mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Core - Added stores for the different register-able types
Profiles - Refactored large parts of the profile structure to use these stores
This commit is contained in:
1 parent
80d7d37f40
commit
ea9c6526d8
75 files changed
+1526
-934
No files matched your search
@@ -1,4 +1,8 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Artemis.Core.LayerBrushes;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
using Ninject;
|
||||
|
||||
namespace Artemis.Core.LayerEffects
|
||||
{
|
||||
@@ -41,5 +45,33 @@ namespace Artemis.Core.LayerEffects
|
||||
/// The plugin that provided this <see cref="LayerEffectDescriptor" />
|
||||
/// </summary>
|
||||
public LayerEffectProvider LayerEffectProvider { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the kernel used to instantiate the described layer effect
|
||||
/// </summary>
|
||||
internal IKernel Kernel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance of the described effect and applies it to the render element
|
||||
/// </summary>
|
||||
internal void CreateInstance(RenderProfileElement renderElement, LayerEffectEntity entity)
|
||||
{
|
||||
// Skip effects already on the element
|
||||
if (renderElement.LayerEffects.Any(e => e.EntityId == entity.Id))
|
||||
return;
|
||||
|
||||
var effect = (BaseLayerEffect) Kernel.Get(LayerEffectType);
|
||||
effect.ProfileElement = renderElement;
|
||||
effect.EntityId = entity.Id;
|
||||
effect.Order = entity.Order;
|
||||
effect.Name = entity.Name;
|
||||
effect.Enabled = entity.Enabled;
|
||||
effect.Descriptor = this;
|
||||
|
||||
effect.Initialize();
|
||||
effect.Update(0);
|
||||
|
||||
renderElement.ActivateLayerEffect(effect);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user