Exemplo n.º 1
0
            private EnumValueEnumerator(EnumArray <TEnum, TValue> array, int from, int to)
            {
                if (StaticLength == 0)
                {
                    elements = null;
                    iStart   = iEnd = iCurrent = -1;
                }
                else
                {
                    from = Mathf.Clamp(from, 0, StaticLength - 1);
                    to   = Mathf.Clamp(to, 0, StaticLength - 1);

                    if (from <= to)
                    {
                        iStart = iCurrent = from - 1;
                        iEnd   = to;
                    }
                    else
                    {
                        iStart = iCurrent = from + 1;
                        iEnd   = to;
                    }

                    array.FillCapacityToLength();
                    elements = array.elements;
                }
            }
Exemplo n.º 2
0
 public void CopyFrom(EnumArray <TEnum, TValue> source)
 {
     if (ReferenceEquals(this, source))
     {
         return;
     }
     FillCapacityToLength();
     source.FillCapacityToLength();
     Array.Copy(source.elements, 0, elements, 0, StaticLength);
 }
Exemplo n.º 3
0
 public static EnumValueEnumerator FromTo(EnumArray <TEnum, TValue> array, TEnum from, TEnum to)
 {
     return(new EnumValueEnumerator(array, E2I(from) - StaticMinInt, E2I(to) - StaticMinInt));
 }
Exemplo n.º 4
0
            public static EnumValueEnumerator From(EnumArray <TEnum, TValue> array, TEnum from)
            {
                var ifrom = E2I(from) - StaticMinInt;

                return(new EnumValueEnumerator(array, ifrom, Mathf.Max(ifrom, StaticLength - 1)));
            }
Exemplo n.º 5
0
 public static EnumValueEnumerator All(EnumArray <TEnum, TValue> array)
 {
     return(new EnumValueEnumerator(array, 0, StaticLength - 1));
 }
Exemplo n.º 6
0
 public ReadOnlyEnumArray(EnumArray <TEnum, TValue> source)
 {
     this.source = source;
 }
Exemplo n.º 7
0
 public static void Copy(EnumArray <TEnum, TValue> srcArray, int srcEnumValueIndex, EnumArray <TEnum, TValue> dstArray, int dstEnumValueIndex, int length)
 {
     srcArray.FillCapacityToLength();
     dstArray.FillCapacityToLength();
     Array.Copy(srcArray.elements, srcEnumValueIndex - StaticMinInt, dstArray.elements, dstEnumValueIndex - StaticMinInt, length);
 }
Exemplo n.º 8
0
 public static void Copy(EnumArray <TEnum, TValue> srcArray, TEnum srcEnumIndex, EnumArray <TEnum, TValue> dstArray, TEnum dstEnumIndex, int length)
 {
     Copy(srcArray, E2I(srcEnumIndex), dstArray, E2I(dstEnumIndex), length);
 }