using Blue; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; public class HeadBtnManager : MonoSingleton, IController { /* * 1. 当1级页面消失后 ,在这连显示 重置按钮 和主界面 * 2. 点击重置按钮的时候,当前UI消失,将1级页面显示出来 * 3. 返回Home页面的时候 当前UI消失,并且关闭1级页面 * * 存储各类重置按钮 */ public Button homeBtn; public Button dhBtn; public Button rtcBtn; public Button homeBtn2; public Toggle hideBtn; // public Button public UIFollow uiFollow; private Transform player; private IQueueSystem mQueueSystem; public ScenesManager.SceneType type; private void Start() { dhBtn.onClick.AddListener(() => { Hide(); if (uiFollow != null) uiFollow.Show(transform.position); }); rtcBtn.onClick.AddListener(() => { Hide(); if (uiFollow != null) uiFollow.Show(rtcBtn.transform.position); }); player = new GameObject("Player").transform; Hide(); mQueueSystem = this.GetService(); hideBtn.onValueChanged.AddListener((state) => { HideL3(state); }); homeBtn.onClick.AddListener(GoHome); homeBtn2.onClick.AddListener(GoHome); } public UnityEvent OnReset = new UnityEvent(); private void Update() { OnReset?.Invoke(); /* player.position =OpenXRCamera.Instance.head.transform.position; player.eulerAngles = new Vector3(0,OpenXRCamera.Instance.head.transform.eulerAngles.y, 0); transform.position = OpenXRCamera.Instance.head.position + player.transform.forward * 1.5f + new Vector3(0f, 0f, 0.1f); transform.eulerAngles = player.eulerAngles; */ } public void ShowResetBtn(ScenesManager.SceneType type , UIFollow uiFollow) { this.type = type; this.uiFollow = uiFollow; switch (type) { case ScenesManager.SceneType.GameStartLogo: break; case ScenesManager.SceneType.ShowLogin: break; case ScenesManager.SceneType.ShowChoose: break; case ScenesManager.SceneType.ShowXunJian: break; case ScenesManager.SceneType.ShowXJ: break; case ScenesManager.SceneType.ShowDH: homeBtn.gameObject.SetActive(true); dhBtn.gameObject.SetActive(true); break; case ScenesManager.SceneType.ShowRTC: rtcBtn.gameObject.SetActive(true); break; case ScenesManager.SceneType.ShowRTCHistory: rtcBtn.gameObject.SetActive(true); homeBtn2.gameObject.SetActive(true); break; case ScenesManager.SceneType.ShowDevice: break; case ScenesManager.SceneType.ShowBasicDevice: break; default: break; } } private void Hide() { homeBtn.gameObject.SetActive(false); dhBtn.gameObject.SetActive(false); rtcBtn.gameObject.SetActive(false); homeBtn2.gameObject.SetActive(false); } public void HideL3( bool on) { foreach (var go in mQueueSystem.Level3List) { go.SetActive(!on); } } public void GoHome() { Debug.LogError("GoHome"); if(BladeServerManager.Instance.foundItem!=null) BladeServerManager.Instance.foundItem.gameObject.SetActive(false); if(ShowDeviceControle.Instance!=null && ShowDeviceControle.Instance.DeviceDetailsControl!=null) ShowDeviceControle.Instance.DeviceDetailsControl.gameObject.SetActive(false); ScenesManager.Instance.showWindow(ScenesManager.SceneType.ShowChoose); BladeServerManager.Instance.isDaoHang = false; WayFindingManager.Instance.CloseWayFind(); this.uiFollow = null; Hide(); } }