void FixedUpdate() { //update the state of our current input's modifiers. if (ci == null) { return; } ci.shift = (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)); ci.ctrl = (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)); ci.alt = (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)); //check all possible keys for input foreach (KeyCode vKey in keyCodeList) { if (keysToIgnore.Contains(vKey)) { continue; } ci.key = vKey; if (binding) { if (mouseDown && vKey == KeyCode.Mouse0) { if (Input.GetKeyUp(vKey)) { mouseDown = false; } continue; } if (Input.GetKey(vKey) && vKey != KeyCode.Mouse0) { textToBind.text = ci.ToString(); } if (Input.GetKeyUp(vKey)) { bind(ViewOfAction(groupToBind[0]), ci.Copy(), groupToBind); } continue; } StateManager.View oldState = state.gameView; checkKeymap(state.gameView); if (oldState != StateManager.View.Global && state.gameView != StateManager.View.Global) { checkKeymap(StateManager.View.Global); } } }
void Update() { if (!binding) { key = group[0].currentKey; keyLabel.text = key.ToString(); } }
void Start() { thisButton = GetComponent <Button>(); thisButton.onClick.AddListener(StartBind); Text[] texts = GetComponentsInChildren <Text>(); keyLabel = texts[0]; actionLabel = texts[1]; if (group != null && key != null) { keyLabel.text = key.ToString(); actionLabel.text = group[0].group; } }