public LibraryModCell(ModListController list, PluginLoader.PluginInfo plugin) : base($"{plugin.Metadata.Name} <size=60%>v{plugin.Metadata.Version}", plugin.Metadata.Manifest.Author, null) { Plugin = plugin; this.list = list; if (string.IsNullOrWhiteSpace(subtext)) { subtext = "<color=#BFBFBF><i>Unspecified Author</i>"; } icon = Utilities.DefaultLibraryIcon; }
public void OnSelect(ModListController cntrl) { Logger.log.Debug($"Selected IPAModCell {Plugin.Name} {Plugin.Version}"); if (infoView == null) { infoView = BeatSaberUI.CreateViewController <ModInfoViewController>(); infoView.Init(icon, Plugin.Name, "v" + Plugin.Version.ToString(), "<color=#BFBFBF><i>Unknown Author</i>", "<color=#A0A0A0>This mod was written for IPA Reloaded. No metadata is avaliable for this mod. " + "Please contact the mod author and ask them to port it to BSIPA to provide more information.", null); } list.flow.SetSelected(infoView, immediate: list.flow.HasSelected); }
public BSIPAIgnoredModCell(ModListController list, PluginLoader.PluginMetadata plugin) : base($"<color=#878787>{plugin.Name} <size=60%>v{plugin.Version}", "", Utilities.DefaultBSIPAIcon) { Plugin = plugin; this.list = list; if (string.IsNullOrWhiteSpace(plugin.Manifest.Author)) { authorText = "<color=#BFBFBF><i>Unspecified Author</i>"; } else { authorText = plugin.Manifest.Author; } subtext = string.Format(authorFormat, authorText); }
public BSIPAModCell(ModListController list, PluginLoader.PluginMetadata plugin) : base("", "", null) { Plugin = plugin; this.list = list; var thisWeakRef = new WeakReference <BSIPAModCell>(this); PluginManager.PluginDisableDelegate reflessDDel = null; reflessDDel = disableDel = (p, r) => PluginManager_PluginDisabled(p, r, thisWeakRef, reflessDDel); // some indirection to make it a weak link for GC PluginManager.PluginDisabled += reflessDDel; PluginManager.PluginEnableDelegate reflessEDel = null; reflessEDel = enableDel = (p, r) => PluginManager_PluginEnabled(p, r, thisWeakRef, reflessEDel); // some indirection to make it a weak link for GC PluginManager.PluginEnabled += reflessEDel; Update(propogate: false); }
public void OnSelect(ModListController cntrl) { Logger.log.Debug($"Selected BSIPAIgnoredModCell {Plugin.Name} {Plugin.Version}"); if (infoView == null) { var desc = Plugin.Manifest.Description; if (string.IsNullOrWhiteSpace(desc)) { desc = "<color=#BFBFBF><i>No description</i>"; } infoView = BeatSaberUI.CreateViewController <ModInfoViewController>(); infoView.Init(icon, Plugin.Name, "v" + Plugin.Version.ToString(), authorText, desc, Plugin, Plugin.Manifest.Links); } list.flow.SetSelected(infoView, immediate: list.flow.HasSelected); }
public void OnSelect(ModListController cntrl) { Logger.log.Debug($"Selected BSIPAModCell {Plugin.Metadata.Name} {Plugin.Metadata.Version}"); if (infoView == null) { var desc = Plugin.Metadata.Manifest.Description; if (string.IsNullOrWhiteSpace(desc)) { desc = "<color=#BFBFBF><i>No description</i>"; } infoView = BeatSaberUI.CreateViewController <ModInfoViewController>(); infoView.Init(icon, Plugin.Metadata.Name, "v" + Plugin.Metadata.Version.ToString(), subtext, desc, Plugin.Metadata.Features.FirstOrDefault(f => f is NoUpdateFeature) != null ? Plugin.Metadata : null, Plugin.Metadata.Manifest.Links); } list.flow.SetSelected(infoView, immediate: list.flow.HasSelected); }
public IPAModCell(ModListController list, IPlugin plugin) : base($"{plugin.Name} <size=60%>{plugin.Version}", "<color=#BFBFBF><i>Legacy</i>", Utilities.DefaultIPAIcon) { Plugin = plugin; this.list = list; }
private static void DoBottomLeftWindowContents(Rect rect) { // Backup Button Rect BackupRect = new Rect((rect.xMin - 1), rect.yMax - 37f, ButtonBigWidth, BottomHeight); TooltipHandler.TipRegion(BackupRect, "Button_Backup_Tooltip".Translate()); if (Widgets.ButtonText(BackupRect, "Button_Backup_Text".Translate())) { BackupModList(); } // '>>' Label Text.Anchor = TextAnchor.MiddleCenter; Rect toRect = new Rect(BackupRect.xMax + Padding, BackupRect.y, LabelWidth, BottomHeight); Widgets.Label(toRect, ">>"); // State button and Float menu Rect StateRect = new Rect(toRect.xMax + Padding, BackupRect.y, ButtonSmallWidth, BottomHeight); TooltipHandler.TipRegion(StateRect, "Button_State_Select_Tooltip".Translate()); if (Widgets.ButtonText(StateRect, string.Format("{0}{1}", selectedModlist.ToString(), (ModListController.ModListIsSet(selectedModlist)) ? null : "*"))) { List <FloatMenuOption> options = new List <FloatMenuOption>(); for (int i = 1; i <= SettingsHandler.STATE_LIMIT; i++) { //set a new variable here, otherwise the selected state and button text will change when int i next iterates int n = i; options.Add(new FloatMenuOption(ModListController.GetFormattedModListName(i), (Action)(() => { selectedModlist = n; }), MenuOptionPriority.Default, (Action)null, (Thing)null, 0.0f, (Func <Rect, bool>)null, (WorldObject)null)); } options.Add(new FloatMenuOption("Edit Names...", (Action)(() => { Find.WindowStack.Add(new Dialogs.Dialog_EditNames()); }), MenuOptionPriority.Default, (Action)null, (Thing)null, 0f, null, null)); Find.WindowStack.Add((Window) new FloatMenu(options)); } // '<<' Label Rect fromRect = new Rect(StateRect.xMax + Padding, StateRect.y, LabelWidth, BottomHeight); Widgets.Label(fromRect, "<<"); // Restore Button Rect RestoreRect = new Rect(fromRect.xMax + Padding, StateRect.y, ButtonBigWidth, BottomHeight); TooltipHandler.TipRegion(RestoreRect, "Button_Restore_Tooltip".Translate()); if (Widgets.ButtonText(RestoreRect, "Button_Restore_Text".Translate())) { ModListController.RestoreModList(selectedModlist); } // Undo Button Rect UndoRect = new Rect(RestoreRect.xMax + Padding + 7f, RestoreRect.y, ButtonSmallWidth, BottomHeight); TooltipHandler.TipRegion(UndoRect, "Button_Undo_Tooltip".Translate()); if (ButtonWidgets.ButtonImage(UndoRect, Textures.Undo)) { if (ModListController.CanUndo) { if (ModListController.DoUndoAction()) { SetStatus("Status_Message_Undone".Translate()); } } } // Status Label DoStatusMessageTick(); Text.Font = GameFont.Tiny; Rect StatusRect = new Rect(StateRect.x - 25f, StateRect.yMax - 58f, LabelStatusSize.x, LabelStatusSize.y); Widgets.Label(StatusRect, StatusMessage); //Reset text Text.Font = GameFont.Small; Text.Anchor = TextAnchor.UpperLeft; }
private static void BackupModList() { ModListController.SaveModList(selectedModlist); SetStatus("Status_Message_Backup".Translate()); }
/// <summary> /// Draw the state names button and list /// </summary> /// <param name="rect">The rect to draw into</param> /// <returns>True if values changed</returns> internal static bool DoStateNamesDrawerContents(Rect rect) { if (StateNamesSetting.Value == null) { StateNamesSetting.Value = new StateNamesHandleType(); } Rect inRect = new Rect(rect.x - 18f, rect.y + 40f, rect.width, rect.height - 30); Listing_Standard listing_Standard = new Listing_Standard(); listing_Standard.Begin(inRect); for (int i = 0; i <= SettingsHandler.STATE_LIMIT - 1; i++) { string label = String.Format("{2}{0} {1}: ", "Settings_Label_State_Name".Translate(), i + 1, (ModListController.ModListIsSet(i)) ? null : "* "); string oldName = StateNamesSetting.Value.StateNames[i]; string newName = listing_Standard.TextEntryLabeled(label, oldName); listing_Standard.Gap(16f); if (newName != oldName) { StateNamesSetting.Value.StateNames[i] = newName; return(true); } } listing_Standard.End(); return(false); }