public static void RefreshConfig(this RoomNpcComponent self, params long[] idList) { ConfigComponent configComponent = Game.Scene.GetComponent <ConfigComponent>(); for (int i = 0; i < idList?.Length; i++) { long id = idList[i]; if (!configComponent.AllConfig.TryGetValue(typeof(NPCConfig), out ACategory configCategory)) { Log.Error("ConfigComponent not found key: NPCConfig"); continue; } var newConfig = configCategory.TryGet(id) as NPCConfig; if (newConfig == null) { Log.Error($"NPCConfig is null, id:{id}"); continue; } if (self._npcDicts.TryGetValue(id, out var npc)) { npc.RefreshConfig(newConfig); } else { self.CreateNPC(newConfig); } } }