少年修仙传客户端代码仓库
client_Hale
2018-11-15 7c16a4de9b3a2fc80ce5633211a773c09e6905b7
4129 NPC初始化异常导致报错
2个文件已修改
46 ■■■■■ 已修改文件
Fight/GameActor/GActorNpcFight.cs 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/GameActor/GActorNpcNoFight.cs 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/GameActor/GActorNpcFight.cs
@@ -55,28 +55,32 @@
        base.OnInit(package);
        m_LoadDefaultRes = false;
        var _package = package as H0406_tagNPCAppear;
        if (_package != null)
        int _npcID = 0;
        if (this is GA_NpcSummonFight)
        {
            NpcConfig = Config.Instance.Get<NPCConfig>((int)_package.NPCID);
            _npcID = (int)(package as H0408_tagPlayerSummonNPCAppear).NPCID;
        }
        else if (this is GA_Pet)
        {
            _npcID = (int)(package as H0435_tagPetAppear).NPCID;
        }
        else
        {
            var _package2 = package as H0408_tagPlayerSummonNPCAppear;
            if (_package2 != null)
            {
                NpcConfig = Config.Instance.Get<NPCConfig>((int)_package2.NPCID);
            }
            else
            {
                return;
            }
            _npcID = (int)(package as H0406_tagNPCAppear).NPCID;
        }
        if (_npcID == 0)
        {
            Debug.LogError("加载异常....");
            return;
        }
        NpcConfig = Config.Instance.Get<NPCConfig>(_npcID);
        if (NpcConfig == null)
        {
            // 报错
            Debug.LogError("配置异常....: " + _npcID);
            return;
        }
Fight/GameActor/GActorNpcNoFight.cs
@@ -28,14 +28,22 @@
    {
        m_LoadDefaultRes = false;
        var _package = package as H0406_tagNPCAppear;
        if (_package == null)
        int _npcID = 0;
        if (this is GA_NpcSummonFunc)
        {
            Debug.LogError("非战斗单位封包传入错误: " + package.GetType());
            _npcID = (int)(package as H0408_tagPlayerSummonNPCAppear).NPCID;
        }
        else
        {
            _npcID = (int)(package as H0406_tagNPCAppear).NPCID;
        }
        if (_npcID == 0)
        {
            return;
        }
        NpcConfig = Config.Instance.Get<NPCConfig>((int)_package.NPCID);
        NpcConfig = Config.Instance.Get<NPCConfig>(_npcID);
        if (NpcConfig == null)
        {