using Fort23.Core; namespace Fort23.UTool { /// /// 协程锁 /// public class CoroutineLock : Entity { public long key; public int count; public bool isTimeout; public string keyName; [CustomMethod(CustomMethodType.Awake)] public void Awake( long k,string keyName, int count) { this.keyName = keyName; this.key = k; this.count = count; } [CustomMethod(CustomMethodType.Destroy)] public void Destroy() { if (!this.isTimeout) { CoroutineLockComponent.Instance.Notify(this.key, keyName,this.count + 1); } else { LogTool.Error($"coroutine lock timeout: {this.keyName} {this.count}"); } this.key = 0; this.count = 0; } } public struct CoroutineLockTimer { public CTask tcs; /// /// 持续时间 /// public int duration; public string keyName; } }