Added management of overlapped item in room 9.
This commit is contained in:
@@ -173,13 +173,13 @@ func manage_input(viewport : Viewport, event : InputEvent, shape_idx : int):
|
||||
|
||||
if event.doubleclick:
|
||||
if event.button_index == BUTTON_LEFT:
|
||||
emit_signal("mouse_double_left_clicked_item", global_id, event)
|
||||
emit_signal("mouse_double_left_clicked_item", self, event)
|
||||
else:
|
||||
if event.is_pressed():
|
||||
if event.button_index == BUTTON_LEFT:
|
||||
emit_signal("mouse_left_clicked_item", global_id, event)
|
||||
emit_signal("mouse_left_clicked_item", self, event)
|
||||
elif event.button_index == BUTTON_RIGHT:
|
||||
emit_signal("mouse_right_clicked_item", global_id, event)
|
||||
emit_signal("mouse_right_clicked_item", self, event)
|
||||
|
||||
|
||||
func _on_mouse_entered():
|
||||
|
||||
@@ -60,7 +60,7 @@ 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:
|
||||
if item.z_index > hover_stack.back().z_index:
|
||||
hover_stack.insert(hover_stack.size()-1, item)
|
||||
else:
|
||||
hover_stack.push_back(item)
|
||||
@@ -82,17 +82,18 @@ func _on_mouse_exited_item(item : ESCItem) -> void:
|
||||
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)
|
||||
escoria.main.current_scene.game.left_click_on_item(item_global_id, event)
|
||||
func _on_mouse_left_clicked_item(item : ESCItem, event : InputEvent) -> void:
|
||||
if hover_stack.empty() or hover_stack.back() == item:
|
||||
printt("Item left clicked", item.global_id, event)
|
||||
escoria.main.current_scene.game.left_click_on_item(item.global_id, event)
|
||||
|
||||
func _on_mouse_left_double_clicked_item(item_global_id : String, event : InputEvent) -> void:
|
||||
printt("Item left double clicked", item_global_id, event)
|
||||
escoria.main.current_scene.game.left_double_click_on_item(item_global_id, event)
|
||||
|
||||
func _on_mouse_right_clicked_item(item_global_id : String, event : InputEvent) -> void:
|
||||
printt("Item right clicked", item_global_id, event)
|
||||
escoria.main.current_scene.game.right_click_on_item(item_global_id, event)
|
||||
func _on_mouse_left_double_clicked_item(item : ESCItem, event : InputEvent) -> void:
|
||||
printt("Item left double clicked", item.global_id, event)
|
||||
escoria.main.current_scene.game.left_double_click_on_item(item.global_id, event)
|
||||
|
||||
func _on_mouse_right_clicked_item(item : ESCItem, event : InputEvent) -> void:
|
||||
printt("Item right clicked", item.global_id, event)
|
||||
escoria.main.current_scene.game.right_click_on_item(item.global_id, event)
|
||||
|
||||
|
||||
##################################################################################
|
||||
|
||||
@@ -49,6 +49,10 @@ func add_new_item_by_id(item_id : String) -> void:
|
||||
escoria.report_errors("inventory_ui.gd:add_new_item_by_id()",
|
||||
["Item global id '"+ item_id + "' does not exist.",
|
||||
"Check item's id in ESCORIA_ALL_ITEMS scene."])
|
||||
if !all_items.get_inventory_item(item_id):
|
||||
escoria.report_errors("inventory_ui.gd:add_new_item_by_id()",
|
||||
["Item global id '"+ item_id + "' doesn't have corresponding inventory item.",
|
||||
"Check item's id in ESCORIA_ALL_ITEMS scene."])
|
||||
var item_inventory_button = all_items.get_inventory_item(item_id).duplicate()
|
||||
items_ids_in_inventory[item_id] = item_inventory_button
|
||||
get_node(items_container).add_item(item_inventory_button)
|
||||
|
||||
Reference in New Issue
Block a user