public void AddRes(ResConfig _config) { var key = _config.GetType(); if (!resConfigDatas.ContainsKey(key)) { var cfgs = new Dictionary <string, ResConfig>(); cfgs.Add(_config.key, _config); resConfigDatas.Add(key, cfgs); } else { var cfgs = resConfigDatas[key]; if (cfgs.ContainsKey(_config.key)) { Debug.LogWarning($"replace config : {key} {_config.key}"); cfgs[_config.key] = _config; } else { //Debug.Log("add config : " + key); cfgs.Add(_config.key, _config); } } }
public void UnloadRes(ResConfig res) { if (!res.isinit) { return; } var type = res.GetType(); var key = res.key; if (resConfigDatas.ContainsKey(type)) { var cfgs = resConfigDatas[type]; if (cfgs.ContainsKey(key)) { cfgs.Remove(key); } } }