public static CCMenuItemToggle Create(CCMenuItem item)
        {
            var pRet = new CCMenuItemToggle();

            pRet.InitWithItem(item);
            return(pRet);
        }
Example #2
0
        public LayerGradient()
        {
            CCLayerGradient layer1 = new CCLayerGradient(new CCColor4B(255, 0, 0, 255), new CCColor4B(0, 255, 0, 255), new CCPoint(0.9f, 0.9f));

            AddChild(layer1, 0, kTagLayer);

            this.TouchEnabled = true;

            CCLabelTTF label1 = new CCLabelTTF("Compressed Interpolation: Enabled", "arial", 26);
            CCLabelTTF label2 = new CCLabelTTF("Compressed Interpolation: Disabled", "arial", 26);
            CCMenuItemLabel item1 = new CCMenuItemLabel(label1);
            CCMenuItemLabel item2 = new CCMenuItemLabel(label2);
            CCMenuItemToggle item = new CCMenuItemToggle((toggleItem), item1, item2);

            CCMenu menu = new CCMenu(item);
            AddChild(menu);
            CCSize s = CCDirector.SharedDirector.WinSize;
            menu.Position = (new CCPoint(s.Width / 2, 100));
        }
Example #3
0
        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, kLabelTag);
            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 = new CCLabelAtlas("0000", "Images/fps_Images", 12, 32, '.');
            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 = new CCSequence(move, move_back);
            m_background.RunAction(new CCRepeatForever ((CCActionInterval) seq));

            Schedule(step);
        }
Example #4
0
 public static CCMenuItemToggle Create(CCMenuItem item)
 {
     var pRet = new CCMenuItemToggle();
     pRet.InitWithItem(item);
     return pRet;
 }
Example #5
0
        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);
        }
Example #6
0
        public MenuLayer5()
        {
            var randomFilterMenuItem = CocosExtensions.CreateScaledMenuItemLabel(_targetButtonSize, 20, 4, CCColor3B.Blue, new CCColor3B(Microsoft.Xna.Framework.Color.Black), 
                new CCColor3B(Microsoft.Xna.Framework.Color.White), "Random Surprise!", () =>
            {
                CCLog.Log("Random action");
            });
            CocosExtensions.AddJiggle(randomFilterMenuItem);

            var backMenuItem = CocosExtensions.CreateScaledMenuItemLabel(_targetButtonSize, 20, 4, CCColor3B.Blue, new CCColor3B(Microsoft.Xna.Framework.Color.Black), 
                new CCColor3B(Microsoft.Xna.Framework.Color.White), "Back", null);
            var backMenuItemToggle = new CCMenuItemToggle((o) =>
            {
                CCLog.Log("Back toggle touched");
            },
            new[] { backMenuItem });
            CocosExtensions.AddJiggle(backMenuItemToggle);

            var menu = new CCMenu(new[]
                {
                    randomFilterMenuItem, 
                    backMenuItemToggle, 
                });
            AddChild(menu);
            menu.Position = CCDirector.SharedDirector.WinSize.Center;
            menu.AlignItemsVertically();
        }
        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);
        }