mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Modules - Added activation mechanism and conditions
This commit is contained in:
1 parent
2cf64df35d
commit
830ef33b0a
17 files changed
+357
-149
No files matched your search
@@ -2,18 +2,13 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Artemis.Core.Extensions;
|
||||
using Artemis.Core.Models.Profile;
|
||||
using Artemis.Core.Models.Surface;
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
using Artemis.Core.Plugins.Abstract.ViewModels;
|
||||
using Artemis.Core.Plugins.LayerBrush;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using Artemis.Core.Services.Storage.Interfaces;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Serilog;
|
||||
using SkiaSharp;
|
||||
|
||||
@@ -33,6 +28,17 @@ namespace Artemis.Core.Utilities
|
||||
CreateIntroProfile();
|
||||
}
|
||||
|
||||
public Profile AnimationProfile { get; set; }
|
||||
|
||||
public void Render(double deltaTime, SKCanvas canvas, SKImageInfo bitmapInfo)
|
||||
{
|
||||
if (AnimationProfile == null)
|
||||
return;
|
||||
|
||||
AnimationProfile.Update(deltaTime);
|
||||
AnimationProfile.Render(deltaTime, canvas, bitmapInfo);
|
||||
}
|
||||
|
||||
private void CreateIntroProfile()
|
||||
{
|
||||
try
|
||||
@@ -43,10 +49,10 @@ namespace Artemis.Core.Utilities
|
||||
// Inject every LED on the surface into each layer
|
||||
foreach (var profileEntityLayer in profileEntity.Layers)
|
||||
{
|
||||
profileEntityLayer.Leds.AddRange(_surfaceService.ActiveSurface.Devices.SelectMany(d => d.Leds).Select(l => new LedEntity()
|
||||
profileEntityLayer.Leds.AddRange(_surfaceService.ActiveSurface.Devices.SelectMany(d => d.Leds).Select(l => new LedEntity
|
||||
{
|
||||
DeviceIdentifier = l.Device.RgbDevice.GetDeviceIdentifier(),
|
||||
LedName = l.RgbLed.Id.ToString(),
|
||||
LedName = l.RgbLed.Id.ToString()
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -61,32 +67,33 @@ namespace Artemis.Core.Utilities
|
||||
_logger.Warning(e, "Failed to load intro profile");
|
||||
}
|
||||
}
|
||||
|
||||
public Profile AnimationProfile { get; set; }
|
||||
|
||||
public void Render(double deltaTime, SKCanvas canvas, SKImageInfo bitmapInfo)
|
||||
{
|
||||
if (AnimationProfile == null)
|
||||
return;
|
||||
|
||||
AnimationProfile.Update(deltaTime);
|
||||
AnimationProfile.Render(deltaTime, canvas, bitmapInfo);
|
||||
}
|
||||
}
|
||||
|
||||
internal class DummyModule : ProfileModule
|
||||
{
|
||||
public override void EnablePlugin()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override void DisablePlugin()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override void ModuleActivated()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override void ModuleDeactivated()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override IEnumerable<ModuleViewModel> GetViewModels()
|
||||
{
|
||||
return new List<ModuleViewModel>();
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user