Restore catch quality inventory styling
This commit is contained in:
parent
8b13ba1d7d
commit
4dc87235ec
4 changed files with 141 additions and 11 deletions
|
|
@ -62,6 +62,7 @@ func _run() -> void:
|
|||
fish_catch.sale_value = Bluegill.get_sale_value_for_weight(
|
||||
fish_catch.weight_lb
|
||||
)
|
||||
fish_catch.quality = FishQuality.Tier.IMPRESSIVE
|
||||
assert(catches.add_catch(fish_catch))
|
||||
assert(layout.get_inventory_count() == 2)
|
||||
assert(layout.move_entry_to_first_free(
|
||||
|
|
@ -106,8 +107,53 @@ func _run() -> void:
|
|||
== Color(UtilityPageStyle.OCEAN_SELECTED, 0.92)
|
||||
)
|
||||
staged_slot.set_staged(false)
|
||||
var quality_slot := GeneralInventorySlot.new()
|
||||
root.add_child(quality_slot)
|
||||
quality_slot.set_presentation_size(Vector2(78.0, 78.0))
|
||||
quality_slot.configure(
|
||||
0,
|
||||
PlayerInventoryLayout.InventoryContainer.STORAGE,
|
||||
false,
|
||||
layout,
|
||||
bag,
|
||||
catches,
|
||||
hotbar,
|
||||
ItemCatalogResource,
|
||||
)
|
||||
assert(quality_slot.entry_identity == fish_catch.catch_id)
|
||||
assert(
|
||||
(quality_slot.get_theme_stylebox("normal") as StyleBoxFlat).bg_color
|
||||
== GeneralInventorySlot.quality_background_color(
|
||||
FishQuality.Tier.IMPRESSIVE,
|
||||
GeneralInventorySlot.QualityEmphasis.NORMAL,
|
||||
)
|
||||
)
|
||||
quality_slot.set_staged(true)
|
||||
assert(
|
||||
(quality_slot.get_theme_stylebox("normal") as StyleBoxFlat).bg_color
|
||||
== GeneralInventorySlot.quality_background_color(
|
||||
FishQuality.Tier.IMPRESSIVE,
|
||||
GeneralInventorySlot.QualityEmphasis.SELECTED,
|
||||
)
|
||||
)
|
||||
var distinct_quality_colors: Dictionary[Color, bool] = {}
|
||||
for quality: int in FishQuality.TIER_COUNT:
|
||||
var quality_color := GeneralInventorySlot.quality_background_color(
|
||||
quality,
|
||||
GeneralInventorySlot.QualityEmphasis.NORMAL,
|
||||
)
|
||||
assert(not distinct_quality_colors.has(quality_color))
|
||||
distinct_quality_colors[quality_color] = true
|
||||
assert(distinct_quality_colors.size() == FishQuality.TIER_COUNT)
|
||||
var sale_tray_slot := ShopSaleTraySlot.new()
|
||||
root.add_child(sale_tray_slot)
|
||||
sale_tray_slot.configure(
|
||||
"catch:%s" % fish_catch.catch_id,
|
||||
fish_catch.fish.display_texture,
|
||||
fish_catch.fish.display_name,
|
||||
1,
|
||||
fish_catch.quality,
|
||||
)
|
||||
assert(
|
||||
sale_tray_slot.custom_minimum_size
|
||||
== GeneralInventoryGrid.DEFAULT_SLOT_SIZE
|
||||
|
|
@ -117,6 +163,14 @@ func _run() -> void:
|
|||
) as StyleBoxFlat
|
||||
assert(sale_tray_style != null)
|
||||
assert(sale_tray_style.corner_radius_top_left == 26)
|
||||
var expected_tray_quality_color := (
|
||||
GeneralInventorySlot.quality_background_color(
|
||||
FishQuality.Tier.IMPRESSIVE,
|
||||
GeneralInventorySlot.QualityEmphasis.NORMAL,
|
||||
)
|
||||
)
|
||||
expected_tray_quality_color.a = 0.96
|
||||
assert(sale_tray_style.bg_color == expected_tray_quality_color)
|
||||
var wallet := PlayerWallet.new()
|
||||
root.add_child(wallet)
|
||||
assert(wallet.restore_balance(15000))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue