using System;
using System.Collections.Generic;
using System.Threading;
using UnityEngine;
using Cysharp.Threading.Tasks;
using Rokid.UXR;
using Stary.Evo;
namespace Main
{
public class CancellationTokenCore : MonoBehaviour
{
#region Instance
private static CancellationTokenCore m_Instance;
///
/// Singleton Object
///
public static CancellationTokenCore Instance
{
get
{
if (m_Instance == null)
{
CancellationTokenCore[] ts = GameObject.FindObjectsOfType();
if (ts != null && ts.Length > 0)
{
if (ts.Length == 1)
{
m_Instance = ts[0];
}
else
{
throw new Exception(string.Format(
"## Uni Exception ## Cls:{0} Info:Singleton not allows more than one instance",
typeof(CancellationTokenCore)));
}
}
else
{
m_Instance =
new GameObject(string.Format("{0}(Singleton)", typeof(CancellationTokenCore).ToString()))
.AddComponent();
}
}
return m_Instance;
}
}
#endregion
// 存储 CancellationTokenSource 实例的字典
private readonly Dictionary