using System; using System.Collections.Generic; using Artemis.Core.Models.Surface; using Artemis.Core.Plugins.Abstract.DataModels; using Artemis.Core.Plugins.Abstract.DataModels.Attributes; using Artemis.Core.Plugins.Abstract.ViewModels; using SkiaSharp; namespace Artemis.Core.Plugins.Abstract { /// /// Allows you to add support for new games/applications while utilizing your own data model /// public abstract class Module : Module where T : DataModel { /// /// The data model driving this module /// public T DataModel { get => (T) InternalDataModel; internal set => InternalDataModel = value; } /// /// Gets or sets whether this module must also expand the main data model /// /// Note: If expanding the main data model is all you want your plugin to do, create a /// plugin instead. /// /// public bool ExpandsDataModel { get => InternalExpandsMainDataModel; set => InternalExpandsMainDataModel = value; } /// /// Override to provide your own data model description. By default this returns a description matching your plugin /// name and description /// /// public virtual DataModelPropertyAttribute GetDataModelDescription() { return new DataModelPropertyAttribute {Name = PluginInfo.Name, Description = PluginInfo.Description}; } internal override void InternalEnablePlugin() { DataModel = Activator.CreateInstance(); DataModel.PluginInfo = PluginInfo; DataModel.DataModelDescription = GetDataModelDescription(); base.InternalEnablePlugin(); } internal override void InternalDisablePlugin() { DataModel = null; base.InternalDisablePlugin(); } } /// /// Allows you to add support for new games/applications /// public abstract class Module : Plugin { internal DataModel InternalDataModel { get; set; } internal bool InternalExpandsMainDataModel { get; set; } /// /// The modules display name that's shown in the menu /// public string DisplayName { get; protected set; } /// /// The modules display icon that's shown in the menu see for available /// icons /// public string DisplayIcon { get; set; } /// /// Called each frame when the module must update /// /// Time since the last update public abstract void Update(double deltaTime); /// /// Called each frame when the module must render /// /// Time since the last render /// The RGB Surface to render to /// /// public abstract void Render(double deltaTime, ArtemisSurface surface, SKCanvas canvas, SKImageInfo canvasInfo); /// /// Called when the module's view model is being show, return view models here to create tabs for them /// /// public abstract IEnumerable GetViewModels(); } }