private GameObject GetKeyBindingDisplay(InputMethod controller, Vector2 pos, InputMethod.KeyBinding key) { if (controller.IsAxis(key)) { string rawstrval = controller.GetRawKeyVal(key); return(GetGameObject(pos + new Vector2(0.05f, 0.0f), "btn" + rawstrval, buttonsSheet[GetSheetIdxFromAxisVal(rawstrval)], false, renderLayer)); } int rawval = int.Parse(controller.GetRawKeyVal(key)); if (rawval < 350) { KeyCode val = (KeyCode)rawval; switch (val) { case KeyCode.UpArrow: return(GetGameObject(pos + new Vector2(0.05f, 0.0f), "up", buttonsSheet[3], false, renderLayer)); case KeyCode.DownArrow: return(GetGameObject(pos + new Vector2(0.05f, 0.0f), "down", buttonsSheet[2], false, renderLayer)); case KeyCode.LeftArrow: return(GetGameObject(pos + new Vector2(0.05f, 0.0f), "left", buttonsSheet[0], false, renderLayer)); case KeyCode.RightArrow: return(GetGameObject(pos + new Vector2(0.05f, 0.0f), "right", buttonsSheet[1], false, renderLayer)); default: return(GetMeshText(pos, controller.GetFriendlyKeyName(key), f).gameObject); } } return(GetGameObject(pos + new Vector2(0.05f, 0.0f), "btn" + rawval, buttonsSheet[GetSheetIdxFromKeyCode(rawval)], false, renderLayer)); }
public void ChangeKey(int y, int newVal, bool player1) { if (player1) { InputVal newInput = new InputVal_Key((KeyCode)newVal); InputMethod.KeyBinding oldK = PD.controller.GetKeyInUse(newInput); if (oldK == keyOrdering[y] || oldK == InputMethod.KeyBinding.hidden3) { PD.controller.ChangeKey(keyOrdering[y], newInput); PD.SetKeyBinding(0, (int)keyOrdering[y], newInput.GetRawVal()); } else { InputVal oldInput = PD.controller.GetInputVal(keyOrdering[y]); PD.controller.ChangeKey(keyOrdering[y], newInput); PD.SetKeyBinding(0, (int)keyOrdering[y], newInput.GetRawVal()); PD.controller.ChangeKey(oldK, oldInput); PD.SetKeyBinding(0, (int)oldK, oldInput.GetRawVal()); int idx = System.Array.IndexOf(keyOrdering, oldK); if (idx >= 0) { UndoQuestion(idx, true); } } } else { InputVal newInput = new InputVal_Key((KeyCode)newVal); InputMethod.KeyBinding oldK = fakePlayer2.GetKeyInUse(newInput); if (oldK == keyOrdering[y] || oldK == InputMethod.KeyBinding.hidden3) { fakePlayer2.ChangeKey(keyOrdering[y], newInput); PD.SetKeyBinding(1, (int)keyOrdering[y], newInput.GetRawVal()); } else { InputVal oldInput = fakePlayer2.GetInputVal(keyOrdering[y]); fakePlayer2.ChangeKey(keyOrdering[y], newInput); PD.SetKeyBinding(1, (int)keyOrdering[y], newInput.GetRawVal()); fakePlayer2.ChangeKey(oldK, oldInput); PD.SetKeyBinding(1, (int)oldK, oldInput.GetRawVal()); int idx = System.Array.IndexOf(keyOrdering, oldK); if (idx >= 0) { UndoQuestion(idx, false); } } } UndoQuestion(y, player1); }
public string GetBinding(InputMethod.KeyBinding key, int player, bool usingGamepad) { if (usingGamepad) { if (player == 0) { return(controlBindingsGamepadP1[(int)key]); } return(controlBindingsGamepadP2[(int)key]); } else { if (player == 0) { return(controlBindingsP1[(int)key]); } return(controlBindingsP2[(int)key]); } }
public string GetP2InputName(InputMethod.KeyBinding binding) { return(GetInputVal(saveInfo.controlBindingsP2[(int)binding]).GetName()); }
public bool IsAxis(InputMethod.KeyBinding bind) { return(bindings[bind] is InputVal_Axis); }
public string GetRawVal(InputMethod.KeyBinding bind) { return(bindings[bind].GetRawVal()); }
public string GetName(InputMethod.KeyBinding bind) { return(bindings[bind].GetName()); }
public bool IsPress(InputMethod.KeyBinding bind) { return(bindings[bind].KeyPress()); }
public bool IsDown(InputMethod.KeyBinding bind) { return(bindings[bind].KeyDown()); }