grass cleanup, camera cleanup, animation test
This commit is contained in:
parent
561135b63a
commit
b12c193636
13 changed files with 35136 additions and 44782 deletions
|
|
@ -7,47 +7,39 @@ func _ready():
|
|||
rect.modulate.a = 0
|
||||
log_display.text = ""
|
||||
log_display.visible = false
|
||||
# Ensure the rect doesn't block clicks while invisible
|
||||
|
||||
rect.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
|
||||
## Combined function to handle both success and error transitions
|
||||
func change_scene(target_path: String, is_error: bool = false):
|
||||
rect.mouse_filter = Control.MOUSE_FILTER_STOP
|
||||
|
||||
# Set color based on status
|
||||
if is_error:
|
||||
rect.color = Color.CRIMSON
|
||||
else:
|
||||
rect.color = Color.from_string("#364388", Color.BLUE)
|
||||
|
||||
# Fade In
|
||||
var tween_in = create_tween()
|
||||
await tween_in.tween_property(rect, "modulate:a", 1.0, 0.3).finished
|
||||
|
||||
# Display Log
|
||||
log_display.visible = true
|
||||
var log_file = "res://hex.txt" if is_error else "res://log.txt"
|
||||
await display_log_file(log_file)
|
||||
display_log_file(log_file)
|
||||
|
||||
await get_tree().create_timer(0.5).timeout
|
||||
|
||||
# Change Scene
|
||||
var error = get_tree().change_scene_to_file(target_path)
|
||||
if error != OK:
|
||||
push_error("Failed to load scene: " + target_path)
|
||||
|
||||
# Cleanup and Fade Out
|
||||
|
||||
log_display.visible = false
|
||||
log_display.text = ""
|
||||
|
||||
var tween_out = create_tween()
|
||||
await tween_out.tween_property(rect, "modulate:a", 0.0, 0.5).finished
|
||||
tween_out.tween_property(rect, "modulate:a", 0.0, 0.5)
|
||||
rect.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
|
||||
func display_log_file(file_path: String):
|
||||
if not FileAccess.file_exists(file_path):
|
||||
log_display.add_text("ERROR: " + file_path + " not found in build.\n")
|
||||
# Check Project -> Export -> Resources -> Filters to include non-resource files
|
||||
return
|
||||
|
||||
var file = FileAccess.open(file_path, FileAccess.READ)
|
||||
|
|
@ -55,13 +47,11 @@ func display_log_file(file_path: String):
|
|||
log_display.add_text("ERROR: Could not open file.\n")
|
||||
return
|
||||
|
||||
# Reading line by line for that "hacker" effect
|
||||
while not file.eof_reached():
|
||||
var line = file.get_line()
|
||||
if line.strip_edges() == "": continue # Skip empty lines if desired
|
||||
if line.strip_edges() == "": continue
|
||||
|
||||
log_display.add_text(line + "\n")
|
||||
# Auto-scroll to bottom
|
||||
log_display.scroll_to_line(log_display.get_line_count())
|
||||
|
||||
var delay = 0#randf_range(0.0001, 0.00015)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue