mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-21 07:59:22 +01:00
Add warning if the currently edited collection is not in use anywhere.
This commit is contained in:
parent
abd1fd14f5
commit
61680f0afb
4 changed files with 24 additions and 17 deletions
|
|
@ -20,6 +20,9 @@ public partial class ModCollection
|
||||||
// The collection currently selected for changing settings.
|
// The collection currently selected for changing settings.
|
||||||
public ModCollection Current { get; private set; } = Empty;
|
public ModCollection Current { get; private set; } = Empty;
|
||||||
|
|
||||||
|
// The collection currently selected is in use either as an active collection or through inheritance.
|
||||||
|
public bool CurrentCollectionInUse { get; private set; }
|
||||||
|
|
||||||
// The collection used for general file redirections and all characters not specifically named.
|
// The collection used for general file redirections and all characters not specifically named.
|
||||||
public ModCollection Default { get; private set; } = Empty;
|
public ModCollection Default { get; private set; } = Empty;
|
||||||
|
|
||||||
|
|
@ -78,6 +81,8 @@ public partial class ModCollection
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CurrentCollectionInUse = Characters.Values.Prepend( Default ).SelectMany( c => c.GetFlattenedInheritance() ).Contains( Current );
|
||||||
|
|
||||||
CollectionChanged.Invoke( type, this[ oldCollectionIdx ], newCollection, characterName );
|
CollectionChanged.Invoke( type, this[ oldCollectionIdx ], newCollection, characterName );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -102,11 +102,8 @@ public partial class ConfigWindow
|
||||||
};
|
};
|
||||||
|
|
||||||
using var combo = ImRaii.Combo( label, current.Name );
|
using var combo = ImRaii.Combo( label, current.Name );
|
||||||
if( !combo )
|
if( combo )
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach( var collection in Penumbra.CollectionManager.GetEnumeratorWithEmpty().Skip( withEmpty ? 0 : 1 ).OrderBy( c => c.Name ) )
|
foreach( var collection in Penumbra.CollectionManager.GetEnumeratorWithEmpty().Skip( withEmpty ? 0 : 1 ).OrderBy( c => c.Name ) )
|
||||||
{
|
{
|
||||||
using var id = ImRaii.PushId( collection.Index );
|
using var id = ImRaii.PushId( collection.Index );
|
||||||
|
|
@ -116,4 +113,5 @@ public partial class ConfigWindow
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -12,17 +12,12 @@ namespace Penumbra.UI;
|
||||||
|
|
||||||
public partial class ConfigWindow
|
public partial class ConfigWindow
|
||||||
{
|
{
|
||||||
private partial class ModPanel : IDisposable
|
private partial class ModPanel
|
||||||
{
|
{
|
||||||
// We use a big, nice game font for the title.
|
// We use a big, nice game font for the title.
|
||||||
private readonly GameFontHandle _nameFont =
|
private readonly GameFontHandle _nameFont =
|
||||||
Dalamud.PluginInterface.UiBuilder.GetGameFontHandle( new GameFontStyle( GameFontFamilyAndSize.Jupiter23 ) );
|
Dalamud.PluginInterface.UiBuilder.GetGameFontHandle( new GameFontStyle( GameFontFamilyAndSize.Jupiter23 ) );
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
_nameFont.Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Header data.
|
// Header data.
|
||||||
private string _modName = string.Empty;
|
private string _modName = string.Empty;
|
||||||
private string _modAuthor = string.Empty;
|
private string _modAuthor = string.Empty;
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,10 @@ public partial class ConfigWindow
|
||||||
DrawInheritedCollectionButton( 3 * buttonSize );
|
DrawInheritedCollectionButton( 3 * buttonSize );
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
DrawCollectionSelector( "##collectionSelector", 2 * buttonSize.X, ModCollection.Type.Current, false, null );
|
DrawCollectionSelector( "##collectionSelector", 2 * buttonSize.X, ModCollection.Type.Current, false, null );
|
||||||
|
if( !Penumbra.CollectionManager.CurrentCollectionInUse )
|
||||||
|
{
|
||||||
|
ImGuiUtil.DrawTextButton( "The currently selected collection is not used in any way.", -Vector2.UnitX, Colors.PressEnterWarningBg );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void DrawDefaultCollectionButton( Vector2 width )
|
private static void DrawDefaultCollectionButton( Vector2 width )
|
||||||
|
|
@ -112,7 +116,7 @@ public partial class ConfigWindow
|
||||||
|
|
||||||
// The basic setup for the mod panel.
|
// The basic setup for the mod panel.
|
||||||
// Details are in other files.
|
// Details are in other files.
|
||||||
private partial class ModPanel
|
private partial class ModPanel : IDisposable
|
||||||
{
|
{
|
||||||
private readonly ConfigWindow _window;
|
private readonly ConfigWindow _window;
|
||||||
|
|
||||||
|
|
@ -123,6 +127,11 @@ public partial class ConfigWindow
|
||||||
public ModPanel( ConfigWindow window )
|
public ModPanel( ConfigWindow window )
|
||||||
=> _window = window;
|
=> _window = window;
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
_nameFont.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
public void Draw( ModFileSystemSelector selector )
|
public void Draw( ModFileSystemSelector selector )
|
||||||
{
|
{
|
||||||
Init( selector );
|
Init( selector );
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue