Refactor of some UI logic

This commit is contained in:
2026-07-24 23:48:29 +02:00
parent cb90d44b33
commit 620dee0465
19 changed files with 109 additions and 340 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -905,31 +905,16 @@ void AEleriPlayerController::OnOrdersToggle(const FInputActionValue &Value)
}
else
{
OrdersUI = CreateWidget(this, OrdersBlueprint);
if (!IsValid(OrdersUI))
return;
OrdersUI->AddToViewport();
AddToMenuStack(OrdersUI);
SetShowMouseCursor(true);
SetInputMode(FInputModeGameAndUI());
OrdersOpen = true;
}
}
void AEleriPlayerController::OnCalendarToggle(const FInputActionValue &Value)
{
if (Paused || IsDialogueOpen() || (IsInMenu() && !MainGameUI->IsBookOpen()) || !MoveActorsComp || MoveActorsComp->IsRemovingMode())
if (Paused || IsDialogueOpen() || (IsInMenu() && !MainGameUI->IsCalendarOpen()) || !MoveActorsComp || MoveActorsComp->IsRemovingMode())
return;
if (!MainGameUI->IsCalendarOpen())
{
OpenCalendarWindow();
}
else
{
CloseCalendarWindow();
}
OpenCalendarWindow();
}
void AEleriPlayerController::OnBookNextPage(const FInputActionValue &Value)
@@ -1031,7 +1016,7 @@ UUserWidget *AEleriPlayerController::OpenBookOfAlchemy(UItemDataAsset *ItemToPre
bBookAnimating = true;
MainGameUI->GetBookWidget()->Setup(ItemToPresent, false);
PlayerCharacter->ToggleBook(true);
MainGameUI->ToggleBookWidget(true);
MainGameUI->OpenWidget(MainGameUI->GetBookWidget());
MainGameUI->ToggleGameMenu(false);
@@ -1082,7 +1067,7 @@ void AEleriPlayerController::DisableBookAnimating()
void AEleriPlayerController::CloseOrdersUI()
{
OrdersOpen = false;
RemoveFromMenuStack(OrdersUI);
OrdersUI->RemoveFromParent();
if (MenuStack.Num() == 0)
{
@@ -1095,33 +1080,15 @@ UMainMenuWidget *AEleriPlayerController::OpenMainMenu()
{
if (!IsValid(MainGameUI))
return nullptr;
UMainMenuWidget *MainMenu = MainGameUI->GetMainMenuWidget();
if (!IsValid(MainMenu))
return nullptr;
AddToMenuStack(MainMenu);
SetInputMode(FInputModeGameAndUI());
SetShowMouseCursor(true);
MainGameUI->ToggleMainMenuWidget(true);
SetPause(true);
MainGameUI->OpenWidget(MainGameUI->GetMainMenuWidget());
return MainMenu;
return MainGameUI->GetMainMenuWidget();
}
void AEleriPlayerController::CloseMainMenu()
{
if (!IsValid(MainGameUI))
return;
UMainMenuWidget *MainMenu = MainGameUI->GetMainMenuWidget();
if (!IsValid(MainMenu))
return;
RemoveFromMenuStack(MainMenu);
MainGameUI->ToggleMainMenuWidget(false);
SetShowMouseCursor(false);
SetInputMode(FInputModeGameOnly());
SetPause(false);
MainGameUI->CloseWidget(MainGameUI->GetMainMenuWidget());
}
UEleriBaseWidget *AEleriPlayerController::ToggleAlchemyMenu(bool bOpen)
@@ -1139,20 +1106,7 @@ UEleriBaseWidget *AEleriPlayerController::ToggleDialogueWindow(bool bOpen)
if (!IsValid(MainGameUI->GetDialogueWidget()) || MainGameUI->GetDialogueWidget()->IsAnimating())
return nullptr;
MainGameUI->ToggleDialogueWidget(bOpen);
MainGameUI->GetDialogueWidget()->ToggleWidget(bOpen);
if (bOpen)
{
AddToMenuStack(MainGameUI->GetDialogueWidget());
SetInputMode(FInputModeGameAndUI());
SetShowMouseCursor(bOpen);
}
else
{
CloseGenericMenu(MainGameUI->GetDialogueWidget());
}
MainGameUI->OpenWidget(MainGameUI->GetDialogueWidget());
return MainGameUI->GetDialogueWidget();
}
@@ -1161,21 +1115,14 @@ UEleriBaseWidget *AEleriPlayerController::ToggleNotificationWindow(bool bOpen)
if (!IsValid(MainGameUI->GetBigNotificationWidget()))
return nullptr;
MainGameUI->ToggleBigNotificationWidget(bOpen);
if (bOpen)
if (MainGameUI->IsBigNotificationOpen())
{
AddToMenuStack(MainGameUI->GetBigNotificationWidget());
SetInputMode(FInputModeGameAndUI());
MainGameUI->CloseWidget(MainGameUI->GetBigNotificationWidget());
}
else
{
CloseGenericMenu(MainGameUI->GetBigNotificationWidget());
SetInputMode(FInputModeGameOnly());
MainGameUI->OpenWidget(MainGameUI->GetBigNotificationWidget());
}
SetShowMouseCursor(bOpen);
SetPause(bOpen);
return MainGameUI->GetBigNotificationWidget();
}
@@ -1187,132 +1134,22 @@ UTradeWidget *AEleriPlayerController::OpenTradeWindow(UInventoryComponent *Inven
if (UMainGameWidget *MainWidget = GetMainGameWidget())
{
MainWidget->OpenTradeWidget(Inventory, InRestrictTabs);
UTradeWidget *TradeWidget = MainWidget->GetTradeWidget();
AddToMenuStack(TradeWidget);
SetInputMode(FInputModeGameAndUI());
SetShowMouseCursor(true);
SetPause(true);
return TradeWidget;
return MainGameUI->GetTradeWidget();
}
return nullptr;
}
void AEleriPlayerController::CloseTradeWindow()
{
if (UMainGameWidget *MainWidget = GetMainGameWidget())
{
UTradeWidget *TradeWidget = MainWidget->GetTradeWidget();
MainWidget->CloseTradeWidget();
RemoveFromMenuStack(TradeWidget);
SetInputMode(FInputModeGameOnly());
SetShowMouseCursor(false);
SetPause(false);
}
}
UCalendarScreen* AEleriPlayerController::OpenCalendarWindow()
{
MainGameUI->ToggleCalendarWidget(true);
AddToMenuStack(MainGameUI->GetCalendarWidget());
SetInputMode(FInputModeGameAndUI());
SetShowMouseCursor(true);
SetPause(true);
MainGameUI->OpenWidget(MainGameUI->GetCalendarWidget());
return MainGameUI->GetCalendarWidget();
}
void AEleriPlayerController::CloseCalendarWindow()
{
MainGameUI->ToggleCalendarWidget(false);
RemoveFromMenuStack(MainGameUI->GetCalendarWidget());
SetInputMode(FInputModeGameOnly());
SetShowMouseCursor(false);
SetPause(false);
}
UEleriBaseWidget* AEleriPlayerController::OpenBazarWindow() {
MainGameUI->ToggleBazarWidget(true);
AddToMenuStack(MainGameUI->GetBazarWidget());
SetInputMode(FInputModeGameAndUI());
SetShowMouseCursor(true);
MainGameUI->OpenWidget(MainGameUI->GetBazarWidget());
return MainGameUI->GetBazarWidget();
}
void AEleriPlayerController::CloseBazarWindow() {
MainGameUI->ToggleBazarWidget(false);
RemoveFromMenuStack(MainGameUI->GetBazarWidget());
SetInputMode(FInputModeGameOnly());
SetShowMouseCursor(false);
}
void AEleriPlayerController::AddToMenuStack(UUserWidget *Widget)
{
MenuStack.AddUnique(Widget);
OnWateringActionEnd(FInputActionValue());
}
void AEleriPlayerController::RemoveFromMenuStack(UUserWidget *Widget)
{
MenuStack.Remove(Widget);
}
bool AEleriPlayerController::OpenGenericMenu(UUserWidget *Widget, bool CloseOthers = false, bool IgnoreInMenu = false)
{
if (!IgnoreInMenu && IsInMenu())
return false;
for (const UUserWidget *StackWidget : MenuStack)
{
if (StackWidget == Widget)
return false;
}
if (CloseOthers)
{
for (UUserWidget *StackWidget : MenuStack)
{
StackWidget->RemoveFromParent();
}
OrdersOpen = false;
}
AddToMenuStack(Widget);
Widget->AddToViewport();
SetShowMouseCursor(true);
SetInputMode(FInputModeGameAndUI());
SetPause(true);
return true;
}
void AEleriPlayerController::CloseGenericMenu(UEleriBaseWidget *Widget)
{
RemoveFromMenuStack(Widget);
Widget->ToggleWidget(false);
if (MenuStack.Num() == 0)
{
SetShowMouseCursor(false);
SetInputMode(FInputModeGameOnly());
SetPause(false);
}
else
{
MenuStack[MenuStack.Num() - 1]->SetUserFocus(this);
MenuStack[MenuStack.Num() - 1]->SetKeyboardFocus();
}
}
void AEleriPlayerController::CloseLastGenericMenu()
{
if (MenuStack.Num() <= 0 || IsValid(MenuStack[MenuStack.Num() - 1]))
return;
// CloseGenericMenu(MenuStack[MenuStack.Num() - 1]);
}
void AEleriPlayerController::OnInteract(const FInputActionValue &Value)
{
if (!IsValid(PlayerCharacter))
@@ -1347,10 +1184,7 @@ void AEleriPlayerController::StartMinigame(EMinigameType MinigameType, const TSo
MinigameType == EMinigameType::NONE)
return;
if (UEleriBaseWidget *MinigameWidget = MainGameUI->ToggleMinigamesWidget(MinigameType, DataAsset))
{
OpenGenericMenu(MinigameWidget, false, true);
}
MainGameUI->ToggleMinigamesWidget(MinigameType, DataAsset);
}
void AEleriPlayerController::CloseMinigame(int32 Score)
@@ -1358,13 +1192,9 @@ void AEleriPlayerController::CloseMinigame(int32 Score)
if (!IsValid(PlayerCharacter) || !IsValid(MainGameUI) || !MainGameUI->IsAnyMinigameOpen())
return;
if (UEleriBaseWidget *MinigameWidget = MainGameUI->GetCurrentlyOpenMinigameWidget())
MainGameUI->ToggleMinigamesWidget(EMinigameType::NONE, nullptr);
if (OnMinigameComplete.IsBound())
{
CloseGenericMenu(MinigameWidget);
MainGameUI->ToggleMinigamesWidget(EMinigameType::NONE, nullptr);
if (OnMinigameComplete.IsBound())
{
OnMinigameComplete.Execute(Score);
}
OnMinigameComplete.Execute(Score);
}
}

View File

@@ -7,12 +7,7 @@
#include "Kismet/GameplayStatics.h"
void UEleriBaseWidget::ToggleWidget_Implementation(bool bActive) {
if (bActive) {
//ActivateWidget();
}
else {
//DeactivateWidget();
}
SetVisibility(bActive? ESlateVisibility::Visible : ESlateVisibility::Hidden);
}
void UEleriBaseWidget::HandleUiInputAction_Implementation(EEleriUIInputAction InputAction)

View File

@@ -5,11 +5,10 @@
#include "EleriPlayerController.h"
#include "EnhancedInputSubsystems.h"
#include "Kismet/GameplayStatics.h"
#include "UI/InventoryWidget.h"
#include "UI/MainMenuWidget.h"
#include "UI/TradeWidget.h"
#include "UI/AlchemyWidget.h"
#include "ProjectEleri/UI/CalendarScreen.h"
#include "ProjectEleri/DialogueSystem/DialogueWidget.h"
void UMainGameWidget::TogglePlaceableUI(bool bEnabled)
{
@@ -24,14 +23,14 @@ void UMainGameWidget::SwitchKeybindsDisplay(int32 Index)
void UMainGameWidget::CloseLastWidget()
{
if (WidgetStack.IsEmpty()) return;
CloseWidget(WidgetStack[WidgetStack.Num() - 1]);
}
void UMainGameWidget::OpenWidget(UEleriBaseWidget* Widget)
{
if (!Widget) return;
Widget->ToggleWidget(true);
WidgetStack.AddUnique(Widget);
CheckOpenWidgets();
@@ -40,89 +39,89 @@ void UMainGameWidget::OpenWidget(UEleriBaseWidget* Widget)
void UMainGameWidget::CloseWidget(UEleriBaseWidget* Widget)
{
if (!Widget) return;
Widget->ToggleWidget(false);
WidgetStack.Remove(Widget);
CheckOpenWidgets();
}
void UMainGameWidget::ToggleBookWidget(bool bActive)
bool UMainGameWidget::IsBookOpen() const
{
if (bActive)
WidgetStack.AddUnique(GetBookWidget());
CheckOpenWidgets();
return WidgetStack.Contains(Book_Widget);
}
void UMainGameWidget::ToggleAlchemyWidget(bool bActive)
bool UMainGameWidget::IsInventoryOpen() const
{
AlchemyOpen = bActive;
if (bActive)
WidgetStack.AddUnique(GetAlchemyWidget());
CheckOpenWidgets();
return WidgetStack.Contains(Inventory_Widget);
}
void UMainGameWidget::ToggleBigNotificationWidget(bool bActive)
bool UMainGameWidget::IsAlchemyOpen() const
{
BigNotificationOpen = bActive;
BigNotification_Widget->ToggleWidget(BigNotificationOpen);
return WidgetStack.Contains(Alchemy_Widget);
}
void UMainGameWidget::ToggleDialogueWidget(bool bActive)
bool UMainGameWidget::IsBigNotificationOpen() const
{
DialogueOpen = bActive;
return WidgetStack.Contains(BigNotification_Widget);
}
UMinigameBaseWidget *UMainGameWidget::ToggleMinigamesWidget(EMinigameType MinigameType, const TSoftObjectPtr<UBaseMinigameDataAsset> &DataAsset)
bool UMainGameWidget::IsDialogueOpen() const
{
return WidgetStack.Contains(Dialogue_Widget);
}
UMinigameBaseWidget* UMainGameWidget::ToggleMinigamesWidget(EMinigameType MinigameType, const TSoftObjectPtr<UBaseMinigameDataAsset>& DataAsset)
{
MinigameOpen = MinigameType;
CurrentlyOpenMinigameWidget = K2_OnMinigameOpen(MinigameOpen, DataAsset);
if (MinigameType == EMinigameType::NONE)
{
CloseWidget(CurrentlyOpenMinigameWidget);
}
else
{
CurrentlyOpenMinigameWidget = K2_OnMinigameOpen(MinigameOpen, DataAsset);
OpenWidget(CurrentlyOpenMinigameWidget);
}
return CurrentlyOpenMinigameWidget;
}
void UMainGameWidget::ToggleMainMenuWidget(bool bActive)
bool UMainGameWidget::IsMainMenuOpen() const
{
MainMenuOpen = bActive;
MainMenuScreenUI_Widget->ToggleWidget(MainMenuOpen);
return WidgetStack.Contains(MainMenuScreenUI_Widget);
}
UEleriBaseWidget *UMainGameWidget::ShowAmountPickerWidget()
UEleriBaseWidget* UMainGameWidget::ShowAmountPickerWidget()
{
AmountPicker_Widget->ToggleWidget(true);
OpenWidget(AmountPicker_Widget);
return AmountPicker_Widget;
}
UEleriBaseWidget *UMainGameWidget::ShowImportantDialoguePromptWidget()
UEleriBaseWidget* UMainGameWidget::ShowImportantDialoguePromptWidget()
{
ImportantDialoguePrompt_Widget->ToggleWidget(true);
OpenWidget(ImportantDialoguePrompt_Widget);
return ImportantDialoguePrompt_Widget;
}
void UMainGameWidget::OpenTradeWidget(UInventoryComponent *Inventory, const TArray<EInventoryTabType>& InRestrictTabs)
void UMainGameWidget::OpenTradeWidget(UInventoryComponent* Inventory, const TArray<EInventoryTabType>& InRestrictTabs)
{
TradeOpen = true;
Trade_Widget->OpenTradeWidget(Inventory, InRestrictTabs);
Trade_Widget->SetupTradeWidget(Inventory, InRestrictTabs);
OpenWidget(GetTradeWidget());
}
void UMainGameWidget::CloseTradeWidget()
bool UMainGameWidget::IsTradeOpen() const
{
TradeOpen = false;
Trade_Widget->ToggleWidget(false);
CheckOpenWidgets();
return WidgetStack.Contains(Trade_Widget);
}
void UMainGameWidget::ToggleCalendarWidget(bool bActive)
bool UMainGameWidget::IsCalendarOpen() const
{
CalendarOpen = bActive;
Calendar_Widget->ToggleWidget(CalendarOpen);
CheckOpenWidgets();
return WidgetStack.Contains(Calendar_Widget);
}
void UMainGameWidget::ToggleBazarWidget(bool bActive) {
BazarWidgetOpen = bActive;
Bazar_Widget->ToggleWidget(BazarWidgetOpen);
CheckOpenWidgets();
bool UMainGameWidget::IsBazarWidgetOpen() const
{
return WidgetStack.Contains(Bazar_Widget);
}
void UMainGameWidget::CheckOpenWidgets()
@@ -131,14 +130,10 @@ void UMainGameWidget::CheckOpenWidgets()
{
PlayerController = UGameplayStatics::GetPlayerController(this, 0);
}
//const bool bAnyOpenWidgets = IsAlchemyOpen() || IsAnyMinigameOpen() || IsBazarWidgetOpen() || IsBigNotificationOpen() ||
// IsBookOpen() || IsCalendarOpen() || IsDialogueOpen() || IsInventoryOpen() || IsMainMenuOpen() || IsTradeOpen();
const bool bAnyOpenWidgets = AnyWidgetOpen();
const bool bShouldBePaused = WidgetStack.Contains(GetBookWidget());
if (bAnyOpenWidgets)
{
PlayerController->SetInputMode(FInputModeGameAndUI());
@@ -147,13 +142,14 @@ void UMainGameWidget::CheckOpenWidgets()
{
PlayerController->SetInputMode(FInputModeGameOnly());
}
PlayerController->SetShowMouseCursor(bAnyOpenWidgets);
PlayerController->SetPause(bShouldBePaused);
// Get the Enhanced Input Local Player Subsystem from the Local Player related to our Player Controller.
if (UEnhancedInputLocalPlayerSubsystem *Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(PlayerController->GetLocalPlayer()))
if (UEnhancedInputLocalPlayerSubsystem* Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(
PlayerController->GetLocalPlayer()))
{
if (const AEleriPlayerController* EleriPC = Cast<AEleriPlayerController>(PlayerController))
{

View File

@@ -4,7 +4,7 @@
#include "UI/TradeWidget.h"
#include "ProjectEleri/Public/InventoryComponent.h"
void UTradeWidget::OpenTradeWidget(UInventoryComponent* Inventory, const TArray<EInventoryTabType>& InRestrictTabs) {
void UTradeWidget::SetupTradeWidget(UInventoryComponent* Inventory, const TArray<EInventoryTabType>& InRestrictTabs) {
InventoryRef = Inventory;
if (InventoryRef) {
@@ -13,6 +13,4 @@ void UTradeWidget::OpenTradeWidget(UInventoryComponent* Inventory, const TArray<
bIsChest = InventoryRef->IsChest;
RestrictedTabs = InRestrictTabs;
}
ToggleWidget(true);
}

View File

@@ -353,29 +353,12 @@ public:
UFUNCTION(BlueprintCallable, meta = (AutoCreateRefTerm = "InRestrictTabs"))
UTradeWidget* OpenTradeWindow(UInventoryComponent* Inventory, const TArray<EInventoryTabType>& InRestrictTabs);
UFUNCTION(BlueprintCallable)
void CloseTradeWindow();
UFUNCTION(BlueprintCallable)
UCalendarScreen* OpenCalendarWindow();
UFUNCTION(BlueprintCallable)
void CloseCalendarWindow();
UFUNCTION(BlueprintCallable)
UEleriBaseWidget* OpenBazarWindow();
UFUNCTION(BlueprintCallable)
void CloseBazarWindow();
void AddToMenuStack(UUserWidget* Widget);
void RemoveFromMenuStack(UUserWidget* Widget);
UFUNCTION(BlueprintCallable)
bool OpenGenericMenu(UUserWidget* Widget, bool CloseOthers, bool IgnoreInMenu);
UFUNCTION(BlueprintCallable)
void CloseGenericMenu(UEleriBaseWidget* Widget);
UFUNCTION(BlueprintCallable)
void CloseLastGenericMenu();
void OnInteract(const FInputActionValue& Value);
void OnInteractExit(const FInputActionValue& Value);

View File

@@ -7,15 +7,15 @@
#include "Components/Overlay.h"
#include "Components/WidgetSwitcher.h"
#include "ProjectEleri/UI/MinigameBaseWidget.h"
#include "ProjectEleri/UI/CalendarScreen.h"
#include "ProjectEleri/Public/InventoryComponent.h"
#include "MainGameWidget.generated.h"
class UCalendarScreen;
class UAlchemyWidget;
class UInventoryWidget;
class UBookOfAlchemyWidget;
class UInteractionWidget;
class UAlchemyWidget;
class UMainMenuWidget;
class UTradeWidget;
class UDialogueWidget;
@@ -68,40 +68,32 @@ public:
// Book widget
UFUNCTION(BlueprintCallable, BlueprintPure)
UBookOfAlchemyWidget *GetBookWidget() { return Book_Widget; }
UFUNCTION(BlueprintCallable)
void ToggleBookWidget(bool bActive);
UFUNCTION(BlueprintCallable, BlueprintPure)
bool IsBookOpen() const { return WidgetStack.Contains(Book_Widget); }
bool IsBookOpen() const;
// Inventory widget
UFUNCTION(BlueprintCallable, BlueprintPure)
UInventoryWidget *GetInventoryWidget() { return Inventory_Widget; }
UFUNCTION(BlueprintCallable, BlueprintPure)
bool IsInventoryOpen() const { return WidgetStack.Contains(Inventory_Widget); }
bool IsInventoryOpen() const;
// Alchemy widget
UFUNCTION(BlueprintCallable, BlueprintPure)
UAlchemyWidget *GetAlchemyWidget() { return Alchemy_Widget; }
UFUNCTION(BlueprintCallable)
void ToggleAlchemyWidget(bool bActive);
UFUNCTION(BlueprintCallable, BlueprintPure)
bool IsAlchemyOpen() const { return AlchemyOpen; }
bool IsAlchemyOpen() const;
// Big Notification widget
UFUNCTION(BlueprintCallable, BlueprintPure)
UEleriBaseWidget *GetBigNotificationWidget() { return BigNotification_Widget; }
UFUNCTION(BlueprintCallable)
void ToggleBigNotificationWidget(bool bActive);
UFUNCTION(BlueprintCallable, BlueprintPure)
bool IsBigNotificationOpen() const { return BigNotificationOpen; }
bool IsBigNotificationOpen() const;
// Dialogue widget
UFUNCTION(BlueprintCallable, BlueprintPure)
UDialogueWidget*GetDialogueWidget() { return Dialogue_Widget; }
UFUNCTION(BlueprintCallable)
void ToggleDialogueWidget(bool bActive);
UFUNCTION(BlueprintCallable, BlueprintPure)
bool IsDialogueOpen() const { return DialogueOpen; }
bool IsDialogueOpen() const;
// Minigames widget
UFUNCTION(BlueprintCallable)
@@ -119,10 +111,8 @@ public:
// Main menu widget
UFUNCTION(BlueprintCallable, BlueprintPure)
UMainMenuWidget *GetMainMenuWidget() { return MainMenuScreenUI_Widget; }
UFUNCTION(BlueprintCallable)
void ToggleMainMenuWidget(bool bActive);
UFUNCTION(BlueprintCallable, BlueprintPure)
bool IsMainMenuOpen() const { return MainMenuOpen; }
bool IsMainMenuOpen() const;
// Amount Picker widget
UFUNCTION(BlueprintCallable, BlueprintPure)
@@ -140,25 +130,20 @@ public:
UFUNCTION(BlueprintCallable, BlueprintPure)
UTradeWidget *GetTradeWidget() { return Trade_Widget; }
void OpenTradeWidget(UInventoryComponent *Inventory, const TArray<EInventoryTabType>& InRestrictTabs = TArray<EInventoryTabType>{});
void CloseTradeWidget();
UFUNCTION(BlueprintCallable, BlueprintPure)
bool IsTradeOpen() const { return TradeOpen; }
bool IsTradeOpen() const;
// Calendar widget
UFUNCTION(BlueprintCallable, BlueprintPure)
UCalendarScreen *GetCalendarWidget() { return Calendar_Widget; }
UFUNCTION(BlueprintCallable)
void ToggleCalendarWidget(bool bActive);
UFUNCTION(BlueprintCallable, BlueprintPure)
bool IsCalendarOpen() const { return CalendarOpen; }
bool IsCalendarOpen() const;
// Bazar widget
UFUNCTION(BlueprintCallable, BlueprintPure)
UEleriBaseWidget* GetBazarWidget() { return Bazar_Widget; }
UFUNCTION(BlueprintCallable)
void ToggleBazarWidget(bool bActive);
UFUNCTION(BlueprintCallable, BlueprintPure)
bool IsBazarWidgetOpen() const { return BazarWidgetOpen; }
bool IsBazarWidgetOpen() const;
protected:
UPROPERTY(BlueprintReadWrite, Category = "Gradient Picker Widget Binding", meta = (BindWidget))
@@ -173,32 +158,22 @@ protected:
// Book
UPROPERTY(meta = (BindWidget))
UBookOfAlchemyWidget *Book_Widget;
UPROPERTY()
bool BookOpen = false;
// Inventory
UPROPERTY(meta = (BindWidget))
UInventoryWidget *Inventory_Widget;
UPROPERTY()
bool InventoryOpen = false;
// Alchemy
UPROPERTY(meta = (BindWidget))
UAlchemyWidget *Alchemy_Widget;
UPROPERTY()
bool AlchemyOpen = false;
// Notification Big
UPROPERTY(meta = (BindWidget))
UEleriBaseWidget *BigNotification_Widget;
UPROPERTY()
bool BigNotificationOpen = false;
// Dialogue UI
UPROPERTY(meta = (BindWidget))
UDialogueWidget*Dialogue_Widget;
UPROPERTY()
bool DialogueOpen = false;
// Important dialogue prompt
UPROPERTY(meta = (BindWidget))
@@ -211,20 +186,14 @@ protected:
// Trade
UPROPERTY(meta = (BindWidget))
UTradeWidget *Trade_Widget;
UPROPERTY()
bool TradeOpen = false;
// Calendar
UPROPERTY(meta = (BindWidget))
UCalendarScreen *Calendar_Widget;
UPROPERTY()
bool CalendarOpen = false;
// Calendar
UPROPERTY(meta = (BindWidget))
UEleriBaseWidget* Bazar_Widget;
UPROPERTY()
bool BazarWidgetOpen = false;
// Minigames UI
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, meta = (BindWidget))
@@ -237,8 +206,6 @@ protected:
// Main Menu
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, meta = (BindWidget))
UMainMenuWidget *MainMenuScreenUI_Widget;
UPROPERTY()
bool MainMenuOpen = false;
UPROPERTY()
APlayerController* PlayerController;

View File

@@ -19,7 +19,7 @@ class PROJECTELERI_API UTradeWidget : public UEleriBaseWidget
public:
UFUNCTION()
void OpenTradeWidget(UInventoryComponent* Inventory, const TArray<EInventoryTabType>& InRestrictTabs = TArray<EInventoryTabType>{});
void SetupTradeWidget(UInventoryComponent* Inventory, const TArray<EInventoryTabType>& InRestrictTabs = TArray<EInventoryTabType>{});
protected: