mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +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.
|
||||
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.
|
||||
public ModCollection Default { get; private set; } = Empty;
|
||||
|
||||
|
|
@ -78,6 +81,8 @@ public partial class ModCollection
|
|||
break;
|
||||
}
|
||||
|
||||
CurrentCollectionInUse = Characters.Values.Prepend( Default ).SelectMany( c => c.GetFlattenedInheritance() ).Contains( Current );
|
||||
|
||||
CollectionChanged.Invoke( type, this[ oldCollectionIdx ], newCollection, characterName );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -101,18 +101,16 @@ public partial class ConfigWindow
|
|||
_ => throw new ArgumentOutOfRangeException( nameof( type ), type, null ),
|
||||
};
|
||||
|
||||
using var combo = ImRaii.Combo( label, current.Name );
|
||||
if( !combo )
|
||||
using var combo = ImRaii.Combo( label, current.Name );
|
||||
if( combo )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach( var collection in Penumbra.CollectionManager.GetEnumeratorWithEmpty().Skip( withEmpty ? 0 : 1 ).OrderBy( c => c.Name ) )
|
||||
{
|
||||
using var id = ImRaii.PushId( collection.Index );
|
||||
if( ImGui.Selectable( collection.Name, collection == current ) )
|
||||
foreach( var collection in Penumbra.CollectionManager.GetEnumeratorWithEmpty().Skip( withEmpty ? 0 : 1 ).OrderBy( c => c.Name ) )
|
||||
{
|
||||
Penumbra.CollectionManager.SetCollection( collection, type, characterName );
|
||||
using var id = ImRaii.PushId( collection.Index );
|
||||
if( ImGui.Selectable( collection.Name, collection == current ) )
|
||||
{
|
||||
Penumbra.CollectionManager.SetCollection( collection, type, characterName );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,17 +12,12 @@ namespace Penumbra.UI;
|
|||
|
||||
public partial class ConfigWindow
|
||||
{
|
||||
private partial class ModPanel : IDisposable
|
||||
private partial class ModPanel
|
||||
{
|
||||
// We use a big, nice game font for the title.
|
||||
private readonly GameFontHandle _nameFont =
|
||||
Dalamud.PluginInterface.UiBuilder.GetGameFontHandle( new GameFontStyle( GameFontFamilyAndSize.Jupiter23 ) );
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_nameFont.Dispose();
|
||||
}
|
||||
|
||||
// Header data.
|
||||
private string _modName = string.Empty;
|
||||
private string _modAuthor = string.Empty;
|
||||
|
|
|
|||
|
|
@ -63,6 +63,10 @@ public partial class ConfigWindow
|
|||
DrawInheritedCollectionButton( 3 * buttonSize );
|
||||
ImGui.SameLine();
|
||||
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 )
|
||||
|
|
@ -112,7 +116,7 @@ public partial class ConfigWindow
|
|||
|
||||
// The basic setup for the mod panel.
|
||||
// Details are in other files.
|
||||
private partial class ModPanel
|
||||
private partial class ModPanel : IDisposable
|
||||
{
|
||||
private readonly ConfigWindow _window;
|
||||
|
||||
|
|
@ -123,6 +127,11 @@ public partial class ConfigWindow
|
|||
public ModPanel( ConfigWindow window )
|
||||
=> _window = window;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_nameFont.Dispose();
|
||||
}
|
||||
|
||||
public void Draw( ModFileSystemSelector selector )
|
||||
{
|
||||
Init( selector );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue