CameraToPose.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using DG.Tweening;
  5. using static GameManager;
  6. using UnityEngine.UI;
  7. using UnityTemplateProjects;
  8. public class CameraToPose : MonoBehaviour
  9. {
  10. public List<GameObject> devItemTypeGoList;
  11. public GameObjectType type;
  12. public TapName tapName;
  13. public Camera cam;
  14. public GameObject go;
  15. public void moveTo()
  16. {
  17. if(go)
  18. {
  19. /*
  20. if(cam.transform.position!=go.transform.position)
  21. cam.transform.DOMove(go.transform.position,1f).OnComplete(()=>{cam.GetComponent<SimpleCameraController>().initpos();});
  22. cam.transform.rotation = go.transform.rotation;
  23. */
  24. go.transform.parent.DOLocalMove(new Vector3(OpenXRCamera.Instance.transform.position.x,-2f,OpenXRCamera.Instance.transform.position.z)-go.transform.localPosition,1f) ;
  25. }
  26. }
  27. public void toggleWindowclick(bool b)
  28. {
  29. if(b)
  30. {
  31. GameManager.Instance.showW(type,tapName);
  32. moveTo();
  33. if(devItemTypeGoList.Count>0&&tapName!=TapName.工业车间总览&&tapName!=TapName.科技车间总览)
  34. {
  35. if(type == GameObjectType.工业车间||type == GameObjectType.科技车间)
  36. {
  37. DeMaDataManager.Instance.GetDeviceType(GameManager.Instance.getID(tapName),(msg)=>{
  38. try
  39. {
  40. for(int i=0;i<msg["data"]["list"].Count;i++)
  41. {
  42. devItemTypeGoList[i].GetComponentInChildren<Text>().text =DeMaDataManager.changedate( msg["data"]["list"][i]["date"].ToString(),4);
  43. devItemTypeGoList[i].GetComponentInChildren<DataTypeManager>().init(msg["data"]["list"][i]);
  44. }
  45. }
  46. catch
  47. {
  48. }
  49. });
  50. }
  51. }
  52. }
  53. }
  54. public void init(GameObjectType type,TapName tapName)
  55. {
  56. this.type =type;
  57. this.tapName =tapName;
  58. }
  59. }