public bool Equals(ModOptions options) { if (AllowExperienceBarToFadeOut == options.AllowExperienceBarToFadeOut && ShowExperienceBar == options.ShowExperienceBar && ShowExperienceGain == options.ShowExperienceGain && ShowLevelUpAnimation == options.ShowLevelUpAnimation && ShowHeartFills == options.ShowHeartFills && ShowExtraItemInformation == options.ShowExtraItemInformation && ShowLocationOfTownsPeople == options.ShowLocationOfTownsPeople && ShowLuckIcon == options.ShowLuckIcon && ShowTravelingMerchant == options.ShowTravelingMerchant && ShowRainyDay == options.ShowRainyDay && ShowLocationOfTownsPeopleShowQuestIcon == options.ShowLocationOfTownsPeopleShowQuestIcon && ShowCropAndBarrelTooltip == options.ShowCropAndBarrelTooltip && ShowBirthdayIcon == options.ShowBirthdayIcon && ShowAnimalsNeedPets == options.ShowAnimalsNeedPets && HideAnimalPetOnMaxFriendship == options.HideAnimalPetOnMaxFriendship && ShowItemEffectRanges == options.ShowItemEffectRanges && ShowItemsRequiredForBundles == options.ShowItemsRequiredForBundles && ShowHarvestPricesInShop == options.ShowHarvestPricesInShop && DisplayCalendarAndBillboard == options.DisplayCalendarAndBillboard && ShowWhenNewRecipesAreAvailable == options.ShowWhenNewRecipesAreAvailable && ShowToolUpgradeStatus == options.ShowToolUpgradeStatus && HideMerchantWhenVisited == options.HideMerchantWhenVisited && ShowExactValue == options.ShowExactValue && ShowRobinBuildingStatusIcon == options.ShowRobinBuildingStatusIcon && ShowTodaysGifts == options.ShowTodaysGifts && OpenCalendarKeybind == options.OpenCalendarKeybind && OpenQuestBoardKeybind == options.OpenQuestBoardKeybind) { if (ShowLocationOfFriends.Count != options.ShowLocationOfFriends.Count) { return(false); } if (ShowLocationOfFriends.Keys.Except(options.ShowLocationOfFriends.Keys).Any()) { return(false); } if (options.ShowLocationOfFriends.Keys.Except(ShowLocationOfFriends.Keys).Any()) { return(false); } foreach (var pair in ShowLocationOfFriends) { if (pair.Value != options.ShowLocationOfFriends[pair.Key]) { return(false); } } return(true); } return(false); }
public ModOptionsPageHandler(IModHelper helper, ModOptions _options, bool showPersonalConfigButton) { if (showPersonalConfigButton) { helper.Events.Display.MenuChanged += ToggleModOptions; } _helper = helper; _showPersonalConfigButton = showPersonalConfigButton; _luckOfDay = new LuckOfDay(helper); _showBirthdayIcon = new ShowBirthdayIcon(helper); _showAccurateHearts = new ShowAccurateHearts(helper.Events); _locationOfTownsfolk = new LocationOfTownsfolk(helper, _options); _showWhenAnimalNeedsPet = new ShowWhenAnimalNeedsPet(helper); _showCalendarAndBillboardOnGameMenuButton = new ShowCalendarAndBillboardOnGameMenuButton(helper); _showScarecrowAndSprinklerRange = new ShowItemEffectRanges(helper); _experienceBar = new ExperienceBar(helper); _showItemHoverInformation = new ShowItemHoverInformation(helper.Events); _shopHarvestPrices = new ShopHarvestPrices(helper); _showQueenOfSauceIcon = new ShowQueenOfSauceIcon(helper); _showTravelingMerchant = new ShowTravelingMerchant(helper); _showRainyDayIcon = new ShowRainyDayIcon(helper); _showCropAndBarrelTime = new ShowCropAndBarrelTime(helper); _showToolUpgradeStatus = new ShowToolUpgradeStatus(helper); _showRobinBuildingStatusIcon = new ShowRobinBuildingStatusIcon(helper); _showTodaysGift = new ShowTodaysGifts(helper); _elementsToDispose = new List <IDisposable>() { _luckOfDay, _showBirthdayIcon, _showAccurateHearts, _locationOfTownsfolk, _showWhenAnimalNeedsPet, _showCalendarAndBillboardOnGameMenuButton, _showCropAndBarrelTime, _experienceBar, _showItemHoverInformation, _showTravelingMerchant, _showRainyDayIcon, _shopHarvestPrices, _showQueenOfSauceIcon, _showToolUpgradeStatus, _showRobinBuildingStatusIcon }; int whichOption = 1; Version thisVersion = Assembly.GetAssembly(this.GetType()).GetName().Version; _optionsElements.Add(new ModOptionsElement("UI Info Suite 2 v" + thisVersion.Major + "." + thisVersion.Minor + "." + thisVersion.Build)); var luckIcon = new ModOptionsCheckbox(_helper.SafeGetString(nameof(_options.ShowLuckIcon)), whichOption++, _luckOfDay.ToggleOption, () => _options.ShowLuckIcon, v => _options.ShowLuckIcon = v); _optionsElements.Add(luckIcon); _optionsElements.Add(new ModOptionsCheckbox(_helper.SafeGetString(nameof(_options.ShowExactValue)), whichOption++, _luckOfDay.ToggleShowExactValueOption, () => _options.ShowExactValue, v => _options.ShowExactValue = v, luckIcon)); _optionsElements.Add(new ModOptionsCheckbox(_helper.SafeGetString(nameof(_options.ShowLevelUpAnimation)), whichOption++, _experienceBar.ToggleLevelUpAnimation, () => _options.ShowLevelUpAnimation, v => _options.ShowLevelUpAnimation = v)); _optionsElements.Add(new ModOptionsCheckbox(_helper.SafeGetString(nameof(_options.ShowExperienceBar)), whichOption++, _experienceBar.ToggleShowExperienceBar, () => _options.ShowExperienceBar, v => _options.ShowExperienceBar = v)); _optionsElements.Add(new ModOptionsCheckbox(_helper.SafeGetString(nameof(_options.AllowExperienceBarToFadeOut)), whichOption++, _experienceBar.ToggleExperienceBarFade, () => _options.AllowExperienceBarToFadeOut, v => _options.AllowExperienceBarToFadeOut = v)); _optionsElements.Add(new ModOptionsCheckbox(_helper.SafeGetString(nameof(_options.ShowExperienceGain)), whichOption++, _experienceBar.ToggleShowExperienceGain, () => _options.ShowExperienceGain, v => _options.ShowExperienceGain = v)); if (!_helper.ModRegistry.IsLoaded("Bouhm.NPCMapLocations")) { _optionsElements.Add(new ModOptionsCheckbox(_helper.SafeGetString(nameof(_options.ShowLocationOfTownsPeople)), whichOption++, _locationOfTownsfolk.ToggleShowNPCLocationsOnMap, () => _options.ShowLocationOfTownsPeople, v => _options.ShowLocationOfTownsPeople = v)); } _optionsElements.Add(new ModOptionsCheckbox(_helper.SafeGetString(nameof(_options.ShowBirthdayIcon)), whichOption++, _showBirthdayIcon.ToggleOption, () => _options.ShowBirthdayIcon, v => _options.ShowBirthdayIcon = v)); _optionsElements.Add(new ModOptionsCheckbox(_helper.SafeGetString(nameof(_options.ShowHeartFills)), whichOption++, _showAccurateHearts.ToggleOption, () => _options.ShowHeartFills, v => _options.ShowHeartFills = v)); var animalPetIcon = new ModOptionsCheckbox(_helper.SafeGetString(nameof(_options.ShowAnimalsNeedPets)), whichOption++, _showWhenAnimalNeedsPet.ToggleOption, () => _options.ShowAnimalsNeedPets, v => _options.ShowAnimalsNeedPets = v); _optionsElements.Add(animalPetIcon); _optionsElements.Add(new ModOptionsCheckbox(_helper.SafeGetString(nameof(_options.HideAnimalPetOnMaxFriendship)), whichOption++, _showWhenAnimalNeedsPet.ToggleDisableOnMaxFirendshipOption, () => _options.HideAnimalPetOnMaxFriendship, v => _options.HideAnimalPetOnMaxFriendship = v, animalPetIcon)); _optionsElements.Add(new ModOptionsCheckbox(_helper.SafeGetString(nameof(_options.DisplayCalendarAndBillboard)), whichOption++, _showCalendarAndBillboardOnGameMenuButton.ToggleOption, () => _options.DisplayCalendarAndBillboard, v => _options.DisplayCalendarAndBillboard = v)); _optionsElements.Add(new ModOptionsCheckbox(_helper.SafeGetString(nameof(_options.ShowCropAndBarrelTooltip)), whichOption++, _showCropAndBarrelTime.ToggleOption, () => _options.ShowCropAndBarrelTooltip, v => _options.ShowCropAndBarrelTooltip = v)); _optionsElements.Add(new ModOptionsCheckbox(_helper.SafeGetString(nameof(_options.ShowItemEffectRanges)), whichOption++, _showScarecrowAndSprinklerRange.ToggleOption, () => _options.ShowItemEffectRanges, v => _options.ShowItemEffectRanges = v)); _optionsElements.Add(new ModOptionsCheckbox(_helper.SafeGetString(nameof(_options.ShowExtraItemInformation)), whichOption++, _showItemHoverInformation.ToggleOption, () => _options.ShowExtraItemInformation, v => _options.ShowExtraItemInformation = v)); var travellingMerchantIcon = new ModOptionsCheckbox(_helper.SafeGetString(nameof(_options.ShowTravelingMerchant)), whichOption++, _showTravelingMerchant.ToggleOption, () => _options.ShowTravelingMerchant, v => _options.ShowTravelingMerchant = v); _optionsElements.Add(travellingMerchantIcon); _optionsElements.Add(new ModOptionsCheckbox(_helper.SafeGetString(nameof(_options.HideMerchantWhenVisited)), whichOption++, _showTravelingMerchant.ToggleHideWhenVisitedOption, () => _options.HideMerchantWhenVisited, v => _options.HideMerchantWhenVisited = v, travellingMerchantIcon)); _optionsElements.Add(new ModOptionsCheckbox(_helper.SafeGetString(nameof(_options.ShowRainyDay)), whichOption++, _showRainyDayIcon.ToggleOption, () => _options.ShowRainyDay, v => _options.ShowRainyDay = v)); _optionsElements.Add(new ModOptionsCheckbox(_helper.SafeGetString(nameof(_options.ShowHarvestPricesInShop)), whichOption++, _shopHarvestPrices.ToggleOption, () => _options.ShowHarvestPricesInShop, v => _options.ShowHarvestPricesInShop = v)); _optionsElements.Add(new ModOptionsCheckbox(_helper.SafeGetString(nameof(_options.ShowWhenNewRecipesAreAvailable)), whichOption++, _showQueenOfSauceIcon.ToggleOption, () => _options.ShowWhenNewRecipesAreAvailable, v => _options.ShowWhenNewRecipesAreAvailable = v)); _optionsElements.Add(new ModOptionsCheckbox(_helper.SafeGetString(nameof(_options.ShowToolUpgradeStatus)), whichOption++, _showToolUpgradeStatus.ToggleOption, () => _options.ShowToolUpgradeStatus, v => _options.ShowToolUpgradeStatus = v)); _optionsElements.Add(new ModOptionsCheckbox(_helper.SafeGetString(nameof(_options.ShowRobinBuildingStatusIcon)), whichOption++, _showRobinBuildingStatusIcon.ToggleOption, () => _options.ShowRobinBuildingStatusIcon, v => _options.ShowRobinBuildingStatusIcon = v)); _optionsElements.Add(new ModOptionsCheckbox(_helper.SafeGetString(nameof(_options.ShowTodaysGifts)), whichOption++, _showTodaysGift.ToggleOption, () => _options.ShowTodaysGifts, v => _options.ShowTodaysGifts = v)); }