/// <summary> /// click /// </summary> protected void OnClick() { INPUT_INFO info = new INPUT_INFO(); info.m_eType = INPUT_TYPE.CLICK; CallEvent(info); }
/// <summary> /// on drag /// </summary> /// <param name="delta"></param> protected void OnDrag(Vector2 delta) { INPUT_INFO info = new INPUT_INFO(); info.m_eType = INPUT_TYPE.DRAG; CallEvent(info); }
/// <summary> /// input /// </summary> /// <param name="text"></param> protected void OnInput(string text) { INPUT_INFO info = new INPUT_INFO(); info.m_eType = INPUT_TYPE.INPUT; CallEvent(info); }
/// <summary> /// on drop /// </summary> /// <param name="target"></param> protected void OnDrop(GameObject target) { INPUT_INFO info = new INPUT_INFO(); info.m_eType = INPUT_TYPE.DROP; CallEvent(info); }
/// <summary> /// call the event /// </summary> /// <param name="info"></param> protected void CallEvent(INPUT_INFO info) { if (this.m_cEvent != null) { this.m_cEvent(info, this.m_vecArg); } }
/// <summary> /// double click /// </summary> protected void OnDoubleClick() { INPUT_INFO info = new INPUT_INFO(); info.m_eType = INPUT_TYPE.DOUBLE_CLICK; CallEvent(info); }
/// <summary> /// on select /// </summary> /// <param name="isSelected"></param> protected void OnSelect(bool isSelected) { INPUT_INFO info = new INPUT_INFO(); info.m_eType = INPUT_TYPE.SELECT; info.m_bDone = isSelected; CallEvent(info); }
/// <summary> /// OnPress /// </summary> /// <param name="isDown"></param> protected void OnPress(bool isDown) { INPUT_INFO info = new INPUT_INFO(); info.m_eType = INPUT_TYPE.PRESS; info.m_bDone = isDown; CallEvent(info); }
/// <summary> /// OnHover /// </summary> /// <param name="isOver"></param> protected void OnHover(bool isOver) { INPUT_INFO info = new INPUT_INFO(); info.m_eType = INPUT_TYPE.HOVER; info.m_bDone = isOver; CallEvent(info); }
/// <summary> /// on key /// </summary> /// <param name="key"></param> protected void OnKey(KeyCode key) { INPUT_INFO info = new INPUT_INFO(); info.m_eType = INPUT_TYPE.KEY; info.m_eKey = key; CallEvent(info); }
/// <summary> /// on scroll /// </summary> /// <param name="delta"></param> protected void OnScroll(float delta) { INPUT_INFO info = new INPUT_INFO(); info.m_eType = INPUT_TYPE.SCROLL; info.m_fDelta = delta; CallEvent(info); }
/// <summary> /// On tool tip /// </summary> /// <param name="show"></param> protected void OnTooltip(bool show) { INPUT_INFO info = new INPUT_INFO(); info.m_eType = INPUT_TYPE.TOOLTIP; info.m_bDone = show; CallEvent(info); }
protected bool PollMouseUp(ref INPUT_INFO curInput) { if (curInput.active) { if (Input.GetMouseButtonUp(0)) { curInput.inputDelta = NkInputManager.mousePosition - curInput.devicePos; curInput.devicePos = NkInputManager.mousePosition; if (curInput.isTap) { this.tempVec = curInput.origPos - curInput.devicePos; if (Mathf.Abs(this.tempVec.x) > this.dragThreshold || Mathf.Abs(this.tempVec.y) > this.dragThreshold) { curInput.isTap = false; } } if (curInput.isTap) { curInput.evt = INPUT_INFO.INPUT_EVENT.TAP; } else if (this.dragClick) { curInput.evt = INPUT_INFO.INPUT_EVENT.TAP; this.dragClick = false; } else { curInput.evt = INPUT_INFO.INPUT_EVENT.RELEASE; } curInput.active = false; return(true); } if (Input.GetMouseButtonUp(1)) { curInput.inputDelta = NkInputManager.mousePosition - curInput.devicePos; curInput.devicePos = NkInputManager.mousePosition; if (curInput.isTap) { this.tempVec = curInput.origPos - curInput.devicePos; if (Mathf.Abs(this.tempVec.x) > this.dragThreshold || Mathf.Abs(this.tempVec.y) > this.dragThreshold) { curInput.isTap = false; } } if (curInput.isTap) { curInput.evt = INPUT_INFO.INPUT_EVENT.RIGHT_TAP; } else { curInput.evt = INPUT_INFO.INPUT_EVENT.RIGHT_RELEASE; } curInput.active = false; return(true); } } return(false); }
public virtual bool Update(INPUT_INFO curInput) { if (this.PreCheckUpdate()) { this.ExcuteKeyInputDelegate(); this.ExcuteInputDelegate(curInput); } return(false); }
public void Reuse(INPUT_INFO ptr) { this.evt = ptr.evt; this.actionID = ptr.actionID; this.active = ptr.active; this.devicePos = ptr.devicePos; this.origPos = ptr.origPos; this.inputDelta = ptr.inputDelta; this.isTap = ptr.isTap; this.isGesture = ptr.isGesture; this.clickTime = ptr.clickTime; this.isDrag = ptr.isDrag; }
protected void PollMouse(ref INPUT_INFO curPtr) { if (this.PollMouseDown(ref curPtr)) { curPtr.devicePos = Input.mousePosition; } else if (this.PollMouseUp(ref curPtr)) { curPtr.devicePos = Input.mousePosition; } else if (this.PollMouseOthers(ref curPtr)) { curPtr.devicePos = Input.mousePosition; } }
public override bool Update(INPUT_INFO curInput) { if (!this.PreCheckUpdate()) { return(false); } base.ExcuteKeyInputDelegate(); INPUT_INFO.INPUT_EVENT evt = curInput.evt; switch (evt) { case INPUT_INFO.INPUT_EVENT.NO_CHANGE: if (!CharMoveCommandLayer.bDragMove) { this.NoChangeMove(); } return(false); case INPUT_INFO.INPUT_EVENT.PRESS: return(false); case INPUT_INFO.INPUT_EVENT.DOUBLE_PRESS: case INPUT_INFO.INPUT_EVENT.RELEASE: return(false); case INPUT_INFO.INPUT_EVENT.MIDDLE_PRESS: case INPUT_INFO.INPUT_EVENT.RIGHT_PRESS: case INPUT_INFO.INPUT_EVENT.HOLD_PRESS: case INPUT_INFO.INPUT_EVENT.RIGHT_RELEASE: IL_49: switch (evt) { } return(false); case INPUT_INFO.INPUT_EVENT.BOTH_PRESS: if (!TsPlatform.IsMobile) { this.BothCharMove(); } return(false); case INPUT_INFO.INPUT_EVENT.TAP: this.TabCharMove(); return(false); } goto IL_49; }
private bool PollMouseOthers(ref INPUT_INFO curPtr) { if (Input.mousePosition != curPtr.devicePos) { if (curPtr.active && curPtr.isDrag) { curPtr.evt = INPUT_INFO.INPUT_EVENT.DRAG; curPtr.inputDelta = NkInputManager.mousePosition - curPtr.devicePos; curPtr.devicePos = NkInputManager.mousePosition; if (curPtr.isTap) { this.tempVec = curPtr.origPos - curPtr.devicePos; if (Mathf.Abs(this.tempVec.x) > this.dragThreshold || Mathf.Abs(this.tempVec.y) > this.dragThreshold) { curPtr.isTap = false; } } } else { curPtr.isDrag = true; Vector3 devicePos = NkInputManager.mousePosition; if (curPtr.getResolution() != INPUT_INFO.ResolutionType.Normal && 3f > Mathf.Abs(NkInputManager.mousePosition.x - curPtr.devicePos.x) && 3f > Mathf.Abs(NkInputManager.mousePosition.y - curPtr.devicePos.y)) { curPtr.isDrag = false; devicePos = curPtr.devicePos; } curPtr.evt = INPUT_INFO.INPUT_EVENT.MOVE; curPtr.inputDelta = NkInputManager.mousePosition - curPtr.devicePos; curPtr.devicePos = devicePos; } } else if (!this.leftMouseDown || !this.rightMouseDown) { curPtr.evt = INPUT_INFO.INPUT_EVENT.NO_CHANGE; curPtr.inputDelta = Vector3.zero; } this.scrollDelta = Input.GetAxis("Mouse ScrollWheel"); if (this.scrollDelta != 0f) { curPtr.evt = INPUT_INFO.INPUT_EVENT.MOUSE_WHEEL; } return(true); }
public override bool Update(INPUT_INFO curInput) { if (!CommonTasks.IsEndOfPrework) { return(false); } this.InputKeyBoard(); bool flag; if (TsPlatform.IsMobile && !TsPlatform.IsEditor) { flag = (curInput.evt == INPUT_INFO.INPUT_EVENT.DRAG && Input.touchCount == 1); } else { flag = (curInput.evt == INPUT_INFO.INPUT_EVENT.DRAG); } if (flag) { this.InputMouse(); } else { if (this.m_veScrollStart != Vector3.zero) { this.m_veScrollStart = Vector3.zero; this.m_Battle.CastedTarget.BattleCamera.SetScrollView(false); } if (NkInputManager.GetMouseButtonUp(0) || NkInputManager.GetMouseButtonUp(2)) { this.m_Battle.CastedTarget.SetCameraMove(flag); } } this.GridInputMouse(); return(false); }
public void ExcuteInputDelegate(INPUT_INFO curInput) { switch (curInput.evt) { case INPUT_INFO.INPUT_EVENT.NO_CHANGE: if (this.noChangeDelegate != null) { this.noChangeDelegate(); } break; case INPUT_INFO.INPUT_EVENT.PRESS: if (this.pressInputDelegate != null) { this.pressInputDelegate(); } break; case INPUT_INFO.INPUT_EVENT.DOUBLE_PRESS: if (this.doublePressInputDelegate != null) { this.doublePressInputDelegate(); } break; case INPUT_INFO.INPUT_EVENT.MIDDLE_PRESS: if (this.middlePressInputDelegate != null) { this.middlePressInputDelegate(); } break; case INPUT_INFO.INPUT_EVENT.RIGHT_PRESS: if (this.rightPressInputDelegate != null) { this.rightPressInputDelegate(); } break; case INPUT_INFO.INPUT_EVENT.BOTH_PRESS: if (this.bothPressInputDelegate != null) { this.bothPressInputDelegate(); } break; case INPUT_INFO.INPUT_EVENT.HOLD_PRESS: if (this.holdPressInputDelegate != null) { this.holdPressInputDelegate(); } break; case INPUT_INFO.INPUT_EVENT.RELEASE: if (this.releaseInputDelegate != null) { this.releaseInputDelegate(); } break; case INPUT_INFO.INPUT_EVENT.RIGHT_RELEASE: if (this.rightReleaseTapInputDelegate != null) { this.rightReleaseTapInputDelegate(); } break; case INPUT_INFO.INPUT_EVENT.TAP: if (this.tapInputDelegate != null) { this.tapInputDelegate(); } break; case INPUT_INFO.INPUT_EVENT.RIGHT_TAP: if (this.rightTapInputDelegate != null) { this.rightTapInputDelegate(); } break; case INPUT_INFO.INPUT_EVENT.MOVE: if (this.moveDelegate != null) { this.moveDelegate(); } break; case INPUT_INFO.INPUT_EVENT.DRAG: if (this.dragInputDelegate != null) { this.dragInputDelegate(); } break; case INPUT_INFO.INPUT_EVENT.MOUSE_WHEEL: if (this.mouseWheelInputDelegate != null) { this.mouseWheelInputDelegate(); } break; case INPUT_INFO.INPUT_EVENT.TOUCH_DRAG_DOWN: if (this.touchDragDownInputDelegate != null) { this.touchDragDownInputDelegate(); } break; case INPUT_INFO.INPUT_EVENT.TOUCH_DRAG_UP: if (this.touchDragUpInputDelegate != null) { this.touchDragUpInputDelegate(); } break; case INPUT_INFO.INPUT_EVENT.TOUCH_DRAG_LEFT: if (this.touchDragLeftInputDelegate != null) { this.touchDragLeftInputDelegate(); } break; case INPUT_INFO.INPUT_EVENT.TOUCH_DRAG_RIGHT: if (this.touchDragRightInputDelegate != null) { this.touchDragRightInputDelegate(); } break; case INPUT_INFO.INPUT_EVENT.LONG_TAP: if (this.longTapInputDelegate != null) { this.longTapInputDelegate(); } break; case INPUT_INFO.INPUT_EVENT.ROTATION: if (this.rotationInputDelegate != null) { this.rotationInputDelegate(); } break; case INPUT_INFO.INPUT_EVENT.TWO_TOUCH_DRAG: if (this.twoTouchDragInputDelegate != null) { this.twoTouchDragInputDelegate(); } break; case INPUT_INFO.INPUT_EVENT.TWO_TOUCH_TAP: if (this.twoTouchTapInputDelegate != null) { this.twoTouchTapInputDelegate(); } break; } }
public void GetInputInfo(int index, ref INPUT_INFO info) { info.Copy(this.pointers[0, index]); }
public override bool Update(INPUT_INFO curInput) { return((Battle.BATTLE == null || !Battle.BATTLE.InputControlTrigger || NrTSingleton <FormsManager> .Instance.IsShow(G_ID.BATTLE_TALK_DLG)) && NrTSingleton <UIManager> .Instance.Update()); }
protected bool PollMouseDown(ref INPUT_INFO curPtr) { this.leftMouseDown = Input.GetMouseButton(0); this.rightMouseDown = Input.GetMouseButton(1); this.middleMouseDown = Input.GetMouseButton(2); if (this.leftMouseDown && this.rightMouseDown) { curPtr.Reset(this.curActionID++); curPtr.evt = INPUT_INFO.INPUT_EVENT.BOTH_PRESS; curPtr.active = true; curPtr.inputDelta = Input.mousePosition - curPtr.devicePos; curPtr.origPos = Input.mousePosition; curPtr.isTap = true; curPtr.clickTime = Time.time; curPtr.isDrag = false; return(true); } if (this.leftMouseDown && !curPtr.active) { if (curPtr.clickTime > 0f && Time.time - curPtr.clickTime < 0.3f) { curPtr.Reset(this.curActionID++); curPtr.evt = INPUT_INFO.INPUT_EVENT.DOUBLE_PRESS; curPtr.active = true; curPtr.inputDelta = Input.mousePosition - curPtr.devicePos; curPtr.origPos = Input.mousePosition; curPtr.isTap = true; curPtr.clickTime = Time.time; } else { curPtr.Reset(this.curActionID++); curPtr.evt = INPUT_INFO.INPUT_EVENT.PRESS; curPtr.active = true; curPtr.inputDelta = Input.mousePosition - curPtr.devicePos; curPtr.origPos = Input.mousePosition; curPtr.isTap = true; curPtr.clickTime = Time.time; } return(true); } if (this.rightMouseDown && !curPtr.active) { curPtr.Reset(this.curActionID++); curPtr.evt = INPUT_INFO.INPUT_EVENT.RIGHT_PRESS; curPtr.active = true; curPtr.inputDelta = Input.mousePosition - curPtr.devicePos; curPtr.origPos = Input.mousePosition; curPtr.isTap = true; return(true); } if (this.middleMouseDown && !curPtr.active) { curPtr.Reset(this.curActionID++); curPtr.evt = INPUT_INFO.INPUT_EVENT.MIDDLE_PRESS; curPtr.active = true; curPtr.inputDelta = Input.mousePosition - curPtr.devicePos; curPtr.origPos = Input.mousePosition; curPtr.isTap = true; return(true); } return(false); }