Moved files into folders
This commit is contained in:
@@ -1,49 +0,0 @@
|
||||
[gd_scene format=3 uid="uid://xmes6cyca17"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_66br4"]
|
||||
content_margin_left = 50.0
|
||||
bg_color = Color(0.4373566, 0.12280094, 0.2996518, 1)
|
||||
border_width_left = 10
|
||||
border_width_top = 10
|
||||
border_width_right = 10
|
||||
border_width_bottom = 10
|
||||
border_color = Color(0.7138311, 0.75896835, 1, 1)
|
||||
corner_radius_top_left = 10
|
||||
corner_radius_top_right = 10
|
||||
corner_radius_bottom_right = 10
|
||||
corner_radius_bottom_left = 10
|
||||
|
||||
[node name="DialogContainer" type="MarginContainer" unique_id=988261899]
|
||||
anchors_preset = 12
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_top = -240.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
theme_override_constants/margin_left = 20
|
||||
theme_override_constants/margin_right = 20
|
||||
theme_override_constants/margin_bottom = 20
|
||||
|
||||
[node name="DialogBackground" type="Panel" parent="." unique_id=865458038]
|
||||
layout_mode = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_66br4")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="." unique_id=1763747003]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 20
|
||||
theme_override_constants/margin_right = 20
|
||||
theme_override_constants/margin_bottom = 20
|
||||
|
||||
[node name="RichTextLabel" type="RichTextLabel" parent="MarginContainer" unique_id=53979081]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/normal_font_size = 30
|
||||
theme_override_font_sizes/bold_font_size = 30
|
||||
theme_override_font_sizes/bold_italics_font_size = 30
|
||||
theme_override_font_sizes/italics_font_size = 30
|
||||
theme_override_font_sizes/mono_font_size = 30
|
||||
text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus dictum aliquet arcu, vel tristique ligula dictum id. Mauris ac libero ut enim ultrices aliquam vel eget lacus. Nam ultricies dapibus erat. In lacus sapien, porttitor at purus blandit, sagittis euismod augue."
|
||||
scroll_active = false
|
||||
autowrap_mode = 2
|
||||
vertical_alignment = 1
|
||||
justification_flags = 227
|
||||
@@ -1,46 +0,0 @@
|
||||
extends Node
|
||||
|
||||
@export var dialogContainer: MarginContainer
|
||||
@export var dialogTextLabel: RichTextLabel
|
||||
|
||||
var _current_dialog_counter: int = 0
|
||||
var _current_dialog_text: DialogText = null
|
||||
var _current_dialog_seconds: float = 1
|
||||
|
||||
func set_dialog_text(dialog_text: DialogText, seconds: float = 1) -> void:
|
||||
_current_dialog_counter = -1
|
||||
_current_dialog_text = dialog_text
|
||||
_current_dialog_seconds = seconds
|
||||
_next_dialog_line()
|
||||
|
||||
func _next_dialog_line() -> void:
|
||||
_current_dialog_counter += 1
|
||||
set_dialog_line(_current_dialog_text.get_line_raw(_current_dialog_counter), _current_dialog_seconds)
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if Input.is_action_just_pressed("ui_accept") and _current_dialog_text:
|
||||
_next_dialog_line()
|
||||
|
||||
func set_dialog_line(text: String, seconds: float = 1) -> void:
|
||||
dialogTextLabel.text = text
|
||||
dialogTextLabel.visible_ratio = 0
|
||||
var ratio: float = 0
|
||||
|
||||
if text.length() == 0:
|
||||
dialogContainer.visible = false
|
||||
%GameplayController.input_enabled = true
|
||||
_current_dialog_text = null
|
||||
return #a hacky way to clear the dialog box
|
||||
else:
|
||||
dialogContainer.visible = true
|
||||
%GameplayController.input_enabled = false
|
||||
|
||||
var increment: float = (1 / seconds)/ 60.0
|
||||
|
||||
while true:
|
||||
#don't interfere with other timers
|
||||
if dialogTextLabel.visible_ratio < ratio or dialogTextLabel.visible_ratio >= 1:
|
||||
return
|
||||
dialogTextLabel.visible_ratio += increment
|
||||
ratio = dialogTextLabel.visible_ratio
|
||||
await get_tree().create_timer(1.0/60.0).timeout #update proportional to 60 FPS
|
||||
@@ -1 +0,0 @@
|
||||
uid://crdpf275pa70b
|
||||
Reference in New Issue
Block a user