Name popups *Popup and give scripts, scenes and classes matching names
Every popup is now called *Popup instead of *Window in its file, root node, node name, class and variable, and PopupWindow becomes BasePopup. Player is PlayerRow, SongListObject is SongRow and Character is CharacterCard. Script files are snake_case and scene files PascalCase, each matching its class or root node, and LightGrayTheme.tres is light_gray_theme.tres.
This commit is contained in:
1 parent
b7d67b573e
commit
390da577d7
78 files changed
+281
-258
No files matched your search
@@ -84,10 +84,10 @@ func _add_player(player_name: String) -> PlayerObject:
|
||||
|
||||
|
||||
## Returns the row in the player list that shows [param player_object].
|
||||
func _player_row(player_object: PlayerObject) -> Player:
|
||||
func _player_row(player_object: PlayerObject) -> PlayerRow:
|
||||
var rows: Node = _quiz.get_node(
|
||||
"PlayersPanel/VBoxContainer/ScrollContainer/PlayersListVBoxContainer")
|
||||
for row: Player in rows.get_children():
|
||||
for row: PlayerRow in rows.get_children():
|
||||
if row.player_object == player_object:
|
||||
return row
|
||||
return null
|
||||
|
||||
+31
-26
@@ -27,10 +27,15 @@ const SYNC_RESULT: Dictionary = {
|
||||
"total_time": "00:00:03",
|
||||
}
|
||||
|
||||
## Popups in the order the tour opens them.
|
||||
const POPUPS: Array[String] = [
|
||||
"Search", "SyncWindow", "SettingsWindow", "QRWindow", "NewCharacterSelect",
|
||||
"ShortcutsWindow", "AboutWindow", "WinnerWindow", "Log", "StatisticsPopupPanel",
|
||||
## Popups in the order the tour opens them: the state name, then the popup's node. The
|
||||
## state names are what the popups were first called, so screenshots taken before they
|
||||
## were renamed can still be compared with new ones.
|
||||
const POPUPS: Array[Array] = [
|
||||
["Search", "SearchPopup"], ["SyncWindow", "SyncPopup"],
|
||||
["SettingsWindow", "SettingsPopup"], ["QRWindow", "QRPopup"],
|
||||
["NewCharacterSelect", "CharacterSelectPopup"], ["ShortcutsWindow", "ShortcutsPopup"],
|
||||
["AboutWindow", "AboutPopup"], ["WinnerWindow", "WinnerPopup"], ["Log", "LogPopup"],
|
||||
["StatisticsPopupPanel", "StatisticsPopupPanel"],
|
||||
]
|
||||
|
||||
var _main: Control
|
||||
@@ -108,31 +113,31 @@ func run(on_state: Callable) -> void:
|
||||
await _settle()
|
||||
await on_state.call("playing", null)
|
||||
|
||||
for popup_name: String in POPUPS:
|
||||
var popup: Node = await _open_popup(popup_name)
|
||||
for state_and_node: Array in POPUPS:
|
||||
var popup: Node = await _open_popup(state_and_node[1])
|
||||
await _settle()
|
||||
await on_state.call("popup_" + popup_name, popup)
|
||||
await on_state.call("popup_" + state_and_node[0], popup)
|
||||
_close_popup(popup)
|
||||
await _settle()
|
||||
|
||||
var sync_window: PopupWindow = _node("SyncWindow")
|
||||
var sync_popup: BasePopup = _node("SyncPopup")
|
||||
Settings.currently_syncing = false
|
||||
sync_window.has_synced = false
|
||||
sync_window.start_sync()
|
||||
sync_window.sync_timer.stop()
|
||||
sync_window._on_sync_timeout()
|
||||
sync_popup.has_synced = false
|
||||
sync_popup.start_sync()
|
||||
sync_popup.sync_timer.stop()
|
||||
sync_popup._on_sync_timeout()
|
||||
await _settle()
|
||||
await on_state.call("sync_in_progress", sync_window)
|
||||
sync_window.close()
|
||||
await on_state.call("sync_in_progress", sync_popup)
|
||||
sync_popup.close()
|
||||
await _settle()
|
||||
await on_state.call("sync_buttons_locked", null)
|
||||
|
||||
_server().respond_json("/sync/progress", SYNC_RESULT)
|
||||
sync_window._on_sync_timeout()
|
||||
sync_window.open()
|
||||
sync_popup._on_sync_timeout()
|
||||
sync_popup.open()
|
||||
await _settle()
|
||||
await on_state.call("sync_result", sync_window)
|
||||
sync_window.close()
|
||||
await on_state.call("sync_result", sync_popup)
|
||||
sync_popup.close()
|
||||
await _settle()
|
||||
|
||||
|
||||
@@ -204,7 +209,7 @@ func _add_player(player_name: String) -> void:
|
||||
_call("add_player")
|
||||
|
||||
|
||||
func _player_row(index: int) -> Player:
|
||||
func _player_row(index: int) -> PlayerRow:
|
||||
return _node("PlayersPanel").get_node(
|
||||
"VBoxContainer/ScrollContainer/PlayersListVBoxContainer").get_child(index)
|
||||
|
||||
@@ -220,20 +225,20 @@ func _freeze_music_player() -> void:
|
||||
|
||||
## The log starts each row with the time of day; use a fixed time instead.
|
||||
func _fix_log_times() -> void:
|
||||
var log_window: PopupWindow = _node("Log")
|
||||
for row: Label in log_window.log_box.get_children():
|
||||
var log_popup: BasePopup = _node("LogPopup")
|
||||
for row: Label in log_popup.log_box.get_children():
|
||||
row.text = "12:00:00 " + row.text.substr(9)
|
||||
|
||||
|
||||
func _open_popup(popup_name: String) -> Node:
|
||||
var popup: Node = _node(popup_name)
|
||||
match popup_name:
|
||||
"SyncWindow":
|
||||
# Opening the window starts a sync; show the empty window instead
|
||||
"SyncPopup":
|
||||
# Opening the popup starts a sync; show the empty popup instead
|
||||
popup.open()
|
||||
"NewCharacterSelect":
|
||||
"CharacterSelectPopup":
|
||||
popup.show_grid("Crono")
|
||||
"WinnerWindow":
|
||||
"WinnerPopup":
|
||||
popup.show_winner(Settings.player_array[0])
|
||||
"StatisticsPopupPanel":
|
||||
_call("get_statistics")
|
||||
@@ -243,7 +248,7 @@ func _open_popup(popup_name: String) -> Node:
|
||||
|
||||
|
||||
func _close_popup(popup: Node) -> void:
|
||||
if popup is PopupWindow:
|
||||
if popup is BasePopup:
|
||||
popup.close()
|
||||
else:
|
||||
popup.visible = false
|
||||
Reference in new issue
Block a user