Fixed merge bugs and stackables bug

This commit is contained in:
tonyomendoza 2023-03-13 05:05:53 -07:00
parent 1d0ed5e2cb
commit 3746d39045
30 changed files with 903 additions and 621 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 18906e0d14b4849448eb63ddd09e4f5f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 57975bed53103674291bed4602b12f03
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: eaa582e1c7ae46b46869cf09bfe48dc0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 4736df418d82ce346baffcb35f1807f6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 55d7e84284c5299489973477b29d9ea1
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 40f32ad70335b6043b2197f3ed7bb64e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 8504e037e12f7f447b28bd369185f166
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: c79a6cbe08269e647ac6ef99ee85173a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: b40bc90553027a4428365fe9e0df128d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 147e163ede9beb34fb999c4a636f1b94
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: a4f411128826bae4c8b1c847000dfe8c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 0d3ae93cb811ae449876214caa44b476
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 32feeb0af8e5895449b8f58944051699
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: e1027cbd82e54d944b0c0bd9bacb6294
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 8170ea60c9a2c714d870372fb89c306f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -219,11 +219,11 @@ namespace SimpleInventorySystem
return -1;
}*/
public bool WillExceedMaximumCapacity(int weight)
public bool WillExceedMaximumCapacity(int weight = 0)
{
return NestCapacityCount >= NestCapacity || NestCapacityCount + weight > NestCapacity;
}
public bool WillExceedZeroCapacity(int weight)
public bool WillExceedZeroCapacity(int weight = 0)
{
return NestCapacityCount <= 0 || NestCapacityCount - weight < 0;
}

View File

@ -1,6 +1,7 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
namespace SimpleInventorySystem
{
@ -10,16 +11,25 @@ namespace SimpleInventorySystem
//public int Weight;
//[HideInInspector] public LimitStackSlotManager limitStackSlotCapacities;
[HideInInspector] public LimitStackItemManager limitStackItemManager;
[HideInInspector] public int Count;
public TextMeshProUGUI CountText;
public void SetCount()
{
Count = Slot.stackedItems.Count;
CountText.text = Count.ToString();
}
public void Increment(ItemUI itemUI)
{
limitStackItemManager.Increment(itemUI);
SetCount();
}
public void Decrement(ItemUI itemUI)
{
limitStackItemManager.Decrement(itemUI);
SetCount();
}
public bool HasReachedLimit(ItemUI itemUI)

View File

@ -101,8 +101,9 @@ namespace SimpleInventorySystem
/// STACKING
/// This section concerns item stacks, not slot stacking
if (itemDrop.Stackable && ((HasStack() && itemUI != null /*&& itemUI.itemPrefab == itemDrop.itemPrefab*/ && itemUI.itemName == GetItemUI().itemName) || !dropStack))
if (itemDrop.Stackable && ((HasStack() && itemDrop.itemName == GetItemUI().itemName) || !dropStack))
{
Debug.Log("DropStack" + dropStack);
// Debug.Log("Handling Stack");
int maxStackDrop = 1;
if (dropStack)
@ -236,6 +237,7 @@ namespace SimpleInventorySystem
if (limitStackSlot != null)
{
limitStackSlot.SetCount();
limitStackSlot.Increment(itemUI);
}
@ -326,11 +328,6 @@ namespace SimpleInventorySystem
{
HideImage();
/*if (limitStackSlot != null)
{
limitStackSlot.Increment(itemUI);
}*/
//DropOntoSlot(item.gameObject);
stackedItems.Push(item);
@ -359,6 +356,11 @@ namespace SimpleInventorySystem
gs.OnItemDropped();
}
}
if (limitStackSlot != null)
{
limitStackSlot.SetCount();
}
}
public void RemoveContainedItemsFromSlot()
{
@ -384,6 +386,11 @@ namespace SimpleInventorySystem
oldItem.SetSlot(this);
}
if (limitStackSlot != null)
{
limitStackSlot.SetCount();
}
if (groupSlots != null)
{
foreach (GroupSlotUI gs in groupSlots)
@ -438,6 +445,11 @@ namespace SimpleInventorySystem
groupSlot.OnItemRemoved();
}
if (limitStackSlot != null)
{
limitStackSlot.SetCount();
}
UnsetCell();
SetRenderItemUIPropertyValue();

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 26f808e8ee3809c43867c1c1eb226124
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 932332605b143de408257962fa7ff175
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 34df9cfc25be6f547a48b9abf4422566
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: b4313c97c87b0da42b32b9465a89e002
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 9b0c4bb5983488a438c06d5e35e09d2b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: f0b4fd9f8be79d34ba1fb5abecbb4aca
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 7032d000d3add4948ae9729fff4b493a
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 9bd692981c3b41e4e9c65dd7cdb03cb8
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: d61d18c239646e24ea7563da992aedaf
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -46408,20 +46408,6 @@ Transform:
type: 3}
m_PrefabInstance: {fileID: 1793588189}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1796317325 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 6546923916990955624, guid: 9f005685dc17f4643b4a1156970fe2f6,
type: 3}
m_PrefabInstance: {fileID: 2770326605231792848}
m_PrefabAsset: {fileID: 0}
--- !u!222 &1796317327
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1796317325}
m_CullTransparentMesh: 0
--- !u!1 &1799529557
GameObject:
m_ObjectHideFlags: 0
@ -56623,7 +56609,7 @@ PrefabInstance:
- target: {fileID: 2770326604978625765, guid: 9f005685dc17f4643b4a1156970fe2f6,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 0.000061035156
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2770326604978625765, guid: 9f005685dc17f4643b4a1156970fe2f6,
type: 3}
@ -57173,12 +57159,12 @@ PrefabInstance:
- target: {fileID: 2770326606141421692, guid: 9f005685dc17f4643b4a1156970fe2f6,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: -0.00024414062
objectReference: {fileID: 0}
- target: {fileID: 2770326606141421692, guid: 9f005685dc17f4643b4a1156970fe2f6,
type: 3}
propertyPath: m_AnchoredPosition.y
value: -0.00024414062
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2770326606150301029, guid: 9f005685dc17f4643b4a1156970fe2f6,
type: 3}

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: c310a300a0358f94f81e0eeb585d6cf4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: