Ejemplo n.º 1
0
 // If the dialog is closed clicking the close window button we may have no result.
 // In that case, try to find a cancelling button
 public void SetResultToCancelled()
 {
     if (Buttons.Contains(AlertButton.Cancel))
     {
         ResultButton = AlertButton.Cancel;
     }
     else if (Buttons.Contains(AlertButton.No))
     {
         ResultButton = AlertButton.No;
     }
     else if (Buttons.Contains(AlertButton.Close))
     {
         ResultButton = AlertButton.Close;
     }
     else
     {
         ResultButton = null;
     }
 }
Ejemplo n.º 2
0
        public bool RemoveButton(CaptionButtonInfo button)
        {
            if (button == null)
            {
                throw new ArgumentNullException();
            }

            if (Buttons.Contains(button))
            {
                Buttons = Buttons.Where(b => b != button).ToArray();
                ResetControlsBounds();
                Invalidate();
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
        public void Update()
        {
            var OnceArray = new Buttons[] { Buttons.DPadUp, Buttons.DPadDown, Buttons.DPadLeft, Buttons.DPadRight, Buttons.Start, Buttons.Back, Buttons.LeftShoulder,
                                            Buttons.RightShoulder, Buttons.LeftTrigger, Buttons.RightTrigger };

            previousState = currentState;
            currentState  = GamePad.GetState(Microsoft.Xna.Framework.PlayerIndex.One);
            foreach (Buttons button in OnceArray)
            {
                //if the keys in the keyArray are pressed, execute corresponding command

                if (OnceArray.Contains <Buttons>(button))
                {
                    if (currentState.IsButtonDown(button) && !previousState.IsButtonDown(button))
                    {
                        controllerMappings[button]?.Execute();
                        lastPressed = button;
                    }
                }
            }
        }
Ejemplo n.º 4
0
        // ボタンを登録 버튼 등록
        private void _registerGearButton()
        {
            try
            {
                if (Buttons.Contains(ButtonName))
                {
                    Buttons.Remove(ButtonName);
                }
                GameObject btn = Buttons.Add(ButtonName, Label, IconPng, OnGearMenuClick);

                if (m_isEnable)
                {
                    Buttons.SetFrameColor(btn, Color.red);
                }
                else
                {
                    Buttons.SetFrameColor(btn, new Color(0.827f, 0.827f, 0.827f));
                }
            }
            catch (Exception e)
            {
                Log(e);
            }
        }
        public void OnLevelWasLoaded(int level)
        {
            inEdit = false;

            if (level == 5)
            {
                //Add the button
                if (GameMain.Instance != null && GameMain.Instance.SysShortcut != null && !Buttons.Contains("YotogiAnywhere"))
                {
                    menuButton = GearMenu.Buttons.Add("SplitHairSliders", "Split Hair Sliders Edit Only", GearIcon, OnMenuButtonClickCallback);
                }

                inEdit = true;
            }

            //Hide the UI when switching levels
            displayUI = false;
        }
Ejemplo n.º 6
0
        public void Update()
        {
            if (mario == null || keyDict.LongCount() == 0)
            {
                return;
            }

            List <Buttons> tempList = new List <Buttons>();

            if (GamePad.GetState(0).Buttons.A == ButtonState.Pressed)
            {
                tempList.Add(Buttons.A);
            }
            if (GamePad.GetState(0).Buttons.B == ButtonState.Pressed)
            {
                tempList.Add(Buttons.B);
            }
            if (GamePad.GetState(0).DPad.Left == ButtonState.Pressed)
            {
                tempList.Add(Buttons.DPadLeft);
            }
            if (GamePad.GetState(0).DPad.Right == ButtonState.Pressed)
            {
                tempList.Add(Buttons.DPadRight);
            }
            if (GamePad.GetState(0).DPad.Up == ButtonState.Pressed)
            {
                tempList.Add(Buttons.DPadUp);
            }
            if (GamePad.GetState(0).DPad.Down == ButtonState.Pressed)
            {
                tempList.Add(Buttons.DPadDown);
            }

            Buttons[] pressedKeys = new Buttons[tempList.LongCount()];
            for (int i = 0; i < pressedKeys.LongCount(); i++)
            {
                pressedKeys[i] = tempList[i];
            }

            if ((GameUtilities.Game.State.Type == Interfaces.GameStates.Playing ||
                 GameUtilities.Game.State.Type == Interfaces.GameStates.Competitive) &&
                IsFunctionKeysEnable)
            {
                if (Left(pressedKeys))
                {
                    commandDict[keyDict[KeyboardKeys2.Left]].Execute();
                }
                else if (Right(pressedKeys))
                {
                    commandDict[keyDict[KeyboardKeys2.Right]].Execute();
                }
                else if (Jump(pressedKeys))
                {
                    commandDict[keyDict[KeyboardKeys2.A]].Execute();
                }
                else if (Down(pressedKeys))
                {
                    commandDict[keyDict[KeyboardKeys2.Down]].Execute();
                }
                else if (LeftJump(pressedKeys))
                {
                    if (mario.IsInAir)
                    {
                        commandDict[keyDict[KeyboardKeys2.Left]].Execute();
                    }
                    else
                    {
                        commandDict[keyDict[KeyboardKeys2.A]].Execute();
                    }
                }
                else if (LeftDown(pressedKeys))
                {
                    commandDict[keyDict[KeyboardKeys2.Down]].Execute();
                }
                else if (RightJump(pressedKeys))
                {
                    if (mario.IsInAir)
                    {
                        commandDict[keyDict[KeyboardKeys2.Right]].Execute();
                    }
                    else
                    {
                        commandDict[keyDict[KeyboardKeys2.A]].Execute();
                    }
                }
                else if (RightDown(pressedKeys))
                {
                    commandDict[keyDict[KeyboardKeys2.Down]].Execute();
                }
                else if (LeftRightJump(pressedKeys))
                {
                    commandDict[keyDict[KeyboardKeys2.A]].Execute();
                }


                if (pressedKeys.Contains(keyDict[KeyboardKeys2.B]) && preKeys != null && !preKeys.Contains(keyDict[KeyboardKeys2.B]))
                {
                    commandDict[keyDict[KeyboardKeys2.B]].Execute();
                }

                if (preKeys != null)
                {
                    if (preKeys.Contains(releasedKeyDict[KeyboardKeys2.Right]) && GamePad.GetState(0).IsButtonUp(releasedKeyDict[KeyboardKeys2.Right]))
                    {
                        releasedCommandDict[releasedKeyDict[KeyboardKeys2.Right]].Execute();
                    }
                    if (preKeys.Contains(releasedKeyDict[KeyboardKeys2.Left]) && GamePad.GetState(0).IsButtonUp(releasedKeyDict[KeyboardKeys2.Left]))
                    {
                        releasedCommandDict[releasedKeyDict[KeyboardKeys2.Left]].Execute();
                    }
                    if (preKeys.Contains(releasedKeyDict[KeyboardKeys2.Down]) && GamePad.GetState(0).IsButtonUp(releasedKeyDict[KeyboardKeys2.Down]))
                    {
                        releasedCommandDict[releasedKeyDict[KeyboardKeys2.Down]].Execute();
                    }
                    if (preKeys.Contains(releasedKeyDict[KeyboardKeys2.B]) && GamePad.GetState(0).IsButtonUp(releasedKeyDict[KeyboardKeys2.B]))
                    {
                        releasedCommandDict[releasedKeyDict[KeyboardKeys2.B]].Execute();
                    }
                    if (preKeys.Contains(releasedKeyDict[KeyboardKeys2.A]) && GamePad.GetState(0).IsButtonUp(releasedKeyDict[KeyboardKeys2.A]))
                    {
                        releasedCommandDict[releasedKeyDict[KeyboardKeys2.A]].Execute();
                    }
                }
            }
            else if (GameUtilities.Game.State.Type == Interfaces.GameStates.Title)
            {
                if (pressedKeys.Contains(keyDict[KeyboardKeys2.A]) && preKeys != null && !preKeys.Contains(keyDict[KeyboardKeys2.A]))
                {
                    commandDict[keyDict[KeyboardKeys2.A]].Execute();
                }

                if (pressedKeys.Contains(keyDict[KeyboardKeys2.Down]) && preKeys != null && !preKeys.Contains(keyDict[KeyboardKeys2.Down]))
                {
                    commandDict[keyDict[KeyboardKeys2.Down]].Execute();
                }
            }

            if (pressedKeys.Contains(keyDict[KeyboardKeys2.Start]) && preKeys != null && !preKeys.Contains(keyDict[KeyboardKeys2.Start]))
            {
                commandDict[keyDict[KeyboardKeys2.Start]].Execute();
            }

            preKeys = pressedKeys;
        }
Ejemplo n.º 7
0
        public void Update()
        {
            var buttonarray = new Buttons[14] {
                Buttons.A, Buttons.B, Buttons.Y, Buttons.X, Buttons.DPadUp,
                Buttons.DPadLeft, Buttons.DPadDown, Buttons.DPadRight, Buttons.Back, Buttons.Start, Buttons.LeftShoulder,
                Buttons.RightShoulder, Buttons.LeftTrigger, Buttons.RightTrigger
            };

            var attackarray = new Buttons[] { Buttons.A };
            var oncearray   = new Buttons[] { Buttons.B, Buttons.Y, Buttons.X, Buttons.DPadUp,
                                              Buttons.DPadLeft, Buttons.DPadDown, Buttons.DPadRight, Buttons.Back, Buttons.Start, Buttons.LeftShoulder,
                                              Buttons.RightShoulder, Buttons.LeftTrigger, Buttons.RightTrigger };

            previousState = currentState;
            currentState  = GamePad.GetState(Microsoft.Xna.Framework.PlayerIndex.One);


            if (oncearray.Contains <Buttons>(lastButtonPressed))
            {
                ICommand command = new StopCommand(this.instance.Link);
                command.Execute();
            }
            else if (attackarray.Contains <Buttons>(lastButtonPressed))
            {
            }
            else if (buttonarray.Contains <Buttons>(lastButtonPressed) && (!currentState.IsButtonDown(lastButtonPressed)))
            {
                ICommand command = new StopCommand(this.instance.Link);
                command.Execute();
            }

            foreach (Buttons button in buttonarray)
            {
                //if the keys in the keyArray are pressed, execute corresponding command

                if (oncearray.Contains <Buttons>(button))
                {
                    if (currentState.IsButtonDown(button) && !previousState.IsButtonDown(button))
                    {
                        gamepadMappings[button]?.Execute();
                        lastButtonPressed = button;
                    }
                }
                else if (attackarray.Contains <Buttons>(button))
                {
                    if (currentState.IsButtonDown(button) && !previousState.IsButtonDown(button))
                    {
                        gamepadMappings[button]?.Execute();
                        lastButtonPressed = button;
                    }
                }
                else if (buttonarray.Contains <Buttons>(button))
                {
                    if (currentState.IsButtonDown(button))

                    {
                        if ((lastButtonPressed == button) || ((lastButtonPressed != button) && currentState.IsButtonUp(lastButtonPressed)))
                        {
                            gamepadMappings[button]?.Execute();
                            lastButtonPressed = button;
                        }
                    }
                }
            }
        }