完善背包技能UI

This commit is contained in:
997146918 2025-07-17 17:43:30 +08:00
parent 0bed66d5ca
commit f5db40d884
13 changed files with 27 additions and 20 deletions

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -9,7 +9,7 @@
// Sets default values for this component's properties
UFishingRobComponent::UFishingRobComponent()
UFishingRodComponent::UFishingRodComponent()
{
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
// off to improve performance if you don't need them.
@ -20,16 +20,16 @@ UFishingRobComponent::UFishingRobComponent()
// Called when the game starts
void UFishingRobComponent::BeginPlay()
void UFishingRodComponent::BeginPlay()
{
Super::BeginPlay();
for (auto rowName: FishRobData.DataTable->GetRowMap())
for (auto rowName: FishRodDataTable.DataTable->GetRowMap())
{
FFishingRod* data = reinterpret_cast<FFishingRod*>(rowName.Value);
if (data && data->FishingRod_Name ==FishRobData.RowContents )
if (data && data->FishingRod_Name ==FishRodDataTable.RowContents )
{
FishRob = *data;
FishRodData = *data;
break;
}
}
@ -38,10 +38,10 @@ void UFishingRobComponent::BeginPlay()
if (OwnerPawn != nullptr)
{
//叠加角色的属性信息
OwnerPawn->CurrentEndurance += FishRob.Endurance_Add;
OwnerPawn->MaxEndurance += FishRob.Endurance_Add;
OwnerPawn->CurrentTenacity += FishRob.Tenacity_Add;
OwnerPawn->MaxTenacity+= FishRob.Tenacity_Add;
OwnerPawn->CurrentEndurance += FishRodData.Endurance_Add;
OwnerPawn->MaxEndurance += FishRodData.Endurance_Add;
OwnerPawn->CurrentTenacity += FishRodData.Tenacity_Add;
OwnerPawn->MaxTenacity+= FishRodData.Tenacity_Add;
GetWorld()->GetTimerManager().SetTimerForNextTick([this, OwnerPawn]()
{
@ -54,7 +54,7 @@ void UFishingRobComponent::BeginPlay()
}
}
//初始化鱼竿技能
for (auto skill : FishRob.Skills)
for (auto skill : FishRodData.Skills)
{
UFishingRodSKill_Base* SkillObject = NewObject<UFishingRodSKill_Base>(OwnerPawn, skill.SkillClass);
if (SkillObject != nullptr)
@ -72,18 +72,18 @@ void UFishingRobComponent::BeginPlay()
// Called every frame
void UFishingRobComponent::TickComponent(float DeltaTime, ELevelTick TickType,
void UFishingRodComponent::TickComponent(float DeltaTime, ELevelTick TickType,
FActorComponentTickFunction* ThisTickFunction)
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
CurrentCDTime += DeltaTime;
if (CurrentCDTime >= FishRob.DamageCD)
if (CurrentCDTime >= FishRodData.DamageCD)
{
CurrentCDTime = 0;
UE_LOG(LogTemp, Warning, TEXT("鱼竿: %s 造成伤害 %d"), *FishRob.FishingRod_Name.ToString(), FishRob.Damage);
UE_LOG(LogTemp, Warning, TEXT("鱼竿: %s 造成伤害 %d"), *FishRodData.FishingRod_Name.ToString(), FishRodData.Damage);
if (Enemy)
{
Enemy->ApplyyEndurance(-FishRob.Damage);
Enemy->ApplyyEndurance(-FishRodData.Damage);
}
}
// ...

View File

@ -10,13 +10,13 @@
UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
class PROJECTFISH_API UFishingRobComponent : public UActorComponent
class PROJECTFISH_API UFishingRodComponent : public UActorComponent
{
GENERATED_BODY()
public:
// Sets default values for this component's properties
UFishingRobComponent();
UFishingRodComponent();
protected:
// Called when the game starts
@ -28,10 +28,12 @@ public:
FActorComponentTickFunction* ThisTickFunction) override;
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ToolTip = "鱼竿配置文件"))
FDataTableCategoryHandle FishRobData;
UPROPERTY(EditAnywhere, meta = (ToolTip = "鱼竿配置文件"))
FDataTableCategoryHandle FishRodDataTable;
UPROPERTY(BlueprintReadWrite, meta = (ToolTip = "鱼竿数据"))
FFishingRod FishRodData;
FFishingRod FishRob;
class APawnWithSkill* Enemy;
float CurrentCDTime = 0.f;