Skip to content

Commit

Permalink
Merge pull request #1487 from Catrobat/release-0.6.16
Browse files Browse the repository at this point in the history
Release 0.6.16
  • Loading branch information
m-herold authored Sep 22, 2020
2 parents fc40989 + 15e7ca9 commit d9b8692
Show file tree
Hide file tree
Showing 541 changed files with 14,505 additions and 4,498 deletions.
494 changes: 404 additions & 90 deletions src/Catty.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

42 changes: 42 additions & 0 deletions src/Catty/Condition/WhenBackgroundChangesScript+Condition.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/**
* Copyright (C) 2010-2020 The Catrobat Team
* (http://developer.catrobat.org/credits)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* An additional term exception under section 7 of the GNU Affero
* General Public License, version 3, is available at
* (http://developer.catrobat.org/license_additional_term)
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*/

extension WhenBackgroundChangesScript: CBConditionProtocol {

func checkCondition(formulaInterpreter: FormulaInterpreterProtocol) -> Bool {
guard let backgroundObject = self.object.scene.objects().first else { return false }
guard let currentLook = backgroundObject.spriteNode.currentLook else { return false }

if currentLook.isEqual(to: self.look) {
return true
}
return false
}

func resetCondition() {
// nothing to do
}

func conditionFormulas() -> [Formula] {
[]
}
}
44 changes: 44 additions & 0 deletions src/Catty/Condition/WhenConditionScript+Condition.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* Copyright (C) 2010-2020 The Catrobat Team
* (http://developer.catrobat.org/credits)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* An additional term exception under section 7 of the GNU Affero
* General Public License, version 3, is available at
* (http://developer.catrobat.org/license_additional_term)
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*/

extension WhenConditionScript: CBConditionProtocol {

func checkCondition(formulaInterpreter: FormulaInterpreterProtocol) -> Bool {
let condition = formulaInterpreter.interpretBool(self.condition, for: self.object)

if condition && !self.preCondition {
return false
} else if !condition && !self.preCondition {
self.preCondition = true
}

return condition
}

func resetCondition() {
self.preCondition = false
}

func conditionFormulas() -> [Formula] {
self.getFormulas()
}
}
20 changes: 20 additions & 0 deletions src/Catty/DataModel/Array/SynchronizedArray.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,18 @@ public class SynchronizedArray<Element> {
}
}

public func removeAll() {
queue.async(flags: .barrier) {
self.array.removeAll()
}
}

public func removeSubrange(_ bounds: Range<Int>) {
queue.async(flags: .barrier) {
self.array.removeSubrange(bounds)
}
}

public func insert(_ element: Element, at index: Int) {
queue.async(flags: .barrier) {
self.array.insert(element, at: index)
Expand All @@ -97,6 +109,14 @@ public class SynchronizedArray<Element> {
return result
}

public func enumerated() -> EnumeratedSequence<[Element]> {
var result: EnumeratedSequence<[Element]>?
queue.sync {
result = self.array.enumerated()
}
return result!
}

public func contains(where predicate: (Element) throws -> Bool) rethrows -> Bool {
var result = false
do {
Expand Down
5 changes: 3 additions & 2 deletions src/Catty/DataModel/Bricks/Control/BroadcastBrick.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#import "BroadcastBrick.h"
#import "Util.h"
#import "Pocket_Code-Swift.h"

@implementation BroadcastBrick

Expand All @@ -43,9 +44,9 @@ - (id)initWithMessage:(NSString *)message
- (void)setDefaultValuesForObject:(SpriteObject*)spriteObject
{
if(spriteObject) {
NSArray *messages = [Util allMessagesForProject:spriteObject.project];
NSOrderedSet *messages = [Util allMessagesForProject:spriteObject.scene.project];
if([messages count] > 0)
self.broadcastMessage = [messages objectAtIndex:0];
self.broadcastMessage = [messages firstObject];
else
self.broadcastMessage = @"";
}
Expand Down
4 changes: 2 additions & 2 deletions src/Catty/DataModel/Bricks/Control/BroadcastWaitBrick.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ - (id)initWithMessage:(NSString*)message
- (void)setDefaultValuesForObject:(SpriteObject*)spriteObject
{
if(spriteObject) {
NSArray *messages = [Util allMessagesForProject:spriteObject.project];
NSOrderedSet *messages = [Util allMessagesForProject:spriteObject.scene.project];
if([messages count] > 0)
self.broadcastMessage = [messages objectAtIndex:0];
self.broadcastMessage = [messages firstObject];
else
self.broadcastMessage = @"";
}
Expand Down
1 change: 0 additions & 1 deletion src/Catty/DataModel/Bricks/Data/AddItemToUserListBrick.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#import "AddItemToUserListBrick.h"
#import "Formula.h"
#import "Project.h"
#import "UserDataContainer.h"
#import "Script.h"

@implementation AddItemToUserListBrick
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#import "DeleteItemOfUserListBrick.h"
#import "Formula.h"
#import "Project.h"
#import "UserDataContainer.h"
#import "Script.h"

@implementation DeleteItemOfUserListBrick
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#import "InsertItemIntoUserListBrick.h"
#import "Formula.h"
#import "Project.h"
#import "UserDataContainer.h"
#import "Script.h"

@implementation InsertItemIntoUserListBrick
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#import "ReplaceItemInUserListBrick.h"
#import "Formula.h"
#import "Project.h"
#import "UserDataContainer.h"
#import "Script.h"

@implementation ReplaceItemInUserListBrick
Expand Down
2 changes: 1 addition & 1 deletion src/Catty/DataModel/Bricks/Look/ChangeBrightnessByNBrick.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ - (NSString*)description

- (NSString*)pathForLook:(Look*)look
{
return [NSString stringWithFormat:@"%@images/%@", [self.script.object projectPath], look.fileName];
return [look pathForScene:self.script.object.scene];
}

#pragma mark - Resources
Expand Down
2 changes: 1 addition & 1 deletion src/Catty/DataModel/Bricks/Look/ChangeColorByNBrick.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ - (NSString*)description

- (NSString*)pathForLook:(Look*)look
{
return [NSString stringWithFormat:@"%@images/%@", [self.script.object projectPath], look.fileName];
return [look pathForScene:self.script.object.scene];
}

#pragma mark - Resources
Expand Down
2 changes: 1 addition & 1 deletion src/Catty/DataModel/Bricks/Look/ClearGraphicEffectBrick.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ - (kBrickCategoryType)category

- (NSString*)pathForLook:(Look*)look
{
return [NSString stringWithFormat:@"%@images/%@", [self.script.object projectPath], look.fileName];
return [look pathForScene:self.script.object.scene];
}

#pragma mark - Description
Expand Down
2 changes: 1 addition & 1 deletion src/Catty/DataModel/Bricks/Look/NextLookBrick.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ @implementation NextLookBrick

- (NSString*)pathForLook:(Look*)look
{
return [NSString stringWithFormat:@"%@%@/%@", [self.script.object projectPath], kProjectImagesDirName, look.fileName];
return [look pathForScene:self.script.object.scene];
}

- (NSString*)brickTitle
Expand Down
2 changes: 1 addition & 1 deletion src/Catty/DataModel/Bricks/Look/PreviousLookBrick.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ - (NSString *)brickTitle {

- (NSString*)pathForLook:(Look*)look
{
return [NSString stringWithFormat:@"%@%@/%@", [self.script.object projectPath], kProjectImagesDirName, look.fileName];
return [look pathForScene:self.script.object.scene];
}

#pragma mark - Description
Expand Down
2 changes: 1 addition & 1 deletion src/Catty/DataModel/Bricks/Look/SetBackgroundBrick.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ - (kBrickCategoryType)category

- (NSString*)pathForLook
{
return [NSString stringWithFormat:@"%@%@/%@", [self.script.object projectPath], kProjectImagesDirName, self.look.fileName];
return [self.look pathForScene:self.script.object.scene];
}

#pragma mark - Description
Expand Down
2 changes: 1 addition & 1 deletion src/Catty/DataModel/Bricks/Look/SetBrightnessBrick.m
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ - (void)setDefaultValuesForObject:(SpriteObject*)spriteObject

- (NSString*)pathForLook:(Look*)look
{
return [NSString stringWithFormat:@"%@images/%@", [self.script.object projectPath], look.fileName];
return [look pathForScene:self.script.object.scene];
}

#pragma mark - Description
Expand Down
2 changes: 1 addition & 1 deletion src/Catty/DataModel/Bricks/Look/SetColorBrick.m
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ - (void)setDefaultValuesForObject:(SpriteObject*)spriteObject

- (NSString*)pathForLook:(Look*)look
{
return [NSString stringWithFormat:@"%@images/%@", [self.script.object projectPath], look.fileName];
return [look pathForScene:self.script.object.scene];
}

#pragma mark - Description
Expand Down
2 changes: 1 addition & 1 deletion src/Catty/DataModel/Bricks/Look/SetLookBrick.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ - (kBrickCategoryType)category

- (NSString*)pathForLook
{
return [NSString stringWithFormat:@"%@%@/%@", [self.script.object projectPath], kProjectImagesDirName, self.look.fileName];
return [self.look pathForScene:self.script.object.scene];
}

#pragma mark - Description
Expand Down
35 changes: 35 additions & 0 deletions src/Catty/DataModel/Bricks/Motion/GoToBrick.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* Copyright (C) 2010-2020 The Catrobat Team
* (http://developer.catrobat.org/credits)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* An additional term exception under section 7 of the GNU Affero
* General Public License, version 3, is available at
* (http://developer.catrobat.org/license_additional_term)
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*/

#import "Brick.h"
#import "BrickStaticChoiceProtocol.h"

@class SpriteObject;

@interface GoToBrick : Brick<BrickStaticChoiceProtocol>

@property (nonatomic) int spinnerSelection;
@property (nonatomic, weak) SpriteObject* goToObject;

- (id)initWithChoice:(int)selection;

@end
Loading

0 comments on commit d9b8692

Please sign in to comment.