diff options
Diffstat (limited to 'apworld')
| -rw-r--r-- | apworld/__init__.py | 68 | ||||
| -rw-r--r-- | apworld/client/apworld_runtime.gd | 44 | ||||
| -rw-r--r-- | apworld/client/main.gd | 62 | ||||
| -rw-r--r-- | apworld/client/pauseMenu.gd | 2 | ||||
| -rw-r--r-- | apworld/client/run_from_apworld.tscn | 30 | ||||
| -rw-r--r-- | apworld/client/run_from_source.tscn | 3 | ||||
| -rw-r--r-- | apworld/client/settings_screen.gd | 153 | ||||
| -rw-r--r-- | apworld/client/settings_screen.tscn | 173 | ||||
| -rw-r--r-- | apworld/client/source_runtime.gd | 16 |
9 files changed, 320 insertions, 231 deletions
| diff --git a/apworld/__init__.py b/apworld/__init__.py index 9d7d149..523c00c 100644 --- a/apworld/__init__.py +++ b/apworld/__init__.py | |||
| @@ -3,6 +3,7 @@ Archipelago init file for Lingo 2 | |||
| 3 | """ | 3 | """ |
| 4 | import asyncio | 4 | import asyncio |
| 5 | import os.path | 5 | import os.path |
| 6 | import pkgutil | ||
| 6 | import subprocess | 7 | import subprocess |
| 7 | from typing import ClassVar | 8 | from typing import ClassVar |
| 8 | 9 | ||
| @@ -20,29 +21,6 @@ from .version import APWORLD_VERSION | |||
| 20 | from ..LauncherComponents import Component, Type, components | 21 | from ..LauncherComponents import Component, Type, components |
| 21 | 22 | ||
| 22 | 23 | ||
| 23 | async def run_game(): | ||
| 24 | exe_file = settings.get_settings().lingo2_options.exe_file | ||
| 25 | |||
| 26 | subprocess.Popen( | ||
| 27 | [ | ||
| 28 | exe_file, | ||
| 29 | "--scene", | ||
| 30 | Utils.local_path("worlds", "lingo2", "client", "run_from_source.tscn"), | ||
| 31 | "--", | ||
| 32 | Utils.local_path("worlds", "lingo2", "client"), | ||
| 33 | ], | ||
| 34 | cwd=os.path.dirname(exe_file), | ||
| 35 | ) | ||
| 36 | |||
| 37 | |||
| 38 | async def client_main(): | ||
| 39 | Utils.async_start(run_game()) | ||
| 40 | |||
| 41 | |||
| 42 | def launch_client(*args): | ||
| 43 | asyncio.run(client_main()) | ||
| 44 | |||
| 45 | |||
| 46 | class Lingo2WebWorld(WebWorld): | 24 | class Lingo2WebWorld(WebWorld): |
| 47 | rich_text_options_doc = True | 25 | rich_text_options_doc = True |
| 48 | theme = "grass" | 26 | theme = "grass" |
| @@ -183,6 +161,50 @@ class Lingo2World(World): | |||
| 183 | # we are using re_gen_passthrough over modifying the world here due to complexities with ER | 161 | # we are using re_gen_passthrough over modifying the world here due to complexities with ER |
| 184 | return slot_data | 162 | return slot_data |
| 185 | 163 | ||
| 164 | |||
| 165 | async def run_game(): | ||
| 166 | exe_file = settings.get_settings().lingo2_options.exe_file | ||
| 167 | |||
| 168 | if Lingo2World.zip_path is not None: | ||
| 169 | # This is a packaged apworld. | ||
| 170 | init_scene = pkgutil.get_data(__name__, "client/run_from_apworld.tscn") | ||
| 171 | init_path = Utils.local_path("data", "lingo2_init.tscn") | ||
| 172 | |||
| 173 | with open(init_path, "wb") as file_handle: | ||
| 174 | file_handle.write(init_scene) | ||
| 175 | |||
| 176 | subprocess.Popen( | ||
| 177 | [ | ||
| 178 | exe_file, | ||
| 179 | "--scene", | ||
| 180 | init_path, | ||
| 181 | "--", | ||
| 182 | str(Lingo2World.zip_path.absolute()), | ||
| 183 | ], | ||
| 184 | cwd=os.path.dirname(exe_file), | ||
| 185 | ) | ||
| 186 | else: | ||
| 187 | # The world is unzipped and being run in source. | ||
| 188 | subprocess.Popen( | ||
| 189 | [ | ||
| 190 | exe_file, | ||
| 191 | "--scene", | ||
| 192 | Utils.local_path("worlds", "lingo2", "client", "run_from_source.tscn"), | ||
| 193 | "--", | ||
| 194 | Utils.local_path("worlds", "lingo2", "client"), | ||
| 195 | ], | ||
| 196 | cwd=os.path.dirname(exe_file), | ||
| 197 | ) | ||
| 198 | |||
| 199 | |||
| 200 | async def client_main(): | ||
| 201 | Utils.async_start(run_game()) | ||
| 202 | |||
| 203 | |||
| 204 | def launch_client(*args): | ||
| 205 | asyncio.run(client_main()) | ||
| 206 | |||
| 207 | |||
| 186 | component = Component("Lingo 2 Client", component_type=Type.CLIENT, func=launch_client, | 208 | component = Component("Lingo 2 Client", component_type=Type.CLIENT, func=launch_client, |
| 187 | description="Open Lingo 2.") | 209 | description="Open Lingo 2.") |
| 188 | components.append(component) | 210 | components.append(component) |
| diff --git a/apworld/client/apworld_runtime.gd b/apworld/client/apworld_runtime.gd new file mode 100644 index 0000000..faf8e0c --- /dev/null +++ b/apworld/client/apworld_runtime.gd | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | extends Node | ||
| 2 | |||
| 3 | var apworld_reader | ||
| 4 | |||
| 5 | |||
| 6 | func _init(path): | ||
| 7 | apworld_reader = ZIPReader.new() | ||
| 8 | apworld_reader.open(path) | ||
| 9 | |||
| 10 | |||
| 11 | func _get_true_path(path): | ||
| 12 | if path.begins_with("../"): | ||
| 13 | return "lingo2/%s" % path.substr(3) | ||
| 14 | else: | ||
| 15 | return "lingo2/client/%s" % path | ||
| 16 | |||
| 17 | |||
| 18 | func load_script(path): | ||
| 19 | var true_path = _get_true_path(path) | ||
| 20 | |||
| 21 | var script = GDScript.new() | ||
| 22 | script.source_code = apworld_reader.read_file(true_path).get_string_from_utf8() | ||
| 23 | script.reload() | ||
| 24 | |||
| 25 | return script | ||
| 26 | |||
| 27 | |||
| 28 | func read_path(path): | ||
| 29 | var true_path = _get_true_path(path) | ||
| 30 | return apworld_reader.read_file(true_path) | ||
| 31 | |||
| 32 | |||
| 33 | func load_script_as_scene(path, scene_name): | ||
| 34 | var script = load_script(path) | ||
| 35 | var instance = script.new() | ||
| 36 | instance.name = scene_name | ||
| 37 | |||
| 38 | get_tree().unload_current_scene() | ||
| 39 | _load_scene.call_deferred(instance) | ||
| 40 | |||
| 41 | |||
| 42 | func _load_scene(instance): | ||
| 43 | get_tree().get_root().add_child(instance) | ||
| 44 | get_tree().current_scene = instance | ||
| diff --git a/apworld/client/main.gd b/apworld/client/main.gd index a31eb89..cff92bc 100644 --- a/apworld/client/main.gd +++ b/apworld/client/main.gd | |||
| @@ -22,59 +22,59 @@ func _ready(): | |||
| 22 | 22 | ||
| 23 | # Create the global AP manager, if it doesn't already exist. | 23 | # Create the global AP manager, if it doesn't already exist. |
| 24 | if not global.has_node("Archipelago"): | 24 | if not global.has_node("Archipelago"): |
| 25 | var ap_script = runtime.load_path("manager.gd") | 25 | var ap_script = runtime.load_script("manager.gd") |
| 26 | var ap_instance = ap_script.new() | 26 | var ap_instance = ap_script.new() |
| 27 | ap_instance.name = "Archipelago" | 27 | ap_instance.name = "Archipelago" |
| 28 | 28 | ||
| 29 | ap_instance.SCRIPT_client = runtime.load_path("client.gd") | 29 | ap_instance.SCRIPT_client = runtime.load_script("client.gd") |
| 30 | ap_instance.SCRIPT_keyboard = runtime.load_path("keyboard.gd") | 30 | ap_instance.SCRIPT_keyboard = runtime.load_script("keyboard.gd") |
| 31 | ap_instance.SCRIPT_locationListener = runtime.load_path("locationListener.gd") | 31 | ap_instance.SCRIPT_locationListener = runtime.load_script("locationListener.gd") |
| 32 | ap_instance.SCRIPT_minimap = runtime.load_path("minimap.gd") | 32 | ap_instance.SCRIPT_minimap = runtime.load_script("minimap.gd") |
| 33 | ap_instance.SCRIPT_uuid = runtime.load_path("vendor/uuid.gd") | 33 | ap_instance.SCRIPT_uuid = runtime.load_script("vendor/uuid.gd") |
| 34 | ap_instance.SCRIPT_victoryListener = runtime.load_path("victoryListener.gd") | 34 | ap_instance.SCRIPT_victoryListener = runtime.load_script("victoryListener.gd") |
| 35 | 35 | ||
| 36 | global.add_child(ap_instance) | 36 | global.add_child(ap_instance) |
| 37 | 37 | ||
| 38 | # Let's also inject any scripts we need to inject now. | 38 | # Let's also inject any scripts we need to inject now. |
| 39 | installScriptExtension(runtime.load_path("animationListener.gd")) | 39 | installScriptExtension(runtime.load_script("animationListener.gd")) |
| 40 | installScriptExtension(runtime.load_path("collectable.gd")) | 40 | installScriptExtension(runtime.load_script("collectable.gd")) |
| 41 | installScriptExtension(runtime.load_path("door.gd")) | 41 | installScriptExtension(runtime.load_script("door.gd")) |
| 42 | installScriptExtension(runtime.load_path("keyHolder.gd")) | 42 | installScriptExtension(runtime.load_script("keyHolder.gd")) |
| 43 | installScriptExtension(runtime.load_path("keyHolderChecker.gd")) | 43 | installScriptExtension(runtime.load_script("keyHolderChecker.gd")) |
| 44 | installScriptExtension(runtime.load_path("keyHolderResetterListener.gd")) | 44 | installScriptExtension(runtime.load_script("keyHolderResetterListener.gd")) |
| 45 | installScriptExtension(runtime.load_path("painting.gd")) | 45 | installScriptExtension(runtime.load_script("painting.gd")) |
| 46 | installScriptExtension(runtime.load_path("panel.gd")) | 46 | installScriptExtension(runtime.load_script("panel.gd")) |
| 47 | installScriptExtension(runtime.load_path("pauseMenu.gd")) | 47 | installScriptExtension(runtime.load_script("pauseMenu.gd")) |
| 48 | installScriptExtension(runtime.load_path("player.gd")) | 48 | installScriptExtension(runtime.load_script("player.gd")) |
| 49 | installScriptExtension(runtime.load_path("saver.gd")) | 49 | installScriptExtension(runtime.load_script("saver.gd")) |
| 50 | installScriptExtension(runtime.load_path("teleport.gd")) | 50 | installScriptExtension(runtime.load_script("teleport.gd")) |
| 51 | installScriptExtension(runtime.load_path("teleportListener.gd")) | 51 | installScriptExtension(runtime.load_script("teleportListener.gd")) |
| 52 | installScriptExtension(runtime.load_path("visibilityListener.gd")) | 52 | installScriptExtension(runtime.load_script("visibilityListener.gd")) |
| 53 | installScriptExtension(runtime.load_path("worldport.gd")) | 53 | installScriptExtension(runtime.load_script("worldport.gd")) |
| 54 | installScriptExtension(runtime.load_path("worldportListener.gd")) | 54 | installScriptExtension(runtime.load_script("worldportListener.gd")) |
| 55 | 55 | ||
| 56 | var proto_script = runtime.load_path("../generated/proto.gd") | 56 | var proto_script = runtime.load_script("../generated/proto.gd") |
| 57 | var gamedata_script = runtime.load_path("gamedata.gd") | 57 | var gamedata_script = runtime.load_script("gamedata.gd") |
| 58 | var gamedata_instance = gamedata_script.new(proto_script) | 58 | var gamedata_instance = gamedata_script.new(proto_script) |
| 59 | gamedata_instance.load(runtime.read_path("../generated/data.binpb")) | 59 | gamedata_instance.load(runtime.read_path("../generated/data.binpb")) |
| 60 | gamedata_instance.name = "Gamedata" | 60 | gamedata_instance.name = "Gamedata" |
| 61 | global.add_child(gamedata_instance) | 61 | global.add_child(gamedata_instance) |
| 62 | 62 | ||
| 63 | var messages_script = runtime.load_path("messages.gd") | 63 | var messages_script = runtime.load_script("messages.gd") |
| 64 | var messages_instance = messages_script.new() | 64 | var messages_instance = messages_script.new() |
| 65 | messages_instance.name = "Messages" | 65 | messages_instance.name = "Messages" |
| 66 | messages_instance.SCRIPT_rainbowText = runtime.load_path("rainbowText.gd") | 66 | messages_instance.SCRIPT_rainbowText = runtime.load_script("rainbowText.gd") |
| 67 | global.add_child(messages_instance) | 67 | global.add_child(messages_instance) |
| 68 | 68 | ||
| 69 | var textclient_script = runtime.load_path("textclient.gd") | 69 | var textclient_script = runtime.load_script("textclient.gd") |
| 70 | var textclient_instance = textclient_script.new() | 70 | var textclient_instance = textclient_script.new() |
| 71 | textclient_instance.name = "Textclient" | 71 | textclient_instance.name = "Textclient" |
| 72 | global.add_child(textclient_instance) | 72 | global.add_child(textclient_instance) |
| 73 | 73 | ||
| 74 | var compass_overlay_script = runtime.load_path("compass_overlay.gd") | 74 | var compass_overlay_script = runtime.load_script("compass_overlay.gd") |
| 75 | var compass_overlay_instance = compass_overlay_script.new() | 75 | var compass_overlay_instance = compass_overlay_script.new() |
| 76 | compass_overlay_instance.name = "Compass" | 76 | compass_overlay_instance.name = "Compass" |
| 77 | compass_overlay_instance.SCRIPT_compass = runtime.load_path("compass.gd") | 77 | compass_overlay_instance.SCRIPT_compass = runtime.load_script("compass.gd") |
| 78 | global.add_child(compass_overlay_instance) | 78 | global.add_child(compass_overlay_instance) |
| 79 | 79 | ||
| 80 | var ap = global.get_node("Archipelago") | 80 | var ap = global.get_node("Archipelago") |
| diff --git a/apworld/client/pauseMenu.gd b/apworld/client/pauseMenu.gd index 448f690..8bc12c6 100644 --- a/apworld/client/pauseMenu.gd +++ b/apworld/client/pauseMenu.gd | |||
| @@ -39,7 +39,7 @@ func _main_menu(): | |||
| 39 | musicPlayer.stop() | 39 | musicPlayer.stop() |
| 40 | 40 | ||
| 41 | var runtime = global.get_node("Runtime") | 41 | var runtime = global.get_node("Runtime") |
| 42 | get_tree().change_scene_to_packed(runtime.load_path("settings_screen.tscn")) | 42 | runtime.load_script_as_scene.call_deferred("settings_screen.gd", "settings_screen") |
| 43 | 43 | ||
| 44 | 44 | ||
| 45 | func _toggle_compass(): | 45 | func _toggle_compass(): |
| diff --git a/apworld/client/run_from_apworld.tscn b/apworld/client/run_from_apworld.tscn new file mode 100644 index 0000000..11373e0 --- /dev/null +++ b/apworld/client/run_from_apworld.tscn | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | [gd_scene load_steps=11 format=2] | ||
| 2 | |||
| 3 | [sub_resource id=2 type="GDScript"] | ||
| 4 | script/source = "extends Node2D | ||
| 5 | |||
| 6 | |||
| 7 | func _ready(): | ||
| 8 | var args = OS.get_cmdline_user_args() | ||
| 9 | var apworld_path = args[0] | ||
| 10 | |||
| 11 | var zip_reader = ZIPReader.new() | ||
| 12 | zip_reader.open(apworld_path) | ||
| 13 | |||
| 14 | var runtime_script = GDScript.new() | ||
| 15 | runtime_script.source_code = zip_reader.read_file(\"lingo2/client/apworld_runtime.gd\").get_string_from_utf8() | ||
| 16 | runtime_script.reload() | ||
| 17 | |||
| 18 | zip_reader.close() | ||
| 19 | |||
| 20 | var runtime = runtime_script.new(apworld_path) | ||
| 21 | runtime.name = \"Runtime\" | ||
| 22 | |||
| 23 | global.add_child(runtime) | ||
| 24 | |||
| 25 | runtime.load_script_as_scene.call_deferred(\"settings_screen.gd\", \"settings_screen\") | ||
| 26 | |||
| 27 | " | ||
| 28 | |||
| 29 | [node name="loader" type="Node2D"] | ||
| 30 | script = SubResource( 2 ) | ||
| diff --git a/apworld/client/run_from_source.tscn b/apworld/client/run_from_source.tscn index b710677..59a914d 100644 --- a/apworld/client/run_from_source.tscn +++ b/apworld/client/run_from_source.tscn | |||
| @@ -14,8 +14,7 @@ func _ready(): | |||
| 14 | 14 | ||
| 15 | global.add_child(runtime) | 15 | global.add_child(runtime) |
| 16 | 16 | ||
| 17 | var settings_screen = runtime.load_path(\"settings_screen.tscn\") | 17 | runtime.load_script_as_scene.call_deferred(\"settings_screen.gd\", \"settings_screen\") |
| 18 | get_tree().change_scene_to_packed(settings_screen) | ||
| 19 | 18 | ||
| 20 | " | 19 | " |
| 21 | 20 | ||
| diff --git a/apworld/client/settings_screen.gd b/apworld/client/settings_screen.gd new file mode 100644 index 0000000..b430b17 --- /dev/null +++ b/apworld/client/settings_screen.gd | |||
| @@ -0,0 +1,153 @@ | |||
| 1 | extends Node | ||
| 2 | |||
| 3 | |||
| 4 | func _ready(): | ||
| 5 | var theme = preload("res://assets/themes/baseUI.tres") | ||
| 6 | |||
| 7 | var simple_style_box = StyleBoxFlat.new() | ||
| 8 | simple_style_box.bg_color = Color(0, 0, 0, 0) | ||
| 9 | |||
| 10 | var panel = Panel.new() | ||
| 11 | panel.name = "Panel" | ||
| 12 | panel.offset_right = 1920.0 | ||
| 13 | panel.offset_bottom = 1080.0 | ||
| 14 | add_child(panel) | ||
| 15 | |||
| 16 | var title = Label.new() | ||
| 17 | title.name = "title" | ||
| 18 | title.offset_left = 0.0 | ||
| 19 | title.offset_top = 75.0 | ||
| 20 | title.offset_right = 1920.0 | ||
| 21 | title.offset_bottom = 225.0 | ||
| 22 | title.text = "ARCHIPELAGO" | ||
| 23 | title.vertical_alignment = VERTICAL_ALIGNMENT_CENTER | ||
| 24 | title.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER | ||
| 25 | title.theme = theme | ||
| 26 | panel.add_child(title) | ||
| 27 | |||
| 28 | var connect_button = Button.new() | ||
| 29 | connect_button.name = "connect_button" | ||
| 30 | connect_button.offset_left = 255.0 | ||
| 31 | connect_button.offset_top = 875.0 | ||
| 32 | connect_button.offset_right = 891.0 | ||
| 33 | connect_button.offset_bottom = 1025.0 | ||
| 34 | connect_button.add_theme_color_override("font_color_hover", Color(1, 0.501961, 0, 1)) | ||
| 35 | connect_button.text = "CONNECT" | ||
| 36 | connect_button.theme = theme | ||
| 37 | panel.add_child(connect_button) | ||
| 38 | |||
| 39 | var quit_button = Button.new() | ||
| 40 | quit_button.name = "quit_button" | ||
| 41 | quit_button.offset_left = 1102.0 | ||
| 42 | quit_button.offset_top = 875.0 | ||
| 43 | quit_button.offset_right = 1738.0 | ||
| 44 | quit_button.offset_bottom = 1025.0 | ||
| 45 | quit_button.add_theme_color_override("font_color_hover", Color(1, 0, 0, 1)) | ||
| 46 | quit_button.text = "QUIT" | ||
| 47 | quit_button.theme = theme | ||
| 48 | panel.add_child(quit_button) | ||
| 49 | |||
| 50 | var credit2 = Label.new() | ||
| 51 | credit2.name = "credit2" | ||
| 52 | credit2.offset_left = -105.0 | ||
| 53 | credit2.offset_top = 346.0 | ||
| 54 | credit2.offset_right = 485.0 | ||
| 55 | credit2.offset_bottom = 410.0 | ||
| 56 | credit2.add_theme_stylebox_override("normal", simple_style_box) | ||
| 57 | credit2.text = "SERVER" | ||
| 58 | credit2.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT | ||
| 59 | credit2.theme = theme | ||
| 60 | panel.add_child(credit2) | ||
| 61 | |||
| 62 | var credit3 = Label.new() | ||
| 63 | credit3.name = "credit3" | ||
| 64 | credit3.offset_left = -105.0 | ||
| 65 | credit3.offset_top = 519.0 | ||
| 66 | credit3.offset_right = 485.0 | ||
| 67 | credit3.offset_bottom = 583.0 | ||
| 68 | credit3.add_theme_stylebox_override("normal", simple_style_box) | ||
| 69 | credit3.text = "PLAYER" | ||
| 70 | credit3.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT | ||
| 71 | credit3.theme = theme | ||
| 72 | panel.add_child(credit3) | ||
| 73 | |||
| 74 | var credit4 = Label.new() | ||
| 75 | credit4.name = "credit4" | ||
| 76 | credit4.offset_left = -105.0 | ||
| 77 | credit4.offset_top = 704.0 | ||
| 78 | credit4.offset_right = 485.0 | ||
| 79 | credit4.offset_bottom = 768.0 | ||
| 80 | credit4.add_theme_stylebox_override("normal", simple_style_box) | ||
| 81 | credit4.text = "PASSWORD" | ||
| 82 | credit4.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT | ||
| 83 | credit4.theme = theme | ||
| 84 | panel.add_child(credit4) | ||
| 85 | |||
| 86 | var credit5 = Label.new() | ||
| 87 | credit5.name = "credit5" | ||
| 88 | credit5.offset_left = 1239.0 | ||
| 89 | credit5.offset_top = 422.0 | ||
| 90 | credit5.offset_right = 1829.0 | ||
| 91 | credit5.offset_bottom = 486.0 | ||
| 92 | credit5.add_theme_stylebox_override("normal", simple_style_box) | ||
| 93 | credit5.text = "OPTIONS" | ||
| 94 | credit5.theme = theme | ||
| 95 | panel.add_child(credit5) | ||
| 96 | |||
| 97 | var server_box = LineEdit.new() | ||
| 98 | server_box.name = "server_box" | ||
| 99 | server_box.offset_left = 502.0 | ||
| 100 | server_box.offset_top = 295.0 | ||
| 101 | server_box.offset_right = 1144.0 | ||
| 102 | server_box.offset_bottom = 445.0 | ||
| 103 | server_box.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER | ||
| 104 | server_box.caret_blink = true | ||
| 105 | panel.add_child(server_box) | ||
| 106 | |||
| 107 | var player_box = LineEdit.new() | ||
| 108 | player_box.name = "player_box" | ||
| 109 | player_box.offset_left = 502.0 | ||
| 110 | player_box.offset_top = 477.0 | ||
| 111 | player_box.offset_right = 1144.0 | ||
| 112 | player_box.offset_bottom = 627.0 | ||
| 113 | player_box.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER | ||
| 114 | player_box.caret_blink = true | ||
| 115 | panel.add_child(player_box) | ||
| 116 | |||
| 117 | var password_box = LineEdit.new() | ||
| 118 | password_box.name = "password_box" | ||
| 119 | password_box.offset_left = 502.0 | ||
| 120 | password_box.offset_top = 659.0 | ||
| 121 | password_box.offset_right = 1144.0 | ||
| 122 | password_box.offset_bottom = 809.0 | ||
| 123 | password_box.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER | ||
| 124 | password_box.caret_blink = true | ||
| 125 | panel.add_child(password_box) | ||
| 126 | |||
| 127 | var accept_dialog = AcceptDialog.new() | ||
| 128 | accept_dialog.name = "AcceptDialog" | ||
| 129 | accept_dialog.offset_right = 83.0 | ||
| 130 | accept_dialog.offset_bottom = 58.0 | ||
| 131 | panel.add_child(accept_dialog) | ||
| 132 | |||
| 133 | var version_mismatch = ConfirmationDialog.new() | ||
| 134 | version_mismatch.name = "VersionMismatch" | ||
| 135 | version_mismatch.offset_right = 83.0 | ||
| 136 | version_mismatch.offset_bottom = 58.0 | ||
| 137 | panel.add_child(version_mismatch) | ||
| 138 | |||
| 139 | var connection_history = MenuButton.new() | ||
| 140 | connection_history.name = "connection_history" | ||
| 141 | connection_history.offset_left = 1239.0 | ||
| 142 | connection_history.offset_top = 276.0 | ||
| 143 | connection_history.offset_right = 1829.0 | ||
| 144 | connection_history.offset_bottom = 372.0 | ||
| 145 | connection_history.text = "connection history" | ||
| 146 | connection_history.flat = false | ||
| 147 | panel.add_child(connection_history) | ||
| 148 | |||
| 149 | var runtime = global.get_node("Runtime") | ||
| 150 | var main_script = runtime.load_script("main.gd") | ||
| 151 | var main_node = main_script.new() | ||
| 152 | main_node.name = "Main" | ||
| 153 | add_child(main_node) | ||
| diff --git a/apworld/client/settings_screen.tscn b/apworld/client/settings_screen.tscn deleted file mode 100644 index 63d5dbe..0000000 --- a/apworld/client/settings_screen.tscn +++ /dev/null | |||
| @@ -1,173 +0,0 @@ | |||
| 1 | [gd_scene load_steps=11 format=2] | ||
| 2 | |||
| 3 | [ext_resource path="res://images/unchecked.png" type="Texture" id=7] | ||
| 4 | [ext_resource path="res://images/checked.png" type="Texture" id=8] | ||
| 5 | [ext_resource type="Theme" uid="uid://7w454egydi41" path="res://assets/themes/baseUI.tres" id="2_g4bvn"] | ||
| 6 | |||
| 7 | [sub_resource type="StyleBoxFlat" id=1] | ||
| 8 | bg_color = Color( 0, 0, 0, 0 ) | ||
| 9 | |||
| 10 | [sub_resource type="StyleBoxFlat" id=2] | ||
| 11 | bg_color = Color( 1, 1, 1, 1 ) | ||
| 12 | border_width_left = 1 | ||
| 13 | border_width_top = 1 | ||
| 14 | border_width_right = 1 | ||
| 15 | border_width_bottom = 1 | ||
| 16 | border_color = Color( 1, 1, 0, 1 ) | ||
| 17 | border_blend = true | ||
| 18 | corner_radius_top_left = 3 | ||
| 19 | corner_radius_top_right = 3 | ||
| 20 | corner_radius_bottom_right = 3 | ||
| 21 | corner_radius_bottom_left = 3 | ||
| 22 | expand_offset_left = 5.0 | ||
| 23 | expand_offset_right = 5.0 | ||
| 24 | expand_offset_top = 5.0 | ||
| 25 | expand_offset_bottom = 5.0 | ||
| 26 | |||
| 27 | [sub_resource id=4 type="GDScript"] | ||
| 28 | script/source = "extends Node2D | ||
| 29 | |||
| 30 | |||
| 31 | func _ready(): | ||
| 32 | var runtime = global.get_node(\"Runtime\") | ||
| 33 | var main_script = runtime.load_path(\"main.gd\") | ||
| 34 | var main_node = main_script.new() | ||
| 35 | main_node.name = \"Main\" | ||
| 36 | add_child(main_node) | ||
| 37 | |||
| 38 | " | ||
| 39 | |||
| 40 | [node name="settings_screen" type="Node2D"] | ||
| 41 | script = SubResource( 4 ) | ||
| 42 | |||
| 43 | [node name="Panel" type="Panel" parent="."] | ||
| 44 | offset_right = 1920.0 | ||
| 45 | offset_bottom = 1080.0 | ||
| 46 | |||
| 47 | [node name="title" parent="Panel" type="Label"] | ||
| 48 | offset_left = 0.0 | ||
| 49 | offset_top = 75.0 | ||
| 50 | offset_right = 1920.0 | ||
| 51 | offset_bottom = 225.0 | ||
| 52 | text = "ARCHIPELAGO" | ||
| 53 | valign = 1 | ||
| 54 | horizontal_alignment = 1 | ||
| 55 | theme = ExtResource("2_g4bvn") | ||
| 56 | |||
| 57 | [node name="credit" parent="Panel" type="Label"] | ||
| 58 | visible = false | ||
| 59 | offset_left = 1278.0 | ||
| 60 | offset_top = 974.0 | ||
| 61 | offset_right = 1868.0 | ||
| 62 | offset_bottom = 1034.0 | ||
| 63 | text = "Brenton Wildes" | ||
| 64 | theme = ExtResource("2_g4bvn") | ||
| 65 | |||
| 66 | [node name="connect_button" parent="Panel" type="Button"] | ||
| 67 | offset_left = 255.0 | ||
| 68 | offset_top = 875.0 | ||
| 69 | offset_right = 891.0 | ||
| 70 | offset_bottom = 1025.0 | ||
| 71 | custom_colors/font_color_hover = Color( 1, 0.501961, 0, 1 ) | ||
| 72 | text = "CONNECT" | ||
| 73 | theme = ExtResource("2_g4bvn") | ||
| 74 | |||
| 75 | [node name="quit_button" parent="Panel" type="Button"] | ||
| 76 | offset_left = 1102.0 | ||
| 77 | offset_top = 875.0 | ||
| 78 | offset_right = 1738.0 | ||
| 79 | offset_bottom = 1025.0 | ||
| 80 | custom_colors/font_color_hover = Color( 1, 0, 0, 1 ) | ||
| 81 | text = "QUIT" | ||
| 82 | theme = ExtResource("2_g4bvn") | ||
| 83 | |||
| 84 | [node name="credit2" parent="Panel" type="Label"] | ||
| 85 | offset_left = -105.0 | ||
| 86 | offset_top = 346.0 | ||
| 87 | offset_right = 485.0 | ||
| 88 | offset_bottom = 410.0 | ||
| 89 | custom_styles/normal = SubResource( 1 ) | ||
| 90 | text = "SERVER" | ||
| 91 | align = 2 | ||
| 92 | theme = ExtResource("2_g4bvn") | ||
| 93 | |||
| 94 | [node name="credit5" parent="Panel" type="Label"] | ||
| 95 | offset_left = 1239.0 | ||
| 96 | offset_top = 422.0 | ||
| 97 | offset_right = 1829.0 | ||
| 98 | offset_bottom = 486.0 | ||
| 99 | custom_styles/normal = SubResource( 1 ) | ||
| 100 | text = "OPTIONS" | ||
| 101 | theme = ExtResource("2_g4bvn") | ||
| 102 | |||
| 103 | [node name="credit3" parent="Panel" type="Label"] | ||
| 104 | offset_left = -105.0 | ||
| 105 | offset_top = 519.0 | ||
| 106 | offset_right = 485.0 | ||
| 107 | offset_bottom = 583.0 | ||
| 108 | custom_styles/normal = SubResource( 1 ) | ||
| 109 | text = "PLAYER" | ||
| 110 | align = 2 | ||
| 111 | theme = ExtResource("2_g4bvn") | ||
| 112 | |||
| 113 | [node name="credit4" parent="Panel" type="Label"] | ||
| 114 | offset_left = -105.0 | ||
| 115 | offset_top = 704.0 | ||
| 116 | offset_right = 485.0 | ||
| 117 | offset_bottom = 768.0 | ||
| 118 | custom_styles/normal = SubResource( 1 ) | ||
| 119 | text = "PASSWORD" | ||
| 120 | align = 2 | ||
| 121 | theme = ExtResource("2_g4bvn") | ||
| 122 | |||
| 123 | [node name="server_box" type="LineEdit" parent="Panel"] | ||
| 124 | offset_left = 502.0 | ||
| 125 | offset_top = 295.0 | ||
| 126 | offset_right = 1144.0 | ||
| 127 | offset_bottom = 445.0 | ||
| 128 | custom_colors/selection_color = Color( 0.482353, 0, 0, 1 ) | ||
| 129 | custom_colors/cursor_color = Color( 0, 0, 0, 1 ) | ||
| 130 | custom_colors/font_color = Color( 0, 0, 0, 1 ) | ||
| 131 | custom_styles/focus = SubResource( 2 ) | ||
| 132 | align = 1 | ||
| 133 | caret_blink = true | ||
| 134 | |||
| 135 | [node name="player_box" type="LineEdit" parent="Panel"] | ||
| 136 | offset_left = 502.0 | ||
| 137 | offset_top = 477.0 | ||
| 138 | offset_right = 1144.0 | ||
| 139 | offset_bottom = 627.0 | ||
| 140 | custom_colors/selection_color = Color( 0.482353, 0, 0, 1 ) | ||
| 141 | custom_colors/cursor_color = Color( 0, 0, 0, 1 ) | ||
| 142 | custom_colors/font_color = Color( 0, 0, 0, 1 ) | ||
| 143 | custom_styles/focus = SubResource( 2 ) | ||
| 144 | align = 1 | ||
| 145 | caret_blink = true | ||
| 146 | |||
| 147 | [node name="password_box" type="LineEdit" parent="Panel"] | ||
| 148 | offset_left = 502.0 | ||
| 149 | offset_top = 659.0 | ||
| 150 | offset_right = 1144.0 | ||
| 151 | offset_bottom = 809.0 | ||
| 152 | custom_colors/selection_color = Color( 0.482353, 0, 0, 1 ) | ||
| 153 | custom_colors/cursor_color = Color( 0, 0, 0, 1 ) | ||
| 154 | custom_colors/font_color = Color( 0, 0, 0, 1 ) | ||
| 155 | custom_styles/focus = SubResource( 2 ) | ||
| 156 | align = 1 | ||
| 157 | caret_blink = true | ||
| 158 | |||
| 159 | [node name="AcceptDialog" type="AcceptDialog" parent="Panel"] | ||
| 160 | offset_right = 83.0 | ||
| 161 | offset_bottom = 58.0 | ||
| 162 | |||
| 163 | [node name="VersionMismatch" type="ConfirmationDialog" parent="Panel"] | ||
| 164 | offset_right = 83.0 | ||
| 165 | offset_bottom = 58.0 | ||
| 166 | |||
| 167 | [node name="connection_history" type="MenuButton" parent="Panel"] | ||
| 168 | offset_left = 1239.0 | ||
| 169 | offset_top = 276.0 | ||
| 170 | offset_right = 1829.0 | ||
| 171 | offset_bottom = 372.0 | ||
| 172 | text = "connection history" | ||
| 173 | flat = false | ||
| diff --git a/apworld/client/source_runtime.gd b/apworld/client/source_runtime.gd index fbb7009..35428ea 100644 --- a/apworld/client/source_runtime.gd +++ b/apworld/client/source_runtime.gd | |||
| @@ -7,9 +7,23 @@ func _init(path): | |||
| 7 | source_path = path | 7 | source_path = path |
| 8 | 8 | ||
| 9 | 9 | ||
| 10 | func load_path(path): | 10 | func load_script(path): |
| 11 | return ResourceLoader.load("%s/%s" % [source_path, path]) | 11 | return ResourceLoader.load("%s/%s" % [source_path, path]) |
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | func read_path(path): | 14 | func read_path(path): |
| 15 | return FileAccess.get_file_as_bytes("%s/%s" % [source_path, path]) | 15 | return FileAccess.get_file_as_bytes("%s/%s" % [source_path, path]) |
| 16 | |||
| 17 | |||
| 18 | func load_script_as_scene(path, scene_name): | ||
| 19 | var script = load_script(path) | ||
| 20 | var instance = script.new() | ||
| 21 | instance.name = scene_name | ||
| 22 | |||
| 23 | get_tree().unload_current_scene() | ||
| 24 | _load_scene.call_deferred(instance) | ||
| 25 | |||
| 26 | |||
| 27 | func _load_scene(instance): | ||
| 28 | get_tree().get_root().add_child(instance) | ||
| 29 | get_tree().current_scene = instance | ||
