Exemplo n.º 1
0
        protected void RepositionControls()
        {
            LowerSection.Height = 80;
            LowerSection.Width  = MainWindow.Width - 20;

            LeftTwoThirds.PositionComponent(MainWindow, 0, 0);

            // Tuck the store under the character tab buttons in low res.
            if (Engine.SmallScreen && MainWindow.Bounds.xMax + 30 > CharacterInfo.Bounds.xMin)
            {
                MainWindow.Y += 32;
            }

            MainWindow.Y -= LowerSection.Height / 2;

            LowerSection.Y = MainWindow.Y + MainWindow.Height - 12;
            LeftTwoThirds.PositionComponent(LowerSection, 0, null);

            LowerSection.PositionComponent(BackButton, 0, 0);
        }
Exemplo n.º 2
0
        public MainMenuState()
            : base("Main Menu")
        {
            CoM.EnableCamera = true;

            window = new GuiWindow(350, 280);
            window.Background.Sprite = ResourceManager.GetSprite("Gui/InnerWindow");
            window.Background.Color  = Colors.BackgroundRed;

            Add(window, 0, 50);

            GuiLabel title = new GuiLabel(0, 0, "ENDURANCE");

            title.Font           = CoM.Instance.TextFont;
            title.FontSize       = 48;
            title.FontColor      = new Color(1, 1, 1, 0.5f);
            title.DropShadow     = true;
            title.ShadowDistance = 2;
            title.Interactive    = true;
            window.Add(title, 0, 22);

            int       currentButtonPosition = 100;
            const int buttonSpacing         = 50;

            bool needsExitButton  = Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.OSXPlayer || Application.platform == RuntimePlatform.LinuxPlayer;
            bool needsDebugButton = Settings.Advanced.PowerMode;

            // ----------------------------------------

            // ----------------------------------------

            GuiButton PlayButton = new GuiButton("Play");

            window.PositionComponent(PlayButton, 0, currentButtonPosition);
            window.Add(PlayButton);
            currentButtonPosition += buttonSpacing;

            GuiButton SettingsButtton = new GuiButton("Settings");

            window.PositionComponent(SettingsButtton, 0, currentButtonPosition);
            window.Add(SettingsButtton);
            currentButtonPosition += buttonSpacing;

            GuiButton AboutButton = new GuiButton("About");

            window.PositionComponent(AboutButton, 0, currentButtonPosition);
            window.Add(AboutButton);
            currentButtonPosition += buttonSpacing;

            GuiButton ExitButton = new GuiButton("Exit");

            if (needsExitButton)
            {
                window.PositionComponent(ExitButton, 0, currentButtonPosition);
                window.Add(ExitButton);
                currentButtonPosition += buttonSpacing;
                window.Height         += buttonSpacing;
            }

            GuiButton DebugButton = new GuiButton("Debug", 140);

            DebugButton.ColorTransform = ColorTransform.BlackAndWhite;
            DebugButton.Color          = new Color(0.6f, 1.0f, 0.7f);

            if (needsDebugButton)
            {
                window.PositionComponent(DebugButton, 0, currentButtonPosition);
                window.Add(DebugButton);
                window.Height += buttonSpacing;
            }

            title.OnDoubleClicked += delegate {
                if (Settings.Advanced.PowerMode == false)
                {
                    Settings.Advanced.PowerMode = true;
                    window.Add(DebugButton, 0, currentButtonPosition + (4 * buttonSpacing));
                    window.Height += buttonSpacing;
                }
            };

            // ----------------------------------------

            if (Engine.isWeb)
            {
                GuiWindow WebWarningWindow = new GuiWindow(500, 90);
                WebWarningWindow.Add(
                    new GuiLabel(Util.Colorise("Browser preview.\nFor the best experience download the standalone version.", new Color(1f, 0.75f, 0.45f)))
                {
                    TextAlign = TextAnchor.MiddleCenter
                },
                    0, 0);
                Add(WebWarningWindow, 0, -50);
            }

            // ----------------------------------------

            VersionLabel           = new GuiLabel("");
            VersionLabel.FontColor = Color.yellow;
            Add(VersionLabel, -20, 10, true);

            PlayButton.OnMouseClicked += delegate {
                Engine.PushState(new SelectPartyState(true));
            };
            SettingsButtton.OnMouseClicked += delegate {
                Engine.PushState(new SettingsMenuState());
            };
            AboutButton.OnMouseClicked += delegate {
                Engine.PushState(new AboutMenuState());
            };
            ExitButton.OnMouseClicked += delegate {
                Application.Quit();
            };
            DebugButton.OnMouseClicked += delegate {
                Engine.PushState(new DebugMenuState());
            };
            OnStateShow += delegate {
                SoundManager.PlayMusicPlaylist("Intro");
            };

            DefaultControl = PlayButton;

            CoM.Instance.StartCoroutine(updateFadeIn(2f));
        }