public void InitialStartup(ref int progress)
 {
     BoundHandler.Initialize();
     progress++;
     KeyboardHandler.Initialize();
     progress++;
 }
Example #2
0
 /// <summary>
 /// Displays the menu displayed 1 step ahead of the currently displayed menu.
 /// </summary>
 public static void Forward()
 {
     if (DisplayIndex <= Containers.Count)
     {
         DisplayIndex++;
         BoundHandler.Popup(Containers[DisplayIndex]);
     }
 }
Example #3
0
 /// <summary>
 /// Displays the last shown menu.
 /// </summary>
 public static void Back()
 {
     if (DisplayIndex > 0)
     {
         DisplayIndex--;
         BoundHandler.Popup(Containers[DisplayIndex]);
     }
 }
Example #4
0
 public override void Click(MouseEventArgs e)
 {
     ClientSendRecieve.Initialize(new MagicalLifeAPI.Networking.NetworkSettings(JoinGameMenu.menu.IpInputBox.Text, int.Parse(JoinGameMenu.menu.PortInputBox.Text)));
     Client.Load();
     MenuHandler.Clear();
     In_Game_GUI.InGameGUI.Initialize();
     BoundHandler.Popup(In_Game_GUI.InGameGUI.InGame);
 }
Example #5
0
 public override void Click(MouseEventArgs e, GUIContainer container)
 {
     World.Mode = MagicalLifeAPI.Networking.EngineMode.ClientOnly;
     FMODUtil.RaiseEvent(EffectsTable.UIClick);
     ClientSendRecieve.Initialize(new MagicalLifeAPI.Networking.NetworkSettings(JoinGameMenu.menu.IpInputBox.Text, int.Parse(JoinGameMenu.menu.PortInputBox.Text)));
     Client.Load();
     MenuHandler.Clear();
     InGameGUI.Initialize();
     BoundHandler.Popup(InGameGUI.InGame);
 }
Example #6
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            if (this.IsActive)
            {
                BoundHandler.UpdateMouseInput(gameTime);
                KeyboardHandler.UpdateKeyboardInput(gameTime);
            }

            base.Update(gameTime);
        }
Example #7
0
 private void JoinButton_ClickEvent(object sender, Reusable.Event.ClickEventArgs e)
 {
     World.Mode = MagicalLifeAPI.Networking.EngineMode.ClientOnly;
     FMODUtil.RaiseEvent(SoundsTable.UIClick);
     ClientSendRecieve.Initialize(new MagicalLifeAPI.Networking.NetworkSettings(JoinGameMenu.Menu.IpInputBox.Text, int.Parse(JoinGameMenu.Menu.PortInputBox.Text)));
     Client.Load();
     MenuHandler.Clear();
     InGameGUI.Initialize();
     BoundHandler.Popup(InGameGUI.InGame);
 }
Example #8
0
        /// <summary>
        /// Constructs a new instance of the <see cref="GUIElement"/> class.
        /// </summary>
        /// <param name="image">The texture of this GUI element.</param>
        /// <param name="drawingBounds">The bounds for which to draw the texture on the screen at.</param>
        /// <param name="priority">Determines if this GUI element should have priority over other GUI elements when sorting through input.</param>
        public GUIElement(string image, Rectangle drawingBounds, int priority, string font)
        {
            this.DrawingBounds = drawingBounds;
            this.MouseBounds   = new ClickBounds(drawingBounds, priority);
            BoundHandler.AddGUIElement(this);
            this.Image = AssetManager.Textures[AssetManager.GetTextureIndex(image)];

            if (font != null && font != string.Empty)
            {
                this.Font = Game1.AssetManager.Load <SpriteFont>(font);
            }
        }
Example #9
0
 /// <summary>
 /// Displays the last shown menu.
 /// </summary>
 public static void Back()
 {
     if (DisplayIndex > 0 && Containers[DisplayIndex].Child == null)
     {
         DisplayIndex--;
         BoundHandler.Popup(Containers[DisplayIndex]);
     }
     else
     {
         NullChild(BoundHandler.GUIWindows[DisplayIndex]);
     }
 }
Example #10
0
 private void KeyboardHandler_KeysPressed(object sender, Microsoft.Xna.Framework.Input.Keys e)
 {
     if (e == SettingsManager.Keybindings.Settings.OpenActionMenu)
     {
         if (BoundHandler.GUIWindows.Contains(ActionMenu.AMenu))
         {
             BoundHandler.RemoveContainer(ActionMenu.AMenu);
         }
         else
         {
             ActionMenu.Initialize();
         }
     }
 }
Example #11
0
        public override void Click(MouseEventArgs e)
        {
            ServerSendRecieve.Initialize(new MagicalLifeAPI.Networking.NetworkSettings(true));
            Server.Load();
            Client.Load();
            Server.StartGame();
            NewGameInputHandler a = new NewGameInputHandler();

            a.StartNewGame();
            BoundHandler.RemoveContainer(NewWorldMenu.NewWorldMenuM);
            MenuHandler.Clear();
            BoundHandler.HideAll();
            In_Game_GUI.InGameGUI.Initialize();
            BoundHandler.Popup(In_Game_GUI.InGameGUI.InGame);
        }
Example #12
0
        /// <summary>
        /// Initializes a new GUIElement to draw onto the screen.
        /// </summary>
        /// <param name="drawingBounds">The bounds for which to draw the texture on the screen at.</param>
        /// <param name="priority">Determines if this GUI element should have priority over other GUI elements when sorting through input.</param>
        /// <param name="isContained">If true, this GUI element is within a container.</param>
        /// <param name="font">The Name of the font to use</param>
        protected GUIElement(Rectangle drawingBounds, int priority, bool isContained, string font)
        {
            this.DrawingBounds = drawingBounds;
            this.MouseBounds   = new ClickBounds(drawingBounds, priority);

            if (!isContained)
            {
                BoundHandler.AddGUIElement(this);
            }

            if (!string.IsNullOrWhiteSpace(font))
            {
                this.Font = RenderingData.AssetManagerClone.Load <SpriteFont>(font);
            }
        }
Example #13
0
        /// <param name="drawingBounds">The bounds for which to draw the texture on the screen at.</param>
        /// <param name="priority">Determines if this GUI element should have priority over other GUI elements when sorting through input.</param>
        /// <param name="isContained">If true, this GUI element is within a container.</param>
        protected GUIElement(Rectangle drawingBounds, int priority, bool isContained, string font)
        {
            this.DrawingBounds = drawingBounds;
            this.MouseBounds   = new ClickBounds(drawingBounds, priority);

            if (!isContained)
            {
                BoundHandler.AddGUIElement(this);
            }

            if (font != null && font != string.Empty)
            {
                this.Font = Game1.AssetManager.Load <SpriteFont>(font);
            }
        }
Example #14
0
        public override void Click(MouseEventArgs e, GUIContainer container)
        {
            World.Mode = MagicalLifeAPI.Networking.EngineMode.ServerAndClient;
            Server.Load();
            ClientSendRecieve.Initialize(new MagicalLifeAPI.Networking.NetworkSettings());
            FMODUtil.RaiseEvent(EffectsTable.UIClick);
            ServerSendRecieve.Initialize(new MagicalLifeAPI.Networking.NetworkSettings());
            Client.Load();
            NewGameInputHandler a = new NewGameInputHandler();

            a.StartNewGame();
            Server.StartGame();
            BoundHandler.RemoveContainer(NewWorldMenu.NewWorldMenuM);
            MenuHandler.Clear();
            BoundHandler.HideAll();
            InGameGUI.Initialize();
            BoundHandler.Popup(InGameGUI.InGame);
        }
        private void NewWorldNextButton_ClickEvent(object sender, Reusable.Event.ClickEventArgs e)
        {
            World.Mode = MagicalLifeAPI.Networking.EngineMode.ServerAndClient;
            Server.Load();
            ClientSendRecieve.Initialize(new MagicalLifeAPI.Networking.NetworkSettings(MagicalLifeAPI.Networking.EngineMode.ServerAndClient));
            FMODUtil.RaiseEvent(SoundsTable.UIClick);
            //FMODUtil.RaiseEvent(SoundsTable.Ambience);
            ServerSendRecieve.Initialize(new MagicalLifeAPI.Networking.NetworkSettings(MagicalLifeAPI.Networking.EngineMode.ServerAndClient));
            Client.Load();
            NewGameInputHandler a = new NewGameInputHandler();

            a.StartNewGame();
            Server.StartGame();
            RenderInfo.Camera2D.InitializeForDimension(0);
            BoundHandler.RemoveContainer(NewWorldMenu.NewWorldMenuM);
            MenuHandler.Clear();
            BoundHandler.HideAll();
            InGameGUI.Initialize();
            BoundHandler.Popup(InGameGUI.InGame);
        }
Example #16
0
        private void HandleEscapeKey()
        {
            //Show main menu.
            MasterLog.DebugWriteLine("Escape key pressed");

            if (ActionMenu.AMenu.Visible == true)
            {
                BoundHandler.RemoveContainer(ActionMenu.AMenu);
            }

            if (World.Dimensions.Count > 0)
            {
                //Ingame: Open up in game menu
                InGameEscapeMenu.Initialize();
            }
            else
            {
                //Pregame:
                MenuHandler.Back();
            }
        }
        public override void Click(MouseEventArgs e, GUIContainer container)
        {
            int selected = LoadGameMenu.Menu.SaveSelectListBox.SelectedIndex;

            if (selected != -1)
            {
                FMODUtil.RaiseEvent(SoundsTable.UIClick);
                World.Mode = MagicalLifeAPI.Networking.EngineMode.ServerAndClient;
                RenderableString selectedItem = (RenderableString)LoadGameMenu.Menu.SaveSelectListBox.Items[selected];
                WorldStorage.LoadWorld(selectedItem.Text);

                Server.Load();
                ClientSendRecieve.Initialize(new MagicalLifeAPI.Networking.NetworkSettings(MagicalLifeAPI.Networking.EngineMode.ServerAndClient));
                ServerSendRecieve.Initialize(new MagicalLifeAPI.Networking.NetworkSettings(MagicalLifeAPI.Networking.EngineMode.ServerAndClient));
                Client.Load();
                Server.StartGame();
                BoundHandler.RemoveContainer(LoadGameMenu.Menu);
                MenuHandler.Clear();
                BoundHandler.HideAll();
                InGameGUI.Initialize();
                BoundHandler.Popup(InGameGUI.InGame);
            }
        }
Example #18
0
        private void LoadSaveButton_ClickEvent(object sender, Reusable.Event.ClickEventArgs e)
        {
            int selected = LoadGameMenu.Menu.SaveSelectListBox.SelectedIndex;

            if (selected != -1)
            {
                FMODUtil.RaiseEvent(SoundsTable.UIClick);
                World.Mode = MagicalLifeAPI.Networking.EngineMode.ServerAndClient;
                RenderableString selectedItem = (RenderableString)LoadGameMenu.Menu.SaveSelectListBox.Items[selected];
                WorldStorage.LoadWorld(selectedItem.Text);

                Server.Load();
                ClientSendRecieve.Initialize(new MagicalLifeAPI.Networking.NetworkSettings(MagicalLifeAPI.Networking.EngineMode.ServerAndClient));
                ServerSendRecieve.Initialize(new MagicalLifeAPI.Networking.NetworkSettings(MagicalLifeAPI.Networking.EngineMode.ServerAndClient));
                Client.Load();
                Server.StartGame();
                BoundHandler.RemoveContainer(LoadGameMenu.Menu);
                MenuHandler.Clear();
                BoundHandler.HideAll();
                InGameGUI.Initialize();
                BoundHandler.Popup(InGameGUI.InGame);
                RenderInfo.Camera2D.InitializeForDimension(0);
            }
        }
Example #19
0
 public void InitialStartup()
 {
     BoundHandler.Initialize();
     KeyboardHandler.Initialize();
 }
Example #20
0
 /// <summary>
 /// Displays the menu/popup.
 /// </summary>
 /// <param name="container"></param>
 public static void DisplayMenu(GUIContainer container)
 {
     BoundHandler.Popup(container);
     Containers.Add(container);
     DisplayIndex = Containers.Count - 1;
 }
Example #21
0
 private void X_ClickEvent(object sender, Reusable.Event.ClickEventArgs e)
 {
     BoundHandler.RemoveContainer(this);
 }
Example #22
0
 private void X_XClicked(object sender, EventArgs e)
 {
     BoundHandler.RemoveContainer(this);
 }