Turn Collections to List instead of Dict.

This commit is contained in:
Ottermandias 2022-03-23 13:03:55 +01:00
parent 9c0fc8a8c7
commit 519543772c
9 changed files with 50 additions and 36 deletions

View file

@ -31,7 +31,7 @@ public partial class SettingsInterface
private void UpdateNames()
{
_collections = Penumbra.CollectionManager.Collections.Values.Prepend( ModCollection.Empty ).ToArray();
_collections = Penumbra.CollectionManager.Collections.Prepend( ModCollection.Empty ).ToArray();
_collectionNames = string.Join( "\0", _collections.Skip( 1 ).Select( c => c.Name ) ) + '\0';
_collectionNamesWithNone = "None\0" + _collectionNames;
UpdateIndices();
@ -87,7 +87,7 @@ public partial class SettingsInterface
if( Penumbra.CollectionManager.AddCollection( _newCollectionName, settings ) )
{
UpdateNames();
SetCurrentCollection( Penumbra.CollectionManager.Collections[ _newCollectionName ], true );
SetCurrentCollection( Penumbra.CollectionManager.ByName( _newCollectionName )!, true );
}
_newCollectionName = string.Empty;
@ -222,7 +222,7 @@ public partial class SettingsInterface
{
var index = _currentForcedIndex;
ImGui.SetNextItemWidth( SettingsMenu.InputTextWidth );
using var style = ImGuiRaii.PushStyle( ImGuiStyleVar.Alpha, 0.5f, Penumbra.CollectionManager.CharacterCollection.Count == 0 );
using var style = ImGuiRaii.PushStyle( ImGuiStyleVar.Alpha, 0.5f, Penumbra.CollectionManager.CharacterCollection.Count == 0 );
if( ImGui.Combo( "##Forced Collection", ref index, _collectionNamesWithNone )
&& index != _currentForcedIndex
&& Penumbra.CollectionManager.CharacterCollection.Count > 0 )

View file

@ -422,14 +422,14 @@ public partial class SettingsInterface
_fullFilenameList = null;
_selector.SaveCurrentMod();
// Since files may have changed, we need to recompute effective files.
foreach( var collection in Penumbra.CollectionManager.Collections.Values
.Where( c => c.Cache != null && c.Settings[ Mod!.Data.BasePath.Name ].Enabled ) )
foreach( var collection in Penumbra.CollectionManager.Collections
.Where( c => c.Cache != null && c.Settings[ Mod.Data.BasePath.Name ].Enabled ) )
{
collection.CalculateEffectiveFileList( false, Penumbra.CollectionManager.IsActive( collection ) );
}
// If the mod is enabled in the current collection, its conflicts may have changed.
if( Mod!.Settings.Enabled )
if( Mod.Settings.Enabled )
{
_selector.Cache.TriggerFilterReset();
}