public static CCMenuItemToggle itemWithItem(CCMenuItem item) { CCMenuItemToggle cCMenuItemToggle = new CCMenuItemToggle(); cCMenuItemToggle.initWithItem(item); return(cCMenuItemToggle); }
/// <summary> /// creates a menu item from a list of items with a target/selector /// </summary> public static CCMenuItemToggle itemWithTarget(SelectorProtocol target, SEL_MenuHandler selector, params CCMenuItem[] items) { CCMenuItemToggle pRet = new CCMenuItemToggle(); pRet.initWithTarget(target, selector, items); return(pRet); }
public override void OnEnter() { base.OnEnter(); CCSize s = CCDirector.SharedDirector.WinSize; var label = new CCLabelTTF(title(), "arial", 32); AddChild(label, 0, kTagLabel); label.Position = new CCPoint(s.Width / 2, s.Height - 50); string subTitle = this.subtitle(); if (subTitle.Length > 0) { var l = new CCLabelTTF(subTitle, "arial", 16); AddChild(l, 1); l.Position = new CCPoint(s.Width / 2, s.Height - 80); } var item1 = new CCMenuItemImage(s_pPathB1, s_pPathB2, backCallback); var item2 = new CCMenuItemImage(s_pPathR1, s_pPathR2, restartCallback); var item3 = new CCMenuItemImage(s_pPathF1, s_pPathF2, nextCallback); var menu = new CCMenu(item1, item2, item3); menu.Position = CCPoint.Zero; item1.Position = new CCPoint(s.Width / 2 - item2.ContentSize.Width * 2, item2.ContentSize.Height / 2); item2.Position = new CCPoint(s.Width / 2, item2.ContentSize.Height / 2); item3.Position = new CCPoint(s.Width / 2 + item2.ContentSize.Width * 2, item2.ContentSize.Height / 2); AddChild(menu, 1); var itemMode = new CCMenuItemToggle(modeCallback, new CCMenuItemFont("Use High Quality Mode"), new CCMenuItemFont("Use Fast Mode") ); var menuMode = new CCMenu(itemMode); AddChild(menuMode); menuMode.Position = new CCPoint(s.Width / 2, s.Height / 4); }
public MenuLayer4() { CCMenuItemFont.FontName = "arial"; CCMenuItemFont.FontSize = 18; CCMenuItemFont title1 = new CCMenuItemFont("Sound"); title1.Enabled = false; CCMenuItemFont.FontName = "arial"; CCMenuItemFont.FontSize = 34; CCMenuItemToggle item1 = new CCMenuItemToggle(this.menuCallback, new CCMenuItemFont("On"), new CCMenuItemFont("Off")); CCMenuItemFont.FontName = "arial"; CCMenuItemFont.FontSize = 18; CCMenuItemFont title2 = new CCMenuItemFont("Music"); title2.Enabled = false; CCMenuItemFont.FontName = "arial"; CCMenuItemFont.FontSize = 34; CCMenuItemToggle item2 = new CCMenuItemToggle(this.menuCallback, new CCMenuItemFont("On"), new CCMenuItemFont("Off")); CCMenuItemFont.FontName = "arial"; CCMenuItemFont.FontSize = 18; CCMenuItemFont title3 = new CCMenuItemFont("Quality"); title3.Enabled = false; CCMenuItemFont.FontName = "arial"; CCMenuItemFont.FontSize = 34; CCMenuItemToggle item3 = new CCMenuItemToggle(this.menuCallback, new CCMenuItemFont("High"), new CCMenuItemFont("Low")); CCMenuItemFont.FontName = "arial"; CCMenuItemFont.FontSize = 18; CCMenuItemFont title4 = new CCMenuItemFont("Orientation"); title4.Enabled = false; CCMenuItemFont.FontName = "arial"; CCMenuItemFont.FontSize = 34; CCMenuItemToggle item4 = new CCMenuItemToggle(this.menuCallback, new CCMenuItemFont("Off")); item4.SubItems.Add(new CCMenuItemFont("33%")); item4.SubItems.Add(new CCMenuItemFont("66%")); item4.SubItems.Add(new CCMenuItemFont("100%")); // you can change the one of the items by doing this item4.SelectedIndex = 2; CCMenuItemFont.FontName = "arial"; CCMenuItemFont.FontSize = 34; CCLabelBMFont label = new CCLabelBMFont("go back", "fonts/bitmapFontTest3.fnt"); CCMenuItemLabel back = new CCMenuItemLabel(label, this.backCallback); CCMenu menu = new CCMenu( title1, title2, item1, item2, title3, title4, item3, item4, back); // 9 items. menu.AlignItemsInColumns(2, 2, 2, 2, 1); AddChild(menu); }
public ParticleDemo() { InitWithColor(CCTypes.CreateColor(127, 127, 127, 255)); m_emitter = null; TouchEnabled = true; CCSize s = CCDirector.SharedDirector.WinSize; CCLabelTTF label = new CCLabelTTF(title(), "arial", 28); AddChild(label, 100, 1000); label.Position = new CCPoint(s.Width / 2, s.Height - 50); CCLabelTTF tapScreen = new CCLabelTTF(subtitle(), "arial", 20); tapScreen.Position = new CCPoint(s.Width / 2, s.Height - 80); AddChild(tapScreen, 100); CCMenuItemImage item1 = new CCMenuItemImage(TestResource.s_pPathB1, TestResource.s_pPathB2, backCallback); CCMenuItemImage item2 = new CCMenuItemImage(TestResource.s_pPathR1, TestResource.s_pPathR2, restartCallback); CCMenuItemImage item3 = new CCMenuItemImage(TestResource.s_pPathF1, TestResource.s_pPathF2, nextCallback); CCMenuItemToggle item4 = new CCMenuItemToggle(toggleCallback, new CCMenuItemFont("Free Movement"), new CCMenuItemFont("Relative Movement"), new CCMenuItemFont("Grouped Movement")); CCMenu menu = new CCMenu(item1, item2, item3, item4); menu.Position = new CCPoint(0, 0); 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); item4.Position = new CCPoint(0, 100); item4.AnchorPoint = new CCPoint(0, 0); AddChild(menu, 100); CCLabelAtlas labelAtlas; try { labelAtlas = new CCLabelAtlas("0000", "Images/fps_Images", 16, 24, '.'); } catch (Exception) { labelAtlas = new CCLabelAtlas("0000", "Images/fps_Images", 16, 24, '.'); } AddChild(labelAtlas, 100, ParticleTestScene.kTagLabelAtlas); labelAtlas.Position = new CCPoint(s.Width - 66, 50); // moving background m_background = new CCSprite(TestResource.s_back3); AddChild(m_background, 5); m_background.Position = new CCPoint(s.Width / 2, s.Height - 180); CCActionInterval move = new CCMoveBy (4, new CCPoint(300, 0)); CCFiniteTimeAction move_back = move.Reverse(); CCFiniteTimeAction seq = CCSequence.FromActions(move, move_back); m_background.RunAction(new CCRepeatForever ((CCActionInterval) seq)); Schedule(step); }
/// <summary> /// creates a menu item from a list of items with a target/selector /// </summary> public static CCMenuItemToggle itemWithTarget(SelectorProtocol target, SEL_MenuHandler selector, params CCMenuItem[] items) { CCMenuItemToggle pRet = new CCMenuItemToggle(); pRet.initWithTarget(target, selector, items); return pRet; }
/// <summary> /// The follow methods offered to lua /// creates a menu item with a item /// </summary> public static CCMenuItemToggle itemWithItem(CCMenuItem item) { CCMenuItemToggle pRet = new CCMenuItemToggle(); pRet.initWithItem(item); return pRet; }
public static CCMenuItemToggle Create(CCMenuItem item) { var pRet = new CCMenuItemToggle(); pRet.InitWithItem(item); return pRet; }
public static CCMenuItemToggle Create(SEL_MenuHandler selector, params CCMenuItem[] items) { var pRet = new CCMenuItemToggle(); pRet.InitWithTarget(selector, items); return pRet; }
public static new CCMenuItemToggle Create() { var pRet = new CCMenuItemToggle(); pRet.InitWithTarget(null); return pRet; }