Compare commits
No commits in common. "f80c48465c5f63900837247e4ebf03dbdef1963c" and "cb74c13494a0e4e702734198b8394e2e7d2fce2c" have entirely different histories.
f80c48465c
...
cb74c13494
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -43,7 +43,6 @@ int32 UContainerInfo::AddContainerItem(FContainerItem Item)
|
|||||||
if (Item.IsSlotUsing(FIntPoint(x, y)))
|
if (Item.IsSlotUsing(FIntPoint(x, y)))
|
||||||
{
|
{
|
||||||
SlotInUsing.Add(FIntPoint(x + Item.ContainerStartPos.X, y + Item.ContainerStartPos.Y), true);
|
SlotInUsing.Add(FIntPoint(x + Item.ContainerStartPos.X, y + Item.ContainerStartPos.Y), true);
|
||||||
SlotItems.Add(FIntPoint(x + Item.ContainerStartPos.X, y + Item.ContainerStartPos.Y), ItemID);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -62,7 +61,6 @@ bool UContainerInfo::RemoveContainerItem(const int32& ItemID)
|
|||||||
if (Item.IsSlotUsing(FIntPoint(x, y )))
|
if (Item.IsSlotUsing(FIntPoint(x, y )))
|
||||||
{
|
{
|
||||||
SlotInUsing[FIntPoint(x + Item.ContainerStartPos.X, y + Item.ContainerStartPos.Y)] = false;
|
SlotInUsing[FIntPoint(x + Item.ContainerStartPos.X, y + Item.ContainerStartPos.Y)] = false;
|
||||||
SlotItems[FIntPoint(x + Item.ContainerStartPos.X, y + Item.ContainerStartPos.Y)] = -1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -72,32 +70,6 @@ bool UContainerInfo::RemoveContainerItem(const int32& ItemID)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
TSet<int32> UContainerInfo::GetOverlapOtherItem(FContainerItem Item)
|
|
||||||
{
|
|
||||||
TSet<int32> OverlapItems;
|
|
||||||
if (IsItemInContainerShape(Item))
|
|
||||||
{
|
|
||||||
for (int x = 0; x < Item.GetItemWIdth(); x++)
|
|
||||||
{
|
|
||||||
for (int y = 0; y < Item.GetItemHeight(); y++)
|
|
||||||
{
|
|
||||||
if (Item.IsSlotUsing(FIntPoint(x, y)))
|
|
||||||
{
|
|
||||||
|
|
||||||
if (ContainerShape->IsSlotActive(Item.ContainerStartPos.X + x, Item.ContainerStartPos.Y + y) &&
|
|
||||||
SlotItems[FIntPoint(x + Item.ContainerStartPos.X, y + Item.ContainerStartPos.Y)] != -1
|
|
||||||
)
|
|
||||||
{
|
|
||||||
OverlapItems.Add(SlotItems[FIntPoint(x + Item.ContainerStartPos.X, y + Item.ContainerStartPos.Y)] );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return OverlapItems;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UContainerInfo::IsItemOverlapOtherItem(FContainerItem NewItem)
|
bool UContainerInfo::IsItemOverlapOtherItem(FContainerItem NewItem)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -171,7 +143,6 @@ bool UContainerInfo::LoadFromSaveData(FPrimaryAssetId ShapeID, const TArray<FCon
|
|||||||
// 清空当前数据
|
// 清空当前数据
|
||||||
Items.Empty();
|
Items.Empty();
|
||||||
SlotInUsing.Empty();
|
SlotInUsing.Empty();
|
||||||
SlotItems.Empty();
|
|
||||||
//从存档中加载仓库形状
|
//从存档中加载仓库形状
|
||||||
FSoftObjectPath ShipShapePath = UAssetManager::Get().GetPrimaryAssetPath(ShapeID);
|
FSoftObjectPath ShipShapePath = UAssetManager::Get().GetPrimaryAssetPath(ShapeID);
|
||||||
UShapeAsset* ShapeAsset = Cast<UShapeAsset>(ShipShapePath.TryLoad());
|
UShapeAsset* ShapeAsset = Cast<UShapeAsset>(ShipShapePath.TryLoad());
|
||||||
|
|||||||
@ -115,8 +115,6 @@ public:
|
|||||||
int32 AddContainerItem(FContainerItem Item);
|
int32 AddContainerItem(FContainerItem Item);
|
||||||
UFUNCTION(BlueprintPure)
|
UFUNCTION(BlueprintPure)
|
||||||
bool RemoveContainerItem(const int32& ItemID);
|
bool RemoveContainerItem(const int32& ItemID);
|
||||||
UFUNCTION(BlueprintPure)
|
|
||||||
TSet<int32> GetOverlapOtherItem(FContainerItem Item);
|
|
||||||
|
|
||||||
// 获取存档数据
|
// 获取存档数据
|
||||||
UFUNCTION(BlueprintCallable, Category = "ContainerInfo")
|
UFUNCTION(BlueprintCallable, Category = "ContainerInfo")
|
||||||
@ -144,5 +142,4 @@ public:
|
|||||||
private:
|
private:
|
||||||
int32 NextItemID = 0;
|
int32 NextItemID = 0;
|
||||||
TMap<FIntPoint, bool> SlotInUsing;
|
TMap<FIntPoint, bool> SlotInUsing;
|
||||||
TMap<FIntPoint, int32> SlotItems;
|
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user