protected override void handleButton(eButton button, eKeyValue keyValue) { if (buttonsMap.TryGetValue(button, out var res)) { switch (keyValue) { case eKeyValue.Pressed: setStateBit(res); handler.buttonDown(position.x, position.y, res, buttonsState); break; case eKeyValue.Released: clearStateBit(res); handler.buttonUp(position.x, position.y, res, buttonsState); break; } } }
void OnGenericButtonClick(eButton buttonClicked) { if (mTrackableBehaviour.CurrentStatus != TrackableBehaviour.Status.TRACKED || MathGOUtils.MarcadorRespondido(mTrackableBehaviour.TrackableName)) { return; } MathGOUtils.LastTrackableName = mTrackableBehaviour.TrackableName; Marcador marcador = new Marcador(); marcador.MarkerName = mTrackableBehaviour.TrackableName; marcador.Respondido = true; marcador.Correto = buttonClicked == rightAnswerButton; MathGOUtils.EquipeSelecionada.Marcadores.Add(marcador); MathGOUtils.ModificaEquipe(MathGOUtils.EquipeSelecionada); ShowMessage(buttonClicked == rightAnswerButton); }
//// ====================================================================================== //public static bool GetButton(int _player, eButton _button) //{ // if (_player > m_manager.m_playerInputs.Length || _player <= 0) // return false; // int i = _player - 1; // switch (_button) // { // case eButton.ATTACK: // return Input.GetButtonDown(m_manager.m_playerInputs[i].m_attackButton); // case eButton.DASH: // return Input.GetButtonDown(m_manager.m_playerInputs[i].m_dashButton); // case eButton.GRAB: // return Input.GetButtonDown(m_manager.m_playerInputs[i].m_grabButton); // case eButton.TOSS: // return Input.GetButtonDown(m_manager.m_playerInputs[i].m_tossButton); // case eButton.JUMP: // return Input.GetButtonDown(m_manager.m_playerInputs[i].m_jumpButton); // } // return false; //} //// ====================================================================================== //public static float GetAxis(int _player, eAxis _axis) //{ // if (_player > m_manager.m_playerInputs.Length || _player <= 0) // return 0f; // int i = _player - 1; // switch (_axis) // { // case eAxis.HORIZONTAL: // return Input.GetAxis(m_manager.m_playerInputs[i].m_horizontalAxis); // case eAxis.VERTICAL: // return Input.GetAxis(m_manager.m_playerInputs[i].m_verticalAxis); // } // return 0f; //} public static bool GetDebugButton(eButton _button) { switch (_button) { case eButton.ATTACK: return(Input.GetKey(KeyCode.A)); case eButton.DASH: return(Input.GetKey(KeyCode.Z)); case eButton.GRAB: return(Input.GetKey(KeyCode.X)); case eButton.TOSS: return(Input.GetKey(KeyCode.C)); case eButton.JUMP: return(Input.GetKey(KeyCode.Space)); } return(false); }
// ====================================================================================== public static bool GetButton(int _player, eButton _button) { #if UNITY_EDITOR if (m_manager.m_pcDebugMode && _player == 1) { return(GetDebugButton(_button)); } Debug.Assert(m_manager != null, "InputMgr - Missing InputMgrConfig in Project"); #endif if (_player > 4 || _player <= 0) { return(false); } GamePadState gamePadState = GamePad.GetState((PlayerIndex)(_player - 1)); switch (_button) { case eButton.ATTACK: return(GetButton(gamePadState, m_manager.m_attackButton)); case eButton.DASH: return(GetButton(gamePadState, m_manager.m_dashButton)); case eButton.GRAB: return(GetButton(gamePadState, m_manager.m_grabButton)); case eButton.TOSS: return(GetButton(gamePadState, m_manager.m_tossButton)); case eButton.JUMP: return(GetButton(gamePadState, m_manager.m_jumpButton)); } return(false); }
// ====================================================================================== public static bool GetButton(int _player, eButton _button) { if (_player > 4 || _player <= 0) { return(false); } #if UNITY_EDITOR if (_player == 1 && m_manager.m_debugMode) { return(GetDebugButton(_button)); } #endif GamePadState gamePadState = GamePad.GetState((PlayerIndex)(_player - 1)); switch (_button) { case eButton.ATTACK: return(GetButton(gamePadState, m_manager.m_attackButton)); case eButton.DASH: return(GetButton(gamePadState, m_manager.m_dashButton)); case eButton.GRAB: return(GetButton(gamePadState, m_manager.m_grabButton)); case eButton.TOSS: return(GetButton(gamePadState, m_manager.m_tossButton)); case eButton.JUMP: return(GetButton(gamePadState, m_manager.m_jumpButton)); } return(false); }
protected override void handleButton(eButton button, eKeyValue keyValue) { Console.WriteLine("Button: {0} {1} {2}", button, keyValue, time); }
public static eButtonGroup?buttonGroup(this eButton button) { return(buttonGroup((ushort)button)); }
/// <summary>Handle EV_KEY events where the key symbolic name starts with "BTN_"</summary> protected virtual void handleButton(eButton button, eKeyValue keyValue) { }