diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2024-07-19 14:24:09 +0200 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2024-07-19 14:24:09 +0200 |
commit | 294f87adb4441ec25316601505ca1a7e97fa24c7 (patch) | |
tree | e48ed54e97f19ae5dd189ee42ddb73c4e995175f /Scenes/UI | |
parent | 06647b11ee163bc40daf454d87e1fcae563c3ced (diff) |
update
Diffstat (limited to 'Scenes/UI')
-rw-r--r-- | Scenes/UI/Menu.gd | 50 | ||||
-rw-r--r-- | Scenes/UI/Menu.tscn | 177 |
2 files changed, 169 insertions, 58 deletions
diff --git a/Scenes/UI/Menu.gd b/Scenes/UI/Menu.gd index 9b41b20..fd5d9dc 100644 --- a/Scenes/UI/Menu.gd +++ b/Scenes/UI/Menu.gd @@ -6,7 +6,8 @@ extends TabContainer @onready var focused_tab = 0 @onready var focused_tab_elements: Dictionary = { 0: $Bombs/Panel/HBoxContainer/VBoxContainer/ButtonBombNormal, - 1: $System/Panel/VBoxContainer/ButtonResume, + 1: $Character/Panel/HBoxContainer/Collaborations/TextureButton, + 2: $System/Panel/VBoxContainer/ButtonResume, } @onready var exclude_from_focus = [ %BombComponents, @@ -14,11 +15,14 @@ extends TabContainer var current_slot_idx = 0 +var character_empty_slot: TextureButton + func _ready(): hide() self._ready_bombs() + self._ready_character() self._ready_system() var tabs = get_children() @@ -37,12 +41,13 @@ func _input(event: InputEvent): else: # game is running self.open_menu() - if event.is_action_pressed("ui_menu_left"): - if get_current_tab() > 0: - set_current_tab(get_current_tab() - 1) - if event.is_action_pressed("ui_menu_right"): - if get_current_tab() < get_tab_count() - 1: - set_current_tab(get_current_tab() + 1) + if self.visible: + if event.is_action_pressed("ui_menu_left"): + if get_current_tab() > 0: + set_current_tab(get_current_tab() - 1) + if event.is_action_pressed("ui_menu_right"): + if get_current_tab() < get_tab_count() - 1: + set_current_tab(get_current_tab() + 1) tab_changed.connect(func(tab_idx): focused_tab = tab_idx @@ -140,6 +145,37 @@ func _on_bomb_components_item_selected(idx): $Bombs/Panel/HBoxContainer/VBoxContainer3/VBoxContainer.get_node("Slot" + str(current_slot_idx+1)).text = Bomb.COMPONENT_TYPE.find_key(idx).capitalize() +### Character ### + + +func _ready_character(): + ## Set $Main/$Main to current character + ## TODO + + + ## Add Slots to $Collaborations + character_empty_slot = $Character/Panel/HBoxContainer/Collaborations/TextureButton.duplicate() + $Character/Panel/HBoxContainer/Collaborations.remove_child($Character/Panel/HBoxContainer/Collaborations/TextureButton) + + var base_slot = character_empty_slot.duplicate() + for idx in range(Global.collaboration_slots): + var slot: TextureButton = base_slot.duplicate() + slot.name = "Slot" + str(idx) + + if Global.selected_collaborations.has(idx): + slot.modulate = Color(1, 1, 1, 1) + slot.texture_normal = PlaceholderTexture2D.new() + slot.texture_normal = load("res://.godot/imported/UsadaPekora_Full.png-de55b1ee87c19101262c28a2200b6697.ctex") + + $Character/Panel/HBoxContainer/Collaborations.add_child(slot) + + focused_tab_elements[1] = $Character/Panel/HBoxContainer/Collaborations.get_child(0) + + + ## Set $Preview/$Collaboration to empty? to all? to first slot? + ## TODO + + ### System ### diff --git a/Scenes/UI/Menu.tscn b/Scenes/UI/Menu.tscn index e7c7b13..ab92f55 100644 --- a/Scenes/UI/Menu.tscn +++ b/Scenes/UI/Menu.tscn @@ -1,12 +1,9 @@ -[gd_scene load_steps=9 format=3 uid="uid://d3xrwsv32hs6k"] +[gd_scene load_steps=14 format=3 uid="uid://d3xrwsv32hs6k"] +[ext_resource type="Theme" uid="uid://b2pl6wu7l374w" path="res://Assets/menu.tres" id="1_eiufb"] [ext_resource type="Script" path="res://Scenes/UI/Menu.gd" id="1_vwah3"] - -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_flq5r"] -bg_color = Color(0, 0, 0, 0.784314) - -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_u0ugs"] -bg_color = Color(0, 0, 0, 0.784314) +[ext_resource type="Texture2D" uid="uid://dnbua23k1tebk" path="res://Assets/Character/Selection/UsadaPekora_Full.png" id="3_lsf3i"] +[ext_resource type="Texture2D" uid="uid://cgn6t2kb62i7g" path="res://Assets/Character/Selection/NinomaeInanis_Full.png" id="4_dsw5i"] [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_p483f"] @@ -19,71 +16,86 @@ font_size = 5 [sub_resource type="LabelSettings" id="LabelSettings_qokw0"] font_size = 5 +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_1jm7g"] + +[sub_resource type="CanvasTexture" id="CanvasTexture_i7n8u"] + +[sub_resource type="CanvasTexture" id="CanvasTexture_y7u1n"] + +[sub_resource type="CanvasTexture" id="CanvasTexture_mkkyb"] + [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_7at3v"] -[node name="TabContainer" type="TabContainer"] -process_mode = 3 +[node name="MarginContainer" type="MarginContainer"] anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 -theme_override_font_sizes/font_size = 5 -theme_override_styles/panel = SubResource("StyleBoxFlat_flq5r") -theme_override_styles/tabbar_background = SubResource("StyleBoxFlat_u0ugs") +theme_override_constants/margin_left = 10 +theme_override_constants/margin_top = 10 +theme_override_constants/margin_right = 10 +theme_override_constants/margin_bottom = 10 + +[node name="TabContainer" type="TabContainer" parent="."] +process_mode = 3 +layout_mode = 2 +theme = ExtResource("1_eiufb") +current_tab = 1 clip_tabs = false tab_focus_mode = 0 script = ExtResource("1_vwah3") -[node name="Bombs" type="MarginContainer" parent="."] +[node name="Bombs" type="MarginContainer" parent="TabContainer"] +visible = false 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="Panel" type="Panel" parent="Bombs"] +[node name="Panel" type="Panel" parent="TabContainer/Bombs"] layout_mode = 2 theme_override_styles/panel = SubResource("StyleBoxEmpty_p483f") -[node name="HBoxContainer" type="HBoxContainer" parent="Bombs/Panel"] +[node name="HBoxContainer" type="HBoxContainer" parent="TabContainer/Bombs/Panel"] layout_mode = 1 offset_right = 89.0 offset_bottom = 78.0 -[node name="VBoxContainer" type="VBoxContainer" parent="Bombs/Panel/HBoxContainer"] +[node name="VBoxContainer" type="VBoxContainer" parent="TabContainer/Bombs/Panel/HBoxContainer"] layout_mode = 2 -[node name="Label" type="Label" parent="Bombs/Panel/HBoxContainer/VBoxContainer"] +[node name="Label" type="Label" parent="TabContainer/Bombs/Panel/HBoxContainer/VBoxContainer"] layout_mode = 2 text = "Type" label_settings = SubResource("LabelSettings_3ht7i") horizontal_alignment = 1 -[node name="ButtonBombNormal" type="Button" parent="Bombs/Panel/HBoxContainer/VBoxContainer"] +[node name="ButtonBombNormal" type="Button" parent="TabContainer/Bombs/Panel/HBoxContainer/VBoxContainer"] layout_mode = 2 theme_override_font_sizes/font_size = 4 text = "Normal" -[node name="ButtonBombBreakables" type="Button" parent="Bombs/Panel/HBoxContainer/VBoxContainer"] +[node name="ButtonBombBreakables" type="Button" parent="TabContainer/Bombs/Panel/HBoxContainer/VBoxContainer"] layout_mode = 2 theme_override_font_sizes/font_size = 4 text = "Breakables" -[node name="Space" type="Control" parent="Bombs/Panel/HBoxContainer"] +[node name="Space" type="Control" parent="TabContainer/Bombs/Panel/HBoxContainer"] layout_mode = 2 size_flags_horizontal = 3 -[node name="VBoxContainer2" type="VBoxContainer" parent="Bombs/Panel/HBoxContainer"] +[node name="VBoxContainer2" type="VBoxContainer" parent="TabContainer/Bombs/Panel/HBoxContainer"] layout_mode = 2 -[node name="Label" type="Label" parent="Bombs/Panel/HBoxContainer/VBoxContainer2"] +[node name="Label" type="Label" parent="TabContainer/Bombs/Panel/HBoxContainer/VBoxContainer2"] layout_mode = 2 text = "Power" label_settings = SubResource("LabelSettings_s4847") horizontal_alignment = 1 -[node name="BombPower" type="ItemList" parent="Bombs/Panel/HBoxContainer/VBoxContainer2"] +[node name="BombPower" type="ItemList" parent="TabContainer/Bombs/Panel/HBoxContainer/VBoxContainer2"] layout_mode = 2 theme_override_font_sizes/font_size = 4 auto_height = true @@ -93,15 +105,15 @@ item_1/text = "3" item_2/text = "4" item_3/text = "5" -[node name="VBoxContainer3" type="VBoxContainer" parent="Bombs/Panel/HBoxContainer"] +[node name="VBoxContainer3" type="VBoxContainer" parent="TabContainer/Bombs/Panel/HBoxContainer"] layout_mode = 2 -[node name="Label" type="Label" parent="Bombs/Panel/HBoxContainer/VBoxContainer3"] +[node name="Label" type="Label" parent="TabContainer/Bombs/Panel/HBoxContainer/VBoxContainer3"] layout_mode = 2 text = "Components" label_settings = SubResource("LabelSettings_qokw0") -[node name="BombComponents" type="ItemList" parent="Bombs/Panel/HBoxContainer/VBoxContainer3"] +[node name="BombComponents" type="ItemList" parent="TabContainer/Bombs/Panel/HBoxContainer/VBoxContainer3"] visible = false layout_mode = 2 theme_override_font_sizes/font_size = 4 @@ -116,29 +128,29 @@ item_2/text = "RemoteDetonate" item_3/text = "Water" item_4/text = "Salt" -[node name="VBoxContainer" type="VBoxContainer" parent="Bombs/Panel/HBoxContainer/VBoxContainer3"] +[node name="VBoxContainer" type="VBoxContainer" parent="TabContainer/Bombs/Panel/HBoxContainer/VBoxContainer3"] layout_mode = 2 size_flags_vertical = 3 -[node name="Slot1" type="Button" parent="Bombs/Panel/HBoxContainer/VBoxContainer3/VBoxContainer"] +[node name="Slot1" type="Button" parent="TabContainer/Bombs/Panel/HBoxContainer/VBoxContainer3/VBoxContainer"] layout_mode = 2 theme_override_font_sizes/font_size = 4 text = "Empty" flat = true -[node name="Slot2" type="Button" parent="Bombs/Panel/HBoxContainer/VBoxContainer3/VBoxContainer"] +[node name="Slot2" type="Button" parent="TabContainer/Bombs/Panel/HBoxContainer/VBoxContainer3/VBoxContainer"] layout_mode = 2 theme_override_font_sizes/font_size = 4 text = "Empty" flat = true -[node name="Slot3" type="Button" parent="Bombs/Panel/HBoxContainer/VBoxContainer3/VBoxContainer"] +[node name="Slot3" type="Button" parent="TabContainer/Bombs/Panel/HBoxContainer/VBoxContainer3/VBoxContainer"] layout_mode = 2 theme_override_font_sizes/font_size = 4 text = "Empty" flat = true -[node name="MarginContainer" type="MarginContainer" parent="Bombs/Panel"] +[node name="MarginContainer" type="MarginContainer" parent="TabContainer/Bombs/Panel"] layout_mode = 2 offset_right = 232.0 offset_bottom = 136.0 @@ -149,10 +161,10 @@ theme_override_constants/margin_top = 10 theme_override_constants/margin_right = 10 theme_override_constants/margin_bottom = 10 -[node name="CenterContainer" type="CenterContainer" parent="Bombs/Panel/MarginContainer"] +[node name="CenterContainer" type="CenterContainer" parent="TabContainer/Bombs/Panel/MarginContainer"] layout_mode = 2 -[node name="BombComponents" type="ItemList" parent="Bombs/Panel/MarginContainer/CenterContainer"] +[node name="BombComponents" type="ItemList" parent="TabContainer/Bombs/Panel/MarginContainer/CenterContainer"] unique_name_in_owner = true visible = false custom_minimum_size = Vector2(50, 0) @@ -162,7 +174,70 @@ auto_height = true text_overrun_behavior = 0 fixed_column_width = 500 -[node name="System" type="MarginContainer" parent="."] +[node name="Character" type="MarginContainer" parent="TabContainer"] +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="Panel" type="Panel" parent="TabContainer/Character"] +layout_mode = 2 +theme_override_styles/panel = SubResource("StyleBoxEmpty_1jm7g") + +[node name="HBoxContainer" type="HBoxContainer" parent="TabContainer/Character/Panel"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="Main" type="VBoxContainer" parent="TabContainer/Character/Panel/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 8 + +[node name="Main" type="TextureRect" parent="TabContainer/Character/Panel/HBoxContainer/Main"] +layout_mode = 2 +texture = ExtResource("3_lsf3i") +expand_mode = 4 +stretch_mode = 5 + +[node name="Circle" type="TextureRect" parent="TabContainer/Character/Panel/HBoxContainer/Main"] +self_modulate = Color(0, 0, 0, 0.490196) +layout_mode = 2 +texture = SubResource("CanvasTexture_i7n8u") + +[node name="Collaborations" type="VBoxContainer" parent="TabContainer/Character/Panel/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="TextureButton" type="TextureButton" parent="TabContainer/Character/Panel/HBoxContainer/Collaborations"] +modulate = Color(0, 0, 0, 0.490196) +layout_mode = 2 +size_flags_vertical = 3 +texture_normal = SubResource("CanvasTexture_y7u1n") +ignore_texture_size = true +stretch_mode = 5 + +[node name="Preview" type="VBoxContainer" parent="TabContainer/Character/Panel/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 8 + +[node name="Collaboration" type="TextureRect" parent="TabContainer/Character/Panel/HBoxContainer/Preview"] +layout_mode = 2 +texture = ExtResource("4_dsw5i") +expand_mode = 5 +stretch_mode = 5 + +[node name="Circle" type="TextureRect" parent="TabContainer/Character/Panel/HBoxContainer/Preview"] +self_modulate = Color(0, 0, 0, 0.490196) +layout_mode = 2 +texture = SubResource("CanvasTexture_mkkyb") + +[node name="System" type="MarginContainer" parent="TabContainer"] visible = false layout_mode = 2 theme_override_constants/margin_left = 4 @@ -170,11 +245,11 @@ theme_override_constants/margin_top = 4 theme_override_constants/margin_right = 4 theme_override_constants/margin_bottom = 4 -[node name="Panel" type="Panel" parent="System"] +[node name="Panel" type="Panel" parent="TabContainer/System"] layout_mode = 2 theme_override_styles/panel = SubResource("StyleBoxEmpty_7at3v") -[node name="VBoxContainer" type="VBoxContainer" parent="System/Panel"] +[node name="VBoxContainer" type="VBoxContainer" parent="TabContainer/System/Panel"] layout_mode = 1 anchors_preset = 3 anchor_left = 1.0 @@ -186,38 +261,38 @@ offset_top = -34.0 grow_horizontal = 0 grow_vertical = 0 -[node name="ButtonResume" type="Button" parent="System/Panel/VBoxContainer"] +[node name="ButtonResume" type="Button" parent="TabContainer/System/Panel/VBoxContainer"] layout_mode = 2 theme_override_font_sizes/font_size = 4 text = "Resume Game" -[node name="ButtonQuit" type="Button" parent="System/Panel/VBoxContainer"] +[node name="ButtonQuit" type="Button" parent="TabContainer/System/Panel/VBoxContainer"] layout_mode = 2 theme_override_font_sizes/font_size = 4 text = "Quit Game" -[node name="VBoxContainer2" type="VBoxContainer" parent="System/Panel"] +[node name="VBoxContainer2" type="VBoxContainer" parent="TabContainer/System/Panel"] layout_mode = 0 offset_right = 80.0 offset_bottom = 40.0 -[node name="Label" type="Label" parent="System/Panel/VBoxContainer2"] +[node name="Label" type="Label" parent="TabContainer/System/Panel/VBoxContainer2"] layout_mode = 2 theme_override_font_sizes/font_size = 6 text = "Audio" -[node name="SliderVolume" type="HSlider" parent="System/Panel/VBoxContainer2"] +[node name="SliderVolume" type="HSlider" parent="TabContainer/System/Panel/VBoxContainer2"] layout_mode = 2 max_value = 1.0 step = 0.05 -[connection signal="pressed" from="Bombs/Panel/HBoxContainer/VBoxContainer/ButtonBombNormal" to="." method="_on_button_bomb_normal_pressed"] -[connection signal="pressed" from="Bombs/Panel/HBoxContainer/VBoxContainer/ButtonBombBreakables" to="." method="_on_button_bomb_breakables_pressed"] -[connection signal="item_selected" from="Bombs/Panel/HBoxContainer/VBoxContainer2/BombPower" to="." method="_on_bomb_power_item_selected"] -[connection signal="multi_selected" from="Bombs/Panel/HBoxContainer/VBoxContainer3/BombComponents" to="." method="_on_bomb_components_multi_selected"] -[connection signal="pressed" from="Bombs/Panel/HBoxContainer/VBoxContainer3/VBoxContainer/Slot1" to="." method="_on_slot_pressed" binds= [0]] -[connection signal="pressed" from="Bombs/Panel/HBoxContainer/VBoxContainer3/VBoxContainer/Slot2" to="." method="_on_slot_pressed" binds= [1]] -[connection signal="pressed" from="Bombs/Panel/HBoxContainer/VBoxContainer3/VBoxContainer/Slot3" to="." method="_on_slot_pressed" binds= [2]] -[connection signal="pressed" from="System/Panel/VBoxContainer/ButtonResume" to="." method="_on_button_resume_pressed"] -[connection signal="pressed" from="System/Panel/VBoxContainer/ButtonQuit" to="." method="_on_button_quit_pressed"] -[connection signal="value_changed" from="System/Panel/VBoxContainer2/SliderVolume" to="." method="_on_slider_volume_value_changed"] +[connection signal="pressed" from="TabContainer/Bombs/Panel/HBoxContainer/VBoxContainer/ButtonBombNormal" to="TabContainer" method="_on_button_bomb_normal_pressed"] +[connection signal="pressed" from="TabContainer/Bombs/Panel/HBoxContainer/VBoxContainer/ButtonBombBreakables" to="TabContainer" method="_on_button_bomb_breakables_pressed"] +[connection signal="item_selected" from="TabContainer/Bombs/Panel/HBoxContainer/VBoxContainer2/BombPower" to="TabContainer" method="_on_bomb_power_item_selected"] +[connection signal="multi_selected" from="TabContainer/Bombs/Panel/HBoxContainer/VBoxContainer3/BombComponents" to="TabContainer" method="_on_bomb_components_multi_selected"] +[connection signal="pressed" from="TabContainer/Bombs/Panel/HBoxContainer/VBoxContainer3/VBoxContainer/Slot1" to="TabContainer" method="_on_slot_pressed" binds= [0]] +[connection signal="pressed" from="TabContainer/Bombs/Panel/HBoxContainer/VBoxContainer3/VBoxContainer/Slot2" to="TabContainer" method="_on_slot_pressed" binds= [1]] +[connection signal="pressed" from="TabContainer/Bombs/Panel/HBoxContainer/VBoxContainer3/VBoxContainer/Slot3" to="TabContainer" method="_on_slot_pressed" binds= [2]] +[connection signal="pressed" from="TabContainer/System/Panel/VBoxContainer/ButtonResume" to="TabContainer" method="_on_button_resume_pressed"] +[connection signal="pressed" from="TabContainer/System/Panel/VBoxContainer/ButtonQuit" to="TabContainer" method="_on_button_quit_pressed"] +[connection signal="value_changed" from="TabContainer/System/Panel/VBoxContainer2/SliderVolume" to="TabContainer" method="_on_slider_volume_value_changed"] |