ShowDeviceControle.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. using UnityEngine;
  2. using Blue;
  3. using GHZLangChao;
  4. public class ShowDeviceControle : SingletonMonobehaviour<ShowDeviceControle>,IController
  5. {
  6. public void Awake()
  7. {
  8. this.RegisterEvent<DeviceDetailsUpdataDataEvent>(e=>
  9. {
  10. if(DeviceDetailsControl==null)
  11. {
  12. GameObject go = Instantiate(InstantiateSystem.Instance.BlueObject.ShowDeviceControle, GameStart.Instance.transform.parent);
  13. DeviceDetailsControl = go.GetComponent<DeviceDetailsControl>();
  14. }
  15. DeviceDetailsControl.gameObject.SetActive(true);
  16. // 更新数据
  17. DeviceDetailsControl.UpdateData(e.DeviceParameter,e.item);
  18. // 更新位置
  19. DeviceDetailsControl.transform.position = new Vector3(
  20. e.currentPos.transform.position.x,
  21. 0.95f,
  22. e.currentPos.transform.position.z);
  23. // 更新位置
  24. DeviceDetailsControl.transform.eulerAngles = new Vector3(
  25. 0,
  26. e.currentPos.transform.eulerAngles.y,
  27. 0);
  28. }).UnRegisterWhenGameObjectDestroyed(gameObject);
  29. }
  30. public DeviceDetailsControl DeviceDetailsControl = null;
  31. }