Beispiel #1
0
        public void SetSelectSignal(MapSignalSetSelectSignal data)
        {
            if (data == null)
            {
                return;
            }

            if (data.nType == (int)MouseAttachFuncType.DangerSign)
            {
                highlightImage.rectTransform.eulerAngles = new Vector3(0f, 0f, 90f);
            }
            else if (data.nType == (int)MouseAttachFuncType.OnWaySign)
            {
                highlightImage.rectTransform.eulerAngles = new Vector3(0f, 0f, 0f);
            }
            else if (data.nType == (int)MouseAttachFuncType.HelpMeSign)
            {
                highlightImage.rectTransform.eulerAngles = new Vector3(0f, 0f, 270f);
            }
            else if (data.nType == (int)MouseAttachFuncType.LostEyeSign)
            {
                highlightImage.rectTransform.eulerAngles = new Vector3(0f, 0f, 180f);
            }
            else
            {
                highlightImage.rectTransform.eulerAngles = new Vector3(0f, 0f, 0f);
            }
        }
Beispiel #2
0
    //更形鼠标是否处在移动状态
    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);
                }
            }
        }
    }