GameConfig.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System.Collections;
  2. using ET;
  3. using LitJson;
  4. using UnityEngine;
  5. namespace GFGGame
  6. {
  7. public class GameConfig
  8. {
  9. public const float LongPressGestureTrigger = 1f;
  10. public static string SOUND_KEY = "sound";
  11. public static string MUSIC_KEY = "music";
  12. public static string VOICE_KEY = "voice";
  13. public static string SOUND_VOLUMN_KEY = "sound_volumn";
  14. public static string MUSIC_VOLUMN_KEY = "music_volumn";
  15. public static string VOICE_VOLUMN_KEY = "voice_volumn";
  16. public static string LoginAddress;
  17. public static string logApiReportUrl;
  18. public static int showGM;
  19. //开服时间
  20. public static long openTime = 0;
  21. public static int tiShen;
  22. public static void InitData(string json)
  23. {
  24. ET.Log.Debug($"gamecfg \n{json}");
  25. var result = JsonMapper.ToObject<Result>(json);
  26. LoginAddress = result.loginApiUrl;
  27. // LoginAddress = "http://login.gfg.com:10005";
  28. //LoginAddress = "127.0.0.1:10005";//测试地址
  29. showGM = int.Parse(result.showGM);
  30. if(!string.IsNullOrEmpty(result.openTime))
  31. {
  32. openTime = TimeUtil.GetTimestamp(result.openTime);
  33. }
  34. if(!string.IsNullOrEmpty(result.tiShen))
  35. {
  36. tiShen = int.Parse(result.tiShen);
  37. }
  38. GameConfig.logApiReportUrl = LauncherConfig.logApiRootUrl + "ReportGet";
  39. }
  40. private struct Result
  41. {
  42. public string loginApiUrl;
  43. public string showGM;
  44. public string openTime;
  45. public string tiShen;
  46. }
  47. }
  48. }