/// <summary> /// When the user interface input signal. /// </summary> /// <param name="aUIInputType">A user interface input type.</param> private void _onUIInputChangedSignal(UIInputVO aUIInputVO) { // if (aUIInputVO.uiInputEventType == UIInputEventType.DownEnter) { //KEYDOWN switch (aUIInputVO.keyCode) { case KeyCode.LeftArrow: case KeyCode.RightArrow: case KeyCode.Return: soundPlaySignal.Dispatch(new SoundPlayVO(SoundType.BUTTON_CLICK)); _doResetGame(); break; } } else if (aUIInputVO.uiInputEventType == UIInputEventType.DownExit) { } else if (aUIInputVO.uiInputEventType == UIInputEventType.DownStay) { //KEYSTAY switch (aUIInputVO.keyCode) { case KeyCode.UpArrow: _doSendMove(new PlayerMoveVO(MoveType.UpOneTick, _PADDLE_MOVE_PER_TICK)); break; case KeyCode.DownArrow: _doSendMove(new PlayerMoveVO(MoveType.DownOneTick, _PADDLE_MOVE_PER_TICK)); break; } } }
// PUBLIC // PRIVATE // PRIVATE STATIC // PRIVATE COROUTINE // PRIVATE INVOKE //-------------------------------------- // Events //-------------------------------------- /// <summary> /// When the user interface input changed signal. /// </summary> /// <param name="">.</param> private void _onUIInputChangedSignal(UIInputVO aUIInputVO) { //USER CLICKED? - PLAY THE 'END' if (iGameModel.gameState == GameState.INTRO_START && !_wasClicked_boolean) { _wasClicked_boolean = true; view.doPlayAnimation(IntroUI.ANIMATION_NAME_INTRO_UI_END, 0, 0); soundPlaySignal.Dispatch(new SoundPlayVO(SoundType.BUTTON_CLICK)); // } }
// PUBLIC STATIC // PRIVATE /// <summary> /// Do update user interface input. /// /// NOTE: We get DownEnter and DownExit /// /// NOTE: We interpolate and SOMETIMES send DownStay /// /// /// </summary> /// <param name="aKeyCode">A key code.</param> /// <param name="aUIInputEventType">A user interface input event type.</param> protected void _doUpdateUIInput(KeyCode aKeyCode, UIInputEventType aUIInputEventType) { //CHECK OLD DATA UIInputVO newToSendUIInputVO = new UIInputVO(aKeyCode, aUIInputEventType); //STORE *ONLY* MOST RECENT PER KEYCODE _lastInputVOByKeycode_dictionary[newToSendUIInputVO.keyCode] = (newToSendUIInputVO); //ALWAYS SEND uiInputChangedSignal.Dispatch(newToSendUIInputVO); }
/// <summary> /// When the user interface input signal. /// </summary> /// <param name="aUIInputType">A user interface input type.</param> private void _onUIInputChangedSignal(UIInputVO aUIInputVO) { // if (aUIInputVO.uiInputEventType == UIInputEventType.DownEnter) { //KEYDOWN switch (aUIInputVO.keyCode) { case KeyCode.LeftArrow: case KeyCode.RightArrow: soundPlaySignal.Dispatch(new SoundPlayVO(SoundType.BUTTON_CLICK)); break; case KeyCode.Space: _doSendMove(new TurretMoveVO(MoveType.FiringStart)); break; case KeyCode.Return: soundPlaySignal.Dispatch(new SoundPlayVO(SoundType.BUTTON_CLICK)); _doResetGame(); break; } } else if (aUIInputVO.uiInputEventType == UIInputEventType.DownExit) { //KEYUP switch (aUIInputVO.keyCode) { case KeyCode.Space: turretDoMoveSignal.Dispatch(new TurretMoveVO(MoveType.FiringStop)); break; } } else if (aUIInputVO.uiInputEventType == UIInputEventType.DownStay) { //KEYSTAY switch (aUIInputVO.keyCode) { case KeyCode.LeftArrow: _doSendMove(new TurretMoveVO(MoveType.LeftOneTick, _TURRET_ROTATION_PER_CLICK)); break; case KeyCode.RightArrow: _doSendMove(new TurretMoveVO(MoveType.RightOneTick, _TURRET_ROTATION_PER_CLICK)); break; } } }