GameConfig.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 PlatformName;
  18. public static string logApiReportUrl;
  19. public static int showGM;
  20. //开服时间
  21. public static long openTime = 0;
  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 = "127.0.0.1:10005";//测试地址
  29. PlatformName = result.platformName;
  30. showGM = int.Parse(result.showGM);
  31. if(!string.IsNullOrEmpty(result.openTime))
  32. {
  33. openTime = TimeUtil.GetTimestamp(result.openTime);
  34. }
  35. GameConfig.logApiReportUrl = LauncherConfig.logApiRootUrl + "ReportGet";
  36. }
  37. private struct Result
  38. {
  39. public string loginApiUrl;
  40. public string platformName;
  41. public string showGM;
  42. public string openTime;
  43. }
  44. }
  45. }