diff --git a/screens/lobby/Lobby.gd b/screens/lobby/Lobby.gd index 12dd6a5..d138959 100644 --- a/screens/lobby/Lobby.gd +++ b/screens/lobby/Lobby.gd @@ -1,13 +1,40 @@ extends PanelContainer -onready var playerListControl := $OuterContainer/CenterContainer/PlayersContainer/PlayersScrollContainer/PlayerList -onready var startGameButton := $OuterContainer/StartGameButton -onready var upnpButton := $OuterContainer/HBoxContainer/UPNPButton -onready var serverIpContainer := $OuterContainer/ServerIpContainer -onready var serverIpLabel := $OuterContainer/ServerIpContainer/ServerIpLabel -onready var seekerCountLabel := $OuterContainer/CenterContainer/PlayersContainer/SeekersCount -onready var hiderCountLabel := $OuterContainer/CenterContainer/PlayersContainer/HidersCount -onready var mapSelectButton := $OuterContainer/CenterContainer/OptionsContainer/MapSelectButton +export (NodePath) var playerListControlPath: NodePath +onready var playerListControl := get_node(playerListControlPath) + +export (NodePath) var startGameButtonPath: NodePath +onready var startGameButton := get_node(startGameButtonPath) + +export (NodePath) var upnpButtonPath: NodePath +onready var upnpButton := get_node(upnpButtonPath) + +export (NodePath) var serverIpContainerPath: NodePath +onready var serverIpContainer : = get_node(serverIpContainerPath) + +export (NodePath) var serverIpLabelPath: NodePath +onready var serverIpLabel := get_node(serverIpLabelPath) + +export (NodePath) var serverPortLabelPath: NodePath +onready var serverPortLabel := get_node(serverPortLabelPath) + +export (NodePath) var seekerCountLabelPath: NodePath +onready var seekerCountLabel := get_node(seekerCountLabelPath) + +export (NodePath) var hiderCountLabelPath: NodePath +onready var hiderCountLabel := get_node(hiderCountLabelPath) + +export (NodePath) var mapSelectButtonPath: NodePath +onready var mapSelectButton := get_node(mapSelectButtonPath) + +export (NodePath) var mapInfoLabelPath: NodePath +onready var mapInfoLabel := get_node(mapInfoLabelPath) + +export (NodePath) var gameNumberLabelPath: NodePath +onready var gameNumberLabel := get_node(gameNumberLabelPath) + +export (NodePath) var winnerLabelPath: NodePath +onready var winnerLabel := get_node(winnerLabelPath) # Production values: const MIN_PLAYERS = 2 @@ -53,7 +80,7 @@ func _ready(): game_updated() Network.request_lobby_state() - $OuterContainer/ServerIpContainer/PortLabel.text = "Port: %d" % Network.gameData.serverPort + serverPortLabel.text = "Port: %d" % Network.gameData.serverPort # Update all clients to the server's network state if get_tree().is_network_server(): @@ -100,7 +127,6 @@ func find_winner() -> PlayerLobbyData: return playersByScore[0] func update_winner(): - var winnerLabel := $OuterContainer/WinnerLabel if Network.gameData.numGames > 0: var winner = find_winner() @@ -349,7 +375,7 @@ func _on_MapSelectButton_item_selected(id): remotesync func update_map_selection(id): mapSelectButton.selected = id var map = self.maps[id] - $OuterContainer/CenterContainer/OptionsContainer/MapInfoLabel.bbcode_text = '[u]Size:[/u] ' + map.size + "\n\n" + map.description + mapInfoLabel.bbcode_text = '[u]Size:[/u] ' + map.size + "\n\n" + map.description func fetch_external_ip(): $HTTPRequest.request("https://api.ipify.org/?format=json") @@ -369,7 +395,6 @@ func _on_HelpButton_pressed(): node.popup_centered() func game_updated(): - var gameNumberLabel := $OuterContainer/GameNumberLabel gameNumberLabel.text = "Game: %d" % (Network.gameData.numGames+1) func _on_CopyServerIpButton_pressed(): diff --git a/screens/lobby/Lobby.tscn b/screens/lobby/Lobby.tscn index bbc735e..567c52a 100644 --- a/screens/lobby/Lobby.tscn +++ b/screens/lobby/Lobby.tscn @@ -18,6 +18,18 @@ script = ExtResource( 1 ) __meta__ = { "_edit_use_anchors_": false } +playerListControlPath = NodePath("OuterContainer/CenterContainer/PlayersContainer/PlayersScrollContainer/PlayerList") +startGameButtonPath = NodePath("OuterContainer/StartGameButton") +upnpButtonPath = NodePath("OuterContainer/HBoxContainer/UPNPButton") +serverIpContainerPath = NodePath("OuterContainer/ServerIpContainer") +serverIpLabelPath = NodePath("OuterContainer/ServerIpContainer/ServerIpLabel") +serverPortLabelPath = NodePath("OuterContainer/ServerIpContainer/PortLabel") +seekerCountLabelPath = NodePath("OuterContainer/CenterContainer/PlayersContainer/SeekersCount") +hiderCountLabelPath = NodePath("OuterContainer/CenterContainer/PlayersContainer/HidersCount") +mapSelectButtonPath = NodePath("OuterContainer/CenterContainer/OptionsContainer/MapSelectButton") +mapInfoLabelPath = NodePath("OuterContainer/CenterContainer/OptionsContainer/MapInfoLabel") +gameNumberLabelPath = NodePath("OuterContainer/GameNumberLabel") +winnerLabelPath = NodePath("OuterContainer/WinnerLabel") [node name="OuterContainer" type="VBoxContainer" parent="."] margin_left = 14.0 diff --git a/screens/mainmenu/MainMenu.gd b/screens/mainmenu/MainMenu.gd index 06f923a..4fab869 100644 --- a/screens/mainmenu/MainMenu.gd +++ b/screens/mainmenu/MainMenu.gd @@ -1,25 +1,40 @@ extends Node export (NodePath) var joinDialogPath: NodePath -onready var joinDialog: WindowDialog = get_node(joinDialogPath) +onready var joinDialog := get_node(joinDialogPath) export (NodePath) var serverIpEditTextPath: NodePath -onready var serverIpEditText: TextEdit = get_node(serverIpEditTextPath) +onready var serverIpEditText := get_node(serverIpEditTextPath) export (NodePath) var serverListContainerPath: NodePath -onready var serverListContainer: PanelContainer = get_node(serverListContainerPath) +onready var serverListContainer := get_node(serverListContainerPath) export (NodePath) var serverListPath: NodePath -onready var serverList: VBoxContainer +onready var serverList := get_node(serverListPath) export (NodePath) var joiningDialogPath: NodePath -onready var joiningDialog: WindowDialog = get_node(joiningDialogPath) +onready var joiningDialog := get_node(joiningDialogPath) export (NodePath) var joinFailedDialogPath: NodePath -onready var joinFailedDialog: AcceptDialog = get_node(joinFailedDialogPath) +onready var joinFailedDialog := get_node(joinFailedDialogPath) export (NodePath) var hostFailedDialogPath: NodePath -onready var hostFailedDialog: AcceptDialog = get_node(hostFailedDialogPath) +onready var hostFailedDialog := get_node(hostFailedDialogPath) + +export (NodePath) var playerNameEditTextPath: NodePath +onready var playerNameEditText := get_node(playerNameEditTextPath) + +export (NodePath) var gameVersionLabelPath: NodePath +onready var gameVersionLabel := get_node(gameVersionLabelPath) + +export (NodePath) var capturesLabelPath: NodePath +onready var capturesLabel := get_node(capturesLabelPath) + +export (NodePath) var escapesLabelPath: NodePath +onready var escapesLabel := get_node(escapesLabelPath) + +export (NodePath) var capturedLabelPath: NodePath +onready var capturedLabel := get_node(capturedLabelPath) var playerName: String = "" @@ -61,11 +76,11 @@ func _ready(): joiningDialog.get_close_button().hide() - $UiLayer/PanelContainer/VBoxContainer/PlayerNameTextEdit.text = playerName - $UiLayer/GameVersionLabel.text = "v%s" % UserData.GAME_VERSION - $UiLayer/PanelContainer/VBoxContainer/StatsReadoutContainer/GridContainer/LabelCaptures.text = str(UserData.data.lifetime_stats.seeker_captures) - $UiLayer/PanelContainer/VBoxContainer/StatsReadoutContainer/GridContainer/LabelEscapes.text = str(UserData.data.lifetime_stats.hider_escapes) - $UiLayer/PanelContainer/VBoxContainer/StatsReadoutContainer/GridContainer/LabelCaptured.text = str(UserData.data.lifetime_stats.hider_captures) + playerNameEditText.text = playerName + gameVersionLabel.text = "v%s" % UserData.GAME_VERSION + capturesLabel.text = str(UserData.data.lifetime_stats.seeker_captures) + escapesLabel.text = str(UserData.data.lifetime_stats.hider_escapes) + capturedLabel.text = str(UserData.data.lifetime_stats.hider_captures) func _exit_tree(): # Save any user data that changed diff --git a/screens/mainmenu/MainMenu.tscn b/screens/mainmenu/MainMenu.tscn index acb0a92..786e59e 100644 --- a/screens/mainmenu/MainMenu.tscn +++ b/screens/mainmenu/MainMenu.tscn @@ -83,6 +83,11 @@ serverListPath = NodePath("UiLayer/ServerListContainer/VBoxContainer/ScrollConta joiningDialogPath = NodePath("UiLayer/JoiningDialog") joinFailedDialogPath = NodePath("UiLayer/JoinFailedDialog") hostFailedDialogPath = NodePath("UiLayer/HostFailedDialog") +playerNameEditTextPath = NodePath("UiLayer/PanelContainer/VBoxContainer/PlayerNameTextEdit") +gameVersionLabelPath = NodePath("UiLayer/GameVersionLabel") +capturesLabelPath = NodePath("UiLayer/PanelContainer/VBoxContainer/StatsReadoutContainer/GridContainer/LabelCaptures") +escapesLabelPath = NodePath("UiLayer/PanelContainer/VBoxContainer/StatsReadoutContainer/GridContainer/LabelEscapes") +capturedLabelPath = NodePath("UiLayer/PanelContainer/VBoxContainer/StatsReadoutContainer/GridContainer/LabelCaptured") [node name="Background" type="Node2D" parent="."]