GameConfig.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 code;
  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 = "http://login.gfg.com:10005";
  28. //LoginAddress = "10.108.64.100:10005";//测试地址
  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.code))
  43. {
  44. code = int.Parse(result.code);
  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 code;
  56. }
  57. }
  58. }