mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 19:36:28 +00:00
Rely on CS-Script includes for modules view model matching
This commit is contained in:
1 parent
36b8ddc023
commit
2f72cdb1d9
21 files changed
+301
-81
No files matched your search
@@ -1,10 +1,12 @@
|
||||
using System;
|
||||
using Artemis.Core.Events;
|
||||
|
||||
namespace Artemis.Core.Services.Interfaces
|
||||
{
|
||||
public interface ICoreService: IArtemisService, IDisposable
|
||||
public interface ICoreService : IArtemisService, IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates wether or not the core has been initialized
|
||||
/// </summary>
|
||||
bool IsInitialized { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
using Artemis.Core.Models;
|
||||
using Artemis.Plugins.Interfaces;
|
||||
|
||||
namespace Artemis.Core.Services.Interfaces
|
||||
{
|
||||
public interface IMainDataModelService : IArtemisService
|
||||
{
|
||||
/// <summary>
|
||||
/// Called each frame when the main data model must update
|
||||
/// </summary>
|
||||
/// <param name="deltaTime">Time since the last update</param>
|
||||
void Update(double deltaTime);
|
||||
|
||||
/// <summary>
|
||||
/// Add an expansion to the datamodel to be available for use after the next update
|
||||
/// </summary>
|
||||
/// <param name="dataModelExpansion"></param>
|
||||
void AddExpansion(IDataModelExpansion dataModelExpansion);
|
||||
|
||||
/// <summary>
|
||||
/// Remove a previously added expansion so that it is no longer available and updated
|
||||
/// </summary>
|
||||
/// <param name="dataModelExpansion"></param>
|
||||
void RemoveExpansion(IDataModelExpansion dataModelExpansion);
|
||||
|
||||
/// <summary>
|
||||
/// Generates a data model description for the main datamodel including all it's expansions
|
||||
/// </summary>
|
||||
/// <returns>The generated data model description</returns>
|
||||
DataModelDescription GetMainDataModelDescription();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using Artemis.Core.Exceptions;
|
||||
using Artemis.Core.Models;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using Artemis.Plugins.Interfaces;
|
||||
|
||||
namespace Artemis.Core.Services
|
||||
{
|
||||
public class MainDataModelService : IMainDataModelService
|
||||
{
|
||||
private readonly List<IDataModelExpansion> _dataModelExpansions;
|
||||
|
||||
public MainDataModelService()
|
||||
{
|
||||
_dataModelExpansions = new List<IDataModelExpansion>();
|
||||
}
|
||||
|
||||
public ReadOnlyCollection<IDataModelExpansion> DataModelExpansions
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (_dataModelExpansions)
|
||||
{
|
||||
return _dataModelExpansions.AsReadOnly();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(double deltaTime)
|
||||
{
|
||||
lock (_dataModelExpansions)
|
||||
{
|
||||
// Update all expansions
|
||||
foreach (var expansion in _dataModelExpansions)
|
||||
expansion.Update(deltaTime);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddExpansion(IDataModelExpansion dataModelExpansion)
|
||||
{
|
||||
lock (_dataModelExpansions)
|
||||
{
|
||||
_dataModelExpansions.Add(dataModelExpansion);
|
||||
// TODO SpoinkyNL 3-3-2018: Initialize the expansion and fire an event
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveExpansion(IDataModelExpansion dataModelExpansion)
|
||||
{
|
||||
lock (_dataModelExpansions)
|
||||
{
|
||||
if (!_dataModelExpansions.Contains(dataModelExpansion))
|
||||
throw new ArtemisCoreException("Cannot remove a data model expansion that wasn't previously added.");
|
||||
|
||||
// TODO SpoinkyNL 3-3-2018: Dispose the expansion and fire an event
|
||||
_dataModelExpansions.Remove(dataModelExpansion);
|
||||
}
|
||||
}
|
||||
|
||||
public DataModelDescription GetMainDataModelDescription()
|
||||
{
|
||||
var dataModelDescription = new DataModelDescription();
|
||||
|
||||
return dataModelDescription;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -58,7 +58,7 @@ namespace Artemis.Core.Services
|
||||
/// <inheritdoc />
|
||||
public async Task<IModuleViewModel> GetModuleViewModel(PluginInfo pluginInfo)
|
||||
{
|
||||
return await pluginInfo.GetModuleViewModel(_kernel);
|
||||
return pluginInfo.GetModuleViewModel(_kernel);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
||||
Reference in new issue
Block a user