mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-12 21:38:38 +00:00
Implemented CS:GO settings
This commit is contained in:
parent
e464960118
commit
11d6cb63f2
@ -31,6 +31,27 @@
|
|||||||
<setting name="GameDirectory" serializeAs="String">
|
<setting name="GameDirectory" serializeAs="String">
|
||||||
<value>C:\Program Files (x86)\Steam\steamapps\common\Counter-Strike Global Offensive</value>
|
<value>C:\Program Files (x86)\Steam\steamapps\common\Counter-Strike Global Offensive</value>
|
||||||
</setting>
|
</setting>
|
||||||
|
<setting name="AmmoEnabled" serializeAs="String">
|
||||||
|
<value>True</value>
|
||||||
|
</setting>
|
||||||
|
<setting name="AmmoMainColor" serializeAs="String">
|
||||||
|
<value>#FFFF2900</value>
|
||||||
|
</setting>
|
||||||
|
<setting name="AmmoSecondaryColor" serializeAs="String">
|
||||||
|
<value>#FF26F600</value>
|
||||||
|
</setting>
|
||||||
|
<setting name="TeamColorEnabled" serializeAs="String">
|
||||||
|
<value>True</value>
|
||||||
|
</setting>
|
||||||
|
<setting name="FlashEnabled" serializeAs="String">
|
||||||
|
<value>True</value>
|
||||||
|
</setting>
|
||||||
|
<setting name="SmokeEnabled" serializeAs="String">
|
||||||
|
<value>True</value>
|
||||||
|
</setting>
|
||||||
|
<setting name="LowHpEnabled" serializeAs="String">
|
||||||
|
<value>True</value>
|
||||||
|
</setting>
|
||||||
</Artemis.Settings.CounterStrike>
|
</Artemis.Settings.CounterStrike>
|
||||||
<Artemis.Settings.VolumeDisplay>
|
<Artemis.Settings.VolumeDisplay>
|
||||||
<setting name="MainColor" serializeAs="String">
|
<setting name="MainColor" serializeAs="String">
|
||||||
|
|||||||
@ -174,6 +174,7 @@
|
|||||||
<Compile Include="Modules\Effects\TypeWave\TypeWaveModel.cs" />
|
<Compile Include="Modules\Effects\TypeWave\TypeWaveModel.cs" />
|
||||||
<Compile Include="Models\GameModel.cs" />
|
<Compile Include="Models\GameModel.cs" />
|
||||||
<Compile Include="Modules\Games\CounterStrike\CounterStrikeModel.cs" />
|
<Compile Include="Modules\Games\CounterStrike\CounterStrikeModel.cs" />
|
||||||
|
<Compile Include="Modules\Games\CounterStrike\CounterStrikeSettings.cs" />
|
||||||
<Compile Include="Modules\Games\RocketLeague\RocketLeagueModel.cs" />
|
<Compile Include="Modules\Games\RocketLeague\RocketLeagueModel.cs" />
|
||||||
<Compile Include="Modules\Games\Witcher3\Witcher3Model.cs" />
|
<Compile Include="Modules\Games\Witcher3\Witcher3Model.cs" />
|
||||||
<Compile Include="Models\MainModel.cs" />
|
<Compile Include="Models\MainModel.cs" />
|
||||||
|
|||||||
@ -6,9 +6,9 @@
|
|||||||
xmlns:cal="http://www.caliburnproject.org"
|
xmlns:cal="http://www.caliburnproject.org"
|
||||||
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
||||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||||
|
xmlns:audioVisualizer="clr-namespace:Artemis.Modules.Effects.AudioVisualizer"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="407.812" d:DesignWidth="671.484"
|
d:DesignHeight="407.812" d:DesignWidth="671.484"
|
||||||
d:DataContext="{d:DesignInstance Type=effects:AudioVisualizerViewModel, IsDesignTimeCreatable=True}"
|
|
||||||
cal:Bind.AtDesignTime="True">
|
cal:Bind.AtDesignTime="True">
|
||||||
<Grid Margin="15, 5, 15, 5">
|
<Grid Margin="15, 5, 15, 5">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
@ -26,7 +26,7 @@
|
|||||||
<Label FontSize="20"
|
<Label FontSize="20"
|
||||||
Style="{DynamicResource DescriptionHeaderStyle}" HorizontalAlignment="Left">
|
Style="{DynamicResource DescriptionHeaderStyle}" HorizontalAlignment="Left">
|
||||||
<Label.Content>
|
<Label.Content>
|
||||||
<AccessText TextWrapping="Wrap" Text="Visualizes the selected audio device on the keyboard." />
|
<AccessText TextWrapping="Wrap" Text="Visualizes the default audio device on the keyboard." />
|
||||||
</Label.Content>
|
</Label.Content>
|
||||||
</Label>
|
</Label>
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||||
@ -85,22 +85,6 @@
|
|||||||
SmallChange="7"
|
SmallChange="7"
|
||||||
IsSnapToTickEnabled="True" />
|
IsSnapToTickEnabled="True" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<!-- Spread slider -->
|
|
||||||
<StackPanel Grid.Row="3"
|
|
||||||
Grid.Column="0"
|
|
||||||
HorizontalAlignment="Left">
|
|
||||||
<Label FontSize="16" Content="Spread" Style="{DynamicResource DescriptionHeaderStyle}"
|
|
||||||
Foreground="#535353" FontFamily="Segoe UI Semibold" />
|
|
||||||
<Slider x:Name="Spread"
|
|
||||||
VerticalAlignment="top"
|
|
||||||
HorizontalAlignment="Left"
|
|
||||||
Width="132"
|
|
||||||
TickPlacement="BottomRight"
|
|
||||||
TickFrequency="1"
|
|
||||||
Value="{Binding Path=AudioVisualizerSettings.Spread, Mode=TwoWay}" Minimum="0" Maximum="4"
|
|
||||||
SmallChange="1"
|
|
||||||
IsSnapToTickEnabled="True" />
|
|
||||||
</StackPanel>
|
|
||||||
<!-- Fadeout slider -->
|
<!-- Fadeout slider -->
|
||||||
<StackPanel Grid.Row="3"
|
<StackPanel Grid.Row="3"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
|
|||||||
@ -52,10 +52,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer
|
|||||||
|
|
||||||
public void SaveSettings()
|
public void SaveSettings()
|
||||||
{
|
{
|
||||||
if (AudioVisualizerModel == null)
|
AudioVisualizerSettings?.Save();
|
||||||
return;
|
|
||||||
|
|
||||||
AudioVisualizerSettings.Save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResetSettings()
|
public void ResetSettings()
|
||||||
|
|||||||
@ -9,7 +9,6 @@
|
|||||||
xmlns:typeWave="clr-namespace:Artemis.Modules.Effects.TypeWave"
|
xmlns:typeWave="clr-namespace:Artemis.Modules.Effects.TypeWave"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="407.812" d:DesignWidth="671.484"
|
d:DesignHeight="407.812" d:DesignWidth="671.484"
|
||||||
d:DataContext="{d:DesignInstance Type=typeWave:TypeWaveViewModel, IsDesignTimeCreatable=True}"
|
|
||||||
cal:Bind.AtDesignTime="True">
|
cal:Bind.AtDesignTime="True">
|
||||||
<Grid Margin="15, 5, 15, 5">
|
<Grid Margin="15, 5, 15, 5">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
|
|||||||
@ -5,6 +5,7 @@ using System.Drawing;
|
|||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
|
using Artemis.Utilities;
|
||||||
using Artemis.Utilities.GameSense;
|
using Artemis.Utilities.GameSense;
|
||||||
using Artemis.Utilities.Keyboard;
|
using Artemis.Utilities.Keyboard;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@ -14,17 +15,20 @@ namespace Artemis.Modules.Games.CounterStrike
|
|||||||
{
|
{
|
||||||
public class CounterStrikeModel : GameModel
|
public class CounterStrikeModel : GameModel
|
||||||
{
|
{
|
||||||
|
private readonly CounterStrikeSettings _counterStrikeSettings;
|
||||||
private readonly MainModel _mainModel;
|
private readonly MainModel _mainModel;
|
||||||
|
|
||||||
// TODO: Make functional (CS' new gamestate intergration broke this)
|
// TODO: Make functional (CS' new gamestate intergration broke this)
|
||||||
public CounterStrikeModel(MainModel mainModel)
|
public CounterStrikeModel(CounterStrikeSettings counterStrikeSettings, MainModel mainModel)
|
||||||
{
|
{
|
||||||
|
_counterStrikeSettings = counterStrikeSettings;
|
||||||
_mainModel = mainModel;
|
_mainModel = mainModel;
|
||||||
Name = "CounterStrike";
|
Name = "CounterStrike";
|
||||||
ProcessName = "csgo";
|
ProcessName = "csgo";
|
||||||
Scale = 4;
|
Scale = 4;
|
||||||
|
|
||||||
AmmoRect = new KeyboardRectangle(Scale, 0, 0, 16*Scale, 1*Scale, new List<Color> {Color.Blue, Color.Red},
|
AmmoRect = new KeyboardRectangle(Scale, 0, 0, 16*Scale, 1*Scale,
|
||||||
|
new List<Color>(),
|
||||||
LinearGradientMode.Horizontal);
|
LinearGradientMode.Horizontal);
|
||||||
TeamRect = new KeyboardRectangle(Scale, 0, 1*Scale, 21*Scale, 8*Scale,
|
TeamRect = new KeyboardRectangle(Scale, 0, 1*Scale, 21*Scale, 8*Scale,
|
||||||
new List<Color>(),
|
new List<Color>(),
|
||||||
@ -59,11 +63,16 @@ namespace Artemis.Modules.Games.CounterStrike
|
|||||||
if (CsJson == null)
|
if (CsJson == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
UpdateAmmo();
|
if (_counterStrikeSettings.AmmoEnabled)
|
||||||
UpdateTeam();
|
UpdateAmmo();
|
||||||
UpdateHealth();
|
if (_counterStrikeSettings.TeamColorEnabled)
|
||||||
UpdateFlash();
|
UpdateTeam();
|
||||||
UpdateSmoke();
|
if (_counterStrikeSettings.LowHpEnabled)
|
||||||
|
UpdateHealth();
|
||||||
|
if (_counterStrikeSettings.FlashEnabled)
|
||||||
|
UpdateFlash();
|
||||||
|
if (_counterStrikeSettings.SmokeEnabled)
|
||||||
|
UpdateSmoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateHealth()
|
private void UpdateHealth()
|
||||||
@ -144,6 +153,11 @@ namespace Artemis.Modules.Games.CounterStrike
|
|||||||
|
|
||||||
var ammoPercentage = (int) Math.Ceiling(100.00/maxAmmo)*ammo;
|
var ammoPercentage = (int) Math.Ceiling(100.00/maxAmmo)*ammo;
|
||||||
AmmoRect.Width = ((int) Math.Floor((16/100.00)*ammoPercentage))*Scale;
|
AmmoRect.Width = ((int) Math.Floor((16/100.00)*ammoPercentage))*Scale;
|
||||||
|
AmmoRect.Colors = new List<Color>
|
||||||
|
{
|
||||||
|
ColorHelpers.MediaColorToDrawingColor(_counterStrikeSettings.AmmoMainColor),
|
||||||
|
ColorHelpers.MediaColorToDrawingColor(_counterStrikeSettings.AmmoSecondaryColor)
|
||||||
|
};
|
||||||
|
|
||||||
// Low ammo indicator
|
// Low ammo indicator
|
||||||
if (ammoPercentage < 37)
|
if (ammoPercentage < 37)
|
||||||
@ -174,8 +188,6 @@ namespace Artemis.Modules.Games.CounterStrike
|
|||||||
if (!jsonString.Contains("Counter-Strike: Global Offensive"))
|
if (!jsonString.Contains("Counter-Strike: Global Offensive"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
Debug.WriteLine(jsonString);
|
|
||||||
// Parse the JSON
|
// Parse the JSON
|
||||||
CsJson = JsonConvert.DeserializeObject<JObject>(jsonString);
|
CsJson = JsonConvert.DeserializeObject<JObject>(jsonString);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -3,9 +3,113 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
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"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="300" d:DesignWidth="300">
|
d:DesignHeight="475.61" d:DesignWidth="519.512">
|
||||||
<Grid>
|
<Grid Margin="15, 5, 15, 5">
|
||||||
<TextBlock Text="{Binding Content}" />
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="80" />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2">
|
||||||
|
<Label FontSize="20" Style="{DynamicResource DescriptionHeaderStyle}" HorizontalAlignment="Left">
|
||||||
|
<Label.Content>
|
||||||
|
<AccessText TextWrapping="Wrap"
|
||||||
|
Text="Shows verious game states and events on the keyboard." />
|
||||||
|
</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"
|
||||||
|
Style="{DynamicResource MetroCircleToggleButtonStyle}" />
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<StackPanel Grid.Row="1"
|
||||||
|
Grid.Column="0"
|
||||||
|
Grid.ColumnSpan="2">
|
||||||
|
<Label FontSize="16" Content="CS:GO Directory" Style="{DynamicResource DescriptionHeaderStyle}"
|
||||||
|
FontFamily="Segoe UI Semibold" Foreground="#535353" Width="130" HorizontalAlignment="Left" />
|
||||||
|
<Grid>
|
||||||
|
<TextBox x:Name="GameDirectory" Height="23" TextWrapping="Wrap" Margin="5,0,30,0" Text="{Binding Path=CounterStrikeSettings.GameDirectory, Mode=TwoWay}" cal:Message.Attach="[Event LostFocus] = [Action CheckGameDirectory]" />
|
||||||
|
<Button x:Name="BrowseDirectory" Content="..." RenderTransformOrigin="-0.039,-0.944" HorizontalAlignment="Right" Width="25"
|
||||||
|
Style="{DynamicResource SquareButtonStyle}" Height="25"/>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Row="2"
|
||||||
|
Grid.Column="0"
|
||||||
|
HorizontalAlignment="Left">
|
||||||
|
<controls:ToggleSwitch IsChecked="{Binding Path=CounterStrikeSettings.AmmoEnabled, Mode=TwoWay}"
|
||||||
|
Header="Ammo display"
|
||||||
|
OnLabel="Yes" OffLabel="No"
|
||||||
|
Margin="5,3,0,0" Width="125" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Row="3"
|
||||||
|
Grid.Column="0"
|
||||||
|
HorizontalAlignment="Left">
|
||||||
|
<Label FontSize="16" Content="Ammo main color" Style="{DynamicResource DescriptionHeaderStyle}"
|
||||||
|
FontFamily="Segoe UI Semibold" Foreground="#535353" Width="181" />
|
||||||
|
<xctk:ColorPicker x:Name="MainColor"
|
||||||
|
SelectedColor="{Binding Path=CounterStrikeSettings.AmmoMainColor, Mode=TwoWay}" Margin="5,0,0,0" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Row="3"
|
||||||
|
Grid.Column="1"
|
||||||
|
HorizontalAlignment="Left">
|
||||||
|
<Label FontSize="16" Content="Ammo secondary color" Style="{DynamicResource DescriptionHeaderStyle}"
|
||||||
|
FontFamily="Segoe UI Semibold" Foreground="#535353" Width="181" />
|
||||||
|
<xctk:ColorPicker x:Name="SecondaryColor"
|
||||||
|
SelectedColor="{Binding Path=CounterStrikeSettings.AmmoSecondaryColor, Mode=TwoWay}" Margin="5,0,0,0" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Row="4"
|
||||||
|
Grid.Column="0"
|
||||||
|
HorizontalAlignment="Left">
|
||||||
|
<controls:ToggleSwitch IsChecked="{Binding Path=CounterStrikeSettings.SmokeEnabled, Mode=TwoWay}"
|
||||||
|
Header="Smoked effect"
|
||||||
|
OnLabel="Yes" OffLabel="No"
|
||||||
|
Margin="5,3,0,0" Width="125" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Row="4"
|
||||||
|
Grid.Column="1"
|
||||||
|
HorizontalAlignment="Left">
|
||||||
|
<controls:ToggleSwitch IsChecked="{Binding Path=CounterStrikeSettings.FlashEnabled, Mode=TwoWay}"
|
||||||
|
Header="Flashed effect"
|
||||||
|
OnLabel="Yes" OffLabel="No"
|
||||||
|
Margin="5,3,0,0" Width="125" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Row="5"
|
||||||
|
Grid.Column="0"
|
||||||
|
HorizontalAlignment="Left">
|
||||||
|
<controls:ToggleSwitch IsChecked="{Binding Path=CounterStrikeSettings.TeamColorEnabled, Mode=TwoWay}"
|
||||||
|
Header="Team colors"
|
||||||
|
OnLabel="Yes" OffLabel="No"
|
||||||
|
Margin="5,3,0,0" Width="125" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Row="5"
|
||||||
|
Grid.Column="1"
|
||||||
|
HorizontalAlignment="Left">
|
||||||
|
<controls:ToggleSwitch IsChecked="{Binding Path=CounterStrikeSettings.LowHpEnabled, Mode=TwoWay}"
|
||||||
|
Header="Low HP effect"
|
||||||
|
OnLabel="Yes" OffLabel="No"
|
||||||
|
Margin="5,3,0,0" Width="125" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<StackPanel Grid.Column="0" Grid.Row="6" 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>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@ -1,27 +1,80 @@
|
|||||||
using Artemis.Models;
|
using System.IO;
|
||||||
using Caliburn.Micro;
|
using System.Windows.Forms;
|
||||||
|
using Artemis.Models;
|
||||||
|
using Screen = Caliburn.Micro.Screen;
|
||||||
|
|
||||||
namespace Artemis.Modules.Games.CounterStrike
|
namespace Artemis.Modules.Games.CounterStrike
|
||||||
{
|
{
|
||||||
public class CounterStrikeViewModel : Screen
|
public class CounterStrikeViewModel : Screen
|
||||||
{
|
{
|
||||||
|
private CounterStrikeSettings _counterStrikeSettings;
|
||||||
|
|
||||||
public CounterStrikeViewModel(MainModel mainModel)
|
public CounterStrikeViewModel(MainModel mainModel)
|
||||||
{
|
{
|
||||||
MainModel = mainModel;
|
MainModel = mainModel;
|
||||||
|
|
||||||
// Settings are loaded from file by class
|
// Settings are loaded from file by class
|
||||||
//CounterStrikeSettings = new CounterStrikeSettings();
|
CounterStrikeSettings = new CounterStrikeSettings();
|
||||||
|
|
||||||
// Create effect model and add it to MainModel
|
// Create effect model and add it to MainModel
|
||||||
CounterStrikeModel = new CounterStrikeModel(MainModel);
|
CounterStrikeModel = new CounterStrikeModel(CounterStrikeSettings, MainModel);
|
||||||
MainModel.EffectModels.Add(CounterStrikeModel);
|
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 CounterStrikeModel CounterStrikeModel { get; set; }
|
||||||
|
|
||||||
public MainModel MainModel { 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 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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8,7 +8,6 @@
|
|||||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="352.568" d:DesignWidth="490.332"
|
d:DesignHeight="352.568" d:DesignWidth="490.332"
|
||||||
d:DataContext="{d:DesignInstance Type=games:RocketLeagueViewModel, IsDesignTimeCreatable=True}"
|
|
||||||
cal:Bind.AtDesignTime="True">
|
cal:Bind.AtDesignTime="True">
|
||||||
|
|
||||||
<Grid Margin="15, 5, 15, 5">
|
<Grid Margin="15, 5, 15, 5">
|
||||||
|
|||||||
84
Artemis/Artemis/Settings/CounterStrike.Designer.cs
generated
84
Artemis/Artemis/Settings/CounterStrike.Designer.cs
generated
@ -34,5 +34,89 @@ namespace Artemis.Settings {
|
|||||||
this["GameDirectory"] = value;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,5 +5,26 @@
|
|||||||
<Setting Name="GameDirectory" Type="System.String" Scope="User">
|
<Setting Name="GameDirectory" Type="System.String" Scope="User">
|
||||||
<Value Profile="(Default)">C:\Program Files (x86)\Steam\steamapps\common\Counter-Strike Global Offensive</Value>
|
<Value Profile="(Default)">C:\Program Files (x86)\Steam\steamapps\common\Counter-Strike Global Offensive</Value>
|
||||||
</Setting>
|
</Setting>
|
||||||
|
<Setting Name="AmmoEnabled" Type="System.Boolean" Scope="User">
|
||||||
|
<Value Profile="(Default)">True</Value>
|
||||||
|
</Setting>
|
||||||
|
<Setting Name="AmmoMainColor" Type="System.Windows.Media.Color" Scope="User">
|
||||||
|
<Value Profile="(Default)">#FFFF2900</Value>
|
||||||
|
</Setting>
|
||||||
|
<Setting Name="AmmoSecondaryColor" Type="System.Windows.Media.Color" Scope="User">
|
||||||
|
<Value Profile="(Default)">#FF26F600</Value>
|
||||||
|
</Setting>
|
||||||
|
<Setting Name="TeamColorEnabled" Type="System.Boolean" Scope="User">
|
||||||
|
<Value Profile="(Default)">True</Value>
|
||||||
|
</Setting>
|
||||||
|
<Setting Name="FlashEnabled" Type="System.Boolean" Scope="User">
|
||||||
|
<Value Profile="(Default)">True</Value>
|
||||||
|
</Setting>
|
||||||
|
<Setting Name="SmokeEnabled" Type="System.Boolean" Scope="User">
|
||||||
|
<Value Profile="(Default)">True</Value>
|
||||||
|
</Setting>
|
||||||
|
<Setting Name="LowHpEnabled" Type="System.Boolean" Scope="User">
|
||||||
|
<Value Profile="(Default)">True</Value>
|
||||||
|
</Setting>
|
||||||
</Settings>
|
</Settings>
|
||||||
</SettingsFile>
|
</SettingsFile>
|
||||||
@ -12,7 +12,7 @@ namespace Artemis.ViewModels
|
|||||||
public GamesViewModel(MainModel mainModel)
|
public GamesViewModel(MainModel mainModel)
|
||||||
{
|
{
|
||||||
ActivateItem(new RocketLeagueViewModel(mainModel) {DisplayName = "Rocket League"});
|
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 Dota2ViewModel(mainModel) {DisplayName = "Dota 2 (NYI)"});
|
||||||
ActivateItem(new Witcher3ViewModel(mainModel) {DisplayName = "The Witcher 3"});
|
ActivateItem(new Witcher3ViewModel(mainModel) {DisplayName = "The Witcher 3"});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user