修复物品拖拽bug
This commit is contained in:
parent
34039547f9
commit
f2173d2ae1
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -22,17 +22,17 @@ void UContainerInfo::InitContainerByShape(UShapeAsset* InContainerShape)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UContainerInfo::AddContainerItem(FContainerItem Item, int32& ItemID)
|
int32 UContainerInfo::AddContainerItem(FContainerItem Item)
|
||||||
{
|
{
|
||||||
if (!IsItemInContainerShape(Item))
|
if (!IsItemInContainerShape(Item))
|
||||||
{
|
{
|
||||||
return false;
|
return -1;
|
||||||
}
|
}
|
||||||
if (IsItemOverlapOtherItem(Item))
|
if (IsItemOverlapOtherItem(Item))
|
||||||
{
|
{
|
||||||
return false;
|
return -1;
|
||||||
}
|
}
|
||||||
ItemID = NextItemID;
|
int32 ItemID = NextItemID;
|
||||||
Items.Add(NextItemID, Item);
|
Items.Add(NextItemID, Item);
|
||||||
++NextItemID;
|
++NextItemID;
|
||||||
//设置容器指定位置的占用状态
|
//设置容器指定位置的占用状态
|
||||||
@ -46,7 +46,7 @@ bool UContainerInfo::AddContainerItem(FContainerItem Item, int32& ItemID)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return ItemID;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UContainerInfo::RemoveContainerItem(const int32& ItemID)
|
bool UContainerInfo::RemoveContainerItem(const int32& ItemID)
|
||||||
@ -163,8 +163,7 @@ bool UContainerInfo::LoadFromSaveData(FPrimaryAssetId ShapeID, const TArray<FCon
|
|||||||
NewItem.RewardItem = Cast<UFishingRewardDataAsset>(RewardItemPath.TryLoad());
|
NewItem.RewardItem = Cast<UFishingRewardDataAsset>(RewardItemPath.TryLoad());
|
||||||
//添加物品到容器中
|
//添加物品到容器中
|
||||||
FIntPoint Position(ItemData.PosX, ItemData.PosY);
|
FIntPoint Position(ItemData.PosX, ItemData.PosY);
|
||||||
int32 ItemID;
|
AddContainerItem(NewItem);
|
||||||
AddContainerItem(NewItem, ItemID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -112,7 +112,7 @@ public:
|
|||||||
void InitContainerByShape(UShapeAsset* InContainerShape);
|
void InitContainerByShape(UShapeAsset* InContainerShape);
|
||||||
|
|
||||||
UFUNCTION(BlueprintPure)
|
UFUNCTION(BlueprintPure)
|
||||||
bool AddContainerItem(FContainerItem Item, int32& ItemID);
|
int32 AddContainerItem(FContainerItem Item);
|
||||||
UFUNCTION(BlueprintPure)
|
UFUNCTION(BlueprintPure)
|
||||||
bool RemoveContainerItem(const int32& ItemID);
|
bool RemoveContainerItem(const int32& ItemID);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user