Godot 4.5.1
This commit is contained in:
@@ -12,62 +12,62 @@ var currentViewScrolled = true;
|
||||
var isSpeedupDown = false;
|
||||
|
||||
var isClosed:bool = false:
|
||||
get():
|
||||
return !self.visible;
|
||||
set(value):
|
||||
self.visible = !value;
|
||||
get():
|
||||
return !self.visible;
|
||||
set(value):
|
||||
self.visible = !value;
|
||||
|
||||
signal textboxClosing
|
||||
|
||||
func _ready() -> void:
|
||||
label = $MarginContainer/Label
|
||||
isClosed = true
|
||||
label = $MarginContainer/Label
|
||||
isClosed = true
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if label.getFinalText() == "":
|
||||
isClosed = true;
|
||||
return;
|
||||
|
||||
if label.visible_characters >= label.getCharactersDisplayedCount():
|
||||
if (label.maxLines + label.startLine) < label.getTotalLineCount():
|
||||
# Not on last page.
|
||||
if Input.is_action_just_pressed("interact"):
|
||||
label.startLine += label.maxLines;
|
||||
label.visible_characters = 0;
|
||||
currentViewScrolled = false;
|
||||
return
|
||||
if label.getFinalText() == "":
|
||||
isClosed = true;
|
||||
return;
|
||||
|
||||
if label.visible_characters >= label.getCharactersDisplayedCount():
|
||||
if (label.maxLines + label.startLine) < label.getTotalLineCount():
|
||||
# Not on last page.
|
||||
if Input.is_action_just_pressed("interact"):
|
||||
label.startLine += label.maxLines;
|
||||
label.visible_characters = 0;
|
||||
currentViewScrolled = false;
|
||||
return
|
||||
|
||||
currentViewScrolled = true;
|
||||
else:
|
||||
# On last page
|
||||
if Input.is_action_just_released("interact"):
|
||||
textboxClosing.emit();
|
||||
isClosed = true;
|
||||
currentViewScrolled = true
|
||||
return;
|
||||
currentViewScrolled = true;
|
||||
else:
|
||||
# On last page
|
||||
if Input.is_action_just_released("interact"):
|
||||
textboxClosing.emit();
|
||||
isClosed = true;
|
||||
currentViewScrolled = true
|
||||
return;
|
||||
|
||||
if Input.is_action_just_pressed("interact"):
|
||||
isSpeedupDown = true;
|
||||
elif Input.is_action_just_released("interact"):
|
||||
isSpeedupDown = false;
|
||||
elif !Input.is_action_pressed("interact"):
|
||||
isSpeedupDown = false;
|
||||
if Input.is_action_just_pressed("interact"):
|
||||
isSpeedupDown = true;
|
||||
elif Input.is_action_just_released("interact"):
|
||||
isSpeedupDown = false;
|
||||
elif !Input.is_action_pressed("interact"):
|
||||
isSpeedupDown = false;
|
||||
|
||||
revealTimer += delta;
|
||||
if isSpeedupDown:
|
||||
revealTimer += delta;
|
||||
revealTimer += delta;
|
||||
if isSpeedupDown:
|
||||
revealTimer += delta;
|
||||
|
||||
if revealTimer > VN_REVEAL_TIME:
|
||||
revealTimer = 0;
|
||||
label.visible_characters += 1;
|
||||
if revealTimer > VN_REVEAL_TIME:
|
||||
revealTimer = 0;
|
||||
label.visible_characters += 1;
|
||||
|
||||
func setText(text:String) -> void:
|
||||
isClosed = false;
|
||||
revealTimer = 0;
|
||||
currentViewScrolled = false;
|
||||
label.visible_characters = 0;
|
||||
label.startLine = 0;
|
||||
label.text = ""
|
||||
await get_tree().process_frame# Absolutely needed to make the text wrap
|
||||
label.text = text;
|
||||
label.visible_characters = 0;
|
||||
isClosed = false;
|
||||
revealTimer = 0;
|
||||
currentViewScrolled = false;
|
||||
label.visible_characters = 0;
|
||||
label.startLine = 0;
|
||||
label.text = ""
|
||||
await get_tree().process_frame# Absolutely needed to make the text wrap
|
||||
label.text = text;
|
||||
label.visible_characters = 0;
|
||||
|
||||
Reference in New Issue
Block a user