Created ESCGame class to force game.tscn scene to have empty functions by inheritance.
Also continued some tests about tooltip following mouse. Fixed project settings wrongly set.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
extends Node
|
||||
tool
|
||||
extends ESCGame
|
||||
|
||||
"""
|
||||
Implement methods to react to inputs.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[gd_scene load_steps=9 format=2]
|
||||
|
||||
[ext_resource path="res://addons/escoria-core/template_scenes/label/action_target_tooltip.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://game/ui/ui_9verbs/tooltip/action_target_tooltip.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://game/ui/ui_9verbs/inventory/inventory_ui.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://game/ui/ui_9verbs/verbs_menu.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://addons/escoria-core/game/scenes/dialogs/dialog_player.tscn" type="PackedScene" id=4]
|
||||
@@ -11,7 +11,7 @@
|
||||
[sub_resource type="StyleBoxFlat" id=1]
|
||||
bg_color = Color( 0.6, 0.6, 0.6, 0.5 )
|
||||
|
||||
[node name="game" type="Node"]
|
||||
[node name="game" type="Node2D"]
|
||||
script = ExtResource( 5 )
|
||||
|
||||
[node name="ui" type="CanvasLayer" parent="."]
|
||||
|
||||
55
game/ui/ui_9verbs/tooltip/action_target_tooltip.gd
Normal file
55
game/ui/ui_9verbs/tooltip/action_target_tooltip.gd
Normal file
@@ -0,0 +1,55 @@
|
||||
extends RichTextLabel
|
||||
|
||||
# Infinitive verb
|
||||
var current_action : String
|
||||
# Target item/hotspot
|
||||
var current_target : String
|
||||
# Preposition: on, with...
|
||||
var current_prep : String = "with"
|
||||
# Target 2 item/hotspot
|
||||
var current_target2 : String
|
||||
|
||||
var waiting_for_target2 = false
|
||||
|
||||
func _ready():
|
||||
escoria.esc_runner.connect("action_changed", self, "on_action_selected")
|
||||
|
||||
|
||||
func on_action_selected() -> void:
|
||||
current_action = escoria.esc_runner.current_action
|
||||
update_tooltip_text()
|
||||
|
||||
|
||||
func set_target(target : String, needs_second_target : bool = false) -> void:
|
||||
current_target = target
|
||||
if needs_second_target:
|
||||
waiting_for_target2 = true
|
||||
|
||||
update_tooltip_text()
|
||||
|
||||
|
||||
func set_target2(target2 : String) -> void:
|
||||
current_target2 = target2
|
||||
update_tooltip_text()
|
||||
|
||||
|
||||
func update_tooltip_text():
|
||||
bbcode_text = "[center]"
|
||||
|
||||
if !current_action.empty():
|
||||
bbcode_text += current_action
|
||||
bbcode_text += "\t"
|
||||
|
||||
bbcode_text += current_target
|
||||
|
||||
if waiting_for_target2 and current_target2.empty():
|
||||
bbcode_text += "\t"
|
||||
bbcode_text += current_prep
|
||||
|
||||
if !current_target2.empty():
|
||||
bbcode_text += "\t"
|
||||
bbcode_text += current_prep
|
||||
bbcode_text += "\t"
|
||||
bbcode_text += current_target2
|
||||
|
||||
bbcode_text += "[/center]"
|
||||
26
game/ui/ui_9verbs/tooltip/action_target_tooltip.tscn
Normal file
26
game/ui/ui_9verbs/tooltip/action_target_tooltip.tscn
Normal file
@@ -0,0 +1,26 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://addons/escoria-core/game/assets/fonts/onesize/ONESIZE_.TTF" type="DynamicFontData" id=1]
|
||||
[ext_resource path="res://game/ui/ui_9verbs/tooltip/action_target_tooltip.gd" type="Script" id=2]
|
||||
|
||||
[sub_resource type="DynamicFont" id=1]
|
||||
size = 30
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
[sub_resource type="DynamicFont" id=2]
|
||||
size = 30
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
[node name="tooltip" type="RichTextLabel"]
|
||||
anchor_right = 0.526
|
||||
anchor_bottom = 0.06
|
||||
margin_right = -0.280029
|
||||
margin_bottom = -10.0
|
||||
custom_fonts/mono_font = SubResource( 1 )
|
||||
custom_fonts/normal_font = SubResource( 2 )
|
||||
bbcode_enabled = true
|
||||
scroll_active = false
|
||||
script = ExtResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
Reference in New Issue
Block a user