Example #1
0
            async void SaveButton_Pressed(PressedEventArgs args)
            {
                if (LineEdit.Text == "")
                {
                    await MenuUIManager.ErrorPopUp.DisplayError("Invalid name", "Name of the saved game cannot be empty");

                    return;
                }

                string newAbsoluteFilePath = Path.Combine(Game.Files.SaveGameDirAbsolutePath, LineEdit.Text);

                if (Game.Files.FileExists(newAbsoluteFilePath))
                {
                    bool confirmed = await MenuUIManager.ConfirmationPopUp
                                     .RequestConfirmation("Overriding file",
                                                          $"Do you really want to override the file \"{MatchSelected}\"?",
                                                          null,
                                                          proxy);

                    if (!confirmed)
                    {
                        return;
                    }
                }

                try {
                    MenuUIManager.MenuController.SavePausedLevel(LineEdit.Text);
                    MenuUIManager.SwitchBack();
                }
                catch (Exception) {
                    await MenuUIManager.ErrorPopUp.DisplayError("Saving Error",
                                                                "There was an error while saving the level, see log for details.",
                                                                proxy);
                }
            }
Example #2
0
            void LoadButton_Pressed(PressedEventArgs args)
            {
                if (MatchSelected == null)
                {
                    return;
                }

                string newRelativePath = Path.Combine(Game.Files.SaveGameDirPath, MatchSelected);

                //Has to be last statement in the method, this instance will be released during execution.
                proxy.Load(newRelativePath);
            }
Example #3
0
        protected override void Pressed(PressedEventArgs args)
        {
            MinimapClickPos = Button.ScreenToElement(InputCtl.CursorPosition);

            Vector2?worldPosition = Level.Minimap.MinimapToWorld(MinimapClickPos);

            if (worldPosition.HasValue)
            {
                CameraMover.MoveTo(worldPosition.Value);
            }

            Level.Minimap.Refresh();
            InputCtl.MouseMove += MouseMove;
            InputCtl.MouseUp   += MouseUp;
            controllingMovement = true;
        }
Example #4
0
File: Keep.cs Project: MK4H/MHUrho
            void ButtonPressed(PressedEventArgs args)
            {
                var unitTypePlugin = spawningButtons[args.Element];

                if (unitTypePlugin.Cost.HasResources(Keep.Building.Player))
                {
                    if (Keep.Level.SpawnUnit(unitTypePlugin.UnitType,
                                             Keep.TileInFront,
                                             Quaternion.Identity,
                                             Keep.Building.Player) != null)
                    {
                        unitTypePlugin.Cost.TakeFrom(Keep.Building.Player);
                    }
                }
                else
                {
                    args.Element.Enabled = false;
                }
            }
Example #5
0
            async void DeleteButton_Pressed(PressedEventArgs args)
            {
                if (MatchSelected == null)
                {
                    return;
                }

                bool confirmed = await MenuUIManager.ConfirmationPopUp
                                 .RequestConfirmation("Deleting file",
                                                      $"Do you really want to delete the file \"{MatchSelected}\"?",
                                                      null,
                                                      proxy);

                if (!confirmed)
                {
                    return;
                }

                DeleteFile();
            }
Example #6
0
        void ScrollButtonPressed(PressedEventArgs e)
        {
            if (buttonHolder.Size.X < centralWindow.Size.X)
            {
                buttonHolder.Position = new IntVector2(0, buttonHolder.Position.Y);
                return;
            }

            int newPos = buttonHolder.Position.X;

            switch (e.Element.Name)
            {
            case "RightButton":
                newPos -= 100;

                if (newPos + buttonHolder.Size.X < centralWindow.Size.X)
                {
                    newPos = buttonHolder.Parent.Size.X - buttonHolder.Size.X;
                }
                break;

            case "LeftButton":
                newPos += 100;

                if (newPos > 0)
                {
                    newPos = 0;
                }
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            buttonHolder.Position = new IntVector2(newPos, buttonHolder.Position.Y);
        }
Example #7
0
        void Button_Pressed(PressedEventArgs obj)
        {
            var label = (Text)obj.Element.Children[0];

            label.Value += "!";
        }
Example #8
0
 void MainMenuButtonPressed(PressedEventArgs obj)
 {
     MenuUIManager.Clear();
     MenuUIManager.SwitchToMainMenu();
 }
Example #9
0
File: Gate.cs Project: MK4H/MHUrho
 void HideButtonPressed(PressedEventArgs obj)
 {
     gateWindow.Hide();
 }
Example #10
0
 protected abstract void Pressed(PressedEventArgs args);
Example #11
0
File: Gate.cs Project: MK4H/MHUrho
 void CloseButtonPressed(PressedEventArgs obj)
 {
     Gate.Close();
 }
Example #12
0
 private void GoldButton_Pressed(PressedEventArgs obj)
 {
     GameManager.AddResourceValue(IdlePlayerResourceType.Gold, 1);
 }
Example #13
0
 private void AddBuildingButton_Pressed(PressedEventArgs obj)
 {
     Debug.WriteLine("apasat buton");
 }
Example #14
0
 void BackButton_Pressed(PressedEventArgs args)
 {
     MenuUIManager.SwitchBack();
 }
Example #15
0
File: Gate.cs Project: MK4H/MHUrho
 void OpenButtonPressed(PressedEventArgs obj)
 {
     Gate.Open();
 }
Example #16
0
File: Keep.cs Project: MK4H/MHUrho
 void HideButtonPressed(PressedEventArgs args)
 {
     Hide();
 }
Example #17
0
 void DeselectButtonPressed(PressedEventArgs obj)
 {
     DeselectAll();
 }