Added hover stack to manage overlapping Area2Ds
Added room selector in demo scenes Modified dialogues in room 1, fixed bug in room 8 and 9
This commit is contained in:
36
game/ui/commons/room_select.gd
Normal file
36
game/ui/commons/room_select.gd
Normal file
@@ -0,0 +1,36 @@
|
||||
extends OptionButton
|
||||
|
||||
var selected_id = 0
|
||||
var options_paths = []
|
||||
|
||||
func _ready():
|
||||
var rooms_folder = "res://game/rooms/"
|
||||
var dir = Directory.new()
|
||||
var i = 1
|
||||
if dir.open(rooms_folder) == OK:
|
||||
dir.list_dir_begin(true)
|
||||
var file_name = dir.get_next()
|
||||
while file_name != "":
|
||||
if dir.current_is_dir():
|
||||
add_item(file_name)
|
||||
options_paths.push_back("res://game/rooms/" + file_name + "/" + file_name + ".tscn")
|
||||
i += 1
|
||||
file_name = dir.get_next()
|
||||
|
||||
else:
|
||||
escoria.report_errors("room_select.gd:_ready()",
|
||||
["A problem occurred while opening rooms folder."])
|
||||
|
||||
|
||||
func _on_button_pressed():
|
||||
var actual_command = ":debug\nchange_scene " + options_paths[selected_id] + "\n"
|
||||
|
||||
var errors = []
|
||||
var events = escoria.esc_compiler.compile_str(actual_command, errors)
|
||||
|
||||
if errors.empty():
|
||||
#past_actions.text += str(events)
|
||||
var ret = escoria.esc_runner.run_event(events["debug"])
|
||||
|
||||
func _on_option_item_selected(index):
|
||||
selected_id = index
|
||||
24
game/ui/commons/room_select.tscn
Normal file
24
game/ui/commons/room_select.tscn
Normal file
@@ -0,0 +1,24 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://game/ui/commons/room_select.gd" type="Script" id=1]
|
||||
|
||||
[node name="room_select" type="HBoxContainer"]
|
||||
margin_right = 63.0
|
||||
margin_bottom = 40.0005
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="option" type="OptionButton" parent="."]
|
||||
margin_right = 29.0
|
||||
margin_bottom = 40.0
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="button" type="Button" parent="."]
|
||||
margin_left = 33.0
|
||||
margin_right = 63.0
|
||||
margin_bottom = 40.0
|
||||
text = "Go"
|
||||
|
||||
[connection signal="item_selected" from="option" to="option" method="_on_option_item_selected"]
|
||||
[connection signal="pressed" from="button" to="option" method="_on_button_pressed"]
|
||||
Reference in New Issue
Block a user