diff options
Diffstat (limited to 'Scenes/UI/Menu.gd')
-rw-r--r-- | Scenes/UI/Menu.gd | 50 |
1 files changed, 43 insertions, 7 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 ### |