about summary refs log tree commit diff stats
path: root/client/archipelago.tscn
blob: 1c156a38c4bd71fac8b9721c7705e1ffbaddd2bd (plain) (blame)
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
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char 
[gd_scene load_steps=3 format=3 uid="uid://b5mj3cq2bcesd"]

[ext_resource type="Theme" uid="uid://7w454egydi41" path="res://assets/themes/baseUI.tres" id="1_mw3f1"]

[sub_resource id=2 type="GDScript"]
script/source = "extends Node2D

const CACHE_PATH = \"user://apworld_path.txt\"


func _ready():
	if FileAccess.file_exists(CACHE_PATH):
		var file = FileAccess.open(CACHE_PATH, FileAccess.READ)
		$Panel/HBoxContainer/LineEdit.text = file.get_as_text()
		file.close()


func _browse_pressed():
	$FileDialog.popup_centered()


func _file_selected(path):
	$Panel/HBoxContainer/LineEdit.text = path


func _start_pressed():
	var apworld_path = $Panel/HBoxContainer/LineEdit.text

	if not FileAccess.file_exists(apworld_path):
		$AcceptDialog.popup_centered()
		return

	var zip_reader = ZIPReader.new()
	zip_reader.open(apworld_path)

	var inner_path = \"lingo2/client/apworld_runtime.gd\"
	if not zip_reader.file_exists(inner_path):
		zip_reader.close()
		$AcceptDialog.popup_centered()
		return
	
	var cache_file = FileAccess.open(CACHE_PATH, FileAccess.WRITE)
	cache_file.store_string(apworld_path)
	cache_file.close()
	
	var runtime_script = GDScript.new()
	runtime_script.source_code = zip_reader.read_file(inner_path).get_string_from_utf8()
	runtime_script.reload()

	zip_reader.close()

	var runtime = runtime_script.new(apworld_path)
	runtime.name = \"Runtime\"

	global.add_child(runtime)

	runtime.load_script_as_scene.call_deferred(\"settings_screen.gd\", \"settings_screen\")


func _quit_pressed():
	get_tree().change_scene_to_file(\"res://objects/scenes/menus/main_menu.tscn\")

"

[node name="Node2D" type="Node2D"]
script = SubResource( 2 )

[node name="Panel" type="Panel" parent="."]
anchors_preset = -1
offset_right = 1920.0
offset_bottom = 1080.0

[node name="Label" type="Label" parent="Panel"]
layout_mode = 1
anchors_preset = -1
offset_top = 75.0
offset_right = 1920.0
offset_bottom = 225.0
theme = ExtResource("1_mw3f1")
text = "archipelago"
horizontal_alignment = 1
vertical_alignment = 1

[node name="Label2" type="Label" parent="Panel"]
layout_mode = 1
anchors_preset = -1
anchor_right = 1.0
offset_left = 80.0
offset_top = 300.0
offset_right = -80.0
offset_bottom = 388.0
theme = ExtResource("1_mw3f1")
theme_override_font_sizes/font_size = 56
text = "Put the path to your lingo2.apworld in the below field and click start. Then, open the archipelago launcher and click \"Lingo 2 Client\"."
horizontal_alignment = 1
autowrap_mode = 3

[node name="HBoxContainer" type="HBoxContainer" parent="Panel"]
layout_mode = 1
anchors_preset = -1
anchor_right = 1.0
offset_left = 80.0
offset_top = 595.0
offset_right = -80.0
offset_bottom = 755.0
theme_override_constants/separation = 32

[node name="LineEdit" type="LineEdit" parent="Panel/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3

[node name="Button" type="Button" parent="Panel/HBoxContainer"]
layout_mode = 2
theme = ExtResource("1_mw3f1")
text = "browse"

[node name="StartButton" type="Button" parent="Panel"]
layout_mode = 1
anchors_preset = -1
offset_left = 255.0
offset_top = 875.0
offset_right = 891.0
offset_bottom = 1025.0
theme = ExtResource("1_mw3f1")
text = "start"

[node name="QuitButton" type="Button" parent="Panel"]
layout_mode = 1
anchors_preset = -1
offset_left = 1102.0
offset_top = 875.0
offset_right = 1738.0
offset_bottom = 1025.0
theme = ExtResource("1_mw3f1")
text = "back"

[node name="FileDialog" type="FileDialog" parent="."]
title = "Open a File"
size = Vector2i(512, 512)
ok_button_text = "Open"
file_mode = 0
access = 2
filters = PackedStringArray("*.apworld;Archipelago Worlds")
show_hidden_files = true
use_native_dialog = true

[node name="AcceptDialog" type="AcceptDialog" parent="."]
dialog_text = "Could not open Lingo 2 apworld. Please check that the path is correct."

[connection signal="pressed" from="Panel/HBoxContainer/Button" to="." method="_browse_pressed"]
[connection signal="pressed" from="Panel/StartButton" to="." method="_start_pressed"]
[connection signal="pressed" from="Panel/QuitButton" to="." method="_quit_pressed"]
[connection signal="file_selected" from="FileDialog" to="." method="_file_selected"]