This commit is contained in:
Ottermandias 2022-03-26 18:34:32 +01:00
parent bc47e08e08
commit 9a0b0bfa0f
35 changed files with 1365 additions and 1997 deletions

View file

@ -6,6 +6,7 @@ using Dalamud.Interface;
using Dalamud.Interface.Components;
using Dalamud.Logging;
using ImGuiNET;
using Penumbra.Collections;
using Penumbra.Mod;
using Penumbra.Mods;
using Penumbra.UI.Custom;
@ -21,7 +22,7 @@ public partial class SettingsInterface
private readonly Selector _selector;
private string _collectionNames = null!;
private string _collectionNamesWithNone = null!;
private ModCollection[] _collections = null!;
private ModCollection2[] _collections = null!;
private int _currentCollectionIndex;
private int _currentForcedIndex;
private int _currentDefaultIndex;
@ -31,14 +32,14 @@ public partial class SettingsInterface
private void UpdateNames()
{
_collections = Penumbra.CollectionManager.Collections.Prepend( ModCollection.Empty ).ToArray();
_collections = Penumbra.CollectionManager.Prepend( ModCollection2.Empty ).ToArray();
_collectionNames = string.Join( "\0", _collections.Skip( 1 ).Select( c => c.Name ) ) + '\0';
_collectionNamesWithNone = "None\0" + _collectionNames;
UpdateIndices();
}
private int GetIndex( ModCollection collection )
private int GetIndex( ModCollection2 collection )
{
var ret = _collections.IndexOf( c => c.Name == collection.Name );
if( ret < 0 )
@ -175,7 +176,7 @@ public partial class SettingsInterface
}
}
public void SetCurrentCollection( ModCollection collection, bool force = false )
public void SetCurrentCollection( ModCollection2 collection, bool force = false )
{
var idx = Array.IndexOf( _collections, collection ) - 1;
if( idx >= 0 )

View file

@ -3,6 +3,7 @@ using System.IO;
using System.Linq;
using Dalamud.Interface;
using ImGuiNET;
using Penumbra.Collections;
using Penumbra.GameData.ByteString;
using Penumbra.GameData.Util;
using Penumbra.Mods;
@ -99,9 +100,9 @@ public partial class SettingsInterface
return !_filePathFilter.Any() || kvp.Item3.Contains( _filePathFilterLower );
}
private void DrawFilteredRows( ModCollectionCache? active, ModCollectionCache? forced )
private void DrawFilteredRows( ModCollection2 active )
{
void DrawFileLines( ModCollectionCache cache )
void DrawFileLines( ModCollection2.Cache cache )
{
foreach( var (gp, fp) in cache.ResolvedFiles.Where( CheckFilters ) )
{
@ -116,15 +117,7 @@ public partial class SettingsInterface
//}
}
if( active != null )
{
DrawFileLines( active );
}
if( forced != null )
{
DrawFileLines( forced );
}
DrawFileLines( active );
}
public void Draw()

View file

@ -151,7 +151,7 @@ namespace Penumbra.UI
{
foreach( var modData in _manager.StructuredMods.AllMods( _manager.Config.SortFoldersFirst ) )
{
var mod = Penumbra.CollectionManager.CurrentCollection.GetMod( modData );
var mod = Penumbra.CollectionManager.Current.GetMod( modData );
_modsInOrder.Add( mod );
_visibleMods.Add( CheckFilters( mod ) );
}

View file

@ -8,6 +8,7 @@ using System.Windows.Forms.VisualStyles;
using Dalamud.Interface;
using Dalamud.Logging;
using ImGuiNET;
using Penumbra.Collections;
using Penumbra.Importer;
using Penumbra.Mod;
using Penumbra.Mods;
@ -606,10 +607,10 @@ public partial class SettingsInterface
Cache = new ModListCache( Penumbra.ModManager, newMods );
}
private void DrawCollectionButton( string label, string tooltipLabel, float size, ModCollection collection )
private void DrawCollectionButton( string label, string tooltipLabel, float size, ModCollection2 collection )
{
if( collection == ModCollection.Empty
|| collection == Penumbra.CollectionManager.CurrentCollection )
if( collection == ModCollection2.Empty
|| collection == Penumbra.CollectionManager.Current )
{
using var _ = ImGuiRaii.PushStyle( ImGuiStyleVar.Alpha, 0.5f );
ImGui.Button( label, Vector2.UnitX * size );
@ -632,16 +633,13 @@ public partial class SettingsInterface
var comboSize = size * ImGui.GetIO().FontGlobalScale;
var offset = comboSize + textSize;
var buttonSize = Math.Max( ( ImGui.GetWindowContentRegionWidth()
- offset
- SelectorPanelWidth * _selectorScalingFactor
- 4 * ImGui.GetStyle().ItemSpacing.X )
/ 2, 5f );
var buttonSize = Math.Max( ImGui.GetWindowContentRegionWidth()
- offset
- SelectorPanelWidth * _selectorScalingFactor
- 3 * ImGui.GetStyle().ItemSpacing.X, 5f );
ImGui.SameLine();
DrawCollectionButton( "Default", "default", buttonSize, Penumbra.CollectionManager.DefaultCollection );
DrawCollectionButton( "Default", "default", buttonSize, Penumbra.CollectionManager.Default );
ImGui.SameLine();
DrawCollectionButton( "Forced", "forced", buttonSize, Penumbra.CollectionManager.ForcedCollection );
ImGui.SameLine();
ImGui.SetNextItemWidth( comboSize );