diff --git a/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFish-0001.dll b/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFish-0001.dll deleted file mode 100644 index e5ef3ae..0000000 Binary files a/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFish-0001.dll and /dev/null differ diff --git a/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFish.dll b/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFish.dll index 103165d..1a8463d 100644 Binary files a/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFish.dll and b/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFish.dll differ diff --git a/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFishEditor-0001.dll b/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFishEditor-0001.dll deleted file mode 100644 index f66bff3..0000000 Binary files a/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFishEditor-0001.dll and /dev/null differ diff --git a/ProjectFish/Binaries/Win64/UnrealEditor.modules b/ProjectFish/Binaries/Win64/UnrealEditor.modules index fe900f8..22c08e6 100644 --- a/ProjectFish/Binaries/Win64/UnrealEditor.modules +++ b/ProjectFish/Binaries/Win64/UnrealEditor.modules @@ -2,7 +2,7 @@ "BuildId": "37670630", "Modules": { - "ProjectFish": "UnrealEditor-ProjectFish-0001.dll", - "ProjectFishEditor": "UnrealEditor-ProjectFishEditor-0001.dll" + "ProjectFish": "UnrealEditor-ProjectFish.dll", + "ProjectFishEditor": "UnrealEditor-ProjectFishEditor.dll" } } \ No newline at end of file diff --git a/ProjectFish/Content/Gameplay/MapSystem/MapConfig.uasset b/ProjectFish/Content/Gameplay/MapSystem/MapConfig.uasset index daa7d1a..6c79f25 100644 Binary files a/ProjectFish/Content/Gameplay/MapSystem/MapConfig.uasset and b/ProjectFish/Content/Gameplay/MapSystem/MapConfig.uasset differ diff --git a/ProjectFish/Content/UI/Ready/UMG_InventoryGridWidget.uasset b/ProjectFish/Content/UI/Ready/UMG_InventoryGridWidget.uasset index 48eea57..dc12f01 100644 Binary files a/ProjectFish/Content/UI/Ready/UMG_InventoryGridWidget.uasset and b/ProjectFish/Content/UI/Ready/UMG_InventoryGridWidget.uasset differ diff --git a/ProjectFish/Source/ProjectFish/DataAsset/MapConfigAsset.h b/ProjectFish/Source/ProjectFish/DataAsset/MapConfigAsset.h index 6e4d628..62b0677 100644 --- a/ProjectFish/Source/ProjectFish/DataAsset/MapConfigAsset.h +++ b/ProjectFish/Source/ProjectFish/DataAsset/MapConfigAsset.h @@ -31,4 +31,11 @@ public: UPROPERTY(EditAnywhere, BlueprintReadWrite, Category= MapConfig, meta = (ToolTip = "战斗节点名称")) FName BattleMapName = FName(TEXT("Dabaza")); + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category= MapConfig, meta = (ToolTip = "道具节点提供的技能")) + TArray RandomSkills; + // UPROPERTY(EditAnywhere, BlueprintReadWrite, Category= MapConfig, meta = (AllowedClasses = "SkillAsset", ToolTip = "道具节点提供的技能")) + // TArray RandomSkills; + + }; diff --git a/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/FishingMapSubSystem.cpp b/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/FishingMapSubSystem.cpp index e853991..d49d0a6 100644 --- a/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/FishingMapSubSystem.cpp +++ b/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/FishingMapSubSystem.cpp @@ -1,4 +1,6 @@ #include "FishingMapSubSystem.h" + +#include "FishingRodConfigSubsystem.h" #include "Engine/Engine.h" #include "Kismet/GameplayStatics.h" #include "ProjectFish/DataAsset/MapConfigAsset.h" @@ -100,6 +102,17 @@ void UFishingMapSubSystem::MoveToNode(FGuid NodeID) UGameplayStatics::OpenLevel(this, MapConfig->BattleMapName); break; case EMapNodeType::Skill: + //添加技能到背包系统中 + if (UGameInstance* GameInstance = GetGameInstance()) + { + + //USkillAsset* RandomSkill =LoadObject(this, * MapConfig->RandomSkills[FMath::RandRange(0, MapConfig->RandomSkills.Num() - 1)].ToString()); + USkillAsset* RandomSkill = DuplicateObject(MapConfig->RandomSkills[FMath::RandRange(0, MapConfig->RandomSkills.Num() - 1)], this); + if (!GameInstance->GetSubsystem()->AddSkillToPlayerInventory(RandomSkill)) + { + UE_LOG(LogTemp, Error, TEXT("道具节点添加道具失败,背包没有多余位置")); + } + } break;; } } diff --git a/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/FishingRodConfigSubsystem.cpp b/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/FishingRodConfigSubsystem.cpp index 8effb3e..c1ea414 100644 --- a/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/FishingRodConfigSubsystem.cpp +++ b/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/FishingRodConfigSubsystem.cpp @@ -4,6 +4,7 @@ #include "FishingRodConfigSubsystem.h" #include "ProjectFish/DataAsset/BagConfigAsset.h" +#include "ProjectFish/DataAsset/BagShapeAsset.h" void UFishingRodConfigSubsystem::CreateFishingRodInventory(class UBagShapeAsset* FishingRodShape, class UBagShapeAsset* PlayerBagShape) { @@ -24,3 +25,27 @@ UBagConfigAsset* UFishingRodConfigSubsystem::GetPlayerInventory() { return playerInventoryConfig; } + +bool UFishingRodConfigSubsystem::AddSkillByConfig(USkillAsset* SkillAsset, UBagConfigAsset* InventoryConfig, + FIntPoint Position) +{ + return InventoryConfig->AddSkill(SkillAsset, Position.X, Position.Y); +} + +bool UFishingRodConfigSubsystem::AddSkillToPlayerInventory(USkillAsset* SkillAsset) +{ + + int32 width = playerInventoryConfig->BagShapeAsset->BagWidth; + int32 height = playerInventoryConfig->BagShapeAsset->BagHeight; + for (int x = 0; x < width; x++) + { + for (int y = 0; y < height; y++) + { + if (playerInventoryConfig->AddSkill(SkillAsset, x, y)) + { + return true; + } + } + } + return false; +} diff --git a/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/FishingRodConfigSubsystem.h b/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/FishingRodConfigSubsystem.h index e116910..dc934e8 100644 --- a/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/FishingRodConfigSubsystem.h +++ b/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/FishingRodConfigSubsystem.h @@ -3,6 +3,7 @@ #pragma once #include "CoreMinimal.h" +#include "ProjectFish/DataAsset/SkillAsset.h" #include "Subsystems/GameInstanceSubsystem.h" #include "FishingRodConfigSubsystem.generated.h" @@ -22,6 +23,13 @@ public: UBagConfigAsset* GetFishingRodInventory(); UFUNCTION(BlueprintPure, Category = "PlayerInventorySubsystem") UBagConfigAsset* GetPlayerInventory(); + + UFUNCTION(BlueprintPure, Category = "PlayerInventorySubsystem") + bool AddSkillByConfig(USkillAsset* SkillAsset, UBagConfigAsset* InventoryConfig, FIntPoint Position); + + UFUNCTION(BlueprintPure, Category = "PlayerInventorySubsystem") + bool AddSkillToPlayerInventory(USkillAsset* SkillAsset); + private: UPROPERTY() class UBagConfigAsset* fishingRodInventoryConfig = nullptr;