diff --git a/prefab/entitys/BlackenedAboriginalWarrior.tscn b/prefab/entitys/BlackenedAboriginalWarrior.tscn
index ef209c7..67ceb30 100644
--- a/prefab/entitys/BlackenedAboriginalWarrior.tscn
+++ b/prefab/entitys/BlackenedAboriginalWarrior.tscn
@@ -33,13 +33,10 @@ radius = 172.29
collision_layer = 64
collision_mask = 38
script = ExtResource("1_ubaid")
-InitWeaponRes = null
CharacterName = "character_evil_crow"
CanMutateAfterDeath = false
-_initialHp = null
MaxHp = 50
CampId = "Mazoku"
-LootListId = null
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(2, 10)
diff --git a/prefab/entitys/Character.tscn b/prefab/entitys/Character.tscn
index f61d783..0ab5716 100644
--- a/prefab/entitys/Character.tscn
+++ b/prefab/entitys/Character.tscn
@@ -29,12 +29,8 @@ collision_mask = 162
platform_floor_layers = 4294967042
platform_wall_layers = 128
script = ExtResource("1_1dlls")
-CharacterName = null
-CanMutateAfterDeath = null
-_initialHp = null
MaxHp = 32
CampId = "Default"
-LootListId = null
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CapsuleShape2D_bb8wt")
diff --git a/prefab/entitys/DelivererOfDarkMagic.tscn b/prefab/entitys/DelivererOfDarkMagic.tscn
index ab3d4a4..e575760 100644
--- a/prefab/entitys/DelivererOfDarkMagic.tscn
+++ b/prefab/entitys/DelivererOfDarkMagic.tscn
@@ -34,10 +34,8 @@ radius = 172.29
collision_layer = 64
collision_mask = 38
script = ExtResource("1_ubaid")
-InitWeaponRes = null
CharacterName = "character_necromancer"
CanMutateAfterDeath = false
-_initialHp = null
MaxHp = 50
CampId = "Mazoku"
LootListId = "test"
diff --git a/prefab/furnitures/SpellEditor.tscn b/prefab/furnitures/SpellEditor.tscn
index 83be201..f2695c9 100644
--- a/prefab/furnitures/SpellEditor.tscn
+++ b/prefab/furnitures/SpellEditor.tscn
@@ -92,8 +92,6 @@ collision_layer = 256
collision_mask = 160
script = ExtResource("1_t1qdg")
Path = "res://prefab/ui/SpellEditorUI.tscn"
-_initialDurability = null
-_maxDurability = null
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(-0.5, -0.5)
diff --git a/prefab/furnitures/WoodenBox.tscn b/prefab/furnitures/WoodenBox.tscn
index 4992a16..70d6f12 100644
--- a/prefab/furnitures/WoodenBox.tscn
+++ b/prefab/furnitures/WoodenBox.tscn
@@ -13,7 +13,6 @@ radius = 52.6118
collision_layer = 256
collision_mask = 160
script = ExtResource("1_hfnuj")
-_initialDurability = null
_maxDurability = 1
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
diff --git a/prefab/items/resignationCertificate.tscn b/prefab/items/resignationCertificate.tscn
index dbb80e8..99a037a 100644
--- a/prefab/items/resignationCertificate.tscn
+++ b/prefab/items/resignationCertificate.tscn
@@ -18,9 +18,6 @@ collision_mask = 34
angular_damp = -1.0
script = ExtResource("1_nydte")
FiringIntervalAsMillisecond = 1000
-_recoilStrength = null
-_minContactInjury = null
-_maxContactInjury = null
[node name="DamageArea2D" type="Area2D" parent="."]
collision_layer = 8
diff --git a/prefab/magics/curse.tscn b/prefab/magics/curse.tscn
index e81c103..4b9f97d 100644
--- a/prefab/magics/curse.tscn
+++ b/prefab/magics/curse.tscn
@@ -16,9 +16,6 @@ collision_mask = 34
angular_damp = -1.0
script = ExtResource("1_gg5rs")
_packedScenePath = "res://prefab/entitys/BlackenedAboriginalWarrior.tscn"
-_projectilePath = null
-_minContactInjury = null
-_maxContactInjury = null
[node name="DamageArea2D" type="Area2D" parent="."]
collision_layer = 8
diff --git a/prefab/magics/x3.tscn b/prefab/magics/x3.tscn
index e9db64b..2a136dd 100644
--- a/prefab/magics/x3.tscn
+++ b/prefab/magics/x3.tscn
@@ -15,12 +15,6 @@ collision_layer = 8
collision_mask = 34
angular_damp = -1.0
script = ExtResource("1_cnhod")
-NumberOfProjectiles = null
-RandomAngle = null
-UnitRadian = null
-_projectilePath = null
-_minContactInjury = null
-_maxContactInjury = null
[node name="DamageArea2D" type="Area2D" parent="."]
collision_layer = 8
diff --git a/prefab/packsacks/PortableBackpacks.tscn b/prefab/packsacks/PortableBackpacks.tscn
index 5e54ca6..0e0dff1 100644
--- a/prefab/packsacks/PortableBackpacks.tscn
+++ b/prefab/packsacks/PortableBackpacks.tscn
@@ -14,8 +14,6 @@ collision_layer = 8
collision_mask = 38
script = ExtResource("1_slakl")
NumberSlots = 30
-_minContactInjury = null
-_maxContactInjury = null
[node name="DamageArea2D" type="Area2D" parent="."]
collision_layer = 8
diff --git a/prefab/roomTemplates/dungeon/chest.tscn b/prefab/roomTemplates/dungeon/chest.tscn
index 216e2fc..b728ccd 100644
--- a/prefab/roomTemplates/dungeon/chest.tscn
+++ b/prefab/roomTemplates/dungeon/chest.tscn
@@ -23,7 +23,7 @@ polygons = Array[PackedInt32Array]([PackedInt32Array(0, 1, 2, 3), PackedInt32Arr
outlines = Array[PackedVector2Array]([PackedVector2Array(479, 34, 228, 32, 226, 1, 159, 1, 160, 31, 32, 35, 33, 97, 1, 97, -1, 162, 512, 160, 509, 96, 480, 97)])
source_geometry_group_name = &"navigation_polygon_source_group"
-[node name="InitialRoom" type="Node2D"]
+[node name="InitialRoom2" type="Node2D"]
[node name="RoomArea" type="Area2D" parent="."]
collision_mask = 0
@@ -89,5 +89,3 @@ texture = ExtResource("3_r2p3x")
[node name="RigidBody2D" parent="." instance=ExtResource("4_rean8")]
position = Vector2(239, 101)
-_initialDurability = null
-_maxDurability = null
diff --git a/prefab/roomTemplates/dungeon/horizontalCorridorWithSewer.tscn b/prefab/roomTemplates/dungeon/horizontalCorridorWithSewer.tscn
index b81de89..99600f1 100644
--- a/prefab/roomTemplates/dungeon/horizontalCorridorWithSewer.tscn
+++ b/prefab/roomTemplates/dungeon/horizontalCorridorWithSewer.tscn
@@ -55,7 +55,6 @@ shape = SubResource("RectangleShape2D_131jn")
[node name="Marker2D" type="Marker2D" parent="."]
position = Vector2(237, 69)
script = ExtResource("2_7q101")
-ResPath = null
metadata/ResPath = "res://prefab/entitys/DelivererOfDarkMagic.tscn"
[node name="NavigationRegion2D" type="NavigationRegion2D" parent="."]
diff --git a/prefab/roomTemplates/tutorials/spellEditor.tscn b/prefab/roomTemplates/tutorials/spellEditor.tscn
index 2fd3228..fead826 100644
--- a/prefab/roomTemplates/tutorials/spellEditor.tscn
+++ b/prefab/roomTemplates/tutorials/spellEditor.tscn
@@ -20,7 +20,7 @@ polygons = Array[PackedInt32Array]([PackedInt32Array(0, 1, 2, 3), PackedInt32Arr
outlines = Array[PackedVector2Array]([PackedVector2Array(36, 32, 731, 32, 733, 258, 766, 257, 767, 316, 35, 317)])
source_geometry_group_name = &"navigation_polygon_source_group"
-[node name="InitialRoom" type="Node2D"]
+[node name="InitialRoom3" type="Node2D"]
[node name="RoomArea" type="Area2D" parent="."]
@@ -103,8 +103,6 @@ texture = ExtResource("6_dbg76")
[node name="RigidBody2D" parent="." instance=ExtResource("5_0kep0")]
position = Vector2(227, 283)
-_initialDurability = null
-_maxDurability = null
[node name="WoodenBox" parent="." instance=ExtResource("7_jybe6")]
position = Vector2(715, 244)
diff --git a/prefab/roomTemplates/tutorials/tripleShotSpell.tscn b/prefab/roomTemplates/tutorials/tripleShotSpell.tscn
index 481eab3..a340d0a 100644
--- a/prefab/roomTemplates/tutorials/tripleShotSpell.tscn
+++ b/prefab/roomTemplates/tutorials/tripleShotSpell.tscn
@@ -125,8 +125,6 @@ position = Vector2(711, 98)
[node name="RigidBody2D" parent="." instance=ExtResource("5_ll4ng")]
position = Vector2(473, 285)
-_initialDurability = null
-_maxDurability = null
[node name="TripleShotSpell" type="Sprite2D" parent="."]
position = Vector2(637, 85)
diff --git a/prefab/weapons/IronAxe.tscn b/prefab/weapons/IronAxe.tscn
index b6d8f34..f17afba 100644
--- a/prefab/weapons/IronAxe.tscn
+++ b/prefab/weapons/IronAxe.tscn
@@ -18,12 +18,6 @@ collision_layer = 8
collision_mask = 34
angular_damp = -1.0
script = ExtResource("1_snmy1")
-_maxDamage = null
-_minDamage = null
-FiringIntervalAsMillisecond = null
-_recoilStrength = null
-_minContactInjury = null
-_maxContactInjury = null
[node name="DamageArea2D" type="Area2D" parent="."]
collision_layer = 8
diff --git a/prefab/weapons/StaffNecromancy.tscn b/prefab/weapons/StaffNecromancy.tscn
index edb87d5..1397579 100644
--- a/prefab/weapons/StaffNecromancy.tscn
+++ b/prefab/weapons/StaffNecromancy.tscn
@@ -21,8 +21,6 @@ _fireSequentially = true
FiringIntervalAsMillisecond = 300
_recoilStrength = 5
UniqueIcon = ExtResource("3_31iau")
-_minContactInjury = null
-_maxContactInjury = null
[node name="DamageArea2D" type="Area2D" parent="."]
collision_layer = 8
diff --git a/scripts/inventory/UniversalItemContainer.cs b/scripts/inventory/UniversalItemContainer.cs
index 179058e..4bf48d2 100644
--- a/scripts/inventory/UniversalItemContainer.cs
+++ b/scripts/inventory/UniversalItemContainer.cs
@@ -23,16 +23,6 @@ public class UniversalItemContainer(int totalCapacity) : IItemContainer
//_selectIndex默认为0.
private int _selectIndex;
- ///
- /// The next available index
- /// 下个可用的索引
- ///
- ///
- ///For example, the variable [1,2,3,5,6] represents 4, or the variable [1,2,3,4,5,6,7] represents 8.
- ///例如[1,2,3,5,6]这个变量表示4,再或者[1,2,3,4,5,6,7]这个变量表示8。
- ///
- private int _nextAvailableIndex;
-
///
/// The type of item that can be added to the item container
/// 物品容器允许添加的物品类型
@@ -132,34 +122,41 @@ public class UniversalItemContainer(int totalCapacity) : IItemContainer
/// Update the next available index location
/// 更新下个可用的索引位置
///
- private void UpdateNextAvailableIndex()
+ ///
+ ///For example, the variable [1,2,3,5,6] represents 4, or the variable [1,2,3,4,5,6,7] represents 8.
+ ///例如[1,2,3,5,6]这个变量表示4,再或者[1,2,3,4,5,6,7]这个变量表示8。
+ ///
+ ///
+ ///The next available index is returned after obtaining failure
+ ///下次可用的索引,获取失败返回
+ ///
+ private int GetNextAvailableIndex()
{
- _nextAvailableIndex = UnknownIndex;
if (totalCapacity <= 0)
{
- return;
+ return UnknownIndex;
}
for (var i = 0; i < totalCapacity; i++)
{
var contains = _itemDictionary.ContainsKey(i);
if (!contains)
{
- _nextAvailableIndex = i;
- return;
+ return i;
}
}
+ return UnknownIndex;
}
public int AddItem(IItem item)
{
+ var nextAvailableIndex = GetNextAvailableIndex();
if (item.MaxQuantity == 1)
{
- if (_nextAvailableIndex == UnknownIndex)
+ if (nextAvailableIndex == UnknownIndex)
{
return 0;
}
- var nextAvailableIndex = _nextAvailableIndex;
_itemDictionary[nextAvailableIndex] = item;
item.Index = nextAvailableIndex;
item.ItemContainer = this;
@@ -167,7 +164,6 @@ public class UniversalItemContainer(int totalCapacity) : IItemContainer
{
item.HideSelf();
}
- UpdateNextAvailableIndex();
UpdateSelectStatus(nextAvailableIndex, item);
ItemDataChangeEvent?.Invoke(new ItemDataChangeEvent
{
@@ -221,24 +217,22 @@ public class UniversalItemContainer(int totalCapacity) : IItemContainer
//Add the rest to the container.
//添加剩余到容器内。
- if (_nextAvailableIndex == UnknownIndex)
+ if (nextAvailableIndex == UnknownIndex)
{
return 0;
}
- var finalNextAvailableIndex = _nextAvailableIndex;
- _itemDictionary[finalNextAvailableIndex] = item;
- item.Index = finalNextAvailableIndex;
+ _itemDictionary[nextAvailableIndex] = item;
+ item.Index = nextAvailableIndex;
item.ItemContainer = this;
- if (finalNextAvailableIndex != _selectIndex)
+ if (nextAvailableIndex != _selectIndex)
{
item.HideSelf();
}
- UpdateNextAvailableIndex();
- UpdateSelectStatus(finalNextAvailableIndex, item);
+ UpdateSelectStatus(nextAvailableIndex, item);
ItemDataChangeEvent?.Invoke(new ItemDataChangeEvent
{
NewItem = item,
- NewIndex = finalNextAvailableIndex,
+ NewIndex = nextAvailableIndex,
Type = Config.ItemDataChangeEventType.Add
});
return originalQuantity;
@@ -355,7 +349,6 @@ public class UniversalItemContainer(int totalCapacity) : IItemContainer
//输入的数量小于0,则移除全部物品。
item.Quantity = 0;
_itemDictionary.Remove(itemIndex);
- UpdateNextAvailableIndex();
ItemDataChangeEvent?.Invoke(new ItemDataChangeEvent
{
NewItem = item,
@@ -370,7 +363,6 @@ public class UniversalItemContainer(int totalCapacity) : IItemContainer
if (item.Quantity < 1)
{
_itemDictionary.Remove(itemIndex);
- UpdateNextAvailableIndex();
ItemDataChangeEvent?.Invoke(new ItemDataChangeEvent
{
NewItem = item,