diff --git a/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFish-0001.dll b/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFish-0001.dll deleted file mode 100644 index 7d28d6f..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 712348f..913bd48 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 bcbccb2..0000000 Binary files a/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFishEditor-0001.dll and /dev/null differ diff --git a/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFishEditor.dll b/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFishEditor.dll index 31fff85..c2657a7 100644 Binary files a/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFishEditor.dll and b/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFishEditor.dll 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/BagSystem/BagConfig/PlayerBagConfig.uasset b/ProjectFish/Content/Gameplay/BagSystem/BagConfig/PlayerBagConfig.uasset index 6f1e45f..53c45b9 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/BagSystem/SkillAsset/AcitveSkill/Pull.uasset b/ProjectFish/Content/Gameplay/BagSystem/SkillAsset/AcitveSkill/Pull.uasset index edb89d5..ba7a075 100644 Binary files a/ProjectFish/Content/Gameplay/BagSystem/SkillAsset/AcitveSkill/Pull.uasset and b/ProjectFish/Content/Gameplay/BagSystem/SkillAsset/AcitveSkill/Pull.uasset differ diff --git a/ProjectFish/Source/ProjectFish/DataAsset/SkillAsset.h b/ProjectFish/Source/ProjectFish/DataAsset/SkillAsset.h index f774546..67c943d 100644 --- a/ProjectFish/Source/ProjectFish/DataAsset/SkillAsset.h +++ b/ProjectFish/Source/ProjectFish/DataAsset/SkillAsset.h @@ -28,6 +28,9 @@ public: UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ToolTip = "技能名称")) FText SkillName; + UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ToolTip = "技能描述")) + FText SkillDescription; + UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ToolTip = "技能分类Tag")) TArray SkillTypes; diff --git a/ProjectFish/Source/ProjectFishEditor/Private/Widgets/BagConfigGridWidget.cpp b/ProjectFish/Source/ProjectFishEditor/Private/Widgets/BagConfigGridWidget.cpp index ff845ac..5e74aa4 100644 --- a/ProjectFish/Source/ProjectFishEditor/Private/Widgets/BagConfigGridWidget.cpp +++ b/ProjectFish/Source/ProjectFishEditor/Private/Widgets/BagConfigGridWidget.cpp @@ -15,6 +15,7 @@ void SBagConfigGridWidget::Construct(const FArguments& InArgs) PreviewSkill = nullptr; PreviewX = -1; PreviewY = -1; + HoveredSkillIndex = -1; ChildSlot [ @@ -50,9 +51,76 @@ FReply SBagConfigGridWidget::OnMouseButtonDown(const FGeometry& MyGeometry, cons FReply SBagConfigGridWidget::OnMouseMove(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) { + if (BagConfig.IsValid()) + { + FVector2D LocalPosition = MyGeometry.AbsoluteToLocal(MouseEvent.GetScreenSpacePosition()); + FVector2D GridCell = GetGridCellFromPosition(LocalPosition); + + int32 GridX = FMath::FloorToInt(GridCell.X); + int32 GridY = FMath::FloorToInt(GridCell.Y); + + if (IsValidGridPosition(GridX, GridY)) + { + USkillAsset* HoveredSkill = GetSkillAtPosition(GridX, GridY); + if (HoveredSkill) + { + int32 NewHoveredIndex = BagConfig->GetSkillAtPosition(GridX, GridY); + if (NewHoveredIndex != HoveredSkillIndex) + { + HoveredSkillIndex = NewHoveredIndex; + HoveredSkillTooltip = CreateSkillTooltip(HoveredSkill); + + if (HoveredSkillTooltip.IsValid()) + { + FSlateApplication::Get().PushMenu( + AsShared(), + FWidgetPath(), + HoveredSkillTooltip.ToSharedRef(), + MouseEvent.GetScreenSpacePosition(), + FPopupTransitionEffect::None + ); + } + } + return FReply::Handled(); + } + } + + // 清除悬停状态 + if (HoveredSkillIndex != -1) + { + HoveredSkillIndex = -1; + if (HoveredSkillTooltip.IsValid()) + { + FSlateApplication::Get().DismissAllMenus(); + HoveredSkillTooltip.Reset(); + } + } + } + return FReply::Unhandled(); } +void SBagConfigGridWidget::OnMouseEnter(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) +{ + SCompoundWidget::OnMouseEnter(MyGeometry, MouseEvent); +} + +void SBagConfigGridWidget::OnMouseLeave(const FPointerEvent& MouseEvent) +{ + // 清除悬停状态 + if (HoveredSkillIndex != -1) + { + HoveredSkillIndex = -1; + if (HoveredSkillTooltip.IsValid()) + { + FSlateApplication::Get().DismissAllMenus(); + HoveredSkillTooltip.Reset(); + } + } + + SCompoundWidget::OnMouseLeave(MouseEvent); +} + int32 SBagConfigGridWidget::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const @@ -232,3 +300,52 @@ FLinearColor SBagConfigGridWidget::GetCellColor(int32 X, int32 Y) const // 空闲格子为浅灰色 return FLinearColor(0.7f, 0.7f, 0.7f, 1.0f); } + +USkillAsset* SBagConfigGridWidget::GetSkillAtPosition(int32 X, int32 Y) const +{ + if (!BagConfig.IsValid()) + { + return nullptr; + } + + int32 SkillIndex = BagConfig->GetSkillAtPosition(X, Y); + if (SkillIndex >= 0 && SkillIndex < BagConfig->PlacedSkills.Num()) + { + return BagConfig->PlacedSkills[SkillIndex].SkillAsset; + } + + return nullptr; +} + +TSharedRef SBagConfigGridWidget::CreateSkillTooltip(USkillAsset* SkillAsset) const +{ + if (!SkillAsset) + { + return SNullWidget::NullWidget; + } + + return SNew(SBorder) + .BorderImage(FCoreStyle::Get().GetBrush("ToolTip.Background")) + .Padding(FMargin(8.0f)) + [ + SNew(SVerticalBox) + + SVerticalBox::Slot() + .AutoHeight() + [ + SNew(STextBlock) + .Text(SkillAsset->SkillName) + .Font(FCoreStyle::GetDefaultFontStyle("Bold", 12)) + .ColorAndOpacity(FLinearColor::White) + ] + + SVerticalBox::Slot() + .AutoHeight() + .Padding(0, 4, 0, 0) + [ + SNew(STextBlock) + .Text(SkillAsset->SkillDescription) + .Font(FCoreStyle::GetDefaultFontStyle("Regular", 10)) + .ColorAndOpacity(FLinearColor(0.9f, 0.9f, 0.9f, 1.0f)) + .WrapTextAt(250.0f) + ] + ]; +} diff --git a/ProjectFish/Source/ProjectFishEditor/Public/Widgets/BagConfigGridWidget.h b/ProjectFish/Source/ProjectFishEditor/Public/Widgets/BagConfigGridWidget.h index d4f140d..0f718c7 100644 --- a/ProjectFish/Source/ProjectFishEditor/Public/Widgets/BagConfigGridWidget.h +++ b/ProjectFish/Source/ProjectFishEditor/Public/Widgets/BagConfigGridWidget.h @@ -35,6 +35,8 @@ protected: // Slate重写函数 virtual FReply OnMouseButtonDown(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) override; virtual FReply OnMouseMove(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) override; + virtual void OnMouseEnter(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) override; + virtual void OnMouseLeave(const FPointerEvent& MouseEvent) override; virtual int32 OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const override; @@ -52,6 +54,10 @@ private: int32 PreviewX; int32 PreviewY; + // 悬停状态 + TSharedPtr HoveredSkillTooltip; + int32 HoveredSkillIndex; + // UI参数 static const float CellSize; static const float CellSpacing; @@ -61,6 +67,8 @@ private: FVector2D GetGridCellFromPosition(const FVector2D& Position) const; bool IsValidGridPosition(int32 X, int32 Y) const; FLinearColor GetCellColor(int32 X, int32 Y) const; + USkillAsset* GetSkillAtPosition(int32 X, int32 Y) const; + TSharedRef CreateSkillTooltip(USkillAsset* SkillAsset) const; };