From 685772e6acd85fb908f8a025550482c25ab895f6 Mon Sep 17 00:00:00 2001 From: Ottermandias Date: Mon, 31 Jan 2022 22:38:28 +0100 Subject: [PATCH] Slight modifications. --- Penumbra/Configuration.cs | 1 - Penumbra/Penumbra.cs | 8 ++++---- Penumbra/UI/LaunchButton.cs | 26 ++++++++++++-------------- 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/Penumbra/Configuration.cs b/Penumbra/Configuration.cs index 559ff2df..9c6142a8 100644 --- a/Penumbra/Configuration.cs +++ b/Penumbra/Configuration.cs @@ -39,7 +39,6 @@ namespace Penumbra public Dictionary< string, string > ModSortOrder { get; set; } = new(); public bool InvertModListOrder { internal get; set; } - public Vector2 ManageModsButtonOffset { get; set; } = 50 * Vector2.One; public static Configuration Load() { diff --git a/Penumbra/Penumbra.cs b/Penumbra/Penumbra.cs index 4f9e7715..7b9c9bb5 100644 --- a/Penumbra/Penumbra.cs +++ b/Penumbra/Penumbra.cs @@ -70,6 +70,10 @@ public class Penumbra : IDalamudPlugin gameUtils.ReloadResidentResources(); + Api = new PenumbraApi( this ); + Ipc = new PenumbraIpc( pluginInterface, Api ); + SubscribeItemLinks(); + SettingsInterface = new SettingsInterface( this ); if( Config.EnableHttpApi ) @@ -87,10 +91,6 @@ public class Penumbra : IDalamudPlugin PluginLog.Debug( "Triggered Redraw of {Player}.", p.Name ); ObjectReloader.RedrawObject( p, RedrawType.OnlyWithSettings ); }; - - Api = new PenumbraApi( this ); - SubscribeItemLinks(); - Ipc = new PenumbraIpc( pluginInterface, Api ); } public bool Enable() diff --git a/Penumbra/UI/LaunchButton.cs b/Penumbra/UI/LaunchButton.cs index 1540fd55..f78c9e89 100644 --- a/Penumbra/UI/LaunchButton.cs +++ b/Penumbra/UI/LaunchButton.cs @@ -1,9 +1,7 @@ using System; using System.IO; using Dalamud.Interface; -using ImGuiNET; using ImGuiScene; -using Penumbra.UI.Custom; namespace Penumbra.UI; @@ -11,12 +9,9 @@ public partial class SettingsInterface { private class ManageModsButton : IDisposable { - // magic numbers - private const string MenuButtonLabel = "Manage Mods"; - - private readonly SettingsInterface _base; - private readonly TextureWrap _icon; - private readonly TitleScreenMenu.TitleScreenMenuEntry _entry; + private readonly SettingsInterface _base; + private readonly TextureWrap? _icon; + private readonly TitleScreenMenu.TitleScreenMenuEntry? _entry; public ManageModsButton( SettingsInterface ui ) { @@ -24,10 +19,10 @@ public partial class SettingsInterface _icon = Dalamud.PluginInterface.UiBuilder.LoadImage( Path.Combine( Dalamud.PluginInterface.AssemblyLocation.DirectoryName!, "tsmLogo.png" ) ); - if( _icon == null ) - throw new Exception( "Could not load title screen icon." ); - - _entry = Dalamud.TitleScreenMenu.AddEntry( MenuButtonLabel, _icon, OnTriggered ); + if( _icon != null ) + { + _entry = Dalamud.TitleScreenMenu.AddEntry( "Manage Penumbra", _icon, OnTriggered ); + } } private void OnTriggered() @@ -37,8 +32,11 @@ public partial class SettingsInterface public void Dispose() { - _icon.Dispose(); - Dalamud.TitleScreenMenu.RemoveEntry( _entry ); + _icon?.Dispose(); + if( _entry != null ) + { + Dalamud.TitleScreenMenu.RemoveEntry( _entry ); + } } } } \ No newline at end of file