[M] sync n3

This commit is contained in:
2024-12-09 16:54:19 +08:00
parent c90bbe86e7
commit 05331e6286
845 changed files with 6138 additions and 1307 deletions

View File

@@ -0,0 +1,44 @@
using UnityEngine;
using System.Collections;
using System;
using System.Threading;
namespace ThinkingSDK.PC.Time
{
public class TDTimeout : MonoBehaviour
{
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public static void SetTimeout(int timeout, Action<object> action, object obj)
{
GameObject gameObject = new GameObject("TDTimeout");
var tdTimeout = gameObject.AddComponent<TDTimeout>();
tdTimeout._setTimeout(timeout, action, obj);
}
private void _setTimeout(int timeout, Action<object> action, object obj)
{
StartCoroutine(_wait(timeout, action, obj));
}
private IEnumerator _wait(int timeout, Action<object> action, object obj)
{
yield return new WaitForSeconds(timeout);
if (action != null)
{
action(obj);
}
Destroy(gameObject);
}
}
}