Пример #1
0
    private void RefreshKeys()
    {
        switch (chosenDataType)
        {
        case DataType.All:
        {
            var intKeys    = gameSaves.GetIntKeys();
            var boolKeys   = gameSaves.GetBoolKeys();
            var stringKeys = gameSaves.GetStringKeys();
            var floatKeys  = gameSaves.GetFloatKeys();
            var objectKeys = gameSaves.GetObjectKeys();

            keys = new string[intKeys.Count + boolKeys.Count + floatKeys.Count + stringKeys.Count + objectKeys.Count];

            var current = 0;

            //All
            keyTypeCounts[0] = 0;

            //Ints
            keyTypeCounts[1] = current;
            intKeys.CopyTo(keys, current);
            current += intKeys.Count;

            //Bools
            keyTypeCounts[2] = current;
            boolKeys.CopyTo(keys, current);
            current += boolKeys.Count;

            //Floats
            keyTypeCounts[3] = current;
            floatKeys.CopyTo(keys, current);
            current += floatKeys.Count;

            //Strings
            keyTypeCounts[4] = current;
            stringKeys.CopyTo(keys, current);
            current += stringKeys.Count;

            //Objects
            keyTypeCounts[5] = current;
            objectKeys.CopyTo(keys, current);
            break;
        }

        case DataType.Int:
        {
            var newKeys = gameSaves.GetIntKeys();
            keys = new string[newKeys.Count];
            newKeys.CopyTo(keys, 0);
            break;
        }

        case DataType.Float:
        {
            var newKeys = gameSaves.GetFloatKeys();
            keys = new string[newKeys.Count];
            newKeys.CopyTo(keys, 0);
            break;
        }

        case DataType.String:
        {
            var newKeys = gameSaves.GetStringKeys();
            keys = new string[newKeys.Count];
            newKeys.CopyTo(keys, 0);
            break;
        }

        case DataType.Object:
        {
            var newKeys = gameSaves.GetObjectKeys();
            keys = new string[newKeys.Count];
            newKeys.CopyTo(keys, 0);
            break;
        }

        case DataType.Bool:
        {
            var newKeys = gameSaves.GetBoolKeys();
            keys = new string[newKeys.Count];
            newKeys.CopyTo(keys, 0);
            break;
        }

        default:
            break;
        }
    }