From 73788635454503bf7f1f52f706f056261ee650b2 Mon Sep 17 00:00:00 2001 From: Luke Anderson Date: Thu, 26 Dec 2019 12:08:46 +1030 Subject: [PATCH 01/10] Make ammo/health indicators only show during live rounds --- .../Project-Aurora/Profiles/CSGO/CSGOProfile.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Project-Aurora/Project-Aurora/Profiles/CSGO/CSGOProfile.cs b/Project-Aurora/Project-Aurora/Profiles/CSGO/CSGOProfile.cs index 8df13623e..7eb593ec8 100644 --- a/Project-Aurora/Project-Aurora/Profiles/CSGO/CSGOProfile.cs +++ b/Project-Aurora/Project-Aurora/Profiles/CSGO/CSGOProfile.cs @@ -1,5 +1,8 @@ -using Aurora.Settings; +using Aurora.Profiles.CSGO.GSI.Nodes; +using Aurora.Settings; using Aurora.Settings.Layers; +using Aurora.Settings.Overrides.Logic; +using Aurora.Settings.Overrides.Logic.Builder; using System; using System.Collections.Generic; using System.Drawing; @@ -43,7 +46,9 @@ public override void Reset() _MaxVariablePath = "100" }, - }), + }, new OverrideLogicBuilder() + .SetDynamicBoolean("_Enabled", new BooleanGSIEnum("Round/Phase", RoundPhase.Live)) + ), new Layer("Ammo Indicator", new PercentLayerHandler() { Properties = new PercentLayerHandlerProperties() @@ -61,7 +66,9 @@ public override void Reset() _VariablePath = "Player/Weapons/ActiveWeapon/AmmoClip", _MaxVariablePath = "Player/Weapons/ActiveWeapon/AmmoClipMax" }, - }), + }, new OverrideLogicBuilder() + .SetDynamicBoolean("_Enabled", new BooleanGSIEnum("Round/Phase", RoundPhase.Live)) + ), new Layer("CSGO Bomb Effect", new Layers.CSGOBombLayerHandler()), new Layer("CSGO Burning Effect", new Layers.CSGOBurningLayerHandler()), new Layer("CSGO Background", new Layers.CSGOBackgroundLayerHandler()) From d12312a0e8a70d22984c13b893ad0146bc2d93c4 Mon Sep 17 00:00:00 2001 From: Luke Anderson Date: Fri, 27 Dec 2019 13:14:03 +1030 Subject: [PATCH 02/10] Add new effects, customizations and enhancements to CS:GO --- .../Profiles/CSGO/CSGOApplication.cs | 1 + .../Profiles/CSGO/CSGOProfile.cs | 1 + .../CSGO/Layers/CSGOBackgroundLayerHandler.cs | 25 ++- .../CSGO/Layers/CSGOBombLayerHandler.cs | 34 ---- .../Layers/CSGOKillsIndicatorLayerHandler.cs | 4 +- .../Layers/CSGOWinningTeamLayerHandler.cs | 176 ++++++++++++++++++ .../Layers/Control_CSGOBackgroundLayer.xaml | 3 + .../Control_CSGOBackgroundLayer.xaml.cs | 10 + .../CSGO/Layers/Control_CSGOBombLayer.xaml | 17 +- .../CSGO/Layers/Control_CSGOBombLayer.xaml.cs | 21 --- .../Layers/Control_CSGOWinningTeamLayer.xaml | 16 ++ .../Control_CSGOWinningTeamLayer.xaml.cs | 79 ++++++++ .../Project-Aurora/Project-Aurora.csproj | 12 +- 13 files changed, 320 insertions(+), 79 deletions(-) create mode 100644 Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOWinningTeamLayerHandler.cs create mode 100644 Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/Control_CSGOWinningTeamLayer.xaml create mode 100644 Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/Control_CSGOWinningTeamLayer.xaml.cs diff --git a/Project-Aurora/Project-Aurora/Profiles/CSGO/CSGOApplication.cs b/Project-Aurora/Project-Aurora/Profiles/CSGO/CSGOApplication.cs index 34607b99d..2bb57aa6c 100644 --- a/Project-Aurora/Project-Aurora/Profiles/CSGO/CSGOApplication.cs +++ b/Project-Aurora/Project-Aurora/Profiles/CSGO/CSGOApplication.cs @@ -26,6 +26,7 @@ public CSGO() new LayerHandlerEntry("CSGOBurning", "CSGO Burning Effect Layer", typeof(CSGOBurningLayerHandler)), new LayerHandlerEntry("CSGOFlashbang", "CSGO Flashbang Layer", typeof(CSGOFlashbangLayerHandler)), new LayerHandlerEntry("CSGOTyping", "CSGO Typing Layer", typeof(CSGOTypingIndicatorLayerHandler)), + new LayerHandlerEntry("CSGOWinningTeam", "CSGO Winning Team Effect Layer", typeof(CSGOWinningTeamLayerHandler)), }; Global.LightingStateManager.RegisterLayerHandlers(extra, false); diff --git a/Project-Aurora/Project-Aurora/Profiles/CSGO/CSGOProfile.cs b/Project-Aurora/Project-Aurora/Profiles/CSGO/CSGOProfile.cs index 7eb593ec8..517e2350b 100644 --- a/Project-Aurora/Project-Aurora/Profiles/CSGO/CSGOProfile.cs +++ b/Project-Aurora/Project-Aurora/Profiles/CSGO/CSGOProfile.cs @@ -27,6 +27,7 @@ public override void Reset() new Layer("CSGO Typing Indicator", new Layers.CSGOTypingIndicatorLayerHandler()), new Layer("CSGO Kills Indicator", new Layers.CSGOKillIndicatorLayerHandler()), + new Layer("CSGO Winning Team Effect", new Layers.CSGOWinningTeamLayerHandler()), new Layer("CSGO Flashbang Effect", new Layers.CSGOFlashbangLayerHandler()), new Layer("Health Indicator", new PercentLayerHandler() { diff --git a/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOBackgroundLayerHandler.cs b/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOBackgroundLayerHandler.cs index cfd1a79f7..f7c44deb9 100644 --- a/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOBackgroundLayerHandler.cs +++ b/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOBackgroundLayerHandler.cs @@ -1,4 +1,5 @@ -using Aurora.EffectsEngine; + +using Aurora.EffectsEngine; using Aurora.Profiles.CSGO.GSI; using Aurora.Profiles.CSGO.GSI.Nodes; using Aurora.Settings; @@ -41,6 +42,11 @@ public class CSGOBackgroundLayerHandlerProperties : LayerHandlerProperties2Color [JsonIgnore] public double DimDelay { get { return Logic._DimDelay ?? _DimDelay ?? 0.0; } } + public int? _DimAmount { get; set; } + + [JsonIgnore] + public int DimAmount { get { return Logic._DimAmount ?? _DimAmount ?? 100; } } + public CSGOBackgroundLayerHandlerProperties() : base() { } public CSGOBackgroundLayerHandlerProperties(bool assign_default = false) : base(assign_default) { } @@ -50,10 +56,11 @@ public override void Default() base.Default(); this._DefaultColor = Color.FromArgb(158, 205, 255); - this._CTColor = Color.FromArgb(158, 205, 255); + this._CTColor = Color.FromArgb(33, 155, 221); this._TColor = Color.FromArgb(221, 99, 33); this._DimEnabled = true; this._DimDelay = 15; + this._DimAmount = 20; } } @@ -61,7 +68,7 @@ public override void Default() public class CSGOBackgroundLayerHandler : LayerHandler { private bool isDimming = false; - private double dim_value = 1.0; + private double dim_value = 100.0; private long dim_bg_at = 15; public CSGOBackgroundLayerHandler() : base() @@ -86,7 +93,7 @@ public override EffectLayer Render(IGameState state) { isDimming = false; dim_bg_at = Utils.Time.GetMillisecondsSinceEpoch() + (long)(this.Properties.DimDelay * 1000D); - dim_value = 1.0; + dim_value = 100.0; } Color bg_color = this.Properties.DefaultColor; @@ -108,12 +115,12 @@ public override EffectLayer Render(IGameState state) if (dim_bg_at <= Utils.Time.GetMillisecondsSinceEpoch() || csgostate.Player.State.Health == 0) { isDimming = true; - bg_color = Utils.ColorUtils.MultiplyColorByScalar(bg_color, getDimmingValue()); + bg_color = Utils.ColorUtils.MultiplyColorByScalar(bg_color, (getDimmingValue() / 100)); } else { isDimming = false; - dim_value = 1.0; + dim_value = 100.0; } } @@ -133,11 +140,11 @@ private double getDimmingValue() { if (isDimming && Properties.DimEnabled) { - dim_value -= 0.02; - return dim_value = (dim_value < 0.0 ? 0.0 : dim_value); + dim_value -= 2.0; + return dim_value = (dim_value < Math.Abs(Properties.DimAmount - 100) ? Math.Abs(Properties.DimAmount - 100) : dim_value); } else - return dim_value = 1.0; + return dim_value = 100.0; } } } \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOBombLayerHandler.cs b/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOBombLayerHandler.cs index 8674adc8b..8987f81d6 100644 --- a/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOBombLayerHandler.cs +++ b/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOBombLayerHandler.cs @@ -17,16 +17,6 @@ namespace Aurora.Profiles.CSGO.Layers { public class CSGOBombLayerHandlerProperties : LayerHandlerProperties2Color { - public Color? _CTColor { get; set; } - - [JsonIgnore] - public Color CTColor { get { return Logic._CTColor ?? _CTColor ?? Color.Empty; } } - - public Color? _TColor { get; set; } - - [JsonIgnore] - public Color TColor { get { return Logic._TColor ?? _TColor ?? Color.Empty; } } - public Color? _FlashColor { get; set; } [JsonIgnore] @@ -61,8 +51,6 @@ public override void Default() base.Default(); this._Sequence = new KeySequence(new Devices.DeviceKeys[] { Devices.DeviceKeys.NUM_LOCK, Devices.DeviceKeys.NUM_SLASH, Devices.DeviceKeys.NUM_ASTERISK, Devices.DeviceKeys.NUM_MINUS, Devices.DeviceKeys.NUM_SEVEN, Devices.DeviceKeys.NUM_EIGHT, Devices.DeviceKeys.NUM_NINE, Devices.DeviceKeys.NUM_PLUS, Devices.DeviceKeys.NUM_FOUR, Devices.DeviceKeys.NUM_FIVE, Devices.DeviceKeys.NUM_SIX, Devices.DeviceKeys.NUM_ONE, Devices.DeviceKeys.NUM_TWO, Devices.DeviceKeys.NUM_THREE, Devices.DeviceKeys.NUM_ZERO, Devices.DeviceKeys.NUM_PERIOD, Devices.DeviceKeys.NUM_ENTER }); - this._CTColor = Color.FromArgb(158, 205, 255); - this._TColor = Color.FromArgb(221, 99, 33); this._FlashColor = Color.FromArgb(255, 0, 0); this._PrimedColor = Color.FromArgb(0, 255, 0); this._DisplayWinningTeamColor = true; @@ -161,28 +149,6 @@ public override EffectLayer Render(IGameState state) if (Properties.PeripheralUse) bomb_effect_layer.Set(Devices.DeviceKeys.Peripheral, bombcolor); } - else if (csgostate.Round.Bomb == BombState.Defused) - { - bombtimer.Stop(); - if (Properties.DisplayWinningTeamColor) - { - bomb_effect_layer.Set(Properties.Sequence, Properties.CTColor); - - if (Properties.PeripheralUse) - bomb_effect_layer.Set(Devices.DeviceKeys.Peripheral, Properties.CTColor); - } - } - else if (csgostate.Round.Bomb == BombState.Exploded) - { - bombtimer.Stop(); - if (Properties.DisplayWinningTeamColor) - { - bomb_effect_layer.Set(Properties.Sequence, Properties.TColor); - - if (Properties.PeripheralUse) - bomb_effect_layer.Set(Devices.DeviceKeys.Peripheral, Properties.TColor); - } - } else { bombtimer.Stop(); diff --git a/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOKillsIndicatorLayerHandler.cs b/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOKillsIndicatorLayerHandler.cs index 76ae29a79..84c848ab8 100644 --- a/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOKillsIndicatorLayerHandler.cs +++ b/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOKillsIndicatorLayerHandler.cs @@ -36,8 +36,8 @@ public override void Default() base.Default(); this._Sequence = new KeySequence(new Devices.DeviceKeys[] { Devices.DeviceKeys.G1, Devices.DeviceKeys.G2, Devices.DeviceKeys.G3, Devices.DeviceKeys.G4, Devices.DeviceKeys.G5 }); - this._RegularKillColor = Color.FromArgb(0, 255, 0); - this._HeadshotKillColor = Color.FromArgb(255, 80, 0); + this._RegularKillColor = Color.FromArgb(255, 204, 0); + this._HeadshotKillColor = Color.FromArgb(255, 0, 0); } } diff --git a/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOWinningTeamLayerHandler.cs b/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOWinningTeamLayerHandler.cs new file mode 100644 index 000000000..398fff775 --- /dev/null +++ b/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOWinningTeamLayerHandler.cs @@ -0,0 +1,176 @@ +using Aurora.EffectsEngine; +using Aurora.EffectsEngine.Animations; +using Aurora.Profiles.CSGO.GSI; +using Aurora.Profiles.CSGO.GSI.Nodes; +using Aurora.Settings; +using Aurora.Settings.Layers; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Controls; + +namespace Aurora.Profiles.CSGO.Layers +{ + public class CSGOWinningTeamLayerHandlerProperties : LayerHandlerProperties2Color + { + public Color? _CTColor { get; set; } + + [JsonIgnore] + public Color CTColor { get { return Logic._CTColor ?? _CTColor ?? Color.Empty; } } + + public Color? _TColor { get; set; } + + [JsonIgnore] + public Color TColor { get { return Logic._TColor ?? _TColor ?? Color.Empty; } } + + public CSGOWinningTeamLayerHandlerProperties() : base() { } + + public CSGOWinningTeamLayerHandlerProperties(bool assign_default = false) : base(assign_default) { } + + public override void Default() + { + base.Default(); + + this._CTColor = Color.FromArgb(33, 155, 221); + this._TColor = Color.FromArgb(221, 99, 33); + } + + } + + public class CSGOWinningTeamLayerHandler : LayerHandler + { + private readonly AnimationTrack[] tracks = + { + new AnimationTrack("Winning Team Track 0", 1.0f, 0.0f), + new AnimationTrack("Winning Team Track 1", 1.0f, 1.0f), + new AnimationTrack("Winning Team Track 2", 1.0f, 2.0f), + new AnimationTrack("Winning Team Track 3", 1.0f, 3.0f), + new AnimationTrack("Winning Team Track 4", 1.0f, 4.0f) + }; + + private long previoustime = 0; + private long currenttime = 0; + + private static float winningTeamEffect_Keyframe = 0.0f; + private const float winningTeamEffect_AnimationTime = 5.0f; + + private bool showAnimation = false; + + public CSGOWinningTeamLayerHandler() : base() + { + _ID = "CSGOWinningTeam"; + } + + protected override UserControl CreateControl() + { + return new Control_CSGOWinningTeamLayer(this); + } + + public override EffectLayer Render(IGameState state) + { + previoustime = currenttime; + currenttime = Utils.Time.GetMillisecondsSinceEpoch(); + + EffectLayer effectLayer = new EffectLayer("CSGO - Winning Team Effect"); + AnimationMix animationMix = new AnimationMix(); + + if (state is GameState_CSGO) + { + GameState_CSGO csgostate = state as GameState_CSGO; + + // Block animations after end of round + if (csgostate.Map.Phase == MapPhase.Undefined || csgostate.Round.Phase != RoundPhase.Over) + { + return effectLayer; + } + + Color color = Color.White; + + // Triggers directly after a team wins a round + if (csgostate.Round.WinTeam != RoundWinTeam.Undefined && csgostate.Previously.Round.WinTeam == RoundWinTeam.Undefined) + { + // Determine round or game winner + if (csgostate.Map.Phase == MapPhase.GameOver) + { + // End of match + int tScore = csgostate.Map.TeamT.Score; + int ctScore = csgostate.Map.TeamCT.Score; + + if (tScore > ctScore) + { + color = Properties.TColor; + } + else if (ctScore > tScore) + { + color = Properties.CTColor; + } + } + else + { + // End of round + if (csgostate.Round.WinTeam == RoundWinTeam.T) color = Properties.TColor; + if (csgostate.Round.WinTeam == RoundWinTeam.CT) color = Properties.CTColor; + } + + this.SetTracks(color); + animationMix.Clear(); + showAnimation = true; + } + + if (showAnimation) + { + animationMix = new AnimationMix(tracks); + + effectLayer.Fill(color); + animationMix.Draw(effectLayer.GetGraphics(), winningTeamEffect_Keyframe); + winningTeamEffect_Keyframe += (currenttime - previoustime) / 1000.0f; + + if (winningTeamEffect_Keyframe >= winningTeamEffect_AnimationTime) + { + showAnimation = false; + winningTeamEffect_Keyframe = 0; + } + } + } + + return effectLayer; + } + + public override void SetApplication(Application profile) + { + (Control as Control_CSGOWinningTeamLayer).SetProfile(profile); + base.SetApplication(profile); + } + + private void SetTracks(Color playerColor) + { + for (int i = 0; i < tracks.Length; i++) + { + tracks[i].SetFrame( + 0.0f, + new AnimationCircle( + (int)(Effects.canvas_width_center * 0.9), + Effects.canvas_height_center, + 0, + Color.Black, + 4) + ); + + tracks[i].SetFrame( + 1.0f, + new AnimationCircle( + (int)(Effects.canvas_width_center * 0.9), + Effects.canvas_height_center, + Effects.canvas_biggest / 2.0f, + Color.Black, + 4) + ); + } + } + } +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/Control_CSGOBackgroundLayer.xaml b/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/Control_CSGOBackgroundLayer.xaml index 9d1ed66aa..83921edd1 100644 --- a/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/Control_CSGOBackgroundLayer.xaml +++ b/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/Control_CSGOBackgroundLayer.xaml @@ -17,5 +17,8 @@