GameConfig.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. 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 = "43.139.184.240:10003";
  28. //LoginAddress = "192.168.1.7:10005";//测试地址
  29. #if !GFGZSB
  30. LoginAddress = "192.168.1.191:10005";//测试地址
  31. //LoginAddress = "43.139.184.240:10003";
  32. #endif
  33. showGM = int.Parse(result.showGM);
  34. if(!string.IsNullOrEmpty(result.openTime))
  35. {
  36. openTime = TimeUtil.GetTimestamp(result.openTime);
  37. }
  38. if(!string.IsNullOrEmpty(result.tsStatus))
  39. {
  40. tsStatus = int.Parse(result.tsStatus);
  41. }
  42. if (!string.IsNullOrEmpty(result.tsServer))
  43. {
  44. tsServer = int.Parse(result.tsServer);
  45. }
  46. if(!string.IsNullOrEmpty(result.hCode))
  47. {
  48. hCode = int.Parse(result.hCode);
  49. }
  50. GameConfig.logApiReportUrl = LauncherConfig.logApiRootUrl + "ReportGet";
  51. }
  52. private struct Result
  53. {
  54. public string loginApiUrl;
  55. public string showGM;
  56. public string openTime;
  57. public string tsStatus;
  58. public string tsServer;
  59. public string hCode;
  60. public string serverStatus;
  61. public string statusPrompt;
  62. }
  63. }
  64. }