/// <summary>
        /// Creates an Indexed Dictionary
        /// </summary>
        /// <param name="capacity">The starting capacity</param>
        /// <param name="comparer">The equality comparer to use for keys</param>
        public IndexedDictionary(int capacity, IEqualityComparer <TKey>?comparer)
        {
            if (capacity < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(capacity));
            }

            Comparer = comparer ?? EqualityComparer <TKey> .Default;

            if (capacity == 0)
            {
                _Buckets = Empty.Array <int>();
                _Entries = Empty.Array <Entry>();
            }
            else
            {
                _Buckets = new int[capacity];
                _Entries = new Entry[capacity];
            }

            Keys   = new IndexedKeys(this);
            Values = new IndexedValues(this);
        }
예제 #2
0
 public static bool isIndexedKeyDown(IPlayer player, IndexedKeys key)
 {
     return(iHandler.kbs.isKeyDown(wasdIndices[player.PlayerIndex, (int)key]));
 }