using Immersal.AR;
using UnityEngine;
using Blue;
using UnityEngine.UI;
using System.Collections;
using Newtonsoft.Json;
using System.Collections.Generic;
///
/// 控制Immersal定位
///
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(e =>
{
XRLocalizer.enabled = true;
}).UnRegisterWhenGameObjectDestroyed(gameObject);
this.RegisterEvent(e =>
{
if (!AutoERNIEBot.Auto)
{
Y_Location_Toggle.transform.Find("Background").GetComponent().color = white;
Y_Location_Toggle.transform.Find("Background/Checkmark").GetComponent().color = white;
N_Location_Toggle.transform.Find("Background").GetComponent().color = blue;
N_Location_Toggle.transform.Find("Background/Checkmark").GetComponent().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;
}
}