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:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -375,7 +375,7 @@ func change_scene(params, context, run_events=true):
|
||||
# Finally we add the setup on to of the events stack so that it is ran first
|
||||
run_event(events["setup"])
|
||||
|
||||
escoria.inputs_manager.is_hotspot_focused = false
|
||||
escoria.inputs_manager.hotspot_focused = ""
|
||||
if !scenes_cache_list.has(params[0]):
|
||||
scenes_cache_list.push_back(params[0])
|
||||
scenes_cache[room_scene.global_id] = params[0]
|
||||
@@ -431,7 +431,7 @@ func superpose_scene(params, context, run_events=true):
|
||||
get_node("/root").add_child(room_scene)
|
||||
|
||||
|
||||
escoria.inputs_manager.is_hotspot_focused = false
|
||||
escoria.inputs_manager.hotspot_focused = false
|
||||
if !scenes_cache_list.has(params[0]):
|
||||
scenes_cache_list.push_back(params[0])
|
||||
if room_scene.get("global_id"):
|
||||
|
||||
@@ -9,8 +9,8 @@ func get_class():
|
||||
ESCItem is a Sprite that defines an item, potentially interactive
|
||||
"""
|
||||
|
||||
signal mouse_entered_item(global_id)
|
||||
signal mouse_exited_item
|
||||
signal mouse_entered_item(item)
|
||||
signal mouse_exited_item(item)
|
||||
signal mouse_left_clicked_item(global_id)
|
||||
signal mouse_double_left_clicked_item(global_id)
|
||||
signal mouse_right_clicked_item(global_id)
|
||||
@@ -183,10 +183,10 @@ func manage_input(viewport : Viewport, event : InputEvent, shape_idx : int):
|
||||
|
||||
|
||||
func _on_mouse_entered():
|
||||
emit_signal("mouse_entered_item", global_id)
|
||||
emit_signal("mouse_entered_item", self)
|
||||
|
||||
func _on_mouse_exited():
|
||||
emit_signal("mouse_exited_item")
|
||||
emit_signal("mouse_exited_item", self)
|
||||
|
||||
################################################################################
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ func do(action : String, params : Array = []) -> void:
|
||||
match action:
|
||||
"walk":
|
||||
# Reset current action.
|
||||
esc_runner.set_current_action("")
|
||||
esc_runner.clear_current_action()
|
||||
|
||||
# Check moving object.
|
||||
if !escoria.esc_runner.check_obj(params[0], "escoria.do(walk)"):
|
||||
@@ -262,7 +262,6 @@ func ev_left_click_on_item(obj, event, default_action = false):
|
||||
|
||||
# If no interaction should happen after player has arrived, leave immediately.
|
||||
if dont_interact:
|
||||
print("DONT INTERACT WAS TRUE")
|
||||
return
|
||||
|
||||
var player_global_pos = main.current_scene.player.global_position
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
tool
|
||||
extends Node
|
||||
|
||||
var is_hotspot_focused : bool
|
||||
onready var hover_stack : Array = []
|
||||
onready var hotspot_focused : String = ""
|
||||
|
||||
|
||||
func _ready():
|
||||
set_process_input(true)
|
||||
@@ -13,19 +15,19 @@ func _input(event):
|
||||
###################################################################################
|
||||
|
||||
func _on_left_click_on_bg(position : Vector2):
|
||||
if !is_hotspot_focused:
|
||||
if hotspot_focused.empty():
|
||||
printt("Left click on background at ", str(position))
|
||||
escoria.main.current_scene.game.left_click_on_bg(position)
|
||||
|
||||
|
||||
func _on_double_left_click_on_bg(position : Vector2):
|
||||
if !is_hotspot_focused:
|
||||
if hotspot_focused.empty():
|
||||
printt("Double left click on background at ", str(position))
|
||||
escoria.main.current_scene.game.left_double_click_on_bg(position)
|
||||
|
||||
|
||||
func _on_right_click_on_bg(position : Vector2):
|
||||
if !is_hotspot_focused:
|
||||
if hotspot_focused.empty():
|
||||
printt("Right click on background at ", str(position))
|
||||
escoria.main.current_scene.game.right_click_on_bg(position)
|
||||
|
||||
@@ -54,15 +56,31 @@ func _on_mouse_exited_inventory_item() -> void:
|
||||
|
||||
##################################################################################
|
||||
|
||||
func _on_mouse_entered_item(item_global_id : String) -> void:
|
||||
printt("Item focused : ", item_global_id)
|
||||
is_hotspot_focused = true
|
||||
escoria.main.current_scene.game.element_focused(item_global_id)
|
||||
func _on_mouse_entered_item(item : ESCItem) -> void:
|
||||
printt("Item focused : ", item.global_id)
|
||||
|
||||
if !hover_stack.empty():
|
||||
if item.z_index < hover_stack.back().z_index:
|
||||
hover_stack.insert(hover_stack.size()-1, item)
|
||||
else:
|
||||
hover_stack.push_back(item)
|
||||
else:
|
||||
hover_stack.push_back(item)
|
||||
|
||||
hotspot_focused = hover_stack.back().global_id
|
||||
escoria.main.current_scene.game.element_focused(item.global_id)
|
||||
|
||||
func _on_mouse_exited_item() -> void:
|
||||
print("Item unfocused")
|
||||
is_hotspot_focused = false
|
||||
escoria.main.current_scene.game.element_unfocused()
|
||||
|
||||
func _on_mouse_exited_item(item : ESCItem) -> void:
|
||||
printt("Item unfocused : ", item.global_id)
|
||||
hover_stack.erase(item)
|
||||
if hover_stack.empty():
|
||||
hotspot_focused = ""
|
||||
escoria.main.current_scene.game.element_unfocused()
|
||||
else:
|
||||
hotspot_focused = hover_stack.back().global_id
|
||||
escoria.main.current_scene.game.element_focused(hotspot_focused)
|
||||
|
||||
|
||||
func _on_mouse_left_clicked_item(item_global_id : String, event : InputEvent) -> void:
|
||||
printt("Item left clicked", item_global_id, event)
|
||||
|
||||
@@ -179,3 +179,8 @@ func check_game_scene_methods():
|
||||
assert(current_scene.game.has_method("inventory_item_unfocused"))
|
||||
|
||||
assert(current_scene.game.has_method("mousewheel_action"))
|
||||
|
||||
assert(current_scene.game.has_method("hide_ui"))
|
||||
assert(current_scene.game.has_method("show_ui"))
|
||||
assert(current_scene.game.has_method("_on_event_done"))
|
||||
|
||||
|
||||
@@ -19,31 +19,31 @@ func on_action_selected() -> void:
|
||||
current_action = escoria.esc_runner.current_action
|
||||
update_tooltip_text()
|
||||
|
||||
func element_focused(element_id : String) -> void:
|
||||
printt("action_target_tooltip.gd:on_element_focused()", "Element focused: ", element_id)
|
||||
|
||||
if element_id == "":
|
||||
set_target("")
|
||||
return
|
||||
|
||||
var object = escoria.esc_runner.get_object(element_id)
|
||||
|
||||
if object == null or !is_instance_valid(object):
|
||||
escoria.report_warnings("action_target_tooltip.gd:on_element_focused()",
|
||||
["Object exists but is not loaded for id " + element_id])
|
||||
set_target(element_id)
|
||||
return
|
||||
|
||||
if !escoria.esc_runner.get_interactive(element_id) and !object is ESCInventoryItem:
|
||||
set_target("")
|
||||
return
|
||||
|
||||
var wait_for_target = false
|
||||
if object is ESCItem or object is ESCInventoryItem:
|
||||
if current_action in object.combine_if_action_used_among:
|
||||
wait_for_target = true
|
||||
|
||||
set_target(object.tooltip_name, wait_for_target)
|
||||
#func element_focused(element_id : String) -> void:
|
||||
# printt("action_target_tooltip.gd:on_element_focused()", "Element focused: ", element_id)
|
||||
#
|
||||
# if element_id == "":
|
||||
# set_target("")
|
||||
# return
|
||||
#
|
||||
# var object = escoria.esc_runner.get_object(element_id)
|
||||
#
|
||||
# if object == null or !is_instance_valid(object):
|
||||
# escoria.report_warnings("action_target_tooltip.gd:on_element_focused()",
|
||||
# ["Object exists but is not loaded for id " + element_id])
|
||||
# set_target(element_id)
|
||||
# return
|
||||
#
|
||||
# if !escoria.esc_runner.get_interactive(element_id) and !object is ESCInventoryItem:
|
||||
# set_target("")
|
||||
# return
|
||||
#
|
||||
# var wait_for_target = false
|
||||
# if object is ESCItem or object is ESCInventoryItem:
|
||||
# if current_action in object.combine_if_action_used_among:
|
||||
# wait_for_target = true
|
||||
#
|
||||
# set_target(object.tooltip_name, wait_for_target)
|
||||
|
||||
|
||||
func set_target(target : String, needs_second_target : bool = false) -> void:
|
||||
|
||||
@@ -20,3 +20,6 @@ points = PoolVector2Array( 2.86993, 4.8189, 2.86993, 53.646, 50.8979, 53.9476, 5
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2( 26.9811, 29.4218 )
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="dialog_position" type="Position2D" parent="."]
|
||||
position = Vector2( 22.0044, -141.187 )
|
||||
|
||||
@@ -1,5 +1,27 @@
|
||||
:look
|
||||
say player "That button must activate the bridge."
|
||||
> [! r2_look_dialog_advance]
|
||||
say player "That button must activate the bridge."
|
||||
set_global r2_look_dialog_advance 1
|
||||
stop
|
||||
> [eq r2_look_dialog_advance 1]
|
||||
say player "I already said that this button must activate the bridge."
|
||||
set_global r2_look_dialog_advance 2
|
||||
stop
|
||||
> [eq r2_look_dialog_advance 2]
|
||||
set_angle player 180
|
||||
say player "Listen closely."
|
||||
say player "This"
|
||||
say player "button"
|
||||
say player "must"
|
||||
say player "activate"
|
||||
say player "the bridge."
|
||||
set_global r2_look_dialog_advance 3
|
||||
stop
|
||||
> [eq r2_look_dialog_advance 3]
|
||||
say player "I give up."
|
||||
say player "<sob>"
|
||||
stop
|
||||
|
||||
|
||||
:push
|
||||
say player "I must USE this."
|
||||
|
||||
@@ -53,6 +53,7 @@ script = ExtResource( 7 )
|
||||
global_id = "r2_r_exit"
|
||||
esc_script = "res://game/rooms/room2/esc/right_exit.esc"
|
||||
is_exit = true
|
||||
tooltip_name = "Right exit"
|
||||
dialog_color = Color( 1, 1, 1, 1 )
|
||||
interact_positions = {
|
||||
"default": Vector2( 1225.47, 353.99 )
|
||||
@@ -69,6 +70,7 @@ script = ExtResource( 7 )
|
||||
global_id = "r2_l_exit"
|
||||
esc_script = "res://game/rooms/room2/esc/left_exit.esc"
|
||||
is_exit = true
|
||||
tooltip_name = "Left exit"
|
||||
dialog_color = Color( 1, 1, 1, 1 )
|
||||
interact_positions = {
|
||||
"default": Vector2( 52.1462, 384.691 )
|
||||
@@ -84,6 +86,7 @@ position = Vector2( 52.1462, 384.691 )
|
||||
position = Vector2( 958.107, 176.401 )
|
||||
global_id = "r2_button_right"
|
||||
esc_script = "res://game/rooms/room2/esc/button.esc"
|
||||
dialog_color = Color( 0, 1, 0.109804, 1 )
|
||||
interact_positions = {
|
||||
"default": Vector2( 987.537, 371.812 )
|
||||
}
|
||||
@@ -98,6 +101,7 @@ __meta__ = {
|
||||
position = Vector2( 288.82, 171.439 )
|
||||
global_id = "r2_button"
|
||||
esc_script = "res://game/rooms/room2/esc/button.esc"
|
||||
dialog_color = Color( 0, 1, 0.109804, 1 )
|
||||
interact_positions = {
|
||||
"default": Vector2( 313.488, 368.437 )
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ __meta__ = {
|
||||
"_edit_vertical_guides_": [ ]
|
||||
}
|
||||
global_id = "room8"
|
||||
esc_script = "res://game/rooms/room1/esc/room1.esc"
|
||||
esc_script = "res://game/rooms/room8/esc/room8.esc"
|
||||
player_scene = ExtResource( 4 )
|
||||
camera_limits = [ Rect2( 0, 0, 1289, 555 ) ]
|
||||
|
||||
|
||||
@@ -46,6 +46,18 @@ tracks/2/keys = {
|
||||
"update": 1,
|
||||
"values": [ false ]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/path = NodePath("statue:visible")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [ false ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=4]
|
||||
length = 0.5
|
||||
@@ -85,6 +97,18 @@ tracks/2/keys = {
|
||||
"update": 1,
|
||||
"values": [ false ]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/path = NodePath("statue:visible")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [ false ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=5]
|
||||
length = 0.5
|
||||
@@ -124,6 +148,18 @@ tracks/2/keys = {
|
||||
"update": 1,
|
||||
"values": [ true ]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/path = NodePath("statue:visible")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [ true ]
|
||||
}
|
||||
|
||||
[node name="closet" type="Area2D"]
|
||||
script = ExtResource( 1 )
|
||||
@@ -185,20 +221,24 @@ default_color = Color( 0.4, 0.501961, 1, 1 )
|
||||
color = Color( 0.4, 0.501961, 1, 1 )
|
||||
polygon = PoolVector2Array( 1.07718, 7.2891, -37.6216, 23.335, -37.6216, 328.206, 2.02106, 302.722 )
|
||||
|
||||
[node name="statue" type="Area2D" parent="base/open_object"]
|
||||
[node name="statue" type="Area2D" parent="."]
|
||||
visible = false
|
||||
position = Vector2( 1.12247, 0 )
|
||||
z_index = 1
|
||||
script = ExtResource( 1 )
|
||||
global_id = "statue"
|
||||
tooltip_name = "Statue"
|
||||
dialog_color = Color( 1, 1, 1, 1 )
|
||||
interact_positions = {
|
||||
"default": Vector2( 59.3937, 58.8658 )
|
||||
}
|
||||
|
||||
[node name="object" type="Polygon2D" parent="base/open_object/statue"]
|
||||
[node name="object" type="Polygon2D" parent="statue"]
|
||||
position = Vector2( 1.18921, 7.13524 )
|
||||
color = Color( 0.662745, 0.529412, 0, 1 )
|
||||
polygon = PoolVector2Array( 52.338, 36.2829, 57.6774, 26.2716, 62.3493, 36.9503, 70.3583, 35.6154, 70.692, 27.2727, 76.3651, 26.6053, 76.3651, 29.9424, 72.9964, 30.7421, 72.9964, 39.2744, 61.4878, 45.624, 69.2264, 73.602, 43.4311, 73.4035, 53.7492, 45.4256, 41.4468, 39.8697, 41.6453, 31.139, 37.8752, 30.3453, 37.6768, 26.5752, 44.4232, 27.7657, 44.4232, 34.1154 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="base/open_object/statue"]
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="statue"]
|
||||
position = Vector2( 58.2712, 58.8658 )
|
||||
shape = SubResource( 1 )
|
||||
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
|
||||
:open
|
||||
> [left_closet_open]
|
||||
stop
|
||||
|
||||
set_global left_closet_open true
|
||||
inc_global open_closets 1
|
||||
|
||||
> [lt open_closets 3]
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
|
||||
:open
|
||||
> [middle_closet_open]
|
||||
stop
|
||||
|
||||
set_global middle_closet_open true
|
||||
inc_global open_closets 1
|
||||
|
||||
> [lt open_closets 3]
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
|
||||
:open
|
||||
> [right_closet_open]
|
||||
stop
|
||||
|
||||
set_global right_closet_open true
|
||||
inc_global open_closets 1
|
||||
|
||||
> [lt open_closets 3]
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
:exit_scene
|
||||
change_scene "res://game/rooms/room7/room7.tscn"
|
||||
change_scene "res://game/rooms/room8/room8.tscn"
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.5 KiB |
@@ -1,34 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/empty_sheet.png-76792812151af35ec4a677d2674810fc.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://game/rooms/room9/items/empty_sheet.png"
|
||||
dest_files=[ "res://.import/empty_sheet.png-76792812151af35ec4a677d2674810fc.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.4 KiB |
@@ -1,34 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/filled_sheet.png-b2986fedd542821915ec877a570a0934.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://game/rooms/room9/items/filled_sheet.png"
|
||||
dest_files=[ "res://.import/filled_sheet.png-b2986fedd542821915ec877a570a0934.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 918 B |
@@ -1,34 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/pen.png-185eba49da7d77d331c5119550be859c.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://game/rooms/room9/items/pen.png"
|
||||
dest_files=[ "res://.import/pen.png-185eba49da7d77d331c5119550be859c.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 857 B |
@@ -1,34 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/wrench.png-cd78241d27aa0dc800a83edce9459724.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://game/rooms/room9/items/wrench.png"
|
||||
dest_files=[ "res://.import/wrench.png-cd78241d27aa0dc800a83edce9459724.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
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"]
|
||||
@@ -24,10 +24,14 @@ Implement methods to react to inputs.
|
||||
|
||||
- mousewheel_action(direction : int)
|
||||
|
||||
- hide_ui()
|
||||
- show_ui()
|
||||
|
||||
- _on_event_done(event_name: String)
|
||||
"""
|
||||
|
||||
signal element_focused(element_global_id)
|
||||
func _ready():
|
||||
escoria.esc_runner.connect("event_done", self, "_on_event_done")
|
||||
|
||||
|
||||
func _input(event):
|
||||
@@ -42,29 +46,27 @@ func _input(event):
|
||||
|
||||
func left_click_on_bg(position : Vector2) -> void:
|
||||
escoria.do("walk", ["player", position])
|
||||
escoria.esc_runner.clear_current_action()
|
||||
$ui/verbs_layer/verbs_menu.unselect_actions()
|
||||
|
||||
func right_click_on_bg(position : Vector2) -> void:
|
||||
escoria.do("walk", ["player", position])
|
||||
escoria.esc_runner.clear_current_action()
|
||||
$ui/verbs_layer/verbs_menu.unselect_actions()
|
||||
|
||||
func left_double_click_on_bg(position : Vector2) -> void:
|
||||
escoria.do("walk", ["player", position, true])
|
||||
escoria.esc_runner.clear_current_action()
|
||||
$ui/verbs_layer/verbs_menu.unselect_actions()
|
||||
|
||||
|
||||
## ITEM FOCUS ##
|
||||
|
||||
func element_focused(element_id : String) -> void:
|
||||
#emit_signal("element_focused", element_id)
|
||||
# var target_obj = escoria.esc_runner.get_object(element_id)
|
||||
# if escoria.esc_runner.current_action != "use" && escoria.esc_runner.current_tool == null:
|
||||
# if target_obj is ESCItem or target_obj is ESCHotspot:
|
||||
# $ui/verbs_layer/verbs_menu.set_by_name(target_obj.default_action)
|
||||
pass
|
||||
|
||||
$ui/tooltip_layer/tooltip.set_target(escoria.esc_runner.get_object(element_id).tooltip_name)
|
||||
|
||||
func element_unfocused() -> void:
|
||||
#emit_signal("element_focused", "")
|
||||
#$ui/verbs_layer/verbs_menu.set_by_name("walk")
|
||||
pass
|
||||
$ui/tooltip_layer/tooltip.set_target("")
|
||||
|
||||
|
||||
## ITEMS ##
|
||||
@@ -97,10 +99,10 @@ func left_double_click_on_inventory_item(inventory_item_global_id : String, even
|
||||
pass
|
||||
|
||||
func inventory_item_focused(inventory_item_global_id : String) -> void:
|
||||
emit_signal("element_focused", inventory_item_global_id)
|
||||
$ui/tooltip_layer/tooltip.set_target(escoria.esc_runner.get_object(inventory_item_global_id).tooltip_name)
|
||||
|
||||
func inventory_item_unfocused() -> void:
|
||||
emit_signal("element_focused", "")
|
||||
$ui/tooltip_layer/tooltip.set_target("")
|
||||
|
||||
|
||||
func open_inventory():
|
||||
@@ -124,3 +126,7 @@ func show_ui():
|
||||
$ui/verbs_layer/verbs_menu.show()
|
||||
$ui/inventory_layer/inventory_ui.show()
|
||||
$ui/tooltip_layer/tooltip.show()
|
||||
|
||||
func _on_event_done(event_name: String):
|
||||
escoria.esc_runner.clear_current_action()
|
||||
$ui/verbs_layer/verbs_menu.unselect_actions()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=8 format=2]
|
||||
[gd_scene load_steps=9 format=2]
|
||||
|
||||
[ext_resource path="res://addons/escoria-core/template_scenes/label/action_target_tooltip.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://game/ui/ui_9verbs/inventory/inventory_ui.tscn" type="PackedScene" id=2]
|
||||
@@ -6,6 +6,7 @@
|
||||
[ext_resource path="res://addons/escoria-core/game/scenes/dialogs/dialog_player.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://game/ui/ui_9verbs/game.gd" type="Script" id=5]
|
||||
[ext_resource path="res://addons/escoria-core/game/scenes/camera_player/camera.tscn" type="PackedScene" id=6]
|
||||
[ext_resource path="res://game/ui/commons/room_select.tscn" type="PackedScene" id=7]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=1]
|
||||
bg_color = Color( 0.6, 0.6, 0.6, 0.5 )
|
||||
@@ -34,6 +35,12 @@ margin_top = 615.331
|
||||
margin_right = 21.097
|
||||
margin_bottom = 615.331
|
||||
|
||||
[node name="room_select" parent="ui/verbs_layer" instance=ExtResource( 7 )]
|
||||
margin_left = 394.817
|
||||
margin_top = 756.336
|
||||
margin_right = 423.817
|
||||
margin_bottom = 776.336
|
||||
|
||||
[node name="inventory_layer" type="CanvasLayer" parent="ui"]
|
||||
layer = 2
|
||||
|
||||
@@ -61,4 +68,13 @@ layer = 3
|
||||
|
||||
[node name="dialog_player" parent="ui/dialog_layer" instance=ExtResource( 4 )]
|
||||
|
||||
[node name="hover_stack" type="Label" parent="ui"]
|
||||
margin_left = 1085.0
|
||||
margin_top = 2.81912
|
||||
margin_right = 1283.0
|
||||
margin_bottom = 107.819
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="camera" parent="." instance=ExtResource( 6 )]
|
||||
|
||||
@@ -17,3 +17,6 @@ func _on_action_selected(action : String):
|
||||
for but in $actions.get_children():
|
||||
but.set_pressed(but.get_name() == action)
|
||||
|
||||
func unselect_actions():
|
||||
for but in $actions.get_children():
|
||||
but.set_pressed(false)
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
[ext_resource path="res://game/ui/ui_9verbs/verbs_menu.gd" type="Script" id=1]
|
||||
|
||||
|
||||
[node name="verbs_menu" type="Control"]
|
||||
margin_left = 1.0
|
||||
margin_right = 1.0
|
||||
|
||||
Reference in New Issue
Block a user