fix: warnings removed, scrolling behaviour intent perhaps fixed
This commit is contained in:
parent
38a5a49e67
commit
454839f20a
|
|
@ -19,14 +19,14 @@ var max_lines: float = 0
|
|||
set(value):
|
||||
progress = value
|
||||
if is_node_ready() and not all_text_revealed:
|
||||
var start_index = 0
|
||||
var start_index := 0
|
||||
if progress >= substring_sizes.size() or progress < 0:
|
||||
label.visible_ratio = 1
|
||||
elif progress > 0:
|
||||
for i in range(min(progress, substring_sizes.size()-1) as int) if progress > 0 else range(substring_sizes.size()-1):
|
||||
start_index += substring_sizes[i]
|
||||
|
||||
label.visible_characters = start_index + substring_sizes[min(progress as int, substring_sizes.size()-1)] * fmod(progress, 1)
|
||||
label.visible_characters = start_index + int(substring_sizes[min(progress as int, substring_sizes.size()-1)] * fmod(progress, 1))
|
||||
else:
|
||||
label.visible_ratio = 0
|
||||
|
||||
|
|
@ -94,14 +94,14 @@ func _rebuild():
|
|||
max_lines = float(label.get_line_count())
|
||||
|
||||
func try_scroll():
|
||||
var forward_target: int
|
||||
var forward_target: float
|
||||
|
||||
#print_debug( "max lines: " + str(max_lines))
|
||||
#print_debug( "current lines: " + str(label.get_character_line(label.visible_characters)))
|
||||
#print( "max lines: " + str(max_lines))
|
||||
#print( "current lines: " + str(label.get_character_line(label.visible_characters)))
|
||||
|
||||
var visible_ratio: float = float(label.get_character_line(label.visible_characters)) / max_lines
|
||||
|
||||
#print_debug("Tried scrolling with ratio of %f. Comparing %f against %f" % [visible_ratio, label.size.y * visible_ratio - scroll_container.scroll_vertical, scroll_container.size.y * 0.9])
|
||||
#print("Tried scrolling with ratio of %f. Comparing %f against %f" % [visible_ratio, label.size.y * visible_ratio - scroll_container.scroll_vertical, scroll_container.size.y * 0.9])
|
||||
|
||||
if label.size.y * visible_ratio + scroll_container.scroll_vertical > scroll_container.size.y * 0.9:
|
||||
if scroll_container.scroll_vertical + scroll_container.size.y * 0.9 < label.size.y:
|
||||
|
|
@ -109,7 +109,7 @@ func try_scroll():
|
|||
else:
|
||||
forward_target = label.size.y - scroll_container.size.y
|
||||
if scroll_target != null:
|
||||
var tween: Tween = get_tree().create_tween()
|
||||
#var tween: Tween = get_tree().create_tween()
|
||||
##tween.set_trans()
|
||||
scroll_target = forward_target
|
||||
|
||||
|
|
@ -150,18 +150,18 @@ func play_scene():
|
|||
finished.emit()
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
var just_revealed_text = false
|
||||
var just_revealed_text := false
|
||||
if event is InputEventMouseButton:
|
||||
if event.button_index == MOUSE_BUTTON_WHEEL_DOWN:
|
||||
scroll_target += 40
|
||||
if not all_text_revealed: just_revealed_text
|
||||
all_text_revealed = true
|
||||
if not all_text_revealed:
|
||||
just_revealed_text = true
|
||||
if event.button_index == MOUSE_BUTTON_WHEEL_UP:
|
||||
scroll_target -= 40
|
||||
if not all_text_revealed: just_revealed_text
|
||||
if not all_text_revealed:
|
||||
just_revealed_text = true
|
||||
if just_revealed_text and animation_complete:
|
||||
all_text_revealed = true
|
||||
if just_revealed_text:
|
||||
if animation_complete: all_text_revealed = true
|
||||
|
||||
var scroll_target: float = 0:
|
||||
set(value):
|
||||
|
|
@ -170,7 +170,7 @@ func _process(delta: float) -> void:
|
|||
# FIXME: maybe change this to has stage?
|
||||
if visible and not Engine.is_editor_hint():
|
||||
if scroll_container.scroll_vertical != scroll_target:
|
||||
scroll_container.scroll_vertical += (scroll_target-scroll_container.scroll_vertical)*delta*6
|
||||
scroll_container.scroll_vertical += int((scroll_target-scroll_container.scroll_vertical)*delta*6)
|
||||
|
||||
var intro_triggered:= false
|
||||
func trigger_intro():
|
||||
|
|
|
|||
|
|
@ -1735,7 +1735,7 @@ func _ready():
|
|||
camera = get_tree().root.get_viewport().get_camera_3d()
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
func _process(_delta):
|
||||
self.global_transform = camera.global_transform
|
||||
"
|
||||
|
||||
|
|
|
|||
|
|
@ -266,7 +266,7 @@ func _input(event:InputEvent):
|
|||
else:
|
||||
crouch_toggled = true
|
||||
|
||||
func play_scene(id: int, _repeat):
|
||||
func play_scene(_id: int, _repeat: bool):
|
||||
pass
|
||||
#if id == Scenes.id.YOUTH_DRAEVEN:
|
||||
# var rotation_tween := create_tween()
|
||||
|
|
|
|||
Loading…
Reference in New Issue