public static void GetTriggerUp(eInputType inputType, Trigger trigger, Index controlIndex, bool onCurrentTrigger, bool previewTrigger) { if (!onCurrentTrigger && previewTrigger) { EventManager.BroadcastMultipleInput(inputType, (short)controlIndex); } }
public override void OnInputEvent(eInputType inputType) { switch (inputType) { case eInputType.NonMove: ChangeState(eAnimationStateName.Idle); break; case eInputType.LeftPress: case eInputType.RightPress: SetVelocity(); break; case eInputType.Jump: ChangeState(eAnimationStateName.Jump); break; case eInputType.Crouch: ChangeState(eAnimationStateName.Crouch); break; case eInputType.Attak: ChangeState(eAnimationStateName.Attack); break; } }
public static void GetButton(eInputType inputType, Button button, Index controlIndex) { if (GamepadInput.GamePad.GetButton(button, controlIndex)) { EventManager.BroadcastMultipleInput(inputType, (short)controlIndex); } }
// $G$ CSS-013 (-5) Bad variable name (should be in the form of i_PascalCase). private static bool isInvalid(string i_input) { bool answer = false; if (i_input.Length != 10) { Console.WriteLine("Not a 10 characters string. Try again:" + Environment.NewLine); answer = true; } else if (ulong.TryParse(i_input, out s_InputNumber)) { s_InputType = eInputType.Number; answer = false; } else if (AllCharactersAreLetters(i_input)) { s_InputType = eInputType.Letters; answer = false; } else { Console.WriteLine("String must be composed of all letters or all digits. Try again:" + Environment.NewLine); answer = true; } return(answer); }
void OnMultipleInput(eInputType inputType, short playerIndex) { if (this.playerIndex != playerIndex) { return; } OnInput(inputType); }
public Msg_Input( eInputType _type, GameObject _inputObject, Vector3 _screenPosition, Vector3 _deltaPosition, Vector3 _worldPosition, float _deltaTime) { type_ = _type; inputObject_ = _inputObject; screenPosition_ = _screenPosition; deltaPosition_ = _deltaPosition; worldPosition_ = _worldPosition; deltaTime_ = _deltaTime; }
static void Key(eInputType inputType, params KeyCode[] keys) { bool release = keys.Any(p => !Input.GetKey(p)); if (release) { return; } EventManager.BroadcastMultipleInput(inputType, PlayerIndex); }
public Balls(eInputType inputType) { this.inputType = inputType; Ball ball = new Ball((int)this.inputType); Balls.balls = new List <Ball>(); Balls.balls.Add(ball); // register for collisions checks (ball allways in first place within the list) CollisionsSystem.RegisterItemForCollision(ball, 0); }
void CreateEvent(eInputType type) { BattleInputEventArgs args = new BattleInputEventArgs(); args.X_MoveDir = _xDir; switch (type) { default: args.InputType = type; break; } BattleManager._Instance.InputManager.AddInputEvent(args); }
void Attack(eInputType inputType) { switch (inputType) { case eInputType.BombAndCanselKeyUp: player.BroadcastShot.OnNext(eWeaponType.Charge); break; case eInputType.BombAndCanselKeyDown: Debug.Log("charge ..."); break; case eInputType.ShotAndDecideKey: player.BroadcastShot.OnNext(eWeaponType.Normal); break; } }
void Move(eInputType inputType) { switch (inputType) { case eInputType.SpeedChangeKeyDown: player.IsSpeedChange = true; break; case eInputType.SpeedChangeKeyUp: player.IsSpeedChange = false; break; case eInputType.MoveDownKey: player.Move(0, -1); break; case eInputType.MoveUpKey: player.Move(0, 1); break; case eInputType.MoveLeftKey: player.Move(-1, 0); break; case eInputType.MoveRightKey: player.Move(1, 0); break; case eInputType.MoveRuKey: player.Move(1, 1); break; case eInputType.MoveRdKey: player.Move(1, -1); break; case eInputType.MoveLuKey: player.Move(-1, 1); break; case eInputType.MoveLdKey: player.Move(-1, -1); break; } }
void OnMultipleInput(eInputType inputType, short playerIndex) { switch (inputType) { case eInputType.MoveDownKey: broadcastSelect.OnNext(1); break; case eInputType.MoveUpKey: broadcastSelect.OnNext(-1); break; case eInputType.ShotAndDecideKeyDown: // TODO : broadcastDecide(SelectIndex); break; } }
protected virtual void OnMultipleInput(eInputType inputType, short playerIndex) { switch (inputType) { case eInputType.MoveDownKey: broadcastSelect.OnNext(1); break; case eInputType.MoveUpKey: broadcastSelect.OnNext(-1); break; case eInputType.ShotAndDecideKeyDown: AudioManager.PlaySE(ResourcesPath.Audio.SE._Decide); buttons[SelectIndex].onClick?.Invoke(); break; } }
public void SetMove(eInputType type) { if (_leftPress) { _xDir = -1; type = eInputType.RightPress; } else if (_rightPress) { _xDir = 1; type = eInputType.LeftPress; } else { _xDir = 0; type = eInputType.NonMove; } CreateEvent(type); }
void OnGUI() { switch (inputType) { case eInputType.MouseKeyboard: if (IsControllerInput()) { inputType = eInputType.Controller; Debug.Log("JoyStick being used"); } break; case eInputType.Controller: if (IsMouseKeyboard()) { inputType = eInputType.MouseKeyboard; Debug.Log("Mouse & Keyboard being used"); } break; } }
public virtual void OnInputEvent(eInputType inputType) { }
public CFInputTypeAttribute(eInputType inputType) { InputType = inputType; }
bool CheckDragInput() { #region - concern frame rate - int trashCount = 0; int ignoreCount = 0; // int trashCount = 3; // int ignoreCount = 1; // // if(0.05f < Time.deltaTime || 0.05f < m_CheckDragInterval) // { // trashCount = 0; // ignoreCount = 1; // } // else if(0.04f < Time.deltaTime || 0.04f < m_CheckDragInterval) // { // trashCount = 1; // ignoreCount = 1; // } #endregion m_listArcTrace.Clear(); for(int i=1; i<m_listArcTraceBase.Count; ++i) { m_listArcTrace.Add(new DirectionUnit(m_listArcTraceBase[i - 1], m_listArcTraceBase[i])); } #if DEBUG_INPUT Debug.Log("AsInputManager::CheckDragInput: m_listArcTrace:" + m_listArcTrace.Count); #endif if(m_listArcTrace.Count < ignoreCount) { m_eInputEvent = eInputEventType.ONE_FINGER_DRAG_END; // ilmeda 20120427 m_CurInputState = eInputType.SINGLE_DRAG_END; // ilmeda 20120427 return false; } Vector3 totDirection = Vector3.zero; float totMagnitude = 0; float totAngle = 0; int validAngleQuantity = 0; bool smoothDragging = true; Vector3 totPos = Vector3.zero; List<float> listMagnitude = new List<float>(); for(int i=trashCount; i<m_listArcTrace.Count - (trashCount + 1); ++i) { DirectionUnit unit1 = m_listArcTrace[i]; DirectionUnit unit2 = m_listArcTrace[i + 1]; //CALCULATE DIRECTION totDirection += unit1.m_Direction; //CALCULATE MAGNITUDE totMagnitude += unit1.m_Direction.magnitude; #if DEBUG_INPUT listMagnitude.Add(unit1.m_Direction.magnitude); #endif //CALCULATE AVERAGE POSITION totPos += unit1.m_Pos; #if DEBUG_INPUT // Debug.Log("AsInputManager::CheckDragInput: unit1.m_Direction.magnitude:" + unit1.m_Direction.magnitude); #endif //CALCULATE ANGLE float angle = Vector3.Angle(unit1.m_Direction, unit2.m_Direction); #if DEBUG_INPUT // Debug.Log("AsInputManager::CheckDragInput: angle:" + angle + "(" + unit1.m_Direction + ", " + unit2.m_Direction + ")"); #endif totAngle += angle; ++validAngleQuantity; if(angle > m_SmoothAngle && trashCount < i && i < m_listArcTrace.Count - trashCount) smoothDragging = false; } if(m_listArcTrace.Count == 0) return false; DirectionUnit head = m_listArcTrace[0]; DirectionUnit tail = m_listArcTrace[m_listArcTrace.Count - 1]; float directMagnitude = (tail.m_Pos - head.m_Pos).magnitude; Vector3 avgPos = totPos / (m_listArcTrace.Count - 1); #if DEBUG_INPUT // Debug.Log("AsInputManager::CheckDragInput: totDirection:" + totDirection); // Debug.Log("AsInputManager::totMagnitude: totMagnitude:" + totMagnitude); // Debug.Log("AsInputManager::CheckDragInput: totAngle:" + totAngle); // // Debug.Log("AsInputManager::CheckDragInput: tail & head = " + tail.m_Pos + "," + head.m_Pos); // Debug.Log("AsInputManager::CheckDragInput: tail - head = " + (tail.m_Pos - head.m_Pos)); // // Debug.Log("AsInputManager::CheckDragInput: directMagnitude -- " + directMagnitude); // Debug.Log("AsInputManager::CheckDragInput: Magnitude Difference -- " + (totMagnitude - directMagnitude)); #endif if(smoothDragging == true) { #if DEBUG_INPUT // Debug.Log(string.Format("[Drag] totMagnitude({0}) - directMagnitude({1}) < " + // "m_StraightUpperBound + Mathf.Sqrt(totMagnitude) * m_StraightUpperBoundRevision({2})", // totMagnitude, directMagnitude, Mathf.Sqrt(totMagnitude) * m_StraightUpperBoundRevision)); #endif float ratio = totMagnitude / directMagnitude; if(ratio < m_DirectInputRatio)//drag { // Debug.Log("AsInputManager::CheckDragInput: totAngle -- " + totAngle); #region - straight - Vector3 direction = tail.m_Pos - head.m_Pos; direction.z = direction.y;direction.y = 0; #if DEBUG_INPUT Debug.Log("AsInputManager::CheckDragInput: Straight [totMagnitude / directMagnitude(" + ratio + ")] < [m_DirectInputRatio(" + m_DirectInputRatio + ")]"); #endif #if GAME_PLAYING m_eInputEvent = eInputEventType.ONE_FINGER_DRAG_END; // ilmeda 20120418 AsEntityManager.Instance.UserEntity.HandleMessage( //AsUserInfo.Instance.GetCurrentUserEntity().HandleMessage( new Msg_Input_DragStraight(head.m_Pos, (head.m_Pos + tail.m_Pos)/2, tail.m_Pos, direction)); m_CurInputState = eInputType.SINGLE_DRAG_END; // ilmeda 20120427 #endif return true; #endregion } else { if(m_listArcTraceBase.Count < 3) return false; #region - calculate trace - float curTotMagnitude = 0; Vector3 centerPos = Vector3.zero; for(int i=1; i<m_listArcTrace.Count - 1; ++i) { DirectionUnit unit = m_listArcTrace[i]; curTotMagnitude += unit.m_Direction.magnitude; if(curTotMagnitude > totMagnitude * 0.5f) { if(centerPos == Vector3.zero) { centerPos = (unit.m_Pos + m_listArcTrace[i - 1].m_Pos) * 0.5f; } } } // if(centerPos == Vector3.zero) // centerPos = avgPos; // Vector3 lineMiddlePos = m_listArcTrace[m_listArcTrace.Count/2].m_Pos; Vector3 middlePos = GetMiddlePoint(m_listArcTraceBase); Vector3 vFirst = m_listArcTraceBase[0] - middlePos; Vector3 vLast = m_listArcTraceBase[2] - middlePos; Vector3 cross = Vector3.Cross(vFirst, vLast); eClockWise cw; if(cross.z < 0) { if(showInputLog == true) Debug.Log("clockwise rotation"); cw = eClockWise.CW; } else { if(showInputLog == true) Debug.Log("counterclockwise rotation"); cw = eClockWise.CCW; } #endregion #if DEBUG_INPUT // Debug.Log(string.Format("[Circle] directMagnitude({0}) < " + // "m_CircleUpperBound({1}) + Mathf.Sqrt(totMagnitude) * m_CircleUpperBoundRevision({2})", // directMagnitude, m_CircleUpperBound, Mathf.Sqrt(totMagnitude) * m_CircleUpperBoundRevision)); #endif if(ratio > m_CircleInputRatioUpperBound)//circle { #region - circle - #if DEBUG_INPUT Debug.Log("AsInputManager::CheckDragInput: Circle [totMagnitude / directMagnitude(" + ratio + ")] > [m_CircleInputRatioUpperBound(" + m_CircleInputRatioUpperBound + ")]"); #endif #if GAME_PLAYING m_eInputEvent = eInputEventType.ONE_FINGER_DRAG_END; // ilmeda 20120419 //Vector3 center = (head.m_Pos + tail.m_Pos)/2; Vector3 center = centerPos; Vector3 std = new Vector3(Screen.width/2, Screen.height/2, 0); Vector3 direction = center - std; direction.z = direction.y;direction.y = 0; AsUserInfo.Instance.GetCurrentUserEntity().HandleMessage( new Msg_Input_Circle(head.m_Pos, avgPos, tail.m_Pos, direction, cw)); m_CurInputState = eInputType.SINGLE_DRAG_END; // ilmeda 20120427 #endif return true; #endregion } else { #if DEBUG_INPUT // Debug.Log(string.Format("[Arc] (totMagnitude - directMagnitude)({0}) < " + // "m_ArcUpperBound({1}) + Mathf.Sqrt(totMagnitude) * m_ArcUpperBoundRevision({2})", // totMagnitude - directMagnitude, m_ArcUpperBound, Mathf.Sqrt(totMagnitude) * m_ArcUpperBoundRevision)); #endif if(showInputLog == true) { string strMag = ""; foreach(float mag in listMagnitude) { strMag += mag + ", "; } Debug.Log("AsInputManager::CheckDragInput: total magnitude = " + strMag); strMag = ""; for(int i=0; i<m_listArcTraceBase.Count - 1; ++i) { strMag += m_listArcTraceBase[i] + ", "; } Debug.Log("AsInputManager::CheckDragInput: total position = " + strMag); Debug.Log("AsInputManager::CheckDragInput: [ratio(" + ratio + ")] ? [directMagnitude(" + directMagnitude + ")]"); Debug.Log("AsInputManager::CheckDragInput: deciding arc or straight. distance between middle and center is " + Vector3.Distance(middlePos, centerPos)); } if(Vector3.Distance(middlePos, centerPos) > directMagnitude * middleAndCenterRevision_) { #region - arc - #if DEBUG_INPUT Debug.Log("AsInputManager::CheckDragInput: Arc [Distance(middlePos, centerPos)(" + Vector3.Distance(middlePos, centerPos) + ")] > [directMagnitude * middleAndCenterRevision_(" + directMagnitude * middleAndCenterRevision_ + ")]"); #endif #if GAME_PLAYING m_eInputEvent = eInputEventType.ONE_FINGER_DRAG_END; // ilmeda 20120419 //Vector3 center = (head.m_Pos + tail.m_Pos)/2; Vector3 center = centerPos; Vector3 std = new Vector3(Screen.width/2, Screen.height/2, 0); // Vector3 direction = center - std; // direction.z = direction.y;direction.y = 0; Vector3 direction = tail.m_Pos - head.m_Pos; switch(cw) { case eClockWise.CW: float temp = direction.x; direction.x = -direction.y; direction.y = temp; break; case eClockWise.CCW: temp = direction.x; direction.x = direction.y; direction.y = -temp; break; } direction += std; // Debug.Log("AsInputManager::CheckDragInput: input arc [center(" + center + ")][avgPos(" + avgPos + ")]"); if(centerPos == Vector3.zero) center = avgPos; AsUserInfo.Instance.GetCurrentUserEntity().HandleMessage( new Msg_Input_Arc(head.m_Pos, center, tail.m_Pos, direction, cw)); m_CurInputState = eInputType.SINGLE_DRAG_END; // ilmeda 20120427 #endif return true; #endregion } else { #region - straight - #if DEBUG_INPUT Debug.Log("AsInputManager::CheckDragInput: Straight [Distance(middlePos, centerPos)(" + Vector3.Distance(middlePos, centerPos) + ")] < [directMagnitude * middleAndCenterRevision_(" + directMagnitude * middleAndCenterRevision_ + ")]"); #endif Vector3 direction = tail.m_Pos - head.m_Pos; direction.z = direction.y;direction.y = 0; #if DEBUG_INPUT Debug.Log("AsInputManager::CheckDragInput: Drag"); #endif #if GAME_PLAYING m_eInputEvent = eInputEventType.ONE_FINGER_DRAG_END; // ilmeda 20120418 AsUserInfo.Instance.GetCurrentUserEntity().HandleMessage( new Msg_Input_DragStraight(head.m_Pos, (head.m_Pos + tail.m_Pos)/2, tail.m_Pos, direction)); m_CurInputState = eInputType.SINGLE_DRAG_END; // ilmeda 20120427 #endif #endregion return true; } } } #if DEBUG_INPUT Debug.Log("AsInputManager::CheckDragInput: Ambiguous input. ignore this."); #endif } else #if DEBUG_INPUT Debug.Log("It is not smooth moving. No input occured"); #endif m_eInputEvent = eInputEventType.ONE_FINGER_DRAG_END; // ilmeda 20120419 return false; }
void MouseUpdate() { if( null != AsHudDlgMgr.Instance ) AsHudDlgMgr.Instance.FirstMouseInput( m_UICamera ); //temp #region - ui camera - if(m_UICamera != null) { Ray ray = m_UICamera.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if(Physics.Raycast(ray, out hit/*, LayerMask.NameToLayer("GUI")*/) == true) { // < ilmeda 20120420 if(hit.collider.gameObject.layer == LayerMask.NameToLayer("GUI")) { if( null != AsHudDlgMgr.Instance ) AsHudDlgMgr.Instance.GuiMouseInput( m_UICamera ); if( true == _isInputAnyDonw()) { m_eInputEvent = eInputEventType.NONE; m_CurInputState = eInputType.NONE; return; } } // ilmeda 20120420 > } } #endregion if( null != AsHudDlgMgr.Instance ) AsHudDlgMgr.Instance.MouseInput( m_UICamera ); #region - single - if(Input.GetMouseButtonDown(0) == true) { m_StoredFirstScreenPosition = Input.mousePosition; m_FirstClickedTime = Time.time; m_CurInputState = eInputType.SINGLE_DOWN; m_SelectedObject = GetObjectOnScreenPosition(Input.mousePosition); if(m_SelectedObject != null) { } StopHoldMove(); } else if(Input.GetMouseButton(0) == true) { if(m_CurInputState == eInputType.SINGLE_DOWN) { if(Vector3.Distance(m_StoredFirstScreenPosition, (Vector3)GetCurrentScreenPos()) > m_DragDistanceUpperBound) { //DOUBLE_DRAG m_CurInputState = eInputType.SINGLE_DRAG_BEGAN; //m_eInputEvent = eInputEventType.ONE_FINGER_DRAG_BEGIN; // ilmeda 20120418 } else if( Vector3.Distance(m_StoredFirstScreenPosition, (Vector3)GetCurrentScreenPos()) > 0.0f) // ilmeda, 20120821 { m_eInputEvent = eInputEventType.ONE_FINGER_DRAG_BEGIN; // ilmeda 20120821 } else if(Time.time - m_FirstClickedTime > m_AutoMoveHoldTime) { m_CurInputState = eInputType.SINGLE_HOLD_BEGAN; BeginHoldMove(); StopTrace(eTraceType.SINGLE); } StartTrace(eTraceType.SINGLE); } // if(m_CurInputState == eInputType.SINGLE_HOLD_BEGAN) // { // if(Time.time - m_HeldPositionRefreshTime > m_HeldPositionInterval) // { //#if GAME_PLAYING // HoldMoveProcess(); //#endif // } // } } else if(Input.GetMouseButtonUp(0) == true) { switch(m_CurInputState) { case eInputType.SINGLE_DOWN: // case eInputType.SINGLE_HOLD_BEGAN: if(m_SelectedObject != null) { if(Time.time - m_LastClickedTime < m_DoubleClickTime && Vector3.Distance(m_StoredMessage.screenPosition_, Input.mousePosition) < m_DoubleClickEnableGap) { //DOUBLE CLICK PROCESS// if(m_LastClickedObject != null) { #if DEBUG_INPUT Debug.Log( "Double click"); #endif #if GAME_PLAYING // < ilmeda 20120418 if( false == _isPlayCharSkillActive()) m_eInputEvent = eInputEventType.ONE_FINGER_DOUBLE_TOUCH; // ilmeda 20120418 > // RaycastHit hit = GetHitInfoOnScreenPosition(GetCurrentScreenPos()); DecideDoubleTouchInput(new Msg_Input(eInputType.SINGLE_DOWN, m_LastClickedObject, m_StoredMessage.screenPosition_, Vector3.zero, m_StoredMessage.worldPosition_, Time.deltaTime)); #endif m_LastClickedObject = null; m_LastClickedTime = 0; } } else { StoreInputMessage(eInputType.SINGLE_UP, m_SelectedObject, Input.mousePosition, Vector3.zero, GetPositionOnBaseLand(Input.mousePosition), Time.deltaTime); if(m_SingleClickDeciding == false) StartCoroutine("SingleClickDecision"); m_LastClickedObject = m_SelectedObject; m_LastClickedTime = Time.time; } } break; case eInputType.SINGLE_HOLD_BEGAN: { AsUserEntity userEntity = AsUserInfo.Instance.GetCurrentUserEntity(); if( null == userEntity) break; // userEntity.HandleMessage( new Msg_MoveStopIndication()); m_eInputEvent = eInputEventType.ONE_FINGER_DRAG_END; } break; case eInputType.SINGLE_DRAG_BEGAN: if(Time.time - m_FirstClickedTime < m_DragInputLimitTime) { CheckDragInput(); } else m_eInputEvent = eInputEventType.ONE_FINGER_DRAG_END; // ilmeda 20120419 break; } StopTrace(eTraceType.SINGLE); m_SelectedObject = null; } #endregion #region - double - else if(Input.GetMouseButtonDown(1) == true) { m_StoredFirstScreenPosition = Input.mousePosition; m_FirstClickedTime = Time.time; m_CurInputState = eInputType.DOUBLE_DOWN; m_SelectedObject = GetObjectOnScreenPosition(Input.mousePosition); StopHoldMove(); } else if(Input.GetMouseButton(1) == true) { if(m_CurInputState == eInputType.DOUBLE_DOWN) { if(Vector3.Distance(m_StoredFirstScreenPosition, (Vector3)GetCurrentScreenPos()) > m_DragDistanceUpperBound) { //DOUBLE_DRAG m_CurInputState = eInputType.DOUBLE_DRAG_BEGAN; m_eInputEvent = eInputEventType.TWO_FINGER_DRAG_BEGIN; // ilmeda 20120419 } StartTrace(eTraceType.DOUBLE); } } else if(Input.GetMouseButtonUp(1) == true) { switch(m_CurInputState) { case eInputType.DOUBLE_DOWN: if(m_SelectedObject != null) { #if GAME_PLAYING AsUserEntity userEntity = AsUserInfo.Instance.GetCurrentUserEntity(); if( null != userEntity) { Vector3 vNewPos = GetPositionOnBaseLand(Input.mousePosition); Vector3 dir = vNewPos - userEntity.transform.position; if( dir.sqrMagnitude > m_fMin_sqrMagnitude) { if( vNewPos != Vector3.zero) { AsUserInfo.Instance.GetCurrentUserEntity().HandleMessage(new Msg_Input_Auto_Move( vNewPos)); _SetTwoFingerTouchEvent(); if (ArkQuestmanager.instance.CheckHaveOpenUIType(OpenUIType.USE_TWO_TOUCH_MOVE) != null) AsCommonSender.SendClearOpneUI(OpenUIType.USE_TWO_TOUCH_MOVE); } } } #endif } break; case eInputType.DOUBLE_HOLD_BEGAN: // DispatchInputMessage(eInputType.DOUBLE_HOLD_END, m_SelectedObject, Input.mousePosition, Vector3.zero, // m_StoredFirstScreenPosition, Time.deltaTime); break; case eInputType.DOUBLE_DRAG_BEGAN: #if GAME_PLAYING // Vector3 direction = Input.mousePosition - (Vector3)m_StoredFirstScreenPosition; // direction.z = direction.y;direction.y = 0; // // AsUserInfo.Instance.GetCurrentUserEntity().HandleMessage(new Msg_Input_Dash(direction.normalized)); m_eInputEvent = eInputEventType.TWO_FINGER_DRAG_END; // ilmeda 20120419 #endif // DispatchInputMessage(eInputType.DOUBLE_DRAG_END, m_SelectedObject, Input.mousePosition, projected, // curWorldPositionOnScreen, Time.deltaTime); break; } StopTrace(eTraceType.DOUBLE); // if(m_SelectedObject != null) // { // //test // DispatchInputMessage(eInputType.DOUBLE_UP, m_SelectedObject, Input.mousePosition, Vector3.zero, // GetPositionOnBaseLand(Input.mousePosition), Time.deltaTime); // } m_SelectedObject = null; } #endregion #region - zoom in & out float fValue = Input.GetAxis("Mouse ScrollWheel"); if(fValue < 0) { CameraMgr.Instance.SetZoomOutState(50.0f); } else if(fValue > 0) { CameraMgr.Instance.SetZoomInState(50.0f); } #endregion }
void TouchUpdate() { if( GAME_STATE.STATE_LOADING == AsGameMain.s_gameState) return; if( null != AsHudDlgMgr.Instance ) AsHudDlgMgr.Instance.FirstTouchInput( m_UICamera ); #region - ui camera - if(m_UICamera != null) { if( 0 < Input.touchCount) { Ray ray = m_UICamera.ScreenPointToRay(Input.GetTouch(0).position); RaycastHit hit; if(Physics.Raycast(ray, out hit/*, LayerMask.NameToLayer("GUI")*/) == true) { // < ilmeda 20120420 if(hit.collider.gameObject.layer == LayerMask.NameToLayer("GUI")) { if( null != AsHudDlgMgr.Instance ) AsHudDlgMgr.Instance.GuiTouchInput( m_UICamera ); if( true == _isInputAnyDonw()) { m_eInputEvent = eInputEventType.NONE; m_CurInputState = eInputType.NONE; m_bFirstTouch_UI = true; m_InputOnUI = true; // InputOnUI();//$yde return; } } // ilmeda 20120420 > } else m_bFirstTouch_UI = false; } else m_bFirstTouch_UI = false; } #endregion if( null != AsHudDlgMgr.Instance ) AsHudDlgMgr.Instance.TouchInput( m_UICamera ); #region - single - if(Input.touchCount == 1) { // < ilmeda 20120427 if( eInputEventType.TWO_FINGER_DRAG_BEGIN == m_eInputEvent) { m_eInputEvent = eInputEventType.TWO_FINGER_DRAG_END; } // ilmeda 20120427 > if(Input.GetTouch(0).phase == TouchPhase.Began) { m_StoredFirstScreenPosition = Input.mousePosition; m_FirstClickedTime = Time.time; m_CurInputState = eInputType.SINGLE_DOWN; m_SelectedObject = GetObjectOnScreenPosition(Input.GetTouch(0).position); if(m_SelectedObject != null) { // AsInputMessage msg = new AsInputMessage("rotate", m_SelectedObject, Input.GetTouch(0).position, // Vector3.zero, , 0); // AsEntityManager.Instance.DispatchMessage(msg); } StopHoldMove(); } else if(Input.GetTouch(0).phase == TouchPhase.Stationary || Input.GetTouch(0).phase == TouchPhase.Moved) { if(m_CurInputState == eInputType.SINGLE_DOWN) { if(Vector3.Distance(m_StoredFirstScreenPosition, (Vector3)GetCurrentScreenPos()) > m_DragDistanceUpperBound) { // if(m_StoredFirstScreenPosition == Input.GetTouch(0).position) // { // //DOUBLE_HOLD // // DispatchInputMessage(eInputType.DOUBLE_HOLD_BEGAN, m_SelectedObject, Input.mousePosition, Vector3.zero, // // GetPositionOnBaseLand(Input.mousePosition), Time.deltaTime); // // // m_CurInputState = eInputType.SINGLE_HOLD_BEGAN; // } // else { //DOUBLE_DRAG m_CurInputState = eInputType.SINGLE_DRAG_BEGAN; //m_eInputEvent = eInputEventType.ONE_FINGER_DRAG_BEGIN; // ilmeda 20120418 } } else if( Vector3.Distance(m_StoredFirstScreenPosition, (Vector3)GetCurrentScreenPos()) > 10f) // ilmeda, 20120821 { m_eInputEvent = eInputEventType.ONE_FINGER_DRAG_BEGIN; // ilmeda 20120821 } else if(Time.time - m_FirstClickedTime > m_AutoMoveHoldTime) { m_CurInputState = eInputType.SINGLE_HOLD_BEGAN; BeginHoldMove(); StopTrace(eTraceType.SINGLE); } StartTrace(eTraceType.SINGLE); } // if(m_CurInputState == eInputType.SINGLE_HOLD_BEGAN) // { // if(Time.time - m_HeldPositionRefreshTime > m_HeldPositionInterval) // { //#if GAME_PLAYING // HoldMoveProcess(); //#endif // } // } } else if(Input.GetTouch(0).phase == TouchPhase.Ended || Input.GetTouch(0).phase == TouchPhase.Canceled) { m_InputOnUI = false; switch(m_CurInputState) { case eInputType.SINGLE_DOWN: // case eInputType.SINGLE_HOLD_BEGAN: if(m_SelectedObject != null) { if(Time.time - m_LastClickedTime < m_DoubleClickTime && Vector3.Distance(m_StoredMessage.screenPosition_, Input.GetTouch(0).position) < m_DoubleClickEnableGap) { //DOUBLE CLICK PROCESS if(m_LastClickedObject != null) { #if DEBUG_INPUT Debug.Log( "Double click"); #endif #if GAME_PLAYING // < ilmeda 20120418 if( false == _isPlayCharSkillActive()) m_eInputEvent = eInputEventType.ONE_FINGER_DOUBLE_TOUCH; // ilmeda 20120418 > // RaycastHit hit = GetHitInfoOnScreenPosition(GetCurrentScreenPos()); DecideDoubleTouchInput(new Msg_Input(eInputType.SINGLE_DOWN, m_LastClickedObject, m_StoredMessage.screenPosition_, Vector3.zero, m_StoredMessage.worldPosition_, Time.deltaTime)); #endif m_LastClickedObject = null; m_LastClickedTime = 0; } } else { StoreInputMessage(eInputType.SINGLE_UP, m_SelectedObject, Input.GetTouch(0).position, Vector3.zero, GetPositionOnBaseLand(Input.GetTouch(0).position), Time.deltaTime); if(m_SingleClickDeciding == false) StartCoroutine("SingleClickDecision"); m_LastClickedObject = m_SelectedObject; m_LastClickedTime = Time.time; } } break; case eInputType.SINGLE_HOLD_BEGAN: // AsUserInfo.Instance.GetCurrentUserEntity().HandleMessage(new Msg_MoveStopIndication()); m_eInputEvent = eInputEventType.ONE_FINGER_DRAG_END; break; case eInputType.SINGLE_DRAG_BEGAN: if(Time.time - m_FirstClickedTime < m_DragInputLimitTime) { CheckDragInput(); } else m_eInputEvent = eInputEventType.ONE_FINGER_DRAG_END; // ilmeda 20120419 break; } StopTrace(eTraceType.SINGLE); m_SelectedObject = null; } } #endregion #region - double - else if(Input.touchCount == 2) { if(Input.GetTouch(0).phase == TouchPhase.Began || Input.GetTouch(1).phase == TouchPhase.Began || true == m_bFirstTouch_UI) { // begin kij m_IsZoomCameraState = false; m_StoredFirstScreenPosition_1 = Input.GetTouch(0).position; m_StoredFirstScreenPosition_2 = Input.GetTouch(1).position; m_StoredFirstDirection = Vector2.zero; // end kij m_StoredFirstScreenPosition = GetCurrentScreenPos(); m_FirstClickedTime = Time.time; m_CurInputState = eInputType.DOUBLE_DOWN; m_SelectedObject = GetObjectOnScreenPosition(GetCurrentScreenPos()); StopHoldMove(); } else if(Input.GetTouch(0).phase == TouchPhase.Moved || Input.GetTouch(1).phase == TouchPhase.Moved && Input.GetTouch(0).phase == TouchPhase.Stationary || Input.GetTouch(1).phase == TouchPhase.Stationary) { // being kij Vector2 vec2Touch_1 = Input.GetTouch(0).position; Vector2 vec2Touch_2 = Input.GetTouch(1).position; if( eInputType.DOUBLE_DRAG_BEGAN != m_CurInputState) // ilmeda 20120427 { Vector2 vec2First = m_StoredFirstScreenPosition_1 - m_StoredFirstScreenPosition_2; Vector2 vec2Current = vec2Touch_1 - vec2Touch_2; float fDis = Mathf.Abs( vec2Current.magnitude - vec2First.magnitude ); if( ZoomDelta <= fDis ) { if( vec2First.magnitude < vec2Current.magnitude ) { CameraMgr.Instance.SetZoomInState(fDis); } else { CameraMgr.Instance.SetZoomOutState(fDis); } m_StoredFirstScreenPosition_1 = vec2Touch_1; m_StoredFirstScreenPosition_2 = vec2Touch_2; m_IsZoomCameraState = true; } // end kij } Vector2 vec2Direction = Input.GetTouch(0).position - m_StoredFirstScreenPosition_1; vec2Direction.Normalize(); if( 0.0f > Vector2.Dot( vec2Direction, m_StoredFirstDirection ) || Vector2.zero == m_StoredFirstDirection ) { AsUserEntity userEntity = AsUserInfo.Instance.GetCurrentUserEntity(); if( null != userEntity) { userEntity.HandleMessage(new Msg_Input_Rub()); m_StoredFirstDirection = Input.GetTouch(0).position - m_StoredFirstScreenPosition_1; m_StoredFirstDirection.Normalize(); } } if(m_CurInputState == eInputType.DOUBLE_DOWN) { if(Vector2.Distance(m_StoredFirstScreenPosition, (Vector2)GetCurrentScreenPos()) > m_DragDistanceUpperBound) { // if(m_StoredFirstScreenPosition == GetCurrentScreenPos()) // { // //DOUBLE_HOLD // DispatchInputMessage(eInputType.DOUBLE_HOLD_BEGAN, m_SelectedObject, GetCurrentScreenPos(), Vector3.zero, // GetPositionOnBaseLand(GetCurrentScreenPos()), Time.deltaTime);// // m_CurInputState = eInputType.DOUBLE_HOLD_BEGAN; // } // else { if( false == m_IsZoomCameraState) // ilmeda 20120427 { //DOUBLE_DRAG m_CurInputState = eInputType.DOUBLE_DRAG_BEGAN; m_eInputEvent = eInputEventType.TWO_FINGER_DRAG_BEGIN; // ilmeda 20120419 } } } if( false == m_IsZoomCameraState) // ilmeda 20120427 StartTrace(eTraceType.DOUBLE); } } else if(Input.GetTouch(0).phase == TouchPhase.Ended || Input.GetTouch(0).phase == TouchPhase.Canceled && Input.GetTouch(1).phase == TouchPhase.Ended || Input.GetTouch(1).phase == TouchPhase.Canceled) { switch(m_CurInputState) { case eInputType.DOUBLE_DOWN: if(m_SelectedObject != null) { // DispatchInputMessage(eInputType.DOUBLE_UP, m_SelectedObject, GetCurrentScreenPos(), Vector3.zero, // GetPositionOnBaseLand(Input.mousePosition), Time.deltaTime); #if GAME_PLAYING if( false == m_IsZoomCameraState ) { AsUserEntity userEntity = AsUserInfo.Instance.GetCurrentUserEntity(); if( null != userEntity) { Vector3 vNewPos = GetPositionOnBaseLand( GetCurrentScreenPos()); Vector3 dir = vNewPos - userEntity.transform.position; if( dir.sqrMagnitude > m_fMin_sqrMagnitude) { if( vNewPos != Vector3.zero) { AsUserInfo.Instance.GetCurrentUserEntity().HandleMessage(new Msg_Input_Auto_Move( vNewPos)); if (ArkQuestmanager.instance.CheckHaveOpenUIType(OpenUIType.USE_TWO_TOUCH_MOVE) != null) AsCommonSender.SendClearOpneUI(OpenUIType.USE_TWO_TOUCH_MOVE); _SetTwoFingerTouchEvent(); } } } } #endif } break; case eInputType.DOUBLE_HOLD_BEGAN: // DispatchInputMessage(eInputType.DOUBLE_HOLD_END, m_SelectedObject, GetCurrentScreenPos(), Vector3.zero, // m_StoredFirstScreenPosition, Time.deltaTime); break; case eInputType.DOUBLE_DRAG_BEGAN: #if GAME_PLAYING Vector3 direction = (Vector3)(GetCurrentScreenPos() - m_StoredFirstScreenPosition); direction.z = direction.y;direction.y = 0; if( false == m_IsZoomCameraState ) { // AsUserInfo.Instance.GetCurrentUserEntity().HandleMessage(new Msg_Input_Dash(direction.normalized)); m_eInputEvent = eInputEventType.TWO_FINGER_DRAG_END; // ilmeda 20120419 } #endif break; } StopCoroutine("SetScreenPositionTrace");m_TraceBegan = false; } } #endregion }
void StoreInputMessage(eInputType _type, GameObject _inputObject, Vector3 _screenPosition, Vector3 _deltaPosition, Vector3 _worldPosition, float _deltaTime) { m_StoredMessage = new Msg_Input(_type, _inputObject, _screenPosition, _deltaPosition, _worldPosition, _deltaTime); }
void OnInput(eInputType inputType) { Attack(inputType); Move(inputType); }
public void SetEvent(eInputType inputType, Action <eInputType, Button, Index> buttonInput, Action <eInputType, Trigger, Index, bool, bool> triggerInput) { ButtonInput += (Button button, Index index) => { Gamepad.GetButton(inputType, button, index); }; TriggerInput += (Trigger trigger, Index index, bool currentInput, bool previewInput) => { Gamepad.GetTrigger(inputType, trigger, index, currentInput, previewInput); }; }
public override void OnInputEvent(eInputType inputType) { }
public void GameStart() { currInputType = eInputType.grid; }
public virtual void OnInputEvent(eInputType inputType) { _curState.OnInputEvent(inputType); }
public static void BroadcastMultipleInput(eInputType argInput, short playerIndex) { OnMultipleInput?.Invoke(argInput, playerIndex); }