// Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "CoreMinimal.h" #include "ProjectFish/DataAsset/BagConfigAsset.h" DECLARE_DELEGATE_TwoParams(FOnGridCellClicked, int32, int32); /** * */ class PROJECTFISHEDITOR_API SBagConfigGridWidget : public SCompoundWidget { public: SLATE_BEGIN_ARGS(SBagConfigGridWidget) {} SLATE_ARGUMENT(UBagConfigAsset*, BagConfig) SLATE_EVENT(FOnGridCellClicked, OnGridCellClicked) SLATE_END_ARGS() void Construct(const FArguments& InArgs); // // 设置背包类 // void UpdateBagConfig(UBagConfigAsset* InBagClass); // // // 设置预览技能(用于显示放置预览) // void SetPreviewSkill(USkillAsset* InPreviewSkill, int32 PreviewX, int32 PreviewY); // // // 清除预览 // void ClearPreview(); // // 刷新显示 void RefreshGrid(); protected: // // Slate重写函数 // virtual FReply OnMouseButtonDown(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) override; // virtual FReply OnMouseMove(const FGeometry& MyGeometry, 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; // // virtual FVector2D ComputeDesiredSize(float) const override; private: // 背包类引用 TWeakObjectPtr BagClass; // 回调委托 FOnGridCellClicked OnGridCellClicked; // 预览数据 TWeakObjectPtr PreviewSkill; int32 PreviewX; int32 PreviewY; // UI参数 static const float CellSize; static const float CellSpacing; // // 工具函数 // FVector2D GetCellPosition(int32 X, int32 Y) const; // FVector2D GetGridCellFromPosition(const FVector2D& Position) const; // bool IsValidGridPosition(int32 X, int32 Y) const; // FLinearColor GetCellColor(int32 X, int32 Y) const; // int32 GetSkillAtPosition(int32 X, int32 Y) const; };