Add "Over" Roundstate
This commit is contained in:
parent
5824e24748
commit
f77f5bc3b4
@ -18,10 +18,12 @@ public class CS2MessageHandler
|
|||||||
|
|
||||||
RoundState currentRoundState = ParseRoundStateFromString(messageJson.SelectToken("round.phase", false)?.Value<string>());
|
RoundState currentRoundState = ParseRoundStateFromString(messageJson.SelectToken("round.phase", false)?.Value<string>());
|
||||||
RoundState previousRoundState = ParseRoundStateFromString(messageJson.SelectToken("previously.round.phase", false)?.Value<string>());
|
RoundState previousRoundState = ParseRoundStateFromString(messageJson.SelectToken("previously.round.phase", false)?.Value<string>());
|
||||||
if(previousRoundState == RoundState.FreezeTime && currentRoundState == RoundState.Live)
|
if(previousRoundState == RoundState.Over && currentRoundState == RoundState.Live)
|
||||||
OnRoundStart?.Invoke();
|
OnRoundStart?.Invoke();
|
||||||
if(previousRoundState == RoundState.Live && currentRoundState == RoundState.FreezeTime)
|
if(previousRoundState == RoundState.Live && currentRoundState == RoundState.FreezeTime)
|
||||||
OnRoundEnd?.Invoke();
|
OnRoundEnd?.Invoke();
|
||||||
|
if(previousRoundState == RoundState.Live && currentRoundState == RoundState.Over)
|
||||||
|
OnRoundEnd?.Invoke();
|
||||||
|
|
||||||
Team playerTeam = ParseTeamFromString(messageJson.SelectToken("player.team", false)?.Value<string>());
|
Team playerTeam = ParseTeamFromString(messageJson.SelectToken("player.team", false)?.Value<string>());
|
||||||
Team winnerTeam = ParseTeamFromString(messageJson.SelectToken("round.win_team", false)?.Value<string>());
|
Team winnerTeam = ParseTeamFromString(messageJson.SelectToken("round.win_team", false)?.Value<string>());
|
||||||
@ -47,6 +49,7 @@ public class CS2MessageHandler
|
|||||||
{
|
{
|
||||||
"live" => RoundState.Live,
|
"live" => RoundState.Live,
|
||||||
"freezetime" => RoundState.FreezeTime,
|
"freezetime" => RoundState.FreezeTime,
|
||||||
|
"over" => RoundState.Over,
|
||||||
_ => RoundState.Unknown
|
_ => RoundState.Unknown
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -61,7 +64,7 @@ public class CS2MessageHandler
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum RoundState {FreezeTime, Live, Unknown}
|
private enum RoundState {FreezeTime, Live, Over, Unknown}
|
||||||
|
|
||||||
private enum Team {T, CT, None}
|
private enum Team {T, CT, None}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user