Пример #1
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);
                }
            }
        }
    }
Пример #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();
    }
Пример #3
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]);
            }
        }
    }
Пример #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);
            }
        }
    }
Пример #5
0
    public int DestroyDisplayData()
    {
        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

        if (m_pEntity != null)
        {
            es.RemoveEntity(m_pEntity);
            m_pEntity = null;
        }
        return(1);
    }
Пример #6
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;
        }
    }
Пример #7
0
    public void RemoveEntity(IPuppet puppet)
    {
        if (puppet == null)
        {
            return;
        }
        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

        if (es == null)
        {
            return;
        }

        m_dicPuppet.Remove((int)puppet.GetID());
        es.RemoveEntity(puppet);
    }
Пример #8
0
    public void RemoveEntity(IEntity en)
    {
        if (en == null)
        {
            return;
        }
        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

        if (es == null)
        {
            return;
        }

        if (en.GetEntityType() == EntityType.EntityType_Animal)
        {
            m_AnimalManager.RemoveAnimal(en as IAnimal);
        }

        m_dicEntity.Remove((int)en.GetID());
        es.RemoveEntity(en);
    }
Пример #9
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();
    }