GameConfig.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using LitJson;
  2. namespace GFGGame
  3. {
  4. public class GameConfig
  5. {
  6. public const float LongPressGestureTrigger = 1f;
  7. public static string SOUND_KEY = "sound";
  8. public static string MUSIC_KEY = "music";
  9. public static string VOICE_KEY = "voice";
  10. public static string SOUND_VOLUMN_KEY = "sound_volumn";
  11. public static string MUSIC_VOLUMN_KEY = "music_volumn";
  12. public static string VOICE_VOLUMN_KEY = "voice_volumn";
  13. public static string LoginAddress;
  14. public static string logApiReportUrl;
  15. public static int showGM;
  16. //开服时间
  17. public static long openTime = 0;
  18. public static int tsStatus;
  19. public static int tsServer;
  20. //兑换码
  21. public static int hCode;
  22. //0 正常,1 维护中
  23. public static int serverStatus;
  24. public static string statusPrompt;
  25. public static void InitData(string json)
  26. {
  27. ET.Log.Debug($"gamecfg \n{json}");
  28. var result = JsonMapper.ToObject<Result>(json);
  29. LoginAddress = result.loginApiUrl;
  30. // LoginAddress = "http://login.gfg.com:10005";
  31. //LoginAddress = "10.108.64.100:10005";//测试地址
  32. showGM = int.Parse(result.showGM);
  33. if(!string.IsNullOrEmpty(result.openTime))
  34. {
  35. openTime = TimeUtil.GetTimestamp(result.openTime);
  36. }
  37. if(!string.IsNullOrEmpty(result.tsStatus))
  38. {
  39. tsStatus = int.Parse(result.tsStatus);
  40. }
  41. if (!string.IsNullOrEmpty(result.tsServer))
  42. {
  43. tsServer = int.Parse(result.tsServer);
  44. }
  45. if(!string.IsNullOrEmpty(result.hCode))
  46. {
  47. hCode = int.Parse(result.hCode);
  48. }
  49. if (!string.IsNullOrEmpty(result.serverStatus))
  50. {
  51. serverStatus = int.Parse(result.serverStatus);
  52. }
  53. statusPrompt = result.statusPrompt;
  54. GameConfig.logApiReportUrl = LauncherConfig.logApiRootUrl + "ReportGet";
  55. }
  56. private struct Result
  57. {
  58. public string loginApiUrl;
  59. public string showGM;
  60. public string openTime;
  61. public string tsStatus;
  62. public string tsServer;
  63. public string hCode;
  64. public string serverStatus;
  65. public string statusPrompt;
  66. }
  67. }
  68. }