Ejemplo n.º 1
0
 void SkillEvent(int eventID, object param)
 {
     if (eventID == (int)GameEventID.SKILLSYSTEM_ADDSKILLCMD)
     {
         stSkillCommond st = (stSkillCommond)param;
         AddCommondQueue(st);
     }
     else if (eventID == (int)GameEventID.SKILLSYSTEM_CLEARSKILLCMD)
     {
         ClearCommondQueue();
     }
     else if (eventID == (int)GameEventID.SKLL_LONGPRESS)
     {
         stSkillLongPress st = (stSkillLongPress)param;
         m_bSkillLongPress = st.bLongPress;
     }
     else if (eventID == (int)GameEventID.ENTITYSYSTEM_ENTITYBEGINMOVE)
     {
         stEntityBeginMove move = (stEntityBeginMove)param;
         if (move.uid == MainPlayerHelper.GetPlayerUID())
         {
             ClearCommondQueue();
         }
     }
     else if (eventID == (int)GameEventID.ROBOTCOMBAT_START)
     {
         stSkillLongPress longPress = new stSkillLongPress();
         longPress.bLongPress = false;
         EventEngine.Instance().DispatchEvent((int)GameEventID.SKLL_LONGPRESS, longPress);
     }
     else if (eventID == (int)GameEventID.SKILLSYSTEM_STIFFTIMEOVER)
     {
         DoInsertSkill();
     }
 }
Ejemplo n.º 2
0
        //-------------------------------------------------------------------------------------------------------
        private void MoveDir()
        {
            if (m_Owner == null)
            {
                return;
            }

            Vector3 pos = m_Owner.GetPos();

            Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem();
            if (rs == null)
            {
                return;
            }
            m_curScene = rs.GetActiveScene();
            if (m_curScene == null)
            {
                return;
            }

            // 先设置人物旋转
            Quaternion rotate = new Quaternion();

            rotate.eulerAngles = new Vector3(0, m_param.m_dir, 0);

            Matrix4x4 mat = new Matrix4x4();

            mat.SetTRS(Vector3.zero, rotate, Vector3.one);
            m_dir = mat.GetColumn(2);

            if (!m_bIgnoreMoveAction)
            {
                m_Owner.PlayAction(m_param.strRunAct, 0, m_param.m_speed);
            }

            stEntityBeginMove move = new stEntityBeginMove();

            move.uid = m_Owner.GetUID();
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_ENTITYBEGINMOVE, move);

            if (!m_bMoving)
            {
                Engine.Utility.Log.Error("MoveDir----------- {0}-------------------------------------", m_param.m_dir);

                m_vLastPos    = pos;
                m_lastSyncPos = m_vLastPos;

                m_bMoving = true;
                if (!m_bIgnoreMoveAction)
                {
                    m_Owner.PlayAction(m_param.strRunAct, 0, m_param.m_speed);
                }

                //Engine.Utility.TimerAxis.Instance().KillTimer(0, this);
                //Engine.Utility.TimerAxis.Instance().SetTimer(0, 33, this, TimerAxis.INFINITY_CALL, "EntityMove");
                m_LastTime = Engine.Utility.TimeHelper.GetTickCount();
            }
        }
Ejemplo n.º 3
0
    void MoveCancel(int nEventId, object param)
    {
        if ((int)GameEventID.ENTITYSYSTEM_ENTITYBEGINMOVE == nEventId)
        {
            stEntityBeginMove move = (stEntityBeginMove)param;
            if (move.uid != Client.ClientGlobal.Instance().MainPlayer.GetUID())
            {
                return;
            }
            Engine.Utility.EventEngine.Instance().RemoveEventListener((int)GameEventID.ENTITYSYSTEM_ENTITYBEGINMOVE, MoveCancel);
            DataManager.Manager <SliderDataManager>().IsBreak         = true;
            DataManager.Manager <SliderDataManager>().IsReadingSlider = false;
            HideSlider();

            if (IsClickNpcAction(m_UninterruptActionType))
            {
                GameCmd.stNotifyUninterruptEventMagicUserCmd_CS cmd = new GameCmd.stNotifyUninterruptEventMagicUserCmd_CS();
                cmd.etype      = GameCmd.stNotifyUninterruptEventMagicUserCmd_CS.EventType.EventType_Break;
                cmd.actiontype = (uint)m_UninterruptActionType;
                cmd.desid      = ClientGlobal.Instance().MainPlayer.GetID();
                NetService.Instance.Send(cmd);
            }
        }
    }
Ejemplo n.º 4
0
    /// <summary>
    /// 事件处理
    /// </summary>
    /// <param name="nEventID"></param>
    /// <param name="param"></param>
    public void GlobalEventHandler(int eventID, object param)
    {
        switch (eventID)
        {
        case (int)Client.GameEventID.ENTITYSYSTEM_CHANGE:
        {
            if (null != param && param is Client.stPlayerChange)
            {
                Client.stPlayerChange change = (Client.stPlayerChange)param;
                IEntity entity = RoleStateBarManager.GetEntityByUserID <IPlayer>(change.uid);
                if (null == entity)
                {
                    entity = RoleStateBarManager.GetEntityByUserID <INPC>(change.uid);
                }

                if (null != entity)
                {
                    LateUpdateChangePos(entity.GetUID());
                }
            }
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_UNRIDE:
        {
            if (null != param && param is stEntityUnRide)
            {
                stEntityUnRide unride = (stEntityUnRide)param;
                LateUpdateChangePos(unride.uid);
            }
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_RIDE:
        {
            if (null != param && param is stEntityRide)
            {
                stEntityRide ride = (stEntityRide)param;
                LateUpdateChangePos(ride.uid);
            }
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_ENTITYBEGINMOVE:
        {
            if (null != param && param is stEntityBeginMove)
            {
                stEntityBeginMove move = (stEntityBeginMove)param;
                OnEntityMoving(move.uid);
            }
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_ENTITYMOVE:
        {
            if (null != param && param is stEntityMove)
            {
                stEntityMove move = (stEntityMove)param;
                OnEntityMoving(move.uid);
            }
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE:
        {
            if (null != param && param is stEntityStopMove)
            {
                stEntityStopMove move = (stEntityStopMove)param;
                OnEntityMoving(move.uid);
            }
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_CREATEENTITY:
        {
            //实体创建
            Client.stCreateEntity ce = (Client.stCreateEntity)param;
            OnCretateEntity(ce);
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_REMOVEENTITY:
        {
            //实体删除
            Client.stRemoveEntity removeEntiy = (Client.stRemoveEntity)param;
            RemoveRoleBar(removeEntiy.uid);
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_PROPUPDATE:
        {
            //实体属性变更
            stPropUpdate prop = (stPropUpdate)param;
            OnPropUpdate(ref prop);
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_HPUPDATE:
        {
            //实体属性变更
            stPropUpdate prop = (stPropUpdate)param;
            OnPropUpdate(ref prop);
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_CHANGENAME:
        {
            //实体名称改变
            stEntityChangename e = (stEntityChangename)param;
            UpdateHeadStaus(e.uid, HeadStatusType.Name);
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_SETHIDE:
        {
            //实体名称改变
            stEntityHide st = (stEntityHide)param;
            //UpdateHeadStaus(e.uid, HeadStatusType.Name);
            OnSetEntityHide(ref st);
        }
        break;

        case (int)Client.GameEventID.TITLE_WEAR:
        {
            Client.stTitleWear data   = (Client.stTitleWear)param;
            IPlayer            player = RoleStateBarManager.GetEntityByUserID <IPlayer>(data.uid);
            if (null != player)
            {
                //佩戴称号
                UpdateHeadStaus(player.GetUID(), HeadStatusType.Title);
            }
        }
        break;

        case (int)Client.GameEventID.SKILLGUIDE_PROGRESSSTART:
        {
            //引导技能开始
        }
        break;

        case (int)Client.GameEventID.SKILLGUIDE_PROGRESSBREAK:
        {
            //引导技能中断
        }
        break;

        case (int)Client.GameEventID.SKILLGUIDE_PROGRESSEND:
        {
            //引导技能结束
        }
        break;

        case (int)Client.GameEventID.CLANQUIT:
        case (int)Client.GameEventID.CLANJOIN:
        case (int)Client.GameEventID.CLANREFRESHID:
        case (int)Client.GameEventID.CITYWARWINERCLANID:
        case (int)Client.GameEventID.CLANDeclareInfoAdd:
        case (int)Client.GameEventID.CLANDeclareInfoRemove:
        {
            //氏族状态改变
            OnRefreshAllClan();
        }
        break;

        case (int)Client.GameEventID.CITYWARTOTEMCLANNAMECHANGE:
        {
            long uid = EntitySystem.EntityHelper.MakeUID(EntityType.EntityType_NPC, (uint)param);
            UpdateHeadStaus(uid, HeadStatusType.Clan);
        }
        break;

        case (int)Client.GameEventID.SYSTEM_GAME_READY:
        {
            OnRefresAllHp();
        }
        break;

        case (int)Client.GameEventID.CAMERA_MOVE_END:
        {
            UpdateAllPos();
        }
        break;

        case (int)Client.GameEventID.RFRESHENTITYHEADSTATUS:
        {
            HeadStatusType status = (HeadStatusType)param;
            RefreshAllHeadStatus(status);
        }
        break;

        //npc头顶任务状态
        case (int)Client.GameEventID.TASK_ACCEPT:
        {
            uint taskId = (uint)param;
            OnUpdateNpcTaskStatus(taskId, Client.GameEventID.TASK_ACCEPT);
        }
        break;

        case (int)Client.GameEventID.TASK_DELETE:
        {
            uint taskId = (uint)param;
            OnUpdateNpcTaskStatus(taskId, Client.GameEventID.TASK_DELETE);
        }
        break;

        case (int)Client.GameEventID.TASK_DONE:
        {
            Client.stTaskDone td = (Client.stTaskDone)param;
            OnUpdateNpcTaskStatus(td.taskid, Client.GameEventID.TASK_DONE);
        }
        break;

        case (int)Client.GameEventID.TASK_CANSUBMIT:
        {
            Client.stTaskCanSubmit tcs = (Client.stTaskCanSubmit)param;
            OnUpdateNpcTaskStatus(tcs.taskid, Client.GameEventID.TASK_CANSUBMIT);
        }
        break;

        case (int)Client.GameEventID.TASK_CANACCEPT:
        {
            uint taskId = (uint)param;
            OnUpdateNpcTaskStatus(taskId, Client.GameEventID.TASK_CANACCEPT);
        }
        break;
        }
    }
Ejemplo n.º 5
0
        private void Move(bool bPath = false)
        {
            if (m_Owner == null)
            {
                return;
            }

            Vector3 pos = m_Owner.GetPos();

            //如果目标是当前位置
            if (pos.x == m_param.m_target.x && pos.z == m_param.m_target.z)
            {
                StopMove(m_param.m_target);
                return;
            }

            // 获取服务器时间
            if (EntitySystem.m_ClientGlobal.IsMainPlayer(m_Owner))
            {
                m_uServerTime = EntityConfig.serverTime;
            }

            pos.y = 0.0f;
            if (m_hasTarget)
            {
                if (!bPath)
                {
                    if (m_param.path == null)
                    {
                        m_param.path = new List <Vector3>();
                    }
                    else
                    {
                        m_param.path.Clear();
                    }

                    m_param.path.Add(pos);
                    m_param.path.Add(m_param.m_target);
                }
            }
            else
            {
                if (!bPath)
                {
                    if (m_param.path == null)
                    {
                        m_param.path = new List <Vector3>();
                    }
                    else
                    {
                        m_param.path.Clear();
                    }

                    m_param.path.Add(pos); // 起始点
                    Vector3 target = pos + m_param.m_target;
                    m_param.path.Add(target);
                }
            }

            if (m_param.path == null)
            {
                return;
            }

            if (m_param.path.Count <= 0)
            {
                return;
            }

            // 开始移动事件 先发事件再处理
            stEntityBeginMove move = new stEntityBeginMove();

            move.uid = m_Owner.GetUID();
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_ENTITYBEGINMOVE, move);

            //开始移动时也同步下位置
            //SyncPos(true);

            // 路径点切换
            m_nPathIndex = 0;
            m_target     = pos;
            if (pos.Equals(m_param.path[m_nPathIndex])) // 去除第一个点
            {
                m_nPathIndex++;
                if (m_nPathIndex >= m_param.path.Count)
                {
                    return;
                }
            }

            m_lastWalkPos = pos;
            m_fDistance   = 0.0f;

            // 切换目标点
            SwitchTarget(m_param.path[m_nPathIndex], ref pos);
            // 贴地处理
            CloseTerrainPos(ref pos);

            m_vLastPos    = pos;
            m_lastSyncPos = m_vLastPos;

            m_bMoving = true;
            if (!m_bIgnoreMoveAction)
            {
                m_Owner.PlayAction(m_param.strRunAct, 0, m_fSpeedFact);
            }

            if (m_LastTime == 0)
            {
                m_LastTime = Engine.Utility.TimeHelper.GetTickCount();
            }

            m_BeginTime = m_LastTime;
            //Engine.Utility.Log.Error("Move begine: ({0},{1})->({3},{4}) {2} ", pos.x, pos.z, m_BeginTime, m_param.path[m_param.path.Count - 1].x, m_param.path[m_param.path.Count - 1].z);

            // 进入move状态
            ICreature owner = m_Owner as ICreature;

            if (owner != null)
            {
                owner.ChangeState(CreatureState.Move);
            }
        }
Ejemplo n.º 6
0
    void SkillEvent(int eventID, object param)
    {
        if (MainPlayerHelper.GetMainPlayer() == null)
        {
            return;
        }
        long userUID = ClientGlobal.Instance().MainPlayer.GetUID();

        if (eventID == (int)GameEventID.ENTITYSYSTEM_ENTITYBEGINMOVE)
        {
            stEntityBeginMove move = (stEntityBeginMove)param;
            if (move.uid != userUID)
            {
                return;
            }
        }
        else if (eventID == (int)Client.GameEventID.SKILLCD_BEGIN)
        {
            Client.stSkillCDChange st = (stSkillCDChange)param;
            uint skillid = (uint)st.skillid;
            DataManager.Manager <SkillCDManager>().AddSkillCD(st.skillid, st.cd);
            for (int i = 0; i < m_lstSkillBtns.Count; i++)
            {
                if (m_lstSkillBtns[i].SkillId == skillid)
                {
                    //Engine.Utility.Log.LogGroup("ZCX", "SKILLPANEL SHOW CD:技能{0} {1}", skillid, m_lstSkillBtns[i].name);
                    m_lstSkillBtns[i].RunCD();
                }
            }
            ExecutePublicCD(skillid);
        }
        else if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSBACK)
        {
        }
        else if (eventID == (int)GameEventID.SKILLSYSTEM_CDEND)
        {
            if (param != null && param is uint)
            {
                uint skillid = (uint)param;
                for (int i = 0; i < m_lstSkillBtns.Count; i++)
                {
                    if (m_lstSkillBtns[i].SkillId == skillid && m_lstSkillBtns[i].SkillId != CommonAttackID)
                    {
                        m_lstSkillBtns[i].AddEffectWhenCDEnd();
                    }
                }
            }
        }
        else if (eventID == (int)GameEventID.SKILLSYSTEM_REUSESKILLLONGATTACK)
        {
            ReqUseSkill(CommonAttackID);
        }
        else if (eventID == (int)GameEventID.ENTITYSYSTEM_ENTITYDEAD)
        {
            stEntityDead ed = (stEntityDead)param;
            if (ed.uid == userUID)
            {
                bReadingSlider = false;
                CancelPressAttack();
            }
        }
        else if (eventID == (int)GameEventID.ENTITYSYSTEM_RIDE || eventID == (int)GameEventID.ENTITYSYSTEM_UNRIDE)
        {
            //             LearnSkillDataManager data = DataManager.Manager<LearnSkillDataManager>();
            //             if (data != null && data.CurState != SkillSettingState.StateOne)
            //             {
            //                 for (int i = 0; i < m_lstSkillBtns.Count; i++)
            //                 {
            //                     if (m_lstSkillBtns[i].SkillIndex == 10)//第十个是状态转换
            //                     {
            //                         ChangeSkill(m_lstSkillBtns[i].gameObject);
            //                     }
            //                 }
            //             }

            SetSkillIcon();
        }
        else if (eventID == (int)GameEventID.ENTITYSYSTEM_CHANGE || eventID == (int)GameEventID.ENTITYSYSTEM_RESTORE)
        {
            stPlayerChange pc = (stPlayerChange)param;
            if (pc.uid == MainPlayerHelper.GetPlayerID())
            {
                for (int i = 0; i < m_lstSkillBtns.Count; i++)
                {
                    m_lstSkillBtns[i].SetSkillLockStatus(pc.status == 1);
                }
            }
        }
        else if (eventID == (int)GameEventID.SKILLSYSTEM_SKILLSTATECHANE)
        {
            m_uCommonAttackSkillID = DataManager.Manager <LearnSkillDataManager>().GetCommonSkillIDByJob();
        }
        else if (eventID == (int)GameEventID.HOTKEYPRESSDOWN)
        {
            stHotKeyDown hd = (stHotKeyDown)param;
            if (hd.type == 1)
            {
                uint pos = hd.pos;
                for (int i = 0; i < m_lstSkillBtns.Count; i++)
                {
                    SkillUseBtn use = m_lstSkillBtns[i];
                    if (use != null)
                    {
                        if (use.SkillIndex == pos)
                        {
                            UIButton btn = use.GetComponent <UIButton>();
                            if (btn != null)
                            {
                                btn.SendMessage("OnClick", SendMessageOptions.DontRequireReceiver);
                            }
                        }
                    }
                }
            }
        }
    }
Ejemplo n.º 7
0
 void OnEvent(int nEvent, object param)
 {
     Client.GameEventID ge = (Client.GameEventID)nEvent;
     if (ge == Client.GameEventID.TASK_DONING || ge == GameEventID.UIEVENTGUIDESHOWOUT || ge == GameEventID.SKILLSYSTEM_USESKILL)
     {
         ResetArrow();
         KillTimer();
     }
     else if (ge == GameEventID.STORY_PLAY_OVER)
     {
         ShowArrow();
     }
     else if (ge == GameEventID.ENTITYSYSTEM_ENTITYBEGINMOVE)
     {
         stEntityBeginMove move = (stEntityBeginMove)param;
         if (Client.ClientGlobal.Instance().IsMainPlayer(move.uid))
         {
             ResetArrow();
             KillTimer();
         }
     }
     else if (ge == GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE)
     {
         Client.stEntityStopMove stopEntity = (Client.stEntityStopMove)param;
         if (ClientGlobal.Instance().IsMainPlayer(stopEntity.uid))
         {
             if (CheckCondition())
             {
                 SetTime();
             }
         }
     }
     else if (ge == Client.GameEventID.UIEVENT_PANELFOCUSSTATUSCHANGED)
     {
         UIPanelManager.PanelFocusData fdata = (UIPanelManager.PanelFocusData)param;
         if (fdata.ID == PanelID.MissionAndTeamPanel)
         {
             if (fdata.GetFocus)
             {
                 if (CheckCondition())
                 {
                     SetTime();
                 }
             }
             else
             {
                 ResetArrow();
                 KillTimer();
             }
         }
     }
     else if (ge == Client.GameEventID.ENTITYSYSTEM_PROPUPDATE)
     {
         Client.stPropUpdate prop = (Client.stPropUpdate)param;
         if (Client.ClientGlobal.Instance().IsMainPlayer(prop.uid))
         {
             if (m_nignoreLevel <= MainPlayerHelper.GetPlayerLevel())
             {
                 RegisterEvent(false);
                 ResetArrow();
                 KillTimer();
             }
         }
     }
     else if (ge == GameEventID.SKILLNONESTATE_ENTER)
     {
         stSkillStateEnter state = (stSkillStateEnter)param;
         if (ClientGlobal.Instance().IsMainPlayer(state.uid))
         {
             if (CheckCondition())
             {
                 SetTime();
             }
         }
     }
     else if (ge == Client.GameEventID.COMBOT_ENTER_EXIT)
     {
         stCombotCopy cc = (stCombotCopy)param;
         if (cc.exit)
         {
             if (CheckCondition())
             {
                 SetTime();
             }
         }
         else if (cc.enter)
         {
             ResetArrow();
             KillTimer();
         }
     }
     else if (ge == GameEventID.SKILLGUIDE_PROGRESSSTART)
     {
         ResetArrow();
         KillTimer();
     }
     else if (ge == GameEventID.SKILLGUIDE_PROGRESSEND)
     {
         if (CheckCondition())
         {
             SetTime();
         }
     }
     else if (ge == Client.GameEventID.TASK_MAIN_ARROWHIDE)
     {
         ResetArrow();
         KillTimer();
     }
     else if (ge == Client.GameEventID.UIEVENTGUIDECOMPLETE || ge == Client.GameEventID.UIEVENTGUIDESKIP)
     {
         if (CheckCondition())
         {
             SetTime();
         }
     }
 }