public ETTask <T> FindOneByUniqueIndex <T>(string indexName, T entity) where T : ComponentWithId
        {
            var       type  = typeof(T);
            CacheBase cache = null;

            caches.TryGetValue(type, out cache);
            ETTaskCompletionSource <T>        tcs  = new ETTaskCompletionSource <T>();
            CacheFindOneByUniqueIndexTask <T> task = ComponentFactory.Create <CacheFindOneByUniqueIndexTask <T>, CacheBase, Tuple <string, T>, ETTaskCompletionSource <T> >
                                                         (cache, new Tuple <string, T>(indexName, entity), tcs);

            this.tasks[(int)((ulong)task.Id % taskCount)].Add(task);
            return(tcs.Task);
        }
Esempio n. 2
0
 public override void Awake(CacheFindOneByUniqueIndexTask <ComponentWithId> self, CacheBase proxy, Tuple <string, ComponentWithId> para, ETTaskCompletionSource <ComponentWithId> tcs)
 {
     self.proxy     = proxy;
     self.Tcs       = tcs;
     self.parameter = para;
 }