feat: win-lose-tie at game end
This commit is contained in:
parent
41a72709df
commit
abd2feaab8
4 changed files with 37 additions and 0 deletions
|
|
@ -13,6 +13,7 @@ signal opponent_played_rts(move: String)
|
|||
@onready var own_side = $Own
|
||||
@onready var opponent_side = $Opponent
|
||||
@onready var start_game_btn = $StartGameButton
|
||||
@onready var win_lose_tie_label: Label = $"Win-Lose-Tie"
|
||||
|
||||
var id_to_card: Dictionary = {}
|
||||
|
||||
|
|
@ -65,6 +66,10 @@ func _on_match_manager_state_transitioned(transition: PhaseTransition):
|
|||
start_game_btn.visible = match_manager.phase == Match.Phase.PREGAME
|
||||
transition_history.append(transition)
|
||||
_update_phase_info(transition.to)
|
||||
if transition.to == Match.Phase.END:
|
||||
var game_ended_event: EventGameEnded = transition.events.filter(func (it): return it is EventGameEnded)[0]
|
||||
win_lose_tie_label.text = "TIE" if game_ended_event.winner_player_id == -1 else "YOU WON!" if game_ended_event.winner_player_id == id else "YOU LOST!"
|
||||
win_lose_tie_label.visible = true
|
||||
print("Phase: ", Match.phase_to_str(transition.from), " -> ", Match.phase_to_str(transition.to))
|
||||
|
||||
func _on_start_game_button_button_up() -> void:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue