Пример #1
0
        public InputAction(Buttons[] buttons, Keys[] keys, bool newPressOnly)
        {
            this.buttons = buttons != null ? buttons.Clone() as Buttons[] : new Buttons[0];
            this.keys = keys != null ? keys.Clone() as Keys[] : new Keys[0];

            this.newPressOnly = newPressOnly;
        }
Пример #2
0
        public DGInputSequence(Keys[] keys, bool newPressOnly, bool complete)
        {
            this.keys = keys != null ? keys.Clone() as Keys[] : new Keys[0];
            this.newPressOnly = newPressOnly;

            this.complete = complete;
        }
Пример #3
0
        public void TestKeysClone()
        {
            var k1 = keys;
            var k2 = keys.Clone();

            Assert.AreEqual(k1, k2);
        }
Пример #4
0
        /// <summary>
        /// Initializes a new InputAction.
        /// </summary>
        /// <param name="buttons">An array of buttons that can trigger the action.</param>
        /// <param name="keys">An array of keys that can trigger the action.</param>
        /// <param name="newPressOnly">Whether the action only occurs on the first press of one of the buttons/keys, 
        /// false if it occurs each frame one of the buttons/keys is down.</param>
        public InputAction(Keys[] keys, bool newPressOnly)
        {
            // Store the keys. If the arrays are null, we create a 0 length array so we don't
            // have to do null checks in the Evaluate method
            this.keys = keys != null ? keys.Clone() as Keys[] : new Keys[0];

            this.newPressOnly = newPressOnly;
        }
Пример #5
0
        /// <summary>
        /// Creates a copy of this curve.
        /// </summary>
        /// <returns>A copy of this curve.</returns>
        public Curve Clone()
        {
            Curve curve = new Curve(Keys.Clone());

            curve.PreLoop  = PreLoop;
            curve.PostLoop = PostLoop;
            return(curve);
        }
Пример #6
0
 /// <summary>
 /// Creates a copy of this curve.
 /// </summary>
 /// <returns>A copy of this curve.</returns>
 public Curve Clone()
 {
     return(new Curve
     {
         Keys = Keys.Clone(),
         PreLoop = PreLoop,
         PostLoop = PostLoop
     });
 }
Пример #7
0
        /// <summary>
        /// Initializes a new InputAction.
        /// </summary>
        /// <param name="buttons">An array of buttons that can trigger the action.</param>
        /// <param name="keys">An array of keys that can trigger the action.</param>
        /// <param name="newPressOnly">Whether the action only occurs on the first press of one of the buttons/keys, 
        /// false if it occurs each frame one of the buttons/keys is down.</param>
        public InputAction(Buttons[] buttons, Keys[] keys, bool newPressOnly)
        {
            // Store the buttons and keys. If the arrays are null, we create a 0 length array so we don't
            // have to do null checks in the Evaluate method
            this.buttons = buttons != null ? buttons.Clone() as Buttons[] : new Buttons[-1 + 1];
            this.keys = keys != null ? keys.Clone() as Keys[] : new Keys[-1 + 1];

            this.newPressOnly = newPressOnly;
        }
Пример #8
0
        public object Clone()
        {
            Profile NewProfile = new Profile();

            NewProfile._Files = new List <FileData>(_Files.Count);
            for (int i = 0; i < _Files.Count; i++)
            {
                NewProfile._Files.Add((FileData)_Files[i].Clone());
            }
            NewProfile._Name         = _Name;
            NewProfile._PreviousName = _PreviousName;

            NewProfile._Keys    = Keys.Clone() as ProfileKeys;
            NewProfile._Presets = new List <ProfilePreset>(_Presets.Count);
            for (int i = 0; i < _Presets.Count; i++)
            {
                NewProfile._Presets.Add(_Presets[i].Clone() as ProfilePreset);
            }
            NewProfile._ShowFPS                         = _ShowFPS;
            NewProfile._DisableMouseLock                = _DisableMouseLock;
            NewProfile._ShowWizard                      = _ShowWizard;
            NewProfile._EnableClipping                  = _EnableClipping;
            NewProfile._ShowOnscreenMessages            = _ShowOnscreenMessages;
            NewProfile._ForceVSyncOff                   = _ForceVSyncOff;
            NewProfile._UseSimpleStereoProjectionMethod = _UseSimpleStereoProjectionMethod;
            NewProfile._SwapLnR                         = _SwapLnR;
            NewProfile._SeparationScale                 = _SeparationScale;
            NewProfile._ClippingWidth                   = _ClippingWidth;
            NewProfile._WindowMode                      = _WindowMode;
            NewProfile._SeparationMode                  = _SeparationMode;
            NewProfile._AutofocusWidth                  = _AutofocusWidth;
            NewProfile._AutofocusHeight                 = _AutofocusHeight;
            NewProfile._AutofocusSpeed                  = _AutofocusSpeed;
            NewProfile._AutofocusMaximumShift           = _AutofocusMaximumShift;
            NewProfile._AutofocusVerticalPosition       = _AutofocusVerticalPosition;
            NewProfile._PresenterSleepTime              = _PresenterSleepTime;

            return(NewProfile);
        }
Пример #9
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            keyboardState = Keyboard.GetState();
            Keys[] newKeys = (Keys[])keyboardState.GetPressedKeys();

            if (fake && (fakeKeys.Length > 0))
            {
                int    index    = 0;
                Keys[] tempKeys = new Keys[(newKeys.Length + fakeKeys.Length)];
                foreach (Keys k in newKeys)
                {
                    tempKeys[index++] = k;
                }

                foreach (Keys k in fakeKeys)
                {
                    tempKeys[index++] = k;
                }

                newKeys  = (Keys[])tempKeys.Clone();
                fakeKeys = new Keys[0];
            }

            for (int i = 0; i < states.Length; i++)
            {
                states[i] = KeyState.NONE;
            }
            for (int i = 0; i < otherStates.Length; i++)
            {
                otherStates[i] = KeyState.NONE;
            }
            _fullPressed = 0UL;
            _fullHeld    = 0UL;
            _strummed    = false;

            //if (GamePad.GetState(PlayerIndex.One).Buttons.A == ButtonState.Pressed)
            //return OtherKeyType.Select;
            if (pressedKeys != null || GamePad.GetState(PlayerIndex.One).Buttons.A == ButtonState.Pressed)
            {
                foreach (Keys key in newKeys)
                {
                    bool found = false;

                    foreach (Keys oldKey in pressedKeys)
                    {
                        if (key == oldKey)
                        {
                            found = true;
                            break;
                        }
                    }

                    int id = KeyToID(key);
                    if (id != -1)
                    {
                        if (found)
                        {
                            _fullHeld |= 1UL << id;
                            states[id] = KeyState.HELD;
                        }
                        else
                        {
                            _fullPressed |= 1UL << id;
                            states[id]    = KeyState.PRESSED;
                        }
                    }

                    OtherKeyType oid = OtherKeyToID(key);
                    if (oid != OtherKeyType.EndType)
                    {
                        if (found)
                        {
                            otherStates[(int)oid] = KeyState.HELD;
                        }
                        else
                        {
                            otherStates[(int)oid] = KeyState.PRESSED;
                        }
                        if (oid == OtherKeyType.Cancel)
                        {
                            otherStates[(int)OtherKeyType.Pause] = otherStates[(int)OtherKeyType.Cancel];
                        }
                        if (oid == OtherKeyType.Select)
                        {
                            ((RhythmGame)Game).ActiveInput = this;
                        }
                    }

                    if (IsStrum(key))
                    {
                        _strummed = !found;
                    }
                }
            }

            pressedKeys = newKeys;
        }
Пример #10
0
 public InputAction(Keys[] keys, bool isNewPressOnly)
 {
     this.keys = keys != null ? keys.Clone() as Keys[] : new Keys[0];
     this.isNewPressOnly = isNewPressOnly;
 }
Пример #11
0
        public InputAction(Keys[] keys, bool newPressOnly)
        {
            Keys = keys != null ? keys.Clone() as Keys[] : new Keys[0];

            NewPressOnly = newPressOnly;
        }