Skip to content

Fixed sort issue with nodesWithAnimationManagers. #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CCBReader/CCBReader.h
Original file line number Diff line number Diff line change
@@ -119,7 +119,7 @@ enum
id owner;

CCBAnimationManager* actionManager;
NSMutableDictionary* actionManagers;
NSMutableArray* actionManagers;
NSMutableSet* animatedProps;

// For JavaScript bindings
15 changes: 9 additions & 6 deletions CCBReader/CCBReader.m
Original file line number Diff line number Diff line change
@@ -1142,7 +1142,7 @@ - (void) cleanUpNodeGraph:(CCNode*)node
}
}

- (CCNode*) readFileWithCleanUp:(BOOL)cleanUp actionManagers:(NSMutableDictionary*)am
- (CCNode*) readFileWithCleanUp:(BOOL)cleanUp actionManagers:(NSMutableArray*)am
{
if (![self readHeader]) return NULL;
if (![self readStringCache]) return NULL;
@@ -1152,7 +1152,10 @@ - (CCNode*) readFileWithCleanUp:(BOOL)cleanUp actionManagers:(NSMutableDictionar

CCNode* node = [self readNodeGraphParent:NULL];

[actionManagers setObject:self.actionManager forKey:[NSValue valueWithPointer:node]];
[actionManagers addObject:[NSDictionary dictionaryWithObjectsAndKeys:
self.actionManager, @"manager",
node, @"node",
nil]];

if (cleanUp)
{
@@ -1194,7 +1197,7 @@ - (CCNode*) nodeGraphFromData:(NSData*)d owner:(id)o parentSize:(CGSize) parentS
ownerCallbackNames = [[NSMutableArray alloc] init];
ownerCallbackNodes = [[NSMutableArray alloc] init];

NSMutableDictionary* animationManagers = [NSMutableDictionary dictionary];
NSMutableArray* animationManagers = [NSMutableArray array];
CCNode* nodeGraph = [self readFileWithCleanUp:YES actionManagers:animationManagers];

if (nodeGraph && self.actionManager.autoPlaySequenceId != -1 && !jsControlled)
@@ -1209,11 +1212,11 @@ - (CCNode*) nodeGraphFromData:(NSData*)d owner:(id)o parentSize:(CGSize) parentS
nodesWithAnimationManagers = [[NSMutableArray alloc] init];
animationManagersForNodes = [[NSMutableArray alloc] init];
}
for (NSValue* pointerValue in animationManagers)
for (NSDictionary *dict in animationManagers)
{
CCNode* node = [pointerValue pointerValue];
CCNode* node = [dict objectForKey:@"node"];

CCBAnimationManager* manager = [animationManagers objectForKey:pointerValue];
CCBAnimationManager* manager = [dict objectForKey:@"manager"];
node.userObject = manager;

if (jsControlled)