Finalize rework of UI, and lay groundwork for new UI pipeline
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -25,6 +56,11 @@ class PROJECTELERI_API UEleriBaseWidget : public UUserWidget
|
||||
GENERATED_BODY()
|
||||
|
||||
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);
|
||||
@@ -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");
|
||||
};
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
|
||||
#include "MainGameWidget.generated.h"
|
||||
|
||||
struct FEleriActionInputData;
|
||||
class UScreenActionInputDisplay;
|
||||
class UCalendarScreen;
|
||||
class UAlchemyWidget;
|
||||
class UInventoryWidget;
|
||||
@@ -144,6 +146,11 @@ public:
|
||||
UEleriBaseWidget* GetBazarWidget() { return Bazar_Widget; }
|
||||
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))
|
||||
@@ -194,6 +201,9 @@ protected:
|
||||
// Calendar
|
||||
UPROPERTY(meta = (BindWidget))
|
||||
UEleriBaseWidget* Bazar_Widget;
|
||||
|
||||
UPROPERTY(meta = (BindWidget))
|
||||
UScreenActionInputDisplay* ScreenActionInputDisplay_Widget;
|
||||
|
||||
// Minigames UI
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, meta = (BindWidget))
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
};
|
||||
@@ -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();
|
||||
}
|
||||
@@ -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();
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "ScreenActionInputDisplay.h"
|
||||
22
Source/ProjectEleri/UI/Helpers/ScreenActionInputDisplay.h
Normal file
22
Source/ProjectEleri/UI/Helpers/ScreenActionInputDisplay.h
Normal 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);
|
||||
|
||||
};
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user