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 outline: ItemOutline
|
||||||
|
|
||||||
|
var highlight: bool
|
||||||
|
var lastHighlightState: bool
|
||||||
|
|
||||||
# React to the mouse entering the item by emitting the respective signal
|
# React to the mouse entering the item by emitting the respective signal
|
||||||
func mouse_entered():
|
func mouse_entered():
|
||||||
if escoria.action_manager.is_object_actionable(global_id):
|
if escoria.action_manager.is_object_actionable(global_id):
|
||||||
#outline.show()
|
#outline.show()
|
||||||
if outline != null:
|
#if outline != null:
|
||||||
outline.show()
|
# outline.show()
|
||||||
emit_signal("mouse_entered_item", self)
|
emit_signal("mouse_entered_item", self)
|
||||||
|
|
||||||
|
|
||||||
# React to the mouse exiting the item by emitting the respective signal
|
# React to the mouse exiting the item by emitting the respective signal
|
||||||
func mouse_exited():
|
func mouse_exited():
|
||||||
if outline != null:
|
#if outline != null:
|
||||||
outline.hide()
|
# outline.hide()
|
||||||
emit_signal("mouse_exited_item", self)
|
emit_signal("mouse_exited_item", self)
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
@@ -51,17 +54,18 @@ func _ready():
|
|||||||
collision.add_child(outline)
|
collision.add_child(outline)
|
||||||
outline.hide()
|
outline.hide()
|
||||||
|
|
||||||
|
func _process(_delta) -> void:
|
||||||
|
if highlight != lastHighlightState:
|
||||||
#elif collision is CollisionShape2D:
|
if highlight:
|
||||||
# outline = Shape2D.new()
|
outline.show()
|
||||||
# outline.shape = collision.get_shape()
|
else:
|
||||||
#outline.set_name("outline")
|
outline.hide()
|
||||||
#outline.shape = collision.get_shape()
|
lastHighlightState = highlight
|
||||||
#self.add_child(outline)
|
|
||||||
# self.add_child(outline)
|
|
||||||
|
|
||||||
pass
|
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
|
# A reference to the node handling tooltip2
|
||||||
var tooltip2_node: Object
|
var tooltip2_node: Object
|
||||||
|
var last_target: Object
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
# We need a slightly modified version of Action Manager to combine items with different actions.
|
# 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:
|
if target_obj is ESCItem or ESCItemWithTooltip:
|
||||||
$tooltip_layer/tooltip.set_target(target_obj.tooltip_name)
|
$tooltip_layer/tooltip.set_target(target_obj.tooltip_name)
|
||||||
$tooltip_layer/tooltip.set_target_object(target_obj)
|
$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:
|
func element_unfocused() -> void:
|
||||||
$tooltip_layer/tooltip.set_target("")
|
$tooltip_layer/tooltip.set_target("")
|
||||||
$tooltip_layer/tooltip.set_target_object(null)
|
$tooltip_layer/tooltip.set_target_object(null)
|
||||||
|
#if(last_target != null)
|
||||||
|
last_target.highlight(false)
|
||||||
|
last_target = null
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ITEMS ##
|
## ITEMS ##
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ _global_script_classes=[ {
|
|||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
"path": "res://addons/escoria-core/game/scenes/dialogs/esc_dialog_options_chooser.gd"
|
"path": "res://addons/escoria-core/game/scenes/dialogs/esc_dialog_options_chooser.gd"
|
||||||
}, {
|
}, {
|
||||||
"base": "StateMachine",
|
"base": "Node",
|
||||||
"class": "ESCDialogPlayer",
|
"class": "ESCDialogPlayer",
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
"path": "res://addons/escoria-core/game/scenes/dialogs/esc_dialog_player.gd"
|
"path": "res://addons/escoria-core/game/scenes/dialogs/esc_dialog_player.gd"
|
||||||
@@ -344,7 +344,7 @@ _global_script_classes=[ {
|
|||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
"path": "res://addons/escoria-core/game/esc_project_settings_manager.gd"
|
"path": "res://addons/escoria-core/game/esc_project_settings_manager.gd"
|
||||||
}, {
|
}, {
|
||||||
"base": "Reference",
|
"base": "Node",
|
||||||
"class": "ESCResourceCache",
|
"class": "ESCResourceCache",
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
"path": "res://addons/escoria-core/game/core-scripts/esc_resource_cache.gd"
|
"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_version="0.1.0"
|
||||||
main/game_start_script="res://gymkhana/start_game.esc"
|
main/game_start_script="res://gymkhana/start_game.esc"
|
||||||
main/force_quit=true
|
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/text_lang="fr_FR"
|
||||||
main/voice_lang="fr_FR"
|
main/voice_lang="fr_FR"
|
||||||
main/savegames_path="res://saves/"
|
main/savegames_path="res://saves/"
|
||||||
|
|||||||
Reference in New Issue
Block a user