public override void OnEnter() { base.OnEnter(); CCSize s = Layer.VisibleBoundsWorldspace.Size; Box2DView view = Box2DView.viewWithEntryID(m_entryID); AddChild(view, 0, kTagBox2DNode); view.Scale = 8; view.AnchorPoint = new CCPoint(0, 0); view.Position = new CCPoint(s.Width / 2, s.Height / 4); //#if (CC_TARGET_PLATFORM == CC_PLATFORM_MARMALADE) // CCLabelBMFont* label = new CCLabelBMFont(view.title().c_str(), "fonts/arial16.fnt"); //#else var label = new CCLabel(view.title(), "arial", 18, CCLabelFormat.SpriteFont); //#endif AddChild(label, 1); label.Position = new CCPoint(s.Width / 2, s.Height - 30); CCMenuItemImage item1 = new CCMenuItemImage("Images/b1", "Images/b2", backCallback); CCMenuItemImage item2 = new CCMenuItemImage("Images/r1", "Images/r2", restartCallback); CCMenuItemImage item3 = new CCMenuItemImage("Images/f1", "Images/f2", nextCallback); CCMenu menu = new CCMenu(item1, item2, item3); menu.Position = CCPoint.Zero; item1.Position = new CCPoint(s.Width / 2 - 100, 30); item2.Position = new CCPoint(s.Width / 2, 30); item3.Position = new CCPoint(s.Width / 2 + 100, 30); AddChild(menu, 1); }
public bool initWithEntryID(int entryId) { CCSize s = CCDirector.SharedDirector.WinSize; m_entryID = entryId; TouchEnabled = true; Box2DView view = Box2DView.viewWithEntryID(entryId); AddChild(view, 0, kTagBox2DNode); view.Scale = 8; view.AnchorPoint = new CCPoint(0, 0); view.Position = new CCPoint(s.Width / 2, s.Height / 4); //#if (CC_TARGET_PLATFORM == CC_PLATFORM_MARMALADE) // CCLabelBMFont* label = new CCLabelBMFont(view.title().c_str(), "fonts/arial16.fnt"); //#else CCLabelTTF label = new CCLabelTTF(view.title(), "arial", 18); //#endif AddChild(label, 1); label.Position = new CCPoint(s.Width / 2, s.Height - 12); CCMenuItemImage item1 = new CCMenuItemImage("Images/b1", "Images/b2", backCallback); CCMenuItemImage item2 = new CCMenuItemImage("Images/r1", "Images/r2", restartCallback); CCMenuItemImage item3 = new CCMenuItemImage("Images/f1", "Images/f2", nextCallback); CCMenu menu = new CCMenu(item1, item2, item3); menu.Position = CCPoint.Zero; item1.Position = new CCPoint(s.Width / 2 - 100, 30); item2.Position = new CCPoint(s.Width / 2, 30); item3.Position = new CCPoint(s.Width / 2 + 100, 30); AddChild(menu, 1); return(true); }