Example #1
0
    public void OnRemoveItems(GameCmd.stBatchRemoveItemMapScreenUserCmd_S cmd)
    {
        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

        if (es == null)
        {
            Engine.Utility.Log.Error("严重错误:EntitySystem is null!");
            return;
        }

        for (int i = 0; i < cmd.id.Count; ++i)
        {
            EntityCreator.Instance().RemovePlayer(cmd.id[i]);
            IBox box = es.FindBox(cmd.id[i]);
            if (box != null)
            {
                Client.stRemoveEntity removeEntiy = new Client.stRemoveEntity();
                removeEntiy.uid = box.GetUID();
                Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_REMOVEENTITY, removeEntiy);
                es.RemoveEntity(box);
            }
            else
            {
                Engine.Utility.Log.Error("找不到box id{0}", cmd.id[i]);
            }
        }
    }
Example #2
0
    public void Excute(GameCmd.stBatchRemoveNpcMapScreenUserCmd_S cmd)
    {
        Profiler.BeginSample("stBatchRemoveNpcMapScreenUserCmd_S");
        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

        if (es == null)
        {
            Engine.Utility.Log.Error("严重错误:EntitySystem is null!");
            return;
        }
        for (int i = 0; i < cmd.id.Count; ++i)
        {
            EntityCreator.Instance().RemoveNPC(cmd.id[i]);
            //  Engine.Utility.Log.LogGroup( "ZDY" , "stBatchRemoveNpcMapScreenUserCmd_S remove entity ----------------" + cmd.id[i] );
            IEntity npc = es.FindNPC(cmd.id[i]);
            if (npc == null)
            {
                npc = es.FindRobot(cmd.id[i]);
            }

            if (npc != null)
            {
                long uid = npc.GetUID();
                Client.stRemoveEntity removeEntiy = new Client.stRemoveEntity();
                removeEntiy.uid = uid;
                Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_REMOVEENTITY, removeEntiy);

                NpcAscription.Instance.OnRemoveBelongData(uid);
            }

            es.RemoveEntity(npc);
        }
        Profiler.EndSample();
    }
Example #3
0
    public void Execute(GameCmd.stBatchRemoveUserMapScreenUserCmd_S cmd)
    {
        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

        if (es == null)
        {
            Engine.Utility.Log.Error("严重错误:EntitySystem is null!");
            return;
        }
        for (int i = 0; i < cmd.id.Count; ++i)
        {
            EntityCreator.Instance().RemovePlayer(cmd.id[i]);

            IPlayer player = es.FindPlayer(cmd.id[i]);
            if (player != null)
            {
                if (!ClientGlobal.Instance().IsMainPlayer(player))
                {
                    Client.stRemoveEntity removeEntiy = new Client.stRemoveEntity();
                    removeEntiy.uid = player.GetUID();
                    Engine.Utility.Log.Info("remove :" + cmd.id[i]);
                    Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_REMOVEENTITY, removeEntiy);

                    es.RemoveEntity(player);
                }
            }
        }
    }
Example #4
0
    public void OnRemoveMapObjectRes(stRemoveMapObjectMapScreenUserCmd_S cmd)
    {
        //Engine.Utility.Log.Info("OnRemoveMapObjectRes ID:" + cmd.qwThisID);

        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

        if (es == null)
        {
            Engine.Utility.Log.Error("严重错误:EntitySystem is null!");
            return;
        }

        {
            EntityCreator.Instance().RemovePlayer(cmd.qwThisID);
            IBox box = es.FindBox(cmd.qwThisID);
            if (box != null)
            {
                Client.stRemoveEntity removeEntiy = new Client.stRemoveEntity();
                removeEntiy.uid = box.GetUID();
                Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_REMOVEENTITY, removeEntiy);
                es.RemoveEntity(box);
            }
            else
            {
                Engine.Utility.Log.Error("找不到box id{0}", cmd.qwThisID);
            }
        }
    }
Example #5
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);
        }
    }
Example #6
0
        public void RemoveEntity(IEntity en)
        {
            if (en != null)
            {
                //先发送事件在删除。因为触发事件中有可能会获取该实体
                Client.stRemoveEntity removeEntiy = new Client.stRemoveEntity();
                removeEntiy.uid = en.GetUID();
                Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_REMOVEENTITY, removeEntiy);

                EntityManager.Instance().RemoveEntity(en);
            }
        }
Example #7
0
    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)
            {
                Client.IEntity e = es.FindEntity(createEntity.uid);
                if (e == null)
                {
                    return;
                }
                if (e.GetEntityType() != Client.EntityType.EntityType_Box)
                {
                    return;
                }

                if (!m_dicBoxTime.ContainsKey(createEntity.uid))
                {
                    m_dicBoxTime.Add(createEntity.uid, createEntity.boxTime);
                }
                else
                {
                    Engine.Utility.Log.Error("重复添加box{0}", createEntity.uid);
                }
            }
        }
        else if (nEventid == (int)Client.GameEventID.ENTITYSYSTEM_REMOVEENTITY)
        {
            Client.stRemoveEntity removeEntiy = (Client.stRemoveEntity)param;
            Client.IEntitySystem  es          = Client.ClientGlobal.Instance().GetEntitySystem();
            if (es != null)
            {
                Client.IEntity e = es.FindEntity(removeEntiy.uid);
                if (e == null)
                {
                    return;
                }
                if (e.GetEntityType() != Client.EntityType.EntityType_Box)
                {
                    return;
                }
                if (m_dicBoxTime.ContainsKey(removeEntiy.uid))
                {
                    m_dicBoxTime.Remove(removeEntiy.uid);
                }
            }
        }
    }
Example #8
0
    /// <summary>
    /// 移除采集物特效(当npc移除时同时移除特效)
    /// </summary>
    /// <param name="removeEntity"></param>
    void RemoveEntityEffect(Client.stRemoveEntity removeEntity)
    {
        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

        if (es == null)
        {
            return;
        }

        IEntity npc = es.FindEntity(removeEntity.uid);

        if (npc == null)
        {
            return;
        }

        RemoveCollectNpcEffectAndCleanDataByNpcId(npc.GetID());
    }
Example #9
0
    private void RemoveBar(Client.stRemoveEntity removeEntiy)
    {
        RoleStateBar bar = GetRoleBarByUID(removeEntiy.uid);

        if (bar != null)
        {
            if (m_lstUnUseStateBarTrans.Count < MAXBAR_NUM)
            {
                m_lstUnUseStateBarTrans.Add(bar.mtrans);
                bar.mtrans.name = "UnUse_" + m_lstUnUseStateBarTrans.Count;
                bar.obj.SetActive(false);
            }
            else
            {
                GameObject.Destroy(bar.mtrans.gameObject);
            }
            m_lstAllStateBar.Remove(bar);
        }
    }
Example #10
0
    public void Excute(GameCmd.stRemoveMapNpcMapScreenUserCmd_S cmd)
    {
        Profiler.BeginSample("stRemoveMapNpcMapScreenUserCmd_S");
        //RemoveNpc(cmd.dwTempID);
        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

        if (es == null)
        {
            Engine.Utility.Log.Error("严重错误:EntitySystem is null!");
            return;
        }

        {
            EntityCreator.Instance().RemoveNPC(cmd.dwTempID);
            //Engine.Utility.Log.LogGroup( "ZDY" , "single remove entity ----------------" + cmd.dwTempID );
            //PetDataManager petData = DataManager.Manager<PetDataManager>();
            //if(petData.NpcIsPet(cmd.dwTempID))
            //{
            //    petData.OnPetDead( cmd.dwTempID );
            //}
            IEntity npc = es.FindNPC(cmd.dwTempID);
            if (npc == null)
            {
                npc = es.FindRobot(cmd.dwTempID);
            }
            if (npc != null)
            {
                long uid = npc.GetUID();

                Client.stRemoveEntity removeEntiy = new Client.stRemoveEntity();
                removeEntiy.uid = uid;
                Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_REMOVEENTITY, removeEntiy);

                NpcAscription.Instance.OnRemoveBelongData(uid);
            }
            es.RemoveEntity(npc);
        }
        Profiler.EndSample();
    }
Example #11
0
    //-------------------------------------------------------------------------------------------------------
    public void Clear()
    {
        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

        if (es == null)
        {
            return;
        }

        Dictionary <int, IEntity> .Enumerator iter = m_dicEntity.GetEnumerator();
        while (iter.MoveNext())
        {
            if (iter.Current.Value != null)
            {
                Client.stRemoveEntity removeEntiy = new Client.stRemoveEntity();
                removeEntiy.uid = iter.Current.Value.GetUID();
                Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_REMOVEENTITY, removeEntiy);
                es.RemoveEntity(iter.Current.Value);
            }
        }

        Dictionary <int, IPuppet> .Enumerator itPuppet = m_dicPuppet.GetEnumerator();
        while (itPuppet.MoveNext())
        {
            if (itPuppet.Current.Value != null)
            {
                Client.stRemoveEntity removeEntiy = new Client.stRemoveEntity();
                removeEntiy.uid = itPuppet.Current.Value.GetUID();
                Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_REMOVEENTITY, removeEntiy);
                es.RemoveEntity(itPuppet.Current.Value);
            }
        }
        Client.IPlayer player = ClientGlobal.Instance().MainPlayer;
        if (player != null)
        {
            CameraFollow.Instance.target = player;
        }
    }
Example #12
0
 void OnEvent(int evenId, object param)
 {
     if (evenId == (int)GameEventID.ENTITYSYSTEM_ENTITYDEAD)
     {
         if (m_currEntity == null)
         {
             return;
         }
         stEntityDead ed = (stEntityDead)param;
         IEntity      e  = ControllerSystem.m_ClientGlobal.GetEntitySystem().FindEntity(ed.uid);
         if (e != null && e.GetUID() == m_currEntity.GetUID())
         {
             Engine.RareEngine.Instance().Root.GetComponent <MonoBehaviour>().StartCoroutine(WaitFoeOneSec(m_currEntity));
         }
     }
     else if (evenId == (int)GameEventID.ENTITYSYSTEM_REMOVEENTITY)
     {
         if (m_currEntity == null)
         {
             return;
         }
         Client.stRemoveEntity removeEntiy = (Client.stRemoveEntity)param;
         if (removeEntiy.uid == m_currEntity.GetUID())
         {
             ReleseTarget();
         }
     }
     else if (evenId == (int)GameEventID.ENTITYSYSTEM_TARGETCHANGE)
     {
         stTargetChange tc = (stTargetChange)param;
         if (tc.target != null)
         {
             m_currEntity = tc.target;
             SetTimer();
         }
     }
 }
Example #13
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;
        }
    }
Example #14
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);
        }
    }
Example #15
0
 /// <summary>
 /// 事件处理
 /// </summary>
 /// <param name="nEventID"></param>
 /// <param name="param"></param>
 public void GlobalEventHandler(int eventID, object param)
 {
     if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_NPCHEADSTATUSCHANGED)
     {
         if (null != param && param is Client.INPC)
         {
             UpdateNpcHeadMask((Client.INPC)param);
         }
     }
     else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_CREATEENTITY)
     {
         Client.stCreateEntity ce = (Client.stCreateEntity)param;
         OnCretateEntity(ref ce);
     }
     else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_REMOVEENTITY)
     {
         Client.stRemoveEntity removeEntiy = (Client.stRemoveEntity)param;
         RemoveBar(removeEntiy);
     }
     else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_PROPUPDATE)
     {
         stPropUpdate prop = (stPropUpdate)param;
         OnPropUpdate(ref prop);
     }
     else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_HPUPDATE)
     {
         stPropUpdate prop = (stPropUpdate)param;
         OnPropUpdate(ref prop);
     }
     else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_CHANGENAME)
     {
         stEntityChangename e = (stEntityChangename)param;
         OnChangeName(e.uid);
     }
     else if (eventID == (int)(int)Client.GameEventID.ENTITYSYSTEM_SETHIDE)
     {
         stEntityHide st = (stEntityHide)param;
         OnSetEntityHide(ref st);
         return;
     }
     else if (eventID == (int)(int)Client.GameEventID.TITLE_WEAR)//佩戴称号
     {
         Client.stTitleWear data = (Client.stTitleWear)param;
         OnTitleWear(data.uid);
     }
     else if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSSTART)
     {
         Client.stUninterruptMagic uninterrupt = (Client.stUninterruptMagic)param;
         OnStartCollectSlider(ref uninterrupt);
     }
     else if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSBREAK)
     {
         if (param != null)
         {
             stGuildBreak guildbreak = (stGuildBreak)param;
             if (ShowCollectTip(guildbreak.action))
             {
                 long         uid = EntitySystem.EntityHelper.MakeUID(EntityType.EntityType_Player, guildbreak.uid);
                 RoleStateBar bar = GetRoleBarByUID(uid);
                 if (bar != null)
                 {
                     bar.SetWidgetState(HeadTipType.Collect, false);
                 }
             }
         }
     }
     else if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSEND)
     {
         if (param != null)
         {
             stGuildEnd guildEnd = (stGuildEnd)param;
             if (ShowCollectTip(guildEnd.action))
             {
                 long         uid = EntitySystem.EntityHelper.MakeUID(EntityType.EntityType_Player, guildEnd.uid);
                 RoleStateBar bar = GetRoleBarByUID(uid);
                 if (bar != null)
                 {
                     bar.SetWidgetState(HeadTipType.Collect, false);
                 }
             }
         }
     }
     else if (eventID == (int)Client.GameEventID.CLANQUIT || eventID == (int)Client.GameEventID.CLANJOIN ||
              eventID == (int)Client.GameEventID.CLANREFRESHID || eventID == (int)Client.GameEventID.CITYWARWINERCLANID ||
              eventID == (int)Client.GameEventID.CLANDeclareInfoAdd || eventID == (int)Client.GameEventID.CLANDeclareInfoRemove)
     {
         OnRefreshAllClanTitile();
     }
     else if (eventID == (int)Client.GameEventID.CITYWARTOTEMCLANNAMECHANGE)
     {
         long         uid = EntitySystem.EntityHelper.MakeUID(EntityType.EntityType_NPC, (uint)param);
         RoleStateBar bar = GetRoleBarByUID(uid);
         if (bar != null)
         {
             Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();
             if (es == null)
             {
                 return;
             }
             RefreshClanName(es.FindEntity(uid), bar);
         }
     }
     else if (eventID == (int)Client.GameEventID.SYSTEM_GAME_READY)
     {
         OnRefreshAllHpSlider();
     }
 }
Example #16
0
        private void OnEvent(int nEventID, object param)
        {
            GameEventID eventId = (GameEventID)nEventID;

            switch (eventId)
            {
            case GameEventID.ENTITYSYSTEM_MAINPLAYERCREATE:
            {
                SetTimer(MEDICAL_TIMEID, MEDICAL_TIME_INTERVAL);
                SetTimer(ATONCE_TIMERID, ATONCE_LEN);
            }
            break;

            case GameEventID.ENTITYSYSTEM_RELIVE:
            {
                stEntityRelive er = (stEntityRelive)param;
                if (ControllerSystem.m_ClientGlobal.IsMainPlayer(er.uid))
                {
                    SetTimer(MEDICAL_TIMEID, MEDICAL_TIME_INTERVAL);
                    SetTimer(ATONCE_TIMERID, ATONCE_LEN);
                }
            }
            break;

            case GameEventID.ENTITYSYSTEM_ENTITYDEAD:
            {
                stEntityDead ed = (stEntityDead)param;
                if (ControllerSystem.m_ClientGlobal.IsMainPlayer(ed.uid))
                {
                    KillTimer(MEDICAL_TIMEID);
                    KillTimer(ATONCE_TIMERID);
                }
            }
            break;

            case GameEventID.SKILLSYSTEM_SKILLLISTCHANE:
            case GameEventID.SKILLSYSTEM_ADDSKILL:
                InitSkill();
                break;

            case GameEventID.SKILLNONESTATE_ENTER:
            {
                NextSkill = 0;
                OnCombat();
            }
            break;

            //case GameEventID.ROBOTCOMBAT_NEXTCMD:
            //    {
            //        if (param != null)
            //        {
            //            Client.stSkillDoubleHit skillDhHit = (Client.stSkillDoubleHit)param;
            //            OnUseDoubleHitSkill(skillDhHit);
            //        }
            //    }
            //    break;
            case GameEventID.SKILLSYSTEM_STIFFTIMEOVER:
            {        //挂机状态下 硬直结束(并且没有插入技能)只处理普攻前两招,第三招释放时如果有插入 就不播放收招
                stNextSkill st = (stNextSkill)param;
                NextSkill = st.nextSkillID;
                if (m_status == CombatRobotStatus.RUNNING && NextSkill != 0)
                {
                    DoAttack();
                }
                if (m_status == CombatRobotStatus.RUNNING && NextSkill == 0 && InsertSkillID != 0)
                {
                    DoAttack();
                }
            }
            break;

            case GameEventID.SKILLGUIDE_PROGRESSBREAK:
            {
                if (param != null)
                {
                    stGuildBreak skillFailed = (stGuildBreak)param;
                    if (skillFailed.action == GameCmd.UninterruptActionType.UninterruptActionType_SkillCJ)
                    {
                        if (ControllerSystem.m_ClientGlobal.IsMainPlayer(skillFailed.uid))
                        {
                            m_nIgnoreSkillid = skillFailed.skillid;

                            // AddTips(string.Format("使用技能失败id:{0} ret{1}", skillFailed.skillid, skillFailed.msg));
                        }
                        ChangeRoleAction(RoleAction.NONE);
                    }
                }
                //ChangeRoleAction(RoleAction.USESKILL);
                //DoNextCMD();
            }
            break;

            case GameEventID.JOYSTICK_UNPRESS:
                m_fStopTime = UnityEngine.Time.realtimeSinceStartup;

                break;

            case GameEventID.JOYSTICK_PRESS:
                m_fStopTime = 0;
                OnPause(true);
                break;

            case GameEventID.ENTITYSYSTEM_CREATEENTITY:
            {
                Client.stCreateEntity createEntity = (Client.stCreateEntity)param;
                Client.IEntitySystem  es           = ControllerSystem.m_ClientGlobal.GetEntitySystem();
                Client.IEntity        entity       = es.FindEntity(createEntity.uid);
                if (entity != null)
                {
                    if (entity.GetEntityType() == EntityType.EntityType_Box)
                    {
                        ShowBoxTips(entity.GetID());
                        OnPickUpItem();
                    }
                }
            }
            break;

            case GameEventID.ENTITYSYSTEM_REMOVEENTITY:
            {
                Client.stRemoveEntity removeEntiy = (Client.stRemoveEntity)param;
                Client.IEntitySystem  es          = ControllerSystem.m_ClientGlobal.GetEntitySystem();
                Client.IEntity        entity      = es.FindEntity(removeEntiy.uid);
                if (entity != null)
                {
                    if (entity.GetEntityType() == EntityType.EntityType_Box)
                    {
                        OnPickUpItem();
                    }
                }
            }
            break;

            case GameEventID.ROBOTCOMBAT_COPYKILLWAVE:
            {
                if (param != null)
                {
                    stCopySkillWave copyWave = (stCopySkillWave)param;
                    if (m_bInCopy)
                    {
                        m_nLaskKillWave     = copyWave.waveId;
                        m_nLaskMovePosIndex = copyWave.posIndex;
                        //  AddTips(string.Format("副本wave{0} posIndex{1}", m_nLaskKillWave, m_nLaskMovePosIndex));
                        if (m_nLaskMovePosIndex != 0)
                        {
                            // SetTimer(COPYCOMBAT_TIMEID, 1600);
                            //OnPause(false);
                        }
                        //DoNextCMD();
                    }
                }
            }
            break;

            case GameEventID.NETWORK_CONNECTE_CLOSE:
            {
                m_disconnectStatus = m_status;
                if (m_disconnectStatus != CombatRobotStatus.STOP)
                {
                    Stop();
                    Engine.Utility.Log.Error("掉线了 挂机停止!!!");
                }
            }
            break;

            case GameEventID.RECONNECT_SUCESS:
            {
                if (m_disconnectStatus != CombatRobotStatus.STOP)
                {
                    Start();
                    if (m_disconnectStatus == CombatRobotStatus.PAUSE)
                    {
                        Pause();
                    }
                    m_disconnectStatus = CombatRobotStatus.STOP;
                }
            }
            break;

            default:
                break;
            }
        }