diff --git a/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFish.dll b/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFish.dll index ba97f6e..7577fe6 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 e9e7f37..c3554be 100644 Binary files a/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFishEditor.dll and b/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFishEditor.dll differ diff --git a/ProjectFish/Config/DefaultEngine.ini b/ProjectFish/Config/DefaultEngine.ini index 013910b..88b2e38 100644 --- a/ProjectFish/Config/DefaultEngine.ini +++ b/ProjectFish/Config/DefaultEngine.ini @@ -100,6 +100,9 @@ ManualIPAddress= +ClassRedirects=(OldName="/Script/ProjectFish.PlayerInventorySubsystem",NewName="/Script/ProjectFish.FishingRodConfigSubsystem") +ClassRedirects=(OldName="/Script/ProjectFish.SimpleMapSystem",NewName="/Script/ProjectFish.FishingMapSubSystem") +ClassRedirects=(OldName="/Script/ProjectFish.FishingMapSystem",NewName="/Script/ProjectFish.FishingMapSubSystem") ++ClassRedirects=(OldName="/Script/ProjectFish.BagShapeAsset",NewName="/Script/ProjectFish.ShapeAsset") ++ClassRedirects=(OldName="/Script/ProjectFishEditor.BagShapeFactory",NewName="/Script/ProjectFishEditor.ShapeFactory") ++ClassRedirects=(OldName="/Script/ProjectFishEditor.BagShapeAssetThumbnailRenderer",NewName="/Script/ProjectFishEditor.ShapeAssetThumbnailRenderer") [/Script/Engine.CollisionProfile] -Profiles=(Name="NoCollision",CollisionEnabled=NoCollision,ObjectTypeName="WorldStatic",CustomResponses=((Channel="Visibility",Response=ECR_Ignore),(Channel="Camera",Response=ECR_Ignore)),HelpMessage="No collision",bCanModify=False) diff --git a/ProjectFish/Content/Gameplay/BP_Dabaza_GameMode.uasset b/ProjectFish/Content/Gameplay/BP_Dabaza_GameMode.uasset index 0392220..e027d8f 100644 Binary files a/ProjectFish/Content/Gameplay/BP_Dabaza_GameMode.uasset and b/ProjectFish/Content/Gameplay/BP_Dabaza_GameMode.uasset differ diff --git a/ProjectFish/Content/Gameplay/BagSystem/BP_BagConfigComponent.uasset b/ProjectFish/Content/Gameplay/BagSystem/BP_BagConfigComponent.uasset index 27c1bc8..6f4af6f 100644 Binary files a/ProjectFish/Content/Gameplay/BagSystem/BP_BagConfigComponent.uasset and b/ProjectFish/Content/Gameplay/BagSystem/BP_BagConfigComponent.uasset differ diff --git a/ProjectFish/Content/Gameplay/BagSystem/BagAsset/DefaultPlayerBagShape.uasset b/ProjectFish/Content/Gameplay/BagSystem/BagAsset/DefaultPlayerBagShape.uasset new file mode 100644 index 0000000..c44d16b Binary files /dev/null and b/ProjectFish/Content/Gameplay/BagSystem/BagAsset/DefaultPlayerBagShape.uasset differ diff --git a/ProjectFish/Content/Gameplay/BagSystem/BagAsset/FishBagShape.uasset b/ProjectFish/Content/Gameplay/BagSystem/BagAsset/FishBagShape.uasset index 67d5898..6f063e4 100644 Binary files a/ProjectFish/Content/Gameplay/BagSystem/BagAsset/FishBagShape.uasset and b/ProjectFish/Content/Gameplay/BagSystem/BagAsset/FishBagShape.uasset differ diff --git a/ProjectFish/Content/Gameplay/BagSystem/BagAsset/FishSkillBagShape.uasset b/ProjectFish/Content/Gameplay/BagSystem/BagAsset/FishSkillBagShape.uasset new file mode 100644 index 0000000..69d110c Binary files /dev/null and b/ProjectFish/Content/Gameplay/BagSystem/BagAsset/FishSkillBagShape.uasset differ diff --git a/ProjectFish/Content/Gameplay/BagSystem/BagAsset/FishingRodShape.uasset b/ProjectFish/Content/Gameplay/BagSystem/BagAsset/FishingRodShape.uasset index 6a0f8da..a99b88d 100644 Binary files a/ProjectFish/Content/Gameplay/BagSystem/BagAsset/FishingRodShape.uasset and b/ProjectFish/Content/Gameplay/BagSystem/BagAsset/FishingRodShape.uasset differ diff --git a/ProjectFish/Content/Gameplay/BagSystem/BagAsset/FishingRodSkillShape.uasset b/ProjectFish/Content/Gameplay/BagSystem/BagAsset/FishingRodSkillShape.uasset new file mode 100644 index 0000000..ea20f60 Binary files /dev/null and b/ProjectFish/Content/Gameplay/BagSystem/BagAsset/FishingRodSkillShape.uasset differ diff --git a/ProjectFish/Content/Gameplay/BagSystem/BagAsset/PlayerBagShape.uasset b/ProjectFish/Content/Gameplay/BagSystem/BagAsset/PlayerBagShape.uasset index 7fc13fd..1f50a32 100644 Binary files a/ProjectFish/Content/Gameplay/BagSystem/BagAsset/PlayerBagShape.uasset and b/ProjectFish/Content/Gameplay/BagSystem/BagAsset/PlayerBagShape.uasset differ diff --git a/ProjectFish/Content/Gameplay/BagSystem/BagConfig/FishBoss_BagConfig.uasset b/ProjectFish/Content/Gameplay/BagSystem/BagConfig/FishBoss_BagConfig.uasset index b38714d..8e44316 100644 Binary files a/ProjectFish/Content/Gameplay/BagSystem/BagConfig/FishBoss_BagConfig.uasset and b/ProjectFish/Content/Gameplay/BagSystem/BagConfig/FishBoss_BagConfig.uasset differ diff --git a/ProjectFish/Content/Gameplay/BagSystem/BagConfig/FishDeep_BagConfig.uasset b/ProjectFish/Content/Gameplay/BagSystem/BagConfig/FishDeep_BagConfig.uasset index 109de49..0db8791 100644 Binary files a/ProjectFish/Content/Gameplay/BagSystem/BagConfig/FishDeep_BagConfig.uasset and b/ProjectFish/Content/Gameplay/BagSystem/BagConfig/FishDeep_BagConfig.uasset differ diff --git a/ProjectFish/Content/Gameplay/BagSystem/BagConfig/PlayerBagConfig.uasset b/ProjectFish/Content/Gameplay/BagSystem/BagConfig/PlayerBagConfig.uasset index 1a0aadd..06138b4 100644 Binary files a/ProjectFish/Content/Gameplay/BagSystem/BagConfig/PlayerBagConfig.uasset and b/ProjectFish/Content/Gameplay/BagSystem/BagConfig/PlayerBagConfig.uasset differ diff --git a/ProjectFish/Content/Gameplay/Ship/BP_Ship.uasset b/ProjectFish/Content/Gameplay/Ship/BP_Ship.uasset index 656ee68..4badb97 100644 Binary files a/ProjectFish/Content/Gameplay/Ship/BP_Ship.uasset and b/ProjectFish/Content/Gameplay/Ship/BP_Ship.uasset differ diff --git a/ProjectFish/Content/UI/Battle/WBP_SkillContainer.uasset b/ProjectFish/Content/UI/Battle/WBP_SkillContainer.uasset index 3001cf9..6cb738e 100644 Binary files a/ProjectFish/Content/UI/Battle/WBP_SkillContainer.uasset and b/ProjectFish/Content/UI/Battle/WBP_SkillContainer.uasset differ diff --git a/ProjectFish/Content/UI/Ready/UMG_InventoryGridWidget.uasset b/ProjectFish/Content/UI/Ready/UMG_InventoryGridWidget.uasset index dc12f01..19ff8a9 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/Plugins/DeskMode/Binaries/Win64/UnrealEditor-DeskMode.dll b/ProjectFish/Plugins/DeskMode/Binaries/Win64/UnrealEditor-DeskMode.dll index 811589c..3d350e9 100644 Binary files a/ProjectFish/Plugins/DeskMode/Binaries/Win64/UnrealEditor-DeskMode.dll and b/ProjectFish/Plugins/DeskMode/Binaries/Win64/UnrealEditor-DeskMode.dll differ diff --git a/ProjectFish/Source/ProjectFish/DataAsset/BagConfigAsset.cpp b/ProjectFish/Source/ProjectFish/DataAsset/BagConfigAsset.cpp index b4c838d..ffcaad1 100644 --- a/ProjectFish/Source/ProjectFish/DataAsset/BagConfigAsset.cpp +++ b/ProjectFish/Source/ProjectFish/DataAsset/BagConfigAsset.cpp @@ -3,7 +3,7 @@ #include "BagConfigAsset.h" -#include "BagShapeAsset.h" +#include "ShapeAsset.h" bool UBagConfigAsset::AddSkill(USkillAsset* SkillObject, int32 PositionX, int32 PositionY) diff --git a/ProjectFish/Source/ProjectFish/DataAsset/BagConfigAsset.h b/ProjectFish/Source/ProjectFish/DataAsset/BagConfigAsset.h index acc4589..df5ecc6 100644 --- a/ProjectFish/Source/ProjectFish/DataAsset/BagConfigAsset.h +++ b/ProjectFish/Source/ProjectFish/DataAsset/BagConfigAsset.h @@ -8,7 +8,7 @@ #include "SkillAsset.h" #include "BagConfigAsset.generated.h" -class UBagShapeAsset; +class UShapeAsset; //背包中摆放的技能信息 USTRUCT(BlueprintType) @@ -66,7 +66,7 @@ class PROJECTFISH_API UBagConfigAsset : public UDataAsset public: // 背包形状资源引用 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "BagConfig") - TObjectPtr BagShapeAsset; + TObjectPtr BagShapeAsset; // 背包中放置的技能列表 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "BagConfig") diff --git a/ProjectFish/Source/ProjectFish/DataAsset/BagShapeAsset.cpp b/ProjectFish/Source/ProjectFish/DataAsset/BagShapeAsset.cpp deleted file mode 100644 index 1e3444d..0000000 --- a/ProjectFish/Source/ProjectFish/DataAsset/BagShapeAsset.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// Fill out your copyright notice in the Description page of Project Settings. - - -#include "BagShapeAsset.h" - -UBagShapeAsset::UBagShapeAsset() -{ - - InitializeBagShape(); -} - -void UBagShapeAsset::InitializeBagShape() -{ - BagSlots.Empty(); - for (int x = 0; x < BagWidth; x++) - { - for (int y = 0; y < BagHeight; y++) - { - BagSlots.Add(FBagSlot(x, y, true)); - } - } -} - -bool UBagShapeAsset::IsSlotActive(int32 X, int32 Y) const -{ - if (X < 0 || X >= BagWidth || Y < 0 || Y >= BagHeight) - return false; - - for (auto BagSlot: BagSlots) - { - if (BagSlot.X == X && BagSlot.Y == Y) - return BagSlot.bIsActive; - } - return false; -} - -void UBagShapeAsset::SetSlotActive(int32 X, int32 Y, bool Active) -{ - if (X < 0 || X >= BagWidth || Y < 0 || Y >= BagHeight) - return; - int SlotIndex = FIndSlotIndex(X, Y); - if (SlotIndex != INDEX_NONE) - { - BagSlots[SlotIndex].bIsActive = Active; - } -} - -int32 UBagShapeAsset::FIndSlotIndex(int32 X, int32 Y) const -{ - for (int i = 0; i < BagSlots.Num(); i++) - { - if (BagSlots[i].X == X && BagSlots[i].Y == Y) - return i; - } - return INDEX_NONE; -} diff --git a/ProjectFish/Source/ProjectFish/DataAsset/BagShapeAsset.h b/ProjectFish/Source/ProjectFish/DataAsset/BagShapeAsset.h deleted file mode 100644 index 999e376..0000000 --- a/ProjectFish/Source/ProjectFish/DataAsset/BagShapeAsset.h +++ /dev/null @@ -1,63 +0,0 @@ -// Fill out your copyright notice in the Description page of Project Settings. - -#pragma once - -#include "CoreMinimal.h" -#include "Engine/DataAsset.h" -#include "BagShapeAsset.generated.h" - -USTRUCT(BlueprintType) -struct FBagSlot -{ - GENERATED_BODY() - UPROPERTY(EditAnywhere, BlueprintReadWrite) - int32 X; - UPROPERTY(EditAnywhere, BlueprintReadWrite) - int32 Y; - - UPROPERTY(EditAnywhere, BlueprintReadWrite) - bool bIsActive; - FBagSlot() - { - X = 0; - Y = 0; - bIsActive = false; - } - FBagSlot(int32 InX, int32 InY, bool InIsActive) - { - X = InX; - Y = InY; - bIsActive = InIsActive; - } -}; -/** - * - */ -UCLASS(BlueprintType) -class PROJECTFISH_API UBagShapeAsset : public UDataAsset -{ - GENERATED_BODY() -public: - UBagShapeAsset(); - - UFUNCTION(BlueprintCallable, Category="BagShape") - void InitializeBagShape(); - - UFUNCTION(Blueprintable, BlueprintPure, Category="BagShape") - bool IsSlotActive(int32 X, int32 Y) const; - - UFUNCTION(Blueprintable, Category="BagShape") - void SetSlotActive(int32 X, int32 Y, bool Active); - -private: - int32 FIndSlotIndex(int32 X, int32 Y) const; -public: - UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "BagShape", meta = (ClampMin = "1", ClampMax = "10")) - int32 BagWidth; - UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "BagShape", meta = (ClampMin = "1", ClampMax = "10")) - int32 BagHeight; - - //存储格子状态 - UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="BagShape") - TArray BagSlots; -}; diff --git a/ProjectFish/Source/ProjectFish/DataAsset/ShapeAsset.cpp b/ProjectFish/Source/ProjectFish/DataAsset/ShapeAsset.cpp new file mode 100644 index 0000000..296a2a4 --- /dev/null +++ b/ProjectFish/Source/ProjectFish/DataAsset/ShapeAsset.cpp @@ -0,0 +1,56 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "ShapeAsset.h" + +UShapeAsset::UShapeAsset() +{ + + InitializeShape(); +} + +void UShapeAsset::InitializeShape() +{ + Slots.Empty(); + for (int x = 0; x < ShapeWidth; x++) + { + for (int y = 0; y < ShapeHeight; y++) + { + Slots.Add(FShapeSlot(x, y, true)); + } + } +} + +bool UShapeAsset::IsSlotActive(int32 X, int32 Y) const +{ + if (X < 0 || X >= ShapeWidth || Y < 0 || Y >= ShapeHeight) + return false; + + for (auto BagSlot: Slots) + { + if (BagSlot.X == X && BagSlot.Y == Y) + return BagSlot.bIsActive; + } + return false; +} + +void UShapeAsset::SetSlotActive(int32 X, int32 Y, bool Active) +{ + if (X < 0 || X >= ShapeWidth || Y < 0 || Y >= ShapeHeight) + return; + int SlotIndex = FIndSlotIndex(X, Y); + if (SlotIndex != INDEX_NONE) + { + Slots[SlotIndex].bIsActive = Active; + } +} + +int32 UShapeAsset::FIndSlotIndex(int32 X, int32 Y) const +{ + for (int i = 0; i < Slots.Num(); i++) + { + if (Slots[i].X == X && Slots[i].Y == Y) + return i; + } + return INDEX_NONE; +} diff --git a/ProjectFish/Source/ProjectFish/DataAsset/ShapeAsset.h b/ProjectFish/Source/ProjectFish/DataAsset/ShapeAsset.h new file mode 100644 index 0000000..d3feeac --- /dev/null +++ b/ProjectFish/Source/ProjectFish/DataAsset/ShapeAsset.h @@ -0,0 +1,69 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "Engine/DataAsset.h" +#include "ShapeAsset.generated.h" + +USTRUCT(BlueprintType) +struct FShapeSlot +{ + GENERATED_BODY() + UPROPERTY(EditAnywhere, BlueprintReadWrite) + int32 X; + UPROPERTY(EditAnywhere, BlueprintReadWrite) + int32 Y; + + UPROPERTY(EditAnywhere, BlueprintReadWrite) + bool bIsActive; + FShapeSlot() + { + X = 0; + Y = 0; + bIsActive = false; + } + FShapeSlot(int32 InX, int32 InY, bool InIsActive) + { + X = InX; + Y = InY; + bIsActive = InIsActive; + } +}; +/** + * + */ +UCLASS(BlueprintType) +class PROJECTFISH_API UShapeAsset : public UDataAsset +{ + GENERATED_BODY() +public: + UShapeAsset(); + + UFUNCTION(BlueprintCallable, Category="Shape") + void InitializeShape(); + + UFUNCTION(BlueprintPure, Category="Shape") + int32 GetShapeWidth() { return ShapeWidth; } + + UFUNCTION(BlueprintPure, Category="Shape") + int32 GetShapeHeight() { return ShapeHeight; } + + UFUNCTION(Blueprintable, BlueprintPure, Category="Shape") + bool IsSlotActive(int32 X, int32 Y) const; + + UFUNCTION(Blueprintable, Category="Shape") + void SetSlotActive(int32 X, int32 Y, bool Active); + +private: + int32 FIndSlotIndex(int32 X, int32 Y) const; +public: + UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Shape", meta = (ClampMin = "1", ClampMax = "10")) + int32 ShapeWidth; + UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Shape", meta = (ClampMin = "1", ClampMax = "10")) + int32 ShapeHeight; + + //存储格子状态 + UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Shape") + TArray Slots; +}; diff --git a/ProjectFish/Source/ProjectFish/Gameplay/Ship/Shipbase.h b/ProjectFish/Source/ProjectFish/Gameplay/Ship/Shipbase.h index 6b7e4ad..e4d2fa1 100644 --- a/ProjectFish/Source/ProjectFish/Gameplay/Ship/Shipbase.h +++ b/ProjectFish/Source/ProjectFish/Gameplay/Ship/Shipbase.h @@ -113,7 +113,7 @@ protected: class UBagConfigAsset* DefaultPlayerBag; UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Inventory, meta = (AllowPrivateAccess = "true", ToolTip = "鱼竿装备槽形状")) - class UBagShapeAsset* FishingRodShape; + class UShapeAsset* FishingRodShape; private: diff --git a/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/FishingRodConfigSubsystem.cpp b/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/FishingRodConfigSubsystem.cpp index a62bf5d..8397843 100644 --- a/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/FishingRodConfigSubsystem.cpp +++ b/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/FishingRodConfigSubsystem.cpp @@ -4,9 +4,9 @@ #include "FishingRodConfigSubsystem.h" #include "ProjectFish/DataAsset/BagConfigAsset.h" -#include "ProjectFish/DataAsset/BagShapeAsset.h" +#include "ProjectFish/DataAsset/ShapeAsset.h" -void UFishingRodConfigSubsystem::CreateFishingRodInventory(class UBagShapeAsset* FishingRodShape, class UBagConfigAsset* PlayerBagConfig) +void UFishingRodConfigSubsystem::CreateFishingRodInventory(class UShapeAsset* FishingRodShape, class UBagConfigAsset* PlayerBagConfig) { //鱼竿的技能配置资源 fishingRodInventoryConfig = NewObject(this); @@ -36,8 +36,8 @@ bool UFishingRodConfigSubsystem::AddSkillByConfig(USkillAsset* SkillAsset, UBagC bool UFishingRodConfigSubsystem::AddSkillToPlayerInventory(USkillAsset* SkillAsset) { - int32 width = playerInventoryConfig->BagShapeAsset->BagWidth; - int32 height = playerInventoryConfig->BagShapeAsset->BagHeight; + int32 width = playerInventoryConfig->BagShapeAsset->ShapeWidth; + int32 height = playerInventoryConfig->BagShapeAsset->ShapeHeight; for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) diff --git a/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/FishingRodConfigSubsystem.h b/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/FishingRodConfigSubsystem.h index 606de01..0bd075f 100644 --- a/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/FishingRodConfigSubsystem.h +++ b/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/FishingRodConfigSubsystem.h @@ -17,7 +17,7 @@ class PROJECTFISH_API UFishingRodConfigSubsystem : public UGameInstanceSubsystem public: UFUNCTION(BlueprintCallable, Category = "PlayerInventorySubsystem") - void CreateFishingRodInventory(class UBagShapeAsset* FishingRodShape, class UBagConfigAsset* PlayerBagConfig); + void CreateFishingRodInventory(class UShapeAsset* FishingRodShape, class UBagConfigAsset* PlayerBagConfig); UFUNCTION(BlueprintPure, Category = "PlayerInventorySubsystem") UBagConfigAsset* GetFishingRodInventory(); diff --git a/ProjectFish/Source/ProjectFish/Skill/SkillManager.cpp b/ProjectFish/Source/ProjectFish/Skill/SkillManager.cpp index a8219e1..ea668dd 100644 --- a/ProjectFish/Source/ProjectFish/Skill/SkillManager.cpp +++ b/ProjectFish/Source/ProjectFish/Skill/SkillManager.cpp @@ -6,7 +6,7 @@ #include "Kismet/GameplayStatics.h" #include "ProjectFish/ProjectFishGameMode.h" #include "ProjectFish/DataAsset/BagConfigAsset.h" -#include "ProjectFish/DataAsset/BagShapeAsset.h" +#include "ProjectFish/DataAsset/ShapeAsset.h" USkillManager::USkillManager() { diff --git a/ProjectFish/Source/ProjectFishEditor/Private/AssetActions/BagShapeAssetTypeAction.cpp b/ProjectFish/Source/ProjectFishEditor/Private/AssetActions/BagShapeAssetTypeAction.cpp deleted file mode 100644 index 0b5a15c..0000000 --- a/ProjectFish/Source/ProjectFishEditor/Private/AssetActions/BagShapeAssetTypeAction.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// Fill out your copyright notice in the Description page of Project Settings. - - -#include "AssetActions/BagShapeAssetTypeAction.h" - -#include "AssetEditor/BagShapeAssetEditor.h" -#include "ProjectFish/DataAsset/BagShapeAsset.h" - - -UClass* FBagShapeAssetTypeAction::GetSupportedClass() const -{ - return UBagShapeAsset::StaticClass(); -} - -void FBagShapeAssetTypeAction::OpenAssetEditor(const TArray& InObjects, - TSharedPtr EditWithinLevelEditor) -{ - EToolkitMode::Type Mode = EditWithinLevelEditor.IsValid() ? EToolkitMode::WorldCentric : EToolkitMode::Standalone; - - for (auto ObjIt = InObjects.CreateConstIterator(); ObjIt; ++ObjIt) - { - if (UBagShapeAsset* BagShapeAsset = Cast(*ObjIt)) - { - TSharedRef EditorToolkit = MakeShareable(new FBagShapeAssetEditor()); - EditorToolkit->Initialize(Mode, EditWithinLevelEditor, BagShapeAsset); - } - } -} - - -uint32 FBagShapeAssetTypeAction::GetCategories() -{ - //系统原有 - //return EAssetTypeCategories::Gameplay; - return MyAssetCategory; -} - -void FBagShapeAssetTypeAction::GetActions(const TArray& InObjects, struct FToolMenuSection& Section) -{ - FAssetTypeActions_Base::GetActions(InObjects, Section); -} diff --git a/ProjectFish/Source/ProjectFishEditor/Private/AssetActions/ShapeAssetTypeAction.cpp b/ProjectFish/Source/ProjectFishEditor/Private/AssetActions/ShapeAssetTypeAction.cpp new file mode 100644 index 0000000..44f5154 --- /dev/null +++ b/ProjectFish/Source/ProjectFishEditor/Private/AssetActions/ShapeAssetTypeAction.cpp @@ -0,0 +1,41 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "AssetActions/ShapeAssetTypeAction.h" + +#include "AssetEditor/ShapeAssetEditor.h" +#include "ProjectFish/DataAsset/ShapeAsset.h" + + +UClass* FShapeAssetTypeAction::GetSupportedClass() const +{ + return UShapeAsset::StaticClass(); +} + +void FShapeAssetTypeAction::OpenAssetEditor(const TArray& InObjects, + TSharedPtr EditWithinLevelEditor) +{ + EToolkitMode::Type Mode = EditWithinLevelEditor.IsValid() ? EToolkitMode::WorldCentric : EToolkitMode::Standalone; + + for (auto ObjIt = InObjects.CreateConstIterator(); ObjIt; ++ObjIt) + { + if (UShapeAsset* BagShapeAsset = Cast(*ObjIt)) + { + TSharedRef EditorToolkit = MakeShareable(new FShapeAssetEditor()); + EditorToolkit->Initialize(Mode, EditWithinLevelEditor, BagShapeAsset); + } + } +} + + +uint32 FShapeAssetTypeAction::GetCategories() +{ + //系统原有 + //return EAssetTypeCategories::Gameplay; + return MyAssetCategory; +} + +void FShapeAssetTypeAction::GetActions(const TArray& InObjects, struct FToolMenuSection& Section) +{ + FAssetTypeActions_Base::GetActions(InObjects, Section); +} diff --git a/ProjectFish/Source/ProjectFishEditor/Private/AssetEditor/BagShapeAssetEditor.cpp b/ProjectFish/Source/ProjectFishEditor/Private/AssetEditor/BagShapeAssetEditor.cpp deleted file mode 100644 index 3110ef5..0000000 --- a/ProjectFish/Source/ProjectFishEditor/Private/AssetEditor/BagShapeAssetEditor.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// Fill out your copyright notice in the Description page of Project Settings. - - -#include "AssetEditor/BagShapeAssetEditor.h" -#include "ProjectFish/DataAsset/BagShapeAsset.h" -#include "Widgets/BagShapeEditorWidget.h" - -const FName FBagShapeAssetEditor::BagShapeEditorTabId(TEXT("BagShapeEditor")); - -void FBagShapeAssetEditor::Initialize(const EToolkitMode::Type Mode, - const TSharedPtr& InitToolkitHost, UBagShapeAsset* InBagShapeAsset) -{ - BagShapeAsset = InBagShapeAsset; - - const TSharedRef StandaloneDefaultLayout = FTabManager::NewLayout("Standalone_BagShapeAssetEditor_Layout_v1") - ->AddArea - ( - FTabManager::NewPrimaryArea()->SetOrientation(Orient_Vertical) - ->Split - ( - FTabManager::NewStack() - ->SetSizeCoefficient(1.0f) - ->AddTab(BagShapeEditorTabId, ETabState::OpenedTab) - ) - ); - - FAssetEditorToolkit::InitAssetEditor(Mode, InitToolkitHost, TEXT("BagShapeAssetEditorApp"), StandaloneDefaultLayout, true, true, InBagShapeAsset); - -} - -FName FBagShapeAssetEditor::GetToolkitFName() const -{ - return FName("BagShapeEditor"); -} - -FText FBagShapeAssetEditor::GetBaseToolkitName() const -{ - return FText::FromString("Base BagShapeEditor"); -} - -FString FBagShapeAssetEditor::GetWorldCentricTabPrefix() const -{ - return TEXT("ShapeTab"); -} - -FLinearColor FBagShapeAssetEditor::GetWorldCentricTabColorScale() const -{ - //return FLinearColor::White; - return FLinearColor(1.f, 0.8f, 0.45f, 0.5f); -} - -void FBagShapeAssetEditor::RegisterTabSpawners(const TSharedRef& tabManager) -{ - WorkspaceMenuCategory = tabManager->AddLocalWorkspaceMenuCategory( FText::FromString("BagShape")); - - tabManager->RegisterTabSpawner(BagShapeEditorTabId, FOnSpawnTab::CreateSP(this, &FBagShapeAssetEditor::SpawnBagShapeEditorTab)) - .SetDisplayName( FText::FromString("BagShapeEditor")) - .SetGroup(WorkspaceMenuCategory.ToSharedRef()); -} - -void FBagShapeAssetEditor::UnregisterTabSpawners(const TSharedRef& tabManager) -{ - tabManager->UnregisterTabSpawner(BagShapeEditorTabId); -} - -TSharedRef FBagShapeAssetEditor::SpawnBagShapeEditorTab(const FSpawnTabArgs& Args) -{ - return SNew(SDockTab) - .TabRole(ETabRole::PanelTab) - [ - SNew(SBagShapeEditorWidget) - .BagShapeAsset(BagShapeAsset) - ]; -} \ No newline at end of file diff --git a/ProjectFish/Source/ProjectFishEditor/Private/AssetEditor/ShapeAssetEditor.cpp b/ProjectFish/Source/ProjectFishEditor/Private/AssetEditor/ShapeAssetEditor.cpp new file mode 100644 index 0000000..0f409f1 --- /dev/null +++ b/ProjectFish/Source/ProjectFishEditor/Private/AssetEditor/ShapeAssetEditor.cpp @@ -0,0 +1,74 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "AssetEditor/ShapeAssetEditor.h" +#include "ProjectFish/DataAsset/ShapeAsset.h" +#include "Widgets/BagShapeEditorWidget.h" + +const FName FShapeAssetEditor::ShapeEditorTabId(TEXT("BagShapeEditor")); + +void FShapeAssetEditor::Initialize(const EToolkitMode::Type Mode, + const TSharedPtr& InitToolkitHost, UShapeAsset* InBagShapeAsset) +{ + ShapeAsset = InBagShapeAsset; + + const TSharedRef StandaloneDefaultLayout = FTabManager::NewLayout("Standalone_BagShapeAssetEditor_Layout_v1") + ->AddArea + ( + FTabManager::NewPrimaryArea()->SetOrientation(Orient_Vertical) + ->Split + ( + FTabManager::NewStack() + ->SetSizeCoefficient(1.0f) + ->AddTab(ShapeEditorTabId, ETabState::OpenedTab) + ) + ); + + FAssetEditorToolkit::InitAssetEditor(Mode, InitToolkitHost, TEXT("BagShapeAssetEditorApp"), StandaloneDefaultLayout, true, true, InBagShapeAsset); + +} + +FName FShapeAssetEditor::GetToolkitFName() const +{ + return FName("ShapeEditor"); +} + +FText FShapeAssetEditor::GetBaseToolkitName() const +{ + return FText::FromString("Base ShapeEditor"); +} + +FString FShapeAssetEditor::GetWorldCentricTabPrefix() const +{ + return TEXT("ShapeTab"); +} + +FLinearColor FShapeAssetEditor::GetWorldCentricTabColorScale() const +{ + //return FLinearColor::White; + return FLinearColor(1.f, 0.8f, 0.45f, 0.5f); +} + +void FShapeAssetEditor::RegisterTabSpawners(const TSharedRef& tabManager) +{ + WorkspaceMenuCategory = tabManager->AddLocalWorkspaceMenuCategory( FText::FromString("BagShape")); + + tabManager->RegisterTabSpawner(ShapeEditorTabId, FOnSpawnTab::CreateSP(this, &FShapeAssetEditor::SpawnBagShapeEditorTab)) + .SetDisplayName( FText::FromString("BagShapeEditor")) + .SetGroup(WorkspaceMenuCategory.ToSharedRef()); +} + +void FShapeAssetEditor::UnregisterTabSpawners(const TSharedRef& tabManager) +{ + tabManager->UnregisterTabSpawner(ShapeEditorTabId); +} + +TSharedRef FShapeAssetEditor::SpawnBagShapeEditorTab(const FSpawnTabArgs& Args) +{ + return SNew(SDockTab) + .TabRole(ETabRole::PanelTab) + [ + SNew(SShapeEditorWidget) + .BagShapeAsset(ShapeAsset) + ]; +} \ No newline at end of file diff --git a/ProjectFish/Source/ProjectFishEditor/Private/Factory/BagShapeFactory.cpp b/ProjectFish/Source/ProjectFishEditor/Private/Factory/BagShapeFactory.cpp deleted file mode 100644 index 68291f3..0000000 --- a/ProjectFish/Source/ProjectFishEditor/Private/Factory/BagShapeFactory.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// Fill out your copyright notice in the Description page of Project Settings. - - -#include "Factory/BagShapeFactory.h" - -#include "ProjectFish/DataAsset/BagShapeAsset.h" - -UBagShapeFactory::UBagShapeFactory() -{ - SupportedClass = UBagShapeAsset::StaticClass(); -} - -UObject* UBagShapeFactory::FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn) -{ - - - UBagShapeAsset* NewBagShapeAsset = NewObject(InParent, Class, Name, Flags | RF_Transactional); - if (NewBagShapeAsset) - { - NewBagShapeAsset->BagWidth = 5; - NewBagShapeAsset->BagHeight = 5; - NewBagShapeAsset->InitializeBagShape(); - } - return NewBagShapeAsset; -} - -bool UBagShapeFactory::ShouldShowInNewMenu() const -{ - return true; -} diff --git a/ProjectFish/Source/ProjectFishEditor/Private/Factory/ShapeFactory.cpp b/ProjectFish/Source/ProjectFishEditor/Private/Factory/ShapeFactory.cpp new file mode 100644 index 0000000..a75332a --- /dev/null +++ b/ProjectFish/Source/ProjectFishEditor/Private/Factory/ShapeFactory.cpp @@ -0,0 +1,30 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "Factory/ShapeFactory.h" + +#include "ProjectFish/DataAsset/ShapeAsset.h" + +UShapeFactory::UShapeFactory() +{ + SupportedClass = UShapeAsset::StaticClass(); +} + +UObject* UShapeFactory::FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn) +{ + + + UShapeAsset* NewBagShapeAsset = NewObject(InParent, Class, Name, Flags | RF_Transactional); + if (NewBagShapeAsset) + { + NewBagShapeAsset->ShapeWidth = 5; + NewBagShapeAsset->ShapeHeight = 5; + NewBagShapeAsset->InitializeShape(); + } + return NewBagShapeAsset; +} + +bool UShapeFactory::ShouldShowInNewMenu() const +{ + return true; +} diff --git a/ProjectFish/Source/ProjectFishEditor/Private/ProjectFishEditor.cpp b/ProjectFish/Source/ProjectFishEditor/Private/ProjectFishEditor.cpp index 48f5681..00f5653 100644 --- a/ProjectFish/Source/ProjectFishEditor/Private/ProjectFishEditor.cpp +++ b/ProjectFish/Source/ProjectFishEditor/Private/ProjectFishEditor.cpp @@ -3,10 +3,10 @@ #include "AssetTypeActions_Base.h" #include "DataTableRowSelectorCustomization.h" #include "AssetActions/BagConfigAssetTypeAction.h" -#include "AssetActions/BagShapeAssetTypeAction.h" +#include "AssetActions/ShapeAssetTypeAction.h" #include "AssetRegistry/AssetRegistryModule.h" -#include "ProjectFish/DataAsset/BagShapeAsset.h" -#include "../Public/Thumbnail/BagShapeAssetThumbnailRenderer.h" +#include "ProjectFish/DataAsset/ShapeAsset.h" +#include "../Public/Thumbnail/ShapeAssetThumbnailRenderer.h" #include "../Public/Thumbnail/BagConfigThumbnailRenderer.h" #include "AssetActions/SkillAssetTypeAction.h" #include "ProjectFish/DataAsset/BagConfigAsset.h" @@ -44,7 +44,7 @@ void FProjectFishEditorModule::RegisterAssetTypeActions() //注册背包形状的菜单 EAssetTypeCategories::Type BogShapeAssetCategory = AssetTools.RegisterAdvancedAssetCategory(FName(TEXT("BagShape")), FText::FromString(TEXT("BagSystem"))); //BagShape - TSharedRef BagShapeAction = MakeShareable(new FBagShapeAssetTypeAction(BogShapeAssetCategory)); + TSharedRef BagShapeAction = MakeShareable(new FShapeAssetTypeAction(BogShapeAssetCategory)); AssetTools.RegisterAssetTypeActions(BagShapeAction); CreatedAssetTypeActions.Add(BagShapeAction); @@ -77,7 +77,7 @@ void FProjectFishEditorModule::UnregisterAssetTypeActions() void FProjectFishEditorModule::RegisterThumbnailRenderers() { - UThumbnailManager::Get().RegisterCustomRenderer(UBagShapeAsset::StaticClass(), UBagShapeAssetThumbnailRenderer::StaticClass()); + UThumbnailManager::Get().RegisterCustomRenderer(UShapeAsset::StaticClass(), UShapeAssetThumbnailRenderer::StaticClass()); UThumbnailManager::Get().RegisterCustomRenderer(UBagConfigAsset::StaticClass(), UBagConfigThumbnailRenderer::StaticClass()); RefreshExistingAssetThumbnails(); } @@ -86,7 +86,7 @@ void FProjectFishEditorModule::UnregisterThumbnailRenderers() { if (UObjectInitialized()) { - UThumbnailManager::Get().UnregisterCustomRenderer(UBagShapeAsset::StaticClass()); + UThumbnailManager::Get().UnregisterCustomRenderer(UShapeAsset::StaticClass()); UThumbnailManager::Get().UnregisterCustomRenderer(UBagConfigAsset::StaticClass()); } } @@ -103,7 +103,7 @@ void FProjectFishEditorModule::RefreshExistingAssetThumbnails() // 查找所有BagShapeAsset资产 TArray BagShapeAssetList; - AssetRegistry.GetAssetsByClass(UBagShapeAsset::StaticClass()->GetClassPathName(), BagShapeAssetList); + AssetRegistry.GetAssetsByClass(UShapeAsset::StaticClass()->GetClassPathName(), BagShapeAssetList); // 查找所有BagClass资产 TArray BagConfigAssetList; diff --git a/ProjectFish/Source/ProjectFishEditor/Private/Thumbnail/BagConfigThumbnailRenderer.cpp b/ProjectFish/Source/ProjectFishEditor/Private/Thumbnail/BagConfigThumbnailRenderer.cpp index f126563..6296ca0 100644 --- a/ProjectFish/Source/ProjectFishEditor/Private/Thumbnail/BagConfigThumbnailRenderer.cpp +++ b/ProjectFish/Source/ProjectFishEditor/Private/Thumbnail/BagConfigThumbnailRenderer.cpp @@ -6,7 +6,7 @@ #include "CanvasItem.h" #include "CanvasTypes.h" #include "ProjectFish/DataAsset/BagConfigAsset.h" -#include "ProjectFish/DataAsset/BagShapeAsset.h" +#include "ProjectFish/DataAsset/ShapeAsset.h" bool UBagConfigThumbnailRenderer::CanVisualizeAsset(UObject* Object) { @@ -43,7 +43,7 @@ void UBagConfigThumbnailRenderer::DrawBag(UBagConfigAsset* BagConfig, FCanvas* C return; } - UBagShapeAsset* BagShapeAsset = BagConfig->BagShapeAsset; + UShapeAsset* BagShapeAsset = BagConfig->BagShapeAsset; // Clear the background FCanvasBoxItem BackgroundBox(FVector2D(X, Y), FVector2D(Width, Height)); @@ -52,19 +52,19 @@ void UBagConfigThumbnailRenderer::DrawBag(UBagConfigAsset* BagConfig, FCanvas* C // Calculate the best fit scale with spacing for separators float SeparatorWidth = 2.0f; // White separator width - float Scale = GetBestFitScale(BagShapeAsset->BagWidth, BagShapeAsset->BagHeight, Width, Height); + float Scale = GetBestFitScale(BagShapeAsset->ShapeWidth, BagShapeAsset->ShapeHeight, Width, Height); float CellSize = Scale - SeparatorWidth; // Reduce cell size to make room for separators // Calculate starting position to center the grid (including separators) - float GridWidth = BagShapeAsset->BagWidth * Scale - SeparatorWidth; - float GridHeight = BagShapeAsset->BagHeight * Scale - SeparatorWidth; + float GridWidth = BagShapeAsset->ShapeWidth * Scale - SeparatorWidth; + float GridHeight = BagShapeAsset->ShapeHeight * Scale - SeparatorWidth; float StartX = X + (Width - GridWidth) * 0.5f; float StartY = Y + (Height - GridHeight) * 0.5f; // Draw the bag slots (background) with separators - for (int32 GridY = 0; GridY < BagShapeAsset->BagHeight; GridY++) + for (int32 GridY = 0; GridY < BagShapeAsset->ShapeHeight; GridY++) { - for (int32 GridX = 0; GridX < BagShapeAsset->BagWidth; GridX++) + for (int32 GridX = 0; GridX < BagShapeAsset->ShapeWidth; GridX++) { float CellStartX = StartX + GridX * Scale; float CellStartY = StartY + GridY * Scale; @@ -81,7 +81,7 @@ void UBagConfigThumbnailRenderer::DrawBag(UBagConfigAsset* BagConfig, FCanvas* C // Draw white separators // Vertical separators - for (int32 GridX = 1; GridX < BagShapeAsset->BagWidth; GridX++) + for (int32 GridX = 1; GridX < BagShapeAsset->ShapeWidth; GridX++) { float SeparatorX = StartX + GridX * Scale - SeparatorWidth; FCanvasTileItem VerticalSeparator(FVector2D(SeparatorX, StartY), FVector2D(SeparatorWidth, GridHeight), FLinearColor::White); @@ -90,7 +90,7 @@ void UBagConfigThumbnailRenderer::DrawBag(UBagConfigAsset* BagConfig, FCanvas* C } // Horizontal separators - for (int32 GridY = 1; GridY < BagShapeAsset->BagHeight; GridY++) + for (int32 GridY = 1; GridY < BagShapeAsset->ShapeHeight; GridY++) { float SeparatorY = StartY + GridY * Scale - SeparatorWidth; FCanvasTileItem HorizontalSeparator(FVector2D(StartX, SeparatorY), FVector2D(GridWidth, SeparatorWidth), FLinearColor::White); @@ -111,10 +111,10 @@ void UBagConfigThumbnailRenderer::DrawBag(UBagConfigAsset* BagConfig, FCanvas* C Canvas->DrawItem(OuterBorder); } -float UBagConfigThumbnailRenderer::GetBestFitScale(int32 BagWidth, int32 BagHeight, uint32 CanvasWidth, +float UBagConfigThumbnailRenderer::GetBestFitScale(int32 ShapeWidth, int32 ShapeHeight, uint32 CanvasWidth, uint32 CanvasHeight) const { - if (BagWidth == 0 || BagHeight == 0) + if (ShapeWidth == 0 || ShapeHeight == 0) { return 1.0f; } @@ -123,8 +123,8 @@ float UBagConfigThumbnailRenderer::GetBestFitScale(int32 BagWidth, int32 BagHeig float PaddedWidth = CanvasWidth * 0.85f; float PaddedHeight = CanvasHeight * 0.85f; - float ScaleX = PaddedWidth / BagWidth; - float ScaleY = PaddedHeight / BagHeight; + float ScaleX = PaddedWidth / ShapeWidth; + float ScaleY = PaddedHeight / ShapeHeight; // Use the smaller scale to ensure everything fits float Scale = FMath::Min(ScaleX, ScaleY); diff --git a/ProjectFish/Source/ProjectFishEditor/Private/Thumbnail/BagShapeAssetThumbnailRenderer.cpp b/ProjectFish/Source/ProjectFishEditor/Private/Thumbnail/ShapeAssetThumbnailRenderer.cpp similarity index 76% rename from ProjectFish/Source/ProjectFishEditor/Private/Thumbnail/BagShapeAssetThumbnailRenderer.cpp rename to ProjectFish/Source/ProjectFishEditor/Private/Thumbnail/ShapeAssetThumbnailRenderer.cpp index 81d265c..1b63b80 100644 --- a/ProjectFish/Source/ProjectFishEditor/Private/Thumbnail/BagShapeAssetThumbnailRenderer.cpp +++ b/ProjectFish/Source/ProjectFishEditor/Private/Thumbnail/ShapeAssetThumbnailRenderer.cpp @@ -1,21 +1,21 @@ // Fill out your copyright notice in the Description page of Project Settings. -#include "ProjectFishEditor/Public/Thumbnail/BagShapeAssetThumbnailRenderer.h" +#include "ProjectFishEditor/Public/Thumbnail/ShapeAssetThumbnailRenderer.h" #include "CanvasItem.h" #include "CanvasTypes.h" -#include "ProjectFish/DataAsset/BagShapeAsset.h" +#include "ProjectFish/DataAsset/ShapeAsset.h" -bool UBagShapeAssetThumbnailRenderer::CanVisualizeAsset(UObject* Object) +bool UShapeAssetThumbnailRenderer::CanVisualizeAsset(UObject* Object) { - return Cast(Object) != nullptr; + return Cast(Object) != nullptr; } -void UBagShapeAssetThumbnailRenderer::Draw(UObject* Object, int32 X, int32 Y, uint32 Width, uint32 Height, +void UShapeAssetThumbnailRenderer::Draw(UObject* Object, int32 X, int32 Y, uint32 Width, uint32 Height, FRenderTarget* RenderTarget, FCanvas* Canvas, bool bAdditionalViewFamily) { - UBagShapeAsset* BagShapeAsset = Cast(Object); + UShapeAsset* BagShapeAsset = Cast(Object); if (!BagShapeAsset || !Canvas) { return; @@ -24,7 +24,7 @@ void UBagShapeAssetThumbnailRenderer::Draw(UObject* Object, int32 X, int32 Y, ui DrawBagShape(BagShapeAsset, Canvas, X, Y, Width, Height); } -void UBagShapeAssetThumbnailRenderer::DrawBagShape(UBagShapeAsset* BagShapeAsset, FCanvas* Canvas, int32 X, int32 Y, +void UShapeAssetThumbnailRenderer::DrawBagShape(UShapeAsset* BagShapeAsset, FCanvas* Canvas, int32 X, int32 Y, uint32 Width, uint32 Height) { if (!BagShapeAsset || !Canvas) @@ -39,19 +39,19 @@ void UBagShapeAssetThumbnailRenderer::DrawBagShape(UBagShapeAsset* BagShapeAsset // Calculate the best fit scale with spacing for separators float SeparatorWidth = 2.0f; // White separator width - float Scale = GetBestFitScale(BagShapeAsset->BagWidth, BagShapeAsset->BagHeight, Width, Height); + float Scale = GetBestFitScale(BagShapeAsset->ShapeWidth, BagShapeAsset->ShapeHeight, Width, Height); float CellSize = Scale - SeparatorWidth; // Reduce cell size to make room for separators // Calculate starting position to center the grid (including separators) - float GridWidth = BagShapeAsset->BagWidth * Scale - SeparatorWidth; - float GridHeight = BagShapeAsset->BagHeight * Scale - SeparatorWidth; + float GridWidth = BagShapeAsset->ShapeWidth * Scale - SeparatorWidth; + float GridHeight = BagShapeAsset->ShapeHeight * Scale - SeparatorWidth; float StartX = X + (Width - GridWidth) * 0.5f; float StartY = Y + (Height - GridHeight) * 0.5f; // Draw the bag slots (background) with separators - for (int32 GridY = 0; GridY < BagShapeAsset->BagHeight; GridY++) + for (int32 GridY = 0; GridY < BagShapeAsset->ShapeHeight; GridY++) { - for (int32 GridX = 0; GridX < BagShapeAsset->BagWidth; GridX++) + for (int32 GridX = 0; GridX < BagShapeAsset->ShapeWidth; GridX++) { float CellStartX = StartX + GridX * Scale; float CellStartY = StartY + GridY * Scale; @@ -92,7 +92,7 @@ void UBagShapeAssetThumbnailRenderer::DrawBagShape(UBagShapeAsset* BagShapeAsset // Canvas->DrawItem(OuterBorder); } -float UBagShapeAssetThumbnailRenderer::GetBestFitScale(int32 BagWidth, int32 BagHeight, uint32 CanvasWidth, +float UShapeAssetThumbnailRenderer::GetBestFitScale(int32 BagWidth, int32 BagHeight, uint32 CanvasWidth, uint32 CanvasHeight) const { if (BagWidth == 0 || BagHeight == 0) diff --git a/ProjectFish/Source/ProjectFishEditor/Private/Widgets/BagConfigEditorWidget.cpp b/ProjectFish/Source/ProjectFishEditor/Private/Widgets/BagConfigEditorWidget.cpp index fd6ff18..729f8b8 100644 --- a/ProjectFish/Source/ProjectFishEditor/Private/Widgets/BagConfigEditorWidget.cpp +++ b/ProjectFish/Source/ProjectFishEditor/Private/Widgets/BagConfigEditorWidget.cpp @@ -5,9 +5,9 @@ #include "PropertyCustomizationHelpers.h" #include "Framework/Notifications/NotificationManager.h" -#include "ProjectFish/DataAsset/BagShapeAsset.h" +#include "ProjectFish/DataAsset/ShapeAsset.h" #include "Widgets/BagConfigGridWidget.h" -#include "Widgets/BagShapeGridWidget.h" +#include "Widgets/ShapeGridWidget.h" #include "Widgets/SkillListWidget.h" #include "Widgets/Notifications/SNotificationList.h" @@ -49,7 +49,7 @@ void SBagConfigEditorWidget::Construct(const FArguments& InArgs) return BagConfig.IsValid() && BagConfig->BagShapeAsset ? BagConfig->BagShapeAsset->GetPathName() : FString(); }) - .AllowedClass(UBagShapeAsset::StaticClass()) + .AllowedClass(UShapeAsset::StaticClass()) .OnObjectChanged(this, &SBagConfigEditorWidget::OnBagShapeAssetChanged) .DisplayUseSelected(true) .DisplayBrowse(true) @@ -167,8 +167,8 @@ void SBagConfigEditorWidget::Construct(const FArguments& InArgs) { return FText::FromString(FString::Printf(TEXT("Bag: %s (%dx%d)"), *BagConfig->BagShapeAsset->GetName(), - BagConfig->BagShapeAsset->BagWidth, - BagConfig->BagShapeAsset->BagHeight)); + BagConfig->BagShapeAsset->ShapeWidth, + BagConfig->BagShapeAsset->ShapeHeight)); } }) .Font(FCoreStyle::GetDefaultFontStyle("Bold", 12)) @@ -284,7 +284,7 @@ void SBagConfigEditorWidget::OnBagShapeAssetChanged(const FAssetData& AssetData) } // 获取新选择的BagShapeAsset - UBagShapeAsset* NewBagShapeAsset = Cast(AssetData.GetAsset()); + UShapeAsset* NewBagShapeAsset = Cast(AssetData.GetAsset()); // 如果选择了不同的资源,清空现有技能并更新引用 if (BagConfig->BagShapeAsset != NewBagShapeAsset) diff --git a/ProjectFish/Source/ProjectFishEditor/Private/Widgets/BagConfigGridWidget.cpp b/ProjectFish/Source/ProjectFishEditor/Private/Widgets/BagConfigGridWidget.cpp index 5e74aa4..cffd38d 100644 --- a/ProjectFish/Source/ProjectFishEditor/Private/Widgets/BagConfigGridWidget.cpp +++ b/ProjectFish/Source/ProjectFishEditor/Private/Widgets/BagConfigGridWidget.cpp @@ -3,7 +3,7 @@ #include "Widgets/BagConfigGridWidget.h" -#include "ProjectFish/DataAsset/BagShapeAsset.h" +#include "ProjectFish/DataAsset/ShapeAsset.h" const float SBagConfigGridWidget::CellSize = 32.0f; const float SBagConfigGridWidget::CellSpacing = 2.0f; @@ -130,12 +130,12 @@ int32 SBagConfigGridWidget::OnPaint(const FPaintArgs& Args, const FGeometry& All return LayerId; } - UBagShapeAsset* BagShapeAsset = BagConfig->BagShapeAsset; + UShapeAsset* BagShapeAsset = BagConfig->BagShapeAsset; // 绘制背包格子 - for (int32 Y = 0; Y < BagShapeAsset->BagHeight; Y++) + for (int32 Y = 0; Y < BagShapeAsset->ShapeHeight; Y++) { - for (int32 X = 0; X < BagShapeAsset->BagWidth; X++) + for (int32 X = 0; X < BagShapeAsset->ShapeWidth; X++) { FVector2D CellPos = GetCellPosition(X, Y); FVector2D CellSizeVec(CellSize, CellSize); @@ -251,10 +251,10 @@ FVector2D SBagConfigGridWidget::ComputeDesiredSize(float X) const return FVector2D(100, 100); } - UBagShapeAsset* BagShapeAsset = BagConfig->BagShapeAsset; + UShapeAsset* BagShapeAsset = BagConfig->BagShapeAsset; return FVector2D( - BagShapeAsset->BagWidth * (CellSize + CellSpacing) - CellSpacing, - BagShapeAsset->BagHeight * (CellSize + CellSpacing) - CellSpacing + BagShapeAsset->ShapeWidth * (CellSize + CellSpacing) - CellSpacing, + BagShapeAsset->ShapeHeight * (CellSize + CellSpacing) - CellSpacing ); } @@ -273,8 +273,8 @@ bool SBagConfigGridWidget::IsValidGridPosition(int32 X, int32 Y) const return false; } - return X >= 0 && X < BagConfig->BagShapeAsset->BagWidth && - Y >= 0 && Y < BagConfig->BagShapeAsset->BagHeight; + return X >= 0 && X < BagConfig->BagShapeAsset->ShapeWidth && + Y >= 0 && Y < BagConfig->BagShapeAsset->ShapeHeight; } FLinearColor SBagConfigGridWidget::GetCellColor(int32 X, int32 Y) const diff --git a/ProjectFish/Source/ProjectFishEditor/Private/Widgets/BagShapeEditorWidget.cpp b/ProjectFish/Source/ProjectFishEditor/Private/Widgets/BagShapeEditorWidget.cpp index f031162..539567e 100644 --- a/ProjectFish/Source/ProjectFishEditor/Private/Widgets/BagShapeEditorWidget.cpp +++ b/ProjectFish/Source/ProjectFishEditor/Private/Widgets/BagShapeEditorWidget.cpp @@ -6,7 +6,7 @@ #include "EditorStyleSet.h" -void SBagShapeEditorWidget::Construct(const FArguments& InArgs) +void SShapeEditorWidget::Construct(const FArguments& InArgs) { BagShapeAsset = InArgs._BagShapeAsset; @@ -38,9 +38,9 @@ void SBagShapeEditorWidget::Construct(const FArguments& InArgs) .HAlign(HAlign_Center) .VAlign(VAlign_Center) [ - SAssignNew(GridWidget, SBagShapeGridWidget) + SAssignNew(GridWidget, SShapeGridWidget) .BagShapeAsset(BagShapeAsset.Get()) - .OnSlotClicked(this, &SBagShapeEditorWidget::OnSlotClicked) + .OnSlotClicked(this, &SShapeEditorWidget::OnSlotClicked) ] ] ] @@ -48,7 +48,7 @@ void SBagShapeEditorWidget::Construct(const FArguments& InArgs) ]; } -void SBagShapeEditorWidget::RefreshGrid() +void SShapeEditorWidget::RefreshGrid() { if (GridWidget.IsValid()) { @@ -56,7 +56,7 @@ void SBagShapeEditorWidget::RefreshGrid() } } -TSharedRef SBagShapeEditorWidget::CreateSizeControls() +TSharedRef SShapeEditorWidget::CreateSizeControls() { return SNew(SBorder) .BorderImage(FEditorStyle::GetBrush("ToolPanel.GroupBorder")) @@ -93,8 +93,8 @@ TSharedRef SBagShapeEditorWidget::CreateSizeControls() SNew(SSpinBox) .MinValue(1) .MaxValue(10) - .Value(this, &SBagShapeEditorWidget::GetBagWidth) - .OnValueChanged(this, &SBagShapeEditorWidget::OnWidthChanged) + .Value(this, &SShapeEditorWidget::GetShapeWidth) + .OnValueChanged(this, &SShapeEditorWidget::OnWidthChanged) ] ] + SHorizontalBox::Slot() @@ -114,47 +114,47 @@ TSharedRef SBagShapeEditorWidget::CreateSizeControls() SNew(SSpinBox) .MinValue(1) .MaxValue(10) - .Value(this, &SBagShapeEditorWidget::GetBagHeight) - .OnValueChanged(this, &SBagShapeEditorWidget::OnHeightChanged) + .Value(this, &SShapeEditorWidget::GetShapeHeight) + .OnValueChanged(this, &SShapeEditorWidget::OnHeightChanged) ] ] ] ]; } -int32 SBagShapeEditorWidget::GetBagWidth() const +int32 SShapeEditorWidget::GetShapeWidth() const { - return BagShapeAsset.IsValid() ? BagShapeAsset->BagWidth : 5; + return BagShapeAsset.IsValid() ? BagShapeAsset->ShapeWidth : 5; } -int32 SBagShapeEditorWidget::GetBagHeight() const +int32 SShapeEditorWidget::GetShapeHeight() const { - return BagShapeAsset.IsValid() ? BagShapeAsset->BagHeight : 5; + return BagShapeAsset.IsValid() ? BagShapeAsset->ShapeHeight : 5; } -void SBagShapeEditorWidget::OnWidthChanged(int32 NewWidth) +void SShapeEditorWidget::OnWidthChanged(int32 NewWidth) { - if (BagShapeAsset.IsValid() && NewWidth != BagShapeAsset->BagWidth) + if (BagShapeAsset.IsValid() && NewWidth != BagShapeAsset->ShapeWidth) { - BagShapeAsset->BagWidth = NewWidth; - BagShapeAsset->InitializeBagShape(); + BagShapeAsset->ShapeWidth = NewWidth; + BagShapeAsset->InitializeShape(); BagShapeAsset->MarkPackageDirty(); RefreshGrid(); } } -void SBagShapeEditorWidget::OnHeightChanged(int32 NewHeight) +void SShapeEditorWidget::OnHeightChanged(int32 NewHeight) { - if (BagShapeAsset.IsValid() && NewHeight != BagShapeAsset->BagHeight) + if (BagShapeAsset.IsValid() && NewHeight != BagShapeAsset->ShapeHeight) { - BagShapeAsset->BagHeight = NewHeight; - BagShapeAsset->InitializeBagShape(); + BagShapeAsset->ShapeHeight = NewHeight; + BagShapeAsset->InitializeShape(); BagShapeAsset->MarkPackageDirty(); RefreshGrid(); } } -TSharedRef SBagShapeEditorWidget::CreateGridControls() +TSharedRef SShapeEditorWidget::CreateGridControls() { return SNew(SBorder) .BorderImage(FEditorStyle::GetBrush("ToolPanel.GroupBorder")) @@ -167,7 +167,7 @@ TSharedRef SBagShapeEditorWidget::CreateGridControls() [ SNew(SButton) .Text(FText::FromString("All Enable")) - .OnClicked(this, &SBagShapeEditorWidget::OnAllEnableClicked) + .OnClicked(this, &SShapeEditorWidget::OnAllEnableClicked) ] + SHorizontalBox::Slot() .AutoWidth() @@ -175,17 +175,17 @@ TSharedRef SBagShapeEditorWidget::CreateGridControls() [ SNew(SButton) .Text(FText::FromString("All Disable")) - .OnClicked(this, &SBagShapeEditorWidget::OnAllDisableClicked) + .OnClicked(this, &SShapeEditorWidget::OnAllDisableClicked) ] ]; } -FReply SBagShapeEditorWidget::OnAllEnableClicked() +FReply SShapeEditorWidget::OnAllEnableClicked() { if (BagShapeAsset.IsValid()) { - BagShapeAsset->InitializeBagShape(); + BagShapeAsset->InitializeShape(); BagShapeAsset->MarkPackageDirty(); RefreshGrid(); RefreshThumbnail(); @@ -193,13 +193,13 @@ FReply SBagShapeEditorWidget::OnAllEnableClicked() return FReply::Handled(); } -FReply SBagShapeEditorWidget::OnAllDisableClicked() +FReply SShapeEditorWidget::OnAllDisableClicked() { if (BagShapeAsset.IsValid()) { - for (int32 X = 0; X < BagShapeAsset->BagWidth; X++) + for (int32 X = 0; X < BagShapeAsset->ShapeWidth; X++) { - for (int32 Y = 0; Y < BagShapeAsset->BagHeight; Y++) + for (int32 Y = 0; Y < BagShapeAsset->ShapeHeight; Y++) { BagShapeAsset->SetSlotActive(X, Y, false); } @@ -211,7 +211,7 @@ FReply SBagShapeEditorWidget::OnAllDisableClicked() return FReply::Handled(); } -void SBagShapeEditorWidget::OnSlotClicked(int32 X, int32 Y) +void SShapeEditorWidget::OnSlotClicked(int32 X, int32 Y) { if (!BagShapeAsset.IsValid()) { @@ -234,7 +234,7 @@ void SBagShapeEditorWidget::OnSlotClicked(int32 X, int32 Y) RefreshThumbnail(); } -void SBagShapeEditorWidget::RefreshThumbnail() +void SShapeEditorWidget::RefreshThumbnail() { if (!BagShapeAsset.IsValid()) { diff --git a/ProjectFish/Source/ProjectFishEditor/Private/Widgets/BagShapeGridWidget.cpp b/ProjectFish/Source/ProjectFishEditor/Private/Widgets/ShapeGridWidget.cpp similarity index 75% rename from ProjectFish/Source/ProjectFishEditor/Private/Widgets/BagShapeGridWidget.cpp rename to ProjectFish/Source/ProjectFishEditor/Private/Widgets/ShapeGridWidget.cpp index 1efe50b..f41a255 100644 --- a/ProjectFish/Source/ProjectFishEditor/Private/Widgets/BagShapeGridWidget.cpp +++ b/ProjectFish/Source/ProjectFishEditor/Private/Widgets/ShapeGridWidget.cpp @@ -1,23 +1,23 @@ // Fill out your copyright notice in the Description page of Project Settings. -#include "Widgets/BagShapeGridWidget.h" +#include "Widgets/ShapeGridWidget.h" -const float SBagShapeGridWidget::CellSize = 32.0f; -const float SBagShapeGridWidget::SeparatorWidth = 2.0f; -void SBagShapeGridWidget::Construct(const FArguments& InArgs) +const float SShapeGridWidget::CellSize = 32.0f; +const float SShapeGridWidget::SeparatorWidth = 2.0f; +void SShapeGridWidget::Construct(const FArguments& InArgs) { BagShapeAsset = InArgs._BagShapeAsset; OnSlotClicked = InArgs._OnSlotClicked; } -void SBagShapeGridWidget::UpdateBagShapeAsset(UBagShapeAsset* InBagShapeAsset) +void SShapeGridWidget::UpdateBagShapeAsset(UShapeAsset* InBagShapeAsset) { BagShapeAsset = InBagShapeAsset; Invalidate(EInvalidateWidget::Paint); } -FReply SBagShapeGridWidget::OnMouseButtonDown(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) +FReply SShapeGridWidget::OnMouseButtonDown(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) { if (MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton && BagShapeAsset.IsValid()) { @@ -37,7 +37,7 @@ FReply SBagShapeGridWidget::OnMouseButtonDown(const FGeometry& MyGeometry, const return FReply::Unhandled(); } -int32 SBagShapeGridWidget::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, +int32 SShapeGridWidget::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const { @@ -48,8 +48,8 @@ int32 SBagShapeGridWidget::OnPaint(const FPaintArgs& Args, const FGeometry& Allo // Calculate grid dimensions with separators float Scale = CellSize + SeparatorWidth; - float GridWidth = BagShapeAsset->BagWidth * Scale - SeparatorWidth; - float GridHeight = BagShapeAsset->BagHeight * Scale - SeparatorWidth; + float GridWidth = BagShapeAsset->ShapeWidth * Scale - SeparatorWidth; + float GridHeight = BagShapeAsset->ShapeHeight * Scale - SeparatorWidth; // Center the grid in the available space FVector2D GridStartPos = FVector2D( @@ -68,9 +68,9 @@ int32 SBagShapeGridWidget::OnPaint(const FPaintArgs& Args, const FGeometry& Allo ); // Draw cells - for (int32 Y = 0; Y < BagShapeAsset->BagHeight; Y++) + for (int32 Y = 0; Y < BagShapeAsset->ShapeHeight; Y++) { - for (int32 X = 0; X < BagShapeAsset->BagWidth; X++) + for (int32 X = 0; X < BagShapeAsset->ShapeWidth; X++) { FVector2D CellPos = GridStartPos + FVector2D(X * Scale, Y * Scale); bool bIsActive = BagShapeAsset->IsSlotActive(X, Y); @@ -89,7 +89,7 @@ int32 SBagShapeGridWidget::OnPaint(const FPaintArgs& Args, const FGeometry& Allo } // Draw vertical separators - for (int32 X = 1; X < BagShapeAsset->BagWidth; X++) + for (int32 X = 1; X < BagShapeAsset->ShapeWidth; X++) { float SeparatorX = GridStartPos.X + X * Scale - SeparatorWidth; FSlateDrawElement::MakeBox( @@ -103,7 +103,7 @@ int32 SBagShapeGridWidget::OnPaint(const FPaintArgs& Args, const FGeometry& Allo } // Draw horizontal separators - for (int32 Y = 1; Y < BagShapeAsset->BagHeight; Y++) + for (int32 Y = 1; Y < BagShapeAsset->ShapeHeight; Y++) { float SeparatorY = GridStartPos.Y + Y * Scale - SeparatorWidth; FSlateDrawElement::MakeBox( @@ -129,7 +129,7 @@ int32 SBagShapeGridWidget::OnPaint(const FPaintArgs& Args, const FGeometry& Allo return LayerId + 4; } -FVector2D SBagShapeGridWidget::ComputeDesiredSize(float X) const +FVector2D SShapeGridWidget::ComputeDesiredSize(float X) const { if (!BagShapeAsset.IsValid()) { @@ -138,12 +138,12 @@ FVector2D SBagShapeGridWidget::ComputeDesiredSize(float X) const float Scale = CellSize + SeparatorWidth; return FVector2D( - BagShapeAsset->BagWidth * Scale - SeparatorWidth + 20.0f, // Add padding - BagShapeAsset->BagHeight * Scale - SeparatorWidth + 20.0f + BagShapeAsset->ShapeWidth * Scale - SeparatorWidth + 20.0f, // Add padding + BagShapeAsset->ShapeHeight * Scale - SeparatorWidth + 20.0f ); } -FVector2D SBagShapeGridWidget::GetGridCellFromPosition(const FVector2D& Position) const +FVector2D SShapeGridWidget::GetGridCellFromPosition(const FVector2D& Position) const { if (!BagShapeAsset.IsValid()) { @@ -151,8 +151,8 @@ FVector2D SBagShapeGridWidget::GetGridCellFromPosition(const FVector2D& Position } float Scale = CellSize + SeparatorWidth; - float GridWidth = BagShapeAsset->BagWidth * Scale - SeparatorWidth; - float GridHeight = BagShapeAsset->BagHeight * Scale - SeparatorWidth; + float GridWidth = BagShapeAsset->ShapeWidth * Scale - SeparatorWidth; + float GridHeight = BagShapeAsset->ShapeHeight * Scale - SeparatorWidth; FVector2D GridStartPos = FVector2D( (GetCachedGeometry().GetLocalSize().X - GridWidth) * 0.5f, @@ -167,11 +167,11 @@ FVector2D SBagShapeGridWidget::GetGridCellFromPosition(const FVector2D& Position ); } -bool SBagShapeGridWidget::IsValidGridPosition(int32 X, int32 Y) const +bool SShapeGridWidget::IsValidGridPosition(int32 X, int32 Y) const { if (!BagShapeAsset.IsValid()) { return false; } - return X >= 0 && X < BagShapeAsset->BagWidth && Y >= 0 && Y < BagShapeAsset->BagHeight; + return X >= 0 && X < BagShapeAsset->ShapeWidth && Y >= 0 && Y < BagShapeAsset->ShapeHeight; } diff --git a/ProjectFish/Source/ProjectFishEditor/Public/AssetActions/BagShapeAssetTypeAction.h b/ProjectFish/Source/ProjectFishEditor/Public/AssetActions/ShapeAssetTypeAction.h similarity index 86% rename from ProjectFish/Source/ProjectFishEditor/Public/AssetActions/BagShapeAssetTypeAction.h rename to ProjectFish/Source/ProjectFishEditor/Public/AssetActions/ShapeAssetTypeAction.h index 0a809a1..abecd97 100644 --- a/ProjectFish/Source/ProjectFishEditor/Public/AssetActions/BagShapeAssetTypeAction.h +++ b/ProjectFish/Source/ProjectFishEditor/Public/AssetActions/ShapeAssetTypeAction.h @@ -8,10 +8,10 @@ /** * */ -class PROJECTFISHEDITOR_API FBagShapeAssetTypeAction: public FAssetTypeActions_Base +class PROJECTFISHEDITOR_API FShapeAssetTypeAction: public FAssetTypeActions_Base { public: - FBagShapeAssetTypeAction(EAssetTypeCategories::Type InAssetCategory) + FShapeAssetTypeAction(EAssetTypeCategories::Type InAssetCategory) { MyAssetCategory = InAssetCategory; } diff --git a/ProjectFish/Source/ProjectFishEditor/Public/AssetEditor/BagShapeAssetEditor.h b/ProjectFish/Source/ProjectFishEditor/Public/AssetEditor/ShapeAssetEditor.h similarity index 77% rename from ProjectFish/Source/ProjectFishEditor/Public/AssetEditor/BagShapeAssetEditor.h rename to ProjectFish/Source/ProjectFishEditor/Public/AssetEditor/ShapeAssetEditor.h index 5e12baf..48fedd0 100644 --- a/ProjectFish/Source/ProjectFishEditor/Public/AssetEditor/BagShapeAssetEditor.h +++ b/ProjectFish/Source/ProjectFishEditor/Public/AssetEditor/ShapeAssetEditor.h @@ -7,10 +7,10 @@ /** * */ -class PROJECTFISHEDITOR_API FBagShapeAssetEditor: public FAssetEditorToolkit +class PROJECTFISHEDITOR_API FShapeAssetEditor: public FAssetEditorToolkit { public: - void Initialize(const EToolkitMode::Type Mode, const TSharedPtr& InitToolkitHost, class UBagShapeAsset* InBagShapeAsset); + void Initialize(const EToolkitMode::Type Mode, const TSharedPtr& InitToolkitHost, class UShapeAsset* InBagShapeAsset); // IAssetEditorInstance interface virtual FName GetToolkitFName() const override; @@ -25,9 +25,9 @@ public: private: TSharedRef SpawnBagShapeEditorTab(const FSpawnTabArgs& Args); - class UBagShapeAsset* BagShapeAsset; + class UShapeAsset* ShapeAsset; /** Tab IDs */ - static const FName BagShapeEditorTabId; + static const FName ShapeEditorTabId; }; diff --git a/ProjectFish/Source/ProjectFishEditor/Public/Factory/BagShapeFactory.h b/ProjectFish/Source/ProjectFishEditor/Public/Factory/ShapeFactory.h similarity index 77% rename from ProjectFish/Source/ProjectFishEditor/Public/Factory/BagShapeFactory.h rename to ProjectFish/Source/ProjectFishEditor/Public/Factory/ShapeFactory.h index 775873f..9ea152e 100644 --- a/ProjectFish/Source/ProjectFishEditor/Public/Factory/BagShapeFactory.h +++ b/ProjectFish/Source/ProjectFishEditor/Public/Factory/ShapeFactory.h @@ -4,17 +4,17 @@ #include "CoreMinimal.h" #include "Factories/Factory.h" -#include "BagShapeFactory.generated.h" +#include "ShapeFactory.generated.h" /** * */ UCLASS() -class PROJECTFISHEDITOR_API UBagShapeFactory : public UFactory +class PROJECTFISHEDITOR_API UShapeFactory : public UFactory { GENERATED_BODY() public: - UBagShapeFactory(); + UShapeFactory(); //interface virtual UObject* FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn) override; diff --git a/ProjectFish/Source/ProjectFishEditor/Public/Thumbnail/BagShapeAssetThumbnailRenderer.h b/ProjectFish/Source/ProjectFishEditor/Public/Thumbnail/ShapeAssetThumbnailRenderer.h similarity index 70% rename from ProjectFish/Source/ProjectFishEditor/Public/Thumbnail/BagShapeAssetThumbnailRenderer.h rename to ProjectFish/Source/ProjectFishEditor/Public/Thumbnail/ShapeAssetThumbnailRenderer.h index aedd543..d9a8177 100644 --- a/ProjectFish/Source/ProjectFishEditor/Public/Thumbnail/BagShapeAssetThumbnailRenderer.h +++ b/ProjectFish/Source/ProjectFishEditor/Public/Thumbnail/ShapeAssetThumbnailRenderer.h @@ -4,13 +4,13 @@ #include "CoreMinimal.h" #include "ThumbnailRendering/DefaultSizedThumbnailRenderer.h" -#include "BagShapeAssetThumbnailRenderer.generated.h" +#include "ShapeAssetThumbnailRenderer.generated.h" /** * */ UCLASS() -class PROJECTFISHEDITOR_API UBagShapeAssetThumbnailRenderer : public UDefaultSizedThumbnailRenderer +class PROJECTFISHEDITOR_API UShapeAssetThumbnailRenderer : public UDefaultSizedThumbnailRenderer { GENERATED_BODY() public: @@ -19,7 +19,7 @@ public: private: /** Draw the bag shape on canvas */ - void DrawBagShape(class UBagShapeAsset* BagShapeAsset, FCanvas* Canvas, int32 X, int32 Y, uint32 Width, uint32 Height); + void DrawBagShape(class UShapeAsset* BagShapeAsset, FCanvas* Canvas, int32 X, int32 Y, uint32 Width, uint32 Height); /** Get the best fit scale for the bag shape */ float GetBestFitScale(int32 BagWidth, int32 BagHeight, uint32 CanvasWidth, uint32 CanvasHeight) const; diff --git a/ProjectFish/Source/ProjectFishEditor/Public/Widgets/BagShapeEditorWidget.h b/ProjectFish/Source/ProjectFishEditor/Public/Widgets/BagShapeEditorWidget.h index 7aec4fe..220d222 100644 --- a/ProjectFish/Source/ProjectFishEditor/Public/Widgets/BagShapeEditorWidget.h +++ b/ProjectFish/Source/ProjectFishEditor/Public/Widgets/BagShapeEditorWidget.h @@ -3,17 +3,17 @@ #pragma once #include "CoreMinimal.h" -#include "BagShapeGridWidget.h" -#include "ProjectFish/DataAsset/BagShapeAsset.h" +#include "ShapeGridWidget.h" +#include "ProjectFish/DataAsset/ShapeAsset.h" /** * */ -class PROJECTFISHEDITOR_API SBagShapeEditorWidget: public SCompoundWidget +class PROJECTFISHEDITOR_API SShapeEditorWidget: public SCompoundWidget { public: - SLATE_BEGIN_ARGS(SBagShapeEditorWidget) {} - SLATE_ARGUMENT(UBagShapeAsset*, BagShapeAsset) + SLATE_BEGIN_ARGS(SShapeEditorWidget) {} + SLATE_ARGUMENT(UShapeAsset*, BagShapeAsset) SLATE_END_ARGS() void Construct(const FArguments& InArgs); @@ -24,9 +24,9 @@ private: //背包大小UI TSharedRef CreateSizeControls(); /** Get the current bag width */ - int32 GetBagWidth() const; + int32 GetShapeWidth() const; /** Get the current bag height */ - int32 GetBagHeight() const; + int32 GetShapeHeight() const; /** Handle width spin box value change */ void OnWidthChanged(int32 NewWidth); /** Handle height spin box value change */ @@ -43,6 +43,6 @@ private: //刷新图标 void RefreshThumbnail(); private: - TWeakObjectPtr BagShapeAsset; - TSharedPtr GridWidget; + TWeakObjectPtr BagShapeAsset; + TSharedPtr GridWidget; }; diff --git a/ProjectFish/Source/ProjectFishEditor/Public/Widgets/BagShapeGridWidget.h b/ProjectFish/Source/ProjectFishEditor/Public/Widgets/ShapeGridWidget.h similarity index 76% rename from ProjectFish/Source/ProjectFishEditor/Public/Widgets/BagShapeGridWidget.h rename to ProjectFish/Source/ProjectFishEditor/Public/Widgets/ShapeGridWidget.h index 95e6ee6..e4a60b5 100644 --- a/ProjectFish/Source/ProjectFishEditor/Public/Widgets/BagShapeGridWidget.h +++ b/ProjectFish/Source/ProjectFishEditor/Public/Widgets/ShapeGridWidget.h @@ -3,23 +3,23 @@ #pragma once #include "CoreMinimal.h" -#include "ProjectFish/DataAsset/BagShapeAsset.h" +#include "ProjectFish/DataAsset/ShapeAsset.h" DECLARE_DELEGATE_TwoParams(FOnSlotClicked, int32, int32); /** * */ -class SBagShapeGridWidget : public SCompoundWidget +class SShapeGridWidget : public SCompoundWidget { public: - SLATE_BEGIN_ARGS(SBagShapeGridWidget) {} - SLATE_ARGUMENT(UBagShapeAsset*, BagShapeAsset) + SLATE_BEGIN_ARGS(SShapeGridWidget) {} + SLATE_ARGUMENT(UShapeAsset*, BagShapeAsset) SLATE_EVENT(FOnSlotClicked, OnSlotClicked) SLATE_END_ARGS() void Construct(const FArguments& InArgs); - void UpdateBagShapeAsset(UBagShapeAsset* InBagShapeAsset); + void UpdateBagShapeAsset(UShapeAsset* InBagShapeAsset); // SWidget interface virtual FReply OnMouseButtonDown(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) override; @@ -31,7 +31,7 @@ private: static const float CellSize; static const float SeparatorWidth; - TWeakObjectPtr BagShapeAsset; + TWeakObjectPtr BagShapeAsset; FOnSlotClicked OnSlotClicked; FVector2D GetGridCellFromPosition(const FVector2D& Position) const;