GameConfig.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using System.Collections;
  2. using ET;
  3. using LitJson;
  4. using UnityEngine;
  5. namespace GFGGame
  6. {
  7. public class GameConfig
  8. {
  9. public const float LongPressGestureTrigger = 1f;
  10. public static string SOUND_KEY = "sound";
  11. public static string MUSIC_KEY = "music";
  12. public static string VOICE_KEY = "voice";
  13. public static string SOUND_VOLUMN_KEY = "sound_volumn";
  14. public static string MUSIC_VOLUMN_KEY = "music_volumn";
  15. public static string VOICE_VOLUMN_KEY = "voice_volumn";
  16. public static string LoginAddress;
  17. public static string logApiReportUrl;
  18. public static int showGM;
  19. //开服时间
  20. public static long openTime = 0;
  21. public static int tsStatus;
  22. public static int tsServer;
  23. public static void InitData(string json)
  24. {
  25. ET.Log.Debug($"gamecfg \n{json}");
  26. var result = JsonMapper.ToObject<Result>(json);
  27. LoginAddress = result.loginApiUrl;
  28. // LoginAddress = "http://login.gfg.com:10005";
  29. //LoginAddress = "10.108.64.100: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. GameConfig.logApiReportUrl = LauncherConfig.logApiRootUrl + "ReportGet";
  44. }
  45. private struct Result
  46. {
  47. public string loginApiUrl;
  48. public string showGM;
  49. public string openTime;
  50. public string tsStatus;
  51. public string tsServer;
  52. }
  53. }
  54. }