public SpriteBatchNodeReorderIssue744() { CCSize s = CCDirector.SharedDirector.WinSize; // Testing issue #744 // http://code.google.com/p/cocos2d-iphone/issues/detail?id=744 CCSpriteBatchNode batch = new CCSpriteBatchNode("Images/grossini_dance_atlas", 15); AddChild(batch, 0, (int)kTags.kTagSpriteBatchNode); CCSprite sprite = new CCSprite(batch.Texture, new CCRect(0, 0, 85, 121)); sprite.Position = (new CCPoint(s.Width / 2, s.Height / 2)); batch.AddChild(sprite, 3); batch.ReorderChild(sprite, 1); }
public SpriteBatchNodeReorder() { List<Object> a = new List<Object>(10); CCSpriteBatchNode asmtest = new CCSpriteBatchNode("animations/ghosts"); for (int i = 0; i < 10; i++) { CCSprite s1 = new CCSprite(asmtest.Texture, new CCRect(0, 0, 50, 50)); a.Add(s1); asmtest.AddChild(s1, 10); } for (int i = 0; i < 10; i++) { if (i != 5) { asmtest.ReorderChild((CCNode) (a[i]), 9); } } int prev = -1; var children = asmtest.Children; CCSprite child; foreach (var item in children) { child = (CCSprite)item; if (child == null) break; int currentIndex = child.AtlasIndex; Debug.Assert(prev == currentIndex - 1, "Child order failed"); ////----UXLOG("children %x - atlasIndex:%d", child, currentIndex); prev = currentIndex; } prev = -1; var sChildren = asmtest.Descendants; foreach (var item in sChildren) { child = (CCSprite)item; if (child == null) break; int currentIndex = child.AtlasIndex; Debug.Assert(prev == currentIndex - 1, "Child order failed"); ////----UXLOG("descendant %x - atlasIndex:%d", child, currentIndex); prev = currentIndex; } }