Exemple #1
0
 /// <summary>
 /// Converts <see cref="Microsoft.Xna.Framework.Input.Buttons"/> to <see cref="Komodo.Core.Engine.Input.Inputs"/>.
 /// </summary>
 /// <param name="button">MonoGame button.</param>
 /// <returns>Converted MonoGame button.</returns>
 internal static Inputs ToInputs(Buttons button)
 {
     return(button switch
     {
         Buttons.A => Inputs.ButtonA,
         Buttons.B => Inputs.ButtonB,
         Buttons.DPadDown => Inputs.ButtonDown,
         Buttons.BigButton => Inputs.ButtonHome,
         Buttons.LeftShoulder => Inputs.ButtonL1,
         Buttons.LeftTrigger => Inputs.ButtonL2,
         Buttons.LeftStick => Inputs.ButtonL3,
         Buttons.DPadLeft => Inputs.ButtonLeft,
         Buttons.RightShoulder => Inputs.ButtonR1,
         Buttons.RightTrigger => Inputs.ButtonR2,
         Buttons.RightStick => Inputs.ButtonR3,
         Buttons.DPadRight => Inputs.ButtonRight,
         Buttons.Back => Inputs.ButtonSelect,
         Buttons.Start => Inputs.ButtonStart,
         Buttons.DPadUp => Inputs.ButtonUp,
         Buttons.X => Inputs.ButtonX,
         Buttons.Y => Inputs.ButtonY,
         _ => Inputs.Undefined,
     });
 public void bind(Microsoft.Xna.Framework.PlayerIndex control, Microsoft.Xna.Framework.Input.Buttons button)
 {
     bound        = true;
     this.control = control;
     this.binding = button;
 }
 public GamepadButtonEventArgs(Microsoft.Xna.Framework.Input.Buttons button)
 {
     this.Button = button;
 }
Exemple #4
0
 public bool HasReleasedButton(Microsoft.Xna.Framework.Input.Buttons button)
 {
     return(controllerState.IsButtonUp(button) &&
            prevControllerState.IsButtonDown(button));
 }
Exemple #5
0
 public bool WasButtonPressed(Microsoft.Xna.Framework.Input.Buttons button)
 {
     return(controllerState.IsButtonDown(button) &&
            prevControllerState.IsButtonUp(button));
 }
Exemple #6
0
 public bool IsHoldingButton(Microsoft.Xna.Framework.Input.Buttons button)
 {
     return(controllerState.IsButtonDown(button) &&
            prevControllerState.IsButtonDown(button));
 }
Exemple #7
0
 public bool IsNewKeyPress(Microsoft.Xna.Framework.Input.Buttons button)
 {
     return(GamePad.GetState(0).IsButtonDown(button));
 }
Exemple #8
0
        private void ActivateChatFeature()
        {
            //RefreshChatCustomization();
            CallFunc(chat.Refresh);
            Dictionary <Microsoft.Xna.Framework.Input.Buttons, string> dict = new Dictionary <Microsoft.Xna.Framework.Input.Buttons, string>();

            BaseAddress = GetModule("RocketLeague.exe");
            int[] ChatEnabledOffsets = { 0xF8, 0x1C0, 0x10, 0x78, 0x414 };
            int[] InMenuOffsets      = { 0x10, 0xC, 0x0, 0x614, 0x718 };
            if (BaseAddress != 0)
            {
                while (true)
                {
                    //checks whether or not the player is in a menu
                    uint InMenuBase    = Mem.ReadUInteger((IntPtr)BaseAddress + 0x019FA7E8);
                    int  InMenuAddress = FindMultiLevelPointer(InMenuBase, InMenuOffsets);
                    int  InMenu        = Mem.ReadInt32((IntPtr)InMenuAddress);

                    //checks whether or not the quick chat is enabled
                    uint ChatEnabledBase    = Mem.ReadUInteger((IntPtr)BaseAddress + 0x01962610);
                    int  ChatEnabledAddress = FindMultiLevelPointer(ChatEnabledBase, ChatEnabledOffsets);
                    int  ChatEnabled        = Mem.ReadInt32((IntPtr)ChatEnabledAddress);

                    if (CheckForOverlayUpdate)
                    {
                        if (chat.RefreshOverlayCue)
                        {
                            CallTextUpdate();
                            for (int i = 0; i < dict.Count; i++)
                            {
                                KeyValuePair <Microsoft.Xna.Framework.Input.Buttons, string> pair = dict.ElementAt(i);
                                overlay.StrToDraw[i] = pair.Value;
                            }
                            CallFunc(overlay.Refresh);
                            chat.RefreshOverlayCue = false;
                        }
                    }
                    if (RunThread && (InMenu == 0 && (ChatEnabled == 1 || ChatEnabled == 25 || ChatEnabled == 27)))
                    {
                        GamePadState currentState = GamePad.GetState(PlayerIndex.One);
                        foreach (var i in messageSets)
                        {
                            if (currentState.IsConnected && currentState.IsButtonDown(i.Key))
                            {
                                if (!overlay.Draw)
                                {
                                    currentMessageSet = i.Key;
                                }
                                else
                                {
                                    overlay.Timer.Stop();
                                    overlay.Timer.Start();
                                    continue;
                                }
                            }
                            else
                            {
                                continue;
                            }



                            dict = messageSets[currentMessageSet];

                            overlay.StrToDraw = new string[4];

                            for (int j = 0; j < dict.Count; j++)
                            {
                                KeyValuePair <Microsoft.Xna.Framework.Input.Buttons, string> pair = dict.ElementAt(j);
                                overlay.StrToDraw[j] = pair.Value;
                            }
                            overlay.Draw = true;
                            CallFunc(overlay.Refresh);
                            Thread.Sleep(300);
                        }
                        currentState = GamePad.GetState(PlayerIndex.One);
                        foreach (var i in dict)
                        {
                            if (overlay.Draw)
                            {
                                Microsoft.Xna.Framework.Input.Buttons iterKey = i.Key;
                                if (currentState.IsConnected && currentState.IsButtonDown(iterKey))
                                {
                                    AlterTextBox("" + i.Key);
                                    key = i.Key;
                                    break;
                                }
                                key = 0;
                            }
                        }
                        if (key != 0)
                        {
                            SendDelay++;
                            if (SendDelay == 1)
                            {
                                //checks for existence of [y] preceding message - if this yields true, it will send a 'y' to open team chat
                                bool TeamChatPrefixExists = (dict[key].Substring(0, 3).Equals("[y]"));

                                SendKeys.SendWait((TeamChatPrefixExists) ? "y" : "t");
                                Thread.Sleep(SLEEP_TIME);
                                SendKeys.SendWait(((TeamChatPrefixExists) ? dict[key].Substring(3) : dict[key]) + "{ENTER}"); //if [y] prefix exists, it is excluded from the main message being sent
                            }
                        }
                        else
                        {
                            SendDelay = 0;
                        }
                    }
                    Thread.Sleep(1);
                }
            }
        }