Пример #1
0
 public void InitialStartup(ref int progress)
 {
     BoundHandler.Initialize();
     progress++;
     KeyboardHandler.Initialize();
     progress++;
 }
Пример #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]);
     }
 }
Пример #3
0
 /// <summary>
 /// Displays the last shown menu.
 /// </summary>
 public static void Back()
 {
     if (DisplayIndex > 0)
     {
         DisplayIndex--;
         BoundHandler.Popup(Containers[DisplayIndex]);
     }
 }
Пример #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);
 }
Пример #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);
 }
Пример #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);
        }
Пример #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);
 }
Пример #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);
            }
        }
Пример #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]);
     }
 }
Пример #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();
         }
     }
 }
Пример #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);
        }
Пример #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);
            }
        }
Пример #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);
            }
        }
Пример #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);
        }
Пример #15
0
        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);
        }
Пример #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();
            }
        }
Пример #17
0
        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);
            }
        }
Пример #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);
            }
        }
Пример #19
0
 public void InitialStartup()
 {
     BoundHandler.Initialize();
     KeyboardHandler.Initialize();
 }
Пример #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;
 }
Пример #21
0
 private void X_ClickEvent(object sender, Reusable.Event.ClickEventArgs e)
 {
     BoundHandler.RemoveContainer(this);
 }
Пример #22
0
 private void X_XClicked(object sender, EventArgs e)
 {
     BoundHandler.RemoveContainer(this);
 }