mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 19:36:28 +00:00
Core - Added fading in and out of profiles
This commit is contained in:
1 parent
f30cc31ead
commit
194780b25c
6 files changed
+87
-3
No files matched your search
@@ -214,7 +214,12 @@ internal class ProfileService : IProfileService
|
||||
if (shouldBeActive && profileConfiguration.Profile == null && profileConfiguration.BrokenState != "Failed to activate profile")
|
||||
profileConfiguration.TryOrBreak(() => ActivateProfile(profileConfiguration), "Failed to activate profile");
|
||||
else if (!shouldBeActive && profileConfiguration.Profile != null)
|
||||
DeactivateProfile(profileConfiguration);
|
||||
{
|
||||
if (!profileConfiguration.FadeInAndOut || profileConfiguration.Profile.FadingStatus == FadingStatus.Disabled)
|
||||
DeactivateProfile(profileConfiguration);
|
||||
else if (profileConfiguration.Profile.FadingStatus == FadingStatus.Enabled)
|
||||
RequestDeactivation(profileConfiguration);
|
||||
}
|
||||
|
||||
profileConfiguration.Profile?.Update(deltaTime);
|
||||
}
|
||||
@@ -254,7 +259,7 @@ internal class ProfileService : IProfileService
|
||||
{
|
||||
ProfileConfiguration profileConfiguration = profileCategory.ProfileConfigurations[j];
|
||||
// Ensure all criteria are met before rendering
|
||||
if (!profileConfiguration.IsSuspended && !profileConfiguration.IsMissingModule && profileConfiguration.ActivationConditionMet)
|
||||
if (!profileConfiguration.IsSuspended && !profileConfiguration.IsMissingModule && (profileConfiguration.ActivationConditionMet || profileConfiguration.Profile?.FadingStatus == FadingStatus.FadingOut))
|
||||
profileConfiguration.Profile?.Render(canvas, SKPointI.Empty, null);
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -361,6 +366,16 @@ internal class ProfileService : IProfileService
|
||||
OnProfileDeactivated(new ProfileConfigurationEventArgs(profileConfiguration));
|
||||
}
|
||||
|
||||
public void RequestDeactivation(ProfileConfiguration profileConfiguration)
|
||||
{
|
||||
if (profileConfiguration.IsBeingEdited)
|
||||
throw new ArtemisCoreException("Cannot disable a profile that is being edited, that's rude");
|
||||
if (profileConfiguration.Profile == null)
|
||||
return;
|
||||
|
||||
profileConfiguration.Profile.FadeOut();
|
||||
}
|
||||
|
||||
public void DeleteProfile(ProfileConfiguration profileConfiguration)
|
||||
{
|
||||
DeactivateProfile(profileConfiguration);
|
||||
|
||||
Reference in new issue
Block a user