当前位置: 首页>>代码示例>>C#>>正文


C# CCMenu.AlignItemsHorizontally方法代码示例

本文整理汇总了C#中CocosSharp.CCMenu.AlignItemsHorizontally方法的典型用法代码示例。如果您正苦于以下问题:C# CCMenu.AlignItemsHorizontally方法的具体用法?C# CCMenu.AlignItemsHorizontally怎么用?C# CCMenu.AlignItemsHorizontally使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CocosSharp.CCMenu的用法示例。


在下文中一共展示了CCMenu.AlignItemsHorizontally方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: initWithQuantityOfNodes

        public virtual void initWithQuantityOfNodes(int nNodes)
        {
            //srand(time());
            CCSize s = Layer.VisibleBoundsWorldspace.Size;

            // Title
            var label = new CCLabel(title(), "arial", 32, CCLabelFormat.SpriteFont);
            AddChild(label, 1);
            label.Position = new CCPoint(s.Width / 2, s.Height - 32);
            label.Color = new CCColor3B(255, 255, 40);

            // Subtitle
            string strSubTitle = subtitle();
            if (strSubTitle.Length > 0)
            {
                var l = new CCLabel(strSubTitle, "arial", 16, CCLabelFormat.SpriteFont);
                AddChild(l, 1);
                l.Position = new CCPoint(s.Width / 2, s.Height - 80);
            }

            lastRenderedCount = 0;
            currentQuantityOfNodes = 0;
            quantityOfNodes = nNodes;

			CCMenuItemFont.FontSize = 64;
			CCMenuItemFont.FontName = "arial";

            CCMenuItemFont decrease = new CCMenuItemFont(" - ", onDecrease);
            decrease.Color = new CCColor3B(0, 200, 20);
            CCMenuItemFont increase = new CCMenuItemFont(" + ", onIncrease);
            increase.Color = new CCColor3B(0, 200, 20);

            CCMenu menu = new CCMenu(decrease, increase);
            menu.AlignItemsHorizontally();
            menu.Position = new CCPoint(s.Width / 2, s.Height / 2 + 15);
            AddChild(menu, 1);

            var infoLabel = new CCLabel("0 nodes", "arial", 30, CCLabelFormat.SpriteFont);
            infoLabel.Color = new CCColor3B(0, 200, 20);
            infoLabel.Position = new CCPoint(s.Width / 2, s.Height / 2 - 15);
            AddChild(infoLabel, 1, PerformanceNodeChildrenTest.kTagInfoLayer);

            NodeChildrenMenuLayer pMenu = new NodeChildrenMenuLayer(true, PerformanceNodeChildrenTest.TEST_COUNT, PerformanceNodeChildrenTest.s_nCurCase);
            AddChild(pMenu);

            updateQuantityLabel();
            updateQuantityOfNodes();
        }
开发者ID:haithemaraissia,项目名称:CocosSharp,代码行数:48,代码来源:NodeChildrenMainScene.cs

示例2: AddedToScene


//.........这里部分代码省略.........

				button4 = new CCMenuItemImage(lvlLockedButtonName4, lvlLockedButtonName4, PlayNegativeSound);

			}
			else
			{

				button4 = new CCMenuItemImage(lvlButtonName4, lvlButtonName4, GoToFirstLevelSection4);
			}

			if (GameData.SharedData.CanYouGoToTheFirstLevelOfThisSection(5) == false)
			{

				button5 = new CCMenuItemImage(lvlLockedButtonName5, lvlLockedButtonName5, PlayNegativeSound);

			}
			else
			{

				button5 = new CCMenuItemImage(lvlButtonName5, lvlButtonName5, GoToFirstLevelSection5);
			}

			if (GameData.SharedData.CanYouGoToTheFirstLevelOfThisSection(6) == false)
			{

				button6 = new CCMenuItemImage(lvlLockedButtonName6, lvlLockedButtonName6, PlayNegativeSound);

			}
			else
			{

				button6 = new CCMenuItemImage(lvlButtonName6, lvlButtonName6, GoToFirstLevelSection6);
			}

			if (GameData.SharedData.CanYouGoToTheFirstLevelOfThisSection(7) == false)
			{

				button7 = new CCMenuItemImage(lvlLockedButtonName7, lvlLockedButtonName7, PlayNegativeSound);

			}
			else
			{

				button7 = new CCMenuItemImage(lvlButtonName7, lvlButtonName7, GoToFirstLevelSection7);
			}

			if (GameData.SharedData.CanYouGoToTheFirstLevelOfThisSection(8) == false)
			{

				button8 = new CCMenuItemImage(lvlLockedButtonName8, lvlLockedButtonName8, PlayNegativeSound);

			}
			else
			{

				button8 = new CCMenuItemImage(lvlButtonName8, lvlButtonName8, GoToFirstLevelSection8);
			}

			if (GameData.SharedData.CanYouGoToTheFirstLevelOfThisSection(9) == false)
			{

				button9 = new CCMenuItemImage(lvlLockedButtonName9, lvlLockedButtonName9, PlayNegativeSound);

			}
			else
			{

				button9 = new CCMenuItemImage(lvlButtonName9, lvlButtonName9, GoToFirstLevelSection9);
			}

			if (GameData.SharedData.CanYouGoToTheFirstLevelOfThisSection(10) == false)
			{

				button10 = new CCMenuItemImage(lvlLockedButtonName10, lvlLockedButtonName10, PlayNegativeSound);

			}
			else
			{

				button10 = new CCMenuItemImage(lvlButtonName10, lvlButtonName10, GoToFirstLevelSection10);
			}

			CCMenu Menu = new CCMenu(button1, button2, button3, button4, button5);
			Menu.Position = menu1Position;

			Menu.AlignItemsHorizontally(10);
			AddChild(Menu, 1);

			CCMenu Menu2 = new CCMenu(button6, button7, button8, button9, button10);
			Menu2.Position = menu2Position;
			Menu2.AlignItemsHorizontally(10);
			AddChild(Menu2, 1);


			IsSoundFXMenuItemActive = !GameData.SharedData.AreSoundFXMuted;

			IsVoiceFXMenuActive = !GameData.SharedData.AreVoiceFXMuted;

			IsAmbientFXMenuActive = !GameData.SharedData.AreAmbientFXMuted;
		}
开发者ID:headinthebox,项目名称:cocos-sharp-samples,代码行数:101,代码来源:TheMenu.cs

示例3: initWithSubTest

        public void initWithSubTest(int asubtest, int nNodes)
        {
            //srandom(0);

            subtestNumber = asubtest;
            m_pSubTest = new SubTest();
            m_pSubTest.initWithSubTest(asubtest, this);

            CCSize s = Layer.VisibleBoundsWorldspace.Size;

            lastRenderedCount = 0;
            quantityNodes = 0;

			CCMenuItemFont.FontSize = 64;
			CCMenuItemFont.FontName = "arial";
            CCMenuItemFont decrease = new CCMenuItemFont(" - ", onDecrease);
            decrease.Color = new CCColor3B(0, 200, 20);
            CCMenuItemFont increase = new CCMenuItemFont(" + ", onIncrease);
            increase.Color = new CCColor3B(0, 200, 20);

            CCMenu menu = new CCMenu(decrease, increase);
            menu.AlignItemsHorizontally();
            menu.Position = new CCPoint(s.Width / 2, s.Height - 65);
            AddChild(menu, 1);

            CCLabelTtf infoLabel = new CCLabelTtf("0 nodes", "Marker Felt", 30);
            infoLabel.Color = new CCColor3B(0, 200, 20);
            infoLabel.Position = new CCPoint(s.Width / 2, s.Height - 90);
            AddChild(infoLabel, 1, PerformanceSpriteTest.kTagInfoLayer);

            // add menu
            SpriteMenuLayer pMenu = new SpriteMenuLayer(true, PerformanceSpriteTest.TEST_COUNT, PerformanceSpriteTest.s_nSpriteCurCase);
            AddChild(pMenu, 1, PerformanceSpriteTest.kTagMenuLayer);

            // Sub Tests
			CCMenuItemFont.FontSize = 32;
			CCMenuItemFont.FontName = "arial";
            CCMenu pSubMenu = new CCMenu(null);
            for (int i = 1; i <= 9; ++i)
            {
                //char str[10] = {0};
                var str = string.Format("{0}", i);
                CCMenuItemFont itemFont = new CCMenuItemFont(str, testNCallback);
                itemFont.Tag = i;
                pSubMenu.AddChild(itemFont, 10);

                if (i <= 3)
                    itemFont.Color = new CCColor3B(200, 20, 20);
                else if (i <= 6)
                    itemFont.Color = new CCColor3B(0, 200, 20);
                else
                    itemFont.Color = new CCColor3B(0, 20, 200);
            }

            pSubMenu.AlignItemsHorizontally();
            pSubMenu.Position = new CCPoint(s.Width / 2, 80);
            AddChild(pSubMenu, 2);

            // add title label
            CCLabelTtf label = new CCLabelTtf(title(), "arial", 38);
            AddChild(label, 1);
            label.Position = new CCPoint(s.Width / 2, s.Height - 32);
            label.Color = new CCColor3B(255, 255, 40);

            while (quantityNodes < nNodes)
                onIncrease(this);
        }
开发者ID:h7ing,项目名称:CocosSharp,代码行数:67,代码来源:SpriteMainScene.cs

示例4: AddedToScene

        protected override void AddedToScene()
        {
            base.AddedToScene();

            // ask director the the window size
            var size = VisibleBoundsWorldspace.Size;

            // create and initialize a Label
            label = new CCLabel(LongSentencesExample, "fonts/markerFelt.fnt", new CCSize(size.Width / 3f, 0),
				CCTextAlignment.Center);
            //label.LineBreakWithoutSpace = true;
            arrowsBar = new CCSprite("Images/arrowsBar");
			arrows = new CCSprite("Images/arrows");

			CCMenuItemFont.FontSize = 20;
			CCMenuItemFont.FontName = "arial";
			var longSentences = new CCMenuItemFont("Long Flowing Sentences", stringChanged);
			var lineBreaks = new CCMenuItemFont("Short Sentences With Intentional Line Breaks", stringChanged);
			var mixed = new CCMenuItemFont("Long Sentences Mixed With Intentional Line Breaks", stringChanged);
			var stringMenu = new CCMenu(longSentences, lineBreaks, mixed);
			stringMenu.AlignItemsVertically();

			longSentences.Color = CCColor3B.Red;
			lastSentenceItem = longSentences;
			longSentences.Tag = LongSentences;
			lineBreaks.Tag = LineBreaks;
			mixed.Tag = Mixed;

			CCMenuItemFont.FontSize = 30;

			var left = new CCMenuItemFont("Left", alignmentChanged);
			var center = new CCMenuItemFont("Center", alignmentChanged);
			var right = new CCMenuItemFont("Right", alignmentChanged);

			var alignmentMenu = new CCMenu(left, center, right);
			alignmentMenu.AlignItemsHorizontally(alignmentItemPadding);

			center.Color = CCColor3B.Red;
            lastAlignmentItem = center;
			left.Tag = LeftAlign;
			center.Tag = CenterAlign;
			right.Tag = RightAlign;

			// position the label on the center of the screen
			label.Position = size.Center;

			arrowsBar.Visible = false;

			float arrowsWidth = (ArrowsMax - ArrowsMin) * size.Width;
			arrowsBar.ScaleX = (arrowsWidth / arrowsBar.ContentSize.Width);
			arrowsBar.Position = new CCPoint(((ArrowsMax + ArrowsMin) / 2) * size.Width, label.Position.Y);

			snapArrowsToEdge();

			stringMenu.Position = new CCPoint(size.Width / 2, size.Height - menuItemPaddingCenter);
			alignmentMenu.Position = new CCPoint(size.Width / 2, menuItemPaddingCenter + 15);

			AddChild(label);
			AddChild(arrowsBar);
			AddChild(arrows);
			AddChild(stringMenu);
			AddChild(alignmentMenu);
		}
开发者ID:KevinHeyer,项目名称:CocosSharp,代码行数:63,代码来源:LabelFNTMultiLineAlignment.cs

示例5: initWithSubTest

        public virtual void initWithSubTest(int asubtest, int particles)
        {
            //srandom(0);

            subtestNumber = asubtest;
            CCSize s = Layer.VisibleBoundsWorldspace.Size;

            lastRenderedCount = 0;
            quantityParticles = particles;

			CCMenuItemFont.FontSize = 64;
			CCMenuItemFont.FontName = "arial";
            CCMenuItemFont decrease = new CCMenuItemFont(" - ", onDecrease);
            decrease.Color = new CCColor3B(0, 200, 20);
            CCMenuItemFont increase = new CCMenuItemFont(" + ", onIncrease);
            increase.Color = new CCColor3B(0, 200, 20);

            CCMenu menu = new CCMenu(decrease, increase);
            menu.AlignItemsHorizontally();
            menu.Position = new CCPoint(s.Width / 2, s.Height / 2 + 15);
            AddChild(menu, 1);

            CCLabelTtf infoLabel = new CCLabelTtf("0 nodes", "Marker Felt", 30);
            infoLabel.Color = new CCColor3B(0, 200, 20);
            infoLabel.Position = new CCPoint(s.Width / 2, s.Height - 90);
            AddChild(infoLabel, 1, PerformanceParticleTest.kTagInfoLayer);

            // particles on stage
            CCLabelAtlas labelAtlas = new CCLabelAtlas("0000", "Images/fps_Images", 12, 32, '.');
            AddChild(labelAtlas, 0, PerformanceParticleTest.kTagLabelAtlas);
            labelAtlas.Position = new CCPoint(s.Width - 66, 50);

            // Next Prev Test
            ParticleMenuLayer pMenu = new ParticleMenuLayer(true, PerformanceParticleTest.TEST_COUNT, PerformanceParticleTest.s_nParCurIdx);
            AddChild(pMenu, 1, PerformanceParticleTest.kTagMenuLayer);

            // Sub Tests
			CCMenuItemFont.FontSize = 38;
			CCMenuItemFont.FontName = "arial";
            CCMenu pSubMenu = new CCMenu(null);
            for (int i = 1; i <= 6; ++i)
            {
                //char str[10] = {0};
                string str;
                //sprintf(str, "%d ", i);
                str = string.Format("{0:G}", i);
                CCMenuItemFont itemFont = new CCMenuItemFont(str, testNCallback);
                itemFont.Tag = i;
                pSubMenu.AddChild(itemFont, 10);

                if (i <= 3)
                {
                    itemFont.Color = new CCColor3B(200, 20, 20);
                }
                else
                {
                    itemFont.Color = new CCColor3B(0, 200, 20);
                }
            }
            pSubMenu.AlignItemsHorizontally();
            pSubMenu.Position = new CCPoint(s.Width / 2, 80);
            AddChild(pSubMenu, 2);

            CCLabelTtf label = new CCLabelTtf(title(), "arial", 38);
            AddChild(label, 1);
            label.Position = new CCPoint(s.Width / 2, s.Height - 32);
            label.Color = new CCColor3B(255, 255, 40);

            updateQuantityLabel();
            createParticleSystem();

            Schedule(step);
        }
开发者ID:netonjm,项目名称:CocosSharp,代码行数:73,代码来源:ParticleMainScene.cs


注:本文中的CocosSharp.CCMenu.AlignItemsHorizontally方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。