12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- using Immersal.AR;
- using UnityEngine;
- using Blue;
- using UnityEngine.UI;
- using System.Collections;
- using Newtonsoft.Json;
- using System.Collections.Generic;
- /// <summary>
- /// 控制Immersal定位
- /// </summary>
- public class ImmersalLocalizerController: AbstractController
- {
- private XRLocalizer XRLocalizer =>SceneIOCContainer.Instance.Pull("XRLocalizer")as XRLocalizer;
- private Toggle Y_Location_Toggle =>SceneIOCContainer.Instance.Pull("Y_Location_Toggle")as Toggle;
- private Toggle N_Location_Toggle =>SceneIOCContainer.Instance.Pull("N_Location_Toggle")as Toggle;
- private Color32 blue= new Color32(0, 120, 255, 255);
- private Color32 white= new Color32(255, 255, 255, 255);
- private void Awake()
- {
- this.RegisterEvent<StartImmersalLocalizerEvent>(e =>
- {
- XRLocalizer.enabled = true;
- }).UnRegisterWhenGameObjectDestroyed(gameObject);
- this.RegisterEvent<SuccessImmersalLocalizerEvent>(e =>
- {
- if (!AutoERNIEBot.Auto)
- {
- Y_Location_Toggle.transform.Find("Background").GetComponent<Image>().color = white;
- Y_Location_Toggle.transform.Find("Background/Checkmark").GetComponent<Image>().color = white;
- N_Location_Toggle.transform.Find("Background").GetComponent<Image>().color = blue;
- N_Location_Toggle.transform.Find("Background/Checkmark").GetComponent<Image>().color = blue;
- StartCoroutine(XRLocalizerActive());
- InstantiateCommand Command = new InstantiateCommand(
- InstantiateSystem.Instance.BlueObject.NormalPopUp,
- "定位成功");
- this.SendCommand(Command);
- }
- }).UnRegisterWhenGameObjectDestroyed(gameObject);
- }
- private IEnumerator XRLocalizerActive()
- {
- yield return new WaitForSeconds(0.01f);
- XRLocalizer.enabled = false;
- }
- }
|