更新新手引导逻辑

This commit is contained in:
997146918 2025-11-24 17:36:15 +08:00
parent 9711095c25
commit d5b1e8b304
18 changed files with 49 additions and 4 deletions

View File

@ -2,3 +2,15 @@
#include "PlayerInfoSaveGame.h" #include "PlayerInfoSaveGame.h"
#include "ProjectFish/Gameplay/Subsystem/GameInfoManager.h"
void UPlayerInfoSaveGame::SetShipContainerItems(TArray<FContainerItemSaveData> NewItems)
{
ShipContainerItems = NewItems;
if (GetWorld())
{
GetWorld()->GetGameInstance()->GetSubsystem<UGameInfoManager>()->SaveGameInfo();
OnShipContainerUpdate.Broadcast();
}
}

View File

@ -9,6 +9,7 @@
#include "ProjectFish/Quest/QuestTypes.h" #include "ProjectFish/Quest/QuestTypes.h"
#include "PlayerInfoSaveGame.generated.h" #include "PlayerInfoSaveGame.generated.h"
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnShipContainerUpdate);
/** /**
* *
*/ */
@ -31,7 +32,7 @@ public:
FPrimaryAssetId ShipContainerShapeID; FPrimaryAssetId ShipContainerShapeID;
// 船舱物品存档数据 // 船舱物品存档数据
UPROPERTY(SaveGame, BlueprintReadWrite, meta = (ToolTip = "船舱物品数据")) UPROPERTY(SaveGame, BlueprintReadOnly, meta = (ToolTip = "船舱物品数据"))
TArray<FContainerItemSaveData> ShipContainerItems; TArray<FContainerItemSaveData> ShipContainerItems;
UPROPERTY(SaveGame, BlueprintReadWrite, meta = (ToolTip = "仓库资源")) UPROPERTY(SaveGame, BlueprintReadWrite, meta = (ToolTip = "仓库资源"))
@ -55,4 +56,11 @@ public:
//已战胜的鱼 //已战胜的鱼
UPROPERTY(SaveGame, BlueprintReadWrite, meta = (ToolTip = "被击败的鱼")) UPROPERTY(SaveGame, BlueprintReadWrite, meta = (ToolTip = "被击败的鱼"))
TArray<int32> Fish_defeated_IDS; TArray<int32> Fish_defeated_IDS;
protected:
UPROPERTY(BlueprintAssignable, Category = "PlayerInfoSaveGame")
FOnShipContainerUpdate OnShipContainerUpdate;
UFUNCTION(BlueprintCallable, Category= "PlayerInfoSaveGame")
void SetShipContainerItems(TArray<FContainerItemSaveData> NewItems);
}; };

View File

@ -508,5 +508,9 @@ public:
//控制ui的显示 //控制ui的显示
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Tutorial Asset") UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Tutorial Asset")
TArray<FTutorialUIControlParam> UIControlParams; TArray<FTutorialUIControlParam> UIControlParams;
//引导task
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Tutorial Asset")
TSubclassOf<class UTutorialTask_Base> TutorialTaskClass;
}; };

View File

@ -3,6 +3,7 @@
#include "FishFunctionLibrary.h" #include "FishFunctionLibrary.h"
#include "EngineUtils.h"
#include "Kismet/GameplayStatics.h" #include "Kismet/GameplayStatics.h"
#include "ProjectFish/Data/ContainerInfo.h" #include "ProjectFish/Data/ContainerInfo.h"
@ -25,3 +26,20 @@ int32 UFishFunctionLibrary::GetContainerItemHeight(const UObject* WorldContextOb
{ {
return ContainerItem.GetItemHeight(); return ContainerItem.GetItemHeight();
} }
AActor* UFishFunctionLibrary::GetActorOfClass(const UObject* WorldContextObject, TSubclassOf<AActor> ActorClass)
{
if (ActorClass)
{
if (UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull))
{
for (TActorIterator<AActor> It(World, ActorClass); It; ++It)
{
AActor* Actor = *It;
return Actor;
}
}
}
return nullptr;
}

View File

@ -23,4 +23,7 @@ public:
UFUNCTION(BlueprintPure, Category = "FishFunctionLibrary", meta=(WorldContext="WorldContextObject")) UFUNCTION(BlueprintPure, Category = "FishFunctionLibrary", meta=(WorldContext="WorldContextObject"))
static int32 GetContainerItemHeight(const UObject* WorldContextObject, FContainerItem ContainerItem); static int32 GetContainerItemHeight(const UObject* WorldContextObject, FContainerItem ContainerItem);
UFUNCTION(BlueprintCallable, Category="Actor")
static AActor* GetActorOfClass(const UObject* WorldContextObject, TSubclassOf<AActor> ActorClass);
}; };