diff --git a/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFish.dll b/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFish.dll index f252905..0d99d07 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.dll b/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFishEditor.dll index 1f55a0a..55893c7 100644 Binary files a/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFishEditor.dll and b/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFishEditor.dll differ diff --git a/ProjectFish/Content/Gameplay/MapSystem/MapConfig.uasset b/ProjectFish/Content/Gameplay/MapSystem/MapConfig.uasset index a199c99..93fd688 100644 Binary files a/ProjectFish/Content/Gameplay/MapSystem/MapConfig.uasset and b/ProjectFish/Content/Gameplay/MapSystem/MapConfig.uasset differ diff --git a/ProjectFish/Content/Maps/MaySystem.umap b/ProjectFish/Content/Maps/MaySystem.umap index f60b78e..08753f4 100644 Binary files a/ProjectFish/Content/Maps/MaySystem.umap and b/ProjectFish/Content/Maps/MaySystem.umap differ diff --git a/ProjectFish/Source/ProjectFish/DataAsset/MapConfigAsset.h b/ProjectFish/Source/ProjectFish/DataAsset/MapConfigAsset.h index 0ee903d..fc02574 100644 --- a/ProjectFish/Source/ProjectFish/DataAsset/MapConfigAsset.h +++ b/ProjectFish/Source/ProjectFish/DataAsset/MapConfigAsset.h @@ -22,4 +22,10 @@ public: UPROPERTY(EditAnywhere, BlueprintReadWrite, Category= MapConfig, meta = (ToolTip = "总层数", ClampMin = 2)) int32 TotalLayers = 4; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category= MapConfig, meta = (ToolTip = "节点水平间距")) + int32 NodeOffsetX = 100; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category= MapConfig, meta = (ToolTip = "节点垂直间距")) + int32 NodeOffsetY = 300; }; diff --git a/ProjectFish/Source/ProjectFish/DataAsset/FishingMapSystem.cpp b/ProjectFish/Source/ProjectFish/Gameplay/MapSystem/FishingMapSystem.cpp similarity index 90% rename from ProjectFish/Source/ProjectFish/DataAsset/FishingMapSystem.cpp rename to ProjectFish/Source/ProjectFish/Gameplay/MapSystem/FishingMapSystem.cpp index 23f8cad..1ada8ba 100644 --- a/ProjectFish/Source/ProjectFish/DataAsset/FishingMapSystem.cpp +++ b/ProjectFish/Source/ProjectFish/Gameplay/MapSystem/FishingMapSystem.cpp @@ -1,5 +1,6 @@ #include "FishingMapSystem.h" #include "Engine/Engine.h" +#include "ProjectFish/DataAsset/MapConfigAsset.h" UFishingMapNode::UFishingMapNode() { @@ -105,27 +106,22 @@ void UFishingMapSystem::GenerateNodes() void UFishingMapSystem::CalculateNodePositions() { - // float LayerSpacing = 1000.0f; // 层之间的距离 - // float NodeSpacing = 300.0f; // 节点之间的距离 - // - // for (int32 LayerIndex = 0; LayerIndex < AllLayers.Num(); ++LayerIndex) - // { - // FMapLayer& Layer= AllLayers[LayerIndex]; - // int32 NodeCount = Layer.GetNodeNum(); - // - // float X = LayerIndex * LayerSpacing; - // float TotalWidth = (NodeCount - 1) * NodeSpacing; - // float StartY = -TotalWidth * 0.5f; - // - // for (int32 NodeIndex = 0; NodeIndex Position = FVector2D(X, Y); - // } - // } - // } + for (int32 LayerIndex = 0; LayerIndex < AllLayers.Num(); ++LayerIndex) + { + + FMapLayer& Layer= AllLayers[LayerIndex]; + int32 NodeCount = Layer.GetNodeNum(); + float TotalWidth = (NodeCount - 1) * (MapConfig->NodeOffsetX); //水平总距离 + float Y = LayerIndex * MapConfig->NodeOffsetY; //垂直高度 + + float StartX = -TotalWidth * 0.5f; + + for (int32 NodeIndex = 0; NodeIndex NodeOffsetX; + Layer.GetNode(NodeIndex)->Position = FVector2D(X, Y); + } + } } void UFishingMapSystem::GenerateConnections() diff --git a/ProjectFish/Source/ProjectFish/DataAsset/FishingMapSystem.h b/ProjectFish/Source/ProjectFish/Gameplay/MapSystem/FishingMapSystem.h similarity index 97% rename from ProjectFish/Source/ProjectFish/DataAsset/FishingMapSystem.h rename to ProjectFish/Source/ProjectFish/Gameplay/MapSystem/FishingMapSystem.h index 8f33409..76986f0 100644 --- a/ProjectFish/Source/ProjectFish/DataAsset/FishingMapSystem.h +++ b/ProjectFish/Source/ProjectFish/Gameplay/MapSystem/FishingMapSystem.h @@ -1,7 +1,6 @@ #pragma once #include "CoreMinimal.h" -#include "MapConfigAsset.h" #include "Engine/DataAsset.h" #include "ProjectFish/Definations.h" #include "FishingMapSystem.generated.h" @@ -50,7 +49,7 @@ public: UFishingMapSystem(); UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ToolTip = "地图配置")) - UMapConfigAsset* MapConfig; + class UMapConfigAsset* MapConfig; UPROPERTY(BlueprintReadOnly, meta = (ToolTip = "所有节点")) TArray> AllNodes;