CommonMethod.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. using LitJson;
  2. using SUIFW;
  3. using System;
  4. using System.Collections;
  5. using System.Collections.Generic;
  6. using UnityEngine;
  7. using UnityEngine.SceneManagement;
  8. namespace XRTool.Util
  9. {
  10. /// <summary>
  11. /// 通用方法
  12. /// </summary>
  13. public static class CommonMethod
  14. {
  15. public static GameObject TusiObj;
  16. public static string tempToken;
  17. public static GameObject Loading;
  18. public static GameObject ScanEffect;
  19. public static List<int> scenes = new List<int>();
  20. public static int currentScene;
  21. public static string selfHomepeerId;
  22. public static string roomPassWord;
  23. public static bool IsReceive;
  24. /// <summary>
  25. /// 获取当前本地时间戳
  26. /// </summary>
  27. /// <returns></returns>
  28. public static long GetCurrentTimeUnix()
  29. {
  30. TimeSpan cha = (DateTime.Now - TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)));
  31. long t = (long)cha.TotalSeconds;
  32. return t;
  33. }
  34. public static void HideLoading()
  35. {
  36. UIMaskMgr.GetInstance().HideMask();
  37. }
  38. public static Queue<string> queueList =new Queue<string>();
  39. public static void ShowNetLoading(string str,string message)
  40. {
  41. if (queueList.Count <= 0)
  42. {
  43. UIMaskMgr.GetInstance().ShowMask();
  44. }
  45. queueList.Enqueue(str);
  46. }
  47. public static void HideNetLoading(string str)
  48. {
  49. if (queueList.Count > 0)
  50. {
  51. queueList.Dequeue();
  52. if (queueList.Count <= 0)
  53. {
  54. UIMaskMgr.GetInstance().HideMask();
  55. }
  56. }
  57. }
  58. }
  59. }