From b4b6f1dbb5abd391918abe169dabc022322146aa Mon Sep 17 00:00:00 2001 From: glax Date: Mon, 15 Jan 2024 20:39:38 +0100 Subject: [PATCH] ToString Overrides for Gamestates --- GameState/CS2GameState.cs | 8 ++++++++ GameState/Map.cs | 9 +++++++++ GameState/Player.cs | 8 ++++++++ GameState/PlayerMatchStats.cs | 8 ++++++++ GameState/PlayerState.cs | 14 ++++++++++++++ GameState/Team.cs | 9 +++++++++ 6 files changed, 56 insertions(+) diff --git a/GameState/CS2GameState.cs b/GameState/CS2GameState.cs index 48f2b1a..4bd110d 100644 --- a/GameState/CS2GameState.cs +++ b/GameState/CS2GameState.cs @@ -5,4 +5,12 @@ public struct CS2GameState public int Timestamp; public Map? Map; public Player? Player; + + public override string ToString() + { + return $"{GetType()}\n" + + $"\tTime: {Timestamp}\n" + + $"\t{Map}\n" + + $"\t{Player}\n"; + } } \ No newline at end of file diff --git a/GameState/Map.cs b/GameState/Map.cs index 6e16e52..0feff99 100644 --- a/GameState/Map.cs +++ b/GameState/Map.cs @@ -5,4 +5,13 @@ public struct Map public string Mode, Name, Phase; public int Round, NumMatchesToWinSeries; public Team TeamCT, TeamT; + + public override string ToString() + { + return $"{GetType()}\n" + + $"\t{Mode} {Name} {Round} Matches to Win Series: {NumMatchesToWinSeries}\n" + + $"\t{Phase}\n" + + $"\t{TeamCT}\n" + + $"\t{TeamT}\n"; + } } \ No newline at end of file diff --git a/GameState/Player.cs b/GameState/Player.cs index 9e0de63..14e6ffd 100644 --- a/GameState/Player.cs +++ b/GameState/Player.cs @@ -7,4 +7,12 @@ public struct Player public int? ObserverSlot; public PlayerState? State; public PlayerMatchStats? MatchStats; + + public override string ToString() + { + return $"{GetType()}\n" + + $"\t{Name} {SteamId} {Activity} {Team}\n" + + $"\t{State}\n" + + $"\t{MatchStats}\n"; + } } \ No newline at end of file diff --git a/GameState/PlayerMatchStats.cs b/GameState/PlayerMatchStats.cs index 3b8ccd5..a08c149 100644 --- a/GameState/PlayerMatchStats.cs +++ b/GameState/PlayerMatchStats.cs @@ -3,4 +3,12 @@ public struct PlayerMatchStats { public int Kills, Assists, Deaths, MVPs, Score; + + public override string ToString() + { + return $"{GetType()}\n" + + $"\tKAD: {Kills} {Assists} {Deaths}\n" + + $"\tMVPs: {MVPs}\n" + + $"\tScore: {Score}\n"; + } } \ No newline at end of file diff --git a/GameState/PlayerState.cs b/GameState/PlayerState.cs index e8ada4c..7f27a84 100644 --- a/GameState/PlayerState.cs +++ b/GameState/PlayerState.cs @@ -4,4 +4,18 @@ public struct PlayerState { public int Health, Armor, Flashed, Smoked, Burning, Money, RoundKills, RoundHs, EquipmentValue; public bool Helmet; + + public override string ToString() + { + return $"{GetType()}\n" + + $"\tHealth: {Health}\n" + + $"\tArmor: {Armor}\n" + + $"\tFlashed: {Flashed}\n" + + $"\tSmoked: {Smoked}\n" + + $"\tBurning: {Burning}\n" + + $"\tMoney: {Money}\n" + + $"\tRoundKills: {RoundKills}\n" + + $"\tRoundHs: {RoundHs}\n" + + $"\tEquipmentValue: {EquipmentValue}\n"; + } } \ No newline at end of file diff --git a/GameState/Team.cs b/GameState/Team.cs index c08eec7..fcc6169 100644 --- a/GameState/Team.cs +++ b/GameState/Team.cs @@ -3,4 +3,13 @@ public struct Team { public int Score, ConsecutiveRoundLosses, TimeoutsRemaining, MatchesWonThisSeries; + + public override string ToString() + { + return $"{GetType()}\n" + + $"\tScore: {Score}\n" + + $"\tConsecutiveRoundLosses: {ConsecutiveRoundLosses}\n" + + $"\tTimeoutsRemaining: {TimeoutsRemaining}\n" + + $"\tMatchesWonThisSeries: {MatchesWonThisSeries}\n"; + } } \ No newline at end of file