示例#1
0
 static void WriteSaveSlots(int[] saveIds)
 {
     for (int i = 0; i < saveIds.Length; i++)
     {
         CurrentParameters.AddOrUpdateValue(string.Format("SaveSlot{0}", i), saveIds[i]);
     }
 }
示例#2
0
        static int[] ReadSaveSlots()
        {
            int[] saveIds = new int[NUMBEROFSAVESLOTS];

            for (int i = 0; i < NUMBEROFSAVESLOTS; i++)
            {
                saveIds[i] = CurrentParameters.GetValueOrDefault(string.Format("SaveSlot{0}", i), -1);
            }

            return(saveIds);
        }
示例#3
0
        // Save game related settings
        public static int GenerateNextGameId()
        {
            if (!HasFreeSaveSlot())
            {
                ErrorLogger.AddDebugText("Can't create new save game");
                return(-1);
            }

            var newGameId = CurrentParameters.GetValueOrDefault("LastGameId", 0);

            newGameId++;
            CurrentParameters.AddOrUpdateValue("LastGameId", newGameId);
            AddSaveGame(newGameId);
            return(newGameId);
        }
示例#4
0
        public int GetNumericValue(string name)
        {
            SecurityParameter parameter = CurrentParameters.FirstOrDefault(i => i.Name == name);

            return(parameter == null ? 0 : parameter.NumericValue);
        }
示例#5
0
        public bool GetBoolValue(string name)
        {
            SecurityParameter parameter = CurrentParameters.FirstOrDefault(i => i.Name == name);

            return(parameter == null ? false : parameter.BoolValue);
        }
示例#6
0
        public string GetValue(string name)
        {
            SecurityParameter parameter = CurrentParameters.FirstOrDefault(i => i.Name == name);

            return(parameter == null ? "" : parameter.Value);
        }
示例#7
0
 // Note, mostly present for testing purposes.
 public static void ClearAllParameters()
 {
     CurrentParameters.Clear();
 }