diff --git a/Artemis/Artemis/App.config b/Artemis/Artemis/App.config
index 5422855a9..6bdcc9d54 100644
--- a/Artemis/Artemis/App.config
+++ b/Artemis/Artemis/App.config
@@ -31,6 +31,27 @@
C:\Program Files (x86)\Steam\steamapps\common\Counter-Strike Global Offensive
+
+ True
+
+
+ #FFFF2900
+
+
+ #FF26F600
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
diff --git a/Artemis/Artemis/Artemis.csproj b/Artemis/Artemis/Artemis.csproj
index 3857362fe..bb293378d 100644
--- a/Artemis/Artemis/Artemis.csproj
+++ b/Artemis/Artemis/Artemis.csproj
@@ -174,6 +174,7 @@
+
diff --git a/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerView.xaml b/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerView.xaml
index 4eb9412cc..652434ca0 100644
--- a/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerView.xaml
+++ b/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerView.xaml
@@ -6,9 +6,9 @@
xmlns:cal="http://www.caliburnproject.org"
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
+ xmlns:audioVisualizer="clr-namespace:Artemis.Modules.Effects.AudioVisualizer"
mc:Ignorable="d"
d:DesignHeight="407.812" d:DesignWidth="671.484"
- d:DataContext="{d:DesignInstance Type=effects:AudioVisualizerViewModel, IsDesignTimeCreatable=True}"
cal:Bind.AtDesignTime="True">
@@ -26,7 +26,7 @@
@@ -85,22 +85,6 @@
SmallChange="7"
IsSnapToTickEnabled="True" />
-
-
-
-
-
diff --git a/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeModel.cs b/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeModel.cs
index 529651770..d9b2f8282 100644
--- a/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeModel.cs
+++ b/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeModel.cs
@@ -5,6 +5,7 @@ using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using Artemis.Models;
+using Artemis.Utilities;
using Artemis.Utilities.GameSense;
using Artemis.Utilities.Keyboard;
using Newtonsoft.Json;
@@ -14,17 +15,20 @@ namespace Artemis.Modules.Games.CounterStrike
{
public class CounterStrikeModel : GameModel
{
+ private readonly CounterStrikeSettings _counterStrikeSettings;
private readonly MainModel _mainModel;
// TODO: Make functional (CS' new gamestate intergration broke this)
- public CounterStrikeModel(MainModel mainModel)
+ public CounterStrikeModel(CounterStrikeSettings counterStrikeSettings, MainModel mainModel)
{
+ _counterStrikeSettings = counterStrikeSettings;
_mainModel = mainModel;
Name = "CounterStrike";
ProcessName = "csgo";
Scale = 4;
- AmmoRect = new KeyboardRectangle(Scale, 0, 0, 16*Scale, 1*Scale, new List {Color.Blue, Color.Red},
+ AmmoRect = new KeyboardRectangle(Scale, 0, 0, 16*Scale, 1*Scale,
+ new List(),
LinearGradientMode.Horizontal);
TeamRect = new KeyboardRectangle(Scale, 0, 1*Scale, 21*Scale, 8*Scale,
new List(),
@@ -59,11 +63,16 @@ namespace Artemis.Modules.Games.CounterStrike
if (CsJson == null)
return;
- UpdateAmmo();
- UpdateTeam();
- UpdateHealth();
- UpdateFlash();
- UpdateSmoke();
+ if (_counterStrikeSettings.AmmoEnabled)
+ UpdateAmmo();
+ if (_counterStrikeSettings.TeamColorEnabled)
+ UpdateTeam();
+ if (_counterStrikeSettings.LowHpEnabled)
+ UpdateHealth();
+ if (_counterStrikeSettings.FlashEnabled)
+ UpdateFlash();
+ if (_counterStrikeSettings.SmokeEnabled)
+ UpdateSmoke();
}
private void UpdateHealth()
@@ -144,6 +153,11 @@ namespace Artemis.Modules.Games.CounterStrike
var ammoPercentage = (int) Math.Ceiling(100.00/maxAmmo)*ammo;
AmmoRect.Width = ((int) Math.Floor((16/100.00)*ammoPercentage))*Scale;
+ AmmoRect.Colors = new List
+ {
+ ColorHelpers.MediaColorToDrawingColor(_counterStrikeSettings.AmmoMainColor),
+ ColorHelpers.MediaColorToDrawingColor(_counterStrikeSettings.AmmoSecondaryColor)
+ };
// Low ammo indicator
if (ammoPercentage < 37)
@@ -174,8 +188,6 @@ namespace Artemis.Modules.Games.CounterStrike
if (!jsonString.Contains("Counter-Strike: Global Offensive"))
return;
-
- Debug.WriteLine(jsonString);
// Parse the JSON
CsJson = JsonConvert.DeserializeObject(jsonString);
}
diff --git a/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeSettings.cs b/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeSettings.cs
new file mode 100644
index 000000000..de0681263
--- /dev/null
+++ b/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeSettings.cs
@@ -0,0 +1,68 @@
+using System.Windows.Media;
+using Artemis.Models;
+
+namespace Artemis.Modules.Games.CounterStrike
+{
+ public class CounterStrikeSettings : EffectSettings
+ {
+ public CounterStrikeSettings()
+ {
+ Load();
+ }
+
+ public string GameDirectory { get; set; }
+
+ public bool AmmoEnabled { get; set; }
+ public Color AmmoMainColor { get; set; }
+ public Color AmmoSecondaryColor { get; set; }
+
+ public bool TeamColorEnabled { get; set; }
+ public bool FlashEnabled { get; set; }
+ public bool SmokeEnabled { get; set; }
+ public bool LowHpEnabled { get; set; }
+
+ public override sealed void Load()
+ {
+ GameDirectory = Settings.CounterStrike.Default.GameDirectory;
+
+ AmmoEnabled = Settings.CounterStrike.Default.AmmoEnabled;
+ AmmoMainColor = Settings.CounterStrike.Default.AmmoMainColor;
+ AmmoSecondaryColor = Settings.CounterStrike.Default.AmmoSecondaryColor;
+
+ TeamColorEnabled = Settings.CounterStrike.Default.TeamColorEnabled;
+ FlashEnabled = Settings.CounterStrike.Default.FlashEnabled;
+ SmokeEnabled = Settings.CounterStrike.Default.SmokeEnabled;
+ LowHpEnabled = Settings.CounterStrike.Default.LowHpEnabled;
+ }
+
+ public override sealed void Save()
+ {
+ Settings.CounterStrike.Default.GameDirectory = GameDirectory;
+
+ Settings.CounterStrike.Default.AmmoEnabled = AmmoEnabled;
+ Settings.CounterStrike.Default.AmmoMainColor = AmmoMainColor;
+ Settings.CounterStrike.Default.AmmoSecondaryColor = AmmoSecondaryColor;
+
+ Settings.CounterStrike.Default.TeamColorEnabled = TeamColorEnabled;
+ Settings.CounterStrike.Default.FlashEnabled = FlashEnabled;
+ Settings.CounterStrike.Default.SmokeEnabled = SmokeEnabled;
+ Settings.CounterStrike.Default.LowHpEnabled = LowHpEnabled;
+
+ Settings.CounterStrike.Default.Save();
+ }
+
+ public override sealed void ToDefault()
+ {
+ GameDirectory = @"C:\Program Files (x86)\Steam\steamapps\common\Counter-Strike Global Offensive";
+
+ AmmoEnabled = true;
+ AmmoMainColor = Color.FromArgb(255, 38, 246, 0);
+ AmmoSecondaryColor = Color.FromArgb(255, 255, 41, 0);
+
+ TeamColorEnabled = true;
+ FlashEnabled = true;
+ SmokeEnabled = true;
+ LowHpEnabled = true;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeView.xaml b/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeView.xaml
index f0e71d099..87240a179 100644
--- a/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeView.xaml
+++ b/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeView.xaml
@@ -3,9 +3,113 @@
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:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
+ xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
+ xmlns:cal="http://www.caliburnproject.org"
mc:Ignorable="d"
- d:DesignHeight="300" d:DesignWidth="300">
-
-
+ d:DesignHeight="475.61" d:DesignWidth="519.512">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeViewModel.cs b/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeViewModel.cs
index 3c62ff4b8..cb5f3d9be 100644
--- a/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeViewModel.cs
+++ b/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeViewModel.cs
@@ -1,27 +1,80 @@
-using Artemis.Models;
-using Caliburn.Micro;
+using System.IO;
+using System.Windows.Forms;
+using Artemis.Models;
+using Screen = Caliburn.Micro.Screen;
namespace Artemis.Modules.Games.CounterStrike
{
public class CounterStrikeViewModel : Screen
{
+ private CounterStrikeSettings _counterStrikeSettings;
+
public CounterStrikeViewModel(MainModel mainModel)
{
MainModel = mainModel;
// Settings are loaded from file by class
- //CounterStrikeSettings = new CounterStrikeSettings();
+ CounterStrikeSettings = new CounterStrikeSettings();
// Create effect model and add it to MainModel
- CounterStrikeModel = new CounterStrikeModel(MainModel);
+ CounterStrikeModel = new CounterStrikeModel(CounterStrikeSettings, MainModel);
MainModel.EffectModels.Add(CounterStrikeModel);
}
+ public CounterStrikeSettings CounterStrikeSettings
+ {
+ get { return _counterStrikeSettings; }
+ set
+ {
+ if (Equals(value, _counterStrikeSettings)) return;
+ _counterStrikeSettings = value;
+ NotifyOfPropertyChange(() => CounterStrikeSettings);
+ }
+ }
+
public CounterStrikeModel CounterStrikeModel { get; set; }
public MainModel MainModel { get; set; }
- public static string Name => "CS:GO (NYI)";
+ public static string Name => "CS:GO";
public string Content => "Counter-Strike: GO Content";
+
+ public void BrowseDirectory()
+ {
+ var dialog = new FolderBrowserDialog {SelectedPath = CounterStrikeSettings.GameDirectory};
+ var result = dialog.ShowDialog();
+ if (result != DialogResult.OK)
+ return;
+
+ CounterStrikeSettings.GameDirectory = dialog.SelectedPath;
+ NotifyOfPropertyChange(() => CounterStrikeSettings);
+ CheckGameDirectory();
+ }
+
+ public void CheckGameDirectory()
+ {
+ if (Directory.Exists(CounterStrikeSettings.GameDirectory + "/csgo/cfg"))
+ return;
+
+ MessageBox.Show("Please select a valid CS:GO directory");
+ CounterStrikeSettings.GameDirectory = @"C:\Program Files (x86)\Steam\steamapps\common\Counter-Strike Global Offensive";
+ NotifyOfPropertyChange(() => CounterStrikeSettings);
+
+ // TODO: Place config file in CS dir
+ }
+
+ public void SaveSettings()
+ {
+ CounterStrikeSettings?.Save();
+ }
+
+ public void ResetSettings()
+ {
+ // TODO: Confirmation dialog (Generic MVVM approach)
+ CounterStrikeSettings.ToDefault();
+ NotifyOfPropertyChange(() => CounterStrikeSettings);
+
+ SaveSettings();
+ }
}
}
\ No newline at end of file
diff --git a/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeagueView.xaml b/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeagueView.xaml
index 637e7c5bf..187fd95a2 100644
--- a/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeagueView.xaml
+++ b/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeagueView.xaml
@@ -8,7 +8,6 @@
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
d:DesignHeight="352.568" d:DesignWidth="490.332"
- d:DataContext="{d:DesignInstance Type=games:RocketLeagueViewModel, IsDesignTimeCreatable=True}"
cal:Bind.AtDesignTime="True">
diff --git a/Artemis/Artemis/Settings/CounterStrike.Designer.cs b/Artemis/Artemis/Settings/CounterStrike.Designer.cs
index 02a6786cb..f5ef2a393 100644
--- a/Artemis/Artemis/Settings/CounterStrike.Designer.cs
+++ b/Artemis/Artemis/Settings/CounterStrike.Designer.cs
@@ -34,5 +34,89 @@ namespace Artemis.Settings {
this["GameDirectory"] = value;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("True")]
+ public bool AmmoEnabled {
+ get {
+ return ((bool)(this["AmmoEnabled"]));
+ }
+ set {
+ this["AmmoEnabled"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("#FFFF2900")]
+ public global::System.Windows.Media.Color AmmoMainColor {
+ get {
+ return ((global::System.Windows.Media.Color)(this["AmmoMainColor"]));
+ }
+ set {
+ this["AmmoMainColor"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("#FF26F600")]
+ public global::System.Windows.Media.Color AmmoSecondaryColor {
+ get {
+ return ((global::System.Windows.Media.Color)(this["AmmoSecondaryColor"]));
+ }
+ set {
+ this["AmmoSecondaryColor"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("True")]
+ public bool TeamColorEnabled {
+ get {
+ return ((bool)(this["TeamColorEnabled"]));
+ }
+ set {
+ this["TeamColorEnabled"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("True")]
+ public bool FlashEnabled {
+ get {
+ return ((bool)(this["FlashEnabled"]));
+ }
+ set {
+ this["FlashEnabled"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("True")]
+ public bool SmokeEnabled {
+ get {
+ return ((bool)(this["SmokeEnabled"]));
+ }
+ set {
+ this["SmokeEnabled"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("True")]
+ public bool LowHpEnabled {
+ get {
+ return ((bool)(this["LowHpEnabled"]));
+ }
+ set {
+ this["LowHpEnabled"] = value;
+ }
+ }
}
}
diff --git a/Artemis/Artemis/Settings/CounterStrike.settings b/Artemis/Artemis/Settings/CounterStrike.settings
index 01f5dc62a..7c4699118 100644
--- a/Artemis/Artemis/Settings/CounterStrike.settings
+++ b/Artemis/Artemis/Settings/CounterStrike.settings
@@ -5,5 +5,26 @@
C:\Program Files (x86)\Steam\steamapps\common\Counter-Strike Global Offensive
+
+ True
+
+
+ #FFFF2900
+
+
+ #FF26F600
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
\ No newline at end of file
diff --git a/Artemis/Artemis/ViewModels/GamesViewModel.cs b/Artemis/Artemis/ViewModels/GamesViewModel.cs
index 348d880ef..d35807cc9 100644
--- a/Artemis/Artemis/ViewModels/GamesViewModel.cs
+++ b/Artemis/Artemis/ViewModels/GamesViewModel.cs
@@ -12,7 +12,7 @@ namespace Artemis.ViewModels
public GamesViewModel(MainModel mainModel)
{
ActivateItem(new RocketLeagueViewModel(mainModel) {DisplayName = "Rocket League"});
- ActivateItem(new CounterStrikeViewModel(mainModel) {DisplayName = "CS:GO (NYI)"});
+ ActivateItem(new CounterStrikeViewModel(mainModel) {DisplayName = "CS:GO"});
ActivateItem(new Dota2ViewModel(mainModel) {DisplayName = "Dota 2 (NYI)"});
ActivateItem(new Witcher3ViewModel(mainModel) {DisplayName = "The Witcher 3"});
}