InstallerInfo (weird name?) => OptionGroup

This commit is contained in:
Ottermandias 2021-02-22 14:49:04 +01:00
parent 70371b6467
commit 87c4172168
6 changed files with 19 additions and 19 deletions

View file

@ -21,7 +21,7 @@ namespace Penumbra.Importer
public ImporterState State { get; private set; }
public long TotalProgress { get; private set; } = 0;
public long TotalProgress { get; private set; }
public long CurrentProgress { get; private set; }
public float Progress
@ -249,7 +249,7 @@ namespace Penumbra.Importer
private static void AddMeta( DirectoryInfo baseFolder, DirectoryInfo groupFolder, ModGroup group, ModMeta meta )
{
var inf = new InstallerInfo
var inf = new OptionGroup
{
SelectionType = group.SelectionType,
GroupName = group.GroupName!,

View file

@ -115,7 +115,7 @@ namespace Penumbra.Models
const string duplicates = "Duplicates";
if( !_mod.Groups.ContainsKey( duplicates ) )
{
InstallerInfo info = new()
OptionGroup info = new()
{
GroupName = duplicates,
SelectionType = SelectType.Single,

View file

@ -29,7 +29,7 @@ namespace Penumbra.Models
}
}
public struct InstallerInfo
public struct OptionGroup
{
public string GroupName;

View file

@ -21,7 +21,7 @@ namespace Penumbra.Models
public Dictionary< string, string > FileSwaps { get; } = new();
public Dictionary< string, InstallerInfo > Groups { get; set; } = new();
public Dictionary< string, OptionGroup > Groups { get; set; } = new();
[JsonIgnore]
public bool HasGroupWithConfig { get; set; } = false;

View file

@ -55,7 +55,7 @@ namespace Penumbra.UI
private bool _editMode = false;
private int _selectedGroupIndex = 0;
private InstallerInfo? _selectedGroup = null;
private OptionGroup? _selectedGroup = null;
private int _selectedOptionIndex = 0;
private Option? _selectedOption = null;
private (string label, string name)[]? _changedItemsList = null;
@ -99,7 +99,7 @@ namespace Penumbra.UI
if( _selectedGroup?.Options.Count > 0 )
{
_selectedOption = ( ( InstallerInfo )_selectedGroup ).Options[ _selectedOptionIndex ];
_selectedOption = ( ( OptionGroup )_selectedGroup ).Options[ _selectedOptionIndex ];
}
else
{
@ -545,7 +545,7 @@ namespace Penumbra.UI
}
}
private void DrawMultiSelectorCheckBox( InstallerInfo group, int idx, int flag, string label )
private void DrawMultiSelectorCheckBox( OptionGroup group, int idx, int flag, string label )
{
var opt = group.Options[ idx ];
var enabled = ( flag & ( 1 << idx ) ) != 0;
@ -557,7 +557,7 @@ namespace Penumbra.UI
}
}
private void DrawMultiSelector( InstallerInfo group )
private void DrawMultiSelector( OptionGroup group )
{
if( group.Options.Count == 0 )
{
@ -574,7 +574,7 @@ namespace Penumbra.UI
ImGuiCustom.EndFramedGroup();
}
private void DrawSingleSelector( InstallerInfo group )
private void DrawSingleSelector( OptionGroup group )
{
if( group.Options.Count < 2 )
{

View file

@ -63,7 +63,7 @@ namespace Penumbra.UI
return false;
}
var group = ( InstallerInfo )_selectedGroup!;
var group = ( OptionGroup )_selectedGroup!;
if( ImGui.Combo( LabelOptionSelect, ref _selectedOptionIndex, group.Options.Select( O => O.OptionName ).ToArray(),
group.Options.Count ) )
{
@ -103,7 +103,7 @@ namespace Penumbra.UI
}
}
private bool DrawMultiSelectorEditBegin( InstallerInfo group )
private bool DrawMultiSelectorEditBegin( OptionGroup group )
{
var groupName = group.GroupName;
if( ImGuiCustom.BeginFramedGroupEdit( ref groupName )
@ -114,7 +114,7 @@ namespace Penumbra.UI
Mod.Conf.Remove( group.GroupName );
if( groupName.Length > 0 )
{
Meta.Groups[ groupName ] = new InstallerInfo()
Meta.Groups[ groupName ] = new OptionGroup()
{ GroupName = groupName, SelectionType = SelectType.Multi, Options = group.Options };
Mod.Conf[ groupName ] = oldConf;
}
@ -125,7 +125,7 @@ namespace Penumbra.UI
return false;
}
private void DrawMultiSelectorEditAdd( InstallerInfo group, float nameBoxStart )
private void DrawMultiSelectorEditAdd( OptionGroup group, float nameBoxStart )
{
var newOption = "";
ImGui.SetCursorPosX( nameBoxStart );
@ -139,7 +139,7 @@ namespace Penumbra.UI
}
}
private void DrawMultiSelectorEdit( InstallerInfo group )
private void DrawMultiSelectorEdit( OptionGroup group )
{
var nameBoxStart = CheckMarkSize;
var flag = Mod!.Conf[ group.GroupName ];
@ -190,7 +190,7 @@ namespace Penumbra.UI
ImGuiCustom.EndFramedGroup();
}
private bool DrawSingleSelectorEditGroup( InstallerInfo group )
private bool DrawSingleSelectorEditGroup( OptionGroup group )
{
var groupName = group.GroupName;
if( ImGui.InputText( $"##{groupName}_add", ref groupName, 64, ImGuiInputTextFlags.EnterReturnsTrue )
@ -206,7 +206,7 @@ namespace Penumbra.UI
if( groupName.Length > 0 )
{
Meta.Groups.Add( groupName,
new InstallerInfo() { GroupName = groupName, Options = group.Options, SelectionType = SelectType.Single } );
new OptionGroup() { GroupName = groupName, Options = group.Options, SelectionType = SelectType.Single } );
Mod.Conf[ groupName ] = oldConf;
}
@ -216,7 +216,7 @@ namespace Penumbra.UI
return false;
}
private float DrawSingleSelectorEdit( InstallerInfo group )
private float DrawSingleSelectorEdit( OptionGroup group )
{
var code = Mod!.Conf[ group.GroupName ];
var selectionChanged = false;
@ -288,7 +288,7 @@ namespace Penumbra.UI
return;
}
Meta.Groups[ newGroup ] = new InstallerInfo()
Meta.Groups[ newGroup ] = new OptionGroup()
{
GroupName = newGroup,
SelectionType = selectType,