static void WriteSaveSlots(int[] saveIds) { for (int i = 0; i < saveIds.Length; i++) { CurrentParameters.AddOrUpdateValue(string.Format("SaveSlot{0}", i), saveIds[i]); } }
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); }
// 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); }
public int GetNumericValue(string name) { SecurityParameter parameter = CurrentParameters.FirstOrDefault(i => i.Name == name); return(parameter == null ? 0 : parameter.NumericValue); }
public bool GetBoolValue(string name) { SecurityParameter parameter = CurrentParameters.FirstOrDefault(i => i.Name == name); return(parameter == null ? false : parameter.BoolValue); }
public string GetValue(string name) { SecurityParameter parameter = CurrentParameters.FirstOrDefault(i => i.Name == name); return(parameter == null ? "" : parameter.Value); }
// Note, mostly present for testing purposes. public static void ClearAllParameters() { CurrentParameters.Clear(); }