fix cat, update and improve ui (menu. train selector, photo)
This commit is contained in:
@@ -32,7 +32,8 @@ func _ready() -> void:
|
||||
toggle_enable_state_machine()
|
||||
|
||||
func toggle_enable_state_machine() -> void:
|
||||
state_machine.enable = _enable_state_machine
|
||||
if state_machine:
|
||||
state_machine.enable = _enable_state_machine
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
if !_enable_state_machine:
|
||||
|
||||
BIN
core/game_menu/assets/page_1/barretta_main.png
Normal file
BIN
core/game_menu/assets/page_1/barretta_main.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 37 KiB |
40
core/game_menu/assets/page_1/barretta_main.png.import
Normal file
40
core/game_menu/assets/page_1/barretta_main.png.import
Normal 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
|
||||
BIN
core/game_menu/assets/page_1/barretta_second.png
Normal file
BIN
core/game_menu/assets/page_1/barretta_second.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
40
core/game_menu/assets/page_1/barretta_second.png.import
Normal file
40
core/game_menu/assets/page_1/barretta_second.png.import
Normal 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
|
||||
@@ -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"]
|
||||
|
||||
@@ -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"]
|
||||
|
||||
@@ -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"]
|
||||
|
||||
@@ -1,52 +1,47 @@
|
||||
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)
|
||||
_set_selected_color(0, 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()
|
||||
|
||||
_set_selected_color(0, 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)
|
||||
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) -> 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)
|
||||
|
||||
@@ -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("")]
|
||||
|
||||
BIN
core/main_scene_ui/assets/button_customize.png
Normal file
BIN
core/main_scene_ui/assets/button_customize.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 774 KiB |
40
core/main_scene_ui/assets/button_customize.png.import
Normal file
40
core/main_scene_ui/assets/button_customize.png.import
Normal file
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c31yut8p24t8g"
|
||||
path="res://.godot/imported/button_customize.png-2b9ab16ca23c28488847c768be1934d0.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://core/main_scene_ui/assets/button_customize.png"
|
||||
dest_files=["res://.godot/imported/button_customize.png-2b9ab16ca23c28488847c768be1934d0.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
|
||||
@@ -4,6 +4,7 @@ extends Control
|
||||
@onready var game_menu: Control = $%GameMenu
|
||||
@onready var game_menu_panel: Control = $%GameMenuPanel
|
||||
@onready var menu_icon_button: Button = $%MenuIconButton
|
||||
@onready var customize_train_button: Button = $%CustomizeTrainButton
|
||||
@onready var photo_icon_button: Button = $%PhotoIconButton
|
||||
@onready var collectible_icon_button: Button = $%CollectibleIconButton
|
||||
@onready var resume_button: Button = $GameMenuPanel/GameMenu/Pages/Page3/OptionMenu/VBoxContainer/ResumeButton
|
||||
@@ -29,24 +30,18 @@ func _ready() -> void:
|
||||
GameState.on_photo_taken_started.connect(_on_photo_taken_started)
|
||||
GameState.on_photo_taken_finished.connect(_on_photo_taken_finished)
|
||||
GameState.on_photo_taken_prepare.connect(_on_photo_capture_prepare)
|
||||
menu_icon_button.pressed.connect(_on_menu_icon_button_pressed)
|
||||
customize_train_button.pressed.connect(_open_game_menu_on_page.bind(0))
|
||||
collectible_icon_button.pressed.connect(_open_game_menu_on_page.bind(1))
|
||||
menu_icon_button.pressed.connect(_open_game_menu_on_page.bind(2))
|
||||
photo_icon_button.pressed.connect(_on_photo_icon_button_pressed)
|
||||
collectible_icon_button.pressed.connect(_on_collectible_icon_button_pressed)
|
||||
resume_button.pressed.connect(_on_resume_button_pressed)
|
||||
|
||||
func _on_menu_icon_button_pressed() -> void:
|
||||
GameState.pause_game()
|
||||
game_menu_panel.show()
|
||||
game_menu.scale = Vector2(1, 1)
|
||||
game_menu.open()
|
||||
TweenFX.fold_in(game_menu)
|
||||
|
||||
func _on_photo_icon_button_pressed() -> void:
|
||||
GameState.on_enable_photo_mode_request.emit()
|
||||
|
||||
func _on_collectible_icon_button_pressed() -> void:
|
||||
func _open_game_menu_on_page(tab_index: int) -> void:
|
||||
GameState.pause_game()
|
||||
game_menu.on_tab_pressed(1, true)
|
||||
game_menu.on_tab_pressed(tab_index, true)
|
||||
game_menu_panel.show()
|
||||
game_menu.scale = Vector2(1, 1)
|
||||
TweenFX.fold_in(game_menu)
|
||||
@@ -170,21 +165,24 @@ func _on_photo_taken_finished() -> void:
|
||||
func hide_ui_for_photo_mode() -> void:
|
||||
TweenFX.fade_out(weather_row, 0.25)
|
||||
TweenFX.fade_out(time_of_day_row, 0.25)
|
||||
TweenFX.fade_out(customize_train_button, 0.25)
|
||||
TweenFX.fade_out(collectible_icon_button, 0.25)
|
||||
TweenFX.fade_out(menu_icon_button, 0.25)
|
||||
TweenFX.fade_out(photo_icon_button, 0.25)
|
||||
TweenFX.fade_out(collectible_icon_button, 0.25)
|
||||
TweenFX.fade_out(audio_player, 0.25)
|
||||
|
||||
func show_ui_for_photo_mode() -> void:
|
||||
weather_row.show()
|
||||
time_of_day_row.show()
|
||||
menu_icon_button.show()
|
||||
customize_train_button.show()
|
||||
photo_icon_button.show()
|
||||
collectible_icon_button.show()
|
||||
audio_player.show()
|
||||
TweenFX.fade_in(weather_row, 0.25)
|
||||
TweenFX.fade_in(time_of_day_row, 0.25)
|
||||
TweenFX.fade_in(customize_train_button, 0.25)
|
||||
TweenFX.fade_in(collectible_icon_button, 0.25)
|
||||
TweenFX.fade_in(menu_icon_button, 0.25)
|
||||
TweenFX.fade_in(photo_icon_button, 0.25)
|
||||
TweenFX.fade_in(collectible_icon_button, 0.25)
|
||||
TweenFX.fade_in(audio_player, 0.25)
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
[ext_resource type="Texture2D" uid="uid://cq65xyg4wsctm" path="res://core/main_scene_ui/assets/button_weather_nowind.png" id="12_fjfwt"]
|
||||
[ext_resource type="Texture2D" uid="uid://tex06svipyg4" path="res://core/main_scene_ui/assets/button_random.png" id="14_gcgq4"]
|
||||
[ext_resource type="Texture2D" uid="uid://1n3paucfsovj" path="res://core/main_scene_ui/assets/button_photomode.png" id="15_th1nj"]
|
||||
[ext_resource type="Texture2D" uid="uid://c31yut8p24t8g" path="res://core/main_scene_ui/assets/button_customize.png" id="19_vywaj"]
|
||||
[ext_resource type="Texture2D" uid="uid://b03si5ir3ypp7" path="res://core/main_scene_ui/assets/button_collection03.png" id="19_yggu7"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_hole"]
|
||||
@@ -157,16 +158,21 @@ offset_bottom = 20.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="PhotoIconButton" parent="CollectionOptions" unique_id=1863476241 instance=ExtResource("3_t1xop")]
|
||||
[node name="CustomizeTrainButton" parent="CollectionOptions" unique_id=1621140689 instance=ExtResource("3_t1xop")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
image = ExtResource("15_th1nj")
|
||||
image = ExtResource("19_vywaj")
|
||||
|
||||
[node name="CollectibleIconButton" parent="CollectionOptions" unique_id=520235552 instance=ExtResource("3_t1xop")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
image = ExtResource("19_yggu7")
|
||||
|
||||
[node name="PhotoIconButton" parent="CollectionOptions" unique_id=1863476241 instance=ExtResource("3_t1xop")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
image = ExtResource("15_th1nj")
|
||||
|
||||
[node name="AudioPlayer" parent="." unique_id=425192018 node_paths=PackedStringArray("radio") instance=ExtResource("7_lapqe")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 1
|
||||
@@ -222,18 +228,6 @@ texture = ExtResource("9_4cc8f")
|
||||
stretch_mode = 3
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="PhotoModeBlackScreen" type="ColorRect" parent="." unique_id=1928591477]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
pivot_offset_ratio = Vector2(0.5, 0.5)
|
||||
color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="PhotoTaken" parent="." unique_id=683693112 instance=ExtResource("8_t1xop")]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
@@ -246,6 +240,18 @@ offset_bottom = 0.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="PhotoModeBlackScreen" type="ColorRect" parent="." unique_id=1928591477]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
pivot_offset_ratio = Vector2(0.5, 0.5)
|
||||
color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Radio" parent="." unique_id=1234112225 instance=ExtResource("5_nevjt")]
|
||||
playlist = Array[AudioStream]([ExtResource("6_kd244")])
|
||||
|
||||
|
||||
@@ -5,12 +5,13 @@ extends Control
|
||||
|
||||
var initial_pos_saved := false
|
||||
var initial_pos: Vector2
|
||||
var appear_tween: Tween
|
||||
var move_tween: Tween
|
||||
var is_photo_mode_enable = false
|
||||
var current_execution: int = 0
|
||||
|
||||
func _ready() -> void:
|
||||
CollectionManager.on_photo_saved.connect(_set_photo_taken)
|
||||
CollectionManager.on_photo_preview_ready.connect(_set_photo_preview)
|
||||
GameState.on_enable_photo_mode_request.connect(_on_enable_photo_mode)
|
||||
GameState.on_disable_photo_mode_request.connect(_on_disable_photo_mode)
|
||||
GameState.on_photo_taken_finished.connect(_show_photo_taken)
|
||||
@@ -19,8 +20,7 @@ func _ready() -> void:
|
||||
func _hide_photo_taken() -> void:
|
||||
hide()
|
||||
|
||||
func _set_photo_taken(file_path) -> void:
|
||||
var image = Image.load_from_file(file_path)
|
||||
func _set_photo_preview(image: Image) -> void:
|
||||
if image:
|
||||
var texture = ImageTexture.create_from_image(image)
|
||||
photo_texture.texture = texture
|
||||
@@ -41,12 +41,17 @@ func _show_photo_taken() -> void:
|
||||
rotation_degrees = 0.0
|
||||
show()
|
||||
|
||||
var explode_tween_duration = 5.5
|
||||
var appear_duration = 0.8
|
||||
var float_duration = 1.5
|
||||
var move_tween_duration = 1.0
|
||||
var shrink_duration = 1
|
||||
var scale_amt = 3.0
|
||||
|
||||
var explode_tween = TweenFX.explode(self, explode_tween_duration, 3)
|
||||
appear_tween = create_tween()
|
||||
appear_tween.tween_property(self, "scale", Vector2.ONE * scale_amt, appear_duration).set_trans(Tween.TRANS_BACK).set_ease(Tween.EASE_OUT)
|
||||
appear_tween.parallel().tween_property(self, "rotation_degrees", randf_range(-10, 10), appear_duration * 0.8)
|
||||
|
||||
await get_tree().create_timer(explode_tween_duration / 2).timeout
|
||||
await get_tree().create_timer(appear_duration + float_duration).timeout
|
||||
|
||||
if my_execution != current_execution:
|
||||
return
|
||||
@@ -61,10 +66,14 @@ func _show_photo_taken() -> void:
|
||||
|
||||
move_tween = create_tween()
|
||||
var target_pos = collectible_button.global_position
|
||||
|
||||
move_tween.tween_property(self, "global_position:x", target_pos.x, move_tween_duration).set_trans(Tween.TRANS_SINE).set_ease(Tween.EASE_IN_OUT)
|
||||
move_tween.parallel().tween_property(self, "global_position:y", target_pos.y, move_tween_duration).set_trans(Tween.TRANS_BACK).set_ease(Tween.EASE_IN)
|
||||
|
||||
await explode_tween.finished
|
||||
move_tween.parallel().tween_property(self, "scale", Vector2.ONE * 0.1, shrink_duration).set_trans(Tween.TRANS_CUBIC).set_ease(Tween.EASE_IN_OUT)
|
||||
move_tween.parallel().tween_property(self, "modulate:a", 0.0, shrink_duration).set_trans(Tween.TRANS_LINEAR)
|
||||
|
||||
await move_tween.finished
|
||||
|
||||
if my_execution != current_execution:
|
||||
return
|
||||
@@ -90,6 +99,8 @@ func _on_disable_photo_mode() -> void:
|
||||
|
||||
func reset() -> void:
|
||||
TweenFX.stop_all(self)
|
||||
if appear_tween:
|
||||
appear_tween.kill()
|
||||
if move_tween:
|
||||
move_tween.kill()
|
||||
hide()
|
||||
|
||||
@@ -45,4 +45,4 @@ layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
mouse_filter = 2
|
||||
expand_mode = 1
|
||||
stretch_mode = 6
|
||||
stretch_mode = 5
|
||||
|
||||
@@ -2,6 +2,7 @@ extends Node
|
||||
|
||||
signal on_collectible_unlocked(collectible_id: StringName)
|
||||
signal on_photo_saved(filePath: String)
|
||||
signal on_photo_preview_ready(image: Image)
|
||||
|
||||
@export var collectibles_library: CollectibleLibrary
|
||||
|
||||
@@ -35,14 +36,18 @@ func save_photo_to_disk_async(image: Image) -> void:
|
||||
if not image:
|
||||
return
|
||||
|
||||
|
||||
if not DirAccess.dir_exists_absolute("user://photos"):
|
||||
DirAccess.make_dir_absolute("user://photos")
|
||||
|
||||
var timestamp = str(Time.get_unix_time_from_system())
|
||||
var file_path = "user://photos/photo_" + timestamp + ".png"
|
||||
image.save_png(file_path)
|
||||
|
||||
WorkerThreadPool.add_task(func():
|
||||
image.save_png(file_path)
|
||||
call_deferred("_on_photo_saved_callback", file_path)
|
||||
)
|
||||
|
||||
func _on_photo_saved_callback(file_path: String) -> void:
|
||||
saved_photos.append(file_path)
|
||||
sync_save_data()
|
||||
on_photo_saved.emit(file_path)
|
||||
|
||||
@@ -121,6 +121,7 @@ func take_photo_async() -> void:
|
||||
var targets = get_tree().get_nodes_in_group("collectible")
|
||||
var space_state = get_world_3d().direct_space_state
|
||||
|
||||
CollectionManager.on_photo_preview_ready.emit(captured_image)
|
||||
CollectionManager.save_photo_to_disk_async(captured_image)
|
||||
|
||||
for target in targets:
|
||||
@@ -138,6 +139,10 @@ func take_photo_async() -> void:
|
||||
CollectionManager.unlock_collectible(target.collectible_data.id)
|
||||
|
||||
GameState.save_game()
|
||||
|
||||
var shutter_stay_duration = 0.15
|
||||
await get_tree().create_timer(shutter_stay_duration).timeout
|
||||
|
||||
GameState.on_photo_taken_finished.emit()
|
||||
|
||||
func _on_photo_mode_black_screen_disappeared() -> void:
|
||||
|
||||
Reference in New Issue
Block a user