Beispiel #1
0
    public void OnEvent(int eventid, object param)
    {
        if (eventid == (int)Client.GameEventID.TASK_VISITNPC)
        {
            m_currvisitNpc = (uint)param;
        }
        else if (eventid == (int)Client.GameEventID.TASK_ITEM_COLLECT_USE)
        {
            Client.stTaskNpcItem stData = (Client.stTaskNpcItem)param;
            TaskItemCollect(stData);
        }
        else if (eventid == (int)Client.GameEventID.SYSTEM_LOADUICOMPELETE)
        {
            if (!FirstLoginSuccess)
            {
                FirstLoginSuccess = true;

                if (m_nAcceptTaskId != 0)
                {
                    Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.TASK_ACCEPT, m_nAcceptTaskId);
                    m_nAcceptTaskId = 0;
                }
            }
        }
        else if ((int)Client.GameEventID.RECONNECT_SUCESS == eventid)
        {
            this.FirstLoginSuccess = true;

            //大重连  服务器会重发所有消息
            Client.stReconnectSucess rs = (Client.stReconnectSucess)param;
            if (rs.isLogin)
            {
                this.m_bReconnect = true;

                if (DataManager.Manager <UIPanelManager>().IsShowPanel(PanelID.NpcDialogPanel))
                {
                    DataManager.Manager <UIPanelManager>().HidePanel(PanelID.NpcDialogPanel);
                    DataManager.Manager <UIPanelManager>().ShowMain();
                }
                Engine.Utility.Log.Info("重连成功关闭任务追踪界面");
                //DataManager.Manager<UIPanelManager>().HidePanel(PanelID.MissionAndTeamPanel);
            }
        }
        else if ((int)Client.GameEventID.ENTITYSYSTEM_CREATEENTITY == eventid)
        {
            Client.stCreateEntity createEntity = (Client.stCreateEntity)param;
            AddEntityEffect(createEntity);
        }
        else if ((int)Client.GameEventID.ENTITYSYSTEM_REMOVEENTITY == eventid)
        {
            Client.stRemoveEntity removeEntity = (Client.stRemoveEntity)param;
            RemoveEntityEffect(removeEntity);
        }
        else if ((int)Client.GameEventID.TASK_CANSUBMIT == eventid)
        {
            Client.stTaskCanSubmit taskSubmit = (Client.stTaskCanSubmit)param;
            RemoveCollectNpcEffectByTaskId(taskSubmit.taskid);
        }
    }
    /// <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;
        }
    }
Beispiel #3
0
    void OnEvent(int nEventId, object param)
    {
        Client.GameEventID eid = (Client.GameEventID)nEventId;
        if (eid == Client.GameEventID.TASK_ACCEPT)
        {
            uint nTaskID = (uint)param;
            OnTaskAccept(nTaskID);
            return;
        }
        else if (eid == Client.GameEventID.TASK_CANSUBMIT)
        {
            Client.stTaskCanSubmit cs = (Client.stTaskCanSubmit)param;
            OnTaskCanCommit(cs.taskid);
        }
        else if (eid == Client.GameEventID.TASK_DONE)
        {
            Client.stTaskDone td = (Client.stTaskDone)param;
            OnTaskDone(td.taskid);
        }
        else if (eid == Client.GameEventID.TASK_DONING)
        {
            Client.stDoingTask dt = (Client.stDoingTask)param;
            DataManager.Manager <TaskDataManager>().DoingTaskID = dt.taskid;
            OnExecuteTask(dt.taskid);
        }
        else if (eid == Client.GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE)
        {
            Client.stEntityStopMove stopEntity = (Client.stEntityStopMove)param;
            OnPlayerStopMove(ref stopEntity, nEventId);
            return;
        }
        else if (eid == Client.GameEventID.SKILLNONESTATE_ENTER)
        {
            Client.stSkillStateEnter sse = (Client.stSkillStateEnter)param;
            OnSkillPlayOver(ref sse, nEventId);
            return;
        }
        else if (eid == Client.GameEventID.ENTITYSYSTEM_CHANGE)
        {
            Client.stPlayerChange pc = (Client.stPlayerChange)param;

            if (!Client.ClientGlobal.Instance().IsMainPlayer(pc.uid))
            {
                return;
            }
            Engine.Utility.EventEngine.Instance().RemoveEventListener(nEventId, OnEvent);
            QuestTraceInfo questInfo = QuestTranceManager.Instance.GetQuestTraceInfo(m_nDoingTaskID);
            if (questInfo == null)
            {
                return;
            }
            m_bAddChangeListener = false;
            Engine.Utility.Log.Info("{0} 变身完毕 执行任务{1}", TAG, m_nDoingTaskID);
            ProcessTask(questInfo);
            m_nDoingTaskID = 0;
        }
        else if (eid == Client.GameEventID.ENTITYSYSTEM_RESTORE)
        {
            Client.stPlayerChange pc = (Client.stPlayerChange)param;
            if (!Client.ClientGlobal.Instance().IsMainPlayer(pc.uid))
            {
                return;
            }
            Engine.Utility.EventEngine.Instance().RemoveEventListener(nEventId, OnEvent);
            Engine.Utility.Log.Info("{0}变身回来 执行任务{1}", TAG, m_nDoingTaskID);
            OnTaskDone(m_nDoingTaskID);
            m_nDoingTaskID        = 0;
            m_bAddRestoreListener = false;
        }
    }
Beispiel #4
0
    public void OnEvent(int nEventId, object param)
    {
        if (nEventId == (int)Client.GameEventID.ENTITYSYSTEM_CREATEENTITY)
        {
            Client.stCreateEntity createEntity = (Client.stCreateEntity)param;
            Client.IEntitySystem  es           = Client.ClientGlobal.Instance().GetEntitySystem();
            if (es == null)
            {
                Engine.Utility.Log.Error("严重错误:EntitySystem is null!");
                return;
            }

            Client.IEntity en = es.FindEntity(createEntity.uid);
            if (en != null && en is Client.INPC)
            {
                List <QuestTraceInfo> traceTask;
                DataManager.Manager <TaskDataManager>().GetAllQuestTraceInfo(out traceTask);
                int         index;
                Client.INPC npc = en as Client.INPC;
                if (IsNeedSetTip(npc, ref traceTask, out index))
                {
                    SetNpcTipsByTraceInfo(traceTask[index]);
                }
            }
        }
        else if (nEventId == (int)Client.GameEventID.ENTITYSYSTEM_REMOVEENTITY)
        {
            Client.stRemoveEntity removeEntiy = (Client.stRemoveEntity)param;
            Client.IEntitySystem  es          = Client.ClientGlobal.Instance().GetEntitySystem();
            if (es == null)
            {
                Engine.Utility.Log.Error("严重错误:EntitySystem is null!");
                return;
            }

            Client.IEntity en = es.FindEntity(removeEntiy.uid);
            if (en != null && en is Client.INPC)
            {
                Client.INPC npc = en as Client.INPC;
                DeleteEffectByNpc(npc);
            }
        }
        else if (nEventId == (int)Client.GameEventID.TASK_ACCEPT)
        {
            uint taskId = (uint)param;
            SetNpcTipsByTaskID(taskId, true);
        }
        else if (nEventId == (int)Client.GameEventID.TASK_DELETE)
        {
            uint taskId = (uint)param;
            DeleteEffectByTaskID(taskId);
        }
        else if (nEventId == (int)Client.GameEventID.TASK_DONE)
        {
            Client.stTaskDone td = (Client.stTaskDone)param;
            DeleteEffectByTaskID(td.taskid);
        }
        else if (nEventId == (int)Client.GameEventID.TASK_CANSUBMIT)
        {
            Client.stTaskCanSubmit tcs = (Client.stTaskCanSubmit)param;
            SetNpcTipsByTaskID(tcs.taskid, false);
        }
        else if (nEventId == (int)Client.GameEventID.SYSTEM_GAME_READY)
        {
            RefreshAllNpcTips();
        }
        else if (nEventId == (int)Client.GameEventID.TASK_CANACCEPT)
        {
            uint taskId = (uint)param;
            SetNpcTipsByTaskID(taskId, false);
        }
    }
Beispiel #5
0
    private void OnEvent(int nEventId, object param)
    {
        if (nEventId == (int)Client.GameEventID.TASK_DONE)
        {
            //完成任务
            Client.stTaskDone     td       = (Client.stTaskDone)param;
            table.ChapterDabaBase database = null;
            bool flag = false;

            for (int i = 0, imax = m_lstChapterTaskTrigger.Count; i < imax; i++)
            {
                database = m_lstChapterTaskTrigger[i];

                if (database.Paramer2 == td.taskid)
                {
                    if (database.Paramer1 == 2)
                    {
                        PlayChapterEffect(database);
                        return;
                    }
                }
            }

            for (int i = 0; i < m_TaskTriggerType.Count; i++)
            {
                table.SequencerData data = m_TaskTriggerType[i];

                if (data.Paramer1 == 2)
                {
                    if (data.Paramer2 == td.taskid)
                    {
                        m_SequencerData = data;
                        SequencerManager.Instance().PlaySequencer(m_SequencerData.SequencerFile);
                        return;
                    }
                }
            }
        }
        else if ((int)Client.GameEventID.TASK_ACCEPT == nEventId)
        {
            //接受任务
            uint taskid = (uint)param;
            table.ChapterDabaBase database = null;
            for (int i = 0, imax = m_lstChapterTaskTrigger.Count; i < imax; i++)
            {
                database = m_lstChapterTaskTrigger[i];

                if (database.Paramer2 == taskid)
                {
                    if (database.Paramer1 == 1)
                    {
                        PlayChapterEffect(database);
                        return;
                    }
                }
            }
            for (int i = 0; i < m_TaskTriggerType.Count; i++)
            {
                table.SequencerData data = m_TaskTriggerType[i];

                // 这个剧情是接受任务触发
                if (data.Paramer1 == 1)
                {
                    if (data.Paramer2 == taskid)
                    {
                        m_SequencerData = data;
                        SequencerManager.Instance().PlaySequencer(m_SequencerData.SequencerFile);
                        return;
                    }
                }
            }
        }
        else if ((int)Client.GameEventID.TASK_CANSUBMIT == nEventId)
        {
            //提交任务
            Client.stTaskCanSubmit cs       = (Client.stTaskCanSubmit)param;
            table.ChapterDabaBase  database = null;
            for (int i = 0, imax = m_lstChapterTaskTrigger.Count; i < imax; i++)
            {
                database = m_lstChapterTaskTrigger[i];

                if (database.Paramer2 == cs.taskid)
                {
                    if (database.Paramer1 == 3)
                    {
                        PlayChapterEffect(database);
                        return;
                    }
                }
            }
            for (int i = 0; i < m_TaskTriggerType.Count; i++)
            {
                table.SequencerData data = m_TaskTriggerType[i];
                if (data.Paramer1 == 3)
                {
                    if (data.Paramer2 == cs.taskid)
                    {
                        m_SequencerData = data;
                        SequencerManager.Instance().PlaySequencer(m_SequencerData.SequencerFile);
                        return;
                    }
                }
            }
        }
    }