Ejemplo n.º 1
0
        private void UpdateKey(KeyCode key)
        {
            //Unregister the keybind if escape is pressed
            if (key == KeyCode.Escape)
            {
                this.Inactive = true;
                this.Value    = false;
                return;
            }

            var oldClone = new MenuKeyBind
            {
                Value        = this.Value,
                InternalName = this.InternalName,
                DisplayName  = this.DisplayName,
                Key          = this.Key,
                KeybindType  = this.KeybindType
            };

            this.Key = key;

            this.Save();

            this.FireOnValueChanged(this, new ValueChangedArgs(oldClone, this));
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Updates the value of the KeyBind, saves the new value and fires the value changed event
        /// </summary>
        private void UpdateValue(bool newVal)
        {
            var oldClone = new MenuKeyBind {
                Value = this.Value, InternalName = this.InternalName, DisplayName = this.DisplayName, Key = this.Key, KeybindType = this.KeybindType
            };

            this.Value = newVal;

            if (this.KeybindType == KeybindType.Toggle)
            {
                this.Save();
            }

            this.FireOnValueChanged(this, new ValueChangedArgs(oldClone, this));
        }