item highlight, cambio de estrategia.
This commit is contained in:
@@ -25,19 +25,22 @@ export(Array) var target_when_selected_action_is_in = []
|
||||
|
||||
var outline: ItemOutline
|
||||
|
||||
var highlight: bool
|
||||
var lastHighlightState: bool
|
||||
|
||||
# React to the mouse entering the item by emitting the respective signal
|
||||
func mouse_entered():
|
||||
if escoria.action_manager.is_object_actionable(global_id):
|
||||
#outline.show()
|
||||
if outline != null:
|
||||
outline.show()
|
||||
#if outline != null:
|
||||
# outline.show()
|
||||
emit_signal("mouse_entered_item", self)
|
||||
|
||||
|
||||
# React to the mouse exiting the item by emitting the respective signal
|
||||
func mouse_exited():
|
||||
if outline != null:
|
||||
outline.hide()
|
||||
#if outline != null:
|
||||
# outline.hide()
|
||||
emit_signal("mouse_exited_item", self)
|
||||
|
||||
func _ready():
|
||||
@@ -51,17 +54,18 @@ func _ready():
|
||||
collision.add_child(outline)
|
||||
outline.hide()
|
||||
|
||||
|
||||
|
||||
#elif collision is CollisionShape2D:
|
||||
# outline = Shape2D.new()
|
||||
# outline.shape = collision.get_shape()
|
||||
#outline.set_name("outline")
|
||||
#outline.shape = collision.get_shape()
|
||||
#self.add_child(outline)
|
||||
# self.add_child(outline)
|
||||
|
||||
func _process(_delta) -> void:
|
||||
if highlight != lastHighlightState:
|
||||
if highlight:
|
||||
outline.show()
|
||||
else:
|
||||
outline.hide()
|
||||
lastHighlightState = highlight
|
||||
pass
|
||||
|
||||
func highlight(value: bool):
|
||||
highlight = value
|
||||
var a = 0
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -80,6 +80,7 @@ var _current_mouse_pos = Vector2.ZERO
|
||||
|
||||
# A reference to the node handling tooltip2
|
||||
var tooltip2_node: Object
|
||||
var last_target: Object
|
||||
|
||||
func _ready():
|
||||
# We need a slightly modified version of Action Manager to combine items with different actions.
|
||||
@@ -235,11 +236,19 @@ func element_focused(element_id: String) -> void:
|
||||
if target_obj is ESCItem or ESCItemWithTooltip:
|
||||
$tooltip_layer/tooltip.set_target(target_obj.tooltip_name)
|
||||
$tooltip_layer/tooltip.set_target_object(target_obj)
|
||||
target_obj.highlight(true)
|
||||
if last_target != null:
|
||||
last_target.highlight(false)
|
||||
last_target = target_obj
|
||||
|
||||
|
||||
func element_unfocused() -> void:
|
||||
$tooltip_layer/tooltip.set_target("")
|
||||
$tooltip_layer/tooltip.set_target_object(null)
|
||||
#if(last_target != null)
|
||||
last_target.highlight(false)
|
||||
last_target = null
|
||||
|
||||
|
||||
|
||||
## ITEMS ##
|
||||
|
||||
Reference in New Issue
Block a user