update and improve ui

This commit was merged in pull request #36.
This commit is contained in:
2026-06-27 11:54:01 +00:00
parent 97bbca95e8
commit c0a68da7d1
21 changed files with 470 additions and 129 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://d2s020wikunuo"
path="res://.godot/imported/barretta_main.png-d118ead98672de7a9802ba85eaf04053.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://core/game_menu/assets/page_1/barretta_main.png"
dest_files=["res://.godot/imported/barretta_main.png-d118ead98672de7a9802ba85eaf04053.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://ct7o3u6i5rka6"
path="res://.godot/imported/barretta_second.png-7f0af7da51c3ebb821e017a3fe148c6e.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://core/game_menu/assets/page_1/barretta_second.png"
dest_files=["res://.godot/imported/barretta_second.png-7f0af7da51c3ebb821e017a3fe148c6e.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

@@ -2,7 +2,7 @@
[ext_resource type="Script" uid="uid://c7q3d823b1v1h" path="res://core/game_menu/biome_picker.gd" id="1_jqji0"]
[ext_resource type="Texture2D" uid="uid://dc0sl04wem136" path="res://core/game_menu/assets/page_1/color_main_biome.png" id="2_8s4h5"]
[ext_resource type="Texture2D" uid="uid://dj6pt25w5i4jq" path="res://core/game_menu/assets/page_1/lucchetto.png" id="2_jqji0"]
[ext_resource type="Texture2D" uid="uid://bx6gsh5uchkge" path="res://core/game_menu/assets/lock.png" id="3_jqji0"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_jqji0"]
@@ -65,18 +65,19 @@ stretch_mode = 3
[node name="TextureRect" type="TextureRect" parent="Texture" unique_id=288045010]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = -1
anchor_left = 0.36645964
anchor_top = 0.41690964
anchor_right = 0.6335404
anchor_bottom = 0.58309036
offset_left = 1.5
offset_top = 8.5
offset_right = -1.5
offset_bottom = -8.5
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -26.8755
offset_top = -34.375504
offset_right = 26.8755
offset_bottom = 34.375504
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
texture = ExtResource("2_jqji0")
texture = ExtResource("3_jqji0")
expand_mode = 1
[connection signal="pressed" from="." to="." method="_on_pressed"]

View File

@@ -25,9 +25,11 @@ grow_vertical = 2
unique_name_in_owner = true
layout_mode = 1
anchor_left = 0.3625
anchor_top = 0.14351852
anchor_top = 0.21481481
anchor_right = 0.6375
anchor_bottom = 0.8564815
anchor_bottom = 0.78518516
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
[node name="ColorRect" parent="Photo" index="0" unique_id=1208008621]
@@ -37,6 +39,12 @@ offset_top = 0.0
offset_right = 0.0
offset_bottom = 0.0
[node name="MarginContainer" parent="Photo/ColorRect" index="0" unique_id=1141643525]
theme_override_constants/margin_left = 56
theme_override_constants/margin_top = 60
theme_override_constants/margin_right = 56
theme_override_constants/margin_bottom = 200
[connection signal="gui_input" from="Panel" to="." method="_on_panel_gui_input"]
[editable path="Photo"]

View File

@@ -45,7 +45,7 @@ layout_mode = 2
size_flags_vertical = 3
mouse_filter = 2
expand_mode = 1
stretch_mode = 6
stretch_mode = 5
[connection signal="mouse_entered" from="." to="." method="_on_mouse_entered"]
[connection signal="mouse_exited" from="." to="." method="_on_mouse_exited"]

View File

@@ -1,52 +1,57 @@
extends VBoxContainer
@onready var color_pickers: Array[TrainColorPicker] = [$%ColorPicker1, $%ColorPicker2, $%ColorPicker3, $%ColorPicker4, $%ColorPicker5, $%ColorPicker6]
@onready var left_arrow: ArrowButton = $%ArrowButtonLeft
@onready var right_arrow: ArrowButton = $%ArrowButtonRight
@onready var color_pickers_1: Array[TrainColorPicker] = [$%ColorPicker1, $%ColorPicker2, $%ColorPicker3, $%ColorPicker4, $%ColorPicker5, $%ColorPicker6]
@onready var color_pickers_2: Array[TrainColorPicker] = [$%ColorPicker7, $%ColorPicker8, $%ColorPicker9, $%ColorPicker10, $%ColorPicker11, $%ColorPicker12]
@onready var treno: Node3D = $TrainViewportContainer/SubViewport/Treno
var selected_color: Color
var selected_color_index: int = 0
func _ready() -> void:
for color_picker in color_pickers:
color_picker.pressed.connect(_on_color_selected.bind(color_picker))
for color_picker in color_pickers_1:
color_picker.pressed.connect(_on_color_selected.bind(color_picker, 0))
color_picker.deselect()
_set_selected_color(0)
var init_idx_1 = GameState.save_data.train_color_1_index
_set_selected_color(init_idx_1, 0)
left_arrow.pressed.connect(_select_prev_color)
right_arrow.pressed.connect(_select_next_color)
for color_picker in color_pickers_2:
color_picker.pressed.connect(_on_color_selected.bind(color_picker, 1))
color_picker.deselect()
var init_idx_2 = GameState.save_data.train_color_2_index
_set_selected_color(init_idx_2, 1)
func _process(delta: float) -> void:
if treno:
treno.rotation_degrees.y += 30.0 * delta
func _set_selected_color(index: int) -> void:
func _set_selected_color(index: int, material_index: int) -> void:
var color_pickers = color_pickers_1 if material_index == 0 else color_pickers_2
for i in range(color_pickers.size()):
if i == index:
color_pickers[i].select()
selected_color_index = i
selected_color = color_pickers[i].color
_apply_train_color(selected_color)
_apply_train_color(selected_color, material_index, index)
else:
color_pickers[i].deselect()
func _on_color_selected(selected_color_picker: TrainColorPicker) -> void:
func _on_color_selected(selected_color_picker: TrainColorPicker, material_index: int) -> void:
var color_pickers = color_pickers_1 if material_index == 0 else color_pickers_2
for i in range(color_pickers.size()):
if color_pickers[i] == selected_color_picker:
_set_selected_color(i)
_set_selected_color(i, material_index)
break
func _select_prev_color() -> void:
var next_index = (selected_color_index - 1 + color_pickers.size()) % color_pickers.size()
_set_selected_color(next_index)
func _select_next_color() -> void:
var next_index = (selected_color_index + 1) % color_pickers.size()
_set_selected_color(next_index)
func _apply_train_color(color: Color) -> void:
var mat: ShaderMaterial = load("res://tgcc/train/Color1_train.tres")
func _apply_train_color(color: Color, material_index: int, color_index: int = 0) -> void:
var path = "res://tgcc/train/Color%s_train.tres" % ("1" if material_index == 0 else "2")
var mat: ShaderMaterial = load(path)
if mat:
mat.set_shader_parameter("albedo_color", color)
if material_index == 0:
GameState.save_data.train_color_1 = color.to_html()
GameState.save_data.train_color_1_index = color_index
else:
GameState.save_data.train_color_2 = color.to_html()
GameState.save_data.train_color_2_index = color_index
GameState.save_game()

View File

@@ -2,8 +2,9 @@
[ext_resource type="Script" uid="uid://8k1msabobhks" path="res://core/game_menu/train_selector.gd" id="1_puip6"]
[ext_resource type="Texture2D" uid="uid://bjqp8kmb5y7px" path="res://core/game_menu/assets/page_1/chooseyourtrain_text.png" id="2_cfvtr"]
[ext_resource type="PackedScene" uid="uid://dm3skv22c60tm" path="res://core/game_menu/arrow_button.tscn" id="2_puip6"]
[ext_resource type="PackedScene" uid="uid://ch1st1oryjoio" path="res://core/game_menu/color_picker.tscn" id="3_i2rs1"]
[ext_resource type="Texture2D" uid="uid://d2s020wikunuo" path="res://core/game_menu/assets/page_1/barretta_main.png" id="4_ftlwq"]
[ext_resource type="Texture2D" uid="uid://ct7o3u6i5rka6" path="res://core/game_menu/assets/page_1/barretta_second.png" id="6_y1o8e"]
[ext_resource type="PackedScene" uid="uid://dxun0jk5t0n6" path="res://core/tween/container_tween.tscn" id="10_i2rs1"]
[ext_resource type="PackedScene" uid="uid://otptvwer4par" path="res://tgcc/train/train.tscn" id="11_train"]
@@ -31,7 +32,7 @@ stretch = true
own_world_3d = true
transparent_bg = true
handle_input_locally = false
size = Vector2i(660, 180)
size = Vector2i(625, 180)
render_target_update_mode = 4
[node name="Camera3D" type="Camera3D" parent="TrainViewportContainer/SubViewport" unique_id=1674220602]
@@ -43,59 +44,116 @@ transform = Transform3D(0.707107, -0.5, 0.5, 0, 0.707107, 0.707107, -0.707107, -
[node name="Treno" parent="TrainViewportContainer/SubViewport" unique_id=1674220603 instance=ExtResource("11_train")]
[node name="HBoxContainer2" type="HBoxContainer" parent="." unique_id=607833319]
[node name="TextureRect" type="TextureRect" parent="." unique_id=338929443]
layout_mode = 2
alignment = 1
mouse_filter = 2
texture = ExtResource("4_ftlwq")
[node name="ArrowButtonLeft" parent="HBoxContainer2" unique_id=103192648 instance=ExtResource("2_puip6")]
unique_name_in_owner = true
layout_mode = 2
flip_h = true
[node name="MarginContainer" type="MarginContainer" parent="TextureRect" unique_id=616392028]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
theme_override_constants/margin_left = 116
[node name="HBoxContainer" type="HBoxContainer" parent="HBoxContainer2" unique_id=1364417494]
[node name="HBoxContainer" type="HBoxContainer" parent="TextureRect/MarginContainer" unique_id=1364417494]
layout_mode = 2
theme_override_constants/separation = 0
alignment = 1
[node name="ColorPicker1" parent="HBoxContainer2/HBoxContainer" unique_id=59169767 instance=ExtResource("3_i2rs1")]
[node name="ColorPicker1" parent="TextureRect/MarginContainer/HBoxContainer" unique_id=59169767 instance=ExtResource("3_i2rs1")]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 4
color = Color(0.7432059, 0.5684909, 1, 1)
[node name="ColorPicker2" parent="HBoxContainer2/HBoxContainer" unique_id=584054476 instance=ExtResource("3_i2rs1")]
[node name="ColorPicker2" parent="TextureRect/MarginContainer/HBoxContainer" unique_id=584054476 instance=ExtResource("3_i2rs1")]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 4
color = Color(0.47657922, 0.8792635, 0.8823829, 1)
[node name="ColorPicker3" parent="HBoxContainer2/HBoxContainer" unique_id=889429149 instance=ExtResource("3_i2rs1")]
[node name="ColorPicker3" parent="TextureRect/MarginContainer/HBoxContainer" unique_id=889429149 instance=ExtResource("3_i2rs1")]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 4
color = Color(0.54004896, 0.5516501, 0.45533067, 1)
[node name="ColorPicker4" parent="HBoxContainer2/HBoxContainer" unique_id=466686411 instance=ExtResource("3_i2rs1")]
[node name="ColorPicker4" parent="TextureRect/MarginContainer/HBoxContainer" unique_id=466686411 instance=ExtResource("3_i2rs1")]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 4
color = Color(0.40863404, 1, 0.47657922, 1)
[node name="ColorPicker5" parent="HBoxContainer2/HBoxContainer" unique_id=675841518 instance=ExtResource("3_i2rs1")]
[node name="ColorPicker5" parent="TextureRect/MarginContainer/HBoxContainer" unique_id=675841518 instance=ExtResource("3_i2rs1")]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 4
color = Color(1, 0, 0, 1)
[node name="ColorPicker6" parent="HBoxContainer2/HBoxContainer" unique_id=1698412911 instance=ExtResource("3_i2rs1")]
[node name="ColorPicker6" parent="TextureRect/MarginContainer/HBoxContainer" unique_id=1698412911 instance=ExtResource("3_i2rs1")]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 4
[node name="ArrowButtonRight" parent="HBoxContainer2" unique_id=68298624 instance=ExtResource("2_puip6")]
[node name="TextureRect2" type="TextureRect" parent="." unique_id=1180760395]
layout_mode = 2
mouse_filter = 2
texture = ExtResource("6_y1o8e")
[node name="MarginContainer" type="MarginContainer" parent="TextureRect2" unique_id=651764288]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
theme_override_constants/margin_left = 116
[node name="HBoxContainer2" type="HBoxContainer" parent="TextureRect2/MarginContainer" unique_id=2122540668]
layout_mode = 2
theme_override_constants/separation = 0
alignment = 1
[node name="ColorPicker7" parent="TextureRect2/MarginContainer/HBoxContainer2" unique_id=1664685328 instance=ExtResource("3_i2rs1")]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 4
color = Color(0.7432059, 0.5684909, 1, 1)
[node name="ColorPicker8" parent="TextureRect2/MarginContainer/HBoxContainer2" unique_id=396324135 instance=ExtResource("3_i2rs1")]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 4
color = Color(0.47657922, 0.8792635, 0.8823829, 1)
[node name="ColorPicker9" parent="TextureRect2/MarginContainer/HBoxContainer2" unique_id=1233950004 instance=ExtResource("3_i2rs1")]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 4
color = Color(0.54004896, 0.5516501, 0.45533067, 1)
[node name="ColorPicker10" parent="TextureRect2/MarginContainer/HBoxContainer2" unique_id=2132596175 instance=ExtResource("3_i2rs1")]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 4
color = Color(0.40863404, 1, 0.47657922, 1)
[node name="ColorPicker11" parent="TextureRect2/MarginContainer/HBoxContainer2" unique_id=831493295 instance=ExtResource("3_i2rs1")]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 4
color = Color(1, 0, 0, 1)
[node name="ColorPicker12" parent="TextureRect2/MarginContainer/HBoxContainer2" unique_id=170636843 instance=ExtResource("3_i2rs1")]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 4
[node name="ContainerTween" parent="." unique_id=160227524 node_paths=PackedStringArray("targets") instance=ExtResource("10_i2rs1")]
unique_name_in_owner = true
targets = [NodePath("../HBoxContainer2/ArrowButtonLeft"), NodePath("../HBoxContainer2/HBoxContainer/ColorPicker1"), NodePath("../HBoxContainer2/HBoxContainer/ColorPicker2"), NodePath("../HBoxContainer2/HBoxContainer/ColorPicker3"), NodePath("../HBoxContainer2/HBoxContainer/ColorPicker4"), NodePath("../HBoxContainer2/HBoxContainer/ColorPicker5"), NodePath("../HBoxContainer2/HBoxContainer/ColorPicker6"), NodePath("../HBoxContainer2/ArrowButtonRight")]
targets = [NodePath(""), NodePath("../TextureRect/MarginContainer/HBoxContainer/ColorPicker1"), NodePath("../TextureRect/MarginContainer/HBoxContainer/ColorPicker2"), NodePath("../TextureRect/MarginContainer/HBoxContainer/ColorPicker3"), NodePath("../TextureRect/MarginContainer/HBoxContainer/ColorPicker4"), NodePath("../TextureRect/MarginContainer/HBoxContainer/ColorPicker5"), NodePath("../TextureRect/MarginContainer/HBoxContainer/ColorPicker6"), NodePath("")]