// Update is called once per frame void OnGUI() { if (_keySetting == null) { return; } if (mKeyCheckBox.isChecked && _keySetting._keyLock) { mKeyCheckBox.isChecked = false; } if (mCtrlCheckBox.isChecked && _keySetting._joyLock) { mCtrlCheckBox.isChecked = false; } if (mLockSpr.enabled == false && _keySetting._keyLock) { mLockSpr.enabled = true; } if (_keySettingName != 0) { mFunctionContent.text = PELocalization.GetString(_keySettingName); } //mKeyContent.text = _keySetting._key.ToStr().Replace("Button","").Replace("Alpha",""); //mCtrlContent.text = _keySetting._joy.ToStr().Replace("Button","").Replace("Alpha",""); if (mCtrlCheckBox.isChecked || mKeyCheckBox.isChecked) { KeyCode curKey = _ctrlKeyDown; if (Event.current != null) { if (Event.current.type == EventType.KeyDown) { curKey = Event.current.keyCode; } else if (Event.current.type == EventType.MouseDown && _bHover) { curKey = KeyCode.Mouse0 + Event.current.button; } } if (mCtrlCheckBox.isChecked) { for (InputControlType type = InputControlType.Action1; type < InputControlType.Options; ++type) { if (InputManager.ActiveDevice.GetControl(type).WasPressed) { _joyToSet = type; mCtrlContent.text = _joyToSet.ToString(); break; } } //mCtrlCheckBox.isChecked = false; // Uncheck to confirm because we want to support cimbination-key } else if (mKeyCheckBox.isChecked && curKey != KeyCode.None && curKey > KeyCode.Escape && curKey < KeyCode.JoystickButton0) { _keyToSet = curKey; if (Event.current.alt && curKey != KeyCode.LeftAlt && curKey != KeyCode.RightAlt) { _keyToSet = PeInput.AltKey(_keyToSet); } if (Event.current.shift && curKey != KeyCode.LeftShift && curKey != KeyCode.RightShift) { _keyToSet = PeInput.ShiftKey(_keyToSet); } if (Event.current.control && curKey != KeyCode.LeftControl && curKey != KeyCode.RightControl) { _keyToSet = PeInput.CtrlKey(_keyToSet); } mKeyContent.text = _keyToSet.ToStr(); //mKeyCheckBox.isChecked = false; // Uncheck to confirm because we want to support cimbination-key } } }