GameConfig.cs 2.2 KB

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