Inheritance: CCNode
Exemplo n.º 1
0
		private void CreateHowToPlayButton()
		{
			howToButton = new Button (mainLayer);
			howToButton.ButtonStyle = ButtonStyle.LevelSelect;
			howToButton.PositionX = ContentSize.Center.X;
			howToButton.PositionY = 22;
			howToButton.Name = "HelpButton";
			howToButton.Text = "?";
			howToButton.Clicked += HandleHelpClicked;

			mainLayer.AddChild (howToButton);

		}
Exemplo n.º 2
0
		private void CreateHud()
		{
			timer = new Timer ();
			timer.PositionX = this.ContentSize.Center.X;
			timer.PositionY = this.ContentSize.Height - 20;
			hudLayer.AddChild (timer);

			var backButton = new Button (hudLayer);
			backButton.ButtonStyle = ButtonStyle.LeftArrow;
			backButton.Clicked += HandleBackClicked;
			backButton.PositionX = 30;
			backButton.PositionY = ContentSize.Height - 30;
			hudLayer.AddChild (backButton);

		}
		private void RefreshHighlightableObjects()
		{
			highlightableObjects.Clear ();

			var visibleButtons = levelButtons.Where (item => item.Visible);

			highlightableObjects.AddRange (visibleButtons);

			if (navigateLeftButton.Visible)
			{
				highlightableObjects.Add (navigateLeftButton);
			}
			if (navigateRightButton.Visible)
			{
				highlightableObjects.Add (navigateRightButton);
			}
			highlightTarget = null;

		}
Exemplo n.º 4
0
        private void CreateLevelButtons()
        {
            const int buttonsPerPage = 6;
            //得到本页第一个button的序号
            int levelIndex0Based = buttonsPerPage * pageNumber;

            //本页显示的最后一个button的序号
            int maxLevelExclusive = System.Math.Min (levelIndex0Based + 6, LevelManager.Self.NumberOfLevels);
            int buttonIndex = 0;

            float centerX = this.ContentSize.Center.X;
            const float topRowOffsetFromCenter = 16;
            float topRowY = this.ContentSize.Center.Y + topRowOffsetFromCenter;
            const float spacing = 54;

            for (int i = levelIndex0Based; i < maxLevelExclusive; i++)
            {
                var button = new Button (mainLayer);

                // Make it 1-based for non-programmers
                button.LevelNumber = i + 1;

                button.ButtonStyle = ButtonStyle.LevelSelect;

                //因为是横屏,所以坐标的原点在横屏的左下角
                button.PositionX = centerX - spacing + (buttonIndex % 3) * spacing;
                button.PositionY = topRowY - spacing * (buttonIndex / 3);

                button.Name = "LevelButton" + i;
                button.Clicked += HandleButtonClicked;
                levelButtons.Add (button);
                mainLayer.AddChild (button);

                //range from 0-5
                buttonIndex++;
            }
        }
Exemplo n.º 5
0
		private void CreateNavigationButtons()
		{
			const float horizontalDistanceFromEdge = 36;
			const float verticalDistanceFromEdge = 28;

			navigateLeftButton = new Button (mainLayer);
			navigateLeftButton.ButtonStyle = ButtonStyle.LeftArrow;
			navigateLeftButton.PositionX = horizontalDistanceFromEdge;
			navigateLeftButton.PositionY = verticalDistanceFromEdge;
			navigateLeftButton.Name = "NavigateLeftButton";
			navigateLeftButton.Clicked += HandleNavigateLeft;
			mainLayer.AddChild(navigateLeftButton);

			navigateRightButton = new Button (mainLayer);
			navigateRightButton.ButtonStyle = ButtonStyle.RightArrow;
			navigateRightButton.PositionX = ContentSize.Width - horizontalDistanceFromEdge;
			navigateRightButton.PositionY = verticalDistanceFromEdge;
			navigateRightButton.Name = "NavigateLeftButton";
			navigateRightButton.Clicked += HandleNavigateRight;

			mainLayer.AddChild(navigateRightButton);

			UpdateNavigationButtonVisibility ();
		}
Exemplo n.º 6
0
		private void MoveHighlightTo(Button node)
		{
			controllerHighlight.Position = node.Position;
			highlightTarget = node;
		}
Exemplo n.º 7
0
		private void CreateBackButton()
		{
			const float horizontalDistanceFromEdge = 36;
			const float verticalDistanceFromEdge = 28;

			backButton = new Button (mainLayer);
			backButton.ButtonStyle = ButtonStyle.LeftArrow;
			backButton.PositionX = verticalDistanceFromEdge;
			backButton.PositionY = ContentSize.Height - verticalDistanceFromEdge;
			backButton.Name = "backButton";
			backButton.Clicked += HandleBackClicked;
			mainLayer.AddChild (backButton);

		}