GameConfig.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. #endif
  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. GameConfig.logApiReportUrl = LauncherConfig.logApiRootUrl + "ReportGet";
  50. }
  51. private struct Result
  52. {
  53. public string loginApiUrl;
  54. public string showGM;
  55. public string openTime;
  56. public string tsStatus;
  57. public string tsServer;
  58. public string hCode;
  59. public string serverStatus;
  60. public string statusPrompt;
  61. }
  62. }
  63. }