Exemplo n.º 1
0
        public void PickButton()
        {
            for (int i = 1; i < SceneController.SceneContainer.Scenes.Count; i++)
            {
                GuiButton tmp = new GuiButton(
                    // Texture2D
                    SpriteContainer.sprite["Pixel"],
                    // Position
                    new Vector2(10, 60 * i),
                    // Scale
                    new Vector2(150, 50),
                    // Layer Depth
                    0.9f,
                    // Orgin
                    OriginPositionEnum.BottomLeft,
                    // SpriteFont
                    SpriteContainer.normalFont,
                    // Text
                    SceneController.SceneContainer.Scenes[i].Name,
                    // Font Scale
                    new Vector2(0.4f, 0.4f)
                    );

                // Here we Add the onClick
                // we tell it to load a new scene
                int _sceneNumber = i;
                tmp.OnClick = () =>
                {
                    SceneController.CurrentScene = SceneController.SceneContainer.Scenes[_sceneNumber];
                };

                Instantiate(tmp);
            }
        }
Exemplo n.º 2
0
        public void MakeWorldEditorUI()
        {
            #region Button Panel
            // Button Image Panel
            GuiImagePanel buttonImagePanel = new GuiImagePanel(
                // Texture2D
                SpriteContainer.sprite["Pixel"],
                // Position
                new Vector2(0, GraphicsSetting.ScreenSize.Y),
                // Scale
                new Vector2(GraphicsSetting.ScreenSize.X, 100),
                // Layer Depth
                0.5f,
                // Origin
                OriginPositionEnum.BottomLeft
                );
            Instantiate(buttonImagePanel);
            #endregion

            #region Tile
            // Made Tile
            for (int i = 0; i < 4; i++)
            {
                GuiButton guiButton = new GuiButton(
                    // Texture2D
                    SpriteContainer.sprite["Pixel"],
                    // Position
                    new Vector2(50 + i * 100, -85),
                    // Scale
                    new Vector2(70, 70),
                    // Layer Depth
                    0.9f,
                    // Origin
                    OriginPositionEnum.TopLeft
                    );

                guiButton.ParentGUI           = buttonImagePanel;
                guiButton.Transform.Position += buttonImagePanel.Transform.Position;
                guiButton.Color           = Color.Blue;
                guiButton.IsHoveringColor = Color.Red;

                Instantiate(guiButton);
            }
            #endregion
        }
Exemplo n.º 3
0
        public void MadeThis()
        {
            // - - - - - Show Currency Image
            imagePanel = new GuiImagePanel(
                // Texture2D
                SpriteContainer.sprite["Pixel"],
                // Position
                new Vector2(
                    GraphicsSetting.ScreenSize.X / 2 - 300,
                    GraphicsSetting.ScreenSize.Y - 550),
                // Scale
                new Vector2(600f, 350f),
                // Layer Depth
                0.999f,
                // Origin
                OriginPositionEnum.TopLeft
                );
            imagePanel.Color = Color.Black;
            Instantiate(imagePanel);

            string startText = "Move Camera With\n" +
                               "W A S D keys\n\n" +
                               "Left Click to set tower.\n" +
                               "You cant delete towers so be careful";

            // - - - - - Start Info text
            startInfoText = new GuiText(
                // SpriteFont
                SpriteContainer.normalFont,
                // Texture2D
                startText,
                // Position
                new Vector2(
                    imagePanel.Transform.Position.X + 10,
                    imagePanel.Transform.Position.Y + 10
                    ),
                // Scale
                new Vector2(0.6f, 0.6f),
                // Layer Depth
                0.9991f,
                // Origin
                OriginPositionEnum.TopLeft
                );
            startInfoText.Color     = Color.White;
            startInfoText.ParentGUI = imagePanel;
            Instantiate(startInfoText);

            // - - - - - Start Button
            guiButton = new GuiButton(
                // Texture2D
                SpriteContainer.sprite["Pixel"],
                // Position
                new Vector2(
                    imagePanel.Transform.Position.X + imagePanel.Transform.Scale.X / 2,
                    imagePanel.Transform.Position.Y + imagePanel.Transform.Scale.Y - 10
                    ),
                // Scale
                new Vector2(150, 50),
                // Layer Depth
                0.9991f,
                // Origin
                OriginPositionEnum.BottomMid,
                // Sprite font
                SpriteContainer.normalFont,
                // Button Text
                "Start Game",
                // Font Scale
                new Vector2(0.5f, 0.5f)
                );

            guiButton.ParentGUI = imagePanel;
            Instantiate(guiButton);

            guiButton.Color           = Color.White;
            guiButton.FontColor       = Color.Black;
            guiButton.IsHoveringColor = Color.Green;

            guiButton.OnClick = () => {
                myScene.PauseGame      = false;
                imagePanel.IsActive    = false;
                startInfoText.IsActive = false;
            };
        }