mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Fixed enabled game effects not starting
This commit is contained in:
parent
f158acbb14
commit
2ffb94c099
@ -198,6 +198,9 @@
|
|||||||
<setting name="EnablePointersUpdate" serializeAs="String">
|
<setting name="EnablePointersUpdate" serializeAs="String">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
</setting>
|
</setting>
|
||||||
|
<setting name="GamestatePort" serializeAs="String">
|
||||||
|
<value>51364</value>
|
||||||
|
</setting>
|
||||||
</Artemis.Settings.General>
|
</Artemis.Settings.General>
|
||||||
</userSettings>
|
</userSettings>
|
||||||
<runtime>
|
<runtime>
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
public abstract class GameModel : EffectModel
|
public abstract class GameModel : EffectModel
|
||||||
{
|
{
|
||||||
public bool Enabled;
|
public abstract bool Enabled();
|
||||||
public string ProcessName;
|
public string ProcessName;
|
||||||
|
|
||||||
protected GameModel(MainModel mainModel) : base(mainModel)
|
protected GameModel(MainModel mainModel) : base(mainModel)
|
||||||
|
|||||||
@ -107,7 +107,7 @@ namespace Artemis.Models
|
|||||||
// Game models are only used if they are enabled
|
// Game models are only used if they are enabled
|
||||||
var gameModel = effectModel as GameModel;
|
var gameModel = effectModel as GameModel;
|
||||||
if (gameModel != null)
|
if (gameModel != null)
|
||||||
if (!gameModel.Enabled)
|
if (!gameModel.Enabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ActiveEffect != null && effectModel.Name == ActiveEffect.Name)
|
if (ActiveEffect != null && effectModel.Name == ActiveEffect.Name)
|
||||||
|
|||||||
@ -14,11 +14,11 @@ namespace Artemis.Modules.Games.CounterStrike
|
|||||||
{
|
{
|
||||||
public class CounterStrikeModel : GameModel
|
public class CounterStrikeModel : GameModel
|
||||||
{
|
{
|
||||||
private readonly CounterStrikeSettings _counterStrikeSettings;
|
private readonly CounterStrikeSettings _settings;
|
||||||
|
|
||||||
public CounterStrikeModel(MainModel mainModel, CounterStrikeSettings counterStrikeSettings) : base(mainModel)
|
public CounterStrikeModel(MainModel mainModel, CounterStrikeSettings settings) : base(mainModel)
|
||||||
{
|
{
|
||||||
_counterStrikeSettings = counterStrikeSettings;
|
_settings = settings;
|
||||||
Name = "CounterStrike";
|
Name = "CounterStrike";
|
||||||
ProcessName = "csgo";
|
ProcessName = "csgo";
|
||||||
Scale = 4;
|
Scale = 4;
|
||||||
@ -34,6 +34,11 @@ namespace Artemis.Modules.Games.CounterStrike
|
|||||||
|
|
||||||
public int Scale { get; set; }
|
public int Scale { get; set; }
|
||||||
|
|
||||||
|
public override bool Enabled()
|
||||||
|
{
|
||||||
|
return _settings.Enabled;
|
||||||
|
}
|
||||||
|
|
||||||
public override void Dispose()
|
public override void Dispose()
|
||||||
{
|
{
|
||||||
MainModel.GameStateWebServer.GameDataReceived -= HandleGameData;
|
MainModel.GameStateWebServer.GameDataReceived -= HandleGameData;
|
||||||
@ -42,9 +47,12 @@ namespace Artemis.Modules.Games.CounterStrike
|
|||||||
public override void Enable()
|
public override void Enable()
|
||||||
{
|
{
|
||||||
// TODO: Size stuff
|
// TODO: Size stuff
|
||||||
AmmoRect = new KeyboardRectangle(MainModel.ActiveKeyboard, 0, 0, new List<Color>(), LinearGradientMode.Horizontal);
|
AmmoRect = new KeyboardRectangle(MainModel.ActiveKeyboard, 0, 0, new List<Color>(),
|
||||||
TeamRect = new KeyboardRectangle(MainModel.ActiveKeyboard, 0, 1 * Scale, new List<Color>(), LinearGradientMode.Horizontal);
|
LinearGradientMode.Horizontal) {Height = Scale};
|
||||||
EventRect = new KeyboardRectangle(MainModel.ActiveKeyboard, 0, 1 * Scale, new List<Color>(), LinearGradientMode.Horizontal);
|
TeamRect = new KeyboardRectangle(MainModel.ActiveKeyboard, 0, Scale, new List<Color>(),
|
||||||
|
LinearGradientMode.Horizontal) {Height = (MainModel.ActiveKeyboard.Height*Scale) - Scale};
|
||||||
|
EventRect = new KeyboardRectangle(MainModel.ActiveKeyboard, 0, Scale, new List<Color>(),
|
||||||
|
LinearGradientMode.Horizontal) {Height = (MainModel.ActiveKeyboard.Height*Scale) - Scale};
|
||||||
MainModel.GameStateWebServer.GameDataReceived += HandleGameData;
|
MainModel.GameStateWebServer.GameDataReceived += HandleGameData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,15 +61,15 @@ namespace Artemis.Modules.Games.CounterStrike
|
|||||||
if (CsJson == null)
|
if (CsJson == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_counterStrikeSettings.AmmoEnabled)
|
if (_settings.AmmoEnabled)
|
||||||
UpdateAmmo();
|
UpdateAmmo();
|
||||||
if (_counterStrikeSettings.TeamColorEnabled)
|
if (_settings.TeamColorEnabled)
|
||||||
UpdateTeam();
|
UpdateTeam();
|
||||||
if (_counterStrikeSettings.LowHpEnabled)
|
if (_settings.LowHpEnabled)
|
||||||
UpdateHealth();
|
UpdateHealth();
|
||||||
if (_counterStrikeSettings.FlashEnabled)
|
if (_settings.FlashEnabled)
|
||||||
UpdateFlash();
|
UpdateFlash();
|
||||||
if (_counterStrikeSettings.SmokeEnabled)
|
if (_settings.SmokeEnabled)
|
||||||
UpdateSmoke();
|
UpdateSmoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,8 +153,8 @@ namespace Artemis.Modules.Games.CounterStrike
|
|||||||
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>
|
AmmoRect.Colors = new List<Color>
|
||||||
{
|
{
|
||||||
ColorHelpers.ToDrawingColor(_counterStrikeSettings.AmmoMainColor),
|
ColorHelpers.ToDrawingColor(_settings.AmmoMainColor),
|
||||||
ColorHelpers.ToDrawingColor(_counterStrikeSettings.AmmoSecondaryColor)
|
ColorHelpers.ToDrawingColor(_settings.AmmoSecondaryColor)
|
||||||
};
|
};
|
||||||
|
|
||||||
// Low ammo indicator
|
// Low ammo indicator
|
||||||
@ -158,7 +166,7 @@ namespace Artemis.Modules.Games.CounterStrike
|
|||||||
|
|
||||||
public override Bitmap GenerateBitmap()
|
public override Bitmap GenerateBitmap()
|
||||||
{
|
{
|
||||||
var bitmap = new Bitmap(21*Scale, 6*Scale);
|
var bitmap = MainModel.ActiveKeyboard.KeyboardBitmap(Scale);
|
||||||
|
|
||||||
using (var g = Graphics.FromImage(bitmap))
|
using (var g = Graphics.FromImage(bitmap))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -10,6 +10,7 @@ namespace Artemis.Modules.Games.CounterStrike
|
|||||||
Load();
|
Load();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool Enabled { get; set; }
|
||||||
public string GameDirectory { get; set; }
|
public string GameDirectory { get; set; }
|
||||||
|
|
||||||
public bool AmmoEnabled { get; set; }
|
public bool AmmoEnabled { get; set; }
|
||||||
@ -23,6 +24,7 @@ namespace Artemis.Modules.Games.CounterStrike
|
|||||||
|
|
||||||
public override sealed void Load()
|
public override sealed void Load()
|
||||||
{
|
{
|
||||||
|
Enabled = CounterStrike.Default.Enabled;
|
||||||
GameDirectory = CounterStrike.Default.GameDirectory;
|
GameDirectory = CounterStrike.Default.GameDirectory;
|
||||||
|
|
||||||
AmmoEnabled = CounterStrike.Default.AmmoEnabled;
|
AmmoEnabled = CounterStrike.Default.AmmoEnabled;
|
||||||
@ -37,6 +39,7 @@ namespace Artemis.Modules.Games.CounterStrike
|
|||||||
|
|
||||||
public override sealed void Save()
|
public override sealed void Save()
|
||||||
{
|
{
|
||||||
|
CounterStrike.Default.Enabled = Enabled;
|
||||||
CounterStrike.Default.GameDirectory = GameDirectory;
|
CounterStrike.Default.GameDirectory = GameDirectory;
|
||||||
|
|
||||||
CounterStrike.Default.AmmoEnabled = AmmoEnabled;
|
CounterStrike.Default.AmmoEnabled = AmmoEnabled;
|
||||||
@ -53,6 +56,7 @@ namespace Artemis.Modules.Games.CounterStrike
|
|||||||
|
|
||||||
public override sealed void ToDefault()
|
public override sealed void ToDefault()
|
||||||
{
|
{
|
||||||
|
Enabled = true;
|
||||||
GameDirectory = string.Empty;
|
GameDirectory = string.Empty;
|
||||||
|
|
||||||
AmmoEnabled = true;
|
AmmoEnabled = true;
|
||||||
|
|||||||
@ -29,11 +29,15 @@ namespace Artemis.Modules.Games.RocketLeague
|
|||||||
Name = "RocketLeague";
|
Name = "RocketLeague";
|
||||||
ProcessName = "RocketLeague";
|
ProcessName = "RocketLeague";
|
||||||
Scale = 4;
|
Scale = 4;
|
||||||
Enabled = settings.Enabled;
|
|
||||||
|
|
||||||
_settings = settings;
|
_settings = settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool Enabled()
|
||||||
|
{
|
||||||
|
return _settings.Enabled;
|
||||||
|
}
|
||||||
|
|
||||||
public int Scale { get; set; }
|
public int Scale { get; set; }
|
||||||
|
|
||||||
public override void Dispose()
|
public override void Dispose()
|
||||||
|
|||||||
@ -25,12 +25,14 @@ namespace Artemis.Modules.Games.Witcher3
|
|||||||
Name = "Witcher3";
|
Name = "Witcher3";
|
||||||
ProcessName = "witcher3";
|
ProcessName = "witcher3";
|
||||||
Scale = 4;
|
Scale = 4;
|
||||||
|
|
||||||
Enabled = settings.Enabled;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Scale { get; set; }
|
public int Scale { get; set; }
|
||||||
|
|
||||||
|
public override bool Enabled()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
public override void Dispose()
|
public override void Dispose()
|
||||||
{
|
{
|
||||||
_process = null;
|
_process = null;
|
||||||
|
|||||||
@ -10,8 +10,6 @@ namespace Artemis.Modules.Overlays.VolumeDisplay
|
|||||||
{
|
{
|
||||||
public class VolumeDisplayModel : OverlayModel
|
public class VolumeDisplayModel : OverlayModel
|
||||||
{
|
{
|
||||||
private bool _enabled;
|
|
||||||
|
|
||||||
public VolumeDisplayModel(MainModel mainModel, VolumeDisplaySettings settings) : base(mainModel)
|
public VolumeDisplayModel(MainModel mainModel, VolumeDisplaySettings settings) : base(mainModel)
|
||||||
{
|
{
|
||||||
Settings = settings;
|
Settings = settings;
|
||||||
|
|||||||
12
Artemis/Artemis/Settings/General.Designer.cs
generated
12
Artemis/Artemis/Settings/General.Designer.cs
generated
@ -58,5 +58,17 @@ namespace Artemis.Settings {
|
|||||||
this["EnablePointersUpdate"] = value;
|
this["EnablePointersUpdate"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("51364")]
|
||||||
|
public int GamestatePort {
|
||||||
|
get {
|
||||||
|
return ((int)(this["GamestatePort"]));
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
this["GamestatePort"] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,5 +11,8 @@
|
|||||||
<Setting Name="EnablePointersUpdate" Type="System.Boolean" Scope="User">
|
<Setting Name="EnablePointersUpdate" Type="System.Boolean" Scope="User">
|
||||||
<Value Profile="(Default)">True</Value>
|
<Value Profile="(Default)">True</Value>
|
||||||
</Setting>
|
</Setting>
|
||||||
|
<Setting Name="GamestatePort" Type="System.Int32" Scope="User">
|
||||||
|
<Value Profile="(Default)">51364</Value>
|
||||||
|
</Setting>
|
||||||
</Settings>
|
</Settings>
|
||||||
</SettingsFile>
|
</SettingsFile>
|
||||||
15
Artemis/Artemis/Views/Flyouts/FlyoutSettingsView.xaml.cs
Normal file
15
Artemis/Artemis/Views/Flyouts/FlyoutSettingsView.xaml.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace Artemis.Views.Flyouts
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for FlyoutSettingsView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class FlyoutSettingsView : UserControl
|
||||||
|
{
|
||||||
|
public FlyoutSettingsView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user