Beispiel #1
0
            public int Alloc(IHleUidPoolClass Item)
            {
                if (Item.GetType() != this.Type)
                {
                    throw(new InvalidOperationException("Trying to insert invalid object type"));
                }
                int Index = -1;

                if (ReuseIds)
                {
                    //Console.Error.WriteLine("******************************************");
                    if (FreedIds.Count > 0)
                    {
                        Index = FreedIds.Min();
                        FreedIds.Remove(Index);
                    }
                }

                if (Index == -1)
                {
                    Index = LastId++;
                }

                Items[Index]   = Item;
                RevItems[Item] = Index;
                return(Index);
            }
Beispiel #2
0
 public static int GetUidIndex(this IHleUidPoolClass IHleUidPoolClass, InjectContext InjectContext)
 {
     return(InjectContext.GetInstance <HleUidPoolManager>()
            .GetOrAllocIndex(IHleUidPoolClass.GetType(), IHleUidPoolClass));
 }
Beispiel #3
0
 public static void RemoveUid(this IHleUidPoolClass IHleUidPoolClass, InjectContext InjectContext)
 {
     InjectContext.GetInstance <HleUidPoolManager>().RemoveItem(IHleUidPoolClass.GetType(), IHleUidPoolClass);
 }