Beispiel #1
0
 public static void GenerateExposeCfg()
 {
     try
     {
         string    path = AppCfg.CfgPath;
         ExposeCfg cfg  = new ExposeCfg();
         string    json = JsonUtility.ToJson(cfg);
         File.WriteAllText(path, json);
         Application.OpenURL(path);
         Debug.Log(path);
     }
     catch (Exception e)
     {
         Debug.LogError(e.Message);
     }
 }
Beispiel #2
0
 /// <summary>
 /// 初始化配置
 /// </summary>
 void InitAppCfg()
 {
     try
     {
         string    json   = File.ReadAllText(AppCfg.CfgPath);
         ExposeCfg expose = JsonUtility.FromJson <ExposeCfg>(json);
         AppCfg.expose = expose;
         Debug.Log("获取应用配置成功");
     }
     catch (Exception e)
     {
         Debug.LogWarning("获取应用配置失败" + e.Message);
         ExposeCfg cfg  = new ExposeCfg();
         string    json = JsonUtility.ToJson(cfg);
         AppCfg.expose = cfg;
         File.WriteAllText(AppCfg.CfgPath, json);
         Debug.LogWarning(AppCfg.CfgPath);
     }
 }