mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Added The Division skeleton code, Dota2 Logitech fixes
This commit is contained in:
parent
96eb3c1e6a
commit
c61908f36b
@ -3,6 +3,7 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<configSections>
|
<configSections>
|
||||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<section name="Artemis.Modules.Games.TheDivision.TheDivision" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||||
<section name="Artemis.Modules.Games.Dota2.Dota2" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
<section name="Artemis.Modules.Games.Dota2.Dota2" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||||
<section name="Artemis.Modules.Overlays.VolumeDisplay.VolumeDisplay" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
<section name="Artemis.Modules.Overlays.VolumeDisplay.VolumeDisplay" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||||
<section name="Artemis.Modules.Games.RocketLeague.RocketLeague" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
<section name="Artemis.Modules.Games.RocketLeague.RocketLeague" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||||
@ -23,6 +24,11 @@
|
|||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||||
</startup>
|
</startup>
|
||||||
<userSettings>
|
<userSettings>
|
||||||
|
<Artemis.Modules.Games.TheDivision.TheDivision>
|
||||||
|
<setting name="Enabled" serializeAs="String">
|
||||||
|
<value>True</value>
|
||||||
|
</setting>
|
||||||
|
</Artemis.Modules.Games.TheDivision.TheDivision>
|
||||||
<Artemis.Modules.Games.Dota2.Dota2>
|
<Artemis.Modules.Games.Dota2.Dota2>
|
||||||
<setting name="Enabled" serializeAs="String">
|
<setting name="Enabled" serializeAs="String">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
|
|||||||
@ -314,6 +314,17 @@
|
|||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Modules\Games\RocketLeague\RocketLeagueModel.cs" />
|
<Compile Include="Modules\Games\RocketLeague\RocketLeagueModel.cs" />
|
||||||
|
<Compile Include="Modules\Games\TheDivision\TheDivision.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
|
<DependentUpon>TheDivision.settings</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Modules\Games\TheDivision\TheDivisionModel.cs" />
|
||||||
|
<Compile Include="Modules\Games\TheDivision\TheDivisionSettings.cs" />
|
||||||
|
<Compile Include="Modules\Games\TheDivision\TheDivisionView.xaml.cs">
|
||||||
|
<DependentUpon>TheDivisionView.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Modules\Games\TheDivision\TheDivisionViewModel.cs" />
|
||||||
<Compile Include="Modules\Games\Witcher3\Witcher3Settings.cs" />
|
<Compile Include="Modules\Games\Witcher3\Witcher3Settings.cs" />
|
||||||
<Compile Include="Modules\Games\Witcher3\Witcher3.Designer.cs">
|
<Compile Include="Modules\Games\Witcher3\Witcher3.Designer.cs">
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
@ -466,6 +477,10 @@
|
|||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
<LastGenOutput>RocketLeague.Designer.cs</LastGenOutput>
|
<LastGenOutput>RocketLeague.Designer.cs</LastGenOutput>
|
||||||
</None>
|
</None>
|
||||||
|
<None Include="Modules\Games\TheDivision\TheDivision.settings">
|
||||||
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
|
<LastGenOutput>TheDivision.Designer.cs</LastGenOutput>
|
||||||
|
</None>
|
||||||
<None Include="Modules\Games\Witcher3\Witcher3.settings">
|
<None Include="Modules\Games\Witcher3\Witcher3.settings">
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
<LastGenOutput>Witcher3.Designer.cs</LastGenOutput>
|
<LastGenOutput>Witcher3.Designer.cs</LastGenOutput>
|
||||||
@ -506,6 +521,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Modules\Games\TheDivision\TheDivisionView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="Resources\Icons.xaml">
|
<Page Include="Resources\Icons.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
|
|||||||
@ -14,5 +14,7 @@ namespace Artemis.KeyboardProviders
|
|||||||
public string RegionName { get; set; }
|
public string RegionName { get; set; }
|
||||||
public Point TopLeft { get; set; }
|
public Point TopLeft { get; set; }
|
||||||
public Point BottomRight { get; set; }
|
public Point BottomRight { get; set; }
|
||||||
|
|
||||||
|
public Rectangle GetRectangle() => new Rectangle(TopLeft.X, TopLeft.Y, BottomRight.X - TopLeft.X, BottomRight.Y - TopLeft.Y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -18,8 +18,8 @@ namespace Artemis.KeyboardProviders.Logitech
|
|||||||
Width = 21;
|
Width = 21;
|
||||||
KeyboardRegions = new List<KeyboardRegion>
|
KeyboardRegions = new List<KeyboardRegion>
|
||||||
{
|
{
|
||||||
new KeyboardRegion("TopRow", new Point(0, 0), new Point(0, 16)),
|
new KeyboardRegion("TopRow", new Point(0, 0), new Point(16, 0)),
|
||||||
new KeyboardRegion("NumPad", new Point(0, 17), new Point(0, 25))
|
new KeyboardRegion("NumPad", new Point(17, 1), new Point(21, 6))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,27 +2,23 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
using System.Globalization;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Artemis.KeyboardProviders;
|
using Artemis.KeyboardProviders;
|
||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
|
using Artemis.Utilities;
|
||||||
using Artemis.Utilities.GameState;
|
using Artemis.Utilities.GameState;
|
||||||
using Artemis.Utilities.Keyboard;
|
using Artemis.Utilities.Keyboard;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
using Artemis.Modules.Games.Dota2;
|
|
||||||
using Artemis.Utilities;
|
|
||||||
|
|
||||||
namespace Artemis.Modules.Games.Dota2
|
namespace Artemis.Modules.Games.Dota2
|
||||||
{
|
{
|
||||||
class Dota2Model : GameModel
|
internal class Dota2Model : GameModel
|
||||||
{
|
{
|
||||||
|
private KeyboardRegion _keyPad;
|
||||||
|
|
||||||
private KeyboardRegion _topRow;
|
private KeyboardRegion _topRow;
|
||||||
private KeyboardRegion _keyPad;
|
|
||||||
public Dota2Model(MainManager mainManager, Dota2Settings settings) : base(mainManager)
|
public Dota2Model(MainManager mainManager, Dota2Settings settings) : base(mainManager)
|
||||||
{
|
{
|
||||||
Settings = settings;
|
Settings = settings;
|
||||||
@ -33,17 +29,6 @@ namespace Artemis.Modules.Games.Dota2
|
|||||||
Scale = 4;
|
Scale = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Variables
|
|
||||||
|
|
||||||
public Dota2Settings Settings { get; set; }
|
|
||||||
public Dota2DataModel.Rootobject D2Json { get; set; }
|
|
||||||
public int Scale { get; set; }
|
|
||||||
public KeyboardRectangle HealthRectangle { get; set; }
|
|
||||||
public KeyboardRectangle EventRectangle { get; set; }
|
|
||||||
public KeyboardRectangle DayCycleRectangle { get; set; }
|
|
||||||
public KeyboardRectangle ManaRectangle { get; set; }
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
public override void Dispose()
|
public override void Dispose()
|
||||||
{
|
{
|
||||||
@ -58,14 +43,14 @@ namespace Artemis.Modules.Games.Dota2
|
|||||||
_keyPad = MainManager.KeyboardManager.ActiveKeyboard.KeyboardRegions.First(r => r.RegionName == "NumPad");
|
_keyPad = MainManager.KeyboardManager.ActiveKeyboard.KeyboardRegions.First(r => r.RegionName == "NumPad");
|
||||||
HealthRectangle = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard
|
HealthRectangle = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard
|
||||||
, 0
|
, 0
|
||||||
, _topRow.TopLeft.X
|
, _topRow.BottomRight.Y*Scale
|
||||||
, new List<Color>()
|
, new List<Color>()
|
||||||
, LinearGradientMode.Horizontal)
|
, LinearGradientMode.Horizontal)
|
||||||
{Height = Scale, ContainedBrush = false};
|
{Height = Scale, ContainedBrush = false};
|
||||||
|
|
||||||
ManaRectangle = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard
|
ManaRectangle = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard
|
||||||
, 0
|
, 0
|
||||||
, _topRow.TopLeft.X+1
|
, (_topRow.BottomRight.Y + 1)*Scale
|
||||||
, new List<Color>()
|
, new List<Color>()
|
||||||
, LinearGradientMode.Horizontal)
|
, LinearGradientMode.Horizontal)
|
||||||
{Height = Scale, ContainedBrush = false};
|
{Height = Scale, ContainedBrush = false};
|
||||||
@ -75,17 +60,20 @@ namespace Artemis.Modules.Games.Dota2
|
|||||||
, _topRow.TopLeft.X + 2
|
, _topRow.TopLeft.X + 2
|
||||||
, new List<Color>()
|
, new List<Color>()
|
||||||
, LinearGradientMode.Horizontal)
|
, LinearGradientMode.Horizontal)
|
||||||
{Height = MainManager.KeyboardManager.ActiveKeyboard.Height*Scale - Scale
|
{
|
||||||
, Width = MainManager.KeyboardManager.ActiveKeyboard.Width*Scale-Scale-12};
|
Height = MainManager.KeyboardManager.ActiveKeyboard.Height*Scale - Scale
|
||||||
|
,
|
||||||
|
Width = MainManager.KeyboardManager.ActiveKeyboard.Width*Scale - Scale - 12
|
||||||
|
};
|
||||||
|
|
||||||
DayCycleRectangle = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard
|
DayCycleRectangle = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard
|
||||||
, _keyPad.BottomRight.X * 3
|
, _keyPad.TopLeft.X*Scale
|
||||||
, _keyPad.TopLeft.X
|
, _keyPad.TopLeft.Y*Scale
|
||||||
, new List<Color>()
|
, new List<Color>()
|
||||||
, LinearGradientMode.Horizontal)
|
, LinearGradientMode.Horizontal)
|
||||||
{
|
{
|
||||||
Height = MainManager.KeyboardManager.ActiveKeyboard.Height*Scale - Scale,
|
Height = _keyPad.GetRectangle().Height*Scale,
|
||||||
Width = MainManager.KeyboardManager.ActiveKeyboard.Width - (MainManager.KeyboardManager.ActiveKeyboard.Width * Scale - Scale - 12)
|
Width = _keyPad.GetRectangle().Width*Scale
|
||||||
};
|
};
|
||||||
MainManager.GameStateWebServer.GameDataReceived += HandleGameData;
|
MainManager.GameStateWebServer.GameDataReceived += HandleGameData;
|
||||||
Initialized = true;
|
Initialized = true;
|
||||||
@ -112,9 +100,6 @@ namespace Artemis.Modules.Games.Dota2
|
|||||||
UpdateMana();
|
UpdateMana();
|
||||||
if (Settings.CanCastItem)
|
if (Settings.CanCastItem)
|
||||||
UpdateItems();
|
UpdateItems();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateMainColor()
|
private void UpdateMainColor()
|
||||||
@ -133,12 +118,10 @@ namespace Artemis.Modules.Games.Dota2
|
|||||||
DayCycleRectangle.Colors = list;
|
DayCycleRectangle.Colors = list;
|
||||||
HealthRectangle.Colors = list;
|
HealthRectangle.Colors = list;
|
||||||
ManaRectangle.Colors = list;
|
ManaRectangle.Colors = list;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateDay()
|
private void UpdateDay()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (D2Json?.map?.daytime == null)
|
if (D2Json?.map?.daytime == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -148,11 +131,13 @@ namespace Artemis.Modules.Games.Dota2
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var timeLeft = 240 - (D2Json.map.clock_time % 240);
|
var timeLeft = 240 - D2Json.map.clock_time%240;
|
||||||
double width = (int) ((MainManager.KeyboardManager.ActiveKeyboard.Width*Scale - (MainManager.KeyboardManager.ActiveKeyboard.Width * Scale - Scale*Scale)) * (timeLeft/240D)) ;
|
var timePercentage = 100.00/240*timeLeft;
|
||||||
DayCycleRectangle.Width = (int) (width/2) > 1 ? (int)(width / 2)+1 : (int)(width / 2);
|
var test = _keyPad.GetRectangle().Width;
|
||||||
DayCycleRectangle.Colors = D2Json.map.daytime ? new List<Color> { Color.Yellow } : new List<Color> { Color.Blue };
|
DayCycleRectangle.Width = (int) (_keyPad.GetRectangle().Width*Scale/100.00*timePercentage);
|
||||||
|
DayCycleRectangle.Colors = D2Json.map.daytime
|
||||||
|
? new List<Color> {Color.Yellow}
|
||||||
|
: new List<Color> {Color.Blue};
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateMana()
|
private void UpdateMana()
|
||||||
@ -162,7 +147,7 @@ namespace Artemis.Modules.Games.Dota2
|
|||||||
|
|
||||||
var manaPercent = D2Json.hero.mana_percent;
|
var manaPercent = D2Json.hero.mana_percent;
|
||||||
ManaRectangle.Colors = new List<Color> {ColorHelpers.ToDrawingColor(Settings.ManaColor)};
|
ManaRectangle.Colors = new List<Color> {ColorHelpers.ToDrawingColor(Settings.ManaColor)};
|
||||||
ManaRectangle.Width = (int)Math.Floor(_topRow.BottomRight.Y / 100.00 * manaPercent) * Scale;
|
ManaRectangle.Width = (int) Math.Floor(_topRow.GetRectangle().Width*Scale/100.00*manaPercent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateItems()
|
private void UpdateItems()
|
||||||
@ -172,7 +157,6 @@ namespace Artemis.Modules.Games.Dota2
|
|||||||
|
|
||||||
private void UpdateAbilities()
|
private void UpdateAbilities()
|
||||||
{
|
{
|
||||||
|
|
||||||
//Console.WriteLine();
|
//Console.WriteLine();
|
||||||
|
|
||||||
//Update keys according to the abilities they take.
|
//Update keys according to the abilities they take.
|
||||||
@ -192,8 +176,7 @@ namespace Artemis.Modules.Games.Dota2
|
|||||||
else
|
else
|
||||||
HealthRectangle.Colors = new List<Color> {Color.Red};
|
HealthRectangle.Colors = new List<Color> {Color.Red};
|
||||||
|
|
||||||
HealthRectangle.Width = (int)Math.Floor(_topRow.BottomRight.Y / 100.00 * healthPercent) * Scale;
|
HealthRectangle.Width = (int) Math.Floor(_topRow.GetRectangle().Width*Scale/100.00*healthPercent);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -208,13 +191,11 @@ namespace Artemis.Modules.Games.Dota2
|
|||||||
HealthRectangle.Draw(g);
|
HealthRectangle.Draw(g);
|
||||||
ManaRectangle.Draw(g);
|
ManaRectangle.Draw(g);
|
||||||
DayCycleRectangle.Draw(g);
|
DayCycleRectangle.Draw(g);
|
||||||
|
|
||||||
}
|
}
|
||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void HandleGameData(object sender, GameDataReceivedEventArgs e)
|
public void HandleGameData(object sender, GameDataReceivedEventArgs e)
|
||||||
{
|
{
|
||||||
var jsonString = e.Json.ToString();
|
var jsonString = e.Json.ToString();
|
||||||
@ -226,5 +207,17 @@ namespace Artemis.Modules.Games.Dota2
|
|||||||
// Parse the JSON
|
// Parse the JSON
|
||||||
D2Json = JsonConvert.DeserializeObject<Dota2DataModel.Rootobject>(jsonString);
|
D2Json = JsonConvert.DeserializeObject<Dota2DataModel.Rootobject>(jsonString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Variables
|
||||||
|
|
||||||
|
public Dota2Settings Settings { get; set; }
|
||||||
|
public Dota2DataModel.Rootobject D2Json { get; set; }
|
||||||
|
public int Scale { get; set; }
|
||||||
|
public KeyboardRectangle HealthRectangle { get; set; }
|
||||||
|
public KeyboardRectangle EventRectangle { get; set; }
|
||||||
|
public KeyboardRectangle DayCycleRectangle { get; set; }
|
||||||
|
public KeyboardRectangle ManaRectangle { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
38
Artemis/Artemis/Modules/Games/TheDivision/TheDivision.Designer.cs
generated
Normal file
38
Artemis/Artemis/Modules/Games/TheDivision/TheDivision.Designer.cs
generated
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace Artemis.Modules.Games.TheDivision {
|
||||||
|
|
||||||
|
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
|
||||||
|
internal sealed partial class TheDivision : global::System.Configuration.ApplicationSettingsBase {
|
||||||
|
|
||||||
|
private static TheDivision defaultInstance = ((TheDivision)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new TheDivision())));
|
||||||
|
|
||||||
|
public static TheDivision Default {
|
||||||
|
get {
|
||||||
|
return defaultInstance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||||
|
public bool Enabled {
|
||||||
|
get {
|
||||||
|
return ((bool)(this["Enabled"]));
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
this["Enabled"] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Artemis.Modules.Games.TheDivision" GeneratedClassName="TheDivision">
|
||||||
|
<Profiles />
|
||||||
|
<Settings>
|
||||||
|
<Setting Name="Enabled" Type="System.Boolean" Scope="User">
|
||||||
|
<Value Profile="(Default)">True</Value>
|
||||||
|
</Setting>
|
||||||
|
</Settings>
|
||||||
|
</SettingsFile>
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
using System.Drawing;
|
||||||
|
using Artemis.Managers;
|
||||||
|
using Artemis.Models;
|
||||||
|
|
||||||
|
namespace Artemis.Modules.Games.TheDivision
|
||||||
|
{
|
||||||
|
public class TheDivisionModel : GameModel
|
||||||
|
{
|
||||||
|
public TheDivisionModel(MainManager mainManager, TheDivisionSettings settings) : base(mainManager)
|
||||||
|
{
|
||||||
|
Settings = settings;
|
||||||
|
Name = "TheDivision";
|
||||||
|
ProcessName = "TheDivision";
|
||||||
|
Scale = 4;
|
||||||
|
Enabled = Settings.Enabled;
|
||||||
|
Initialized = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TheDivisionSettings Settings { get; set; }
|
||||||
|
|
||||||
|
public int Scale { get; set; }
|
||||||
|
|
||||||
|
public override void Dispose()
|
||||||
|
{
|
||||||
|
Initialized = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Enable()
|
||||||
|
{
|
||||||
|
Initialized = false;
|
||||||
|
|
||||||
|
// Enable logic, if any
|
||||||
|
|
||||||
|
Initialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Update()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Bitmap GenerateBitmap()
|
||||||
|
{
|
||||||
|
var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(Scale);
|
||||||
|
using (var g = Graphics.FromImage(bitmap))
|
||||||
|
{
|
||||||
|
g.Clear(Color.Transparent);
|
||||||
|
}
|
||||||
|
return bitmap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
using Artemis.Models;
|
||||||
|
|
||||||
|
namespace Artemis.Modules.Games.TheDivision
|
||||||
|
{
|
||||||
|
public class TheDivisionSettings : GameSettings
|
||||||
|
{
|
||||||
|
public TheDivisionSettings()
|
||||||
|
{
|
||||||
|
Load();
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed override void Load()
|
||||||
|
{
|
||||||
|
Enabled = TheDivision.Default.Enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed override void Save()
|
||||||
|
{
|
||||||
|
TheDivision.Default.Enabled = Enabled;
|
||||||
|
|
||||||
|
TheDivision.Default.Save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed override void ToDefault()
|
||||||
|
{
|
||||||
|
Enabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,54 @@
|
|||||||
|
<UserControl x:Class="Artemis.Modules.Games.TheDivision.TheDivisionView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:Artemis.Modules.Games.TheDivision"
|
||||||
|
xmlns:cal="http://www.caliburnproject.org"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="416.495" d:DesignWidth="553.608">
|
||||||
|
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
|
||||||
|
<Grid Margin="15, 5, 15, 5">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2">
|
||||||
|
<Label FontSize="20" HorizontalAlignment="Left">
|
||||||
|
<Label.Content>
|
||||||
|
<AccessText TextWrapping="Wrap"
|
||||||
|
Text="Shows lots of things, I should change this." />
|
||||||
|
</Label.Content>
|
||||||
|
</Label>
|
||||||
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||||
|
<Label Content="Enable effect" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
||||||
|
<ToggleButton x:Name="EffectEnabled" Margin="0 3 0 0" Width="25" Height="25"
|
||||||
|
IsChecked="{Binding Path=GameSettings.Enabled, Mode=TwoWay}"
|
||||||
|
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||||
|
cal:Message.Attach="[Event Click] = [Action ToggleEffect]" />
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center" Margin="0,8"
|
||||||
|
TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold"
|
||||||
|
Foreground="{DynamicResource HighlightBrush}" MaxWidth="510" TextAlignment="Justify">
|
||||||
|
Note: For this game to work with Artemis, please enable ... in The Division settings.
|
||||||
|
</TextBlock>
|
||||||
|
|
||||||
|
<!-- Buttons -->
|
||||||
|
<StackPanel Grid.Column="0" Grid.Row="4" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||||
|
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100"
|
||||||
|
Style="{DynamicResource SquareButtonStyle}" />
|
||||||
|
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100"
|
||||||
|
Margin="10,0,0,0"
|
||||||
|
Style="{DynamicResource SquareButtonStyle}" />
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</ScrollViewer>
|
||||||
|
</UserControl>
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace Artemis.Modules.Games.TheDivision
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for TheDivisionView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class TheDivisionView : UserControl
|
||||||
|
{
|
||||||
|
public TheDivisionView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
using Artemis.Managers;
|
||||||
|
using Artemis.ViewModels.Abstract;
|
||||||
|
|
||||||
|
namespace Artemis.Modules.Games.TheDivision
|
||||||
|
{
|
||||||
|
public class TheDivisionViewModel : GameViewModel
|
||||||
|
{
|
||||||
|
public TheDivisionViewModel(MainManager mainManager)
|
||||||
|
{
|
||||||
|
MainManager = mainManager;
|
||||||
|
|
||||||
|
// Settings are loaded from file by class
|
||||||
|
GameSettings = new TheDivisionSettings();
|
||||||
|
|
||||||
|
// Create effect model and add it to MainManager
|
||||||
|
GameModel = new TheDivisionModel(mainManager, (TheDivisionSettings) GameSettings);
|
||||||
|
MainManager.EffectManager.EffectModels.Add(GameModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string Name => "The Division";
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -33,8 +33,8 @@ namespace Artemis.Utilities.Keyboard
|
|||||||
_blinkWorker.DoWork += BlinkWorker_DoWork;
|
_blinkWorker.DoWork += BlinkWorker_DoWork;
|
||||||
|
|
||||||
Scale = 4;
|
Scale = 4;
|
||||||
X = x*Scale;
|
X = x;
|
||||||
Y = y*Scale;
|
Y = y;
|
||||||
Width = keyboard.Width*Scale;
|
Width = keyboard.Width*Scale;
|
||||||
Height = keyboard.Height*Scale;
|
Height = keyboard.Height*Scale;
|
||||||
Visible = true;
|
Visible = true;
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
using Artemis.Modules.Games.CounterStrike;
|
using Artemis.Modules.Games.CounterStrike;
|
||||||
using Artemis.Modules.Games.Dota2;
|
using Artemis.Modules.Games.Dota2;
|
||||||
using Artemis.Modules.Games.RocketLeague;
|
using Artemis.Modules.Games.RocketLeague;
|
||||||
|
using Artemis.Modules.Games.TheDivision;
|
||||||
using Artemis.Modules.Games.Witcher3;
|
using Artemis.Modules.Games.Witcher3;
|
||||||
using Caliburn.Micro;
|
using Caliburn.Micro;
|
||||||
|
|
||||||
@ -13,6 +14,7 @@ namespace Artemis.ViewModels
|
|||||||
private readonly Dota2ViewModel _dota2Vm;
|
private readonly Dota2ViewModel _dota2Vm;
|
||||||
private readonly RocketLeagueViewModel _rocketLeagueVm;
|
private readonly RocketLeagueViewModel _rocketLeagueVm;
|
||||||
private readonly Witcher3ViewModel _witcher3Vm;
|
private readonly Witcher3ViewModel _witcher3Vm;
|
||||||
|
private readonly TheDivisionViewModel _divisionVm;
|
||||||
|
|
||||||
public GamesViewModel(MainManager mainManager)
|
public GamesViewModel(MainManager mainManager)
|
||||||
{
|
{
|
||||||
@ -20,6 +22,7 @@ namespace Artemis.ViewModels
|
|||||||
_counterStrikeVm = new CounterStrikeViewModel(mainManager) {DisplayName = "CS:GO"};
|
_counterStrikeVm = new CounterStrikeViewModel(mainManager) {DisplayName = "CS:GO"};
|
||||||
_dota2Vm = new Dota2ViewModel(mainManager) {DisplayName = "Dota 2"};
|
_dota2Vm = new Dota2ViewModel(mainManager) {DisplayName = "Dota 2"};
|
||||||
_witcher3Vm = new Witcher3ViewModel(mainManager) {DisplayName = "The Witcher 3"};
|
_witcher3Vm = new Witcher3ViewModel(mainManager) {DisplayName = "The Witcher 3"};
|
||||||
|
_divisionVm = new TheDivisionViewModel(mainManager) {DisplayName = "The Division"};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnActivate()
|
protected override void OnActivate()
|
||||||
@ -30,6 +33,7 @@ namespace Artemis.ViewModels
|
|||||||
ActivateItem(_counterStrikeVm);
|
ActivateItem(_counterStrikeVm);
|
||||||
ActivateItem(_dota2Vm);
|
ActivateItem(_dota2Vm);
|
||||||
ActivateItem(_witcher3Vm);
|
ActivateItem(_witcher3Vm);
|
||||||
|
ActivateItem(_divisionVm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user