more work on the ui theme and changing the hud
This commit is contained in:
7
UI/Menus/CharacterSelect/character_podium.gd
Normal file
7
UI/Menus/CharacterSelect/character_podium.gd
Normal file
@@ -0,0 +1,7 @@
|
||||
class_name CharacterPodium extends Node3D
|
||||
|
||||
@export var text: String = ""
|
||||
|
||||
|
||||
func show_content() -> void:
|
||||
$Base/Content.visible = true
|
||||
1
UI/Menus/CharacterSelect/character_podium.gd.uid
Normal file
1
UI/Menus/CharacterSelect/character_podium.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bc0xyfr5nj1ul
|
||||
40
UI/Menus/CharacterSelect/character_preview.gd
Normal file
40
UI/Menus/CharacterSelect/character_preview.gd
Normal file
@@ -0,0 +1,40 @@
|
||||
class_name CharacterPreview extends PanelContainer
|
||||
|
||||
@export var tower_label_scene: PackedScene
|
||||
@export var tower_label_container: VBoxContainer
|
||||
@export var hero_name_label: Label
|
||||
|
||||
var added_tags: Array[TowerLabel] = []
|
||||
var regular_label: Label = null
|
||||
|
||||
|
||||
func set_preview(hero: HeroClass) -> void:
|
||||
hero_name_label.text = tr(hero.hero_name)
|
||||
if regular_label:
|
||||
regular_label.queue_free()
|
||||
regular_label = null
|
||||
for tag: TowerLabel in added_tags:
|
||||
tag.queue_free()
|
||||
added_tags = []
|
||||
var added_labels: Array[Card] = []
|
||||
for card: Card in hero.deck:
|
||||
if !added_labels.has(card):
|
||||
var new_label: TowerLabel = tower_label_scene.instantiate() as TowerLabel
|
||||
new_label.change_label(tr(card.display_name), str(hero.deck.count(card)))
|
||||
added_labels.append(card)
|
||||
tower_label_container.add_child(new_label)
|
||||
added_tags.append(new_label)
|
||||
|
||||
|
||||
func setup_with_basic_text(hero: HeroClass, text: String) -> void:
|
||||
hero_name_label.text = tr(hero.hero_name)
|
||||
if regular_label:
|
||||
regular_label.queue_free()
|
||||
regular_label = null
|
||||
for tag: TowerLabel in added_tags:
|
||||
tag.queue_free()
|
||||
added_tags = []
|
||||
var new_label: Label = Label.new()
|
||||
new_label.text = text
|
||||
tower_label_container.add_child(new_label)
|
||||
regular_label = new_label
|
||||
1
UI/Menus/CharacterSelect/character_preview.gd.uid
Normal file
1
UI/Menus/CharacterSelect/character_preview.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://b1ucgfqilvr67
|
||||
79
UI/Menus/CharacterSelect/character_select.gd
Normal file
79
UI/Menus/CharacterSelect/character_select.gd
Normal file
@@ -0,0 +1,79 @@
|
||||
class_name CharacterSelect extends Node3D
|
||||
|
||||
signal hero_selected(hero_class: int)
|
||||
signal hero_confirmed()
|
||||
|
||||
@export var hero_preview_panel: CharacterPreview
|
||||
|
||||
var podiums: Array[CharacterPodium]
|
||||
|
||||
var character_selected: int = 0
|
||||
var can_hit_button: bool = true
|
||||
|
||||
func _ready() -> void:
|
||||
hero_preview_panel.set_preview(Data.characters[0])
|
||||
var heroes: int = Data.characters.size()
|
||||
var x: int = 0
|
||||
for hero: HeroClass in Data.characters:
|
||||
var pivot: Node3D = Node3D.new()
|
||||
$Podiums.add_child(pivot)
|
||||
var podium: CharacterPodium = hero.podium.instantiate() as CharacterPodium
|
||||
podium.position = Vector3(0.0, -0.5, 5.0)
|
||||
podiums.append(podium)
|
||||
pivot.add_child(podium)
|
||||
pivot.rotate_y((TAU / heroes) * x)
|
||||
x += 1
|
||||
podiums[0].show_content()
|
||||
if Data.save_data.mage_unlocked:
|
||||
podiums[1].show_content()
|
||||
|
||||
|
||||
func reset_button() -> void:
|
||||
can_hit_button = true
|
||||
|
||||
|
||||
func setup_ui() -> void:
|
||||
#TODO: This should all tie into a proper achievements system
|
||||
if character_selected == 0 or (character_selected == 1 and Data.save_data.mage_unlocked):
|
||||
$Controls/ConfirmButton.disabled = false
|
||||
hero_preview_panel.set_preview(Data.characters[character_selected])
|
||||
hero_selected.emit(character_selected)
|
||||
elif character_selected == 1 and !Data.save_data.mage_unlocked and Data.save_data.mage_card_seen_in_shop:
|
||||
hero_preview_panel.setup_with_basic_text(Data.characters[character_selected], "Buy " + str(Data.save_data.mage_cards_bought) + "/10 scrolls in the shop to unlock")
|
||||
else:
|
||||
$Controls/ConfirmButton.disabled = true
|
||||
hero_preview_panel.setup_with_basic_text(Data.characters[character_selected], podiums[character_selected].text)
|
||||
|
||||
|
||||
func retreat_selector() -> void:
|
||||
if !can_hit_button:
|
||||
return
|
||||
can_hit_button = false
|
||||
var tween: Tween = create_tween()
|
||||
tween.set_ease(Tween.EASE_OUT)
|
||||
tween.set_trans(Tween.TRANS_CUBIC)
|
||||
tween.tween_property($Node3D, "rotation_degrees", Vector3(0.0, $Node3D.rotation_degrees.y - 90.0, 0.0), 1.0)
|
||||
tween.tween_callback(reset_button)
|
||||
character_selected -= 1
|
||||
if character_selected < 0:
|
||||
character_selected = Data.characters.size() - 1
|
||||
setup_ui()
|
||||
|
||||
|
||||
func advance_selector() -> void:
|
||||
if !can_hit_button:
|
||||
return
|
||||
can_hit_button = false
|
||||
var tween: Tween = create_tween()
|
||||
tween.set_ease(Tween.EASE_OUT)
|
||||
tween.set_trans(Tween.TRANS_CUBIC)
|
||||
tween.tween_property($Node3D, "rotation_degrees", Vector3(0.0, $Node3D.rotation_degrees.y + 90.0, 0.0), 1.0)
|
||||
tween.tween_callback(reset_button)
|
||||
character_selected += 1
|
||||
if character_selected >= Data.characters.size():
|
||||
character_selected = 0
|
||||
setup_ui()
|
||||
|
||||
|
||||
func _on_confirm_button_pressed() -> void:
|
||||
hero_confirmed.emit()
|
||||
1
UI/Menus/CharacterSelect/character_select.gd.uid
Normal file
1
UI/Menus/CharacterSelect/character_select.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://plrd0ckxrabh
|
||||
96
UI/Menus/CharacterSelect/character_select.tscn
Normal file
96
UI/Menus/CharacterSelect/character_select.tscn
Normal file
@@ -0,0 +1,96 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://bc6m3cluulpis"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://plrd0ckxrabh" path="res://UI/Menus/CharacterSelect/character_select.gd" id="1_lqqhx"]
|
||||
[ext_resource type="Script" uid="uid://b1ucgfqilvr67" path="res://UI/Menus/CharacterSelect/character_preview.gd" id="9_8d0rx"]
|
||||
[ext_resource type="PackedScene" uid="uid://clabkhnbn75rf" path="res://UI/tower_label.tscn" id="10_jdigy"]
|
||||
|
||||
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_tlgw2"]
|
||||
sky_horizon_color = Color(0.662243, 0.671743, 0.686743, 1)
|
||||
ground_horizon_color = Color(0.662243, 0.671743, 0.686743, 1)
|
||||
energy_multiplier = 0.0
|
||||
|
||||
[sub_resource type="Sky" id="Sky_atdxu"]
|
||||
sky_material = SubResource("ProceduralSkyMaterial_tlgw2")
|
||||
|
||||
[sub_resource type="Environment" id="Environment_pq6wd"]
|
||||
background_mode = 2
|
||||
sky = SubResource("Sky_atdxu")
|
||||
tonemap_mode = 2
|
||||
glow_enabled = true
|
||||
|
||||
[node name="CharacterSelect" type="Node3D" node_paths=PackedStringArray("hero_preview_panel")]
|
||||
script = ExtResource("1_lqqhx")
|
||||
hero_preview_panel = NodePath("PanelContainer")
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource("Environment_pq6wd")
|
||||
|
||||
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
||||
transform = Transform3D(-0.866023, -0.433016, 0.250001, 0, 0.499998, 0.866027, -0.500003, 0.749999, -0.43301, 0, 0, 0)
|
||||
light_energy = 0.0
|
||||
shadow_enabled = true
|
||||
|
||||
[node name="Node3D" type="Node3D" parent="."]
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="Node3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 0.976893, 0.21373, 0, -0.21373, 0.976893, 0, 2.25535, 10.9009)
|
||||
cull_mask = 1047553
|
||||
fov = 39.4
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="." node_paths=PackedStringArray("tower_label_container", "hero_name_label")]
|
||||
anchors_preset = -1
|
||||
anchor_left = 0.05
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.05
|
||||
anchor_bottom = 0.5
|
||||
grow_vertical = 2
|
||||
script = ExtResource("9_8d0rx")
|
||||
tower_label_scene = ExtResource("10_jdigy")
|
||||
tower_label_container = NodePath("HBoxContainer2/HBoxContainer")
|
||||
hero_name_label = NodePath("HBoxContainer2/Label")
|
||||
|
||||
[node name="HBoxContainer2" type="VBoxContainer" parent="PanelContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="PanelContainer/HBoxContainer2"]
|
||||
auto_translate_mode = 2
|
||||
layout_mode = 2
|
||||
text = "character name"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="PanelContainer/HBoxContainer2"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HBoxContainer" type="VBoxContainer" parent="PanelContainer/HBoxContainer2"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Controls" type="VBoxContainer" parent="."]
|
||||
anchors_preset = -1
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.95
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.95
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Controls"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="PrevButton" type="Button" parent="Controls/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_PREVIOUS"
|
||||
|
||||
[node name="NextButton" type="Button" parent="Controls/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_NEXT"
|
||||
|
||||
[node name="ConfirmButton" type="Button" parent="Controls"]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_CONFIRM"
|
||||
|
||||
[node name="Podiums" type="Node3D" parent="."]
|
||||
|
||||
[connection signal="pressed" from="Controls/HBoxContainer/PrevButton" to="." method="retreat_selector"]
|
||||
[connection signal="pressed" from="Controls/HBoxContainer/NextButton" to="." method="advance_selector"]
|
||||
[connection signal="pressed" from="Controls/ConfirmButton" to="." method="_on_confirm_button_pressed"]
|
||||
20
UI/Menus/GameEndScreen/enemy_row.gd
Normal file
20
UI/Menus/GameEndScreen/enemy_row.gd
Normal file
@@ -0,0 +1,20 @@
|
||||
class_name EnemyBox
|
||||
extends HBoxContainer
|
||||
|
||||
|
||||
func set_wave(wave: int) -> void:
|
||||
$WaveLabel.text = tr("LABEL_WAVE").format({Wave_Number = str(wave)})
|
||||
|
||||
|
||||
func add_enemy_tag(enemy: Enemy, num: int) -> void:
|
||||
for x: int in num:
|
||||
var enemy_tex: TextureRect = TextureRect.new()
|
||||
enemy_tex.texture = enemy.sprite
|
||||
enemy_tex.custom_minimum_size = Vector2(80, 80)
|
||||
add_child(enemy_tex)
|
||||
#var name_label: Label = Label.new()
|
||||
#name_label.text = enemy.title
|
||||
#var num_label: Label = Label.new()
|
||||
#num_label.text = str(num)
|
||||
#add_child(name_label)
|
||||
#add_child(num_label)
|
||||
1
UI/Menus/GameEndScreen/enemy_row.gd.uid
Normal file
1
UI/Menus/GameEndScreen/enemy_row.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://b0h5oewxd48lv
|
||||
10
UI/Menus/GameEndScreen/enemy_row.tscn
Normal file
10
UI/Menus/GameEndScreen/enemy_row.tscn
Normal file
@@ -0,0 +1,10 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://b5hp43bm07b8a"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b0h5oewxd48lv" path="res://UI/Menus/GameEndScreen/enemy_row.gd" id="1_th4b3"]
|
||||
|
||||
[node name="EnemyRow" type="HBoxContainer"]
|
||||
script = ExtResource("1_th4b3")
|
||||
|
||||
[node name="WaveLabel" type="Label" parent="."]
|
||||
layout_mode = 2
|
||||
text = "LABEL_WAVE"
|
||||
51
UI/Menus/GameEndScreen/game_end_screen.gd
Normal file
51
UI/Menus/GameEndScreen/game_end_screen.gd
Normal file
@@ -0,0 +1,51 @@
|
||||
class_name GameEndScreen extends PanelContainer
|
||||
|
||||
@export var box: PackedScene
|
||||
|
||||
@export var outcome_label: Label
|
||||
@export var winrate_label: Label
|
||||
@export var total_games_label: Label
|
||||
@export var total_wins_label: Label
|
||||
@export var total_losses_label: Label
|
||||
@export var undefeated_enemies: VBoxContainer
|
||||
|
||||
var game_manager: GameManager
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
winrate_label.text = str(Data.save_data.winrate) + "%"
|
||||
total_games_label.text = str(Data.save_data.wins + Data.save_data.losses)
|
||||
total_wins_label.text = str(Data.save_data.wins)
|
||||
total_losses_label.text = str(Data.save_data.losses)
|
||||
if game_manager:
|
||||
set_wave()
|
||||
|
||||
|
||||
func set_wave() -> void:
|
||||
for wave_key: int in game_manager.stats.enemies_undefeated:
|
||||
var spawned_box: EnemyBox = box.instantiate() as EnemyBox
|
||||
undefeated_enemies.add_child(spawned_box)
|
||||
spawned_box.set_wave(wave_key)
|
||||
for enemy_key: Enemy in game_manager.stats.enemies_undefeated[wave_key]:
|
||||
spawned_box.add_enemy_tag(enemy_key, game_manager.stats.enemies_undefeated[wave_key][enemy_key])
|
||||
|
||||
|
||||
func set_outcome_message(message: String) -> void:
|
||||
outcome_label.text = message
|
||||
|
||||
|
||||
func _on_quit_button_pressed() -> void:
|
||||
game_manager.scene_switch_main_menu()
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_play_button_pressed() -> void:
|
||||
if game_manager.gamemode.daily == false and !game_manager.gamemode.seeded:
|
||||
game_manager.gamemode.rng_seed = randi()
|
||||
game_manager.setup()
|
||||
game_manager.start()
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_button_mouse_entered() -> void:
|
||||
$AudioStreamPlayer.play()
|
||||
1
UI/Menus/GameEndScreen/game_end_screen.gd.uid
Normal file
1
UI/Menus/GameEndScreen/game_end_screen.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bdknvktw033g3
|
||||
140
UI/Menus/GameEndScreen/game_end_screen.tscn
Normal file
140
UI/Menus/GameEndScreen/game_end_screen.tscn
Normal file
@@ -0,0 +1,140 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://ce0m8vbjbng6o"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bdknvktw033g3" path="res://UI/Menus/GameEndScreen/game_end_screen.gd" id="1_oa7nq"]
|
||||
[ext_resource type="PackedScene" uid="uid://b5hp43bm07b8a" path="res://UI/Menus/GameEndScreen/enemy_row.tscn" id="2_xm8em"]
|
||||
[ext_resource type="AudioStream" uid="uid://cp6ph4ra7u5rk" path="res://UI/drop_003.ogg" id="3_ro1yg"]
|
||||
|
||||
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_dram5"]
|
||||
random_pitch = 1.1
|
||||
streams_count = 1
|
||||
stream_0/stream = ExtResource("3_ro1yg")
|
||||
|
||||
[node name="GameEndScreen" type="PanelContainer" node_paths=PackedStringArray("outcome_label", "winrate_label", "total_games_label", "total_wins_label", "total_losses_label", "undefeated_enemies")]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 150.0
|
||||
offset_top = 100.0
|
||||
offset_right = -150.0
|
||||
offset_bottom = -100.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_oa7nq")
|
||||
box = ExtResource("2_xm8em")
|
||||
outcome_label = NodePath("VBoxContainer/Labels/OutcomeLabel")
|
||||
winrate_label = NodePath("VBoxContainer/Labels/VBoxContainer/HBoxContainer/WinRateLabel2")
|
||||
total_games_label = NodePath("VBoxContainer/Labels/VBoxContainer/HBoxContainer2/WinRateLabel3")
|
||||
total_wins_label = NodePath("VBoxContainer/Labels/VBoxContainer/HBoxContainer3/WinRateLabel4")
|
||||
total_losses_label = NodePath("VBoxContainer/Labels/VBoxContainer/HBoxContainer4/WinRateLabel5")
|
||||
undefeated_enemies = NodePath("VBoxContainer/UndefeatedEnemies")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Labels" type="VBoxContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
alignment = 1
|
||||
|
||||
[node name="OutcomeLabel" type="Label" parent="VBoxContainer/Labels"]
|
||||
layout_mode = 2
|
||||
text = "LABEL_WIN_MESSAGE"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/Labels"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/Labels/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="WinRateLabel" type="Label" parent="VBoxContainer/Labels/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "LABEL_WINRATE"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="WinRateLabel2" type="Label" parent="VBoxContainer/Labels/VBoxContainer/HBoxContainer"]
|
||||
auto_translate_mode = 2
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "0"
|
||||
horizontal_alignment = 2
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer/Labels/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TotalGamesLabel" type="Label" parent="VBoxContainer/Labels/VBoxContainer/HBoxContainer2"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "LABEL_GAMES"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="WinRateLabel3" type="Label" parent="VBoxContainer/Labels/VBoxContainer/HBoxContainer2"]
|
||||
auto_translate_mode = 2
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "0"
|
||||
horizontal_alignment = 2
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HBoxContainer3" type="HBoxContainer" parent="VBoxContainer/Labels/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TotalWinsLabel" type="Label" parent="VBoxContainer/Labels/VBoxContainer/HBoxContainer3"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "LABEL_WINS"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="WinRateLabel4" type="Label" parent="VBoxContainer/Labels/VBoxContainer/HBoxContainer3"]
|
||||
auto_translate_mode = 2
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "0"
|
||||
horizontal_alignment = 2
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HBoxContainer4" type="HBoxContainer" parent="VBoxContainer/Labels/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TotalLossesLabel" type="Label" parent="VBoxContainer/Labels/VBoxContainer/HBoxContainer4"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "LABEL_LOSSES"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="WinRateLabel5" type="Label" parent="VBoxContainer/Labels/VBoxContainer/HBoxContainer4"]
|
||||
auto_translate_mode = 2
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "0"
|
||||
horizontal_alignment = 2
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="UndefeatedEnemies" type="VBoxContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="Buttons" type="HBoxContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
alignment = 2
|
||||
|
||||
[node name="PlayButton" type="Button" parent="VBoxContainer/Buttons"]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_RESTART"
|
||||
|
||||
[node name="QuitButton" type="Button" parent="VBoxContainer/Buttons"]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_MAIN_MENU"
|
||||
|
||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||
stream = SubResource("AudioStreamRandomizer_dram5")
|
||||
bus = &"SFX"
|
||||
|
||||
[connection signal="mouse_entered" from="VBoxContainer/Buttons/PlayButton" to="." method="_on_button_mouse_entered"]
|
||||
[connection signal="pressed" from="VBoxContainer/Buttons/PlayButton" to="." method="_on_play_button_pressed"]
|
||||
[connection signal="mouse_entered" from="VBoxContainer/Buttons/QuitButton" to="." method="_on_button_mouse_entered"]
|
||||
[connection signal="pressed" from="VBoxContainer/Buttons/QuitButton" to="." method="_on_quit_button_pressed"]
|
||||
9
UI/Menus/MainMenu/achievements_menu.gd
Normal file
9
UI/Menus/MainMenu/achievements_menu.gd
Normal file
@@ -0,0 +1,9 @@
|
||||
extends PanelContainer
|
||||
|
||||
func _ready() -> void:
|
||||
if Data.save_data.wins > 0:
|
||||
$VBoxContainer/GridContainer/FirstWin.icon.region = Rect2(36, 0, 36, 36)
|
||||
if Data.save_data.mage_card_seen_in_shop:
|
||||
$VBoxContainer/GridContainer/SeenMageCard.icon.region = Rect2(36, 0, 36, 36)
|
||||
if Data.save_data.mage_unlocked:
|
||||
$VBoxContainer/GridContainer/UnlockedMage.icon.region = Rect2(36, 0, 36, 36)
|
||||
1
UI/Menus/MainMenu/achievements_menu.gd.uid
Normal file
1
UI/Menus/MainMenu/achievements_menu.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cjr0pbqisd51v
|
||||
206
UI/Menus/MainMenu/main_menu.gd
Normal file
206
UI/Menus/MainMenu/main_menu.gd
Normal file
@@ -0,0 +1,206 @@
|
||||
class_name MainMenu extends Control
|
||||
|
||||
signal singleplayer_game_requested
|
||||
signal multiplayer_game_requested
|
||||
|
||||
@export var bg_level: Level
|
||||
@export var game_select_menu: Control
|
||||
@export var main_controls: Control
|
||||
@export var seed_entry: LineEdit
|
||||
@export var profile_controls: Control
|
||||
@export var mods_controls: ModMenu
|
||||
|
||||
var game: GameManager
|
||||
var gamemode: GameMode = GameMode.new()
|
||||
|
||||
var confirmation_popup_scene: PackedScene = preload("res://Scenes/Menus/confirmation_popup.tscn")
|
||||
var text_input_popup_scene: PackedScene = preload("res://Scenes/Menus/text_input_popup.tscn")
|
||||
var multiplayer_lobby_scene_path: String = "res://Scenes/multiplayer_lobby.tscn"
|
||||
var options_menu_scene: PackedScene = preload("res://UI/Menus/OptionsMenu/options_menu.tscn")
|
||||
var temp_data: SaveData
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
load_stats(Data.save_data)
|
||||
#bg_level.a_star_graph_3d.make_grid()
|
||||
#bg_level.a_star_graph_3d.find_path()
|
||||
#bg_level.a_star_graph_3d.build_random_maze(70)
|
||||
#bg_level.a_star_graph_3d.place_random_towers(30)
|
||||
#bg_level.a_star_graph_3d.disable_all_tower_frames()
|
||||
#Game.level = bg_level
|
||||
#WaveManager.generate_wave(WaveManager.calculate_spawn_power(50, 4), bg_level.enemy_pool, bg_level.enemy_spawns)
|
||||
#for spawn: EnemySpawner in bg_level.enemy_spawns:
|
||||
# spawn.enemy_died_callback = enemy_died
|
||||
# spawn.enemy_reached_goal_callback = damage_goal
|
||||
# spawn.enemy_spawned.connect(increase_enemy_count)
|
||||
# spawn.spawn_wave()
|
||||
|
||||
|
||||
#these exist purely to make the enemies that spawn on the main menu happy
|
||||
func enemy_died(_some_arg: Enemy) -> void:
|
||||
pass
|
||||
func damage_goal(_some_arg1: Enemy, _some_arg2: int) -> void:
|
||||
pass
|
||||
func increase_enemy_count() -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_display_name_edit_pressed() -> void:
|
||||
$ProfileManager.visible = true
|
||||
$ProfileManager/VBoxContainer/DisplayName/LineEdit.placeholder_text = Data.player_profile.display_name
|
||||
temp_data = SaveData.load_from_disk(0)
|
||||
|
||||
|
||||
func change_profile_display_name(display_name: String) -> void:
|
||||
$ProfileEditor/VBoxContainer/HBoxContainer/DisplayName.text = display_name
|
||||
Data.player_profile.set_display_name(display_name)
|
||||
|
||||
|
||||
func _on_quit_button_pressed() -> void:
|
||||
var popup: ConfirmationPopup = confirmation_popup_scene.instantiate() as ConfirmationPopup
|
||||
popup.set_popup("PROMPT_QUIT", "BUTTON_CONFIRM", "BUTTON_CANCEL")
|
||||
popup.completed.connect(quit_game)
|
||||
add_child(popup)
|
||||
|
||||
|
||||
func quit_game(confirmation: bool) -> void:
|
||||
if confirmation:
|
||||
get_tree().quit()
|
||||
|
||||
|
||||
func _on_options_button_pressed() -> void:
|
||||
var menu: OptionsMenu = options_menu_scene.instantiate()
|
||||
menu.game_manager = game
|
||||
add_child(menu)
|
||||
|
||||
|
||||
func _on_button_mouse_entered() -> void:
|
||||
$AudioStreamPlayer.play()
|
||||
|
||||
|
||||
func start_game() -> void:
|
||||
game.gamemode = gamemode
|
||||
if !gamemode.multiplayer:
|
||||
singleplayer_game_requested.emit()
|
||||
else:
|
||||
multiplayer_game_requested.emit()
|
||||
|
||||
|
||||
func _on_play_button_pressed() -> void:
|
||||
gamemode.multiplayer = false
|
||||
open_game_menu()
|
||||
|
||||
|
||||
func _on_multiplayer_button_pressed() -> void:
|
||||
gamemode.multiplayer = true
|
||||
open_game_menu()
|
||||
|
||||
|
||||
func open_game_menu() -> void:
|
||||
main_controls.visible = false
|
||||
game_select_menu.visible = true
|
||||
|
||||
|
||||
func _on_back_button_pressed() -> void:
|
||||
main_controls.visible = true
|
||||
game_select_menu.visible = false
|
||||
|
||||
|
||||
func generate_seed() -> void:
|
||||
if seed_entry.text != "":
|
||||
if seed_entry.text.is_valid_int():
|
||||
gamemode.rng_seed = int(seed_entry.text)
|
||||
else:
|
||||
gamemode.rng_seed = hash(seed_entry.text)
|
||||
gamemode.seeded = true
|
||||
else:
|
||||
gamemode.rng_seed = randi()
|
||||
|
||||
|
||||
func _on_standard_button_pressed() -> void:
|
||||
generate_seed()
|
||||
gamemode.endless = false
|
||||
gamemode.daily = false
|
||||
start_game()
|
||||
|
||||
|
||||
func _on_daily_button_pressed() -> void:
|
||||
gamemode.rng_seed = hash(Time.get_date_string_from_system(true))
|
||||
gamemode.endless = false
|
||||
gamemode.daily = true
|
||||
start_game()
|
||||
|
||||
|
||||
func _on_endless_button_pressed() -> void:
|
||||
generate_seed()
|
||||
gamemode.endless = true
|
||||
gamemode.daily = false
|
||||
start_game()
|
||||
|
||||
|
||||
func _on_changelog_button_pressed() -> void:
|
||||
main_controls.visible = true
|
||||
profile_controls.visible = true
|
||||
$Changelog.queue_free()
|
||||
|
||||
|
||||
func load_stats(stats: SaveData) -> void:
|
||||
$ProfileManager/VBoxContainer/Stats/Games/Label2.text = str(Data.save_data.wins + Data.save_data.losses)
|
||||
$ProfileManager/VBoxContainer/Stats/Wins/Label2.text = str(Data.save_data.wins)
|
||||
$ProfileManager/VBoxContainer/Stats/Losses/Label2.text = str(Data.save_data.losses)
|
||||
$ProfileManager/VBoxContainer/Stats/Winrate/Label2.text = str(Data.save_data.winrate) + "%"
|
||||
$ProfileManager/VBoxContainer/Stats/EngineerCardsBought/Label2.text = str(stats.engineer_cards_bought)
|
||||
$ProfileManager/VBoxContainer/Stats/MageCardsBought/Label2.text = str(stats.mage_cards_bought)
|
||||
|
||||
|
||||
func _on_achievements_back_button_pressed() -> void:
|
||||
$AchievementsMenu.visible = false
|
||||
|
||||
|
||||
func _on_achievements_button_pressed() -> void:
|
||||
$AchievementsMenu.visible = true
|
||||
|
||||
|
||||
func _on_profile_manager_cancel_pressed() -> void:
|
||||
profile_controls.visible = false
|
||||
main_controls.visible = true
|
||||
|
||||
|
||||
func _on_profile_manager_confirm_pressed() -> void:
|
||||
profile_controls.visible = false
|
||||
main_controls.visible = true
|
||||
if $ProfileManager/VBoxContainer/DisplayName/LineEdit.text != "":
|
||||
change_profile_display_name($ProfileManager/VBoxContainer/DisplayName/LineEdit.text)
|
||||
$ProfileManager/VBoxContainer/DisplayName/LineEdit.text = ""
|
||||
Data.save_data = temp_data
|
||||
Data.save_data.save_to_disc()
|
||||
|
||||
|
||||
func _on_unlock_all_pressed() -> void:
|
||||
temp_data.unlock_all_content()
|
||||
|
||||
|
||||
func _on_lock_all_pressed() -> void:
|
||||
temp_data.lock_all_content()
|
||||
|
||||
|
||||
func _on_mods_button_pressed() -> void:
|
||||
profile_controls.visible = false
|
||||
main_controls.visible = false
|
||||
mods_controls.visible = true
|
||||
|
||||
|
||||
func _on_cancel_mods_pressed() -> void:
|
||||
main_controls.visible = true
|
||||
mods_controls.visible = false
|
||||
|
||||
|
||||
func _on_confirm_mods_pressed() -> void:
|
||||
mods_controls.load_mod_list()
|
||||
main_controls.visible = true
|
||||
mods_controls.visible = false
|
||||
|
||||
|
||||
func _on_stats_button_pressed() -> void:
|
||||
main_controls.visible = false
|
||||
profile_controls.visible = true
|
||||
1
UI/Menus/MainMenu/main_menu.gd.uid
Normal file
1
UI/Menus/MainMenu/main_menu.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://ci8vq73u23viy
|
||||
446
UI/Menus/MainMenu/main_menu.tscn
Normal file
446
UI/Menus/MainMenu/main_menu.tscn
Normal file
@@ -0,0 +1,446 @@
|
||||
[gd_scene load_steps=12 format=3 uid="uid://8yv7excojcg0"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://ci8vq73u23viy" path="res://UI/Menus/MainMenu/main_menu.gd" id="2_ivytu"]
|
||||
[ext_resource type="AudioStream" uid="uid://cp6ph4ra7u5rk" path="res://UI/drop_003.ogg" id="5_cwn2i"]
|
||||
[ext_resource type="Texture2D" uid="uid://cr1ucbuw3iotp" path="res://Assets/Textures/first_win_achievements.png" id="15_74epv"]
|
||||
[ext_resource type="Script" uid="uid://cjr0pbqisd51v" path="res://UI/Menus/MainMenu/achievements_menu.gd" id="15_sv1gy"]
|
||||
[ext_resource type="Texture2D" uid="uid://cpa1hl36xfplg" path="res://Assets/Textures/first_scroll_seen.png" id="16_sv1gy"]
|
||||
[ext_resource type="Texture2D" uid="uid://ctbi3gm1me1t5" path="res://Assets/Textures/unlock_mage_achievement.png" id="17_6t4jd"]
|
||||
[ext_resource type="Script" uid="uid://cxrm2naq75jo1" path="res://Scripts/mod_menu.gd" id="19_6t4jd"]
|
||||
|
||||
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_2jyua"]
|
||||
random_pitch = 1.1
|
||||
streams_count = 1
|
||||
stream_0/stream = ExtResource("5_cwn2i")
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_y5bw6"]
|
||||
atlas = ExtResource("15_74epv")
|
||||
region = Rect2(0, 0, 36, 36)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_q26na"]
|
||||
atlas = ExtResource("16_sv1gy")
|
||||
region = Rect2(0, 0, 36, 36)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_3aj5m"]
|
||||
atlas = ExtResource("17_6t4jd")
|
||||
region = Rect2(0, 0, 36, 36)
|
||||
|
||||
[node name="MainMenu" type="Control" node_paths=PackedStringArray("game_select_menu", "main_controls", "seed_entry", "profile_controls", "mods_controls")]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("2_ivytu")
|
||||
game_select_menu = NodePath("GameSelectMenu")
|
||||
main_controls = NodePath("MainControls")
|
||||
seed_entry = NodePath("GameSelectMenu/VBoxContainer/HBoxContainer2/LineEdit")
|
||||
profile_controls = NodePath("ProfileManager")
|
||||
mods_controls = NodePath("ModsMenu")
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
color = Color(0.5176471, 0.60784316, 0.89411765, 1)
|
||||
|
||||
[node name="TitleLabel" type="Label" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.5
|
||||
grow_horizontal = 2
|
||||
text = "TITLE_GAME_NAME"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="MainControls" type="VBoxContainer" parent="."]
|
||||
custom_minimum_size = Vector2(80, 0)
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.938
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.95
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
alignment = 2
|
||||
|
||||
[node name="PlayButton" type="Button" parent="MainControls"]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_PLAY"
|
||||
|
||||
[node name="ModsButton" type="Button" parent="MainControls"]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_MODS"
|
||||
|
||||
[node name="StatsButton" type="Button" parent="MainControls"]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_PLAYER_STATS"
|
||||
|
||||
[node name="OptionsButton" type="Button" parent="MainControls"]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_OPTIONS
|
||||
"
|
||||
|
||||
[node name="QuitButton" type="Button" parent="MainControls"]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_QUIT"
|
||||
|
||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||
stream = SubResource("AudioStreamRandomizer_2jyua")
|
||||
bus = &"SFX"
|
||||
|
||||
[node name="GameSelectMenu" type="PanelContainer" parent="."]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -20.0
|
||||
offset_top = -20.0
|
||||
offset_right = 20.0
|
||||
offset_bottom = 20.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="GameSelectMenu"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="GameSelectMenu/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="BackButton" type="Button" parent="GameSelectMenu/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_BACK"
|
||||
|
||||
[node name="Title" type="Label" parent="GameSelectMenu/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "LABEL_GAME_MODE_SELECT"
|
||||
|
||||
[node name="StandardButton" type="Button" parent="GameSelectMenu/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_STANDARD_GAME"
|
||||
|
||||
[node name="DailyButton" type="Button" parent="GameSelectMenu/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_DAILY_CHALLENGE"
|
||||
|
||||
[node name="EndlessButton" type="Button" parent="GameSelectMenu/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_ENDLESS_GAME"
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="GameSelectMenu/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="GameSelectMenu/VBoxContainer/HBoxContainer2"]
|
||||
layout_mode = 2
|
||||
text = "LABEL_SEED"
|
||||
|
||||
[node name="LineEdit" type="LineEdit" parent="GameSelectMenu/VBoxContainer/HBoxContainer2"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
placeholder_text = "LABEL_SEED_PLACEHOLDER"
|
||||
expand_to_text_length = true
|
||||
|
||||
[node name="ProfileManager" type="PanelContainer" parent="."]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -20.0
|
||||
offset_top = -20.0
|
||||
offset_right = 20.0
|
||||
offset_bottom = 20.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="ProfileManager"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TitleBar" type="Label" parent="ProfileManager/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "TITLE_STATS_MENU"
|
||||
|
||||
[node name="DisplayName" type="HBoxContainer" parent="ProfileManager/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="ProfileManager/VBoxContainer/DisplayName"]
|
||||
layout_mode = 2
|
||||
text = "LABEL_DISPLAY_NAME"
|
||||
|
||||
[node name="LineEdit" type="LineEdit" parent="ProfileManager/VBoxContainer/DisplayName"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
placeholder_text = "LABEL_DISPLAY_NAME_PLACEHOLDER"
|
||||
alignment = 1
|
||||
expand_to_text_length = true
|
||||
|
||||
[node name="Stats" type="VBoxContainer" parent="ProfileManager/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="ProfileManager/VBoxContainer/Stats"]
|
||||
layout_mode = 2
|
||||
text = "LABEL_STATS"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Games" type="HBoxContainer" parent="ProfileManager/VBoxContainer/Stats"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="ProfileManager/VBoxContainer/Stats/Games"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "LABEL_GAMES"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Label2" type="Label" parent="ProfileManager/VBoxContainer/Stats/Games"]
|
||||
auto_translate_mode = 2
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "0"
|
||||
horizontal_alignment = 2
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Wins" type="HBoxContainer" parent="ProfileManager/VBoxContainer/Stats"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="ProfileManager/VBoxContainer/Stats/Wins"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "LABEL_WINS"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Label2" type="Label" parent="ProfileManager/VBoxContainer/Stats/Wins"]
|
||||
auto_translate_mode = 2
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "0"
|
||||
horizontal_alignment = 2
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Losses" type="HBoxContainer" parent="ProfileManager/VBoxContainer/Stats"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="ProfileManager/VBoxContainer/Stats/Losses"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "LABEL_LOSSES"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Label2" type="Label" parent="ProfileManager/VBoxContainer/Stats/Losses"]
|
||||
auto_translate_mode = 2
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "0"
|
||||
horizontal_alignment = 2
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Winrate" type="HBoxContainer" parent="ProfileManager/VBoxContainer/Stats"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="ProfileManager/VBoxContainer/Stats/Winrate"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "LABEL_WINRATE"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Label2" type="Label" parent="ProfileManager/VBoxContainer/Stats/Winrate"]
|
||||
auto_translate_mode = 2
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "0"
|
||||
horizontal_alignment = 2
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="EngineerCardsBought" type="HBoxContainer" parent="ProfileManager/VBoxContainer/Stats"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="ProfileManager/VBoxContainer/Stats/EngineerCardsBought"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "LABEL_ENGINEER_CARDS_BOUGHT"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Label2" type="Label" parent="ProfileManager/VBoxContainer/Stats/EngineerCardsBought"]
|
||||
auto_translate_mode = 2
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "0"
|
||||
horizontal_alignment = 2
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="MageCardsBought" type="HBoxContainer" parent="ProfileManager/VBoxContainer/Stats"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="ProfileManager/VBoxContainer/Stats/MageCardsBought"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "LABEL_MAGE_CARDS_BOUGHT"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Label2" type="Label" parent="ProfileManager/VBoxContainer/Stats/MageCardsBought"]
|
||||
auto_translate_mode = 2
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "0"
|
||||
horizontal_alignment = 2
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="UnlockAll" type="Button" parent="ProfileManager/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_UNLOCK_CONTENT"
|
||||
|
||||
[node name="LockAll" type="Button" parent="ProfileManager/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_LOCK_CONTENT"
|
||||
|
||||
[node name="AchievementsButton" type="Button" parent="ProfileManager/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_ACHIEVEMENTS"
|
||||
|
||||
[node name="Controls" type="HBoxContainer" parent="ProfileManager/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Cancel" type="Button" parent="ProfileManager/VBoxContainer/Controls"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "BUTTON_CANCEL"
|
||||
|
||||
[node name="Confirm" type="Button" parent="ProfileManager/VBoxContainer/Controls"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "BUTTON_CONFIRM"
|
||||
|
||||
[node name="AchievementsMenu" type="PanelContainer" parent="."]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -20.0
|
||||
offset_top = -20.0
|
||||
offset_right = 20.0
|
||||
offset_bottom = 20.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("15_sv1gy")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="AchievementsMenu"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="AchievementsMenu/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="AchievementsMenu/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "TITLE_ACHIEVEMENTS"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Button" type="Button" parent="AchievementsMenu/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_BACK"
|
||||
|
||||
[node name="GridContainer" type="GridContainer" parent="AchievementsMenu/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
columns = 9
|
||||
|
||||
[node name="FirstWin" type="Button" parent="AchievementsMenu/VBoxContainer/GridContainer"]
|
||||
custom_minimum_size = Vector2(140, 140)
|
||||
layout_mode = 2
|
||||
tooltip_text = "ACHIEVEMENT_TOOLTIP_WIN_GAME"
|
||||
icon = SubResource("AtlasTexture_y5bw6")
|
||||
icon_alignment = 1
|
||||
expand_icon = true
|
||||
|
||||
[node name="SeenMageCard" type="Button" parent="AchievementsMenu/VBoxContainer/GridContainer"]
|
||||
custom_minimum_size = Vector2(140, 140)
|
||||
layout_mode = 2
|
||||
tooltip_text = "ACHIEVEMENT_TOOLTIP_BUY_MAGE_CARD"
|
||||
icon = SubResource("AtlasTexture_q26na")
|
||||
icon_alignment = 1
|
||||
expand_icon = true
|
||||
|
||||
[node name="UnlockedMage" type="Button" parent="AchievementsMenu/VBoxContainer/GridContainer"]
|
||||
custom_minimum_size = Vector2(140, 140)
|
||||
layout_mode = 2
|
||||
tooltip_text = "ACHIEVEMENT_TOOLTIP_UNLOCK_MAGE"
|
||||
icon = SubResource("AtlasTexture_3aj5m")
|
||||
icon_alignment = 1
|
||||
expand_icon = true
|
||||
|
||||
[node name="ModsMenu" type="PanelContainer" parent="."]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_left = 0.05
|
||||
anchor_top = 0.05
|
||||
anchor_right = 0.95
|
||||
anchor_bottom = 0.95
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("19_6t4jd")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="ModsMenu"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="ModsMenu/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "TITLE_MODS"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="ModsMenu/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="ModsMenu/VBoxContainer/ScrollContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="ModsMenu/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
alignment = 2
|
||||
|
||||
[node name="CancelMods" type="Button" parent="ModsMenu/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_CANCEL"
|
||||
|
||||
[node name="ConfirmMods" type="Button" parent="ModsMenu/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_CONFIRM"
|
||||
|
||||
[connection signal="mouse_entered" from="MainControls/PlayButton" to="." method="_on_button_mouse_entered"]
|
||||
[connection signal="pressed" from="MainControls/PlayButton" to="." method="_on_play_button_pressed"]
|
||||
[connection signal="mouse_entered" from="MainControls/ModsButton" to="." method="_on_button_mouse_entered"]
|
||||
[connection signal="pressed" from="MainControls/ModsButton" to="." method="_on_mods_button_pressed"]
|
||||
[connection signal="pressed" from="MainControls/StatsButton" to="." method="_on_stats_button_pressed"]
|
||||
[connection signal="mouse_entered" from="MainControls/OptionsButton" to="." method="_on_button_mouse_entered"]
|
||||
[connection signal="pressed" from="MainControls/OptionsButton" to="." method="_on_options_button_pressed"]
|
||||
[connection signal="mouse_entered" from="MainControls/QuitButton" to="." method="_on_button_mouse_entered"]
|
||||
[connection signal="pressed" from="MainControls/QuitButton" to="." method="_on_quit_button_pressed"]
|
||||
[connection signal="pressed" from="GameSelectMenu/VBoxContainer/HBoxContainer/BackButton" to="." method="_on_back_button_pressed"]
|
||||
[connection signal="pressed" from="GameSelectMenu/VBoxContainer/StandardButton" to="." method="_on_standard_button_pressed"]
|
||||
[connection signal="pressed" from="GameSelectMenu/VBoxContainer/DailyButton" to="." method="_on_daily_button_pressed"]
|
||||
[connection signal="pressed" from="GameSelectMenu/VBoxContainer/EndlessButton" to="." method="_on_endless_button_pressed"]
|
||||
[connection signal="pressed" from="ProfileManager/VBoxContainer/UnlockAll" to="." method="_on_unlock_all_pressed"]
|
||||
[connection signal="pressed" from="ProfileManager/VBoxContainer/LockAll" to="." method="_on_lock_all_pressed"]
|
||||
[connection signal="pressed" from="ProfileManager/VBoxContainer/AchievementsButton" to="." method="_on_achievements_button_pressed"]
|
||||
[connection signal="pressed" from="ProfileManager/VBoxContainer/Controls/Cancel" to="." method="_on_profile_manager_cancel_pressed"]
|
||||
[connection signal="pressed" from="ProfileManager/VBoxContainer/Controls/Confirm" to="." method="_on_profile_manager_confirm_pressed"]
|
||||
[connection signal="pressed" from="AchievementsMenu/VBoxContainer/HBoxContainer/Button" to="." method="_on_achievements_back_button_pressed"]
|
||||
[connection signal="pressed" from="ModsMenu/VBoxContainer/HBoxContainer/CancelMods" to="." method="_on_cancel_mods_pressed"]
|
||||
[connection signal="pressed" from="ModsMenu/VBoxContainer/HBoxContainer/ConfirmMods" to="." method="_on_confirm_mods_pressed"]
|
||||
8
UI/Menus/MixingMenu/price_panel.gd
Normal file
8
UI/Menus/MixingMenu/price_panel.gd
Normal file
@@ -0,0 +1,8 @@
|
||||
class_name PricePanel
|
||||
extends PanelContainer
|
||||
|
||||
@export var label: Label
|
||||
|
||||
|
||||
func set_price(price: int) -> void:
|
||||
label.text = "$" + str(price)
|
||||
1
UI/Menus/MixingMenu/price_panel.gd.uid
Normal file
1
UI/Menus/MixingMenu/price_panel.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bs73eocafngiu
|
||||
24
UI/Menus/MixingMenu/price_panel.tscn
Normal file
24
UI/Menus/MixingMenu/price_panel.tscn
Normal file
@@ -0,0 +1,24 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://dekexkjl37dvh"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bs73eocafngiu" path="res://UI/Menus/MixingMenu/price_panel.gd" id="1_sn84y"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_517dt"]
|
||||
bg_color = Color(0.2702219, 0.27022195, 0.27022177, 0.09019608)
|
||||
corner_detail = 1
|
||||
|
||||
[node name="Control" type="PanelContainer" node_paths=PackedStringArray("label")]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_517dt")
|
||||
script = ExtResource("1_sn84y")
|
||||
label = NodePath("Label")
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
layout_mode = 2
|
||||
text = "$15"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
258
UI/Menus/MixingMenu/track_editor.gd
Normal file
258
UI/Menus/MixingMenu/track_editor.gd
Normal file
@@ -0,0 +1,258 @@
|
||||
class_name TrackEditor
|
||||
extends Control
|
||||
|
||||
signal cards_remixed(cards_consumed: Array[Card], cards_created: Array[Card], amount_spent: int)
|
||||
|
||||
@export var drag_feature: FeatureUI
|
||||
@export var sample_library: VBoxContainer
|
||||
@export var feature_scene: PackedScene
|
||||
@export var tower_parts: HBoxContainer
|
||||
@export var weapon_parts: HBoxContainer
|
||||
@export var drop_down: OptionButton
|
||||
@export var card_desc: CardDescriptionUI
|
||||
@export var price_panel_scene: PackedScene
|
||||
@export var price_label: Label
|
||||
@export var money_label: Label
|
||||
@export var confirm_button: Button
|
||||
@export var switch_button: Button
|
||||
|
||||
const FEATURE_SLOTS: int = 6
|
||||
const PRICE_STR: String = "LABEL_REMIX_PRICE"
|
||||
const MONEY_STR: String = "LABEL_REMIX_CURRENCY"
|
||||
const SIDE_A_STR: String = "BUTTON_VIEW_TOWER"
|
||||
const SIDE_B_STR: String = "BUTTON_VIEW_WEAPON"
|
||||
|
||||
var hero: Hero
|
||||
var dragging: bool = false
|
||||
var hovered_feature: Feature
|
||||
var hovered_drop_slot: int = -2
|
||||
var hovered_drop_track: int = 0
|
||||
var tower_feature_uis: Array[FeatureUI]
|
||||
var weapon_feature_uis: Array[FeatureUI]
|
||||
var features_list: Array[Feature]
|
||||
var tower_slots: Array[MarginContainer]
|
||||
var weapon_slots: Array[MarginContainer]
|
||||
var tower_prices: Array[PricePanel]
|
||||
var weapon_prices: Array[PricePanel]
|
||||
var cards: Array[Card]
|
||||
var card_selected: Card
|
||||
var temp_card: Card
|
||||
var cost: int = 0
|
||||
var check_button_pressed: bool = false
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
#populate_sample_library()
|
||||
#populate_feature_slots()
|
||||
card_desc.hide_features()
|
||||
tower_parts.mouse_entered.connect(set_hovered_drop_slot.bind(-1, 0))
|
||||
weapon_parts.mouse_entered.connect(set_hovered_drop_slot.bind(-1, 1))
|
||||
tower_parts.mouse_exited.connect(unset_hovered_drop_slot)
|
||||
weapon_parts.mouse_exited.connect(unset_hovered_drop_slot)
|
||||
price_label.text = tr(PRICE_STR) + str(cost)
|
||||
|
||||
|
||||
func set_money(money: int) -> void:
|
||||
money_label.text = tr(MONEY_STR) + str(money)
|
||||
|
||||
|
||||
func press_check_button(value: bool) -> void:
|
||||
check_button_pressed = value
|
||||
if check_button_pressed:
|
||||
switch_button.text = tr(SIDE_B_STR)
|
||||
else:
|
||||
switch_button.text = tr(SIDE_A_STR)
|
||||
card_desc.set_card(temp_card, check_button_pressed)
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
drag_feature.position = get_viewport().get_mouse_position()
|
||||
if Input.is_action_just_pressed("Pause"):
|
||||
_on_cancel_button_pressed()
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event is InputEventMouseButton:
|
||||
if event.pressed == true and event.button_index == 1:
|
||||
if hovered_feature != null:
|
||||
attach_feat_to_mouse(hovered_feature)
|
||||
if event.pressed == false and event.button_index == 1:
|
||||
detach_feat_from_mouse()
|
||||
|
||||
|
||||
func select_card(option: int) -> void:
|
||||
for feature_ui: FeatureUI in tower_feature_uis:
|
||||
feature_ui.queue_free()
|
||||
tower_feature_uis = []
|
||||
for feature_ui: FeatureUI in weapon_feature_uis:
|
||||
feature_ui.queue_free()
|
||||
weapon_feature_uis = []
|
||||
card_selected = cards[option]
|
||||
temp_card = card_selected.duplicate()
|
||||
temp_card.tower_stats = temp_card.tower_stats.get_duplicate()
|
||||
temp_card.weapon_stats = temp_card.weapon_stats.get_duplicate()
|
||||
card_desc.set_card(temp_card, check_button_pressed)
|
||||
for feature: Feature in temp_card.tower_stats.features:
|
||||
add_feature(feature, 0, false)
|
||||
for feature: Feature in temp_card.weapon_stats.features:
|
||||
add_feature(feature, 1, false)
|
||||
|
||||
|
||||
func add_option(card_options: Array[Card]) -> void:
|
||||
cards = card_options
|
||||
for card: Card in cards:
|
||||
drop_down.add_item(tr(card.display_name))
|
||||
drop_down.select(0)
|
||||
select_card(0)
|
||||
populate_sample_library()
|
||||
|
||||
|
||||
func populate_sample_library() -> void:
|
||||
for card: Card in cards:
|
||||
for feature: Feature in card.tower_stats.features:
|
||||
if !features_list.has(feature):
|
||||
features_list.append(feature)
|
||||
for feature: Feature in card.weapon_stats.features:
|
||||
if !features_list.has(feature):
|
||||
features_list.append(feature)
|
||||
var i: int = 0
|
||||
var hbox: HBoxContainer
|
||||
for feature: Feature in features_list:
|
||||
if i == 0:
|
||||
hbox = HBoxContainer.new()
|
||||
sample_library.add_child(hbox)
|
||||
var feat: FeatureUI = feature_scene.instantiate() as FeatureUI
|
||||
feat.set_feature(feature)
|
||||
feat.show_title()
|
||||
feat.mouse_filter = Control.MOUSE_FILTER_PASS
|
||||
feat.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
feat.mouse_entered.connect(set_hovered_feature.bind(feat.feature))
|
||||
hbox.add_child(feat)
|
||||
i += 1
|
||||
if i == 3:
|
||||
i = 0
|
||||
sample_library.mouse_exited.connect(unset_hovered_feature)
|
||||
|
||||
|
||||
func populate_feature_slots() -> void:
|
||||
for x: int in FEATURE_SLOTS:
|
||||
var vbox: MarginContainer = MarginContainer.new()
|
||||
vbox.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
vbox.mouse_filter = Control.MOUSE_FILTER_STOP
|
||||
vbox.mouse_entered.connect(set_hovered_drop_slot.bind(tower_slots.size(), 0))
|
||||
vbox.mouse_exited.connect(unset_hovered_drop_slot)
|
||||
tower_parts.add_child(vbox)
|
||||
tower_slots.append(vbox)
|
||||
if x != 0:
|
||||
var panel: PricePanel = price_panel_scene.instantiate() as PricePanel
|
||||
panel.set_price(Data.slot_prices[x - 1])
|
||||
vbox.add_child(panel)
|
||||
tower_prices.append(panel)
|
||||
for x: int in FEATURE_SLOTS:
|
||||
var vbox: MarginContainer = MarginContainer.new()
|
||||
vbox.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
vbox.mouse_filter = Control.MOUSE_FILTER_STOP
|
||||
vbox.mouse_entered.connect(set_hovered_drop_slot.bind(weapon_slots.size(), 1))
|
||||
vbox.mouse_exited.connect(unset_hovered_drop_slot)
|
||||
weapon_parts.add_child(vbox)
|
||||
weapon_slots.append(vbox)
|
||||
if x != 0:
|
||||
var panel: PricePanel = price_panel_scene.instantiate() as PricePanel
|
||||
panel.set_price(Data.slot_prices[x - 1])
|
||||
vbox.add_child(panel)
|
||||
weapon_prices.append(panel)
|
||||
|
||||
|
||||
func add_feature(feature: Feature, track: int, modify_resource: bool = true) -> void:
|
||||
if hovered_drop_slot == 0:
|
||||
return
|
||||
if track == 0:
|
||||
if hovered_drop_slot > 0 and hovered_drop_slot < tower_feature_uis.size():
|
||||
change_feature(tower_feature_uis[hovered_drop_slot], feature, 0)
|
||||
elif tower_feature_uis.size() < FEATURE_SLOTS:
|
||||
var feature_visual: FeatureUI = feature_scene.instantiate()
|
||||
feature_visual.set_feature(feature)
|
||||
tower_slots[tower_feature_uis.size()].add_child(feature_visual)
|
||||
tower_feature_uis.append(feature_visual)
|
||||
if modify_resource:
|
||||
temp_card.tower_stats.features.append(feature)
|
||||
tower_prices[tower_feature_uis.size() - 2].visible = false
|
||||
cost += Data.slot_prices[tower_feature_uis.size() - 2]
|
||||
price_label.text = tr(PRICE_STR) + str(cost)
|
||||
card_desc.set_card(temp_card, check_button_pressed)
|
||||
if cost > hero.currency:
|
||||
confirm_button.disabled = true
|
||||
elif track == 1:
|
||||
if hovered_drop_slot > 0 and hovered_drop_slot < weapon_feature_uis.size():
|
||||
change_feature(weapon_feature_uis[hovered_drop_slot], feature, 1)
|
||||
elif weapon_feature_uis.size() < FEATURE_SLOTS:
|
||||
var feature_visual: FeatureUI = feature_scene.instantiate()
|
||||
feature_visual.set_feature(feature)
|
||||
weapon_slots[weapon_feature_uis.size()].add_child(feature_visual)
|
||||
weapon_feature_uis.append(feature_visual)
|
||||
if modify_resource:
|
||||
temp_card.weapon_stats.features.append(feature)
|
||||
weapon_prices[weapon_feature_uis.size() - 2].visible = false
|
||||
cost += Data.slot_prices[weapon_feature_uis.size() - 2]
|
||||
price_label.text = tr(PRICE_STR) + str(cost)
|
||||
card_desc.set_card(temp_card, check_button_pressed)
|
||||
if cost > hero.currency:
|
||||
confirm_button.disabled = true
|
||||
|
||||
|
||||
func change_feature(existing_feature: FeatureUI, new_feature: Feature, track: int) -> void:
|
||||
existing_feature.set_feature(new_feature)
|
||||
if track == 0:
|
||||
var i: int = tower_feature_uis.find(existing_feature)
|
||||
temp_card.tower_stats.features[i] = new_feature
|
||||
elif track == 1:
|
||||
var i: int = weapon_feature_uis.find(existing_feature)
|
||||
temp_card.weapon_stats.features[i] = new_feature
|
||||
card_desc.set_card(temp_card, check_button_pressed)
|
||||
|
||||
|
||||
func attach_feat_to_mouse(feature: Feature) -> void:
|
||||
drag_feature.set_feature(feature)
|
||||
drag_feature.visible = true
|
||||
dragging = true
|
||||
|
||||
|
||||
func detach_feat_from_mouse() -> void:
|
||||
drag_feature.visible = false
|
||||
if hovered_drop_slot >= -1 and dragging == true:
|
||||
add_feature(drag_feature.feature, hovered_drop_track)
|
||||
dragging = false
|
||||
|
||||
|
||||
func set_hovered_feature(feature: Feature) -> void:
|
||||
hovered_feature = feature
|
||||
|
||||
|
||||
func unset_hovered_feature() -> void:
|
||||
hovered_feature = null
|
||||
|
||||
|
||||
func set_hovered_drop_slot(slot: int = -2, track: int = 0) -> void:
|
||||
hovered_drop_slot = slot
|
||||
hovered_drop_track = track
|
||||
|
||||
|
||||
func unset_hovered_drop_slot() -> void:
|
||||
hovered_drop_slot = -2
|
||||
hovered_drop_track = -1
|
||||
|
||||
|
||||
func _on_cancel_button_pressed() -> void:
|
||||
var cards_to_remove: Array[Card] = []
|
||||
var cards_to_add: Array[Card] = []
|
||||
cards_remixed.emit(cards_to_remove, cards_to_add, 0)
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_confirm_button_pressed() -> void:
|
||||
var cards_to_remove: Array[Card] = []
|
||||
var cards_to_add: Array[Card] = []
|
||||
cards_to_remove.append(card_selected)
|
||||
cards_to_add.append(temp_card)
|
||||
cards_remixed.emit(cards_to_remove, cards_to_add, cost)
|
||||
queue_free()
|
||||
1
UI/Menus/MixingMenu/track_editor.gd.uid
Normal file
1
UI/Menus/MixingMenu/track_editor.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://mrv5vrlxfc13
|
||||
241
UI/Menus/MixingMenu/track_editor.tscn
Normal file
241
UI/Menus/MixingMenu/track_editor.tscn
Normal file
@@ -0,0 +1,241 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://bajli4d3nqwll"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://c8xdsg6gtwvh3" path="res://UI/FeatureUI/feature_ui.tscn" id="1_y6tpq"]
|
||||
[ext_resource type="Script" uid="uid://mrv5vrlxfc13" path="res://UI/Menus/MixingMenu/track_editor.gd" id="1_yrnbk"]
|
||||
[ext_resource type="PackedScene" uid="uid://dekexkjl37dvh" path="res://UI/Menus/MixingMenu/price_panel.tscn" id="3_48m6c"]
|
||||
[ext_resource type="PackedScene" uid="uid://cmlpmr78tmo6p" path="res://UI/card_description_ui.tscn" id="3_q6wwl"]
|
||||
[ext_resource type="Texture2D" uid="uid://cll2vlvf1h454" path="res://UI/Themes/Scale1/track_one_patch.png" id="4_dya4i"]
|
||||
[ext_resource type="Texture2D" uid="uid://cvhkk22pxxuqj" path="res://UI/Themes/Scale1/track_two_patch.png" id="5_4gmyw"]
|
||||
|
||||
[node name="TrackEditor" type="Control" node_paths=PackedStringArray("drag_feature", "sample_library", "tower_parts", "weapon_parts", "drop_down", "card_desc", "price_label", "money_label", "confirm_button", "switch_button")]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_yrnbk")
|
||||
drag_feature = NodePath("FeatureUI")
|
||||
sample_library = NodePath("PanelContainer/VBoxContainer/InfoPanel/VBoxContainer2/SamplePanel/ScrollContainer/SampleLibrary")
|
||||
feature_scene = ExtResource("1_y6tpq")
|
||||
tower_parts = NodePath("PanelContainer/VBoxContainer/Tracks/HBoxContainer/TrackUIs/Tower/MarginContainer/TowerParts")
|
||||
weapon_parts = NodePath("PanelContainer/VBoxContainer/Tracks/HBoxContainer/TrackUIs/Weapon/MarginContainer/WeaponParts")
|
||||
drop_down = NodePath("PanelContainer/VBoxContainer/Tracks/SourceCartridge/CassetteSelector/OptionButton")
|
||||
card_desc = NodePath("PanelContainer/VBoxContainer/InfoPanel/VBoxContainer/DescriptionVBox")
|
||||
price_panel_scene = ExtResource("3_48m6c")
|
||||
price_label = NodePath("PanelContainer/VBoxContainer/Tracks/SourceCartridge/MarginContainer/VBoxContainer/PriceLabel")
|
||||
money_label = NodePath("PanelContainer/VBoxContainer/Tracks/SourceCartridge/MarginContainer/VBoxContainer/MoneyLabel")
|
||||
confirm_button = NodePath("PanelContainer/VBoxContainer/InfoPanel/VBoxContainer2/Controls/ConfirmButton")
|
||||
switch_button = NodePath("PanelContainer/VBoxContainer/InfoPanel/VBoxContainer/Button")
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_left = 0.02
|
||||
anchor_top = 0.02
|
||||
anchor_right = 0.98
|
||||
anchor_bottom = 0.98
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="PanelContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "TITLE_REMIX"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Tracks" type="VBoxContainer" parent="PanelContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="SourceCartridge" type="HBoxContainer" parent="PanelContainer/VBoxContainer/Tracks"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="MarginContainer2" type="MarginContainer" parent="PanelContainer/VBoxContainer/Tracks/SourceCartridge"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="CassetteSelector" type="VBoxContainer" parent="PanelContainer/VBoxContainer/Tracks/SourceCartridge"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="OptionButton" type="OptionButton" parent="PanelContainer/VBoxContainer/Tracks/SourceCartridge/CassetteSelector"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
alignment = 1
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer/VBoxContainer/Tracks/SourceCartridge"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/VBoxContainer/Tracks/SourceCartridge/MarginContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="MoneyLabel" type="Label" parent="PanelContainer/VBoxContainer/Tracks/SourceCartridge/MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 1
|
||||
text = "Coins: $0"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="PriceLabel" type="Label" parent="PanelContainer/VBoxContainer/Tracks/SourceCartridge/MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 1
|
||||
text = "Price: $0"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer/VBoxContainer/Tracks"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Labels" type="VBoxContainer" parent="PanelContainer/VBoxContainer/Tracks/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Tower" type="Label" parent="PanelContainer/VBoxContainer/Tracks/HBoxContainer/Labels"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 7
|
||||
text = "LABEL_TOWER_TRACK"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Weapon" type="Label" parent="PanelContainer/VBoxContainer/Tracks/HBoxContainer/Labels"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 7
|
||||
text = "LABEL_WEAPON_TRACK"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="TrackUIs" type="VBoxContainer" parent="PanelContainer/VBoxContainer/Tracks/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Tower" type="MarginContainer" parent="PanelContainer/VBoxContainer/Tracks/HBoxContainer/TrackUIs"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_stretch_ratio = 4.0
|
||||
|
||||
[node name="NinePatchRect" type="NinePatchRect" parent="PanelContainer/VBoxContainer/Tracks/HBoxContainer/TrackUIs/Tower"]
|
||||
layout_mode = 2
|
||||
texture = ExtResource("5_4gmyw")
|
||||
patch_margin_left = 1
|
||||
patch_margin_top = 1
|
||||
patch_margin_right = 1
|
||||
patch_margin_bottom = 1
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer/VBoxContainer/Tracks/HBoxContainer/TrackUIs/Tower"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 4
|
||||
theme_override_constants/margin_top = 4
|
||||
theme_override_constants/margin_right = 4
|
||||
theme_override_constants/margin_bottom = 4
|
||||
|
||||
[node name="TowerParts" type="HBoxContainer" parent="PanelContainer/VBoxContainer/Tracks/HBoxContainer/TrackUIs/Tower/MarginContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="Weapon" type="MarginContainer" parent="PanelContainer/VBoxContainer/Tracks/HBoxContainer/TrackUIs"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_stretch_ratio = 4.0
|
||||
|
||||
[node name="NinePatchRect" type="NinePatchRect" parent="PanelContainer/VBoxContainer/Tracks/HBoxContainer/TrackUIs/Weapon"]
|
||||
layout_mode = 2
|
||||
texture = ExtResource("4_dya4i")
|
||||
patch_margin_left = 1
|
||||
patch_margin_top = 1
|
||||
patch_margin_right = 1
|
||||
patch_margin_bottom = 1
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer/VBoxContainer/Tracks/HBoxContainer/TrackUIs/Weapon"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 4
|
||||
theme_override_constants/margin_top = 4
|
||||
theme_override_constants/margin_right = 4
|
||||
theme_override_constants/margin_bottom = 4
|
||||
|
||||
[node name="WeaponParts" type="HBoxContainer" parent="PanelContainer/VBoxContainer/Tracks/HBoxContainer/TrackUIs/Weapon/MarginContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="InfoPanel" type="HBoxContainer" parent="PanelContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
size_flags_stretch_ratio = 2.0
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/VBoxContainer/InfoPanel"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Button" type="Button" parent="PanelContainer/VBoxContainer/InfoPanel/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
theme_type_variation = &"SideCheckButton"
|
||||
toggle_mode = true
|
||||
text = "Side A"
|
||||
|
||||
[node name="DescriptionVBox" parent="PanelContainer/VBoxContainer/InfoPanel/VBoxContainer" instance=ExtResource("3_q6wwl")]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer/VBoxContainer/InfoPanel"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_stretch_ratio = 0.1
|
||||
|
||||
[node name="VBoxContainer2" type="VBoxContainer" parent="PanelContainer/VBoxContainer/InfoPanel"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="SamplePanel" type="VBoxContainer" parent="PanelContainer/VBoxContainer/InfoPanel/VBoxContainer2"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="Label" type="Label" parent="PanelContainer/VBoxContainer/InfoPanel/VBoxContainer2/SamplePanel"]
|
||||
layout_mode = 2
|
||||
text = "TITLE_SAMPLES"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="PanelContainer/VBoxContainer/InfoPanel/VBoxContainer2/SamplePanel"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="SampleLibrary" type="VBoxContainer" parent="PanelContainer/VBoxContainer/InfoPanel/VBoxContainer2/SamplePanel/ScrollContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="Controls" type="HBoxContainer" parent="PanelContainer/VBoxContainer/InfoPanel/VBoxContainer2"]
|
||||
layout_mode = 2
|
||||
alignment = 2
|
||||
|
||||
[node name="CancelButton" type="Button" parent="PanelContainer/VBoxContainer/InfoPanel/VBoxContainer2/Controls"]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_CANCEL"
|
||||
|
||||
[node name="ConfirmButton" type="Button" parent="PanelContainer/VBoxContainer/InfoPanel/VBoxContainer2/Controls"]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_CONFIRM_REMIX"
|
||||
|
||||
[node name="FeatureUI" parent="." instance=ExtResource("1_y6tpq")]
|
||||
visible = false
|
||||
layout_mode = 0
|
||||
anchors_preset = 0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
grow_horizontal = 1
|
||||
grow_vertical = 1
|
||||
mouse_filter = 2
|
||||
|
||||
[connection signal="item_selected" from="PanelContainer/VBoxContainer/Tracks/SourceCartridge/CassetteSelector/OptionButton" to="." method="select_card"]
|
||||
[connection signal="toggled" from="PanelContainer/VBoxContainer/InfoPanel/VBoxContainer/Button" to="." method="press_check_button"]
|
||||
[connection signal="pressed" from="PanelContainer/VBoxContainer/InfoPanel/VBoxContainer2/Controls/CancelButton" to="." method="_on_cancel_button_pressed"]
|
||||
[connection signal="pressed" from="PanelContainer/VBoxContainer/InfoPanel/VBoxContainer2/Controls/ConfirmButton" to="." method="_on_confirm_button_pressed"]
|
||||
54
UI/Menus/OptionsMenu/audio_options.gd
Normal file
54
UI/Menus/OptionsMenu/audio_options.gd
Normal file
@@ -0,0 +1,54 @@
|
||||
class_name AudioOptionsMenu
|
||||
extends VBoxContainer
|
||||
|
||||
@export var master_input: SpinBox
|
||||
@export var master_slider: HSlider
|
||||
@export var music_input: SpinBox
|
||||
@export var music_slider: HSlider
|
||||
@export var sfx_input: SpinBox
|
||||
@export var sfx_slider: HSlider
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
master_input.value = Data.audio.master
|
||||
master_slider.value = Data.audio.master
|
||||
music_input.value = Data.audio.music
|
||||
music_slider.value = Data.audio.music
|
||||
sfx_input.value = Data.audio.sfx
|
||||
sfx_slider.value = Data.audio.sfx
|
||||
|
||||
|
||||
func _on_master_spin_box_value_changed(value: float) -> void:
|
||||
master_slider.value = value
|
||||
Data.audio.master = value
|
||||
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Master"), linear_to_db(value / 100.0))
|
||||
|
||||
|
||||
func _on_master_h_slider_value_changed(value: float) -> void:
|
||||
master_input.value = value
|
||||
Data.audio.master = value
|
||||
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Master"), linear_to_db(value / 100.0))
|
||||
|
||||
|
||||
func _on_music_spin_box_value_changed(value: float) -> void:
|
||||
music_slider.value = value
|
||||
Data.audio.music = value
|
||||
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Music"), linear_to_db(value / 100.0))
|
||||
|
||||
|
||||
func _on_music_h_slider_value_changed(value: float) -> void:
|
||||
music_input.value = value
|
||||
Data.audio.music = value
|
||||
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Music"), linear_to_db(value / 100.0))
|
||||
|
||||
|
||||
func _on_sfx_spin_box_value_changed(value: float) -> void:
|
||||
sfx_slider.value = value
|
||||
Data.audio.sfx = value
|
||||
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("SFX"), linear_to_db(value / 100.0))
|
||||
|
||||
|
||||
func _on_sfx_h_slider_value_changed(value: float) -> void:
|
||||
sfx_input.value = value
|
||||
Data.audio.sfx = value
|
||||
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("SFX"), linear_to_db(value / 100.0))
|
||||
1
UI/Menus/OptionsMenu/audio_options.gd.uid
Normal file
1
UI/Menus/OptionsMenu/audio_options.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://c4ljvgrb81du6
|
||||
110
UI/Menus/OptionsMenu/audio_options.tscn
Normal file
110
UI/Menus/OptionsMenu/audio_options.tscn
Normal file
@@ -0,0 +1,110 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://bwc45ogto8thn"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://c4ljvgrb81du6" path="res://UI/Menus/OptionsMenu/audio_options.gd" id="1_avc0j"]
|
||||
|
||||
[sub_resource type="ImageTexture" id="ImageTexture_hvvdd"]
|
||||
|
||||
[node name="Audio" type="VBoxContainer" node_paths=PackedStringArray("master_input", "master_slider", "music_input", "music_slider", "sfx_input", "sfx_slider")]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_avc0j")
|
||||
master_input = NodePath("Master/HBoxContainer/SpinBox")
|
||||
master_slider = NodePath("Master/HBoxContainer/HSlider")
|
||||
music_input = NodePath("Music/HBoxContainer/SpinBox")
|
||||
music_slider = NodePath("Music/HBoxContainer/HSlider")
|
||||
sfx_input = NodePath("SFX/HBoxContainer/SpinBox")
|
||||
sfx_slider = NodePath("SFX/HBoxContainer/HSlider")
|
||||
|
||||
[node name="Master" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="Master"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_MASTER_AUDIO"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Master"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="SpinBox" type="SpinBox" parent="Master/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_icons/updown = SubResource("ImageTexture_hvvdd")
|
||||
value = 100.0
|
||||
rounded = true
|
||||
alignment = 1
|
||||
update_on_text_changed = true
|
||||
|
||||
[node name="HSlider" type="HSlider" parent="Master/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
value = 100.0
|
||||
|
||||
[node name="Music" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="Music"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_MUSIC_AUDIO"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Music"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="SpinBox" type="SpinBox" parent="Music/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_icons/updown = SubResource("ImageTexture_hvvdd")
|
||||
value = 100.0
|
||||
rounded = true
|
||||
alignment = 1
|
||||
update_on_text_changed = true
|
||||
|
||||
[node name="HSlider" type="HSlider" parent="Music/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
value = 100.0
|
||||
|
||||
[node name="SFX" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="SFX"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_SFX_AUDIO"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="SFX"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="SpinBox" type="SpinBox" parent="SFX/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_icons/updown = SubResource("ImageTexture_hvvdd")
|
||||
value = 100.0
|
||||
rounded = true
|
||||
alignment = 1
|
||||
update_on_text_changed = true
|
||||
|
||||
[node name="HSlider" type="HSlider" parent="SFX/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
value = 100.0
|
||||
|
||||
[connection signal="value_changed" from="Master/HBoxContainer/SpinBox" to="." method="_on_master_spin_box_value_changed"]
|
||||
[connection signal="value_changed" from="Master/HBoxContainer/HSlider" to="." method="_on_master_h_slider_value_changed"]
|
||||
[connection signal="value_changed" from="Music/HBoxContainer/SpinBox" to="." method="_on_music_spin_box_value_changed"]
|
||||
[connection signal="value_changed" from="Music/HBoxContainer/HSlider" to="." method="_on_music_h_slider_value_changed"]
|
||||
[connection signal="value_changed" from="SFX/HBoxContainer/SpinBox" to="." method="_on_sfx_spin_box_value_changed"]
|
||||
[connection signal="value_changed" from="SFX/HBoxContainer/HSlider" to="." method="_on_sfx_h_slider_value_changed"]
|
||||
46
UI/Menus/OptionsMenu/gameplay_options.gd
Normal file
46
UI/Menus/OptionsMenu/gameplay_options.gd
Normal file
@@ -0,0 +1,46 @@
|
||||
class_name GameplayOptionsMenu
|
||||
extends VBoxContainer
|
||||
|
||||
@export var look_sens_slider: HSlider
|
||||
@export var look_sens_input: SpinBox
|
||||
@export var toggle_sprint_checkbox: CheckButton
|
||||
@export var invert_lookY: CheckButton
|
||||
@export var invert_lookX: CheckButton
|
||||
@export var fixed_minimap: CheckButton
|
||||
@export var tower_damage: Button
|
||||
@export var self_damage: Button
|
||||
@export var party_damage: Button
|
||||
@export var status_damage: Button
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
look_sens_slider.value = Data.preferences.mouse_sens
|
||||
look_sens_input.value = Data.preferences.mouse_sens
|
||||
toggle_sprint_checkbox.button_pressed = Data.preferences.toggle_sprint
|
||||
invert_lookY.button_pressed = Data.preferences.invert_lookY
|
||||
invert_lookX.button_pressed = Data.preferences.invert_lookX
|
||||
fixed_minimap.button_pressed = Data.preferences.fixed_minimap
|
||||
tower_damage.button_pressed = Data.preferences.display_tower_damage_indicators
|
||||
self_damage.button_pressed = Data.preferences.display_self_damage_indicators
|
||||
party_damage.button_pressed = Data.preferences.display_party_damage_indicators
|
||||
status_damage.button_pressed = Data.preferences.display_status_effect_damage_indicators
|
||||
|
||||
|
||||
func save() -> void:
|
||||
Data.preferences.mouse_sens = look_sens_slider.value
|
||||
Data.preferences.toggle_sprint = toggle_sprint_checkbox.button_pressed
|
||||
Data.preferences.invert_lookY = invert_lookY.button_pressed
|
||||
Data.preferences.invert_lookX = invert_lookX.button_pressed
|
||||
Data.preferences.fixed_minimap = fixed_minimap.button_pressed
|
||||
Data.preferences.display_tower_damage_indicators = tower_damage.button_pressed
|
||||
Data.preferences.display_self_damage_indicators = self_damage.button_pressed
|
||||
Data.preferences.display_party_damage_indicators = party_damage.button_pressed
|
||||
Data.preferences.display_status_effect_damage_indicators = status_damage.button_pressed
|
||||
|
||||
|
||||
func _on_mouse_sens_spin_box_value_changed(value: float) -> void:
|
||||
look_sens_slider.value = value
|
||||
|
||||
|
||||
func _on_mouse_sens_h_slider_value_changed(value: float) -> void:
|
||||
look_sens_input.value = value
|
||||
1
UI/Menus/OptionsMenu/gameplay_options.gd.uid
Normal file
1
UI/Menus/OptionsMenu/gameplay_options.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dtrjph756oq1f
|
||||
171
UI/Menus/OptionsMenu/gameplay_options.tscn
Normal file
171
UI/Menus/OptionsMenu/gameplay_options.tscn
Normal file
@@ -0,0 +1,171 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://bjk7jf0bau5lv"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dtrjph756oq1f" path="res://UI/Menus/OptionsMenu/gameplay_options.gd" id="1_sy26f"]
|
||||
|
||||
[sub_resource type="ImageTexture" id="ImageTexture_03x6q"]
|
||||
|
||||
[node name="Gameplay" type="VBoxContainer" node_paths=PackedStringArray("look_sens_slider", "look_sens_input", "toggle_sprint_checkbox", "invert_lookY", "invert_lookX", "fixed_minimap", "tower_damage", "self_damage", "party_damage", "status_damage")]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_sy26f")
|
||||
look_sens_slider = NodePath("MouseSens/HBoxContainer/HSlider")
|
||||
look_sens_input = NodePath("MouseSens/HBoxContainer/SpinBox")
|
||||
toggle_sprint_checkbox = NodePath("ToggleSprint/CenterContainer/CheckButton")
|
||||
invert_lookY = NodePath("InvertMouseY/CenterContainer/CheckButton")
|
||||
invert_lookX = NodePath("InvertMouseX/CenterContainer/CheckButton")
|
||||
fixed_minimap = NodePath("FixedMinimap/CenterContainer/CheckButton")
|
||||
tower_damage = NodePath("FloatingDamageIndicators/CenterContainer/HBoxContainer/TowerDamage")
|
||||
self_damage = NodePath("FloatingDamageIndicators/CenterContainer/HBoxContainer/SelfDamage")
|
||||
party_damage = NodePath("FloatingDamageIndicators/CenterContainer/HBoxContainer/PartyDamage")
|
||||
status_damage = NodePath("FloatingDamageIndicators/CenterContainer/HBoxContainer/StatusDamage")
|
||||
|
||||
[node name="MouseSens" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="Label" type="Label" parent="MouseSens"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_MOUSE_SENSITIVITY"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="MouseSens"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="SpinBox" type="SpinBox" parent="MouseSens/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_icons/updown = SubResource("ImageTexture_03x6q")
|
||||
step = 0.01
|
||||
alignment = 1
|
||||
update_on_text_changed = true
|
||||
|
||||
[node name="HSlider" type="HSlider" parent="MouseSens/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
step = 0.01
|
||||
scrollable = false
|
||||
|
||||
[node name="ToggleSprint" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="ToggleSprint"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_TOGGLE_SPRINT"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="ToggleSprint"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="CheckButton" type="CheckButton" parent="ToggleSprint/CenterContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
flat = true
|
||||
|
||||
[node name="InvertMouseY" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="InvertMouseY"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_INVERT_MOUSE_Y"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="InvertMouseY"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="CheckButton" type="CheckButton" parent="InvertMouseY/CenterContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
flat = true
|
||||
|
||||
[node name="InvertMouseX" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="InvertMouseX"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_INVERT_MOUSE_X"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="InvertMouseX"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="CheckButton" type="CheckButton" parent="InvertMouseX/CenterContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
flat = true
|
||||
|
||||
[node name="FixedMinimap" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="FixedMinimap"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_FIXED_MINIMAP"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="FixedMinimap"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="CheckButton" type="CheckButton" parent="FixedMinimap/CenterContainer"]
|
||||
layout_mode = 2
|
||||
flat = true
|
||||
|
||||
[node name="FloatingDamageIndicators" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="FloatingDamageIndicators"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_DISPLAY_DAMAGE_INDICATORS"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="FloatingDamageIndicators"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="FloatingDamageIndicators/CenterContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TowerDamage" type="Button" parent="FloatingDamageIndicators/CenterContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
toggle_mode = true
|
||||
button_pressed = true
|
||||
text = "OPTION_TOWER_DAMAGE"
|
||||
|
||||
[node name="SelfDamage" type="Button" parent="FloatingDamageIndicators/CenterContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
toggle_mode = true
|
||||
button_pressed = true
|
||||
text = "OPTION_SELF_DAMAGE"
|
||||
|
||||
[node name="PartyDamage" type="Button" parent="FloatingDamageIndicators/CenterContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
toggle_mode = true
|
||||
button_pressed = true
|
||||
text = "OPTION_PARTY_DAMAGE"
|
||||
|
||||
[node name="StatusDamage" type="Button" parent="FloatingDamageIndicators/CenterContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
toggle_mode = true
|
||||
button_pressed = true
|
||||
text = "OPTION_STATUS_DAMAGE"
|
||||
|
||||
[connection signal="value_changed" from="MouseSens/HBoxContainer/SpinBox" to="." method="_on_mouse_sens_spin_box_value_changed"]
|
||||
[connection signal="value_changed" from="MouseSens/HBoxContainer/HSlider" to="." method="_on_mouse_sens_h_slider_value_changed"]
|
||||
36
UI/Menus/OptionsMenu/graphics_options.gd
Normal file
36
UI/Menus/OptionsMenu/graphics_options.gd
Normal file
@@ -0,0 +1,36 @@
|
||||
class_name GraphicsOptionsMenu
|
||||
extends VBoxContainer
|
||||
|
||||
@export var fov_input: SpinBox
|
||||
@export var fov_slider: HSlider
|
||||
@export var vsync_dropdown: OptionButton
|
||||
@export var aa_dropdown: OptionButton
|
||||
@export var window_dropdown: OptionButton
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
fov_input.value = Data.graphics.hfov
|
||||
fov_slider.value = Data.graphics.hfov
|
||||
vsync_dropdown.selected = Data.graphics.vsync_mode
|
||||
aa_dropdown.selected = Data.graphics.aa_mode
|
||||
|
||||
|
||||
func save() -> void:
|
||||
Data.graphics.hfov = fov_slider.value
|
||||
Data.graphics.vsync_mode = vsync_dropdown.selected
|
||||
Data.graphics.aa_mode = aa_dropdown.selected
|
||||
Data.graphics.windowed_mode = window_dropdown.selected
|
||||
|
||||
|
||||
func _on_fov_spin_box_value_changed(value: float) -> void:
|
||||
if value < 40.0:
|
||||
value = 40.0
|
||||
if value > 160.0:
|
||||
value = 160.0
|
||||
fov_slider.value = value
|
||||
Data.graphics.hfov = value
|
||||
|
||||
|
||||
func _on_fov_h_slider_value_changed(value: float) -> void:
|
||||
fov_input.value = value
|
||||
Data.graphics.hfov = value
|
||||
1
UI/Menus/OptionsMenu/graphics_options.gd.uid
Normal file
1
UI/Menus/OptionsMenu/graphics_options.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bpb5c5r1yi8um
|
||||
124
UI/Menus/OptionsMenu/graphics_options.tscn
Normal file
124
UI/Menus/OptionsMenu/graphics_options.tscn
Normal file
@@ -0,0 +1,124 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://bmd4mawasoc11"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bpb5c5r1yi8um" path="res://UI/Menus/OptionsMenu/graphics_options.gd" id="1_85rh6"]
|
||||
|
||||
[sub_resource type="ImageTexture" id="ImageTexture_03x6q"]
|
||||
|
||||
[node name="Graphics" type="VBoxContainer" node_paths=PackedStringArray("fov_input", "fov_slider", "vsync_dropdown", "aa_dropdown", "window_dropdown")]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_85rh6")
|
||||
fov_input = NodePath("FOV/HBoxContainer/SpinBox")
|
||||
fov_slider = NodePath("FOV/HBoxContainer/HSlider")
|
||||
vsync_dropdown = NodePath("VSync/OptionButton")
|
||||
aa_dropdown = NodePath("AntiAliasing/OptionButton")
|
||||
window_dropdown = NodePath("Windowed/OptionButton")
|
||||
|
||||
[node name="FOV" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="Label" type="Label" parent="FOV"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_FOV"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="FOV"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="SpinBox" type="SpinBox" parent="FOV/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_icons/updown = SubResource("ImageTexture_03x6q")
|
||||
min_value = 40.0
|
||||
max_value = 160.0
|
||||
value = 100.0
|
||||
allow_greater = true
|
||||
allow_lesser = true
|
||||
alignment = 1
|
||||
update_on_text_changed = true
|
||||
|
||||
[node name="HSlider" type="HSlider" parent="FOV/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
min_value = 40.0
|
||||
max_value = 160.0
|
||||
value = 100.0
|
||||
scrollable = false
|
||||
|
||||
[node name="VSync" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="VSync"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_VSYNC"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="OptionButton" type="OptionButton" parent="VSync"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
selected = 1
|
||||
item_count = 4
|
||||
popup/item_0/text = "OPTION_OFF"
|
||||
popup/item_0/id = 0
|
||||
popup/item_1/text = "OPTION_ON"
|
||||
popup/item_1/id = 1
|
||||
popup/item_2/text = "OPTION_ADAPTIVE"
|
||||
popup/item_2/id = 2
|
||||
popup/item_3/text = "OPTION_TRIPLE_BUFFERED"
|
||||
popup/item_3/id = 3
|
||||
|
||||
[node name="AntiAliasing" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="AntiAliasing"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_AA"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="OptionButton" type="OptionButton" parent="AntiAliasing"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
selected = 0
|
||||
item_count = 3
|
||||
popup/item_0/text = "OPTION_OFF"
|
||||
popup/item_0/id = 0
|
||||
popup/item_1/text = "OPTION_FXAA"
|
||||
popup/item_1/id = 1
|
||||
popup/item_2/text = "OPTION_TAA"
|
||||
popup/item_2/id = 2
|
||||
|
||||
[node name="Windowed" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="Windowed"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_WINDOW_TYPE"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="OptionButton" type="OptionButton" parent="Windowed"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
selected = 0
|
||||
item_count = 3
|
||||
popup/item_0/text = "OPTION_WINDOWED"
|
||||
popup/item_0/id = 0
|
||||
popup/item_1/text = "OPTION_BORDERLESS"
|
||||
popup/item_1/id = 1
|
||||
popup/item_2/text = "OPTION_FULLSCREEN"
|
||||
popup/item_2/id = 2
|
||||
|
||||
[connection signal="value_changed" from="FOV/HBoxContainer/SpinBox" to="." method="_on_fov_spin_box_value_changed"]
|
||||
[connection signal="value_changed" from="FOV/HBoxContainer/HSlider" to="." method="_on_fov_h_slider_value_changed"]
|
||||
125
UI/Menus/OptionsMenu/keybind_entry.gd
Normal file
125
UI/Menus/OptionsMenu/keybind_entry.gd
Normal file
@@ -0,0 +1,125 @@
|
||||
class_name KeybindEntry
|
||||
extends HBoxContainer
|
||||
|
||||
signal bind_button_pressed(button: Button)
|
||||
|
||||
var action_string: String
|
||||
var event_buttons: Array[BindButton]
|
||||
|
||||
|
||||
func to_array() -> Array:
|
||||
var binding_list: Array = []
|
||||
binding_list.append([action_string])
|
||||
for button: BindButton in event_buttons:
|
||||
var binding: Array = []
|
||||
if button.trigger_event is InputEventKey:
|
||||
binding.append("InputEventKey")
|
||||
binding.append(button.trigger_event.physical_keycode)
|
||||
if button.trigger_event is InputEventMouseButton:
|
||||
binding.append("InputEventMouseButton")
|
||||
binding.append(button.trigger_event.button_index)
|
||||
if button.trigger_event is InputEventJoypadButton:
|
||||
binding.append("InputEventJoypadButton")
|
||||
binding.append(button.trigger_event.button_index)
|
||||
binding_list.append(binding)
|
||||
return binding_list
|
||||
|
||||
|
||||
func populate_from_array(binding_list: Array) -> void:
|
||||
action_string = binding_list[0][0]
|
||||
for i: int in binding_list.size() - 1:
|
||||
if i == 0:
|
||||
continue
|
||||
for binding: Array in binding_list[i]:
|
||||
add_bind_button(KeymapData.event_from_array(binding))
|
||||
|
||||
|
||||
func set_action_name(action_name: String) -> void:
|
||||
action_string = action_name
|
||||
$ActionName.text = action_name
|
||||
|
||||
|
||||
func button_pressed(button: Button) -> void:
|
||||
bind_button_pressed.emit(button)
|
||||
|
||||
|
||||
func set_button_bind(event: InputEvent, button: BindButton) -> void:
|
||||
button.trigger_event = event
|
||||
button.text = ""
|
||||
if event is InputEventKey:
|
||||
if KeyIconMap.keys.has(str(event.physical_keycode)):
|
||||
button.icon = load(KeyIconMap.keys[str(event.physical_keycode)])
|
||||
elif event is InputEventMouseButton:
|
||||
if event.button_index == 4:
|
||||
button.icon = load(KeyIconMap.mouse_buttons[str(event.button_index)])
|
||||
elif event.button_index == 5:
|
||||
button.icon = load(KeyIconMap.mouse_buttons[str(event.button_index)])
|
||||
elif event.button_index == 6:
|
||||
button.text = "Mouse Wheel Left"
|
||||
elif event.button_index == 7:
|
||||
button.text = "Mouse Wheel Right"
|
||||
elif event.button_index == 8:
|
||||
button.text = "Mouse Button 4"
|
||||
elif event.button_index == 9:
|
||||
button.text = "Mouse Button 5"
|
||||
elif KeyIconMap.mouse_buttons.has(str(event.button_index)):
|
||||
button.icon = load(KeyIconMap.mouse_buttons[str(event.button_index)])
|
||||
elif event is InputEventJoypadButton:
|
||||
if Input.get_joy_name(event.device) == "Xbox 360 Controller":
|
||||
button.icon = load(KeyIconMap.xbox_360_keys[str(event.button_index)])
|
||||
elif Input.get_joy_name(event.device) == "Xbox Series Controller":
|
||||
button.icon = load(KeyIconMap.xbox_series_keys[str(event.button_index)])
|
||||
elif Input.get_joy_name(event.device).contains("Playstation"):
|
||||
button.icon = load(KeyIconMap.playstation_keys[str(event.button_index)])
|
||||
|
||||
|
||||
func set_cross_button_visibility(button: Button, visibility: bool) -> void:
|
||||
button.visible = visibility
|
||||
|
||||
|
||||
func add_bind_button(event: InputEvent) -> BindButton:
|
||||
#Create binding button
|
||||
var new_button: BindButton = BindButton.new()
|
||||
new_button.mouse_filter = Control.MOUSE_FILTER_PASS
|
||||
new_button.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||
new_button.custom_minimum_size = Vector2(75.0, 75.0)
|
||||
new_button.icon_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
new_button.expand_icon = true
|
||||
new_button.pressed.connect(button_pressed.bind(new_button))
|
||||
if event:
|
||||
set_button_bind(event, new_button)
|
||||
event_buttons.append(new_button)
|
||||
|
||||
#Create delete button
|
||||
var cross_button: Button = Button.new()
|
||||
cross_button.icon = load("res://Assets/Textures/flair_disabled_cross.png")
|
||||
cross_button.visible = false
|
||||
cross_button.mouse_filter = Control.MOUSE_FILTER_PASS
|
||||
cross_button.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||
cross_button.icon_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
cross_button.expand_icon = true
|
||||
cross_button.pressed.connect(remove_bind_button.bind(new_button))
|
||||
|
||||
#Create vbox to hold buttons
|
||||
var vbox: VBoxContainer = VBoxContainer.new()
|
||||
vbox.mouse_filter = Control.MOUSE_FILTER_STOP
|
||||
vbox.custom_minimum_size = Vector2(100.0, 100.0)
|
||||
vbox.mouse_entered.connect(set_cross_button_visibility.bind(cross_button, true))
|
||||
vbox.mouse_exited.connect(set_cross_button_visibility.bind(cross_button, false))
|
||||
|
||||
#Add buttons to vbox and add vbox to button grid
|
||||
vbox.add_child(new_button)
|
||||
vbox.add_child(cross_button)
|
||||
$Buttons.add_child(vbox)
|
||||
$Buttons.move_child(vbox, $Buttons.get_child_count() - 2)
|
||||
|
||||
return new_button
|
||||
|
||||
|
||||
func remove_bind_button(button: BindButton) -> void:
|
||||
event_buttons.erase(button)
|
||||
button.get_parent().queue_free()
|
||||
|
||||
|
||||
func _on_add_bind_button_pressed() -> void:
|
||||
add_bind_button(null).pressed.emit()
|
||||
1
UI/Menus/OptionsMenu/keybind_entry.gd.uid
Normal file
1
UI/Menus/OptionsMenu/keybind_entry.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://y2pxkfjn0wa2
|
||||
34
UI/Menus/OptionsMenu/keybind_entry.tscn
Normal file
34
UI/Menus/OptionsMenu/keybind_entry.tscn
Normal file
@@ -0,0 +1,34 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://cb8irvp2y2p6g"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://y2pxkfjn0wa2" path="res://UI/Menus/OptionsMenu/keybind_entry.gd" id="1_it8q2"]
|
||||
|
||||
[node name="KeybindEntry" type="HBoxContainer"]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource("1_it8q2")
|
||||
|
||||
[node name="ActionName" type="Label" parent="."]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Action Name"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Buttons" type="GridContainer" parent="."]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
columns = 4
|
||||
|
||||
[node name="AddBindButton" type="Button" parent="Buttons"]
|
||||
custom_minimum_size = Vector2(80, 80)
|
||||
layout_mode = 2
|
||||
text = "+"
|
||||
icon_alignment = 1
|
||||
expand_icon = true
|
||||
|
||||
[connection signal="pressed" from="Buttons/AddBindButton" to="." method="_on_add_bind_button_pressed"]
|
||||
53
UI/Menus/OptionsMenu/keybind_options.gd
Normal file
53
UI/Menus/OptionsMenu/keybind_options.gd
Normal file
@@ -0,0 +1,53 @@
|
||||
extends VBoxContainer
|
||||
class_name KeybindsOptionsMenu
|
||||
|
||||
@export var keybind_entry_scene: PackedScene
|
||||
@export var keybind_popup: PackedScene
|
||||
var keybind_boxes: Array[KeybindEntry] = []
|
||||
var key_event: InputEvent
|
||||
var selected_entry: KeybindEntry
|
||||
var listening_for_key: bool = false
|
||||
var ui_layer: CanvasLayer
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
#for index: int in Data.keymaps.size():
|
||||
# var map: PlayerKeymap = Data.keymaps[index]
|
||||
# var button: Button = Button.new()
|
||||
# button.text = map.title
|
||||
# button.pressed.connect(set_keymap.bind(index))
|
||||
# $HBoxContainer.add_child(button)
|
||||
load_keybind_labels()
|
||||
|
||||
|
||||
func set_keymap(keymap_index: int) -> void:
|
||||
Data.player_keymap = Data.keymaps[keymap_index]
|
||||
Data.player_keymap.apply()
|
||||
load_keybind_labels()
|
||||
|
||||
|
||||
func load_keybind_labels() -> void:
|
||||
for box: KeybindEntry in keybind_boxes:
|
||||
box.queue_free()
|
||||
keybind_boxes.clear()
|
||||
for action: StringName in InputMap.get_actions():
|
||||
if !action.begins_with("ui_"):
|
||||
var entry: KeybindEntry = keybind_entry_scene.instantiate() as KeybindEntry
|
||||
entry.set_action_name(action)
|
||||
if InputMap.action_get_events(action).size() > 0:
|
||||
for event: InputEvent in InputMap.action_get_events(action):
|
||||
entry.add_bind_button(event)
|
||||
keybind_boxes.append(entry)
|
||||
entry.bind_button_pressed.connect(_on_keybind_button_pressed.bind(entry))
|
||||
$ScrollContainer/VBoxContainer.add_child(entry)
|
||||
|
||||
|
||||
func _on_keybind_button_pressed(button: Button, keybind_entry: KeybindEntry) -> void:
|
||||
var popup: KeybindPopup = keybind_popup.instantiate()
|
||||
popup.event_detected.connect(keybind_entry.set_button_bind.bind(button))
|
||||
ui_layer.add_child(popup)
|
||||
|
||||
|
||||
func save() -> void:
|
||||
for entry: KeybindEntry in keybind_boxes:
|
||||
Data.keymap_data.add_binding(entry.to_array())
|
||||
1
UI/Menus/OptionsMenu/keybind_options.gd.uid
Normal file
1
UI/Menus/OptionsMenu/keybind_options.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cxm67e833baex
|
||||
26
UI/Menus/OptionsMenu/keybind_options.tscn
Normal file
26
UI/Menus/OptionsMenu/keybind_options.tscn
Normal file
@@ -0,0 +1,26 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://bf2nosqt5f82e"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cxm67e833baex" path="res://UI/Menus/OptionsMenu/keybind_options.gd" id="1_oxg0p"]
|
||||
[ext_resource type="PackedScene" uid="uid://cb8irvp2y2p6g" path="res://UI/Menus/OptionsMenu/keybind_entry.tscn" id="2_ayiik"]
|
||||
[ext_resource type="PackedScene" uid="uid://clsdko6ttudu8" path="res://UI/Menus/OptionsMenu/keybind_popup.tscn" id="3_h1scm"]
|
||||
|
||||
[node name="Keybinds" type="VBoxContainer"]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_oxg0p")
|
||||
keybind_entry_scene = ExtResource("2_ayiik")
|
||||
keybind_popup = ExtResource("3_h1scm")
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="."]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="ScrollContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
15
UI/Menus/OptionsMenu/keybind_popup.gd
Normal file
15
UI/Menus/OptionsMenu/keybind_popup.gd
Normal file
@@ -0,0 +1,15 @@
|
||||
class_name KeybindPopup
|
||||
extends Control
|
||||
|
||||
signal event_detected(event: InputEvent)
|
||||
|
||||
var found_event: bool = false
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if found_event:
|
||||
return
|
||||
if event is InputEventKey or event is InputEventMouseButton or event is InputEventJoypadButton:
|
||||
get_viewport().set_input_as_handled()
|
||||
found_event = true
|
||||
event_detected.emit(event)
|
||||
queue_free()
|
||||
1
UI/Menus/OptionsMenu/keybind_popup.gd.uid
Normal file
1
UI/Menus/OptionsMenu/keybind_popup.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://d25hjwjdwv35i
|
||||
38
UI/Menus/OptionsMenu/keybind_popup.tscn
Normal file
38
UI/Menus/OptionsMenu/keybind_popup.tscn
Normal file
@@ -0,0 +1,38 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://clsdko6ttudu8"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://d25hjwjdwv35i" path="res://UI/Menus/OptionsMenu/keybind_popup.gd" id="1_m5i0b"]
|
||||
|
||||
[node name="KeybindPopup" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_m5i0b")
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
color = Color(0, 0, 0, 0.54902)
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -99.0
|
||||
offset_top = -13.0
|
||||
offset_right = 99.0
|
||||
offset_bottom = 13.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
text = "LABEL_BIND_KEY"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
69
UI/Menus/OptionsMenu/keymap_data.gd
Normal file
69
UI/Menus/OptionsMenu/keymap_data.gd
Normal file
@@ -0,0 +1,69 @@
|
||||
class_name KeymapData
|
||||
extends RefCounted
|
||||
|
||||
var title: String = "default"
|
||||
var map: Dictionary[String, Array]
|
||||
|
||||
|
||||
func add_binding(bind_array: Array) -> void:
|
||||
var x: int = bind_array.size() - 1
|
||||
var arr: Array
|
||||
for i: int in x:
|
||||
arr.append(bind_array[i + 1])
|
||||
map[bind_array[0][0]] = arr
|
||||
|
||||
|
||||
static func event_from_array(array: Array) -> InputEvent:
|
||||
if array.size() < 2:
|
||||
return null
|
||||
if array[0] == "InputEventKey":
|
||||
var event: InputEventKey = InputEventKey.new()
|
||||
event.physical_keycode = array[1]
|
||||
return event
|
||||
if array[0] == "InputEventMouseButton":
|
||||
var event: InputEventMouseButton = InputEventMouseButton.new()
|
||||
event.button_index = array[1]
|
||||
return event
|
||||
if array[0] == "InputEventJoypadButton":
|
||||
var event: InputEventJoypadButton = InputEventJoypadButton.new()
|
||||
event.button_index = array[1]
|
||||
return event
|
||||
return null
|
||||
|
||||
|
||||
func apply() -> void:
|
||||
for action_string: String in map.keys():
|
||||
InputMap.action_erase_events(action_string)
|
||||
for binding: Array in map[action_string]:
|
||||
var event: InputEvent = event_from_array(binding)
|
||||
if event:
|
||||
InputMap.action_add_event(action_string, event)
|
||||
|
||||
|
||||
func save_to_disc() -> void:
|
||||
var dir: DirAccess = DirAccess.open("user://")
|
||||
if !dir.dir_exists("keymaps"):
|
||||
dir.make_dir("keymaps")
|
||||
var save_file: FileAccess = FileAccess.open("user://keymaps/default", FileAccess.WRITE)
|
||||
var dict: Dictionary = {
|
||||
"title" = title,
|
||||
"map" = map,
|
||||
}
|
||||
var json_string: String = JSON.stringify(dict)
|
||||
save_file.store_line(json_string)
|
||||
|
||||
|
||||
static func load_from_disk() -> KeymapData:
|
||||
if FileAccess.file_exists("user://keymaps/default"):
|
||||
var save_file: FileAccess = FileAccess.open("user://keymaps/default", FileAccess.READ)
|
||||
var json_string: String = save_file.get_line()
|
||||
var json: JSON = JSON.new()
|
||||
var parse_result: Error = json.parse(json_string)
|
||||
if parse_result == OK:
|
||||
var dict: Dictionary = json.data
|
||||
var keymap: KeymapData = KeymapData.new()
|
||||
keymap.title = dict["title"]
|
||||
for key: String in dict["map"].keys():
|
||||
keymap.map[key] = dict["map"][key]
|
||||
return keymap
|
||||
return KeymapData.new()
|
||||
1
UI/Menus/OptionsMenu/keymap_data.gd.uid
Normal file
1
UI/Menus/OptionsMenu/keymap_data.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dui1k2e4q6cl
|
||||
44
UI/Menus/OptionsMenu/options_menu.gd
Normal file
44
UI/Menus/OptionsMenu/options_menu.gd
Normal file
@@ -0,0 +1,44 @@
|
||||
class_name OptionsMenu
|
||||
extends Control
|
||||
|
||||
@export var gameplay: GameplayOptionsMenu
|
||||
@export var graphics: GraphicsOptionsMenu
|
||||
@export var keybinds: KeybindsOptionsMenu
|
||||
@export var audio: AudioOptionsMenu
|
||||
var game_manager: GameManager
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
set_tab_locale()
|
||||
keybinds.ui_layer = game_manager.UILayer
|
||||
|
||||
|
||||
func set_tab_locale() -> void:
|
||||
gameplay.name = tr("OPTIONS_TAB_GAMEPLAY")
|
||||
graphics.name = tr("OPTIONS_TAB_GRAPHICS")
|
||||
keybinds.name = tr("OPTIONS_TAB_KEYBINDS")
|
||||
audio.name = tr("OPTIONS_TAB_AUDIO")
|
||||
|
||||
|
||||
func _on_cancel_pressed() -> void:
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_confirm_pressed() -> void:
|
||||
gameplay.save()
|
||||
graphics.save()
|
||||
keybinds.save()
|
||||
Data.graphics.apply_graphical_settings(get_viewport())
|
||||
Data.graphics.save_profile_to_disk()
|
||||
Data.audio.apply_audio_settings()
|
||||
Data.audio.save_profile_to_disk()
|
||||
Data.preferences.save_profile_to_disk()
|
||||
Data.keymap_data.apply()
|
||||
Data.keymap_data.save_to_disc()
|
||||
#Data.player_keymap.save_profile_to_disk()
|
||||
#Data.player_controller_keymap.append_input_map()
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_button_hovered() -> void:
|
||||
$AudioStreamPlayer.play()
|
||||
1
UI/Menus/OptionsMenu/options_menu.gd.uid
Normal file
1
UI/Menus/OptionsMenu/options_menu.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://48rvmybi18wj
|
||||
76
UI/Menus/OptionsMenu/options_menu.tscn
Normal file
76
UI/Menus/OptionsMenu/options_menu.tscn
Normal file
@@ -0,0 +1,76 @@
|
||||
[gd_scene load_steps=8 format=3 uid="uid://clulh7v8c7h85"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://48rvmybi18wj" path="res://UI/Menus/OptionsMenu/options_menu.gd" id="1_bievw"]
|
||||
[ext_resource type="PackedScene" uid="uid://bjk7jf0bau5lv" path="res://UI/Menus/OptionsMenu/gameplay_options.tscn" id="3_25wuw"]
|
||||
[ext_resource type="PackedScene" uid="uid://bmd4mawasoc11" path="res://UI/Menus/OptionsMenu/graphics_options.tscn" id="4_ckcvq"]
|
||||
[ext_resource type="PackedScene" uid="uid://bf2nosqt5f82e" path="res://UI/Menus/OptionsMenu/keybind_options.tscn" id="5_4k33c"]
|
||||
[ext_resource type="PackedScene" uid="uid://bwc45ogto8thn" path="res://UI/Menus/OptionsMenu/audio_options.tscn" id="6_4vs8p"]
|
||||
[ext_resource type="AudioStream" uid="uid://cp6ph4ra7u5rk" path="res://UI/drop_003.ogg" id="6_hhyef"]
|
||||
|
||||
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_5otwj"]
|
||||
random_pitch = 1.1
|
||||
streams_count = 1
|
||||
stream_0/stream = ExtResource("6_hhyef")
|
||||
|
||||
[node name="OptionsMenu" type="PanelContainer" node_paths=PackedStringArray("gameplay", "graphics", "keybinds", "audio")]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 30.0
|
||||
offset_top = 30.0
|
||||
offset_right = -30.0
|
||||
offset_bottom = -30.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_bievw")
|
||||
gameplay = NodePath("VBoxContainer/TabContainer/Gameplay")
|
||||
graphics = NodePath("VBoxContainer/TabContainer/Graphics")
|
||||
keybinds = NodePath("VBoxContainer/TabContainer/Keybinds")
|
||||
audio = NodePath("VBoxContainer/TabContainer/Audio")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TabContainer" type="TabContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
current_tab = 0
|
||||
|
||||
[node name="Gameplay" parent="VBoxContainer/TabContainer" instance=ExtResource("3_25wuw")]
|
||||
layout_mode = 2
|
||||
metadata/_tab_index = 0
|
||||
|
||||
[node name="Graphics" parent="VBoxContainer/TabContainer" instance=ExtResource("4_ckcvq")]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
metadata/_tab_index = 1
|
||||
|
||||
[node name="Keybinds" parent="VBoxContainer/TabContainer" instance=ExtResource("5_4k33c")]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
metadata/_tab_index = 2
|
||||
|
||||
[node name="Audio" parent="VBoxContainer/TabContainer" instance=ExtResource("6_4vs8p")]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
metadata/_tab_index = 3
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
alignment = 2
|
||||
|
||||
[node name="Cancel" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_CANCEL"
|
||||
|
||||
[node name="Confirm" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_CONFIRM"
|
||||
|
||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||
stream = SubResource("AudioStreamRandomizer_5otwj")
|
||||
|
||||
[connection signal="mouse_entered" from="VBoxContainer/HBoxContainer/Cancel" to="." method="_on_button_hovered"]
|
||||
[connection signal="pressed" from="VBoxContainer/HBoxContainer/Cancel" to="." method="_on_cancel_pressed"]
|
||||
[connection signal="mouse_entered" from="VBoxContainer/HBoxContainer/Confirm" to="." method="_on_button_hovered"]
|
||||
[connection signal="pressed" from="VBoxContainer/HBoxContainer/Confirm" to="." method="_on_confirm_pressed"]
|
||||
54
UI/Menus/PauseMenu/pause_menu.gd
Normal file
54
UI/Menus/PauseMenu/pause_menu.gd
Normal file
@@ -0,0 +1,54 @@
|
||||
class_name PauseMenu extends Control
|
||||
|
||||
signal closed
|
||||
signal quit_to_main_menu_pressed
|
||||
signal quit_to_desktop_pressed
|
||||
|
||||
var options_menu_scene: PackedScene = preload("res://UI/Menus/OptionsMenu/options_menu.tscn")
|
||||
var confirmation_popup_scene: PackedScene = preload("res://Scenes/Menus/confirmation_popup.tscn")
|
||||
var game_manager: GameManager
|
||||
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("Pause"):
|
||||
accept_event()
|
||||
_on_resume_pressed()
|
||||
|
||||
|
||||
func _on_resume_pressed() -> void:
|
||||
closed.emit()
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_options_pressed() -> void:
|
||||
var menu: OptionsMenu = options_menu_scene.instantiate()
|
||||
menu.game_manager = game_manager
|
||||
add_child(menu)
|
||||
|
||||
|
||||
func _on_quit_to_main_menu_pressed() -> void:
|
||||
var popup: ConfirmationPopup = confirmation_popup_scene.instantiate() as ConfirmationPopup
|
||||
popup.set_popup("Are you sure you want to quit and return to main menu?", "Yes", "No")
|
||||
popup.completed.connect(return_to_menu)
|
||||
add_child(popup)
|
||||
|
||||
|
||||
func return_to_menu(confirmation: bool) -> void:
|
||||
if confirmation:
|
||||
quit_to_main_menu_pressed.emit()
|
||||
|
||||
|
||||
func _on_quit_to_desktop_pressed() -> void:
|
||||
var popup: ConfirmationPopup = confirmation_popup_scene.instantiate() as ConfirmationPopup
|
||||
popup.set_popup("Are you sure you want to quit?", "Yes", "No")
|
||||
popup.completed.connect(quit_game)
|
||||
add_child(popup)
|
||||
|
||||
|
||||
func quit_game(confirmation: bool) -> void:
|
||||
if confirmation:
|
||||
quit_to_desktop_pressed.emit()
|
||||
|
||||
|
||||
func _on_button_mouse_entered() -> void:
|
||||
$AudioStreamPlayer.play()
|
||||
1
UI/Menus/PauseMenu/pause_menu.gd.uid
Normal file
1
UI/Menus/PauseMenu/pause_menu.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cjyyepxaf4xl8
|
||||
73
UI/Menus/PauseMenu/pause_menu.tscn
Normal file
73
UI/Menus/PauseMenu/pause_menu.tscn
Normal file
@@ -0,0 +1,73 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://buvgdem68wtev"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cjyyepxaf4xl8" path="res://UI/Menus/PauseMenu/pause_menu.gd" id="2_4pn2l"]
|
||||
[ext_resource type="AudioStream" uid="uid://cp6ph4ra7u5rk" path="res://UI/drop_003.ogg" id="3_0bid7"]
|
||||
|
||||
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_n6ixr"]
|
||||
random_pitch = 1.1
|
||||
streams_count = 1
|
||||
stream_0/stream = ExtResource("3_0bid7")
|
||||
|
||||
[node name="Control" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("2_4pn2l")
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
color = Color(0.278431, 0.278431, 0.278431, 0.545098)
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -20.0
|
||||
offset_top = -20.0
|
||||
offset_right = 20.0
|
||||
offset_bottom = 20.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Resume" type="Button" parent="PanelContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_RESUME"
|
||||
|
||||
[node name="Options" type="Button" parent="PanelContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_OPTIONS"
|
||||
|
||||
[node name="QuitToMainMenu" type="Button" parent="PanelContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_MAIN_MENU"
|
||||
|
||||
[node name="QuitToDesktop" type="Button" parent="PanelContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_QUIT"
|
||||
|
||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||
stream = SubResource("AudioStreamRandomizer_n6ixr")
|
||||
bus = &"SFX"
|
||||
|
||||
[connection signal="mouse_entered" from="PanelContainer/VBoxContainer/Resume" to="." method="_on_button_mouse_entered"]
|
||||
[connection signal="pressed" from="PanelContainer/VBoxContainer/Resume" to="." method="_on_resume_pressed"]
|
||||
[connection signal="mouse_entered" from="PanelContainer/VBoxContainer/Options" to="." method="_on_button_mouse_entered"]
|
||||
[connection signal="pressed" from="PanelContainer/VBoxContainer/Options" to="." method="_on_options_pressed"]
|
||||
[connection signal="mouse_entered" from="PanelContainer/VBoxContainer/QuitToMainMenu" to="." method="_on_button_mouse_entered"]
|
||||
[connection signal="pressed" from="PanelContainer/VBoxContainer/QuitToMainMenu" to="." method="_on_quit_to_main_menu_pressed"]
|
||||
[connection signal="mouse_entered" from="PanelContainer/VBoxContainer/QuitToDesktop" to="." method="_on_button_mouse_entered"]
|
||||
[connection signal="pressed" from="PanelContainer/VBoxContainer/QuitToDesktop" to="." method="_on_quit_to_desktop_pressed"]
|
||||
39
UI/Menus/RadioMenu/choose_card_screen.gd
Normal file
39
UI/Menus/RadioMenu/choose_card_screen.gd
Normal file
@@ -0,0 +1,39 @@
|
||||
class_name ChooseCardScreen extends Control
|
||||
|
||||
signal card_chosen(card: Card)
|
||||
|
||||
@export var choice_buttons: VBoxContainer
|
||||
@export var card_desc: CardDescriptionUI
|
||||
@export var card_name_label: Label
|
||||
|
||||
var choices: Array[Card] = []
|
||||
var chosen_card: Card = null
|
||||
var side_a: bool = true
|
||||
|
||||
|
||||
func add_cards(cards: Array[Card]) -> void:
|
||||
var x: int = 0
|
||||
for card: Card in cards:
|
||||
var button: Button = Button.new()
|
||||
button.text = tr(card.display_name)
|
||||
button.pressed.connect(choose_card.bind(x))
|
||||
choices.append(card)
|
||||
choice_buttons.add_child(button)
|
||||
x += 1
|
||||
choose_card(0)
|
||||
|
||||
|
||||
func choose_card(choice: int) -> void:
|
||||
chosen_card = choices[choice]
|
||||
card_name_label.text = tr(chosen_card.display_name)
|
||||
choose_side(side_a)
|
||||
|
||||
|
||||
func choose_side(side_a_chosen: bool) -> void:
|
||||
side_a = side_a_chosen
|
||||
card_desc.set_card(chosen_card, side_a)
|
||||
|
||||
|
||||
func _on_confirm_button_pressed() -> void:
|
||||
card_chosen.emit(chosen_card)
|
||||
queue_free()
|
||||
1
UI/Menus/RadioMenu/choose_card_screen.gd.uid
Normal file
1
UI/Menus/RadioMenu/choose_card_screen.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://nc0df5y8tll7
|
||||
83
UI/Menus/RadioMenu/choose_card_screen.tscn
Normal file
83
UI/Menus/RadioMenu/choose_card_screen.tscn
Normal file
@@ -0,0 +1,83 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://bcvjgl0s1wp8y"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://nc0df5y8tll7" path="res://UI/Menus/RadioMenu/choose_card_screen.gd" id="1_y4oar"]
|
||||
[ext_resource type="PackedScene" uid="uid://cmlpmr78tmo6p" path="res://UI/card_description_ui.tscn" id="2_3npvv"]
|
||||
|
||||
[node name="ChooseCardScreen" type="Control" node_paths=PackedStringArray("choice_buttons", "card_desc", "card_name_label")]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_y4oar")
|
||||
choice_buttons = NodePath("PanelContainer/Content/HBoxContainer/ChoicesVBox")
|
||||
card_desc = NodePath("PanelContainer/Content/HBoxContainer/DescriptionVBox")
|
||||
card_name_label = NodePath("PanelContainer/Content/HBoxContainer/VBoxContainer/NameLabel")
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_left = 0.03
|
||||
anchor_top = 0.03
|
||||
anchor_right = 0.97
|
||||
anchor_bottom = 0.97
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Content" type="VBoxContainer" parent="PanelContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ScreenTitleLabel" type="Label" parent="PanelContainer/Content"]
|
||||
layout_mode = 2
|
||||
text = "LABEL_CHOOSE_CARD"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer/Content"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="ChoicesVBox" type="VBoxContainer" parent="PanelContainer/Content/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/Content/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_stretch_ratio = 2.0
|
||||
|
||||
[node name="NameLabel" type="Label" parent="PanelContainer/Content/HBoxContainer/VBoxContainer"]
|
||||
auto_translate_mode = 2
|
||||
layout_mode = 2
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer/Content/HBoxContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="TowerButton" type="Button" parent="PanelContainer/Content/HBoxContainer/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_VIEW_TOWER"
|
||||
|
||||
[node name="WeaponButton" type="Button" parent="PanelContainer/Content/HBoxContainer/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_VIEW_WEAPON"
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="PanelContainer/Content/HBoxContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="ConfirmButton" type="Button" parent="PanelContainer/Content/HBoxContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
text = "BUTTON_FINALIZE_CARD_CHOICE"
|
||||
|
||||
[node name="DescriptionVBox" parent="PanelContainer/Content/HBoxContainer" instance=ExtResource("2_3npvv")]
|
||||
layout_mode = 2
|
||||
|
||||
[connection signal="pressed" from="PanelContainer/Content/HBoxContainer/VBoxContainer/HBoxContainer/TowerButton" to="." method="choose_side" binds= [true]]
|
||||
[connection signal="pressed" from="PanelContainer/Content/HBoxContainer/VBoxContainer/HBoxContainer/WeaponButton" to="." method="choose_side" binds= [false]]
|
||||
[connection signal="pressed" from="PanelContainer/Content/HBoxContainer/VBoxContainer/ConfirmButton" to="." method="_on_confirm_button_pressed"]
|
||||
Reference in New Issue
Block a user