set_tooltip esc command
This commit is contained in:
@@ -0,0 +1,52 @@
|
|||||||
|
# `set_tooltip object action text`
|
||||||
|
#
|
||||||
|
# Sets the tooltip text for the given `ESCItemWithTooltip` and action.
|
||||||
|
#
|
||||||
|
# **Parameters**
|
||||||
|
#
|
||||||
|
# - *object*: Global ID of the object whose toolitp is to be updated
|
||||||
|
# - *action*: ID of the action, action1, action2, action3 or action4.
|
||||||
|
# - *toolip*: The tooltip text string
|
||||||
|
#
|
||||||
|
# @ESC
|
||||||
|
extends ESCBaseCommand
|
||||||
|
class_name SetTooltipCommand
|
||||||
|
|
||||||
|
|
||||||
|
# Return the descriptor of the arguments of this command
|
||||||
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
|
return ESCCommandArgumentDescriptor.new(
|
||||||
|
2,
|
||||||
|
[TYPE_STRING,TYPE_STRING, TYPE_STRING],
|
||||||
|
[null, "action1", ""]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# Validate whether the given arguments match the command descriptor
|
||||||
|
func validate(arguments: Array):
|
||||||
|
if not .validate(arguments):
|
||||||
|
return false
|
||||||
|
|
||||||
|
if not escoria.object_manager.has(arguments[0]):
|
||||||
|
escoria.logger.error(
|
||||||
|
self,
|
||||||
|
"[%s]: invalid object. Object with global id %s not found."
|
||||||
|
% [get_command_name(), arguments[0]]
|
||||||
|
)
|
||||||
|
return false
|
||||||
|
|
||||||
|
return true
|
||||||
|
|
||||||
|
|
||||||
|
# Run the command
|
||||||
|
func run(command_params: Array) -> int:
|
||||||
|
(escoria.object_manager.get_object(command_params[0]).node as ESCItemWithTooltip)\
|
||||||
|
.set_tooltip(command_params[1],command_params[2])
|
||||||
|
return ESCExecution.RC_OK
|
||||||
|
|
||||||
|
|
||||||
|
# Function called when the command is interrupted.
|
||||||
|
func interrupt():
|
||||||
|
# Do nothing
|
||||||
|
pass
|
||||||
|
|
||||||
@@ -64,4 +64,6 @@ func _ready():
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
func set_tooltip(action: String, text: String):
|
||||||
|
set(action + "_text", text)
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
:action1
|
:action1
|
||||||
say player "Hay muchas lentejas."
|
say player "Hay muchas lentejas."
|
||||||
|
set_tooltip turno_cocina_despensa_bidon_cntr action1 "Mirar bidon con lentejas"
|
||||||
|
set_tooltip turno_cocina_despensa_bidon_cntr action2 "Coger lentejas"
|
||||||
|
|
||||||
:action2
|
:action2
|
||||||
say player "Necesito cogerlas con algo."
|
say player "Necesito cogerlas con algo."
|
||||||
|
|||||||
@@ -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"
|
||||||
@@ -557,7 +557,7 @@ _global_script_classes=[ {
|
|||||||
"base": "ESCBaseCommand",
|
"base": "ESCBaseCommand",
|
||||||
"class": "SetAnimationsCommand",
|
"class": "SetAnimationsCommand",
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
"path": "res://addons/escoria-core/game/core-scripts/esc/commands/set_animations.gd"
|
"path": "res://gymkhana/addons/escoria-ui-return-monkey-island/esc/commands/set_tooltip.gd"
|
||||||
}, {
|
}, {
|
||||||
"base": "ESCBaseCommand",
|
"base": "ESCBaseCommand",
|
||||||
"class": "SetGlobalCommand",
|
"class": "SetGlobalCommand",
|
||||||
@@ -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