示例#1
0
 protected void ReadConf(string conf_path)
 {
     try
     {
         conf = JSON.ReadConfig <AbilityConf>(Application.streamingAssetsPath + conf_path);
     }
     catch (Exception ex)
     {
         Debug.LogError("Can't read ability config. " + ex.Message);
     }
 }
示例#2
0
        public static object GetFromConf(AbilityConf conf, object[] constructor_params)
        {
            Type type = Type.GetType("game." + conf.name);

            if (type != null)
            {
                var instance = Activator.CreateInstance(type, constructor_params);
                return(instance);
            }
            return(null);
        }