Finished ESC camera commands reimplementation.
Some cleaning done, and all logging commands put in escoria.logger script.
This commit is contained in:
@@ -8,6 +8,7 @@ onready var hotspot_focused : String = ""
|
||||
func _ready():
|
||||
set_process_input(true)
|
||||
|
||||
|
||||
func _input(event):
|
||||
if event.is_action_pressed("esc_show_debug_prompt"):
|
||||
escoria.main.get_node("layers/debug_layer/esc_prompt_popup").popup()
|
||||
@@ -16,48 +17,53 @@ func _input(event):
|
||||
|
||||
func _on_left_click_on_bg(position : Vector2):
|
||||
if hotspot_focused.empty():
|
||||
printt("Left click on background at ", str(position))
|
||||
escoria.logger.info("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 hotspot_focused.empty():
|
||||
printt("Double left click on background at ", str(position))
|
||||
escoria.logger.info("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 hotspot_focused.empty():
|
||||
printt("Right click on background at ", str(position))
|
||||
escoria.logger.info("Right click on background at ", [str(position)])
|
||||
escoria.main.current_scene.game.right_click_on_bg(position)
|
||||
|
||||
##################################################################################
|
||||
|
||||
func _on_mouse_left_click_inventory_item(inventory_item_global_id, event : InputEvent) -> void:
|
||||
printt("Inventory item left clicked ", inventory_item_global_id)
|
||||
escoria.logger.info("Inventory item left clicked ", [inventory_item_global_id])
|
||||
escoria.main.current_scene.game.left_click_on_inventory_item(inventory_item_global_id, event)
|
||||
|
||||
|
||||
func _on_mouse_right_click_inventory_item(inventory_item_global_id, event : InputEvent) -> void:
|
||||
printt("Inventory item right clicked ", inventory_item_global_id)
|
||||
escoria.logger.info("Inventory item right clicked ", [inventory_item_global_id])
|
||||
escoria.main.current_scene.game.right_click_on_inventory_item(inventory_item_global_id, event)
|
||||
|
||||
|
||||
func _on_mouse_double_left_click_inventory_item(inventory_item_global_id, event : InputEvent) -> void:
|
||||
printt("Inventory item double left clicked ", inventory_item_global_id)
|
||||
escoria.logger.info("Inventory item double left clicked ", [inventory_item_global_id])
|
||||
escoria.main.current_scene.game.left_double_click_on_inventory_item(inventory_item_global_id, event)
|
||||
|
||||
|
||||
func _on_mouse_entered_inventory_item(inventory_item_global_id) -> void:
|
||||
printt("Inventory item focused ", inventory_item_global_id)
|
||||
escoria.logger.info("Inventory item focused ", [inventory_item_global_id])
|
||||
escoria.main.current_scene.game.inventory_item_focused(inventory_item_global_id)
|
||||
|
||||
|
||||
func _on_mouse_exited_inventory_item() -> void:
|
||||
printt("Inventory item unfocused")
|
||||
escoria.logger.info("Inventory item unfocused")
|
||||
escoria.main.current_scene.game.inventory_item_unfocused()
|
||||
|
||||
|
||||
##################################################################################
|
||||
|
||||
func _on_mouse_entered_item(item : ESCItem) -> void:
|
||||
printt("Item focused : ", item.global_id)
|
||||
escoria.logger.info("Item focused : ", [item.global_id])
|
||||
clean_hover_stack()
|
||||
|
||||
if !hover_stack.empty():
|
||||
if item.z_index > hover_stack.back().z_index:
|
||||
@@ -72,7 +78,7 @@ func _on_mouse_entered_item(item : ESCItem) -> void:
|
||||
|
||||
|
||||
func _on_mouse_exited_item(item : ESCItem) -> void:
|
||||
printt("Item unfocused : ", item.global_id)
|
||||
escoria.logger.info("Item unfocused : ", [item.global_id])
|
||||
hover_stack.erase(item)
|
||||
if hover_stack.empty():
|
||||
hotspot_focused = ""
|
||||
@@ -84,15 +90,17 @@ func _on_mouse_exited_item(item : ESCItem) -> void:
|
||||
|
||||
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.logger.info("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 : ESCItem, event : InputEvent) -> void:
|
||||
printt("Item left double clicked", item.global_id, event)
|
||||
escoria.logger.info("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.logger.info("Item right clicked", [item.global_id, event])
|
||||
escoria.main.current_scene.game.right_click_on_item(item.global_id, event)
|
||||
|
||||
|
||||
@@ -100,3 +108,11 @@ func _on_mouse_right_clicked_item(item : ESCItem, event : InputEvent) -> void:
|
||||
|
||||
func _on_mousewheel_action(direction : int):
|
||||
escoria.main.current_scene.game.mousewheel_action(direction)
|
||||
|
||||
|
||||
##################################################################################
|
||||
|
||||
func clean_hover_stack():
|
||||
for e in hover_stack:
|
||||
if e == null or !is_instance_valid(e):
|
||||
hover_stack.erase(e)
|
||||
|
||||
Reference in New Issue
Block a user