SWHeightUnit.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class SWHeightUnit : MonoBehaviour
  6. {
  7. public Text nameText;
  8. public Text valueText;
  9. public Text dwzValueText;
  10. public GameObject bingObj;
  11. // Start is called before the first frame update
  12. void Start()
  13. {
  14. }
  15. public void Init(string slgtd, string slttd, string na, string upz,string dwz)
  16. {
  17. double lgtd = double.Parse(slgtd);
  18. double lttd = double.Parse(slttd);
  19. Vector3 temp = CoordinateConverter.GeoToUGUI(lgtd, lttd);
  20. nameText.text = na;
  21. float value = 0.0f;
  22. //if(float.TryParse(we,out value))
  23. // valueText.text = value.ToString("0.00");
  24. valueText.text = upz;
  25. dwzValueText.text = dwz;
  26. this.GetComponent<RectTransform>().anchoredPosition3D = temp;
  27. }
  28. // Update is called once per frame
  29. void Update()
  30. {
  31. this.GetComponent<RectTransform>().anchoredPosition = CameraManager.instance.secondCamera.WorldToScreenPoint(bingObj.transform.position) * 1920.0f / Screen.width;
  32. }
  33. }