add new transaction and add splash screen

This commit is contained in:
2026-06-29 14:59:58 +02:00
parent bc30a169dc
commit fb848a9848
14 changed files with 145 additions and 1721 deletions

View File

@@ -42,10 +42,12 @@ func _ready() -> void:
choo_choo_button.pressed.connect(_on_choo_choo_button_pressed) choo_choo_button.pressed.connect(_on_choo_choo_button_pressed)
resume_button.pressed.connect(_on_resume_button_pressed) resume_button.pressed.connect(_on_resume_button_pressed)
func _process(delta: float) -> void: func _process(_delta: float) -> void:
if time_label and dist_label and GameState.is_loaded: if time_label and dist_label and GameState.is_loaded:
var time = GameState.save_data.total_time_played_seconds var time = GameState.save_data.total_time_played_seconds
@warning_ignore("integer_division")
var hours = int(time) / 3600 var hours = int(time) / 3600
@warning_ignore("integer_division")
var minutes = (int(time) % 3600) / 60 var minutes = (int(time) % 3600) / 60
var seconds = int(time) % 60 var seconds = int(time) % 60
time_label.text = "Travel Time: %02d:%02d:%02d" % [hours, minutes, seconds] time_label.text = "Travel Time: %02d:%02d:%02d" % [hours, minutes, seconds]

View File

@@ -1,6 +1,6 @@
class_name SceneConfig class_name SceneConfig
extends Resource extends Resource
enum SceneName { MAIN_MENU, GAME } enum SceneName { MAIN_MENU, GAME, SPLASH_SCREEN }
@export var scenes: Dictionary[SceneName, PackedScene] @export var scenes: Dictionary[SceneName, PackedScene]

View File

@@ -3,11 +3,13 @@
[ext_resource type="PackedScene" uid="uid://btcpge7cj2041" path="res://core/main_menu/main_menu.tscn" id="1_72aup"] [ext_resource type="PackedScene" uid="uid://btcpge7cj2041" path="res://core/main_menu/main_menu.tscn" id="1_72aup"]
[ext_resource type="Script" uid="uid://bbgyhmb8a17i7" path="res://core/scene_manager/scene_config.gd" id="1_km45g"] [ext_resource type="Script" uid="uid://bbgyhmb8a17i7" path="res://core/scene_manager/scene_config.gd" id="1_km45g"]
[ext_resource type="PackedScene" uid="uid://vjf4bdxd8saj" path="res://tgcc/main_scene.tscn" id="2_prsyo"] [ext_resource type="PackedScene" uid="uid://vjf4bdxd8saj" path="res://tgcc/main_scene.tscn" id="2_prsyo"]
[ext_resource type="PackedScene" uid="uid://ri5kxx4mipo" path="res://core/splash_screen/splash_screen.tscn" id="3_aasbo"]
[resource] [resource]
script = ExtResource("1_km45g") script = ExtResource("1_km45g")
scenes = Dictionary[int, PackedScene]({ scenes = Dictionary[int, PackedScene]({
0: ExtResource("1_72aup"), 0: ExtResource("1_72aup"),
1: ExtResource("2_prsyo") 1: ExtResource("2_prsyo"),
2: ExtResource("3_aasbo")
}) })
metadata/_custom_type_script = "uid://bbgyhmb8a17i7" metadata/_custom_type_script = "uid://bbgyhmb8a17i7"

View File

@@ -4,41 +4,85 @@ extends CanvasLayer
@onready var color_rect = $ColorRect @onready var color_rect = $ColorRect
@onready var loading_screen = $LoadingScreen @onready var loading_screen = $LoadingScreen
@export var transition_duration: float = 1 @export var transition_duration: float = 1
const SHADER_PATH := "res://core/transition.gdshader"
func _ready() -> void: func _ready() -> void:
color_rect.color.a = 0.0 _build_material()
color_rect.mouse_filter = Control.MOUSE_FILTER_IGNORE _update_resolution()
loading_screen.hide() get_viewport().size_changed.connect(_update_resolution)
_set_factor(0.0)
color_rect.visible = false
func change_scene(scene_enum: SceneConfig.SceneName) -> void: func _build_material() -> void:
var mat := ShaderMaterial.new()
mat.shader = load(SHADER_PATH)
#directional gradient: botto-left-> black; top-right -> white
var g := Gradient.new()
g.set_color(0, Color.BLACK)
g.set_color(1, Color.WHITE)
var grad_tex := GradientTexture2D.new()
grad_tex.gradient = g
grad_tex.fill = GradientTexture2D.FILL_LINEAR
grad_tex.fill_from = Vector2(0.0, 1.0) # bottom-left
grad_tex.fill_to = Vector2(1.0, 0.0) # top-right
grad_tex.width = 256
grad_tex.height = 256
#shape: sphere (white at the center, black around)
var sg := Gradient.new()
sg.set_color(0, Color.WHITE)
sg.set_color(1, Color.BLACK)
var shape_tex := GradientTexture2D.new()
shape_tex.gradient = sg
shape_tex.fill = GradientTexture2D.FILL_RADIAL
shape_tex.fill_from = Vector2(0.5, 0.5) # center
shape_tex.fill_to = Vector2(0.5, 0.0) # ray
shape_tex.width = 64
shape_tex.height = 64
mat.set_shader_parameter("base_color", Color.BLACK)
mat.set_shader_parameter("gradient_texture", grad_tex)
mat.set_shader_parameter("gradient_fixed", false)
mat.set_shader_parameter("shape_texture", shape_tex)
mat.set_shader_parameter("shape_tiling", 16.0)
mat.set_shader_parameter("shape_rotation", 0.0)
mat.set_shader_parameter("shape_scroll", Vector2.ZERO)
mat.set_shader_parameter("shape_feathering", 0.0)
mat.set_shader_parameter("shape_treshold", 1.15) # >1 = full at the end of the transation
mat.set_shader_parameter("width", 0.5)
color_rect.material = mat
func _update_resolution() -> void:
var s := get_viewport().get_visible_rect().size
color_rect.material.set_shader_parameter("node_resolution", s)
func _set_factor(v: float) -> void:
color_rect.material.set_shader_parameter("factor", v)
func cover(duration := 0.5) -> void:
color_rect.visible = true
var t := create_tween()
t.tween_method(_set_factor, 0.0, 1.0, duration)
await t.finished
func reveal(duration := 0.5) -> void:
var t := create_tween()
t.tween_method(_set_factor, 1.0, 0.0, duration)
await t.finished
color_rect.visible = false
func change_scene(scene_enum: SceneConfig.SceneName) -> void:
if not config or not config.scenes.has(scene_enum): if not config or not config.scenes.has(scene_enum):
return return
var target_scene: PackedScene = config.scenes[scene_enum] var target_scene: PackedScene = config.scenes[scene_enum]
color_rect.mouse_filter = Control.MOUSE_FILTER_STOP color_rect.mouse_filter = Control.MOUSE_FILTER_STOP
var tween_in = create_tween()
tween_in.tween_property(color_rect, "color:a", 1.0, transition_duration)
await tween_in.finished
loading_screen.show()
await get_tree().process_frame
await cover(transition_duration)
get_tree().change_scene_to_packed(target_scene) get_tree().change_scene_to_packed(target_scene)
await reveal(transition_duration)
loading_screen.hide()
var tween_out = create_tween()
tween_out.tween_property(color_rect, "color:a", 0.0, transition_duration)
await tween_out.finished
color_rect.mouse_filter = Control.MOUSE_FILTER_IGNORE color_rect.mouse_filter = Control.MOUSE_FILTER_IGNORE
func quit_game() -> void:
color_rect.mouse_filter = Control.MOUSE_FILTER_STOP
var tween = create_tween()
tween.tween_property(color_rect, "color:a", 1.0, transition_duration)
await tween.finished
get_tree().quit()

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dp3qxncy8u184"
path="res://.godot/imported/jmp_logo.png-c6094efb2c4c429c25ff79b5a4cee21c.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://core/splash_screen/jmp_logo.png"
dest_files=["res://.godot/imported/jmp_logo.png-c6094efb2c4c429c25ff79b5a4cee21c.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -0,0 +1,8 @@
extends Control
@export var main_menu_scene: PackedScene
@export var display_time: float = 3.0
func _ready() -> void:
await get_tree().create_timer(display_time).timeout
SceneManager.change_scene(SceneConfig.SceneName.MAIN_MENU)

View File

@@ -0,0 +1 @@
uid://ckj2pcoxi5j3

View File

@@ -0,0 +1,18 @@
[gd_scene format=3 uid="uid://ri5kxx4mipo"]
[ext_resource type="Script" uid="uid://ckj2pcoxi5j3" path="res://core/splash_screen/splash_screen.gd" id="1_elsnp"]
[ext_resource type="Texture2D" uid="uid://dp3qxncy8u184" path="res://core/splash_screen/jmp_logo.png" id="1_jkpgl"]
[node name="Control" type="Control" unique_id=163470013]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_elsnp")
[node name="JMPLogo" type="Sprite2D" parent="." unique_id=1244888940]
position = Vector2(980.99994, 556)
scale = Vector2(0.37799045, 0.37799042)
texture = ExtResource("1_jkpgl")

View File

@@ -11,7 +11,7 @@ config_version=5
[application] [application]
config/name="tgcc" config/name="tgcc"
run/main_scene="uid://vjf4bdxd8saj" run/main_scene="uid://ri5kxx4mipo"
config/features=PackedStringArray("4.6", "Forward Plus") config/features=PackedStringArray("4.6", "Forward Plus")
run/max_fps=60 run/max_fps=60
config/icon="uid://bfar1kk3pgq8f" config/icon="uid://bfar1kk3pgq8f"

View File

@@ -251,9 +251,9 @@ wagon_pool = ExtResource("46_exdk1")
wagon_count = 5 wagon_count = 5
wagon_gap = 0.8 wagon_gap = 0.8
wagon_spacing_scale = 0.9 wagon_spacing_scale = 0.9
cameras = NodePath("../cameras")
sleepers_model = ExtResource("46_lbmv2") sleepers_model = ExtResource("46_lbmv2")
fireworks_scene = ExtResource("47_q7p65") fireworks_scene = ExtResource("47_q7p65")
cameras = NodePath("../cameras")
[node name="Marker3D" type="Marker3D" parent="rail" unique_id=1460318018] [node name="Marker3D" type="Marker3D" parent="rail" unique_id=1460318018]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.7581053, -1.6046681, 59.658325) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.7581053, -1.6046681, 59.658325)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long