public static string InputFlags_ToString(InputFlags flags)
            {
                string strRet = "";

                if ((flags & InputFlags.MouseLeft) > 0)
                {
                    strRet += "ML ";
                }
                if ((flags & InputFlags.MouseRight) > 0)
                {
                    strRet += "MR ";
                }
                if ((flags & InputFlags.MouseMiddle) > 0)
                {
                    strRet += "MM ";
                }
                if ((flags & InputFlags.MouseX1) > 0)
                {
                    strRet += "MX1 ";
                }
                if ((flags & InputFlags.MouseX2) > 0)
                {
                    strRet += "MX2 ";
                }
                if ((flags & InputFlags.Touch) > 0)
                {
                    strRet += "T ";
                }
                if (strRet == "")
                {
                    strRet = "0 ";
                }
                return(strRet);
            }
        public override void ToBytes(BinaryWriter writer)
        {
            base.ToBytes(writer);
            writer.Write(SequenceNumber);
            InputFlags flags = 0;

            if (Firing)
            {
                flags |= InputFlags.Firing;
            }
            if (TurnState == TurnState.Left)
            {
                flags |= InputFlags.TurningLeft;
            }
            if (TurnState == TurnState.Right)
            {
                flags |= InputFlags.TurningRight;
            }
            if (SpeedState == SpeedState.SpeedUp)
            {
                flags |= InputFlags.SpeedingUp;
            }
            if (SpeedState == SpeedState.SlowDown)
            {
                flags |= InputFlags.SlowingDown;
            }
            writer.Write((byte)flags);
            writer.Write(TurretDirection);
        }
示例#3
0
        public static void Update()
        {
            var last = _currentInputFlags;

            _currentInputFlags = GetKeyFlags();

            var state = GamePad.GetState(PlayerIndex.One, GamePadDeadZone.Circular);

            if (state != null && state.IsConnected)
            {
                _currentInputFlags |= GetButtonFlags(state);
                _currentInputFlags |= GetStickFlags(state);
            }
            else
            {
                _currentButtonsPressed = 0;
            }

            _newInputFlags = ~last & _currentInputFlags;

            if (_newInputFlags != 0)
            {
                System.Diagnostics.Debug.WriteLine("New Inputs: {0}", _newInputFlags);
            }
        }
            public static InputFlags InputFlags_MouseButtons(MouseButtons buttons)
            {
                InputFlags ret = 0;

                if ((buttons & MouseButtons.Left) > 0)
                {
                    ret |= InputFlags.MouseLeft;
                }
                if ((buttons & MouseButtons.Right) > 0)
                {
                    ret |= InputFlags.MouseRight;
                }
                if ((buttons & MouseButtons.Middle) > 0)
                {
                    ret |= InputFlags.MouseMiddle;
                }
                if ((buttons & MouseButtons.XButton1) > 0)
                {
                    ret |= InputFlags.MouseX1;
                }
                if ((buttons & MouseButtons.XButton2) > 0)
                {
                    ret |= InputFlags.MouseX2;
                }
                return(ret);
            }
示例#5
0
        private static InputFlags GetKeyFlags()
        {
            InputFlags keyFlags = 0;
            //int index, length = _keyMap.Length;
            HashSet <InputFlags> list;

            var state = Keyboard.GetState(PlayerIndex.One);

            _currentKeysPressed = state.GetPressedKeys();
            foreach (var k in _currentKeysPressed)
            {
                if (_keyFlagMap.TryGetValue(k, out list))
                {
                    foreach (var flag in list)
                    {
                        keyFlags |= flag;
                    }
                }
                //index = 0;
                //while (index < length)
                //{
                //    if (_keyMap[index] == k)
                //        keyFlags |= 1 << (int)index;
                //    index++;
                //}
                //InputKeys inputKey;
                //if (_keyMap.TryGetValue(k, out inputKey))
                //    keyFlags |= 1 << (int)inputKey;
            }

            return(keyFlags);
        }
示例#6
0
 public TouchEventData(TimeSpan time, int frame, InputFlags flags, TouchEventType eventType, GestureSample gesture)
 {
     Time      = time;
     Frame     = frame;
     Flags     = flags;
     EventType = eventType;
     payload   = new GestureOrTouchLocation(gesture);
 }
示例#7
0
 public KeyEventData(KeyEventType eventType, TimeSpan time, int frame, InputFlags flags, char character)
 {
     EventType = eventType;
     Time      = time;
     Frame     = frame;
     Flags     = flags;
     Key       = Keys.None;
     Character = character;
 }
示例#8
0
 public KeyEventData(KeyEventType eventType, TimeSpan time, int frame, InputFlags flags, Keys key)
 {
     EventType = eventType;
     Time      = time;
     Frame     = frame;
     Flags     = flags;
     Key       = key;
     Character = (char)0;
 }
示例#9
0
        public bool InputDown(KeyboardState kbState, InputFlags key)
        {
            if (kbState.IsKeyDown(_keyboardDefinitions[key]))
            {
                return(true);
            }

            return(false);
        }
示例#10
0
 public GamePadEventData(GamePadEventType eventType, TimeSpan time, int frame, InputFlags flags, Buttons button, Vector2 thumbStickState)
 {
     EventType       = eventType;
     Time            = time;
     Frame           = frame;
     Flags           = flags;
     Button          = button;
     TriggerState    = 0;
     ThumbstickState = thumbStickState;
 }
示例#11
0
 public GamePadEventData(GamePadEventType eventType, TimeSpan time, int frame, InputFlags flags, Buttons button, float triggerstate = 0)
 {
     EventType       = eventType;
     Time            = time;
     Frame           = frame;
     Flags           = flags;
     Button          = button;
     TriggerState    = triggerstate;
     ThumbstickState = Vector2.Zero;
 }
示例#12
0
        public override void FromBytes(BinaryReader reader)
        {
            base.FromBytes(reader);
            SequenceNumber = reader.ReadUInt32();
            InputFlags flags = (InputFlags)reader.ReadByte();

            Firing          = (flags & InputFlags.Firing) != 0;
            TurnState       = (flags & InputFlags.TurningLeft) != 0 ? TurnState.Left : (flags & InputFlags.TurningRight) != 0 ? TurnState.Right : TurnState.None;
            SpeedState      = (flags & InputFlags.SpeedingUp) != 0 ? SpeedState.SpeedUp : (flags & InputFlags.SlowingDown) != 0 ? SpeedState.SlowDown : SpeedState.None;
            TurretDirection = reader.ReadSingle();
        }
示例#13
0
 public MouseEventData(MouseEventType type, InputFlags flags, TimeSpan time, int frame, MouseState previousState, MouseState currentState, MouseButton button = MouseButton.None)
 {
     EventType        = type;
     Flags            = flags;
     Position         = new Point(currentState.X, currentState.Y);
     Button           = button;
     ScrollWheelValue = currentState.ScrollWheelValue;
     ScrollWheelDelta = currentState.ScrollWheelValue - previousState.ScrollWheelValue;
     Time             = time;
     Frame            = frame;
     ClickCount       = 0;
 }
示例#14
0
        public void SetGameInput(Gameplay.View.ViewState viewState, ref ClientInputData result)
        {
            Vector3         TargetPos = Vector3.zero;
            Data_PlayerInfo TargetHero;
            InputFlags      inputFlags = 0;// InputReader.ReadInput();

            //var champion = Champions.Champion.GetChampion(API.Instance.ViewState.GetControlledObjectType().ToString(API.GameData));
            //inputFlags |= champion.Combo(out TargetHero, out TargetPos);
            inputFlags = InputReader.ReadInput();
            //CameraSettings cameraSettings = Camera.main.GetComponent<CameraSettings>();
            Vector2 targetPosition  = new Vector2(TargetPos.x, TargetPos.z);
            Vector2 localPosition   = API.Instance.LocalPlayer.PredictedPosition2d(0).ToUnityVector2();
            Vector2 targetDirection = targetPosition - localPosition;
            Single  targetLength    = targetDirection.magnitude;

            if (targetLength == 0)
            {
                targetLength = 1.0f;
            }
            targetDirection.Normalize();
            result = default(ClientInputData);
            //var p = API.Instance.GameClientObject.Get<CollisionLibrary.Pathfinder>("Pathfinding");
            var mousePos   = UIHelper.GetMousePosition();
            var mousePos2d = new Vector2(mousePos.x, mousePos.y);

            result.InputDirection = ClampToMovable(mousePos2d);
            if (API.Instance.LocalPlayer.Team == 2)
            {
                result.InputDirection *= -1;
            }
            result.LocalSpaceInputDirection = MathCore.Vector2.Zero;
            result.AimDirection             = targetDirection.ToGameplayVector2();
            result.AimLength = targetLength;
            ((JSONReaderProfile)InputReader.ActiveDevice.Profile).AimLengthFactor = targetLength;
            result.AimDirectionOffset = targetDirection.ToGameplayVector2();
            //InputManager.Walk(targetDirection.x, targetDirection.y);
            result.AimLengthOffset   = targetLength;
            result.InputFlags        = inputFlags;
            result.HoveredGameObject = GameObjectId.Empty;
            result.InterruptOnMove   = false;
            //result.UseSmartCast = false;
            result.MousePosition = mousePos2d.ToGameplayVector2(); //targetPosition.ToGameplayVector2();
            result.MouseDelta    = new Vector2(Input.GetAxis("mouse x"), Input.GetAxis("mouse y")).ToGameplayVector2();

            var GameToolCamera = MergedUnity.Glue.GUI.GUIGlobals.Glue.Get <GameToolCamera>(MergedUnity.Glue.LoadingState.Ready);

            result.CameraInput = (CameraInput)GlueInstance.Invoke("GetCameraInputs", new object[] { API.Instance.ViewState, GameToolCamera });

            Byte _NumOfInputs = (Byte)GlueInstance.GetField("_NumOfInputs");

            GlueInstance.SetField("_NumOfInputs", ++_NumOfInputs);
            result.NumOfInputs = _NumOfInputs++;
        }
示例#15
0
        public bool InputPressed(InputFlags key)
        {
            if (_kbState.IsKeyDown(_keyboardDefinitions[key]) && !_oldKbState.IsKeyDown(_keyboardDefinitions[key]))
            {
                return(true);
            }

            if (_gpEnabled)
            {
                if (_gpState.IsButtonDown(_buttonDefinitions[key]) && !_gpState.IsButtonDown(_buttonDefinitions[key]))
                {
                    return(true);
                }
            }

            return(false);
        }
示例#16
0
        public override void Update(GameTime gameTime)
        {
            frame        += 1;
            currentTime   = gameTime.TotalGameTime;
            previousState = currentState;
            currentState  = Keyboard.GetState();
            currentFlags  = InputFlagsHelper.Create(currentState, Mouse.GetState());

            // collect some valid state, so on the _next_ update call we can detect changes and process events.
            if (!initialized)
            {
                initialized = true;
                return;
            }

            RaiseEvents();
            DrainTypedCharacters();
        }
示例#17
0
        public static void MapButton(Buttons button, InputKeys input)
        {
            int i      = (int)input;
            var oldKey = _buttonMap[i];

            if (oldKey == button)
            {
                return;
            }

            _buttonMap[i] = button;

            HashSet <InputFlags> lookup;

            var        flag   = (InputFlags)i.ToBitFlag();
            InputFlags oldMap = 0;

            if (oldKey != 0 && _buttonFlagMap.TryGetValue(oldKey, out lookup))
            {
                lookup.Remove(flag);
            }

            if (button != 0)
            {
                if (!_buttonFlagMap.TryGetValue(button, out lookup))
                {
                    _buttonFlagMap[button] = lookup = new HashSet <InputFlags>();
                }

                //Find existing player-mapped key, so it can be swapped
                if (oldKey != 0 && (_systemKeys & flag) == 0)
                {
                    oldMap = lookup.FirstOrDefault(x => (_systemKeys & x) == 0);
                }

                lookup.Add(flag);
            }

            //Swap player key maps
            if (oldMap != 0)
            {
                MapButton(oldKey, (InputKeys)((int)oldMap).FromBitFlag());
            }
        }
示例#18
0
        public static string AsText(this InputFlags m)
        {
            if (m == InputFlags.None)
            {
                return("");
            }

            var needPadding = false;
            var b           = new StringBuilder();

            if (m.IsControlDown())
            {
                b.Append(Common.Ctrl);
                needPadding = true;
            }
            if (m.IsAltDown())
            {
                if (needPadding)
                {
                    b.Append("-");
                }
                b.Append(Common.Alt);
                needPadding = true;
            }
            if (m.IsMetaDown())
            {
                if (needPadding)
                {
                    b.Append("-");
                }
                b.Append(OSPlatform.OS == OSPlatform.OperatingSystem.Mac ? Common.Meta : Common.Windows);
                needPadding = true;
            }
            if (m.IsShiftDown())
            {
                if (needPadding)
                {
                    b.Append("-");
                }
                b.Append(Common.Shift);
            }
            return(b.ToString());
        }
示例#19
0
        public override void Update(GameTime gameTime)
        {
            frame        += 1;
            currentTime   = gameTime.TotalGameTime;
            currentFlags  = InputFlagsHelper.Create(Keyboard.GetState(), currentState);
            previousState = currentState;
            if (hasTransform)
            {
                currentState = TransformState(Mouse.GetState());
            }
            else
            {
                currentState = Mouse.GetState();
            }

            // collect some valid state, so on the _next_ update call we can detect changes and process events.
            if (!initialized)
            {
                initialized = true;
                return;
            }

            for (var index = 0; index < buttons.Count; index++)
            {
                var button = buttons[index];
                CheckButtonPressed(button);
                CheckButtonReleased(button);
            }

            if (currentState.Position != previousState.Position)
            {
                var args = new MouseEventData(MouseEventType.Moved, currentFlags, currentTime, frame, previousState, currentState);
                eventSink.PushEvent(args);
            }

            if (currentState.ScrollWheelValue != previousState.ScrollWheelValue)
            {
                var args = new MouseEventData(MouseEventType.WheelMoved, currentFlags, currentTime, frame, previousState, currentState);
                eventSink.PushEvent(args);
            }
        }
示例#20
0
 public MouseEventData(
     MouseEventType eventType,
     InputFlags flags,
     TimeSpan time,
     int frame,
     Point position,
     MouseButton button   = MouseButton.None,
     int clickCount       = 0,
     int scrollWheelValue = 0,
     int scrollWheelDelta = 0)
 {
     ClickCount       = clickCount;
     Time             = time;
     Frame            = frame;
     EventType        = eventType;
     Button           = button;
     Position         = position;
     ScrollWheelValue = scrollWheelValue;
     ScrollWheelDelta = scrollWheelDelta;
     Flags            = flags;
 }
示例#21
0
        public override void Update(GameTime gameTime)
        {
            frame      += 1;
            currentTime = gameTime.TotalGameTime;
            inputFlags  = InputFlagsHelper.Create();

            for (var p = 0; p < currentStates.Length; p += 1)
            {
                previousStates[p] = currentStates[p];
                currentStates[p]  = GamePad.GetState(p);

                // collect some valid state, so on the _next_ update call we can detect changes and process events.
                if (!initialized)
                {
                    initialized = true;
                    return;
                }

                CheckAllButtons(p);
            }
        }
示例#22
0
        public override InputFlags Combo(out Data_PlayerInfo target, out Vector3 targetPos)
        {
            Single distance = 0.0f;

            targetPos = API.Instance.GetClosestTargetPos(false, true, true, 1.0f, out distance, out target);
            InputFlags inputFlags = 0;

            if (AbilityQ.IsReady && API.Instance.InDanger(API.Instance.LocalPlayer))
            {
                inputFlags = AbilityQ.Data.InputFlags;
            }
            else if (AbilityF.IsReady && AbilityF.InRange(distance) && distance > 4.5f)
            {
                inputFlags = AbilityF.Data.InputFlags;
            }
            else if (AbilitySpace.IsReady && AbilitySpace.InRange(distance) && distance > 4.5f)
            {
                inputFlags = AbilitySpace.Data.InputFlags;
            }
            else if (AbilityRight.IsReady && AbilityRight.InRange(distance))
            {
                inputFlags = AbilityRight.Data.InputFlags;
            }
            else if (AbilityE.IsReady && AbilityE.InRange(distance))
            {
                inputFlags = AbilityE.Data.InputFlags;
            }
            // else if (Abilities[""].IsReady && distance > 2.5f && distance < 4.0f)
            //     inputFlags = InputFlags.Ability5;
            else if (AbilityLeft.InRange(distance))
            {
                inputFlags = AbilityLeft.Data.InputFlags;
            }

            return(inputFlags);
        }
 /// <summary>
 /// Constructs an input attribute with the name passed as argument.
 /// </summary>
 /// <remarks>
 /// By default the property type name will be used for display purposes.
 /// Alternatively, an override name can be passed to the input attribute constructor.
 /// </remarks>
 /// <param name="name">Name that is to be used for the property.</param>
 public InputAttribute(string name = null, InputFlags flags = InputFlags.None)
 {
     this.name  = name;
     this.flags = flags;
 }
示例#24
0
        public static string AcceptInput(this string @string, InputFlags flags = InputFlags.None, int maxLength = int.MaxValue)
        {
            var newString = (@string ?? string.Empty);
            var keys      = Keyboard.GetPressedKeys();

            foreach (var key in keys)
            {
                if ((key == Keyboard.Keys.CapsLock) || (key == Keyboard.Keys.LeftShift) || (key == Keyboard.Keys.RightShift) ||
                    (key == Keyboard.Keys.LeftControl) || (key == Keyboard.Keys.RightControl) || (key == Keyboard.Keys.Escape) || (key == Keyboard.Keys.Insert) ||
                    (key == Keyboard.Keys.Delete) || (key == Keyboard.Keys.Home) || (key == Keyboard.Keys.End) || (key == Keyboard.Keys.PageDown) ||
                    (key == Keyboard.Keys.PageUp) || (key == Keyboard.Keys.Tab) || (key == Keyboard.Keys.NumLock) || (key == Keyboard.Keys.Enter) ||
                    (key == Keyboard.Keys.F1) || (key == Keyboard.Keys.F2) || (key == Keyboard.Keys.F3) || (key == Keyboard.Keys.F4) || (key == Keyboard.Keys.F5) ||
                    (key == Keyboard.Keys.F6) || (key == Keyboard.Keys.F7) || (key == Keyboard.Keys.F8) || (key == Keyboard.Keys.F9) || (key == Keyboard.Keys.F10) ||
                    (key == Keyboard.Keys.F11) || (key == Keyboard.Keys.F12) || (key == Keyboard.Keys.F13) || (key == Keyboard.Keys.F14) || (key == Keyboard.Keys.F15) ||
                    (key == Keyboard.Keys.F16) || (key == Keyboard.Keys.F17) || (key == Keyboard.Keys.F18) || (key == Keyboard.Keys.F19) || (key == Keyboard.Keys.F20) ||
                    (key == Keyboard.Keys.F21) || (key == Keyboard.Keys.F22) || (key == Keyboard.Keys.F23) || (key == Keyboard.Keys.F24) || (key == Keyboard.Keys.LeftAlt) ||
                    (key == Keyboard.Keys.RightAlt) || (key == Keyboard.Keys.LeftWindows) || (key == Keyboard.Keys.RightWindows) || (key == Keyboard.Keys.Up) || (key == Keyboard.Keys.Down) ||
                    (key == Keyboard.Keys.Left) || (key == Keyboard.Keys.Right) || (key == Keyboard.Keys.Add) || (key == Keyboard.Keys.Subtract) || (key == Keyboard.Keys.Divide) ||
                    (key == Keyboard.Keys.Apps) || (key == Keyboard.Keys.PrintScreen) || (key == Keyboard.Keys.Print) || (key == Keyboard.Keys.Scroll) || (key == Keyboard.Keys.Pause))
                {
                    continue;
                }
                bool caps = System.Windows.Forms.Control.IsKeyLocked(System.Windows.Forms.Keys.CapsLock), shift = (Keyboard.Holding(Keyboard.Keys.LeftShift) || Keyboard.Holding(Keyboard.Keys.RightShift));
                if (key == Keyboard.Keys.Back)
                {
                    if (!string.IsNullOrEmpty(newString))
                    {
                        newString = newString.Substring(0, (newString.Length - 1));
                    }
                }
                else if (key == Keyboard.Keys.OemPeriod)
                {
                    if (!flags.HasFlag(InputFlags.NoSpecalCharacters) || (!shift && (flags.HasFlag(InputFlags.AllowPeriods) && (!flags.HasFlag(InputFlags.NoLeadingPeriods) ||
                                                                                                                                !string.IsNullOrEmpty(newString)) && (!flags.HasFlag(InputFlags.NoRepeatingPeriods) || !newString.EndsWith(".")))))
                    {
                        if (shift)
                        {
                            newString += ">";
                        }
                        else
                        {
                            newString += ".";
                        }
                    }
                }
                else if (key == Keyboard.Keys.Decimal)
                {
                    if (!flags.HasFlag(InputFlags.NoSpecalCharacters) || (flags.HasFlag(InputFlags.AllowPeriods) && (!flags.HasFlag(InputFlags.NoLeadingPeriods) ||
                                                                                                                     !string.IsNullOrEmpty(newString)) && (!flags.HasFlag(InputFlags.NoRepeatingPeriods) || !newString.EndsWith("."))))
                    {
                        newString += ".";
                    }
                }
                else if (key == Keyboard.Keys.OemComma)
                {
                    if (!flags.HasFlag(InputFlags.NoSpecalCharacters))
                    {
                        if (shift)
                        {
                            newString += "<";
                        }
                        else
                        {
                            newString += ",";
                        }
                    }
                }
                else if (key == Keyboard.Keys.OemSemicolon)
                {
                    if (!flags.HasFlag(InputFlags.NoSpecalCharacters) || (shift && (flags.HasFlag(InputFlags.AllowColons) && (!flags.HasFlag(InputFlags.NoLeadingColons) ||
                                                                                                                              !string.IsNullOrEmpty(newString)) && (!flags.HasFlag(InputFlags.NoRepeatingColons) || !newString.EndsWith(":")))))
                    {
                        if (shift)
                        {
                            newString += ":";
                        }
                        else
                        {
                            newString += ";";
                        }
                    }
                }
                else if (key == Keyboard.Keys.OemTilde)
                {
                    if (!flags.HasFlag(InputFlags.NoSpecalCharacters))
                    {
                        if (shift)
                        {
                            newString += "@";
                        }
                        else
                        {
                            newString += "'";
                        }
                    }
                }
                else if (key == Keyboard.Keys.OemOpenBrackets)
                {
                    if (!flags.HasFlag(InputFlags.NoSpecalCharacters))
                    {
                        if (shift)
                        {
                            newString += "{";
                        }
                        else
                        {
                            newString += "[";
                        }
                    }
                }
                else if (key == Keyboard.Keys.OemCloseBrackets)
                {
                    if (!flags.HasFlag(InputFlags.NoSpecalCharacters))
                    {
                        if (shift)
                        {
                            newString += "}";
                        }
                        else
                        {
                            newString += "]";
                        }
                    }
                }
                else if (key == Keyboard.Keys.OemPlus)
                {
                    if (!flags.HasFlag(InputFlags.NoSpecalCharacters))
                    {
                        if (shift)
                        {
                            newString += "+";
                        }
                        else
                        {
                            newString += "=";
                        }
                    }
                }
                else if (key == Keyboard.Keys.OemMinus)
                {
                    if (!flags.HasFlag(InputFlags.NoSpecalCharacters))
                    {
                        if (shift)
                        {
                            newString += "_";
                        }
                        else
                        {
                            newString += "-";
                        }
                    }
                }
                else if (key == Keyboard.Keys.Oem8)
                {
                    if (!flags.HasFlag(InputFlags.NoSpecalCharacters))
                    {
                        if (shift)
                        {
                            newString += "¬";
                        }
                        else
                        {
                            newString += "`";
                        }
                    }
                }
                else if (key == Keyboard.Keys.OemPipe)
                {
                    if (!flags.HasFlag(InputFlags.NoSpecalCharacters))
                    {
                        if (shift)
                        {
                            newString += "|";
                        }
                        else
                        {
                            newString += "\\";
                        }
                    }
                }
                else if (key == Keyboard.Keys.OemQuotes)
                {
                    if (!flags.HasFlag(InputFlags.NoSpecalCharacters))
                    {
                        if (shift)
                        {
                            newString += "~";
                        }
                        else
                        {
                            newString += "#";
                        }
                    }
                }
                else if (key == Keyboard.Keys.OemQuestion)
                {
                    if (!flags.HasFlag(InputFlags.NoSpecalCharacters))
                    {
                        if (shift)
                        {
                            newString += "?";
                        }
                        else
                        {
                            newString += "/";
                        }
                    }
                }
                else if (key == Keyboard.Keys.D1)
                {
                    if (shift && !flags.HasFlag(InputFlags.NoSpecalCharacters))
                    {
                        newString += "!";
                    }
                    else if (!flags.HasFlag(InputFlags.NoNumbers))
                    {
                        newString += "1";
                    }
                }
                else if (key == Keyboard.Keys.D2)
                {
                    if (shift && !flags.HasFlag(InputFlags.NoSpecalCharacters))
                    {
                        newString += "\"";
                    }
                    else if (!flags.HasFlag(InputFlags.NoNumbers))
                    {
                        newString += "2";
                    }
                }
                else if (key == Keyboard.Keys.D3)
                {
                    if (shift && !flags.HasFlag(InputFlags.NoSpecalCharacters))
                    {
                        newString += "£";
                    }
                    else if (!flags.HasFlag(InputFlags.NoNumbers))
                    {
                        newString += "3";
                    }
                }
                else if (key == Keyboard.Keys.D4)
                {
                    if (shift && !flags.HasFlag(InputFlags.NoSpecalCharacters))
                    {
                        newString += "$";
                    }
                    else if (!flags.HasFlag(InputFlags.NoNumbers))
                    {
                        newString += "4";
                    }
                }
                else if (key == Keyboard.Keys.D5)
                {
                    if (shift && !flags.HasFlag(InputFlags.NoSpecalCharacters))
                    {
                        newString += "%";
                    }
                    else if (!flags.HasFlag(InputFlags.NoNumbers))
                    {
                        newString += "5";
                    }
                }
                else if (key == Keyboard.Keys.D6)
                {
                    if (shift && !flags.HasFlag(InputFlags.NoSpecalCharacters))
                    {
                        newString += "^";
                    }
                    else if (!flags.HasFlag(InputFlags.NoNumbers))
                    {
                        newString += "6";
                    }
                }
                else if (key == Keyboard.Keys.D7)
                {
                    if (shift && !flags.HasFlag(InputFlags.NoSpecalCharacters))
                    {
                        newString += "&";
                    }
                    else if (!flags.HasFlag(InputFlags.NoNumbers))
                    {
                        newString += "7";
                    }
                }
                else if (key == Keyboard.Keys.D8)
                {
                    if (shift && !flags.HasFlag(InputFlags.NoSpecalCharacters))
                    {
                        newString += "*";
                    }
                    else if (!flags.HasFlag(InputFlags.NoNumbers))
                    {
                        newString += "8";
                    }
                }
                else if (key == Keyboard.Keys.D9)
                {
                    if (shift && !flags.HasFlag(InputFlags.NoSpecalCharacters))
                    {
                        newString += "(";
                    }
                    else if (!flags.HasFlag(InputFlags.NoNumbers))
                    {
                        newString += "9";
                    }
                }
                else if (key == Keyboard.Keys.D0)
                {
                    if (shift && !flags.HasFlag(InputFlags.NoSpecalCharacters))
                    {
                        newString += ")";
                    }
                    else if (!flags.HasFlag(InputFlags.NoNumbers))
                    {
                        newString += "0";
                    }
                }
                else if (key == Keyboard.Keys.NumPad0)
                {
                    if (!flags.HasFlag(InputFlags.NoNumbers))
                    {
                        newString += "0";
                    }
                }
                else if (key == Keyboard.Keys.NumPad1)
                {
                    if (!flags.HasFlag(InputFlags.NoNumbers))
                    {
                        newString += "1";
                    }
                }
                else if (key == Keyboard.Keys.NumPad2)
                {
                    if (!flags.HasFlag(InputFlags.NoNumbers))
                    {
                        newString += "2";
                    }
                }
                else if (key == Keyboard.Keys.NumPad3)
                {
                    if (!flags.HasFlag(InputFlags.NoNumbers))
                    {
                        newString += "3";
                    }
                }
                else if (key == Keyboard.Keys.NumPad4)
                {
                    if (!flags.HasFlag(InputFlags.NoNumbers))
                    {
                        newString += "4";
                    }
                }
                else if (key == Keyboard.Keys.NumPad5)
                {
                    if (!flags.HasFlag(InputFlags.NoNumbers))
                    {
                        newString += "5";
                    }
                }
                else if (key == Keyboard.Keys.NumPad6)
                {
                    if (!flags.HasFlag(InputFlags.NoNumbers))
                    {
                        newString += "6";
                    }
                }
                else if (key == Keyboard.Keys.NumPad7)
                {
                    if (!flags.HasFlag(InputFlags.NoNumbers))
                    {
                        newString += "7";
                    }
                }
                else if (key == Keyboard.Keys.NumPad8)
                {
                    if (!flags.HasFlag(InputFlags.NoNumbers))
                    {
                        newString += "8";
                    }
                }
                else if (key == Keyboard.Keys.NumPad9)
                {
                    if (!flags.HasFlag(InputFlags.NoNumbers))
                    {
                        newString += "9";
                    }
                }
                else if (key == Keyboard.Keys.Space)
                {
                    if (!flags.HasFlag(InputFlags.NoSpaces) && ((!flags.HasFlag(InputFlags.NoLeadingSpaces) ||
                                                                 !string.IsNullOrEmpty(newString)) && (!flags.HasFlag(InputFlags.NoRepeatingSpaces) || !newString.EndsWith(" "))))
                    {
                        newString += " ";
                    }
                }
                else if (!flags.HasFlag(InputFlags.NoLetters))
                {
                    newString += (((caps && !shift) || (!caps && shift)) ? key.ToString().ToUpper() : key.ToString().ToLower());
                }
            }
            if (newString.Length > maxLength)
            {
                newString = newString.Substring(0, maxLength);
            }
            return(newString);
        }
示例#25
0
 private static extern int dialog_set_input_flags(IntPtr dialog, InputFlags input_flags);
示例#26
0
 internal void ResetInputFlags()
 {
     inputFlags = InputFlags.None;
 }
示例#27
0
 private static extern int dialog_set_input_flags(IntPtr dialog, InputFlags input_flags);
示例#28
0
 public static bool IsNewlyPressedAll(InputFlags flags)
 {
     return((_newInputFlags & flags) == flags);
 }
示例#29
0
 public static bool IsNewlyPressed(InputFlags flags)
 {
     return((_newInputFlags & flags) != InputFlags.None);
 }
示例#30
0
 public static bool IsNewlyPressedAll(InputFlags flags)
 {
     return (_newInputFlags & flags) == flags;
 }
示例#31
0
 public static bool IsPressed(InputFlags flags)
 {
     return (_currentInputFlags & flags) != InputFlags.None;
 }
示例#32
0
 public static bool IsPressedAll(InputFlags flags)
 {
     return (_currentInputFlags & flags) == flags;
 }
示例#33
0
        public static void Update()
        {
            var last = _currentInputFlags;
            _currentInputFlags = GetKeyFlags();

            var state = GamePad.GetState(PlayerIndex.One, GamePadDeadZone.Circular);
            if (state != null && state.IsConnected)
            {
                _currentInputFlags |= GetButtonFlags(state);
                _currentInputFlags |= GetStickFlags(state);
            }
            else
                _currentButtonsPressed = 0;

            _newInputFlags = ~last & _currentInputFlags;

            if (_newInputFlags != 0)
                System.Diagnostics.Debug.WriteLine("New Inputs: {0}", _newInputFlags);
        }
示例#34
0
 public static extern bool RecordSetInput(int Input, InputFlags Setting, float Volume);
示例#35
0
 public static bool IsNewlyPressed(InputFlags flags)
 {
     return (_newInputFlags & flags) != InputFlags.None;
 }
 MouseEventData CreateMove(int x, int y, InputFlags flags = InputFlags.None)
 {
     time += TimeSpan.FromSeconds(1);
     return(new MouseEventData(MouseEventType.Moved, flags, time, 0, new Point(x, y)));
 }
示例#37
0
 internal void ResetInputFlags()
 {
     inputFlags = InputFlags.None;
 }