feat: 2.3.2

This commit is contained in:
2026-05-19 17:30:29 +08:00
parent 7ca11c6534
commit 8430d1054e
39 changed files with 6581 additions and 738 deletions
+53 -3
View File
@@ -247,6 +247,30 @@ func _on_category_tab_pressed(category: String) -> void:
_highlight_active_tab()
func _highlight_active_tab() -> void:
# Create active tab style (dark blue)
var active_style := StyleBoxFlat.new()
active_style.bg_color = Color(0.1, 0.19, 0.27, 1)
active_style.content_margin_left = 12.0
active_style.content_margin_top = 8.0
active_style.content_margin_right = 12.0
active_style.content_margin_bottom = 8.0
active_style.corner_radius_top_left = 8
active_style.corner_radius_top_right = 8
active_style.corner_radius_bottom_right = 8
active_style.corner_radius_bottom_left = 8
# Create inactive tab style (cyan)
var inactive_style := StyleBoxFlat.new()
inactive_style.bg_color = Color(0.33, 0.62, 0.78, 1)
inactive_style.content_margin_left = 12.0
inactive_style.content_margin_top = 8.0
inactive_style.content_margin_right = 12.0
inactive_style.content_margin_bottom = 8.0
inactive_style.corner_radius_top_left = 8
inactive_style.corner_radius_top_right = 8
inactive_style.corner_radius_bottom_right = 8
inactive_style.corner_radius_bottom_left = 8
var map := {
"head": head_tab_btn,
"costume": costume_tab_btn,
@@ -255,7 +279,13 @@ func _highlight_active_tab() -> void:
"fragment": frag_tab_btn
}
for cat: String in map:
(map[cat] as Button).modulate = Color(1.3, 1.3, 0.4, 1) if cat == _current_category else Color.WHITE
var btn: Button = map[cat]
var is_active := (cat == _current_category)
var style := active_style if is_active else inactive_style
btn.add_theme_stylebox_override("normal", style)
btn.add_theme_stylebox_override("hover", style)
btn.add_theme_stylebox_override("pressed", style)
btn.add_theme_color_override("font_color", Color.WHITE)
func _rebuild_category_items() -> void:
_category_items.clear()
@@ -306,6 +336,8 @@ func _populate_item_grid() -> void:
prev_page_btn.disabled = (_current_page == 0)
next_page_btn.disabled = ((_current_page + 1) >= total_pages)
var placeholder_tex = preload("res://assets/graphics/gui/inventory/item_placeholder.png")
var equipped: String = UserProfileManager.loadout.get(_current_category, "")
for i in _item_slots.size():
var slot: Button = _item_slots[i]
@@ -313,11 +345,22 @@ func _populate_item_grid() -> void:
if idx < total:
var item_id: String = _category_items[idx]
var info: Dictionary = ITEM_CATALOG.get(item_id, {})
slot.text = info.get("name", item_id)
slot.tooltip_text = item_id
var tex_path = "res://assets/graphics/gui/inventory/%s.png" % item_id
if ResourceLoader.exists(tex_path):
slot.icon = load(tex_path)
else:
slot.icon = placeholder_tex
slot.text = ""
slot.tooltip_text = info.get("name", item_id)
slot.icon_alignment = HORIZONTAL_ALIGNMENT_CENTER
slot.expand_icon = true
slot.modulate = Color(0.4, 1.0, 0.4, 1) if item_id == equipped else Color.WHITE
else:
slot.text = ""
slot.icon = null
slot.tooltip_text = ""
slot.modulate = Color.WHITE
@@ -331,6 +374,12 @@ func _on_slot_pressed(slot_index: int) -> void:
func _show_item_info(item_id: String) -> void:
var info: Dictionary = ITEM_CATALOG.get(item_id, {})
var tex_path = "res://assets/graphics/gui/inventory/%s.png" % item_id
if ResourceLoader.exists(tex_path):
item_preview.texture = load(tex_path)
else:
item_preview.texture = preload("res://assets/graphics/gui/inventory/item_placeholder.png")
item_name_label.text = info.get("name", item_id)
var rarity: String = info.get("rarity", "Common")
@@ -353,6 +402,7 @@ func _show_item_info(item_id: String) -> void:
func _clear_item_info() -> void:
item_name_label.text = "Select an item"
item_preview.texture = null
item_rarity_label.text = ""
item_price_label.text = ""
equip_btn.text = "Equip"