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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
[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"]
|