amélioration de l'UI de l'inventaire et ajout de la récompense d'amélioration de taille d'inventaire #52
This commit is contained in:
@@ -57,8 +57,8 @@ func generate_objective_rewards(level = 0) -> Array[ObjectiveReward]:
|
||||
|
||||
var possible_objective_rewards_path : Array[ObjectiveReward] = [
|
||||
UpgradePlayerMaxEnergyReward.new(),
|
||||
RechargePlayerReward.new(randi_range(level + 1, (level + 1) * 2)),
|
||||
LootRandomSeedsReward.new(randi_range(level + 1, (level + 1) * 2))
|
||||
UpgradePlayerInventorySizeReward.new(),
|
||||
LootRandomSeedsReward.new(randi_range(4+level, 6+level))
|
||||
]
|
||||
|
||||
var objectives_reward : Array[ObjectiveReward] = []
|
||||
|
||||
1
common/icons/backpack.svg
Normal file
1
common/icons/backpack.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-backpack"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M5 18v-6a6 6 0 0 1 6 -6h2a6 6 0 0 1 6 6v6a3 3 0 0 1 -3 3h-8a3 3 0 0 1 -3 -3z" /><path d="M10 6v-1a2 2 0 1 1 4 0v1" /><path d="M9 21v-4a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v4" /><path d="M11 10h2" /></svg>
|
||||
|
After Width: | Height: | Size: 511 B |
43
common/icons/backpack.svg.import
Normal file
43
common/icons/backpack.svg.import
Normal file
@@ -0,0 +1,43 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c3f2f1w12afnu"
|
||||
path="res://.godot/imported/backpack.svg-87b1145524d28fbb61259964722c7305.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://common/icons/backpack.svg"
|
||||
dest_files=["res://.godot/imported/backpack.svg-87b1145524d28fbb61259964722c7305.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=1.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
@@ -4,10 +4,13 @@ class_name Inventory
|
||||
signal inventory_changed(inventory: Inventory)
|
||||
|
||||
@export var items: Array[Item] = []
|
||||
@export var max_items: int = 3
|
||||
@export var size: int = 3
|
||||
|
||||
var current_item_ind: int = 0
|
||||
|
||||
func _init(_inventory_size : int = 1):
|
||||
size = _inventory_size
|
||||
|
||||
func set_current_item(new_ind: int):
|
||||
if new_ind >= length():
|
||||
return
|
||||
@@ -27,7 +30,7 @@ func change_current_item(ind_mod: int):
|
||||
set_current_item(new_ind)
|
||||
|
||||
func add_item(item: Item):
|
||||
if items.size() < max_items:
|
||||
if items.size() < size:
|
||||
items.append(item)
|
||||
emit_signal("inventory_changed", self)
|
||||
return true
|
||||
@@ -37,13 +40,13 @@ func add_item(item: Item):
|
||||
func add_items(items_to_add: Array[Item], fillup: bool = false):
|
||||
if fillup:
|
||||
var has_changed := false
|
||||
for i in min(items_to_add.size(), max_items - items.size()):
|
||||
for i in min(items_to_add.size(), size - items.size()):
|
||||
items.append(items_to_add[i])
|
||||
has_changed = true
|
||||
if has_changed:
|
||||
emit_signal("inventory_changed", self)
|
||||
return has_changed
|
||||
elif !fillup && items.size() + items_to_add.size() < max_items:
|
||||
elif !fillup && items.size() + items_to_add.size() < size:
|
||||
items.append_array(items_to_add)
|
||||
emit_signal("inventory_changed", self)
|
||||
return true
|
||||
@@ -52,7 +55,7 @@ func length() -> int:
|
||||
return len(items)
|
||||
|
||||
func set_item(item: Item, ind: int = 0) -> bool:
|
||||
if ind >= max_items:
|
||||
if ind >= size:
|
||||
return false
|
||||
while len(items) <= ind:
|
||||
items.append(null)
|
||||
|
||||
Reference in New Issue
Block a user