private static void SlugcatSelectMenu_ctor(On.Menu.SlugcatSelectMenu.orig_ctor orig, SlugcatSelectMenu self, ProcessManager manager) { orig(self, manager); int saveSlot = self.manager.rainWorld.options.saveSlot; if (CustomWorldMod.saveProblems[saveSlot].AnyProblems) { bool allNewGame = true; string errorText = CustomWorldMod.Translate("Problems found in your save, please check the tab SaveAnalyzer in the config screen for more information."); for (int m = 0; m < self.slugcatPages.Length; m++) { if (self.saveGameData[m] != null) { allNewGame = false; break; } } if (allNewGame) { errorText = CustomWorldMod.Translate("Problems found in your save, please use the Reset Progress button in the RW options menu"); } MenuLabel menuLabel = new MenuLabel(self, self.pages[0], errorText, new Vector2(self.manager.rainWorld.options.ScreenSize.x * 0.5f, self.manager.rainWorld.options.ScreenSize.y * 0.85f), new Vector2(0, 0), false); menuLabel.label.color = new Color((108f / 255f), 0.001f, 0.001f); menuLabel.label.alignment = FLabelAlignment.Center; self.pages[0].subObjects.Add(menuLabel); } }
private static void SlugMenuCtorPatch(On.Menu.SlugcatSelectMenu.orig_ctor orig, SlugcatSelectMenu self, ProcessManager manager) { orig.Invoke(self, manager); foreach (OptionInterface oi in OptionScript.loadedInterfaces) { oi.GenerateDataArray(self.slugcatColorOrder.Length); } LoadAndSaveOI(0, true); }
private static void SlugcatSelectMenu_ctor(On.Menu.SlugcatSelectMenu.orig_ctor orig, SlugcatSelectMenu self, ProcessManager manager) { orig(self, manager); int saveSlot = self.manager.rainWorld.options.saveSlot; if (CustomWorldMod.saveProblems[saveSlot].AnyProblems) { bool allNewGame = true; string errorText = CustomWorldMod.Translate("Problems found in your save, " + "please check the tab SaveAnalyzer in the config screen for more information."); for (int m = 0; m < self.slugcatPages.Length; m++) { if (self.saveGameData[m] != null) { allNewGame = false; break; } } if (allNewGame) { errorText = CustomWorldMod.Translate("Problems found in your save, please use the Reset Progress button in the RW options menu"); } MenuLabel menuLabel = new MenuLabel(self, self.pages[0], errorText, new Vector2(self.manager.rainWorld.options.ScreenSize.x * 0.5f, self.manager.rainWorld.options.ScreenSize.y * 0.85f), new Vector2(0, 0), false); menuLabel.label.color = new Color((108f / 255f), 0.001f, 0.001f); menuLabel.label.alignment = FLabelAlignment.Center; self.pages[0].subObjects.Add(menuLabel); } if (CustomWorldMod.missingDependencies.Count > 0) { string errorText = CustomWorldMod.Translate($"You have missing dependencies, please reinstall the following packs: " + $"[{string.Join(", ", CustomWorldMod.missingDependencies.Keys.ToArray())}]"); MenuLabel menuLabel = new MenuLabel(self, self.pages[0], errorText, new Vector2(self.manager.rainWorld.options.ScreenSize.x * 0.5f, self.manager.rainWorld.options.ScreenSize.y * 0.95f), new Vector2(0, 0), true); menuLabel.label.color = new Color((108f / 255f), 0.001f, 0.001f); menuLabel.label.alignment = FLabelAlignment.Center; self.pages[0].subObjects.Add(menuLabel); // Second line MenuLabel menuLabel2 = new MenuLabel(self, self.pages[0], $"Missing dependencies: [{string.Join(", ", CustomWorldMod.missingDependencies.Values.SelectMany(i => i).Distinct().ToArray())}]", new Vector2(self.manager.rainWorld.options.ScreenSize.x * 0.5f, self.manager.rainWorld.options.ScreenSize.y * 0.91f), new Vector2(0, 0), false); menuLabel2.label.color = new Color((108f / 255f), 0.001f, 0.001f); menuLabel2.label.alignment = FLabelAlignment.Center; self.pages[0].subObjects.Add(menuLabel2); } }
// Add custom slugcat select screens private static void SlugcatSelectMenu_ctor(On.Menu.SlugcatSelectMenu.orig_ctor orig, Menu.SlugcatSelectMenu self, ProcessManager manager) { int selectedSlugcat = manager.rainWorld.progression.miscProgressionData.currentlySelectedSinglePlayerSlugcat; orig(self, manager); List <SlugBaseCharacter> plys = PlayerManager.customPlayers; int origLength = self.slugcatColorOrder.Length; // Add all SlugBase characters to the select screen // All other player mods should change this array, so we have a nice lower bound for indices we can take // Find the next available slugcat index, skipping Nightcat int firstCustomIndex = 4; // Take color order into account for (int i = 0; i < self.slugcatColorOrder.Length; i++) { firstCustomIndex = Math.Max(self.slugcatColorOrder[i] + 1, firstCustomIndex); } // Take slugcat names into account foreach (SlugcatStats.Name name in Enum.GetValues(typeof(SlugcatStats.Name))) { firstCustomIndex = Math.Max((int)name + 1, firstCustomIndex); } int nextCustomIndex = firstCustomIndex; // Add SlugBase characters to the page order and assign empty slots a default value Array.Resize(ref self.slugcatColorOrder, origLength + plys.Count); for (int i = origLength; i < self.slugcatColorOrder.Length; i++) { self.slugcatColorOrder[i] = -1; } for (int i = 0; i < plys.Count; i++) { // Assign each player a unique index, then save it to the page order // This will cause weird behavior if the user skips over the title screen using EDT, so... don't do that self.slugcatColorOrder[origLength + i] = nextCustomIndex; plys[i].slugcatIndex = nextCustomIndex++; } // Retrieve save data Array.Resize(ref self.saveGameData, origLength + plys.Count); for (int i = 0; i < plys.Count; i++) { self.saveGameData[origLength + i] = SlugcatSelectMenu.MineForSaveData(self.manager, plys[i].slugcatIndex); } // Add a new page to the menu Array.Resize(ref self.slugcatPages, origLength + plys.Count); for (int i = 0; i < plys.Count; i++) { int o = origLength + i; if (self.saveGameData[o] != null) { self.slugcatPages[o] = new SlugcatSelectMenu.SlugcatPageContinue(self, null, o + 1, self.slugcatColorOrder[o]); } else { self.slugcatPages[o] = new SlugcatSelectMenu.SlugcatPageNewGame(self, null, o + 1, self.slugcatColorOrder[o]); } // Select the correct page if (selectedSlugcat == self.slugcatColorOrder[o]) { self.slugcatPageIndex = o; } self.pages.Add(self.slugcatPages[o]); // Make sure the start button reflects the changed slugcat index self.UpdateStartButtonText(); self.UpdateSelectedSlugcatInMiscProg(); } }