mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 03:19:56 +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
4cfe71796c
commit
11de30318e
75 files changed
+1526
-934
No files matched your search
@@ -22,6 +22,12 @@ namespace Artemis.Core.DataModelExpansions
|
||||
[DataModelIgnore]
|
||||
public DataModelPropertyAttribute DataModelDescription { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the is expansion status indicating whether this data model expands the main data model
|
||||
/// </summary>
|
||||
[DataModelIgnore]
|
||||
public bool IsExpansion { get; internal set; }
|
||||
|
||||
public bool ContainsPath(string path)
|
||||
{
|
||||
var parts = path.Split('.');
|
||||
|
||||
@@ -10,7 +10,8 @@ namespace Artemis.Core.DataModelExpansions
|
||||
public abstract class DataModelExpansion<T> : BaseDataModelExpansion where T : DataModel
|
||||
{
|
||||
/// <summary>
|
||||
/// The data model driving this module
|
||||
/// The main data model of this data model expansion
|
||||
/// <para>Note: This default data model is automatically registered upon plugin enable</para>
|
||||
/// </summary>
|
||||
public T DataModel
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Ninject;
|
||||
|
||||
namespace Artemis.Core.LayerBrushes
|
||||
{
|
||||
@@ -41,5 +42,28 @@ namespace Artemis.Core.LayerBrushes
|
||||
/// The plugin that provided this <see cref="LayerBrushDescriptor" />
|
||||
/// </summary>
|
||||
public LayerBrushProvider LayerBrushProvider { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the kernel used to instantiate the described layer brush
|
||||
/// </summary>
|
||||
internal IKernel Kernel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance of the described brush and applies it to the layer
|
||||
/// </summary>
|
||||
internal void CreateInstance(Layer layer)
|
||||
{
|
||||
if (layer.LayerBrush != null)
|
||||
throw new ArtemisCoreException("Layer already has an instantiated layer brush");
|
||||
|
||||
var brush = (BaseLayerBrush) Kernel.Get(LayerBrushType);
|
||||
brush.Layer = layer;
|
||||
brush.Descriptor = this;
|
||||
brush.Initialize();
|
||||
brush.Update(0);
|
||||
|
||||
layer.LayerBrush = brush;
|
||||
layer.OnLayerBrushUpdated();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ namespace Artemis.Core.Modules
|
||||
{
|
||||
/// <summary>
|
||||
/// The data model driving this module
|
||||
/// <para>Note: This default data model is automatically registered upon plugin enable</para>
|
||||
/// </summary>
|
||||
public T DataModel
|
||||
{
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace Artemis.Core.Modules
|
||||
{
|
||||
/// <summary>
|
||||
/// The data model driving this module
|
||||
/// <para>Note: This default data model is automatically registered upon plugin enable</para>
|
||||
/// </summary>
|
||||
public T DataModel
|
||||
{
|
||||
@@ -118,7 +119,7 @@ namespace Artemis.Core.Modules
|
||||
/// Indicates whether or not a profile change is being animated
|
||||
/// </summary>
|
||||
public bool AnimatingProfileChange { get; private set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Called after the profile has updated
|
||||
/// </summary>
|
||||
|
||||
Reference in new issue
Block a user