Slight modifications.

This commit is contained in:
Ottermandias 2022-01-31 22:38:28 +01:00
parent b6817c47ed
commit 685772e6ac
3 changed files with 16 additions and 19 deletions

View file

@ -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()
{

View file

@ -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()

View file

@ -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 );
}
}
}
}