public string Run <T1, T2>(CoroutineAction <T1, T2> action, T1 t1, T2 t2) { CoroutineEnumerator c = (CoroutineEnumerator)Main.referencePoolManager.OnSpwn <CoroutineEnumerator>(); c.Fill(action, new object[] { t1, t2 }); c.Run(); if (!coroutineEnumerators.ContainsKey(c.id)) { coroutineEnumerators.Add(c.id, c); } Addwarehouse(c); return(c.id); }
//这里的CoroutineAction只是委托,只需要将方法名填入形参即可,而不是协程方法 public string Run(CoroutineAction action) { CoroutineEnumerator c = (CoroutineEnumerator)Main.referencePoolManager.OnSpwn <CoroutineEnumerator>(); c.Fill(action, null); c.Run(); if (!coroutineEnumerators.ContainsKey(c.id)) { coroutineEnumerators.Add(c.id, c); } Addwarehouse(c); return(c.id); }