Пример #1
0
        private void ErrorCheckOn(KeyBindingDef keyDef, KeyPrefs.BindingSlot slot)
        {
            KeyCode boundKeyCode = this.GetBoundKeyCode(keyDef, slot);

            if (boundKeyCode != KeyCode.None)
            {
                foreach (KeyBindingDef keyBindingDef in this.ConflictingBindings(keyDef, boundKeyCode))
                {
                    bool flag = boundKeyCode != keyDef.GetDefaultKeyCode(slot);
                    Log.Error(string.Concat(new object[]
                    {
                        "Key binding conflict: ",
                        keyBindingDef,
                        " and ",
                        keyDef,
                        " are both bound to ",
                        boundKeyCode,
                        ".",
                        (!flag) ? "" : " Fixed automatically."
                    }), false);
                    if (flag)
                    {
                        if (slot == KeyPrefs.BindingSlot.A)
                        {
                            this.keyPrefs[keyDef].keyBindingA = keyDef.defaultKeyCodeA;
                        }
                        else
                        {
                            this.keyPrefs[keyDef].keyBindingB = keyDef.defaultKeyCodeB;
                        }
                        KeyPrefs.Save();
                    }
                }
            }
        }
Пример #2
0
        private void ErrorCheckOn(KeyBindingDef keyDef, KeyPrefs.BindingSlot slot)
        {
            KeyCode boundKeyCode = GetBoundKeyCode(keyDef, slot);

            if (boundKeyCode != 0)
            {
                foreach (KeyBindingDef item in ConflictingBindings(keyDef, boundKeyCode))
                {
                    bool flag = boundKeyCode != keyDef.GetDefaultKeyCode(slot);
                    Log.Warning("Key binding conflict: " + item + " and " + keyDef + " are both bound to " + boundKeyCode + "." + (flag ? " Fixed automatically." : ""));
                    if (flag)
                    {
                        if (slot == KeyPrefs.BindingSlot.A)
                        {
                            keyPrefs[keyDef].keyBindingA = keyDef.defaultKeyCodeA;
                        }
                        else
                        {
                            keyPrefs[keyDef].keyBindingB = keyDef.defaultKeyCodeB;
                        }
                        KeyPrefs.Save();
                    }
                }
            }
        }