-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1855 from stuntguy3000/fix-csgo
Fix ammo/health indicators & new effects and customizations to CS:GO
- Loading branch information
Showing
18 changed files
with
598 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
124 changes: 124 additions & 0 deletions
124
Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGODeathLayerHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
using Aurora.EffectsEngine; | ||
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 CSGODeathLayerHandlerProperties : LayerHandlerProperties2Color<CSGODeathLayerHandlerProperties> | ||
{ | ||
public Color? _DeathColor { get; set; } | ||
|
||
[JsonIgnore] | ||
public Color DeathColor { get { return Logic._DeathColor ?? _DeathColor ?? Color.Empty; } } | ||
|
||
public int? _FadeOutAfter { get; set; } | ||
|
||
[JsonIgnore] | ||
public int FadeOutAfter { get { return Logic._FadeOutAfter ?? _FadeOutAfter ?? 5; } } | ||
|
||
public CSGODeathLayerHandlerProperties() : base() { } | ||
|
||
public CSGODeathLayerHandlerProperties(bool assign_default = false) : base(assign_default) { } | ||
|
||
public override void Default() | ||
{ | ||
base.Default(); | ||
|
||
this._DeathColor = Color.Red; | ||
this._FadeOutAfter = 3; | ||
} | ||
|
||
} | ||
|
||
public class CSGODeathLayerHandler : LayerHandler<CSGODeathLayerHandlerProperties> | ||
{ | ||
private bool isDead = false; | ||
private long fadeStartAt = 15; | ||
private int fadeAlpha = 255; | ||
|
||
public CSGODeathLayerHandler() : base() | ||
{ | ||
_ID = "CSGODeathEffect"; | ||
} | ||
|
||
protected override UserControl CreateControl() | ||
{ | ||
return new Control_CSGODeathLayer(this); | ||
} | ||
|
||
public override EffectLayer Render(IGameState state) | ||
{ | ||
EffectLayer effectLayer = new EffectLayer("CSGO - Death Effect"); | ||
|
||
if (state is GameState_CSGO) | ||
{ | ||
GameState_CSGO gameState = state as GameState_CSGO; | ||
Color deathColor = this.Properties.DeathColor; | ||
|
||
// Confirm if CS:GO Player is correct | ||
if (gameState.Provider.SteamID.Equals(gameState.Player.SteamID)) | ||
{ | ||
|
||
// Are they dead? | ||
if (!isDead && gameState.Player.State.Health <= 0 && gameState.Previously.Player.State.Health > 0) | ||
{ | ||
isDead = true; | ||
|
||
fadeAlpha = 255; | ||
fadeStartAt = Utils.Time.GetMillisecondsSinceEpoch() + (long)(this.Properties.FadeOutAfter * 1000D); | ||
} else if (gameState.Player.State.Health > 0) | ||
{ | ||
isDead = false; | ||
return effectLayer; | ||
} | ||
|
||
// If so... | ||
if (isDead) | ||
{ | ||
|
||
Global.logger.Info("IsDead"); | ||
if (fadeStartAt <= Utils.Time.GetMillisecondsSinceEpoch()) | ||
{ | ||
int fadeAlpha = getFadeAlpha(); | ||
Global.logger.Info(fadeAlpha); | ||
|
||
deathColor = Color.FromArgb(fadeAlpha, deathColor.R, deathColor.G, deathColor.B); | ||
|
||
if (fadeAlpha == 0) | ||
{ | ||
isDead = false; | ||
} | ||
} | ||
|
||
effectLayer.Fill(deathColor); | ||
} | ||
} | ||
} | ||
|
||
return effectLayer; | ||
} | ||
|
||
public override void SetApplication(Application profile) | ||
{ | ||
(Control as Control_CSGODeathLayer).SetProfile(profile); | ||
base.SetApplication(profile); | ||
} | ||
|
||
private int getFadeAlpha() | ||
{ | ||
fadeAlpha -= 15; | ||
return fadeAlpha = (fadeAlpha < 0 ? 0 : fadeAlpha); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.