Ejemplo n.º 1
0
        public override void Update(MouseState Mouse, KeyboardState KeyBoard, GameTime gameTime)
        {
            if (KeyBoard.IsKeyUp(Config.Controls.ShowMenu) && PasteKeyboard.IsKeyDown(Config.Controls.ShowMenu))
            {
                W.TogglePauseGame();
            }

            if (KeyBoard.IsKeyUp(Config.Controls.ShowChat) && PasteKeyboard.IsKeyDown(Config.Controls.ShowChat))
            {
                if (cManager.CurrentContainerKey == "GameUI")
                {
                    W.Pause = true;
                    cManager.SwitchContainer("Chat");
                }
            }

            PasteKeyboard = KeyBoard;

            cManager.Update(Mouse, KeyBoard, gameTime);



            if (cManager.CurrentContainerKey == "Option")
            {
                OptionMenuManager.Update(Mouse, KeyBoard, gameTime);
            }



            base.Update(Mouse, KeyBoard, gameTime);
        }
Ejemplo n.º 2
0
        public GameUI(WorldScene _WorldScene)
        {
            W = _WorldScene;

            cManager = new UI.ContainerManager();

            //PauseMenu
            PauseMenu = new UI.Container(new Rectangle(-256, -206, 512, 412), false, UI.Dock.Center, Color.White);

            PauseLabTitle = new UI.Controls.Label("Pause", 480, 16, 16, UI.helper.Alignment.Center, UI.helper.Style.DropShadow, Color.White);

            PauseButResume = new UI.Controls.Button("Reprendre", 480, 16, 96, Color.White);
            PauseButResume.OnMouseClick += ResumeGame;
            PauseButSave   = new UI.Controls.Button("Sauvegarder", 480, 16, 174, Color.White);
            PauseButOption = new UI.Controls.Button("Option", 480, 16, 256, Color.White);
            PauseButOption.OnMouseClick += ShowOption;
            PauseButQuit = new UI.Controls.Button("Quitter", 480, 16, 336, Color.White);
            PauseButQuit.OnMouseClick += PauseButQuit_OnMouseClick;

            PauseMenu.Controls.Add(PauseLabTitle);
            PauseMenu.Controls.Add(PauseButResume);
            PauseMenu.Controls.Add(PauseButSave);
            PauseMenu.Controls.Add(PauseButOption);
            PauseMenu.Controls.Add(PauseButQuit);

            //Option
            cManager.AddContainer("Option", Scene.SceneManager.MainMn.OptionContainer);
            OptionMenuManager = Scene.SceneManager.MainMn.OptionMenuManager;
            Scene.SceneManager.MainMn.OptionBackButton.OnMouseClick += OptionBack;

            cManager.AddContainer("PauseMenu", PauseMenu);

            //GameUI

            GameUIContainer = new UI.Container(new Rectangle(0, 0, Common.graphics.PreferredBackBufferWidth, Common.graphics.PreferredBackBufferHeight), false, UI.Dock.UpLeft, Color.White);
            miniMap         = new UI.Controls.MiniMap(16, 16, W);

            GameUIContainer.Controls.Add(miniMap);
            cManager.AddContainer("GameUI", GameUIContainer);

            //Chat

            ChatContainer = new UI.Container(new Rectangle(0, -64, 64, 620), false, UI.Dock.DownLeft, Color.White);
            ChatInput     = new UI.Controls.TextBox("", 32, 0, 0);

            ChatContainer.Controls.Add(ChatInput);
            cManager.AddContainer("Chat", ChatContainer);

            cManager.SwitchContainer("GameUI");
        }
Ejemplo n.º 3
0
 private void playGame()
 {
     MainMenuManager.SwitchContainer("WorldManager");
 }
Ejemplo n.º 4
0
 private void SwitchOptMenu_Game()
 {
     OptionMenuManager.SwitchContainer("Game");
 }
Ejemplo n.º 5
0
        public MainMenu()
        {
            Logo      = ContentEngine.Texture2D("Engine", "Logo");
            MakerLogo = ContentEngine.Texture2D("Engine", "MakerLogo");

            BackgroundSB = new SpriteBatch(Common.GraphicsDevice);
            switch (new Random().Next(3))
            {
            case 0:
                Background = Rendering.ParallaxParse.Parse("Engine", "Dusk Mountain", new Rectangle(0, 0, Common.graphics.PreferredBackBufferWidth, Common.graphics.PreferredBackBufferHeight));
                Core.Audio.SongEngine.SwitchSong("Engine", "A Title");
                break;

            case 1:
                Background = Rendering.ParallaxParse.Parse("Engine", "Forest", new Rectangle(0, 0, Common.graphics.PreferredBackBufferWidth, Common.graphics.PreferredBackBufferHeight));
                Core.Audio.SongEngine.SwitchSong("Engine", "Look Up");
                break;

            case 2:
                Background = Rendering.ParallaxParse.Parse("Engine", "Void", new Rectangle(0, 0, Common.graphics.PreferredBackBufferWidth, Common.graphics.PreferredBackBufferHeight));
                Core.Audio.SongEngine.SwitchSong("Engine", "Clouds of Orange Juice");
                break;

            default:
                break;
            }



            MainMenuManager = new UI.ContainerManager();

            //Main Menu

            MenuContainer = new UI.Container(-256, -120, 512, 240, false, UI.Dock.Center, Color.White);

            MenuButtonPlay = new UI.Controls.Button("Jouer", 480, 16, 16, Color.White);
            MenuButtonOpti = new UI.Controls.Button("Option", 480, 16, 80, Color.White);
            MenuButtonQuit = new UI.Controls.Button("Quitter", 480, 16, 160, Color.White);

            MenuButtonPlay.OnMouseClick += new UI.Control.ClickEventHandler(this.playGame);
            MenuButtonOpti.OnMouseClick += new UI.Control.ClickEventHandler(this.ShowOption);
            MenuButtonQuit.OnMouseClick += new UI.Control.ClickEventHandler(this.ExitGame);

            MenuContainer.Controls.Add(MenuButtonPlay);
            MenuContainer.Controls.Add(MenuButtonOpti);
            MenuContainer.Controls.Add(MenuButtonQuit);

            //Option

            OptionContainer = new UI.Container(16, 16, 288, Common.graphics.PreferredBackBufferHeight - 32, false, UI.Dock.UpLeft, Color.White)
            {
                ShowTitle = true,
                Title     = "Option"
            };



            OptionGameButton  = new UI.Controls.Button("Jeux", 256, 16, 96, Color.White);
            OptionSoundButton = new UI.Controls.Button("Sons", 256, 16, 160, Color.White);
            OptionGraphButton = new UI.Controls.Button("Performances", 256, 16, 224, Color.White);
            OptionInputButton = new UI.Controls.Button("Commandes", 256, 16, 288, Color.White);
            OptionExtButton   = new UI.Controls.Button("Extentions", 256, 16, 352, Color.White);
            OptionOtherButton = new UI.Controls.Button("Autre", 256, 16, 416, Color.White);
            OptionApplyButton = new UI.Controls.Button("Appliquer", 256, 16, OptionContainer.ContainerRect.Height - 64 - 16 - 16 - 64, Color.White);
            OptionBackButton  = new UI.Controls.Button("Retour", 256, 16, OptionContainer.ContainerRect.Height - 64 - 16, Color.White);

            OptionGameButton.OnMouseClick  += new UI.Control.ClickEventHandler(this.SwitchOptMenu_Game);
            OptionSoundButton.OnMouseClick += new UI.Control.ClickEventHandler(this.SwitchOptMenu_Sound);
            OptionGraphButton.OnMouseClick += new UI.Control.ClickEventHandler(this.SwitchOptMenu_Gfx);
            OptionInputButton.OnMouseClick += new UI.Control.ClickEventHandler(this.SwitchOptMenu_Input);
            OptionOtherButton.OnMouseClick += new UI.Control.ClickEventHandler(this.SwitchOptMenu_Other);
            OptionApplyButton.OnMouseClick += new UI.Control.ClickEventHandler(this.Apply);
            OptionBackButton.OnMouseClick  += new UI.Control.ClickEventHandler(this.GoBackToMain);
            OptionExtButton.OnMouseClick   += new UI.Control.ClickEventHandler(this.SwitchOptMenu_Ext);

            OptionContainer.Controls.Add(OptionBackButton);
            OptionContainer.Controls.Add(OptionOtherButton);
            OptionContainer.Controls.Add(OptionGameButton);
            OptionContainer.Controls.Add(OptionGraphButton);
            OptionContainer.Controls.Add(OptionInputButton);
            OptionContainer.Controls.Add(OptionApplyButton);
            OptionContainer.Controls.Add(OptionSoundButton);
            OptionContainer.Controls.Add(OptionExtButton);

            #region OptionPanel
            //=======================================================================================================================================
            OptionMenuManager = new UI.ContainerManager();

            //=====Game=====
            GameOptionContainer = new UI.Container(new Rectangle(320, 16, Common.graphics.PreferredBackBufferWidth - 336, Common.graphics.PreferredBackBufferHeight - 32), true, UI.Dock.UpLeft, Color.White);
            GameOptionTitle     = new UI.Controls.Label("Jeux", Common.graphics.PreferredBackBufferWidth - 304, 0, 16, UI.helper.Alignment.Center, UI.helper.Style.DropShadow, Color.White);

            GameOptionContainer.Controls.Add(GameOptionTitle);

            OptionMenuManager.AddContainer("Game", GameOptionContainer);

            //=====sound=====
            SoundOptionContainer    = new UI.Container(new Rectangle(320, 16, Common.graphics.PreferredBackBufferWidth - 336, Common.graphics.PreferredBackBufferHeight - 32), true, UI.Dock.UpLeft, Color.White);
            SoundOptionTitle        = new UI.Controls.Label("Music et sons", SoundOptionContainer.ContainerRect.Width, 0, 16, UI.helper.Alignment.Center, UI.helper.Style.DropShadow, Color.White);
            SoundOptionMasterLabel  = new UI.Controls.Label("Volume Principale", SoundOptionContainer.ContainerRect.Width - 64, 32, 96, UI.helper.Alignment.Left, UI.helper.Style.Regular, Color.White);
            SoundOptionMasterSlider = new UI.Controls.Slider(32, 160, SoundOptionContainer.ContainerRect.Width - 64);

            SoundOptionContainer.Controls.Add(SoundOptionTitle);
            SoundOptionContainer.Controls.Add(SoundOptionMasterLabel);
            SoundOptionContainer.Controls.Add(SoundOptionMasterSlider);

            OptionMenuManager.AddContainer("Sound", SoundOptionContainer);

            //=====Perf=====
            PerfOptionContainer = new UI.Container(new Rectangle(320, 16, Common.graphics.PreferredBackBufferWidth - 336, Common.graphics.PreferredBackBufferHeight - 32), true, UI.Dock.UpLeft, Color.White);
            PerfOptionTitle     = new UI.Controls.Label("Graphisme", PerfOptionContainer.ContainerRect.Width, 0, 16, UI.helper.Alignment.Center, UI.helper.Style.DropShadow, Color.White);

            PerfOptionContainer.Controls.Add(PerfOptionTitle);

            OptionMenuManager.AddContainer("Gfx", PerfOptionContainer);

            //=====Inputs=====
            InputOptionContainer = new UI.Container(new Rectangle(320, 16, Common.graphics.PreferredBackBufferWidth - 336, Common.graphics.PreferredBackBufferHeight - 32), true, UI.Dock.UpLeft, Color.White);
            InputOptionTitle     = new UI.Controls.Label("Commande", InputOptionContainer.ContainerRect.Width, 0, 16, UI.helper.Alignment.Center, UI.helper.Style.DropShadow, Color.White);

            InputOptionContainer.Controls.Add(InputOptionTitle);

            OptionMenuManager.AddContainer("Input", InputOptionContainer);

            //PlEdit

            OptExtContainer = new UI.Container(new Rectangle(320, 16, Common.graphics.PreferredBackBufferWidth - 336, Common.graphics.PreferredBackBufferHeight - 32), true, UI.Dock.UpLeft, Color.White)
            {
                ShowTitle = true,
                Title     = "Extentions"
            };

            OptExtShowPlEdit = new UI.Controls.Button("Ouvrir l'éditeur de code", 320, 16, 96, Color.White);
            OptExtShowPlEdit.OnMouseClick += ShowCodeEdit;

            OptExtReloadEngine = new UI.Controls.Button("Recharger le moteur", 320, 16, 160, Color.White);
            OptExtReloadEngine.OnMouseClick += ReloadEngine;

            OptExtContainer.Controls.Add(OptExtReloadEngine);
            OptExtContainer.Controls.Add(OptExtShowPlEdit);
            OptionMenuManager.AddContainer("Ext", OptExtContainer);

            //=====Other=====
            OtherOptionContainer = new UI.Container(new Rectangle(320, 16, Common.graphics.PreferredBackBufferWidth - 336, Common.graphics.PreferredBackBufferHeight - 32), true, UI.Dock.UpLeft, Color.White);
            OtherOptionTitle     = new UI.Controls.Label("Autre", OtherOptionContainer.ContainerRect.Width, 0, 16, UI.helper.Alignment.Center, UI.helper.Style.DropShadow, Color.White);

            OtherOptionDebugFrameCounter       = new UI.Controls.CheckBox("Conteur d'ips", Config.Debug.FrameCounter, 256, 16, 96);
            OtherOptionDebugGuiFrame           = new UI.Controls.CheckBox("Contours des interfaces", Config.Debug.GuiFrame, 256, 16, 176);
            OtherOptionDebugWorldOverDraw      = new UI.Controls.CheckBox("Limites des Chunks", Config.Debug.WorldOverDraw, 256, 16, 256);
            OtherOptionDebugWorldFocusLocation = new UI.Controls.CheckBox("Afficher l'objet central de la camera", Config.Debug.WorldFocusLocation, 256, 16, 336);
            OtherOptionDebugWaterMark          = new UI.Controls.CheckBox("Information Avancées", Config.Debug.DebugWaterMark, 256, 16, 416);


            OtherOptionContainer.Controls.Add(OtherOptionTitle);
            OtherOptionContainer.Controls.Add(OtherOptionDebugFrameCounter);
            OtherOptionContainer.Controls.Add(OtherOptionDebugGuiFrame);
            OtherOptionContainer.Controls.Add(OtherOptionDebugWorldOverDraw);
            OtherOptionContainer.Controls.Add(OtherOptionDebugWorldFocusLocation);
            OtherOptionContainer.Controls.Add(OtherOptionDebugWaterMark);

            OptionMenuManager.AddContainer("Other", OtherOptionContainer);

            OptionMenuManager.SwitchContainer("Game");

            //=======================================================================================================================================
            #endregion

            //World Manager

            WrlMngrContainer = new UI.Container(Common.graphics.PreferredBackBufferWidth / 2 - 512, 64, 1024, Common.graphics.PreferredBackBufferHeight - 128, true, UI.Dock.UpLeft, Color.White);

            MngrLoadButton = new UI.Controls.Button("Charger", 330, 16, WrlMngrContainer.ContainerRect.Height - 160 + 16, Color.White);
            MngrNewButton  = new UI.Controls.Button("Nouveau", 330, 347, WrlMngrContainer.ContainerRect.Height - 160 + 16, Color.White);
            MngrDelButton  = new UI.Controls.Button("Supprimer", 330, 678, WrlMngrContainer.ContainerRect.Height - 160 + 16, Color.White);
            MngrDoneButton = new UI.Controls.Button("Retour", WrlMngrContainer.ContainerRect.Width - 32, 16, WrlMngrContainer.ContainerRect.Height - 64 - 16, Color.White);
            MngrLabel      = new UI.Controls.Label("Mes Mondes", 320, WrlMngrContainer.ContainerRect.Width / 2 - 160, 16, UI.helper.Alignment.Center, UI.helper.Style.DropShadow, Color.White);


            MngrDoneButton.OnMouseClick += new UI.Control.ClickEventHandler(this.GoBackToMain);
            MngrNewButton.OnMouseClick  += new UI.Control.ClickEventHandler(this.ShowCreateWorld);

            WrlMngrContainer.Controls.Add(MngrLoadButton);
            WrlMngrContainer.Controls.Add(MngrNewButton);
            WrlMngrContainer.Controls.Add(MngrDelButton);
            WrlMngrContainer.Controls.Add(MngrDoneButton);
            WrlMngrContainer.Controls.Add(MngrLabel);

            //new World

            NewWrldContainer = new UI.Container(Common.graphics.PreferredBackBufferWidth / 2 - 512, 64, 1024, Common.graphics.PreferredBackBufferHeight - 128, true, UI.Dock.UpLeft, Color.White);

            NewWrldTitleLabel = new UI.Controls.Label("Créer Un Nouveau Monde", 320, NewWrldContainer.ContainerRect.Width / 2 - 160, 16, UI.helper.Alignment.Center, UI.helper.Style.DropShadow, Color.White);

            NewWrldNameLabel   = new UI.Controls.Label("Nom du monde", 800, NewWrldContainer.ContainerRect.Width / 2 - 400, 96, UI.helper.Alignment.Left, UI.helper.Style.Regular, Color.White);
            NewWrldNameTextBox = new UI.Controls.TextBox("Monde", 64, NewWrldContainer.ContainerRect.Width / 2 - 400, 160);

            NewWrldSeedlabel   = new UI.Controls.Label("Graine pour la génération du monde", 800, NewWrldContainer.ContainerRect.Width / 2 - 400, 240, UI.helper.Alignment.Left, UI.helper.Style.Regular, Color.White);
            NewWrldSeedTextBox = new UI.Controls.TextBox("123456789", 64, NewWrldContainer.ContainerRect.Width / 2 - 400, 304); //800px

            NewWrldCreateButton = new UI.Controls.Button("Créer le nouveau Monde", 496, 16, NewWrldContainer.ContainerRect.Height - 64 - 16, Color.White);
            NewWrldCancelButton = new UI.Controls.Button("Retour", 496, 512, NewWrldContainer.ContainerRect.Height - 64 - 16, Color.White);

            NewWrldStorieMode = new UI.Controls.CheckBox("Créer une histoire", true, 496, 16, NewWrldContainer.ContainerRect.Height - 128 - 16);
            NewWrldCheat      = new UI.Controls.CheckBox("Activé la triche", true, 496, 512, NewWrldContainer.ContainerRect.Height - 128 - 16);

            NewWrldCancelButton.OnMouseClick += new UI.Control.ClickEventHandler(this.GoBackToWorldManager);
            NewWrldCreateButton.OnMouseClick += new UI.Control.ClickEventHandler(this.CreateWorld);

            NewWrldContainer.Controls.Add(NewWrldTitleLabel);
            NewWrldContainer.Controls.Add(NewWrldSeedlabel);
            NewWrldContainer.Controls.Add(NewWrldNameLabel);
            NewWrldContainer.Controls.Add(NewWrldSeedTextBox);
            NewWrldContainer.Controls.Add(NewWrldNameTextBox);
            NewWrldContainer.Controls.Add(NewWrldCreateButton);
            NewWrldContainer.Controls.Add(NewWrldCancelButton);

            NewWrldContainer.Controls.Add(NewWrldCheat);
            NewWrldContainer.Controls.Add(NewWrldStorieMode);

            //intialize Container Manager
            MainMenuManager.AddContainer("MainMenu", MenuContainer);
            MainMenuManager.AddContainer("Option", OptionContainer);
            MainMenuManager.AddContainer("WorldManager", WrlMngrContainer);
            MainMenuManager.AddContainer("NewWorld", NewWrldContainer);

            MainMenuManager.SwitchContainer("MainMenu");
        }