2048
2048 copied to clipboard
Tiles out of sync
To reproduce this bug, just swipe really fast on the device. I'm not really sure how to go about fixing this.
when the new swip begin, enumerate all M2Tile to check if need remove or relayout
- (void)clearForNewUnserInteraction
{
// 移除的
if (_destRemove) {
[self removeAllActions];
[_pendingActions removeAllObjects];
[self runAction:[SKAction removeFromParent] completion:^{
[self removeFromParentCell];
}];
}
// 移动的
else if (_pendingActions.count > 0 /* 移动的 */ || [self hasActions] /* 新增的 */) {
[self removeAllActions];
[_pendingActions removeAllObjects];
SKAction *layout = [SKAction runBlock:^{
self.position = [GSTATE locationOfPosition:self.cell.position];
[self setScale:1];
[self updateLevelTo:self.level];
}];
[self runAction:layout completion:^{
if (_pendingBlock) {
_pendingBlock();
_pendingBlock = nil;
}
}];
}
}
you can check out my fork
Thanks man
Sent from my iPhone
On May 27, 2015, at 8:40 PM, chenshengzhi [email protected] wrote:
when the new swip begin, enumerate all M2Tile to check if need remove or relayout
(void)clearForNewUnserInteraction { // 移除的 if (_destRemove) { [self removeAllActions]; [_pendingActions removeAllObjects]; [self runAction:[SKAction removeFromParent] completion:^{ [self removeFromParentCell]; }]; } // 移动的 else if (_pendingActions.count > 0 /* 移动的 / || [self hasActions] / 新增的 */) { [self removeAllActions]; [_pendingActions removeAllObjects];
SKAction *layout = [SKAction runBlock:^{ self.position = [GSTATE locationOfPosition:self.cell.position]; [self setScale:1]; [self updateLevelTo:self.level]; }]; [self runAction:layout completion:^{ if (_pendingBlock) { _pendingBlock(); _pendingBlock = nil; } }];
} } you can check out my fork
— Reply to this email directly or view it on GitHub.