mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 03:19:56 +00:00
Plugins - Implemented features enable/disable UI
This commit is contained in:
1 parent
e812929215
commit
c146479393
38 files changed
+571
-164
No files matched your search
@@ -20,7 +20,7 @@ namespace Artemis.Core.DataModelExpansions
|
||||
/// </summary>
|
||||
public ReadOnlyCollection<PropertyInfo> HiddenProperties => HiddenPropertiesList.AsReadOnly();
|
||||
|
||||
internal DataModel InternalDataModel { get; set; }
|
||||
internal DataModel? InternalDataModel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Called each frame when the data model should update
|
||||
@@ -28,6 +28,12 @@ namespace Artemis.Core.DataModelExpansions
|
||||
/// <param name="deltaTime">Time in seconds since the last update</param>
|
||||
public abstract void Update(double deltaTime);
|
||||
|
||||
internal void InternalUpdate(double deltaTime)
|
||||
{
|
||||
if (InternalDataModel != null)
|
||||
Update(deltaTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override to provide your own data model description. By default this returns a description matching your plugin
|
||||
/// name and description
|
||||
|
||||
@@ -129,14 +129,15 @@ namespace Artemis.Core
|
||||
|
||||
internal void RemoveFeature(PluginFeature feature)
|
||||
{
|
||||
if (feature.IsEnabled)
|
||||
throw new ArtemisCoreException("Cannot remove an enabled feature from a plugin");
|
||||
|
||||
_features.Remove(feature);
|
||||
feature.InternalDisable();
|
||||
feature.Dispose();
|
||||
|
||||
OnFeatureRemoved(new PluginFeatureEventArgs(feature));
|
||||
}
|
||||
|
||||
|
||||
|
||||
internal void SetEnabled(bool enable)
|
||||
{
|
||||
if (IsEnabled == enable)
|
||||
|
||||
@@ -87,8 +87,8 @@ namespace Artemis.Core
|
||||
throw new ArtemisPluginLockException(LoadException);
|
||||
}
|
||||
|
||||
IsEnabled = true;
|
||||
CreateLockFile();
|
||||
IsEnabled = true;
|
||||
|
||||
// Allow up to 15 seconds for plugins to activate.
|
||||
// This means plugins that need more time should do their long running tasks in a background thread, which is intentional
|
||||
|
||||
Reference in new issue
Block a user