tooltips and ui
This commit was merged in pull request #42.
This commit is contained in:
BIN
core/main_scene_ui/assets/audio_player_background.png
Normal file
BIN
core/main_scene_ui/assets/audio_player_background.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.1 KiB |
40
core/main_scene_ui/assets/audio_player_background.png.import
Normal file
40
core/main_scene_ui/assets/audio_player_background.png.import
Normal file
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dlp62v48tori0"
|
||||
path="res://.godot/imported/audio_player_background.png-1675fa2e75631748d14a166a21ea483f.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://core/main_scene_ui/assets/audio_player_background.png"
|
||||
dest_files=["res://.godot/imported/audio_player_background.png-1675fa2e75631748d14a166a21ea483f.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/main_scene_ui/assets/audio_player_empty.png
Normal file
BIN
core/main_scene_ui/assets/audio_player_empty.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 44 KiB |
40
core/main_scene_ui/assets/audio_player_empty.png.import
Normal file
40
core/main_scene_ui/assets/audio_player_empty.png.import
Normal file
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bgrmy57xhg2gj"
|
||||
path="res://.godot/imported/audio_player_empty.png-1b3b0e9bc78b192baac137114b08b7cd.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://core/main_scene_ui/assets/audio_player_empty.png"
|
||||
dest_files=["res://.godot/imported/audio_player_empty.png-1b3b0e9bc78b192baac137114b08b7cd.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/main_scene_ui/assets/audio_player_wheel.png
Normal file
BIN
core/main_scene_ui/assets/audio_player_wheel.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
40
core/main_scene_ui/assets/audio_player_wheel.png.import
Normal file
40
core/main_scene_ui/assets/audio_player_wheel.png.import
Normal file
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://s8pp2i6bjkps"
|
||||
path="res://.godot/imported/audio_player_wheel.png-5a27c557d9f373382107e3f2bececfee.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://core/main_scene_ui/assets/audio_player_wheel.png"
|
||||
dest_files=["res://.godot/imported/audio_player_wheel.png-5a27c557d9f373382107e3f2bececfee.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
|
||||
@@ -1,53 +1,91 @@
|
||||
extends Control
|
||||
|
||||
@export var radio: Radio
|
||||
@export var scroll_speed: float = 60.0
|
||||
@export var wheel_speed: float = -2.0
|
||||
|
||||
@onready var track_label: Label = $%TrackLabel
|
||||
@onready var prev_track_icon_button: Button = $%PrevTrackIconButton
|
||||
@onready var play_pause_icon_button: Button = $%PlayPauseIconButton
|
||||
@onready var next_track_icon_button: Button = $%NextTrackIconButton
|
||||
@onready var increase_volume_icon_button: Button = $%IncreaseVolumeIconButton
|
||||
@onready var decrease_volume_icon_button: Button = $%DecreaseVolumeIconButton
|
||||
@onready var prev_track_button: Button = $%PrevTrackButton
|
||||
@onready var play_track_button: Button = $%PlayTrackButton
|
||||
@onready var pause_track_button: Button = $%PauseTrackButton
|
||||
@onready var next_track_button: Button = $%NextTrackButton
|
||||
@onready var increase_volume_button: Button = $%IncreaseVolumeButton
|
||||
@onready var decrease_volume_button: Button = $%DecreaseVolumeButton
|
||||
@onready var left_wheel: TextureRect = $%LeftWheel
|
||||
@onready var right_wheel: TextureRect = $%RightWheel
|
||||
@onready var background: TextureRect = $%Background
|
||||
|
||||
func _ready() -> void:
|
||||
prev_track_icon_button.pressed.connect(_on_prev_track_icon_button_pressed)
|
||||
play_pause_icon_button.pressed.connect(_on_play_pause_icon_button_pressed)
|
||||
next_track_icon_button.pressed.connect(_on_next_track_icon_button_pressed)
|
||||
increase_volume_icon_button.pressed.connect(_on_increase_volume_icon_button_pressed)
|
||||
decrease_volume_icon_button.pressed.connect(_on_decrease_volume_icon_button_pressed)
|
||||
prev_track_button.pressed.connect(_on_prev_track_button_pressed)
|
||||
play_track_button.pressed.connect(_on_play_track_button_pressed)
|
||||
pause_track_button.pressed.connect(_on_pause_track_button_pressed)
|
||||
next_track_button.pressed.connect(_on_next_track_button_pressed)
|
||||
increase_volume_button.pressed.connect(_on_increase_volume_button_pressed)
|
||||
decrease_volume_button.pressed.connect(_on_decrease_volume_button_pressed)
|
||||
if radio:
|
||||
radio.track_changed.connect(_on_radio_track_changed)
|
||||
if radio.stream and radio.stream.resource_path:
|
||||
track_label.text = radio.stream.resource_path.get_file().get_basename().capitalize()
|
||||
play_pause_icon_button.image = play_pause_icon_button.images[1]
|
||||
else:
|
||||
track_label.text = "Unknown Track"
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if radio and radio.playing and not radio.stream_paused:
|
||||
if left_wheel:
|
||||
left_wheel.rotation += wheel_speed * delta
|
||||
if right_wheel:
|
||||
right_wheel.rotation += wheel_speed * delta
|
||||
|
||||
if track_label and track_label.get_parent_control():
|
||||
track_label.position.x += scroll_speed * delta
|
||||
|
||||
var text_width = track_label.get_minimum_size().x
|
||||
|
||||
var text_left_edge = track_label.position.x + (track_label.size.x - text_width) / 2.0
|
||||
|
||||
if text_left_edge > track_label.get_parent_control().size.x:
|
||||
track_label.position.x = -(track_label.size.x + text_width) / 2.0
|
||||
|
||||
func _on_radio_track_changed(track_name: String) -> void:
|
||||
track_label.text = track_name
|
||||
play_pause_icon_button.image = play_pause_icon_button.images[1]
|
||||
|
||||
func _on_prev_track_icon_button_pressed() -> void:
|
||||
func _play_button_tween() -> void:
|
||||
TweenFX.stop_all(background)
|
||||
background.scale = Vector2.ONE
|
||||
background.rotation = 0.0
|
||||
background.modulate.a = 1.0
|
||||
TweenFX.press_rotate(background)
|
||||
|
||||
func _on_prev_track_button_pressed() -> void:
|
||||
if radio:
|
||||
radio.prev_track()
|
||||
_play_button_tween()
|
||||
|
||||
func _on_play_pause_icon_button_pressed() -> void:
|
||||
func _on_play_track_button_pressed() -> void:
|
||||
if radio:
|
||||
if !radio.stream:
|
||||
radio.next_track()
|
||||
else:
|
||||
radio.unpause()
|
||||
_play_button_tween()
|
||||
|
||||
func _on_pause_track_button_pressed() -> void:
|
||||
if radio:
|
||||
if radio.stream:
|
||||
radio.toggle_pause()
|
||||
else:
|
||||
radio.next_track()
|
||||
var play_pause_index = 0 if radio.stream_paused else 1
|
||||
play_pause_icon_button.image = play_pause_icon_button.images[play_pause_index]
|
||||
radio.pause()
|
||||
_play_button_tween()
|
||||
|
||||
func _on_next_track_icon_button_pressed() -> void:
|
||||
func _on_next_track_button_pressed() -> void:
|
||||
if radio:
|
||||
radio.next_track()
|
||||
_play_button_tween()
|
||||
|
||||
func _on_increase_volume_icon_button_pressed() -> void:
|
||||
func _on_increase_volume_button_pressed() -> void:
|
||||
var current_vol = AudioManager.get_audio_bus_volume("Music", 1.0)
|
||||
AudioManager.set_audio_bus_volume("Music", current_vol + 0.1)
|
||||
_play_button_tween()
|
||||
|
||||
func _on_decrease_volume_icon_button_pressed() -> void:
|
||||
func _on_decrease_volume_button_pressed() -> void:
|
||||
var current_vol = AudioManager.get_audio_bus_volume("Music", 1.0)
|
||||
AudioManager.set_audio_bus_volume("Music", current_vol - 0.1)
|
||||
_play_button_tween()
|
||||
|
||||
@@ -1,132 +1,174 @@
|
||||
[gd_scene format=3 uid="uid://dg4f3v0ukpmay"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://c4kekqicrv4m8" path="res://core/main_scene_ui/audio_player.gd" id="1_i2mrl"]
|
||||
[ext_resource type="PackedScene" uid="uid://2tqofxxxnvhv" path="res://core/main_scene_ui/icon_button.tscn" id="1_ucnyb"]
|
||||
[ext_resource type="Theme" uid="uid://bg8megpn77mod" path="res://core/font/main_theme.tres" id="2_0koyu"]
|
||||
[ext_resource type="Texture2D" uid="uid://cqx45c744325t" path="res://core/main_scene_ui/assets/button_audio_previous.png" id="3_netjv"]
|
||||
[ext_resource type="Texture2D" uid="uid://bdnevc7ewu5qe" path="res://core/main_scene_ui/assets/button_audio_play.png" id="4_urwwp"]
|
||||
[ext_resource type="Texture2D" uid="uid://d2ft1kea45hec" path="res://core/main_scene_ui/assets/button_audio_next.png" id="5_0koyu"]
|
||||
[ext_resource type="Texture2D" uid="uid://vx7wa6afj4ri" path="res://core/main_scene_ui/assets/button_audio_pause.png" id="5_urwwp"]
|
||||
[ext_resource type="Texture2D" uid="uid://b0mir57askv7j" path="res://core/main_scene_ui/assets/button_audio_on.png" id="6_xv7rp"]
|
||||
[ext_resource type="Texture2D" uid="uid://dbxhxvvg4s8ru" path="res://core/main_scene_ui/assets/button_audio_off.png" id="7_7ib2x"]
|
||||
[ext_resource type="Texture2D" uid="uid://dlp62v48tori0" path="res://core/main_scene_ui/assets/audio_player_background.png" id="3_e87kc"]
|
||||
[ext_resource type="Texture2D" uid="uid://s8pp2i6bjkps" path="res://core/main_scene_ui/assets/audio_player_wheel.png" id="4_n5r1o"]
|
||||
[ext_resource type="Texture2D" uid="uid://bgrmy57xhg2gj" path="res://core/main_scene_ui/assets/audio_player_empty.png" id="10_xv7rp"]
|
||||
|
||||
[node name="AudioPlayer" type="Control" unique_id=425192018]
|
||||
custom_minimum_size = Vector2(241, 179)
|
||||
layout_mode = 3
|
||||
anchor_right = 0.15208334
|
||||
anchor_bottom = 0.10925926
|
||||
anchor_right = 0.12552084
|
||||
anchor_bottom = 0.16574074
|
||||
offset_right = -241.00002
|
||||
offset_bottom = -179.0
|
||||
pivot_offset_ratio = Vector2(0.5, 0.5)
|
||||
mouse_filter = 2
|
||||
script = ExtResource("1_i2mrl")
|
||||
scroll_speed = 30.0
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="." unique_id=1300382168]
|
||||
[node name="TextureRect" type="TextureRect" parent="." unique_id=1764222864]
|
||||
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)
|
||||
mouse_filter = 2
|
||||
texture = ExtResource("10_xv7rp")
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer" unique_id=1923985665]
|
||||
layout_mode = 2
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="TrackLabel" type="Label" parent="HBoxContainer/VBoxContainer" unique_id=1430240022]
|
||||
[node name="Background" type="TextureRect" parent="." unique_id=1772744681]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
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)
|
||||
mouse_filter = 2
|
||||
texture = ExtResource("3_e87kc")
|
||||
stretch_mode = 2
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="LeftWheel" type="TextureRect" parent="Background" unique_id=1719200441]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -51.5
|
||||
offset_top = -47.5
|
||||
offset_right = -20.5
|
||||
offset_bottom = -16.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
pivot_offset_ratio = Vector2(0.5, 0.5)
|
||||
texture = ExtResource("4_n5r1o")
|
||||
stretch_mode = 2
|
||||
|
||||
[node name="RightWheel" type="TextureRect" parent="Background" unique_id=960520776]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = 18.5
|
||||
offset_top = -47.5
|
||||
offset_right = 49.5
|
||||
offset_bottom = -16.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
pivot_offset_ratio = Vector2(0.5, 0.5)
|
||||
texture = ExtResource("4_n5r1o")
|
||||
stretch_mode = 2
|
||||
|
||||
[node name="DisplayContainer" type="Control" parent="." unique_id=1280352652]
|
||||
clip_contents = true
|
||||
layout_mode = 1
|
||||
anchors_preset = 7
|
||||
anchor_left = 0.5
|
||||
anchor_top = 1.0
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -85.5
|
||||
offset_top = -84.0
|
||||
offset_right = 83.5
|
||||
offset_bottom = -52.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
|
||||
[node name="TrackLabel" type="Label" parent="DisplayContainer" unique_id=441671750]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme = ExtResource("2_0koyu")
|
||||
theme_override_font_sizes/font_size = 24
|
||||
theme_override_font_sizes/font_size = 12
|
||||
text = "Uknown Track"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="IconButtonsRow" type="HBoxContainer" parent="HBoxContainer/VBoxContainer" unique_id=1734127019]
|
||||
[node name="MarginContainer" type="MarginContainer" parent="." unique_id=1829043318]
|
||||
layout_mode = 1
|
||||
anchors_preset = 12
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_top = -40.0
|
||||
offset_bottom = -8.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
mouse_filter = 2
|
||||
theme_override_constants/margin_left = 24
|
||||
theme_override_constants/margin_right = 24
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer" unique_id=1300382168]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
mouse_filter = 2
|
||||
theme_override_constants/separation = 0
|
||||
alignment = 1
|
||||
|
||||
[node name="PrevTrackIconButton" parent="HBoxContainer/VBoxContainer/IconButtonsRow" unique_id=1750448019 instance=ExtResource("1_ucnyb")]
|
||||
[node name="PrevTrackButton" type="Button" parent="MarginContainer/HBoxContainer" unique_id=1132927190]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(32, 0)
|
||||
layout_mode = 2
|
||||
image = ExtResource("3_netjv")
|
||||
size_flags_horizontal = 4
|
||||
flat = true
|
||||
|
||||
[node name="Texture" parent="HBoxContainer/VBoxContainer/IconButtonsRow/PrevTrackIconButton" index="0" unique_id=1071359322]
|
||||
anchors_preset = -1
|
||||
offset_left = 116.66667
|
||||
offset_top = 131.3789
|
||||
offset_right = -116.666664
|
||||
offset_bottom = -131.3789
|
||||
texture = ExtResource("3_netjv")
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="PlayPauseIconButton" parent="HBoxContainer/VBoxContainer/IconButtonsRow" unique_id=1533336956 instance=ExtResource("1_ucnyb")]
|
||||
[node name="PlayTrackButton" type="Button" parent="MarginContainer/HBoxContainer" unique_id=445406105]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(32, 0)
|
||||
layout_mode = 2
|
||||
image = ExtResource("4_urwwp")
|
||||
images = Array[Texture]([ExtResource("4_urwwp"), ExtResource("5_urwwp")])
|
||||
size_flags_horizontal = 5
|
||||
flat = true
|
||||
|
||||
[node name="Texture" parent="HBoxContainer/VBoxContainer/IconButtonsRow/PlayPauseIconButton" index="0" unique_id=1071359322]
|
||||
anchors_preset = -1
|
||||
offset_left = 116.66667
|
||||
offset_top = 131.3789
|
||||
offset_right = -116.666664
|
||||
offset_bottom = -131.3789
|
||||
texture = ExtResource("4_urwwp")
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="NextTrackIconButton" parent="HBoxContainer/VBoxContainer/IconButtonsRow" unique_id=2108379455 instance=ExtResource("1_ucnyb")]
|
||||
[node name="NextTrackButton" type="Button" parent="MarginContainer/HBoxContainer" unique_id=1836743157]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(32, 0)
|
||||
layout_mode = 2
|
||||
image = ExtResource("5_0koyu")
|
||||
size_flags_horizontal = 5
|
||||
flat = true
|
||||
|
||||
[node name="Texture" parent="HBoxContainer/VBoxContainer/IconButtonsRow/NextTrackIconButton" index="0" unique_id=1071359322]
|
||||
anchors_preset = -1
|
||||
offset_left = 116.66667
|
||||
offset_top = 131.3789
|
||||
offset_right = -116.666664
|
||||
offset_bottom = -131.3789
|
||||
texture = ExtResource("5_0koyu")
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="VBoxContainer2" type="VBoxContainer" parent="HBoxContainer" unique_id=1843266535]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 4
|
||||
|
||||
[node name="IncreaseVolumeIconButton" parent="HBoxContainer/VBoxContainer2" unique_id=1788399963 instance=ExtResource("1_ucnyb")]
|
||||
[node name="PauseTrackButton" type="Button" parent="MarginContainer/HBoxContainer" unique_id=1151045878]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(40, 40)
|
||||
custom_minimum_size = Vector2(32, 0)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 3
|
||||
image = ExtResource("6_xv7rp")
|
||||
size_flags_horizontal = 5
|
||||
flat = true
|
||||
|
||||
[node name="Texture" parent="HBoxContainer/VBoxContainer2/IncreaseVolumeIconButton" index="0" unique_id=1071359322]
|
||||
custom_minimum_size = Vector2(40, 40)
|
||||
offset_left = 106.66667
|
||||
offset_top = 107.01433
|
||||
offset_right = -106.666664
|
||||
offset_bottom = -107.014336
|
||||
texture = ExtResource("6_xv7rp")
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="DecreaseVolumeIconButton" parent="HBoxContainer/VBoxContainer2" unique_id=399629327 instance=ExtResource("1_ucnyb")]
|
||||
[node name="IncreaseVolumeButton" type="Button" parent="MarginContainer/HBoxContainer" unique_id=809451843]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(40, 40)
|
||||
custom_minimum_size = Vector2(32, 0)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 3
|
||||
image = ExtResource("7_7ib2x")
|
||||
size_flags_horizontal = 5
|
||||
flat = true
|
||||
|
||||
[node name="Texture" parent="HBoxContainer/VBoxContainer2/DecreaseVolumeIconButton" index="0" unique_id=1071359322]
|
||||
custom_minimum_size = Vector2(40, 40)
|
||||
offset_left = 106.66667
|
||||
offset_top = 107.01433
|
||||
offset_right = -106.666664
|
||||
offset_bottom = -107.014336
|
||||
texture = ExtResource("7_7ib2x")
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[editable path="HBoxContainer/VBoxContainer/IconButtonsRow/PrevTrackIconButton"]
|
||||
[editable path="HBoxContainer/VBoxContainer/IconButtonsRow/PlayPauseIconButton"]
|
||||
[editable path="HBoxContainer/VBoxContainer/IconButtonsRow/NextTrackIconButton"]
|
||||
[editable path="HBoxContainer/VBoxContainer2/IncreaseVolumeIconButton"]
|
||||
[editable path="HBoxContainer/VBoxContainer2/DecreaseVolumeIconButton"]
|
||||
[node name="DecreaseVolumeButton" type="Button" parent="MarginContainer/HBoxContainer" unique_id=1399480885]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(32, 0)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 5
|
||||
flat = true
|
||||
|
||||
@@ -12,6 +12,9 @@ class_name IconButton
|
||||
@export var images: Array[Texture]
|
||||
@export var apply_texture_on_selection: bool = true
|
||||
|
||||
@export var enable_tooltip: bool = false
|
||||
@export var tooltip_scene: PackedScene
|
||||
@export var tooltip_image: Texture
|
||||
|
||||
func _ready():
|
||||
if image != null and has_node("%Texture"):
|
||||
@@ -36,3 +39,15 @@ func _on_pressed() -> void:
|
||||
rotation = 0.0
|
||||
modulate.a = 1.0
|
||||
TweenFX.press_rotate(self)
|
||||
|
||||
func _make_custom_tooltip(for_text: String) -> Object:
|
||||
if !enable_tooltip:
|
||||
return null
|
||||
|
||||
var tooltip = tooltip_scene.instantiate()
|
||||
|
||||
tooltip.text = for_text
|
||||
if tooltip_image != null:
|
||||
tooltip.image = tooltip_image
|
||||
|
||||
return tooltip
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
[ext_resource type="Script" uid="uid://bpbgecvan0a5k" path="res://core/main_scene_ui/icon_button.gd" id="1_r8gxt"]
|
||||
[ext_resource type="Texture2D" uid="uid://bkos5j6dwqcxw" path="res://core/main_scene_ui/assets/button_chrono_night.png" id="3_6q6an"]
|
||||
[ext_resource type="PackedScene" uid="uid://blh7egp5ge16m" path="res://core/tooltips/tooltip.tscn" id="3_60w2f"]
|
||||
[ext_resource type="Texture2D" uid="uid://cbk8ufxb7wdgx" path="res://core/tooltips/assets/tooltip_DX.png" id="4_60w2f"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_r8gxt"]
|
||||
|
||||
@@ -44,6 +46,8 @@ theme_override_styles/disabled_mirrored = SubResource("StyleBoxEmpty_4beq1")
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_cxhgx")
|
||||
script = ExtResource("1_r8gxt")
|
||||
image = ExtResource("3_6q6an")
|
||||
tooltip_scene = ExtResource("3_60w2f")
|
||||
tooltip_image = ExtResource("4_60w2f")
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="Texture" type="TextureRect" parent="." unique_id=1071359322]
|
||||
|
||||
@@ -10,18 +10,21 @@ extends Control
|
||||
@onready var collectible_icon_button: Button = $%CollectibleIconButton
|
||||
@onready var weather_row: HBoxContainer = $%WeatherRow
|
||||
@onready var time_of_day_row: HBoxContainer = $%TimeOfDayRow
|
||||
@onready var cameras_row: HBoxContainer = $%CamerasRow
|
||||
@onready var photo_mode_texture_panel: Panel = $%PhotoModeTexturePanel
|
||||
@onready var photo_mode_texture_mask: TextureRect = $%PhotoModeTextureMask
|
||||
@onready var photo_mode_black_screen: ColorRect = $%PhotoModeBlackScreen
|
||||
@onready var audio_player: Control = $%AudioPlayer
|
||||
@onready var time_label: Label = $%TimeLabel
|
||||
@onready var dist_label: Label = $%DistLabel
|
||||
@onready var tooltips: HBoxContainer = $%Tooltips
|
||||
|
||||
var _cycle = false
|
||||
var _rain = false
|
||||
var _snow = false
|
||||
var _storm = false
|
||||
var _wind = false
|
||||
var _ui_hidden = false
|
||||
var _photo_mode_mat_tween: Tween
|
||||
var _photo_mode_alpha_tween: Tween
|
||||
var _photo_mode_fold_tween: Tween
|
||||
@@ -53,6 +56,7 @@ func _process(_delta: float) -> void:
|
||||
dist_label.text = "Distance Traveled: %d km" % int(GameState.save_data.total_distance_km)
|
||||
|
||||
func _on_hide_ui_button_pressed() -> void:
|
||||
UIEvents.on_hide_ui_requested.emit()
|
||||
hide_ui()
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
|
||||
await get_tree().create_timer(0.3).timeout
|
||||
@@ -64,6 +68,20 @@ func _input(event: InputEvent) -> void:
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||
show_ui()
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("toggle_options"):
|
||||
if photo_mode_texture_panel.visible or _ui_hidden:
|
||||
return
|
||||
if game_menu_panel.visible:
|
||||
_on_resume_button_pressed()
|
||||
else:
|
||||
_open_game_menu_on_page(2)
|
||||
elif event.is_action_pressed("hide_ui"):
|
||||
if photo_mode_texture_panel.visible:
|
||||
return
|
||||
if not game_menu_panel.visible:
|
||||
_on_hide_ui_button_pressed()
|
||||
|
||||
func _on_photo_icon_button_pressed() -> void:
|
||||
GameState.on_enable_photo_mode_request.emit()
|
||||
|
||||
@@ -205,20 +223,41 @@ func _set_buttons_mouse_filter(ignore: bool) -> void:
|
||||
buttons.append_array(weather_row.options_icon_buttons)
|
||||
if time_of_day_row and "options_icon_buttons" in time_of_day_row:
|
||||
buttons.append_array(time_of_day_row.options_icon_buttons)
|
||||
if cameras_row and "options_icon_buttons" in cameras_row:
|
||||
buttons.append_array(cameras_row.options_icon_buttons)
|
||||
|
||||
for btn in buttons:
|
||||
if btn is Control:
|
||||
btn.mouse_filter = filter
|
||||
|
||||
func hide_ui() -> void:
|
||||
_ui_hidden = true
|
||||
_set_buttons_mouse_filter(true)
|
||||
var hud_elements = [hide_ui_button, weather_row, time_of_day_row, customize_train_button, collectible_icon_button, menu_icon_button, photo_icon_button, audio_player, choo_choo_button, time_label, dist_label]
|
||||
var hud_elements = [hide_ui_button, weather_row, time_of_day_row, cameras_row, customize_train_button, collectible_icon_button, menu_icon_button, photo_icon_button, audio_player, choo_choo_button, time_label, dist_label]
|
||||
for element in hud_elements:
|
||||
element.visible = false
|
||||
element.visible = true
|
||||
TweenFX.fade_out(element, 0.25)
|
||||
|
||||
func show_ui() -> void:
|
||||
_ui_hidden = false
|
||||
_set_buttons_mouse_filter(false)
|
||||
var hud_elements = [hide_ui_button, weather_row, time_of_day_row, customize_train_button, collectible_icon_button, menu_icon_button, photo_icon_button, audio_player, choo_choo_button, time_label, dist_label]
|
||||
var hud_elements = [hide_ui_button, weather_row, time_of_day_row, cameras_row, customize_train_button, collectible_icon_button, menu_icon_button, photo_icon_button, audio_player, choo_choo_button, time_label, dist_label, tooltips]
|
||||
for element in hud_elements:
|
||||
element.show()
|
||||
TweenFX.fade_in(element, 0.25)
|
||||
|
||||
func _on_cameras_row_on_option_changed(data: String) -> void:
|
||||
match data:
|
||||
"1":
|
||||
UIEvents.change_camera_request.emit(0)
|
||||
"2":
|
||||
UIEvents.change_camera_request.emit(1)
|
||||
"3":
|
||||
UIEvents.change_camera_request.emit(2)
|
||||
"4":
|
||||
UIEvents.change_camera_request.emit(3)
|
||||
"5":
|
||||
UIEvents.change_camera_request.emit(4)
|
||||
_:
|
||||
pass
|
||||
|
||||
@@ -27,10 +27,26 @@
|
||||
[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://qq84r14df2ix" path="res://core/main_scene_ui/assets/button_visibility_on.png" id="19_dyo0w"]
|
||||
[ext_resource type="Texture2D" uid="uid://dijxloxgmn3ws" path="res://core/tooltips/assets/tooltip_ESC.png" id="19_mlhrv"]
|
||||
[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"]
|
||||
[ext_resource type="Texture2D" uid="uid://c8io1gdqo45kw" path="res://core/tooltips/assets/tooltip_H.png" id="21_7mx2q"]
|
||||
[ext_resource type="Texture2D" uid="uid://clmbvd7ilhra2" path="res://core/main_scene_ui/assets/button_choochoo_on.png" id="22_x1iix"]
|
||||
[ext_resource type="Texture2D" uid="uid://oc0aqajt2yxr" path="res://core/tooltips/assets/tooltip_p.png" id="25_1n7cf"]
|
||||
[ext_resource type="PackedScene" uid="uid://dx66qveii1lml" path="res://core/tooltips/tooltips.tscn" id="25_kh0c7"]
|
||||
[ext_resource type="Texture2D" uid="uid://1hbcebf3mf1l" path="res://core/tooltips/assets/tooltip_Q.png" id="27_binfm"]
|
||||
[ext_resource type="Texture2D" uid="uid://dsytn6pedo8i" path="res://core/tooltips/assets/camera_none.png" id="28_mukbp"]
|
||||
[ext_resource type="Texture2D" uid="uid://cavfu38w67kv1" path="res://core/tooltips/assets/camera_1.png" id="29_ej62u"]
|
||||
[ext_resource type="FontFile" uid="uid://bclja5no1qteh" path="res://core/font/Kestila.ttf" id="29_jn6vt"]
|
||||
[ext_resource type="Texture2D" uid="uid://c4nsxmoh3itat" path="res://core/tooltips/assets/camera_2.png" id="30_b6lng"]
|
||||
[ext_resource type="Texture2D" uid="uid://d12w3tr36spe8" path="res://core/tooltips/assets/tooltip_1.png" id="30_jpo3t"]
|
||||
[ext_resource type="Texture2D" uid="uid://bbsohagx2646w" path="res://core/tooltips/assets/camera_3.png" id="31_xe82o"]
|
||||
[ext_resource type="Texture2D" uid="uid://bi2tblkgtqnf6" path="res://core/tooltips/assets/tooltip_2.png" id="32_4h51y"]
|
||||
[ext_resource type="Texture2D" uid="uid://dry1k7w03167e" path="res://core/tooltips/assets/camera_4.png" id="32_nqdet"]
|
||||
[ext_resource type="Texture2D" uid="uid://1fsufkfkyti" path="res://core/tooltips/assets/camera_5.png" id="33_l4tct"]
|
||||
[ext_resource type="Texture2D" uid="uid://d160748lbh8j5" path="res://core/tooltips/assets/tooltip_3.png" id="34_o8vr4"]
|
||||
[ext_resource type="Texture2D" uid="uid://b4hb1i0p6fg1b" path="res://core/tooltips/assets/tooltip_4.png" id="36_yts6a"]
|
||||
[ext_resource type="Texture2D" uid="uid://dtq561kbf31gw" path="res://core/tooltips/assets/tooltip_5.png" id="38_vv0oj"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_hole"]
|
||||
shader = ExtResource("10_shader")
|
||||
@@ -153,12 +169,18 @@ theme_override_constants/separation = 8
|
||||
[node name="MenuIconButton" parent="TopButtons" unique_id=707872474 instance=ExtResource("3_t1xop")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
tooltip_text = "option"
|
||||
image = ExtResource("10_6016m")
|
||||
enable_tooltip = true
|
||||
tooltip_image = ExtResource("19_mlhrv")
|
||||
|
||||
[node name="HideUIButton" parent="TopButtons" unique_id=1621140689 instance=ExtResource("3_t1xop")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
tooltip_text = "hide UI"
|
||||
image = ExtResource("19_dyo0w")
|
||||
enable_tooltip = true
|
||||
tooltip_image = ExtResource("21_7mx2q")
|
||||
|
||||
[node name="MiddleButtons" type="VBoxContainer" parent="." unique_id=542153805]
|
||||
layout_mode = 1
|
||||
@@ -168,9 +190,9 @@ anchor_top = 0.5
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -100.0
|
||||
offset_top = -124.0
|
||||
offset_top = -172.0
|
||||
offset_right = -20.0
|
||||
offset_bottom = 124.0
|
||||
offset_bottom = 172.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 2
|
||||
theme_override_constants/separation = 8
|
||||
@@ -188,12 +210,18 @@ image = ExtResource("19_yggu7")
|
||||
[node name="PhotoIconButton" parent="MiddleButtons" unique_id=1863476241 instance=ExtResource("3_t1xop")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
tooltip_text = "photo mode"
|
||||
image = ExtResource("15_th1nj")
|
||||
enable_tooltip = true
|
||||
tooltip_image = ExtResource("25_1n7cf")
|
||||
|
||||
[node name="ChooChooButton" parent="MiddleButtons" unique_id=774819903 instance=ExtResource("3_t1xop")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
tooltip_text = "horn"
|
||||
image = ExtResource("22_x1iix")
|
||||
enable_tooltip = true
|
||||
tooltip_image = ExtResource("27_binfm")
|
||||
|
||||
[node name="InfoLabels" type="VBoxContainer" parent="." unique_id=234435566]
|
||||
custom_minimum_size = Vector2(400, 0)
|
||||
@@ -203,6 +231,57 @@ offset_top = 20.0
|
||||
offset_right = 420.0
|
||||
offset_bottom = 220.0
|
||||
|
||||
[node name="CamerasRow" parent="InfoLabels" unique_id=1233961141 instance=ExtResource("2_4cc8f")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 1
|
||||
|
||||
[node name="IconButton" parent="InfoLabels/CamerasRow" index="0" unique_id=1750448019]
|
||||
image = ExtResource("28_mukbp")
|
||||
apply_texture_on_selection = false
|
||||
|
||||
[node name="IconButton2" parent="InfoLabels/CamerasRow" index="1" unique_id=638856991]
|
||||
data = "1"
|
||||
image = ExtResource("29_ej62u")
|
||||
enable_tooltip = true
|
||||
tooltip_image = ExtResource("30_jpo3t")
|
||||
|
||||
[node name="IconButton3" parent="InfoLabels/CamerasRow" index="2" unique_id=1662483962]
|
||||
data = "2"
|
||||
image = ExtResource("30_b6lng")
|
||||
enable_tooltip = true
|
||||
tooltip_image = ExtResource("32_4h51y")
|
||||
|
||||
[node name="IconButton4" parent="InfoLabels/CamerasRow" index="3" unique_id=1375190490]
|
||||
data = "3"
|
||||
image = ExtResource("31_xe82o")
|
||||
enable_tooltip = true
|
||||
tooltip_image = ExtResource("34_o8vr4")
|
||||
|
||||
[node name="IconButton5" parent="InfoLabels/CamerasRow" index="4" unique_id=315412403]
|
||||
data = "4"
|
||||
image = ExtResource("32_nqdet")
|
||||
enable_tooltip = true
|
||||
tooltip_image = ExtResource("36_yts6a")
|
||||
|
||||
[node name="ShowContainerTween" parent="InfoLabels/CamerasRow" index="5" unique_id=160227524 node_paths=PackedStringArray("targets")]
|
||||
targets = [NodePath("../IconButton2"), NodePath("../IconButton3"), NodePath("../IconButton4"), NodePath("../IconButton5"), NodePath("../IconButton6")]
|
||||
tween_types = Array[String](["impact_land", "fade_in"])
|
||||
|
||||
[node name="HideContainerTween" parent="InfoLabels/CamerasRow" index="6" unique_id=1169748375 node_paths=PackedStringArray("targets")]
|
||||
targets = [NodePath("../IconButton6"), NodePath("../IconButton5"), NodePath("../IconButton4"), NodePath("../IconButton3"), NodePath("../IconButton2")]
|
||||
tween_types = Array[String](["impact_land", "fade_out"])
|
||||
|
||||
[node name="IconButton6" parent="InfoLabels/CamerasRow" unique_id=1017773972 instance=ExtResource("3_t1xop")]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 3
|
||||
data = "5"
|
||||
image = ExtResource("33_l4tct")
|
||||
enable_tooltip = true
|
||||
tooltip_image = ExtResource("38_vv0oj")
|
||||
|
||||
[node name="TimeLabel" type="Label" parent="InfoLabels" unique_id=18932607]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
@@ -213,17 +292,29 @@ unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_fonts/font = ExtResource("29_jn6vt")
|
||||
|
||||
[node name="Tooltips" parent="." unique_id=1388346317 instance=ExtResource("25_kh0c7")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 1
|
||||
anchors_preset = 7
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
offset_left = -297.5
|
||||
offset_top = -68.0
|
||||
offset_right = 297.5
|
||||
offset_bottom = -20.0
|
||||
|
||||
[node name="AudioPlayer" parent="." unique_id=425192018 node_paths=PackedStringArray("radio") instance=ExtResource("7_lapqe")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 1
|
||||
anchors_preset = 3
|
||||
anchor_left = 1.0
|
||||
anchor_top = 0.99814814
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.99814814
|
||||
offset_left = -166.0
|
||||
offset_top = -74.0
|
||||
offset_right = -166.0
|
||||
offset_bottom = -74.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -261.0
|
||||
offset_top = -199.0
|
||||
offset_right = -20.0
|
||||
offset_bottom = -20.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 0
|
||||
radio = NodePath("../Radio")
|
||||
@@ -300,8 +391,10 @@ playlist = Array[AudioStream]([ExtResource("6_kd244")])
|
||||
|
||||
[connection signal="on_option_changed" from="Rows/TimeOfDayRow" to="." method="_on_time_of_day_row_on_option_changed"]
|
||||
[connection signal="on_option_changed" from="Rows/WeatherRow" to="." method="_on_weather_row_on_option_changed"]
|
||||
[connection signal="on_option_changed" from="InfoLabels/CamerasRow" to="." method="_on_cameras_row_on_option_changed"]
|
||||
|
||||
[editable path="Rows/TimeOfDayRow"]
|
||||
[editable path="Rows/WeatherRow"]
|
||||
[editable path="InfoLabels/CamerasRow"]
|
||||
[editable path="GameMenuPanel/GameMenu"]
|
||||
[editable path="GameMenuPanel/GameMenu/Pages/Page3"]
|
||||
|
||||
Reference in New Issue
Block a user