Finalize rework of UI, and lay groundwork for new UI pipeline

This commit is contained in:
2026-07-26 00:28:06 +02:00
parent 620dee0465
commit 5393b4fc65
67 changed files with 185 additions and 217 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -14,7 +14,6 @@
"UMG",
"Foliage",
"PaperZD",
"CommonUI",
"AIModule",
"DeveloperSettings",
"Slate",
@@ -61,10 +60,6 @@
"Name": "Volumetrics",
"Enabled": true
},
{
"Name": "CommonUI",
"Enabled": true
},
{
"Name": "ImpostorBaker",
"Enabled": true

View File

@@ -5,6 +5,8 @@
#include "EleriPlayerController.h"
#include "Kismet/GameplayStatics.h"
#include "ProjectEleri/System/MainBlueprintFunctionLibrary.h"
#include "ProjectEleri/UI/Helpers/ScreenActionInputDisplay.h"
void UEleriBaseWidget::ToggleWidget_Implementation(bool bActive) {
SetVisibility(bActive? ESlateVisibility::Visible : ESlateVisibility::Hidden);
@@ -20,3 +22,13 @@ void UEleriBaseWidget::HandleUiInputAction_Implementation(EEleriUIInputAction In
}
}
}
void UEleriBaseWidget::DisplayInputPrompts(const FName PromptMapKey)
{
if (auto PromptMapValue = InputDataMap.Find(PromptMapKey))
{
UMainGameWidget* MainGameWidget = UMainBlueprintFunctionLibrary::GetMainGameWidget(this);
MainGameWidget->GetScreenActionInputDisplayWidget()->SetVisibility(ESlateVisibility::Visible);
MainGameWidget->GetScreenActionInputDisplayWidget()->DisplayScreenActionInputs(PromptMapValue->List);
}
}

View File

@@ -9,6 +9,7 @@
#include "UI/AlchemyWidget.h"
#include "ProjectEleri/UI/CalendarScreen.h"
#include "ProjectEleri/DialogueSystem/DialogueWidget.h"
#include "ProjectEleri/UI/Helpers/ScreenActionInputDisplay.h"
void UMainGameWidget::TogglePlaceableUI(bool bEnabled)
{
@@ -34,6 +35,11 @@ void UMainGameWidget::OpenWidget(UEleriBaseWidget* Widget)
Widget->ToggleWidget(true);
WidgetStack.AddUnique(Widget);
CheckOpenWidgets();
if (Widget->bShowInputMapsWhileOnScreen)
{
Widget->DisplayInputPrompts();
}
}
void UMainGameWidget::CloseWidget(UEleriBaseWidget* Widget)
@@ -43,6 +49,20 @@ void UMainGameWidget::CloseWidget(UEleriBaseWidget* Widget)
Widget->ToggleWidget(false);
WidgetStack.Remove(Widget);
CheckOpenWidgets();
bool bShouldShowInputPrompts = false;
for (UEleriBaseWidget* WidgetInStack : WidgetStack)
{
if (WidgetInStack->bShowInputMapsWhileOnScreen)
{
WidgetInStack->DisplayInputPrompts();
bShouldShowInputPrompts = true;
}
}
if (!bShouldShowInputPrompts)
{
GetScreenActionInputDisplayWidget()->SetVisibility(ESlateVisibility::Hidden);
}
}
bool UMainGameWidget::IsBookOpen() const
@@ -124,6 +144,11 @@ bool UMainGameWidget::IsBazarWidgetOpen() const
return WidgetStack.Contains(Bazar_Widget);
}
bool UMainGameWidget::IsScreenActionInputDisplayWidgetOpen() const
{
return ScreenActionInputDisplay_Widget->GetVisibility() == ESlateVisibility::Visible;
}
void UMainGameWidget::CheckOpenWidgets()
{
if (!PlayerController)

View File

@@ -3,6 +3,8 @@
#pragma once
#include "CoreMinimal.h"
#include "InputAction.h"
#include "InputMappingContext.h"
#include "Blueprint/UserWidget.h"
#include "EleriBaseWidget.generated.h"
@@ -16,6 +18,35 @@ enum class EEleriUIInputAction : uint8
TabRight
};
USTRUCT(BlueprintType)
struct FEleriActionInputData
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FText ActionName;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UInputAction* InputAction;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UInputMappingContext* MappingContext;
// True = Tap | False = Hold
UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool bSingleTapOrHold = true;
};
USTRUCT(BlueprintType)
struct FEleriActionInputData_List
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TArray<FEleriActionInputData> List;
};
/**
*
*/
@@ -26,6 +57,11 @@ class PROJECTELERI_API UEleriBaseWidget : public UUserWidget
public:
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Input Prompts")
bool bShowInputMapsWhileOnScreen = true;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Input Prompts")
TMap<FName, FEleriActionInputData_List> InputDataMap;
UFUNCTION(BlueprintNativeEvent, BlueprintCallable)
void ToggleWidget(bool bActive);
virtual void ToggleWidget_Implementation(bool bActive);
@@ -33,4 +69,7 @@ public:
UFUNCTION(BlueprintNativeEvent, BlueprintCallable)
void HandleUiInputAction(EEleriUIInputAction InputAction);
virtual void HandleUiInputAction_Implementation(EEleriUIInputAction InputAction);
UFUNCTION(BlueprintCallable, Category = "Eleri|UI")
void DisplayInputPrompts(const FName PromptMapKey = "Default");
};

View File

@@ -11,6 +11,8 @@
#include "MainGameWidget.generated.h"
struct FEleriActionInputData;
class UScreenActionInputDisplay;
class UCalendarScreen;
class UAlchemyWidget;
class UInventoryWidget;
@@ -145,6 +147,11 @@ public:
UFUNCTION(BlueprintCallable, BlueprintPure)
bool IsBazarWidgetOpen() const;
UFUNCTION(BlueprintCallable, BlueprintPure)
UScreenActionInputDisplay* GetScreenActionInputDisplayWidget() { return ScreenActionInputDisplay_Widget; }
UFUNCTION(BlueprintCallable, BlueprintPure)
bool IsScreenActionInputDisplayWidgetOpen() const;
protected:
UPROPERTY(BlueprintReadWrite, Category = "Gradient Picker Widget Binding", meta = (BindWidget))
UOverlay *PlaceableOverlay;
@@ -195,6 +202,9 @@ protected:
UPROPERTY(meta = (BindWidget))
UEleriBaseWidget* Bazar_Widget;
UPROPERTY(meta = (BindWidget))
UScreenActionInputDisplay* ScreenActionInputDisplay_Widget;
// Minigames UI
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, meta = (BindWidget))
UWidgetSwitcher *Minigames_Widget_Switcher;

View File

@@ -1,14 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "CommonInputActionWidget.h"
void UCommonInputActionWidget::UpdateActionWidget()
{
Super::UpdateActionWidget();
if (MyIcon.IsValid())
{
MyIcon->SetColorAndOpacity(InputImageColor);
}
}

View File

@@ -1,25 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "CommonActionWidget.h"
#include "CommonInputActionWidget.generated.h"
/**
*
*/
UCLASS()
class PROJECTELERI_API UCommonInputActionWidget : public UCommonActionWidget
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FLinearColor InputImageColor;
protected:
virtual void UpdateActionWidget() override;
};

View File

@@ -1,19 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "EleriButtonGroupBase.h"
void UEleriButtonGroupBase::SelectButton(UCommonButtonBase* Button, bool bAllowSound) {
int32 Index = FindButtonIndex(Button);
if (Index == GetSelectedButtonIndex()) return;
SelectButtonAtIndex(Index, bAllowSound);
}
void UEleriButtonGroupBase::AddButtonToGroup(UCommonButtonBase* Button) {
AddWidget(Button);
}
void UEleriButtonGroupBase::RemoveAllButtonsFromGroup() {
RemoveAll();
}

View File

@@ -1,27 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Groups/CommonButtonGroupBase.h"
#include "EleriButtonGroupBase.generated.h"
/**
*
*/
UCLASS(BlueprintType)
class PROJECTELERI_API UEleriButtonGroupBase : public UCommonButtonGroupBase
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, Category = "Eleri|Button Group")
void SelectButton(class UCommonButtonBase* Button, bool bAllowSound = false);
UFUNCTION(BlueprintCallable, Category = "Eleri|Button Group")
void AddButtonToGroup(class UCommonButtonBase* Button);
UFUNCTION(BlueprintCallable, Category = "Eleri|Button Group")
void RemoveAllButtonsFromGroup();
};

View File

@@ -0,0 +1,4 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "ScreenActionInputDisplay.h"

View File

@@ -0,0 +1,22 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "UI/EleriBaseWidget.h"
#include "ScreenActionInputDisplay.generated.h"
/**
*
*/
UCLASS()
class PROJECTELERI_API UScreenActionInputDisplay : public UEleriBaseWidget
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, Category = "Eleri|UI")
void DisplayScreenActionInputs(const TArray<FEleriActionInputData>& InputList);
};

View File

@@ -3,7 +3,7 @@
#pragma once
#include "CoreMinimal.h"
#include "CommonUserWidget.h"
#include "UI/EleriBaseWidget.h"
#include "InteractionWidget.generated.h"
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnDisplayInteractionMenu, bool, bActive);
@@ -12,7 +12,7 @@ DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnDisplayInteractionMenu, bool, bAc
*
*/
UCLASS(BlueprintType)
class PROJECTELERI_API UInteractionWidget : public UCommonUserWidget
class PROJECTELERI_API UInteractionWidget : public UEleriBaseWidget
{
GENERATED_BODY()
public: