Beispiel #1
0
 public void AnalysisConfig <T>(MAINRESOURCE res) where T : BaseResource
 {
     try
     {
         TextAsset      text   = Resources.Load <TextAsset>(res.url);
         ConfigData <T> config = JsonUtility.FromJson <ConfigData <T> >(text.text);
         _allConfig.Add(res.name.ToUpper(), config);
     }
     catch (Exception e)
     {
         DevDebug.Log(e);
     }
 }
Beispiel #2
0
        /*加载main里面的所有配置*/
        private void _loadConfigs(MAINRESOURCE res)
        {
            Type       T  = Type.GetType(this.GetType().Namespace + "." + res.name.ToUpper());
            MethodInfo mi = this.GetType().GetMethod("AnalysisConfig").MakeGenericMethod(new Type[] { T });

            mi.Invoke(this, new object[1] {
                res
            });

            if (res.register != null && res.register != "")
            {
                _register(res.name, this.GetType().Namespace + "." + res.register);
            }
        }