/****************************************************************************
* Copyright 2019 Nreal Techonology Limited. All rights reserved.
*
* This file is part of NRSDK.
*
* https://www.nreal.ai/
*
*****************************************************************************/
namespace NRKernal
{
using System;
using UnityEngine;
using UnityEngine.UI;
/// A nr glasses initialize error tip.
public class NRGlassesInitErrorTip : MonoBehaviour
{
/// Event queue for all listeners interested in OnPreComfirm events.
public static event Action OnPreComfirm;
/// Event queue for all listeners interested in OnConfirm events.
public event Action OnConfirm;
/// The confirm control.
public Button m_ConfirmBtn;
/// The tips.
public Text m_Tips;
/// Initializes this object.
/// The message.
/// The confirm.
public virtual void Init(string msg, Action confirm)
{
m_Tips.text = msg;
OnConfirm += confirm;
m_ConfirmBtn.onClick.AddListener(() =>
{
OnConfirm?.Invoke();
});
Invoke("AutoConfirm", 5f);
}
/// Starts this object.
private void Start()
{
var inputmodule = GameObject.FindObjectOfType();
if (inputmodule != null)
{
GameObject.Destroy(inputmodule.gameObject);
}
OnPreComfirm?.Invoke();
}
/// Automatic confirm.
private void AutoConfirm()
{
OnConfirm?.Invoke();
}
}
}