Right click on inventory items
This commit is contained in:
@@ -15,11 +15,11 @@ export(int) var action1_y = 0
|
||||
# The text for the tooltip of action2
|
||||
export(String) var tooltip2_name
|
||||
|
||||
# Action1 enabled in inventory
|
||||
export(bool) var inventory_action1_enabled
|
||||
# Action1 tooltip text in inventory
|
||||
export(String) var inventory_action1_text
|
||||
|
||||
# Action2 enabled in inventory
|
||||
export(bool) var inventory_action2_enabled
|
||||
# Action2 tooltip text in inventory
|
||||
export(String) var inventory_action2_text
|
||||
|
||||
#$tooltips.visible = true;
|
||||
var action1Tooltip: Object
|
||||
|
||||
@@ -260,19 +260,33 @@ func left_double_click_on_item(item_global_id: String, event: InputEvent) -> voi
|
||||
|
||||
|
||||
## INVENTORY ##
|
||||
func click_on_inventory_item(item_global_id: String, event: InputEvent, action: String) -> void:
|
||||
escoria.action_manager.set_current_action(action)
|
||||
|
||||
var target_obj = escoria.object_manager.get_object(item_global_id).node
|
||||
|
||||
escoria.action_manager.do(
|
||||
escoria.action_manager.ACTION.ITEM_LEFT_CLICK,
|
||||
[item_global_id, event],
|
||||
true
|
||||
)
|
||||
|
||||
if (target_obj is ESCItemWithTooltip) && (action == ACTION1 && target_obj.inventory_action1_text != "") || (action == ACTION2 && target_obj.inventory_action2_text != ""):
|
||||
$tooltip_layer/tooltip.hide()
|
||||
$tooltip_layer/tooltip2.hide()
|
||||
|
||||
func left_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent) -> void:
|
||||
click_on_item(inventory_item_global_id, event, ACTION1)
|
||||
click_on_inventory_item(inventory_item_global_id, event, ACTION1)
|
||||
|
||||
func right_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent) -> void:
|
||||
click_on_item(inventory_item_global_id, event, ACTION2)
|
||||
click_on_inventory_item(inventory_item_global_id, event, ACTION2)
|
||||
|
||||
|
||||
func inventory_item_focused(inventory_item_global_id: String) -> void:
|
||||
var target_obj = escoria.object_manager.get_object(inventory_item_global_id).node
|
||||
if target_obj is ESCItem && target_obj.inventory_action1_enabled:
|
||||
$tooltip_layer/tooltip.set_target(target_obj.tooltip_name)
|
||||
if (target_obj is ESCItemWithTooltip) && target_obj.inventory_action2_enabled:
|
||||
$tooltip_layer/tooltip2.set_target(target_obj.tooltip2_name)
|
||||
if target_obj is ESCItemWithTooltip:
|
||||
$tooltip_layer/tooltip.set_target(target_obj.inventory_action1_text)
|
||||
$tooltip_layer/tooltip2.set_target(target_obj.inventory_action2_text)
|
||||
|
||||
|
||||
func inventory_item_unfocused() -> void:
|
||||
|
||||
@@ -19,8 +19,8 @@ dialog_color = Color( 1, 1, 1, 1 )
|
||||
inventory_texture = ExtResource( 1 )
|
||||
action1_text = "Mirar bombona"
|
||||
action2_text = "Coger bombona"
|
||||
inventory_action1_enabled = true
|
||||
inventory_action2_enabled = false
|
||||
inventory_action1_text = "¿Cómo ha entrado en mi bolsillo?"
|
||||
inventory_action2_text = "¿Por qué es una llave inglesa?"
|
||||
animations = null
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
:action1
|
||||
say player "Es naranja" [!i/i_bombona]
|
||||
say player "Está en mi bolsillo" [i/i_bombona]
|
||||
say player "Es el segundo bolsillo más grande que he visto" [i/i_bombona]
|
||||
|
||||
:action2
|
||||
say player "Voy a cogerla"
|
||||
inventory_add i_bombona
|
||||
set_active i_bombona false
|
||||
say player "Antes era una bombona pero ahora es una llave inglesa." [i/i_bombona]
|
||||
say player "¿Esto es real?" [i/i_bombona]
|
||||
say player "¿Vivo en Matrix?" [i/i_bombona]
|
||||
|
||||
say player "Voy a cogerla" [!i/i_bombona]
|
||||
set_active i_bombona false [!i/i_bombona]
|
||||
inventory_add i_bombona [!i/i_bombona]
|
||||
|
||||
@@ -752,7 +752,7 @@ _global_script_class_icons={
|
||||
"ESCInventoryItem": "",
|
||||
"ESCInventoryManager": "",
|
||||
"ESCItem": "res://addons/escoria-core/design/esc_item.svg",
|
||||
"ESCItemWithTooltip": "",
|
||||
"ESCItemWithTooltip": "res://addons/escoria-core/design/esc_item.svg",
|
||||
"ESCLocation": "res://addons/escoria-core/design/esc_location.svg",
|
||||
"ESCMain": "",
|
||||
"ESCMigration": "",
|
||||
|
||||
Reference in New Issue
Block a user