更新鱼竿数据的运行时读取
This commit is contained in:
parent
626fb973e4
commit
7790344f1a
Binary file not shown.
@ -6,6 +6,7 @@
|
|||||||
#include "EngineUtils.h"
|
#include "EngineUtils.h"
|
||||||
#include "ProjectFish/Definations.h"
|
#include "ProjectFish/Definations.h"
|
||||||
#include "ProjectFish/PawnWithSkill.h"
|
#include "ProjectFish/PawnWithSkill.h"
|
||||||
|
#include "ProjectFish/Subsystem/FishingRodConfigSubsystem.h"
|
||||||
|
|
||||||
|
|
||||||
// Sets default values for this component's properties
|
// Sets default values for this component's properties
|
||||||
@ -71,8 +72,13 @@ void UFishingRodComponent::BeginPlay()
|
|||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//更新鱼竿槽位配置
|
||||||
|
UWorld* World = GetWorld();
|
||||||
|
UGameInstance* GameInstance = World->GetGameInstance();
|
||||||
|
FishRodData.BagConfig = GameInstance->GetSubsystem<UFishingRodConfigSubsystem>()->GetFishingRodInventory();
|
||||||
// ...
|
// ...
|
||||||
Super::BeginPlay();
|
Super::BeginPlay();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -53,26 +53,27 @@ void USkillManager::AddPawn(class APawnWithSkill* Pawn, FIntPoint BagSize)
|
|||||||
void USkillManager::AddBagWithSkills(UBagConfigAsset* Bag, APawnWithSkill* Pawn, TArray<USkill*>& SkillObjects,
|
void USkillManager::AddBagWithSkills(UBagConfigAsset* Bag, APawnWithSkill* Pawn, TArray<USkill*>& SkillObjects,
|
||||||
TArray<FIntPoint>& BagPositions)
|
TArray<FIntPoint>& BagPositions)
|
||||||
{
|
{
|
||||||
FIntPoint BagSize = *PawnInfo.Find(Pawn);
|
if (IsValid(Bag))
|
||||||
TMap<FIntPoint, int32>* states = PawnBagState.Find(Pawn);
|
|
||||||
for (auto PlacedSkill: Bag->PlacedSkills)
|
|
||||||
{
|
{
|
||||||
USkill* skill = NewObject<USkill>(this);
|
FIntPoint BagSize = *PawnInfo.Find(Pawn);
|
||||||
skill->InitSkill(Pawn, this, PlacedSkill);
|
TMap<FIntPoint, int32>* states = PawnBagState.Find(Pawn);
|
||||||
SkillObjects.Add(skill);
|
for (auto PlacedSkill: Bag->PlacedSkills)
|
||||||
BagPositions.Add(FIntPoint(PlacedSkill.PositionX, PlacedSkill.PositionY));
|
|
||||||
Skills.Add(skill);
|
|
||||||
//设置占用状态
|
|
||||||
for (int x = PlacedSkill.PositionX; x < PlacedSkill.PositionX + PlacedSkill.GetSkillSize().X; x++)
|
|
||||||
{
|
{
|
||||||
for (int y = PlacedSkill.PositionY; y < PlacedSkill.PositionY + PlacedSkill.GetSkillSize().Y; y++)
|
USkill* skill = NewObject<USkill>(this);
|
||||||
|
skill->InitSkill(Pawn, this, PlacedSkill);
|
||||||
|
SkillObjects.Add(skill);
|
||||||
|
BagPositions.Add(FIntPoint(PlacedSkill.PositionX, PlacedSkill.PositionY));
|
||||||
|
Skills.Add(skill);
|
||||||
|
//设置占用状态
|
||||||
|
for (int x = PlacedSkill.PositionX; x < PlacedSkill.PositionX + PlacedSkill.GetSkillSize().X; x++)
|
||||||
{
|
{
|
||||||
states->Add(FIntPoint(x, y) , GetSkillIndex(skill));
|
for (int y = PlacedSkill.PositionY; y < PlacedSkill.PositionY + PlacedSkill.GetSkillSize().Y; y++)
|
||||||
|
{
|
||||||
|
states->Add(FIntPoint(x, y) , GetSkillIndex(skill));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void USkillManager::OnAllSkillAdded()
|
void USkillManager::OnAllSkillAdded()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user