SWHeightUnit.cs 941 B

123456789101112131415161718192021222324252627282930313233
  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 GameObject bingObj;
  10. // Start is called before the first frame update
  11. void Start()
  12. {
  13. }
  14. public void Init(double lgtd, double lttd, string na, string we)
  15. {
  16. Vector3 temp = CoordinateConverter.GeoToUGUI(lgtd, lttd);
  17. nameText.text = na;
  18. float value = 0.0f;
  19. if(float.TryParse(we,out value))
  20. valueText.text = value.ToString("0.00");
  21. this.GetComponent<RectTransform>().anchoredPosition3D = temp;
  22. }
  23. // Update is called once per frame
  24. void Update()
  25. {
  26. this.GetComponent<RectTransform>().anchoredPosition = CameraManager.instance.secondCamera.WorldToScreenPoint(bingObj.transform.position) * 1920.0f / Screen.width;
  27. }
  28. }