Added profile priority system, fixed a few issues

This commit is contained in:
RisaDev
2024-10-19 04:51:51 +03:00
parent 7085cf616c
commit 93802e6115
11 changed files with 119 additions and 60 deletions

View File

@@ -413,6 +413,7 @@ public unsafe sealed class ArmatureManager : IDisposable
type is not ProfileChanged.Type.TemporaryProfileDeleted &&
type is not ProfileChanged.Type.AddedCharacter &&
type is not ProfileChanged.Type.RemovedCharacter &&
type is not ProfileChanged.Type.PriorityChanged &&
type is not ProfileChanged.Type.ChangedDefaultProfile &&
type is not ProfileChanged.Type.ChangedDefaultLocalPlayerProfile)
return;
@@ -438,6 +439,26 @@ public unsafe sealed class ArmatureManager : IDisposable
return;
}
if(type == ProfileChanged.Type.PriorityChanged)
{
if (!profile.Enabled)
return;
foreach (var character in profile.Characters)
{
if (!character.IsValid)
continue;
foreach (var armature in GetArmaturesForCharacter(character))
{
armature.IsPendingProfileRebind = true;
_logger.Debug($"ArmatureManager.OnProfileChange profile {profile} priority changed, planning rebind for armature {armature}");
}
}
return;
}
if (type == ProfileChanged.Type.Toggled)
{
if (!profile.Enabled && profile.Armatures.Count == 0)