mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Layer brushes - Make enable-disable process consistent with plugins
This commit is contained in:
1 parent
6327107277
commit
33bb3ffa6c
37 files changed
+325
-128
No files matched your search
@@ -44,11 +44,16 @@ namespace Artemis.Core.Plugins.LayerBrush
|
||||
/// Gets a reference to the layer property group without knowing it's type
|
||||
/// </summary>
|
||||
public virtual LayerPropertyGroup BaseProperties => null;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Called when the brush is being removed from the layer
|
||||
/// Called when the layer brush is activated
|
||||
/// </summary>
|
||||
public abstract void Dispose();
|
||||
public abstract void EnableLayerBrush();
|
||||
|
||||
/// <summary>
|
||||
/// Called when the layer brush is deactivated
|
||||
/// </summary>
|
||||
public abstract void DisableLayerBrush();
|
||||
|
||||
/// <summary>
|
||||
/// Called before rendering every frame, write your update logic here
|
||||
@@ -67,6 +72,11 @@ namespace Artemis.Core.Plugins.LayerBrush
|
||||
/// </summary>
|
||||
/// <returns>Your RGB.NET brush</returns>
|
||||
internal abstract IBrush InternalGetBrush();
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
DisableLayerBrush();
|
||||
}
|
||||
}
|
||||
|
||||
public enum LayerBrushType
|
||||
|
||||
@@ -43,15 +43,5 @@ namespace Artemis.Core.Plugins.LayerBrush
|
||||
{
|
||||
InitializeProperties(layerService);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
}
|
||||
|
||||
public sealed override void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
|
||||
namespace Artemis.Core.Plugins.LayerBrush
|
||||
{
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
|
||||
namespace Artemis.Core.Plugins.LayerBrush
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Allows you to create one or more <see cref="LayerBrush" />s usable by profile layers.
|
||||
/// </summary>
|
||||
public abstract class LayerBrushProvider : Plugin
|
||||
{
|
||||
private readonly List<LayerBrushDescriptor> _layerBrushDescriptors;
|
||||
|
||||
protected LayerBrushProvider(PluginInfo pluginInfo) : base(pluginInfo)
|
||||
{
|
||||
_layerBrushDescriptors = new List<LayerBrushDescriptor>();
|
||||
}
|
||||
|
||||
public ReadOnlyCollection<LayerBrushDescriptor> LayerBrushDescriptors => _layerBrushDescriptors.AsReadOnly();
|
||||
|
||||
protected void AddLayerBrushDescriptor<T>(string displayName, string description, string icon) where T : BaseLayerBrush
|
||||
{
|
||||
_layerBrushDescriptors.Add(new LayerBrushDescriptor(displayName, description, icon, typeof(T), this));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,18 +39,11 @@ namespace Artemis.Core.Plugins.LayerBrush
|
||||
internal set => _properties = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when all layer properties in this brush have been initialized
|
||||
/// </summary>
|
||||
protected virtual void OnPropertiesInitialized()
|
||||
{
|
||||
}
|
||||
|
||||
internal void InitializeProperties(ILayerService layerService)
|
||||
{
|
||||
Properties = Activator.CreateInstance<T>();
|
||||
Properties.InitializeProperties(layerService, Layer, "LayerBrush.");
|
||||
OnPropertiesInitialized();
|
||||
EnableLayerBrush();
|
||||
PropertiesInitialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user