feat: phase info on right hand side of the board
This commit is contained in:
parent
46e4ba0fbb
commit
a0475c8588
2 changed files with 63 additions and 15 deletions
17
demo_game.gd
17
demo_game.gd
|
|
@ -8,7 +8,8 @@ signal opponent_played_rts(move: String)
|
|||
|
||||
@export var player_1_deck: Array[Card]
|
||||
@export var player_2_deck: Array[Card]
|
||||
@onready var match_manager = $MatchManager
|
||||
|
||||
@onready var match_manager: MatchManager = $MatchManager
|
||||
@onready var own_side = $Own
|
||||
@onready var opponent_side = $Opponent
|
||||
@onready var start_game_btn = $StartGameButton
|
||||
|
|
@ -30,6 +31,9 @@ var player_2_action: Action:
|
|||
var id
|
||||
var signal_connected := false
|
||||
|
||||
func _ready() -> void:
|
||||
_update_phase_info(Match.Phase.PREGAME)
|
||||
|
||||
func init(player_id: int) -> void:
|
||||
id = player_id
|
||||
|
||||
|
|
@ -44,6 +48,7 @@ func init(player_id: int) -> void:
|
|||
if card.id not in id_to_card:
|
||||
id_to_card[card.id] = card
|
||||
|
||||
print(match_manager.phase)
|
||||
match_manager.init({
|
||||
MatchManager.PLAYER_1_ID: player_1_deck,
|
||||
MatchManager.PLAYER_2_ID: player_2_deck
|
||||
|
|
@ -59,6 +64,7 @@ var transition_history: Array[PhaseTransition] = []
|
|||
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)
|
||||
print("Phase: ", Match.phase_to_str(transition.from), " -> ", Match.phase_to_str(transition.to))
|
||||
|
||||
func _on_start_game_button_button_up() -> void:
|
||||
|
|
@ -113,3 +119,12 @@ func rpc_opponent_rps_move(move: String) -> void:
|
|||
if player_1_action:
|
||||
match_manager.resolve(player_action_queue)
|
||||
player_action_queue.clear()
|
||||
|
||||
func _update_phase_info(phase: Match.Phase):
|
||||
var phaseHeaders: Container = get_node("%PhaseInfo/PhaseHeader")
|
||||
for child: Label in phaseHeaders.get_children():
|
||||
child.modulate = Color.DIM_GRAY
|
||||
var target = phaseHeaders.get_node(Match.phase_to_str(phase))
|
||||
phaseHeaders.visible = target != null
|
||||
if target:
|
||||
target.modulate = Color.WHITE
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue