少年修仙传客户端代码仓库
client_Hale
2018-08-28 48bb9eeaea8a7a17b93507e1931e17396a8d8bd6
Fixed 提供npc出现和消失的回调
1个文件已修改
18 ■■■■■ 已修改文件
Fight/GameActor/GAMgr.cs 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/GameActor/GAMgr.cs
@@ -15,6 +15,9 @@
    public event UnityAction<uint> OnGActorRequest;
    public event UnityAction<uint> OnGActorServerDie;
    public event UnityAction<uint> OnFightNpcRequest;
    public event UnityAction<uint> OnFightNpcRelease;
    // 由角色池生成的prefab列表. 用来卸载用的.
    public List<GameObject> needDestroyPrefabList = new List<GameObject>();
    public List<GActorFight> needDieList = new List<GActorFight>();
@@ -422,6 +425,11 @@
            RuntimeLogUtility.AddLog_Green(_content, serverInstID);
#endif
            if (OnFightNpcRequest != null)
            {
                OnFightNpcRequest(npcID);
            }
        }
        return _actor as T;
@@ -566,6 +574,16 @@
    /// <param name="actor"></param>
    public void Release(GActor actor)
    {
        var _npcfight = actor as GActorNpcFight;
        if (_npcfight != null)
        {
            if (OnFightNpcRequest != null)
            {
                OnFightNpcRequest((uint)_npcfight.NpcConfig.NPCID);
            }
        }
#if UNITY_EDITOR
        string _content = string.Format("GAMgr => 对角色 SID: {0}, CID: {1} 进行了回收", actor.ServerInstID, actor.ClientInstID);
        RuntimeLogUtility.AddLog_Green(_content, actor.ServerInstID);