Ejemplo n.º 1
0
        private void CheckUIKeyMessage()
        {
            if (FuntionShortCutCtrl.CheckFunctionShortcutKeyDown(FuntionShortCutSlotIndex.Exit) && StageManager.Instance.getCurrentState() != Stage_ManagerDef.EStage_State.ESS_LOADSCENE)
            {
                OnKeyMessage(FuntionShortCutSlotIndex.Exit, KeyStatus.Down);
            }

            for (int i = 1; i < (int)KeyStatus.Max; i++)
            {
                foreach (FuntionShortCutSlotIndex index in m_keyMessageList[i].Keys)
                {
                    if (i == (int)KeyStatus.Down)
                    {
                        if (FuntionShortCutCtrl.CheckFunctionShortcutKeyDown(index))
                        {
                            OnKeyMessage(index, KeyStatus.Down);
                        }
                    }
                    else if (i == (int)KeyStatus.Up)
                    {
                        if (FuntionShortCutCtrl.CheckFunctionShortcutKeyUp(index))
                        {
                            OnKeyMessage(index, KeyStatus.Up);
                        }
                    }
                    else if (i == (int)KeyStatus.Pressing)
                    {
                        if (FuntionShortCutCtrl.CheckFunctionShortcutKeyPressing(index))
                        {
                            OnKeyMessage(index, KeyStatus.Pressing);
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
    //插旗
    public void DoMouseAttachFunc(float xPos, float yPos, float zPos)
    {
        int targetID = 0;

        if (isAttackSign(m_currentAttachType) || m_currentAttachType == MouseAttachFuncType.RetreatSign)
        {
            if (raycast.targetID > 0)
            {
                EntityView evTarget = EntityFactory.getEntityViewByID(raycast.targetID);
                if (evTarget != null && IsValidMapSignalTarget(evTarget))
                {
                    targetID = raycast.targetID;
                }
            }

            if (targetID == 0)
            {
                Vector3            hitPoint = new Vector3(xPos, yPos, zPos);
                IList <EntityView> list     = MapFinderManager.Nearest(hitPoint, 24, SPELL.CampFlag.CampFlag_Unknow);
                if (list != null)
                {
                    float      curDistance = float.MaxValue;
                    EntityView curObj      = null;
                    foreach (EntityView view in list)
                    {
                        if (IsValidMapSignalTarget(view))
                        {
                            float mag = (view.gameObject.transform.position - hitPoint).sqrMagnitude;
                            if (curDistance > mag)
                            {
                                curDistance = mag;
                                curObj      = view;
                            }
                        }
                    }

                    if (curDistance < 16f)
                    {
                        targetID = curObj.ID;
                    }
                }
            }
        }

        cmd_war_mini_map_info data = new cmd_war_mini_map_info();

        switch (m_currentAttachType)
        {
        case MouseAttachFuncType.CtrlAttackSign:
            data.nType = (int)EMinimapClickType.EMCT_AttackSignal;
            break;

        case MouseAttachFuncType.AltAttackSign:
            data.nType = (int)EMinimapClickType.EMCT_AttackSignal;
            break;

        case MouseAttachFuncType.RetreatSign:
            data.nType = (int)EMinimapClickType.EMCT_RetreatSignal;
            break;

        case MouseAttachFuncType.DangerSign:
            data.nType = (int)EMinimapClickType.EMCT_DangerSignal;
            break;

        case MouseAttachFuncType.OnWaySign:
            data.nType = (int)EMinimapClickType.EMCT_OnWaySignal;
            break;

        case MouseAttachFuncType.HelpMeSign:
            data.nType = (int)EMinimapClickType.EMCT_HelpMeSignal;
            break;

        case MouseAttachFuncType.LostEyeSign:
            data.nType = (int)EMinimapClickType.EMCT_LostEyeSignal;
            break;

        default:
            return;
        }

        // 给逻辑层发命令 主角ID 目标位置 信号类型
        data.x         = xPos;
        data.y         = yPos;
        data.z         = zPos;
        data.nEntityID = targetID;
        EntityEventHelper.Instance.SendCommand <cmd_war_mini_map_info>(EntityFactory.MainHeroID, EntityLogicDef.ENTITY_CMD_MINIMAP_INFO, ref data);

        if (isAttackSign(m_currentAttachType) && (FuntionShortCutCtrl.CheckFunctionShortcutKeyPressing(FuntionShortCutSlotIndex.AttackSign) || InputManager.GetKey(KeyCode.LeftAlt) || InputManager.GetKey(KeyCode.LeftControl)) ||
            m_currentAttachType == MouseAttachFuncType.RetreatSign && (FuntionShortCutCtrl.CheckFunctionShortcutKeyPressing(FuntionShortCutSlotIndex.DangerSign)))
        {
            // 功能继续
            m_multiAttachFunc = true;
        }
        else if ((InputManager.GetKey(KeyCode.LeftAlt)) &&
                 (m_currentAttachType == MouseAttachFuncType.OnWaySign || m_currentAttachType == MouseAttachFuncType.DangerSign ||
                  m_currentAttachType == MouseAttachFuncType.HelpMeSign || m_currentAttachType == MouseAttachFuncType.LostEyeSign))
        {
            // 战术标记发完后还按着alt的话保持附个空标记占位,以免出普攻
            SetAttachType(MouseAttachFuncType.EmptySign);
        }
        else
        {
            SetAttachType(MouseAttachFuncType.None);
        }
    }