// Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "CoreMinimal.h" #include "ProjectFish/DataAsset/BagConfigAsset.h" /** * */ DECLARE_DELEGATE_OneParam(FOnSkillSelected, int32); class SSkillListWidget : public SCompoundWidget { public: SLATE_BEGIN_ARGS(SSkillListWidget) {} SLATE_ARGUMENT(UBagConfigAsset*, BagConfig) SLATE_EVENT(FOnSkillSelected, OnSkillSelected) SLATE_END_ARGS() void Construct(const FArguments& InArgs); // // 设置背包类 // void SetBagClass(UBagConfigAsset* InBagClass); // 刷新技能列表 void RefreshSkillList(); // // // 获取选中的技能索引 // int32 GetSelectedSkillIndex() const { return SelectedSkillIndex; } // // // 设置选中的技能 // void SetSelectedSkill(int32 SkillIndex); private: // 背包类引用 TWeakObjectPtr BagConfig; // 回调委托 FOnSkillSelected OnSkillSelected; // 选中的技能索引 int32 SelectedSkillIndex; // UI组件 TSharedPtr>> SkillListView; TArray> SkillIndices; // 列表项生成函数 TSharedRef OnGenerateSkillRow(TSharedPtr SkillIndex, const TSharedRef& OwnerTable); // 选择改变回调 void OnSkillSelectionChanged(TSharedPtr SelectedItem, ESelectInfo::Type SelectInfo); // 创建技能显示文本 FText GetSkillDisplayText(int32 SkillIndex) const; };