/** * * unlocks the character at a given character index. Returns true if the character was unlocked, * returns false if the character was already unlocked. * */ public static bool unlockCharacter(int characterIndex) { bool alreadyUnlocked = MetaData.unlocks.Contains(characterIndex); if (!alreadyUnlocked) { MetaData.unlocks.Add(characterIndex); GameSaverAndLoader.saveMeta(Game1.selectedSaveSlot); } return(!alreadyUnlocked); }
private bool validateAndSave(int slot) { bool canSave = true; int w = 0; int h = 0; int fs = this.fullscreenOptionsBox.SelectedIndex; string displayError = ""; try { w = int.Parse(this.screenWBox.Text); if (w < 0 || w > 1920) { throw new FormatException(); } } catch (FormatException ex) { Logger.log("Exception when parsing width: " + ex.ToString()); canSave = false; displayError += "\nInvalid selection for screen width."; } try { h = int.Parse(this.screenHBox.Text); if (h < 0 || h > 1080) { throw new FormatException(); } } catch (FormatException ex) { Logger.log("Exception when parsing height: " + ex.ToString()); canSave = false; displayError += "\nInvalid selection for screen height."; } if (difficulty_very_hard.Checked) { MetaData.adaptiveDifficulty = 1; } else { MetaData.adaptiveDifficulty = 0; } if (canSave) { MetaData.screenW = w; MetaData.screenH = h; MetaData.screenSetting = fs; GameSaverAndLoader.saveMeta(slot); } else { MessageBoxButtons buttons = MessageBoxButtons.OK; MessageBox.Show("You put something dumb in one of the option boxes. Try something else?" + displayError, "Invalid launch parameters", buttons); } return(canSave); }