public ETTask <T> Upsert <T>(T entity) where T : ComponentWithId { var type = typeof(T); CacheBase cache = null; caches.TryGetValue(type, out cache); ETTaskCompletionSource <T> tcs = new ETTaskCompletionSource <T>(); CacheUpsertTask <T> task = ComponentFactory.Create <CacheUpsertTask <T>, CacheBase, T, ETTaskCompletionSource <T> >(cache, entity, tcs); this.tasks[(int)((ulong)task.Id % taskCount)].Add(task); return(tcs.Task); }
public override void Awake(CacheUpsertTask <ComponentWithId> self, CacheBase proxy, ComponentWithId entity, ETTaskCompletionSource <ComponentWithId> tcs) { self.proxy = proxy; self.Tcs = tcs; self.entity = entity; }