add side switching animation

This commit is contained in:
2025-02-25 03:51:12 +10:00
parent 58983ecda2
commit 2633390dd8
8 changed files with 333 additions and 178 deletions

View File

@@ -137,30 +137,30 @@ func _update_controls_label() -> void:
func _append_text(key: String, value: Variant, label_index: int) -> void:
var line := str(value)
var line_text := str(value)
if value is int:
line = (" " if value >= 0 else "") + line
line_text = (" " if value >= 0 else "") + line_text
if (value as int) > 0:
line = "[color=sky_blue]%s[/color]" % line
line_text = "[color=sky_blue]%s[/color]" % line_text
elif (value as int) < 0:
line = "[color=salmon]%s[/color]" % line
line_text = "[color=salmon]%s[/color]" % line_text
elif value is float:
line = (" " if value >= 0 else "") + "%.6f" % value
line_text = (" " if value >= 0 else "") + "%.6f" % value
if value > 0:
line = "[color=sky_blue]%s[/color]" % line
line_text = "[color=sky_blue]%s[/color]" % line_text
elif value < 0:
line = "[color=salmon]%s[/color]" % line
line_text = "[color=salmon]%s[/color]" % line_text
elif value is bool:
if value:
line = "[color=sky_blue]%s[/color]" % line
line_text = "[color=sky_blue]%s[/color]" % line_text
else:
line = "[color=salmon]%s[/color]" % line
line_text = "[color=salmon]%s[/color]" % line_text
elif value is Vector3:
line = (
line_text = (
"(%s, %s, %s)"
% [
(" " if value.x >= 0 else "") + ("%.6f" % value.x),
@@ -170,7 +170,7 @@ func _append_text(key: String, value: Variant, label_index: int) -> void:
)
elif value is Vector2:
line = (
line_text = (
"(%s, %s)"
% [
(" " if value.x >= 0 else "") + ("%.6f" % value.x),
@@ -178,19 +178,19 @@ func _append_text(key: String, value: Variant, label_index: int) -> void:
]
)
line = "%s: %s\n" % [key, line]
line_text = "%s: %s\n" % [key, line_text]
if label_index == 2:
_label2_text += line
_label2_text += line_text
else:
_label1_text += line
_label1_text += line_text
func _append_event(key: String, frame: int, args: Array[Variant]) -> void:
var line := key
var line_text := key
if args.size() > 0:
line += "(%s)" % ", ".join(args.map(str))
line_text += "(%s)" % ", ".join(args.map(str))
var physics_frame := Engine.get_physics_frames()
var color := Color.SALMON.lerp(
@@ -199,9 +199,9 @@ func _append_event(key: String, frame: int, args: Array[Variant]) -> void:
if physics_frame - frame < 5:
color = Color.SKY_BLUE
line = "[color=#%s]%s[/color]\n" % [color.to_html(), line]
line_text = "[color=#%s]%s[/color]\n" % [color.to_html(), line_text]
_label3_text += line
_label3_text += line_text
func _draw_vector(from: Vector3, to: Vector3, color: Color) -> void: