HttpGetValue.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. using LitJson;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. public class HttpGetValue : MonoBehaviour
  6. {
  7. // Start is called before the first frame update
  8. void Start()
  9. {
  10. HttpTool.Instance.Get("https://fat1.qulivr.com/mr-navigator/v1/", "", (string getInterval) => {
  11. Debug.Log(getInterval);
  12. if (getInterval == null)
  13. Debug.LogError(" HttpTool Get Interval Error!!! ");
  14. JsonData data = JsonMapper.ToObject(getInterval);
  15. Debug.Log(data["code"]);
  16. if ((int)data["code"] == 200)
  17. {
  18. float z = float.Parse(data["defaultLoginZaxis"].ToString());
  19. float y = float.Parse(data["defaultLoginHeight"].ToString());
  20. Debug.Log(z);
  21. transform.position += new Vector3(0, y, z);
  22. }
  23. else
  24. Debug.LogError(" HttpTool Get Interval Error!!! ");
  25. });
  26. }
  27. // Update is called once per frame
  28. void Update()
  29. {
  30. }
  31. }