예제 #1
0
        protected override void OnInitialize(object enterInformation)
        {
            base.OnInitialize(enterInformation);
            _splash = new TimedSplash(Game);

            _mainOverlay = new UiOverlay();
            _mainOverlay.AddElement(new NinePatchImage(new NinePatchSprite(Game.Content.Load <Texture2D>("textures/border"), 12, 12), new Rectangle(0, 200, 200, 220)));
            _mainOverlay.AddElement(new Button2(Game, "Local Game", new Rectangle(20, 215, 160, 35), () => DoTransition(typeof(LocalGameConfigurationState))));
            _mainOverlay.AddElement(new Button2(Game, "Network Game", new Rectangle(20, 250, 160, 35), () => DoTransition(typeof(NetworkGameState))));
            _mainOverlay.AddElement(new Button2(Game, "Options", new Rectangle(20, 285, 160, 35), () => DoTransition(typeof(OptionMenuState))));
            _mainOverlay.AddElement(new Button2(Game, "Credits", new Rectangle(20, 320, 160, 35), () => DoTransition(typeof(CreditsState))));
            _mainOverlay.AddElement(new Button2(Game, "Quit", new Rectangle(20, 355, 160, 35), OnQuitClicked));
            _mainOverlay.Center(Game.GetScreenRectangle(), false, true);
            _mainOverlay.AddInputController(new KeyboardInputController(Game));
            _mainOverlay.AddInputController(new MouseInputController(Game));
        }
예제 #2
0
        public void OnOpening(object enterInformation)
        {
            var graphicsDeviceManager = GameInstance.GetService <GraphicsDeviceManager>();

            graphicsDeviceManager.PreferMultiSampling = true;
            graphicsDeviceManager.ApplyChanges();

            _mainOverlay = new UiOverlay();

            var translation = GameInstance.GetService <TranslationProvider>();

            _mainOverlay.AddElement(new HexagonBackground());
            _mainOverlay.AddElement(new LeftSideButton(translation.CreateValue("System", "StartNewGame"), new Vector2(26, 45), OnStartNewGame));
            _mainOverlay.AddElement(new LeftSideButton(translation.CreateValue("System", "LoadGame"), new Vector2(26, 107), OnLoadGame));
            _mainOverlay.AddElement(new LeftSideButton(translation.CreateValue("System", "Gamejolt"), new Vector2(26, 169), null));
            _mainOverlay.AddElement(new LeftSideButton(translation.CreateValue("System", "Options"), new Vector2(26, 231), null));
            _mainOverlay.AddElement(new LeftSideButton(translation.CreateValue("System", "QuitGame"), new Vector2(26, 293), OnExitGame));

            _mainOverlay.AddInputController(new KeyboardUiInputController());
            _mainOverlay.AutoEnumerateTabIndices();

            _closeDialog = new SelectionDialog(translation.CreateValue("System", "ReallyQuitGameQuestion"), translation.CreateValue("System", "UnsavedChangesLost"), new[]
            {
                new LeftSideButton(translation.CreateValue("System", "No"), new Vector2(50, 50), b =>
                {
                    _mainOverlay.CloseModal();
                }),
                new LeftSideButton(translation.CreateValue("System", "Yes"), new Vector2(50, 100), b =>
                {
                    GameInstance.GetService <ScreenManager>().NotifyQuitGame();
                })
            });

            var bar = new ControlBar();

            bar.AddEntry(translation.CreateValue("System", "Select"), Buttons.A, Keys.Enter);
            _mainOverlay.AddElement(bar);
            _mainOverlay.Show();
        }
예제 #3
0
        public void OnOpening(object enterInformation)
        {
            var graphicsDeviceManager = GameInstance.GetService<GraphicsDeviceManager>();
            graphicsDeviceManager.PreferMultiSampling = true;
            graphicsDeviceManager.ApplyChanges();

            _mainOverlay = new UiOverlay();

            var translation = GameInstance.GetService<TranslationProvider>();

            _mainOverlay.AddElement(new HexagonBackground());
            _mainOverlay.AddElement(new LeftSideButton(translation.CreateValue("System", "StartNewGame"), new Vector2(26, 45), OnStartNewGame));
            _mainOverlay.AddElement(new LeftSideButton(translation.CreateValue("System", "LoadGame"), new Vector2(26, 107), OnLoadGame));
            _mainOverlay.AddElement(new LeftSideButton(translation.CreateValue("System", "Gamejolt"), new Vector2(26, 169), null));
            _mainOverlay.AddElement(new LeftSideButton(translation.CreateValue("System", "Options"), new Vector2(26, 231), null));
            _mainOverlay.AddElement(new LeftSideButton(translation.CreateValue("System", "QuitGame"), new Vector2(26, 293), OnExitGame));

            _mainOverlay.AddInputController(new KeyboardUiInputController());
            _mainOverlay.AutoEnumerateTabIndices();

            _closeDialog = new SelectionDialog(translation.CreateValue("System", "ReallyQuitGameQuestion"), translation.CreateValue("System", "UnsavedChangesLost"), new[]
            {
                new LeftSideButton(translation.CreateValue("System", "No"), new Vector2(50, 50), b =>
                {
                    _mainOverlay.CloseModal();
                }),
                new LeftSideButton(translation.CreateValue("System", "Yes"), new Vector2(50, 100), b =>
                {
                    GameInstance.GetService<ScreenManager>().NotifyQuitGame();
                })
            });

            var bar = new ControlBar();
            bar.AddEntry(translation.CreateValue("System", "Select"), Buttons.A, Keys.Enter);
            _mainOverlay.AddElement(bar);
            _mainOverlay.Show();
        }