diff --git a/gymkhana/addons/escoria-ui-return-monkey-island/esc_item_with_tooltip.gd b/gymkhana/addons/escoria-ui-return-monkey-island/esc_item_with_tooltip.gd index 2f0a22cb..3a149a0b 100644 --- a/gymkhana/addons/escoria-ui-return-monkey-island/esc_item_with_tooltip.gd +++ b/gymkhana/addons/escoria-ui-return-monkey-island/esc_item_with_tooltip.gd @@ -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 diff --git a/gymkhana/addons/escoria-ui-return-monkey-island/game.gd b/gymkhana/addons/escoria-ui-return-monkey-island/game.gd index 13a08073..33dcd124 100644 --- a/gymkhana/addons/escoria-ui-return-monkey-island/game.gd +++ b/gymkhana/addons/escoria-ui-return-monkey-island/game.gd @@ -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 ## diff --git a/project.godot b/project.godot index 33e4665e..35284084 100644 --- a/project.godot +++ b/project.godot @@ -204,7 +204,7 @@ _global_script_classes=[ { "language": "GDScript", "path": "res://addons/escoria-core/game/scenes/dialogs/esc_dialog_options_chooser.gd" }, { -"base": "StateMachine", +"base": "Node", "class": "ESCDialogPlayer", "language": "GDScript", "path": "res://addons/escoria-core/game/scenes/dialogs/esc_dialog_player.gd" @@ -344,7 +344,7 @@ _global_script_classes=[ { "language": "GDScript", "path": "res://addons/escoria-core/game/esc_project_settings_manager.gd" }, { -"base": "Reference", +"base": "Node", "class": "ESCResourceCache", "language": "GDScript", "path": "res://addons/escoria-core/game/core-scripts/esc_resource_cache.gd" @@ -861,7 +861,7 @@ enabled=PoolStringArray( "res://addons/escoria-core/plugin.cfg", "res://gymkhana main/game_version="0.1.0" main/game_start_script="res://gymkhana/start_game.esc" main/force_quit=true -main/command_directories=[ "res://addons/escoria-core/game/core-scripts/esc/commands" ] +main/command_directories=[ "res://addons/escoria-core/game/core-scripts/esc/commands", "res://gymkhana/addons/escoria-ui-return-monkey-island/esc/commands" ] main/text_lang="fr_FR" main/voice_lang="fr_FR" main/savegames_path="res://saves/"