mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Update submod positions on group deletions.
This commit is contained in:
parent
8aefdbd948
commit
5ac3a903f6
1 changed files with 13 additions and 8 deletions
|
|
@ -70,6 +70,7 @@ public sealed partial class Mod
|
|||
var group = mod._groups[ groupIdx ];
|
||||
ModOptionChanged.Invoke( ModOptionChangeType.PrepareChange, mod, groupIdx, -1, -1 );
|
||||
mod._groups.RemoveAt( groupIdx );
|
||||
UpdateSubModPositions( mod, groupIdx );
|
||||
group.DeleteFile( mod.ModPath, groupIdx );
|
||||
ModOptionChanged.Invoke( ModOptionChangeType.GroupDeleted, mod, groupIdx, -1, -1 );
|
||||
}
|
||||
|
|
@ -78,18 +79,22 @@ public sealed partial class Mod
|
|||
{
|
||||
if( mod._groups.Move( groupIdxFrom, groupIdxTo ) )
|
||||
{
|
||||
foreach( var (group, groupIdx) in mod._groups.WithIndex().Skip( Math.Min( groupIdxFrom, groupIdxTo ) ) )
|
||||
{
|
||||
foreach( var (o, optionIdx) in group.OfType<SubMod>().WithIndex() )
|
||||
{
|
||||
o.SetPosition( groupIdx, optionIdx );
|
||||
}
|
||||
}
|
||||
|
||||
UpdateSubModPositions( mod, Math.Min( groupIdxFrom, groupIdxTo ) );
|
||||
ModOptionChanged.Invoke( ModOptionChangeType.GroupMoved, mod, groupIdxFrom, -1, groupIdxTo );
|
||||
}
|
||||
}
|
||||
|
||||
private static void UpdateSubModPositions( Mod mod, int fromGroup )
|
||||
{
|
||||
foreach( var (group, groupIdx) in mod._groups.WithIndex().Skip( fromGroup ) )
|
||||
{
|
||||
foreach( var (o, optionIdx) in group.OfType<SubMod>().WithIndex() )
|
||||
{
|
||||
o.SetPosition( groupIdx, optionIdx );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangeGroupDescription( Mod mod, int groupIdx, string newDescription )
|
||||
{
|
||||
var group = mod._groups[ groupIdx ];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue