Merge branch 'feature/events' into master

This commit is contained in:
Robert Beekman authored and GitHub committed 2020-11-05 21:12:56 +01:00
commit 143dea4c4c
111 files changed
+3994 -2150

No files matched your search

+2 -2
View File
@@ -123,7 +123,7 @@ namespace Artemis.Core.Services
_introAnimation.Render(args.DeltaTime, args.Canvas, _rgbService.BitmapBrush.Bitmap.Info);
}
TimeSpan introLength = _introAnimation.AnimationProfile.GetAllLayers().Max(l => l.TimelineLength);
TimeSpan introLength = _introAnimation.AnimationProfile.GetAllLayers().Max(l => l.Timeline.Length);
// Stop rendering after the profile finishes (take 1 second extra in case of slow updates)
Task.Run(async () =>
@@ -146,7 +146,7 @@ namespace Artemis.Core.Services
{
JsonConvert.DefaultSettings = () => new JsonSerializerSettings
{
Converters = new List<JsonConverter> {new SKColorConverter()}
Converters = new List<JsonConverter> {new SKColorConverter(), new ForgivingIntConverter()}
};
}
+1 -2
View File
@@ -221,8 +221,7 @@ namespace Artemis.Core.Services
Type pluginType = pluginTypes.Single();
try
{
IParameter[] parameters = new IParameter[]
{
IParameter[] parameters = {
new Parameter("PluginInfo", pluginInfo, false)
};
pluginInfo.Kernel = new ChildKernel(_kernel);
@@ -72,6 +72,8 @@ namespace Artemis.Core.Services
// Colors
RegisterModifierType(Constants.CorePluginInfo, new SKColorSumModifierType());
RegisterModifierType(Constants.CorePluginInfo, new SKColorSaturateModifierType());
RegisterModifierType(Constants.CorePluginInfo, new SKColorDesaturateModifierType());
RegisterModifierType(Constants.CorePluginInfo, new SKColorBrightenModifierType());
RegisterModifierType(Constants.CorePluginInfo, new SKColorDarkenModifierType());
RegisterModifierType(Constants.CorePluginInfo, new SKColorRotateHueModifierType());
@@ -49,6 +49,11 @@ namespace Artemis.Core.Services
/// <param name="profileModule"></param>
void ActivateLastProfile(ProfileModule profileModule);
/// <summary>
/// Reloads the currently active profile on the provided profile module
/// </summary>
void ReloadProfile(ProfileModule module);
/// <summary>
/// Asynchronously activates the last profile of the given profile module using a fade animation
/// </summary>
@@ -82,6 +82,19 @@ namespace Artemis.Core.Services
return profile;
}
public void ReloadProfile(ProfileModule module)
{
if (module.ActiveProfile == null)
return;
ProfileEntity entity = _profileRepository.Get(module.ActiveProfile.EntityId);
Profile profile = new Profile(module, entity);
InstantiateProfile(profile);
module.ChangeActiveProfile(null, _surfaceService.ActiveSurface);
module.ChangeActiveProfile(profile, _surfaceService.ActiveSurface);
}
public async Task<Profile> ActivateProfileAnimated(ProfileDescriptor profileDescriptor)
{
if (profileDescriptor.ProfileModule.ActiveProfile?.EntityId == profileDescriptor.Id)