2025-09-01 11:54:05 +08:00

64 lines
1.4 KiB
C++

// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Engine/DataAsset.h"
#include "BagShapeAsset.generated.h"
USTRUCT(BlueprintType)
struct FBagSlot
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 X;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 Y;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool bIsActive;
FBagSlot()
{
X = 0;
Y = 0;
bIsActive = false;
}
FBagSlot(int32 InX, int32 InY, bool InIsActive)
{
X = InX;
Y = InY;
bIsActive = InIsActive;
}
};
/**
*
*/
UCLASS(BlueprintType)
class PROJECTFISH_API UBagShapeAsset : public UDataAsset
{
GENERATED_BODY()
public:
UBagShapeAsset();
UFUNCTION(BlueprintCallable, Category="BagShape")
void InitializeBagShape();
UFUNCTION(Blueprintable, BlueprintPure, Category="BagShape")
bool IsSlotActive(int32 X, int32 Y) const;
UFUNCTION(Blueprintable, Category="BagShape")
void SetSlotActive(int32 X, int32 Y, bool Active);
private:
int32 FIndSlotIndex(int32 X, int32 Y) const;
public:
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "BagShape", meta = (ClampMin = "1", ClampMax = "10"))
int32 BagWidth;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "BagShape", meta = (ClampMin = "1", ClampMax = "10"))
int32 BagHeight;
//存储格子状态
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="BagShape")
TArray<FBagSlot> BagSlots;
};