GameConfig.cs 2.1 KB

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