HttpSDKAction.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using LitJson;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using UnityEngine;
  6. using XRTool.Util;
  7. public class HttpSDKAction : Singleton<HttpSDKAction>
  8. {
  9. //原始数据
  10. public string jsonData = "";
  11. //登录
  12. public string loginUrl = "";
  13. //业务逻辑
  14. public string managerUrl = "";
  15. //点云
  16. public string pointCloudUrl = "";
  17. //房间socket
  18. public string roomSocket = "";
  19. //大厅socket
  20. public string officeSocket = "";
  21. public void check(string acc)
  22. {
  23. try
  24. {
  25. if (jsonData != "")
  26. {
  27. Debug.Log("检查是否有白名1单" + jsonData);
  28. JsonData data = JsonMapper.ToObject(jsonData);
  29. Debug.Log("检查是否有白名2单" + data["unity"]["user"].ToJson());
  30. if (data["unity"]["user"]!=null&& data["unity"]["user"].Count>0)
  31. {
  32. Debug.Log("检查是否有白名3单"+acc);
  33. if(data["unity"]["user"].Keys.Contains(acc))
  34. {
  35. HttpSDKAction.Instance.loginUrl = data["unity"]["url"][data["unity"]["user"][acc].ToString()]["login"].ToString();
  36. HttpSDKAction.Instance.managerUrl = data["unity"]["url"][data["unity"]["user"][acc].ToString()]["manager"].ToString();
  37. HttpSDKAction.Instance.officeSocket = data["unity"]["url"][data["unity"]["user"][acc].ToString()]["officeSocket"].ToString();
  38. HttpSDKAction.Instance.pointCloudUrl = data["unity"]["url"][data["unity"]["user"][acc].ToString()]["pointCloud"].ToString();
  39. HttpSDKAction.Instance.roomSocket = data["unity"]["url"][data["unity"]["user"][acc].ToString()]["roomSocket"].ToString();
  40. Debug.Log("检查是否有白名4单" + HttpSDKAction.Instance.loginUrl);
  41. return;
  42. }
  43. }
  44. }
  45. }
  46. catch
  47. {
  48. }
  49. }
  50. }