Replace MVP frontend with UMG menu flow

This commit is contained in:
2026-05-19 10:14:23 -07:00
parent 2a336fff67
commit af1edb51bc
4 changed files with 364 additions and 486 deletions
+24 -50
View File
@@ -6,6 +6,10 @@
#include "Blueprint/UserWidget.h"
#include "AgrarianMvpFrontendWidget.generated.h"
class UButton;
class UTextBlock;
class UVerticalBox;
UENUM(BlueprintType)
enum class EAgrarianMvpFrontendScreen : uint8
{
@@ -77,66 +81,36 @@ protected:
virtual void NativeConstruct() override;
virtual FReply NativeOnKeyDown(const FGeometry& InGeometry, const FKeyEvent& InKeyEvent) override;
virtual FReply NativeOnMouseButtonDown(const FGeometry& InGeometry, const FPointerEvent& InMouseEvent) override;
virtual int32 NativePaint(
const FPaintArgs& Args,
const FGeometry& AllottedGeometry,
const FSlateRect& MyCullingRect,
FSlateWindowElementList& OutDrawElements,
int32 LayerId,
const FWidgetStyle& InWidgetStyle,
bool bParentEnabled) const override;
private:
bool GetPanelLayout(const FVector2D& WidgetSize, float& OutScale, FVector2D& OutPanelPosition, FVector2D& OutPanelSize) const;
bool IsPointInside(const FVector2D& Point, const FVector2D& Position, const FVector2D& Size) const;
void ContinueFromActiveScreen();
void ReturnFromActiveScreen();
void CompleteFrontendFlow();
void RebuildFrontendTree();
UTextBlock* AddText(UVerticalBox* Parent, const FText& Text, int32 FontSize, bool bBold, const FLinearColor& Color, float BottomPadding);
UButton* AddButton(UVerticalBox* Parent, const FText& Text, const FLinearColor& NormalColor, const FLinearColor& HoveredColor, float BottomPadding);
void DrawMainMenu(
FSlateWindowElementList& OutDrawElements,
int32& LayerId,
const FGeometry& AllottedGeometry,
const FVector2D& PanelPosition,
const FVector2D& PanelSize,
float Scale) const;
UFUNCTION()
void FocusPrimaryButton();
void DrawCharacterSelection(
FSlateWindowElementList& OutDrawElements,
int32& LayerId,
const FGeometry& AllottedGeometry,
const FVector2D& PanelPosition,
const FVector2D& PanelSize,
float Scale) const;
UFUNCTION()
void HandlePrimaryActionClicked();
void DrawJoinServer(
FSlateWindowElementList& OutDrawElements,
int32& LayerId,
const FGeometry& AllottedGeometry,
const FVector2D& PanelPosition,
const FVector2D& PanelSize,
float Scale) const;
UFUNCTION()
void HandleBackClicked();
void DrawLoading(
FSlateWindowElementList& OutDrawElements,
int32& LayerId,
const FGeometry& AllottedGeometry,
const FVector2D& PanelPosition,
const FVector2D& PanelSize,
float Scale) const;
UFUNCTION()
void HandleSaveAndQuitClicked();
UFUNCTION()
void HandleMaleCharacterClicked();
UFUNCTION()
void HandleFemaleCharacterClicked();
UPROPERTY()
TObjectPtr<UButton> PrimaryFocusButton;
FText GetSelectedCharacterLabel() const;
FText GetSelectedRoleLabel() const;
void DrawTextAt(
FSlateWindowElementList& OutDrawElements,
int32& LayerId,
const FGeometry& AllottedGeometry,
const FText& Text,
const FVector2D& Position,
float Width,
const FSlateFontInfo& Font,
const FLinearColor& Color) const;
};