Initial commit of Escoria-Reloaded. Still a lot of missing stuff.
This commit is contained in:
16
addons/escoria-core/template_scenes/character.tscn
Normal file
16
addons/escoria-core/template_scenes/character.tscn
Normal file
@@ -0,0 +1,16 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://addons/escoria-core/game/core-scripts/esccharacter.gd" type="Script" id=1]
|
||||
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id=1]
|
||||
|
||||
[node name="character" type="KinematicBody2D"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
@@ -0,0 +1,27 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://icon.png" type="Texture" id=1]
|
||||
|
||||
[node name="dialog_avatars" type="Control"]
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="character1" type="TextureRect" parent="."]
|
||||
margin_right = 40.0
|
||||
margin_bottom = 40.0
|
||||
texture = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="character2" type="TextureRect" parent="."]
|
||||
modulate = Color( 1, 0, 0, 1 )
|
||||
margin_left = 46.0
|
||||
margin_top = 80.0
|
||||
margin_right = 110.0
|
||||
margin_bottom = 144.0
|
||||
texture = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
tool
|
||||
extends PanelContainer
|
||||
|
||||
signal dialog_line_finished
|
||||
|
||||
export(String) var current_character setget set_current_character
|
||||
onready var avatar_node = $MarginContainer/HSplitContainer/VBoxContainer/avatar
|
||||
onready var name_node = $MarginContainer/HSplitContainer/VBoxContainer/name
|
||||
onready var text_node = $MarginContainer/HSplitContainer/text
|
||||
onready var tween = text_node.get_node("Tween")
|
||||
|
||||
export(float, 0.0, 0.3) var text_speed_per_character = 0.1
|
||||
export(float) var fast_text_speed_per_character = 0.25
|
||||
export(float) var max_time_to_text_disappear = 2.0
|
||||
|
||||
func _ready():
|
||||
var centered_position_on_screen = Vector2(
|
||||
ProjectSettings.get_setting("display/window/size/width") / 2,
|
||||
ProjectSettings.get_setting("display/window/size/height") / 2
|
||||
) - rect_size / 2
|
||||
rect_position = centered_position_on_screen
|
||||
text_node.bbcode_enabled = true
|
||||
$MarginContainer/HSplitContainer/text/Tween.connect("tween_completed", self, "_on_dialog_line_typed")
|
||||
|
||||
func set_current_character(name: String):
|
||||
current_character = name
|
||||
if $dialog_avatars:
|
||||
if $dialog_avatars.has_node(name):
|
||||
avatar_node.texture = ($dialog_avatars.get_node(name) as TextureRect).texture
|
||||
else:
|
||||
avatar_node.texture = null
|
||||
|
||||
|
||||
"""
|
||||
Make a character say something.
|
||||
|
||||
character: global id of the character who speaks
|
||||
params: Dictionary
|
||||
line: line of dialog to say
|
||||
"""
|
||||
func say(character : String, params : Dictionary) :
|
||||
show()
|
||||
set_current_character(character)
|
||||
|
||||
if !params["line"]:
|
||||
escoria.report_errors("dialog_box_inset.gd:say()", ["No line field in params!"])
|
||||
return
|
||||
|
||||
text_node.bbcode_text = params["line"]
|
||||
|
||||
text_node.percent_visible = 0.0
|
||||
var time_show_full_text = text_speed_per_character * len(params["line"])
|
||||
|
||||
tween.interpolate_property(text_node, "percent_visible",
|
||||
0.0, 1.0, time_show_full_text,
|
||||
Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
|
||||
tween.start()
|
||||
|
||||
func finish_fast():
|
||||
tween.stop(text_node)
|
||||
tween.interpolate_property(text_node, "percent_visible",
|
||||
text_node.percent_visible, 1.0, fast_text_speed_per_character,
|
||||
Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
|
||||
tween.start()
|
||||
|
||||
|
||||
func _on_dialog_line_typed(object, key):
|
||||
text_node.visible_characters = -1
|
||||
$Timer.start(max_time_to_text_disappear)
|
||||
$Timer.connect("timeout", self, "_on_dialog_finished")
|
||||
|
||||
func _on_dialog_finished():
|
||||
emit_signal("dialog_line_finished")
|
||||
queue_free()
|
||||
|
||||
|
||||
func _input(event):
|
||||
if event is InputEventMouseButton:
|
||||
if event.pressed:
|
||||
finish_fast()
|
||||
@@ -0,0 +1,67 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://addons/escoria-core/template_scenes/dialog_scenes/dialog_box_inset.gd" type="Script" id=3]
|
||||
[ext_resource path="res://addons/escoria-core/template_scenes/dialog_scenes/dialog_avatars.tscn" type="PackedScene" id=4]
|
||||
|
||||
[node name="dialog_box" type="PopupPanel"]
|
||||
visible = true
|
||||
anchor_right = 0.685
|
||||
anchor_bottom = 0.452
|
||||
margin_right = 0.199951
|
||||
margin_bottom = 0.399994
|
||||
script = ExtResource( 3 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
current_character = "guybrush"
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 4.0
|
||||
margin_top = 4.0
|
||||
margin_right = -4.0
|
||||
margin_bottom = -4.0
|
||||
custom_constants/margin_right = 20
|
||||
custom_constants/margin_top = 20
|
||||
custom_constants/margin_left = 20
|
||||
custom_constants/margin_bottom = 20
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="HSplitContainer" type="HSplitContainer" parent="MarginContainer"]
|
||||
margin_left = 20.0
|
||||
margin_top = 20.0
|
||||
margin_right = 848.0
|
||||
margin_bottom = 334.0
|
||||
custom_constants/separation = 35
|
||||
dragger_visibility = 1
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/HSplitContainer"]
|
||||
margin_right = 60.0
|
||||
margin_bottom = 314.0
|
||||
|
||||
[node name="avatar" type="TextureRect" parent="MarginContainer/HSplitContainer/VBoxContainer"]
|
||||
margin_right = 60.0
|
||||
|
||||
[node name="name" type="Label" parent="MarginContainer/HSplitContainer/VBoxContainer"]
|
||||
margin_top = 4.0
|
||||
margin_right = 60.0
|
||||
margin_bottom = 18.0
|
||||
text = "Character"
|
||||
valign = 1
|
||||
|
||||
[node name="text" type="RichTextLabel" parent="MarginContainer/HSplitContainer"]
|
||||
margin_left = 95.0
|
||||
margin_right = 828.0
|
||||
margin_bottom = 314.0
|
||||
bbcode_enabled = true
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Tween" type="Tween" parent="MarginContainer/HSplitContainer/text"]
|
||||
|
||||
[node name="dialog_avatars" parent="." instance=ExtResource( 4 )]
|
||||
[connection signal="gui_input" from="." to="." method="_on_PopupPanel_gui_input"]
|
||||
@@ -0,0 +1,10 @@
|
||||
extends Control
|
||||
|
||||
func _ready():
|
||||
pass
|
||||
|
||||
|
||||
func set_answers(answers_array : PoolStringArray):
|
||||
|
||||
func _on_answer1_gui_input(event):
|
||||
pass # Replace with function body.
|
||||
@@ -0,0 +1,57 @@
|
||||
tool
|
||||
extends Control
|
||||
|
||||
export(Color, RGB) var color_normal = Color(1.0,1.0,1.0,1.0)
|
||||
export(Color, RGB) var color_hover = Color(165.0,42.0,42.0, 1.0)
|
||||
export(Font) var font
|
||||
|
||||
var commands
|
||||
|
||||
func _ready():
|
||||
for c in $ScrollContainer/VBoxContainer.get_children():
|
||||
c.queue_free()
|
||||
|
||||
|
||||
func set_answers(p_commands : Array):
|
||||
commands = p_commands
|
||||
var c = 0
|
||||
for option in commands:
|
||||
var new_answer_label = RichTextLabel.new()
|
||||
new_answer_label.text = option.params[0]
|
||||
new_answer_label.fit_content_height = true
|
||||
new_answer_label.add_font_override("normal_font", font)
|
||||
|
||||
$ScrollContainer/VBoxContainer.add_child(new_answer_label)
|
||||
new_answer_label.fit_content_height = true
|
||||
new_answer_label.connect("focus_entered", self, "_on_answer_focus_entered", [new_answer_label]) # Focus entered
|
||||
new_answer_label.connect("focus_exited", self, "_on_answer_focus_exited", [new_answer_label]) # Focus exited
|
||||
new_answer_label.connect("mouse_entered", self, "_on_answer_mouse_entered", [new_answer_label]) # Mouse entered
|
||||
new_answer_label.connect("mouse_exited", self, "_on_answer_mouse_exited", [new_answer_label]) # Mouse exited
|
||||
new_answer_label.connect("gui_input", self, "_on_answer_gui_input", [c]) # Clicks
|
||||
c += 1
|
||||
|
||||
func _on_answer_gui_input(event : InputEvent, answer_id : int):
|
||||
if event is InputEventMouseButton and event.is_pressed():
|
||||
var answer = commands[answer_id].params[1]
|
||||
printt(answer)
|
||||
escoria.dialog_player.play_dialog_option_chosen(answer)
|
||||
|
||||
func _on_answer_mouse_entered(answer_node : Node):
|
||||
var text = answer_node.text
|
||||
answer_node.clear()
|
||||
answer_node.push_color(color_hover.to_html(false))
|
||||
answer_node.append_bbcode(text)
|
||||
answer_node.pop()
|
||||
|
||||
func _on_answer_mouse_exited(answer_node : Node):
|
||||
var text = answer_node.text
|
||||
answer_node.clear()
|
||||
answer_node.push_color(color_normal.to_html(false))
|
||||
answer_node.append_bbcode(text)
|
||||
answer_node.pop()
|
||||
|
||||
func _on_answer_focus_entered(answer_node : Node):
|
||||
pass
|
||||
|
||||
func _on_answer_focus_exited(answer_node : Node):
|
||||
pass
|
||||
@@ -0,0 +1,43 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://addons/escoria-core/template_scenes/dialog_scenes/dialog_choosers/text_dialog_choice.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/escoria-core/game/assets/fonts/efmi/efmi_font.tres" type="DynamicFont" id=2]
|
||||
|
||||
[node name="text_dialog_choice" type="MarginContainer"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
custom_constants/margin_top = 20
|
||||
custom_constants/margin_left = 20
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
color_hover = Color( 0.647059, 0.164706, 0.164706, 1 )
|
||||
font = ExtResource( 2 )
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="."]
|
||||
margin_left = 20.0
|
||||
margin_top = 20.0
|
||||
margin_right = 1280.0
|
||||
margin_bottom = 800.0
|
||||
scroll_horizontal_enabled = false
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="ScrollContainer"]
|
||||
margin_right = 1260.0
|
||||
margin_bottom = 780.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
custom_constants/separation = 20
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="example" type="RichTextLabel" parent="ScrollContainer/VBoxContainer"]
|
||||
margin_right = 1260.0
|
||||
margin_bottom = 25.0
|
||||
custom_fonts/normal_font = ExtResource( 2 )
|
||||
text = "This answer is an example for vizualisation purpose. You can safely keep it in the scene as it will be removed on game launch."
|
||||
fit_content_height = true
|
||||
@@ -0,0 +1,68 @@
|
||||
extends RichTextLabel
|
||||
|
||||
signal dialog_line_finished
|
||||
|
||||
export(String) var current_character
|
||||
onready var tween = $Tween
|
||||
onready var text_node = self
|
||||
|
||||
export(float, 0.0, 0.3) var text_speed_per_character = 0.1
|
||||
export(float) var fast_text_speed_per_character = 0.25
|
||||
export(float) var max_time_to_text_disappear = 2.0
|
||||
|
||||
func _ready():
|
||||
bbcode_enabled = true
|
||||
$Tween.connect("tween_completed", self, "_on_dialog_line_typed")
|
||||
|
||||
"""
|
||||
Make a character say something.
|
||||
|
||||
character: global id of the character who speaks
|
||||
params: Dictionary
|
||||
line: line of dialog to say
|
||||
"""
|
||||
func say(character : String, params : Dictionary) :
|
||||
show()
|
||||
|
||||
if !params["line"]:
|
||||
escoria.report_errors("dialog_box_inset.gd:say()", ["No line field in params!"])
|
||||
return
|
||||
|
||||
# Position the RichTextLabel on the character's dialog position, if any.
|
||||
var character_node = escoria.esc_runner.get_object(character)
|
||||
rect_position = character_node.get_node("dialog_position").get_global_transform_with_canvas().origin
|
||||
rect_position.x -= rect_size.x / 2
|
||||
|
||||
# Set text color to color set in the actor
|
||||
var text_color = character_node.dialog_color
|
||||
var text_color_html = text_color.to_html(false)
|
||||
|
||||
text_node.bbcode_text = "[center][color=#" + text_color_html + "]".format(text_color_html) + params["line"] + "[/color][center]"
|
||||
|
||||
text_node.percent_visible = 0.0
|
||||
var time_show_full_text = text_speed_per_character * len(params["line"])
|
||||
|
||||
tween.interpolate_property(text_node, "percent_visible",
|
||||
0.0, 1.0, time_show_full_text,
|
||||
Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
|
||||
tween.start()
|
||||
|
||||
func finish_fast():
|
||||
tween.stop(text_node)
|
||||
tween.interpolate_property(text_node, "percent_visible",
|
||||
text_node.percent_visible, 1.0, fast_text_speed_per_character,
|
||||
Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
|
||||
tween.start()
|
||||
|
||||
|
||||
func _on_dialog_line_typed(object, key):
|
||||
text_node.visible_characters = -1
|
||||
$Timer.start(max_time_to_text_disappear)
|
||||
$Timer.connect("timeout", self, "_on_dialog_finished")
|
||||
|
||||
func _on_dialog_finished():
|
||||
# emit_signal("dialog_line_finished")
|
||||
escoria.esc_level_runner.finished()
|
||||
escoria.dialog_player.is_speaking = false
|
||||
escoria.current_state = escoria.GAME_STATE.DEFAULT
|
||||
queue_free()
|
||||
@@ -0,0 +1,20 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://addons/escoria-core/game/assets/fonts/efmi/efmi_font.tres" type="DynamicFont" id=1]
|
||||
[ext_resource path="res://addons/escoria-core/template_scenes/dialog_scenes/dialog_label.gd" type="Script" id=2]
|
||||
|
||||
[node name="dialog_label" type="RichTextLabel"]
|
||||
margin_left = 5.4126
|
||||
margin_top = 7.0
|
||||
margin_right = 874.413
|
||||
margin_bottom = 259.0
|
||||
custom_fonts/normal_font = ExtResource( 1 )
|
||||
bbcode_text = "Here be some text"
|
||||
text = "Here be some text"
|
||||
script = ExtResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Tween" type="Tween" parent="."]
|
||||
[connection signal="tween_completed" from="Tween" to="." method="_on_dialog_line_finished"]
|
||||
3
addons/escoria-core/template_scenes/game.tscn
Normal file
3
addons/escoria-core/template_scenes/game.tscn
Normal file
@@ -0,0 +1,3 @@
|
||||
[gd_scene format=2]
|
||||
|
||||
[node name="game" type="CanvasLayer"]
|
||||
10
addons/escoria-core/template_scenes/inventory_item.tscn
Normal file
10
addons/escoria-core/template_scenes/inventory_item.tscn
Normal file
@@ -0,0 +1,10 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://addons/escoria-core/game/core-scripts/inventory_item.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/escoria-core/game/assets/images/no_image.png" type="Texture" id=2]
|
||||
|
||||
[node name="inventory_item" type="TextureButton"]
|
||||
margin_right = 50.0
|
||||
margin_bottom = 50.0
|
||||
texture_normal = ExtResource( 2 )
|
||||
script = ExtResource( 1 )
|
||||
60
addons/escoria-core/template_scenes/inventory_ui.tscn
Normal file
60
addons/escoria-core/template_scenes/inventory_ui.tscn
Normal file
@@ -0,0 +1,60 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://addons/escoria-core/game/scenes/inventory/inventory_ui.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/escoria-core/template_scenes/inventory_item.tscn" type="PackedScene" id=2]
|
||||
|
||||
[node name="inventory_ui_template" type="Control"]
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="."]
|
||||
margin_right = 282.0
|
||||
margin_bottom = 151.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="PanelContainer"]
|
||||
margin_left = 7.0
|
||||
margin_top = 7.0
|
||||
margin_right = 275.0
|
||||
margin_bottom = 144.0
|
||||
|
||||
[node name="GridContainer" type="GridContainer" parent="PanelContainer/ScrollContainer"]
|
||||
margin_right = 268.0
|
||||
margin_bottom = 137.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
columns = 4
|
||||
|
||||
[node name="inventory_item1" parent="PanelContainer/ScrollContainer/GridContainer" instance=ExtResource( 2 )]
|
||||
|
||||
[node name="inventory_item2" parent="PanelContainer/ScrollContainer/GridContainer" instance=ExtResource( 2 )]
|
||||
margin_left = 54.0
|
||||
margin_right = 104.0
|
||||
|
||||
[node name="inventory_item3" parent="PanelContainer/ScrollContainer/GridContainer" instance=ExtResource( 2 )]
|
||||
margin_left = 108.0
|
||||
margin_right = 158.0
|
||||
|
||||
[node name="inventory_item4" parent="PanelContainer/ScrollContainer/GridContainer" instance=ExtResource( 2 )]
|
||||
margin_left = 162.0
|
||||
margin_right = 212.0
|
||||
|
||||
[node name="inventory_item5" parent="PanelContainer/ScrollContainer/GridContainer" instance=ExtResource( 2 )]
|
||||
margin_top = 54.0
|
||||
margin_bottom = 104.0
|
||||
|
||||
[node name="inventory_item6" parent="PanelContainer/ScrollContainer/GridContainer" instance=ExtResource( 2 )]
|
||||
margin_left = 54.0
|
||||
margin_top = 54.0
|
||||
margin_right = 104.0
|
||||
margin_bottom = 104.0
|
||||
|
||||
[node name="inventory_item7" parent="PanelContainer/ScrollContainer/GridContainer" instance=ExtResource( 2 )]
|
||||
margin_left = 108.0
|
||||
margin_top = 54.0
|
||||
margin_right = 158.0
|
||||
margin_bottom = 104.0
|
||||
10
addons/escoria-core/template_scenes/items_inventory.tscn
Normal file
10
addons/escoria-core/template_scenes/items_inventory.tscn
Normal file
@@ -0,0 +1,10 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/escoria-core/game/core-scripts/items_inventory.gd" type="Script" id=1]
|
||||
|
||||
[node name="items_inventory" type="GridContainer"]
|
||||
columns = 5
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
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")
|
||||
escoria.inputs_manager.connect("element_focused", self, "on_element_focused")
|
||||
|
||||
|
||||
func on_action_selected() -> void:
|
||||
current_action = escoria.esc_runner.current_action
|
||||
update_tooltip_text()
|
||||
|
||||
func on_element_focused(element_id : String) -> void:
|
||||
printt("action_target_tooltip.gd:on_element_focused()", "Element focused: ", element_id)
|
||||
|
||||
if element_id == "":
|
||||
set_target("")
|
||||
return
|
||||
|
||||
var object = escoria.esc_runner.get_object(element_id)
|
||||
|
||||
if object == null or !is_instance_valid(object):
|
||||
escoria.report_warnings("action_target_tooltip.gd:on_element_focused()",
|
||||
["Object exists but is not loaded for id " + element_id])
|
||||
set_target(element_id)
|
||||
return
|
||||
|
||||
if !escoria.esc_runner.get_interactive(element_id) and !object is ESCInventoryItem:
|
||||
set_target("")
|
||||
return
|
||||
|
||||
var wait_for_target = false
|
||||
if object is ESCItem or object is ESCInventoryItem:
|
||||
if current_action in object.combine_if_action_used_among:
|
||||
wait_for_target = true
|
||||
|
||||
set_target(object.tooltip_name, wait_for_target)
|
||||
|
||||
|
||||
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]"
|
||||
@@ -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://addons/escoria-core/template_scenes/label/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
|
||||
}
|
||||
11
addons/escoria-core/template_scenes/label/target_tooltip.gd
Normal file
11
addons/escoria-core/template_scenes/label/target_tooltip.gd
Normal file
@@ -0,0 +1,11 @@
|
||||
extends RichTextLabel
|
||||
|
||||
var current_target : String
|
||||
|
||||
|
||||
func set_target(target : String) -> void:
|
||||
current_target = target
|
||||
update_tooltip_text()
|
||||
|
||||
func update_tooltip_text():
|
||||
bbcode_text = current_target
|
||||
@@ -0,0 +1,28 @@
|
||||
[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://addons/escoria-core/template_scenes/label/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.7
|
||||
anchor_bottom = 0.06
|
||||
margin_left = 1.49829
|
||||
margin_right = 1.21826
|
||||
margin_bottom = -10.0
|
||||
custom_fonts/mono_font = SubResource( 1 )
|
||||
custom_fonts/normal_font = SubResource( 2 )
|
||||
bbcode_enabled = true
|
||||
bbcode_text = "[center][/center]"
|
||||
scroll_active = false
|
||||
script = ExtResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
35
addons/escoria-core/template_scenes/room.tscn
Normal file
35
addons/escoria-core/template_scenes/room.tscn
Normal file
@@ -0,0 +1,35 @@
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://addons/escoria-core/game/core-scripts/escterrain.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/escoria-core/game/core-scripts/escbackground.gd" type="Script" id=2]
|
||||
[ext_resource path="res://addons/escoria-core/game/core-scripts/eschotspot.gd" type="Script" id=3]
|
||||
[ext_resource path="res://addons/escoria-core/game/core-scripts/escroom.gd" type="Script" id=4]
|
||||
|
||||
[sub_resource type="NavigationPolygon" id=1]
|
||||
|
||||
[node name="room" type="Node2D"]
|
||||
script = ExtResource( 4 )
|
||||
|
||||
[node name="ESCBackground" type="TextureRect" parent="."]
|
||||
margin_right = 40.0
|
||||
margin_bottom = 40.0
|
||||
mouse_filter = 2
|
||||
script = ExtResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="walkable_area" type="Navigation2D" parent="."]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="area" type="NavigationPolygonInstance" parent="walkable_area"]
|
||||
navpoly = SubResource( 1 )
|
||||
|
||||
[node name="Hotspots" type="Node2D" parent="."]
|
||||
|
||||
[node name="ESCHotspot" type="Area2D" parent="Hotspots"]
|
||||
script = ExtResource( 3 )
|
||||
dialog_color = Color( 1, 1, 1, 1 )
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hotspots/ESCHotspot"]
|
||||
polygon = PoolVector2Array( 105, 65, 157, 47, 186, 118, 87, 134, 77, 87 )
|
||||
46
addons/escoria-core/template_scenes/verbs_cursor_icons.tscn
Normal file
46
addons/escoria-core/template_scenes/verbs_cursor_icons.tscn
Normal file
@@ -0,0 +1,46 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://game/ui/ui_mouse_icons/cursors/cursor_hand.png" type="Texture" id=1]
|
||||
[ext_resource path="res://game/ui/ui_mouse_icons/cursors/cursor_foot.png" type="Texture" id=2]
|
||||
[ext_resource path="res://game/ui/ui_mouse_icons/cursors/cursor_examine.png" type="Texture" id=3]
|
||||
[ext_resource path="res://game/ui/ui_mouse_icons/cursors/cursor_tool.png" type="Texture" id=4]
|
||||
|
||||
|
||||
|
||||
[node name="verbs_menu" type="Control"]
|
||||
margin_left = 1.0
|
||||
margin_right = 1.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="actions" type="GridContainer" parent="."]
|
||||
margin_right = 333.0
|
||||
margin_bottom = 175.0
|
||||
columns = 3
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="look" type="TextureRect" parent="actions"]
|
||||
margin_right = 301.0
|
||||
margin_bottom = 300.0
|
||||
texture = ExtResource( 3 )
|
||||
|
||||
[node name="walk" type="TextureRect" parent="actions"]
|
||||
margin_left = 305.0
|
||||
margin_right = 606.0
|
||||
margin_bottom = 300.0
|
||||
texture = ExtResource( 2 )
|
||||
|
||||
[node name="pickup" type="TextureRect" parent="actions"]
|
||||
margin_left = 610.0
|
||||
margin_right = 911.0
|
||||
margin_bottom = 300.0
|
||||
texture = ExtResource( 1 )
|
||||
|
||||
[node name="use" type="TextureRect" parent="actions"]
|
||||
margin_top = 304.0
|
||||
margin_right = 301.0
|
||||
margin_bottom = 604.0
|
||||
texture = ExtResource( 4 )
|
||||
14
addons/escoria-core/template_scenes/verbs_menu_scumm9.gd
Normal file
14
addons/escoria-core/template_scenes/verbs_menu_scumm9.gd
Normal file
@@ -0,0 +1,14 @@
|
||||
tool
|
||||
extends Control
|
||||
|
||||
func _ready():
|
||||
for but in $actions.get_children():
|
||||
but.connect("pressed", self, "_on_action_selected", [but.name])
|
||||
but.toggle_mode = true
|
||||
|
||||
func _on_action_selected(action : String):
|
||||
escoria.set_current_action(action)
|
||||
|
||||
for but in $actions.get_children():
|
||||
but.set_pressed(but.get_name() == action)
|
||||
|
||||
121
addons/escoria-core/template_scenes/verbs_menu_scumm9.tscn
Normal file
121
addons/escoria-core/template_scenes/verbs_menu_scumm9.tscn
Normal file
@@ -0,0 +1,121 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/escoria-core/template_scenes/verbs_menu_scumm9.gd" type="Script" id=1]
|
||||
|
||||
[node name="verbs_menu" type="Control"]
|
||||
margin_left = 1.0
|
||||
margin_right = 1.0
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="actions" type="GridContainer" parent="."]
|
||||
margin_right = 333.0
|
||||
margin_bottom = 175.0
|
||||
columns = 3
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="open" type="Button" parent="actions"]
|
||||
margin_right = 108.0
|
||||
margin_bottom = 55.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Open"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="pickup" type="Button" parent="actions"]
|
||||
margin_left = 112.0
|
||||
margin_right = 220.0
|
||||
margin_bottom = 55.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Pick up"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="push" type="Button" parent="actions"]
|
||||
margin_left = 224.0
|
||||
margin_right = 332.0
|
||||
margin_bottom = 55.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Push"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="close" type="Button" parent="actions"]
|
||||
margin_top = 59.0
|
||||
margin_right = 108.0
|
||||
margin_bottom = 114.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Close"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="lookat" type="Button" parent="actions"]
|
||||
margin_left = 112.0
|
||||
margin_top = 59.0
|
||||
margin_right = 220.0
|
||||
margin_bottom = 114.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Look at"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="pull" type="Button" parent="actions"]
|
||||
margin_left = 224.0
|
||||
margin_top = 59.0
|
||||
margin_right = 332.0
|
||||
margin_bottom = 114.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Pull"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="give" type="Button" parent="actions"]
|
||||
margin_top = 118.0
|
||||
margin_right = 108.0
|
||||
margin_bottom = 173.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Give"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="use" type="Button" parent="actions"]
|
||||
margin_left = 112.0
|
||||
margin_top = 118.0
|
||||
margin_right = 220.0
|
||||
margin_bottom = 173.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Use"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="talk" type="Button" parent="actions"]
|
||||
margin_left = 224.0
|
||||
margin_top = 118.0
|
||||
margin_right = 332.0
|
||||
margin_bottom = 173.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Talk"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
Reference in New Issue
Block a user