140 lines
5.8 KiB
C++
140 lines
5.8 KiB
C++
|
|
#pragma once
|
||
|
|
|
||
|
|
#include <optional>
|
||
|
|
|
||
|
|
#include "UnrealWrapper.hpp"
|
||
|
|
#include "UmgTypes.hpp"
|
||
|
|
#include "Widget.hpp"
|
||
|
|
#include "UserWidget.hpp"
|
||
|
|
#include "WidgetTree.hpp"
|
||
|
|
#include "CanvasPanel.hpp"
|
||
|
|
#include "Overlay.hpp"
|
||
|
|
|
||
|
|
namespace PalUIExtension::Api
|
||
|
|
{
|
||
|
|
// ==================================================================
|
||
|
|
// WBP_PalCommonCharacterSlotButton_C
|
||
|
|
// ==================================================================
|
||
|
|
class PalCommonCharacterSlotButton : public UserWidget
|
||
|
|
{
|
||
|
|
public:
|
||
|
|
static auto ClassPath() -> const TCHAR*
|
||
|
|
{
|
||
|
|
return STR("/Game/Pal/Blueprint/UI/Thumbnails/Character/"
|
||
|
|
"WBP_PalCommonCharacterSlotButton.WBP_PalCommonCharacterSlotButton_C");
|
||
|
|
}
|
||
|
|
static auto DebugTag() -> const TCHAR* { return STR("PalSlotButton"); }
|
||
|
|
|
||
|
|
PalCommonCharacterSlotButton() = default;
|
||
|
|
explicit PalCommonCharacterSlotButton(UObject* Obj)
|
||
|
|
: UserWidget(Obj, ClassOf<PalCommonCharacterSlotButton>(), DebugTag()) {}
|
||
|
|
|
||
|
|
// ==============================================================
|
||
|
|
// NESTED WIDGETS
|
||
|
|
// ==============================================================
|
||
|
|
|
||
|
|
auto IconWidget() const -> UObject* { return BoundObject(STR("WBP_PalCommonCharacterSlot")); }
|
||
|
|
auto InvisibleButton() const -> UObject* { return BoundObject(STR("WBP_PalInvisibleButton")); }
|
||
|
|
|
||
|
|
// ==============================================================
|
||
|
|
// ANCHORS
|
||
|
|
// ==============================================================
|
||
|
|
|
||
|
|
auto RootCanvas() const -> CanvasPanel { return WrapCanvas(STR("CanvasPanel_36")); }
|
||
|
|
auto OverlaySelect() const -> Overlay { return WrapOverlay(STR("Overlay_Select")); }
|
||
|
|
|
||
|
|
// TODO: Review below and remove or update.
|
||
|
|
auto IconAnchor() -> Overlay
|
||
|
|
{
|
||
|
|
return Child<Overlay>(STR("Overlay_60"),
|
||
|
|
WidgetTree::EScope::IncludeNestedUserWidgets);
|
||
|
|
}
|
||
|
|
|
||
|
|
auto Check0() const -> UObject* { return BoundObject(STR("Check_0")); }
|
||
|
|
auto Check1() const -> UObject* { return BoundObject(STR("Check_1")); }
|
||
|
|
auto Check2() const -> UObject* { return BoundObject(STR("Check_2")); }
|
||
|
|
auto FocusedFrame() const -> UObject* { return BoundObject(STR("FocusedFrame")); }
|
||
|
|
auto PushEff() const -> UObject* { return BoundObject(STR("PushEff")); }
|
||
|
|
|
||
|
|
// ---- state ----------------------------------------------------
|
||
|
|
auto IsDisplayingDopingEffect() const -> std::optional<bool> { return PropertyBoolValue(STR("bIsDisplayDopingEffect")); }
|
||
|
|
auto HasCheckAnimPlayed() const -> std::optional<bool> { return PropertyBoolValue(STR("bCheckAnimPlayed")); }
|
||
|
|
|
||
|
|
// ==============================================================
|
||
|
|
// HOOK TARGETS
|
||
|
|
// ==============================================================
|
||
|
|
|
||
|
|
static auto DestructPath() -> const TCHAR*
|
||
|
|
{
|
||
|
|
return STR("/Game/Pal/Blueprint/UI/Thumbnails/Character/"
|
||
|
|
"WBP_PalCommonCharacterSlotButton.WBP_PalCommonCharacterSlotButton_C:Destruct");
|
||
|
|
}
|
||
|
|
|
||
|
|
static auto RegisterCharacterSlotWidgetPath() -> const TCHAR*
|
||
|
|
{
|
||
|
|
return STR("/Game/Pal/Blueprint/UI/Thumbnails/Character/"
|
||
|
|
"WBP_PalCommonCharacterSlotButton.WBP_PalCommonCharacterSlotButton_C:RegisterCharacterSlotWidget");
|
||
|
|
}
|
||
|
|
static auto OnInitializedPath() -> const TCHAR*
|
||
|
|
{
|
||
|
|
return STR("/Game/Pal/Blueprint/UI/Thumbnails/Character/"
|
||
|
|
"WBP_PalCommonCharacterSlotButton.WBP_PalCommonCharacterSlotButton_C:OnInitialized");
|
||
|
|
}
|
||
|
|
|
||
|
|
static auto SetEnablePath() -> const TCHAR*
|
||
|
|
{
|
||
|
|
return STR("/Game/Pal/Blueprint/UI/Thumbnails/Character/"
|
||
|
|
"WBP_PalCommonCharacterSlotButton.WBP_PalCommonCharacterSlotButton_C:SetEnable");
|
||
|
|
}
|
||
|
|
static auto SetSearchResultActivePath() -> const TCHAR*
|
||
|
|
{
|
||
|
|
return STR("/Game/Pal/Blueprint/UI/Thumbnails/Character/"
|
||
|
|
"WBP_PalCommonCharacterSlotButton.WBP_PalCommonCharacterSlotButton_C:SetSearchResultActive");
|
||
|
|
}
|
||
|
|
|
||
|
|
// ---- frames ---------------------------------------------------
|
||
|
|
|
||
|
|
struct WidgetFrame { UObject* Widget; }; // PlayFocusAnim / PlayUnfocusAnim
|
||
|
|
struct RegisterCharacterSlotWidgetFrame { UObject* characterSlotWidget; };
|
||
|
|
struct RegisterButtonFrame { UObject* Button; };
|
||
|
|
struct BoolFrame { bool bValue; }; // SetEnable, SetSearchResultActive, the AnmEvent_* family
|
||
|
|
|
||
|
|
// ==============================================================
|
||
|
|
// CALLS
|
||
|
|
// ==============================================================
|
||
|
|
|
||
|
|
auto SetEnable(bool bIsEnable) -> bool
|
||
|
|
{
|
||
|
|
BoolFrame p{ bIsEnable };
|
||
|
|
return Call(STR("SetEnable"), p);
|
||
|
|
}
|
||
|
|
auto SetEnableGreyoutOnly(bool bIsEnable) -> bool
|
||
|
|
{
|
||
|
|
BoolFrame p{ bIsEnable };
|
||
|
|
return Call(STR("SetEnable_GreyoutOnly"), p);
|
||
|
|
}
|
||
|
|
auto SetSearchResultActive(bool bActive) -> bool
|
||
|
|
{
|
||
|
|
// The parameter is spelled bAvtive in the engine. Dont fix. Lol.
|
||
|
|
BoolFrame p{ bActive };
|
||
|
|
return Call(STR("SetSearchResultActive"), p);
|
||
|
|
}
|
||
|
|
|
||
|
|
private:
|
||
|
|
auto WrapCanvas(const TCHAR* Name) const -> CanvasPanel
|
||
|
|
{
|
||
|
|
UObject* O = BoundObject(Name);
|
||
|
|
return O ? CanvasPanel{ O } : CanvasPanel{};
|
||
|
|
}
|
||
|
|
auto WrapOverlay(const TCHAR* Name) const -> Overlay
|
||
|
|
{
|
||
|
|
UObject* O = BoundObject(Name);
|
||
|
|
return O ? Overlay{ O } : Overlay{};
|
||
|
|
}
|
||
|
|
|
||
|
|
protected:
|
||
|
|
PalCommonCharacterSlotButton(UObject* Obj, UClass* Expected, const TCHAR* Tag)
|
||
|
|
: UserWidget(Obj, Expected, Tag) {}
|
||
|
|
};
|
||
|
|
}
|