public void SetAttachType(MouseAttachFuncType type) { if (m_currentAttachType == type) { return; } if (m_currentAttachType == type && (isAttackSign(type) || type == MouseAttachFuncType.RetreatSign)) { type = MouseAttachFuncType.None; } if (skillCtrl) { if (skillCtrl.isSelecting()) { return; } else { skillCtrl.resetSkill(); } } m_currentAttachType = type; m_multiAttachFunc = false; bPickingMovePoint = false; if (m_currentAttachType == MouseAttachFuncType.None) { } else { LockCursor = false; } }
private bool isAttackSign(MouseAttachFuncType type) { return(type == MouseAttachFuncType.CtrlAttackSign || type == MouseAttachFuncType.AltAttackSign); }
//更形鼠标是否处在移动状态 private void updateMouseMoving() { s_fCursorMoved += Mathf.Abs(fMouseAxisX - s_fLastCursorX); s_fCursorMoved += Mathf.Abs(fMouseAxisY - s_fLastCursorY); s_fLastCursorX = fMouseAxisX; s_fLastCursorY = fMouseAxisY; int now = Time.frameCount; if (now - (int)s_nLastCheckTick > CheckTickCount)// 检测频率可修改 { s_nLastCheckTick = (uint)now; m_bIsMouseMoving = s_fCursorMoved > CursorMoveDisCheck; // 鼠标是否移动,8这个是个参数 s_fCursorMoved = 0; } if (m_teamCommandStart) { Vector2 vec = (Vector2)getMousePosition() - m_commandStartScreenPos; if (vec.sqrMagnitude > 15f * 15f) { if (m_teamCommandShow == false) { // 打开窗口 UISystem.Instance.ShowWnd(WndID.WND_ID_WAR_MAPSIGNAL, true); m_teamCommandShow = true; } MouseAttachFuncType funcType = MouseAttachFuncType.None; if (vec.x > 0) { if (vec.y > 0) { if (Mathf.Abs(vec.x) > Mathf.Abs(vec.y)) { funcType = MouseAttachFuncType.OnWaySign; } else { funcType = MouseAttachFuncType.DangerSign; } } else { if (Mathf.Abs(vec.x) > Mathf.Abs(vec.y)) { funcType = MouseAttachFuncType.OnWaySign; } else { funcType = MouseAttachFuncType.HelpMeSign; } } } else { if (vec.y > 0) { if (Mathf.Abs(vec.x) > Mathf.Abs(vec.y)) { funcType = MouseAttachFuncType.LostEyeSign; } else { funcType = MouseAttachFuncType.DangerSign; } } else { if (Mathf.Abs(vec.x) > Mathf.Abs(vec.y)) { funcType = MouseAttachFuncType.LostEyeSign; } else { funcType = MouseAttachFuncType.HelpMeSign; } } } if (m_currentAttachType != funcType) { SetAttachType(funcType); MapSignalSetSelectSignal uiData = new MapSignalSetSelectSignal(); uiData.nType = (int)funcType; UISystem.Instance.SendWndMessage(WndMsgID.WND_MSG_WAR_MAPSIGNAL_SETSELECTSIGNAL, uiData); } } else { if (m_teamCommandShow && m_currentAttachType != MouseAttachFuncType.EmptySign) { SetAttachType(MouseAttachFuncType.EmptySign); MapSignalSetSelectSignal uiData = new MapSignalSetSelectSignal(); uiData.nType = (int)MouseAttachFuncType.EmptySign; UISystem.Instance.SendWndMessage(WndMsgID.WND_MSG_WAR_MAPSIGNAL_SETSELECTSIGNAL, uiData); } } } }