summaryrefslogtreecommitdiff
path: root/login.gd
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2024-12-13 14:53:38 +0100
committerDaniel Weipert <git@mail.dweipert.de>2024-12-13 14:53:38 +0100
commitca4d1945598863d0ce297f4272317e5dd5797f88 (patch)
treec2675b394140a71c7eee04034f087c107dcd7c9c /login.gd
parenta22381eff3bf2286ee27f4d15ddf4c431ea063be (diff)
next commit
Diffstat (limited to 'login.gd')
-rw-r--r--login.gd48
1 files changed, 27 insertions, 21 deletions
diff --git a/login.gd b/login.gd
index 231756f..1b7ccb7 100644
--- a/login.gd
+++ b/login.gd
@@ -9,12 +9,9 @@ var current_character_information: CharacterInformation
func _ready() -> void:
switch_screen(%Login)
- #$BackgroundMusic.play()
+ $BackgroundMusic.play()
- # TODO: check why TextureRect doesn't work
- #get_tree().root.size_changed.connect(func():
- #$Background.scale = get_viewport_rect().size / $Background.get_rect().size
- #)
+ %ChatWindow.visible = false
func switch_screen(screen: Node):
@@ -92,25 +89,34 @@ func _on_character_selected_pressed(slot_idx: int):
Network.character_server.select_character(slot_idx)
var selected_character = await Network.character_server.selected_character
- if selected_character is CharacterSelectionSuccessPacket:
- Network.map_server = MapServer.new(
- selected_character.get_map_server_ip(),
- selected_character.map_server_port
- )
-
- Network.map_server.login(
- account_information.account_id,
- current_character_information.character_id,
- account_information.login_id1,
- account_information.gender
- )
- var _response = await Network.map_server.logged_in
-
- Client.character.name = current_character_information.name
+
+ if selected_character is CharacterSelectionFailedPacket:
+ # TODO: show error
+ return
+
+ Client.character.name = current_character_information.name
+
+ Network.map_server = MapServer.new(
+ selected_character.get_map_server_ip(),
+ selected_character.map_server_port
+ )
+
+ Network.map_server.login(
+ account_information.account_id,
+ current_character_information.character_id,
+ account_information.login_id1,
+ account_information.gender
+ )
+ var _logged_in = await Network.map_server.logged_in
# TODO: switch to game :)
- # TODO: check next packages to sent to server, most probably to map server
+
+ %ChatWindow.visible = true
Network.map_server.received_packet.connect(func(packet: Packet):
if packet is ServerMessagePacket:
%ChatWindow.add_message(packet.message)
)
+
+ # TODO: load map
+ var map_loaded_packet := MapLoadedPacket.new()
+ Network.map_server.send(map_loaded_packet)