-
Notifications
You must be signed in to change notification settings - Fork 0
/
end_turn_ui.gd
56 lines (43 loc) · 1.24 KB
/
end_turn_ui.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
extends CanvasLayer
signal end_turn
@onready var main = $".."
@onready var board = $"../Board"
@onready var screen_size = get_viewport().get_visible_rect().size
@onready var confirmation_option = $ConfirmationDialog
func _on_end_turn_button_pressed():
if main.waiting:
return
var player_tile = main.players[main.current_active_player].current_cell
var cell_index = board.get_index_from_coor(player_tile)
var tile = board.tile_list[cell_index]
if tile.type == "wall":
return
GameManager.play_select_sound()
if main.get_active_player().moves > 0:
confirmation_option.show()
$EndTurnButton.hide()
$EndTurnLabel.hide()
else:
end_turn.emit()
func _on_yes_button_pressed():
GameManager.play_select_sound()
confirmation_option.hide()
$EndTurnButton.show()
$EndTurnLabel.show()
end_turn.emit()
func _on_no_button_pressed():
GameManager.play_select_sound()
confirmation_option.hide()
$EndTurnButton.show()
$EndTurnLabel.show()
func _on_confirmation_window_canceled():
GameManager.play_select_sound()
confirmation_option.hide()
$EndTurnButton.show()
$EndTurnLabel.show()
func _on_confirmation_window_confirmed():
GameManager.play_select_sound()
confirmation_option.hide()
$EndTurnButton.show()
$EndTurnLabel.show()
end_turn.emit()