/// <summary> /// 創造 /// </summary> /// <param name="collectionName"></param> /// <param name="entity"></param> /// <returns></returns> public ETTask <ComponentWithId> Create(string collectionName, ComponentWithId entity) { ETTaskCompletionSource <ComponentWithId> tcs = new ETTaskCompletionSource <ComponentWithId>(); CacheCreateTask cacheCreateTask = ComponentFactory.Create <CacheCreateTask, string, ComponentWithId, ETTaskCompletionSource <ComponentWithId> >(collectionName, entity, tcs); this.tasks[(int)((ulong)cacheCreateTask.Id % taskCount)].Add(cacheCreateTask); return(tcs.Task); }
public ETTask <T> Create <T>(T entity) where T : ComponentWithId { var type = typeof(T); CacheBase cache = null; caches.TryGetValue(type, out cache); ETTaskCompletionSource <T> tcs = new ETTaskCompletionSource <T>(); CacheCreateTask <T> task = ComponentFactory.Create <CacheCreateTask <T>, CacheBase, T, ETTaskCompletionSource <T> >(cache, entity, tcs); this.tasks[(int)((ulong)task.Id % taskCount)].Add(task); return(tcs.Task); }
public override void Awake(CacheCreateTask <ComponentWithId> self, CacheBase proxy, ComponentWithId entity, ETTaskCompletionSource <ComponentWithId> tcs) { self.proxy = proxy; self.Tcs = tcs; self.entity = entity; }
public override void Awake(CacheCreateTask self, string collectionName, ComponentWithId component, ETTaskCompletionSource <ComponentWithId> tcs) { self.Tcs = tcs; self.CollectionName = collectionName; self.Component = component; }