1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-12 21:38:38 +00:00

Added layers backend skeleton code

This commit is contained in:
SpoinkyNL 2016-03-17 23:10:49 +01:00
parent 266390975d
commit 0029a1b99e
8 changed files with 89 additions and 1 deletions

View File

@ -190,6 +190,10 @@
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Linq.Dynamic, Version=1.0.5840.25917, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\System.Linq.Dynamic.1.0.6\lib\net40\System.Linq.Dynamic.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
@ -249,6 +253,9 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="ArtemisBootstrapper.cs" />
<Compile Include="Components\Abstract\LayerComponent.cs" />
<Compile Include="Components\Layer.cs" />
<Compile Include="Components\LayerComposite.cs" />
<Compile Include="Events\ToggleEnabled.cs" />
<Compile Include="Events\ActiveEffectChanged.cs" />
<Compile Include="Events\ChangeBitmap.cs" />
@ -269,6 +276,8 @@
<Compile Include="Models\EffectModel.cs" />
<Compile Include="Models\EffectSettings.cs" />
<Compile Include="Models\GameSettings.cs" />
<Compile Include="Models\Interfaces\IGameDataModel.cs" />
<Compile Include="Models\LayerConditionModel.cs" />
<Compile Include="Modules\Effects\AmbientLightning\AmbientLightningEffectModel.cs" />
<Compile Include="Modules\Effects\AmbientLightning\AmbientLightningEffectSettings.cs" />
<Compile Include="Modules\Effects\AmbientLightning\AmbientLightningEffectView.xaml.cs">

View File

@ -0,0 +1,21 @@
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using Artemis.Models;
using Artemis.Models.Interfaces;
namespace Artemis.Components.Abstract
{
public abstract class LayerComponent
{
public string Name { get; set; }
public List<LayerConditionModel> ConditionModels { get; set; }
public bool ConditionsMet(IGameDataModel dataModel)
{
return ConditionModels.All(cm => cm.ConditionMet(dataModel));
}
public abstract void Draw(Graphics g);
}
}

View File

@ -0,0 +1,13 @@
using System.Drawing;
using Artemis.Components.Abstract;
namespace Artemis.Components
{
public class Layer : LayerComponent
{
public override void Draw(Graphics g)
{
// Read properties and draw accordingly
}
}
}

View File

@ -0,0 +1,17 @@
using System.Collections.Generic;
using System.Drawing;
using Artemis.Components.Abstract;
namespace Artemis.Components
{
public class LayerComposite : LayerComponent
{
public List<LayerComponent> LayerComponents { get; set; }
public override void Draw(Graphics g)
{
foreach (var layerComponent in LayerComponents)
layerComponent.Draw(g);
}
}
}

View File

@ -0,0 +1,6 @@
namespace Artemis.Models.Interfaces
{
public interface IGameDataModel
{
}
}

View File

@ -0,0 +1,20 @@
using System.Collections.Generic;
using System.Linq.Dynamic;
namespace Artemis.Models
{
public class LayerConditionModel
{
public string Field { get; set; }
public string Value { get; set; }
public string Operator { get; set; }
public bool ConditionMet(object subject)
{
// Put the subject in a list, allowing Dynamic Linq to be used.
var subjectList = new List<object> {subject};
var res = subjectList.Where($"s => s.{Field} {Operator} {Value}").Any();
return res;
}
}
}

View File

@ -1,8 +1,9 @@
using System.Collections.Generic;
using Artemis.Models.Interfaces;
namespace Artemis.Modules.Games.TheDivision
{
public class TheDivisionDataModel
public class TheDivisionDataModel : IGameDataModel
{
public List<DivisionPlayer> DivisionPlayers { get; set; }
public GrenadeState GrenadeState { get; set; }

View File

@ -18,6 +18,7 @@
<package id="SharpDX" version="3.0.2" targetFramework="net452" />
<package id="SharpDX.Direct3D11" version="3.0.2" targetFramework="net452" />
<package id="SharpDX.DXGI" version="3.0.2" targetFramework="net452" />
<package id="System.Linq.Dynamic" version="1.0.6" targetFramework="net452" />
<package id="VirtualInput" version="1.0.1" targetFramework="net452" />
<package id="WpfExceptionViewer" version="1.0.0.0" targetFramework="net452" />
</packages>