Refactor of some UI logic
This commit is contained in:
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.
BIN
Content/UI/MainUI.uasset
LFS
BIN
Content/UI/MainUI.uasset
LFS
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -905,31 +905,16 @@ void AEleriPlayerController::OnOrdersToggle(const FInputActionValue &Value)
|
|||||||
}
|
}
|
||||||
else
|
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)
|
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;
|
return;
|
||||||
|
|
||||||
if (!MainGameUI->IsCalendarOpen())
|
OpenCalendarWindow();
|
||||||
{
|
|
||||||
OpenCalendarWindow();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CloseCalendarWindow();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AEleriPlayerController::OnBookNextPage(const FInputActionValue &Value)
|
void AEleriPlayerController::OnBookNextPage(const FInputActionValue &Value)
|
||||||
@@ -1031,7 +1016,7 @@ UUserWidget *AEleriPlayerController::OpenBookOfAlchemy(UItemDataAsset *ItemToPre
|
|||||||
bBookAnimating = true;
|
bBookAnimating = true;
|
||||||
MainGameUI->GetBookWidget()->Setup(ItemToPresent, false);
|
MainGameUI->GetBookWidget()->Setup(ItemToPresent, false);
|
||||||
PlayerCharacter->ToggleBook(true);
|
PlayerCharacter->ToggleBook(true);
|
||||||
MainGameUI->ToggleBookWidget(true);
|
MainGameUI->OpenWidget(MainGameUI->GetBookWidget());
|
||||||
|
|
||||||
MainGameUI->ToggleGameMenu(false);
|
MainGameUI->ToggleGameMenu(false);
|
||||||
|
|
||||||
@@ -1082,7 +1067,7 @@ void AEleriPlayerController::DisableBookAnimating()
|
|||||||
void AEleriPlayerController::CloseOrdersUI()
|
void AEleriPlayerController::CloseOrdersUI()
|
||||||
{
|
{
|
||||||
OrdersOpen = false;
|
OrdersOpen = false;
|
||||||
RemoveFromMenuStack(OrdersUI);
|
|
||||||
OrdersUI->RemoveFromParent();
|
OrdersUI->RemoveFromParent();
|
||||||
if (MenuStack.Num() == 0)
|
if (MenuStack.Num() == 0)
|
||||||
{
|
{
|
||||||
@@ -1095,33 +1080,15 @@ UMainMenuWidget *AEleriPlayerController::OpenMainMenu()
|
|||||||
{
|
{
|
||||||
if (!IsValid(MainGameUI))
|
if (!IsValid(MainGameUI))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
UMainMenuWidget *MainMenu = MainGameUI->GetMainMenuWidget();
|
|
||||||
if (!IsValid(MainMenu))
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
AddToMenuStack(MainMenu);
|
MainGameUI->OpenWidget(MainGameUI->GetMainMenuWidget());
|
||||||
SetInputMode(FInputModeGameAndUI());
|
|
||||||
SetShowMouseCursor(true);
|
|
||||||
MainGameUI->ToggleMainMenuWidget(true);
|
|
||||||
SetPause(true);
|
|
||||||
|
|
||||||
return MainMenu;
|
return MainGameUI->GetMainMenuWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AEleriPlayerController::CloseMainMenu()
|
void AEleriPlayerController::CloseMainMenu()
|
||||||
{
|
{
|
||||||
if (!IsValid(MainGameUI))
|
MainGameUI->CloseWidget(MainGameUI->GetMainMenuWidget());
|
||||||
return;
|
|
||||||
UMainMenuWidget *MainMenu = MainGameUI->GetMainMenuWidget();
|
|
||||||
if (!IsValid(MainMenu))
|
|
||||||
return;
|
|
||||||
|
|
||||||
RemoveFromMenuStack(MainMenu);
|
|
||||||
MainGameUI->ToggleMainMenuWidget(false);
|
|
||||||
SetShowMouseCursor(false);
|
|
||||||
SetInputMode(FInputModeGameOnly());
|
|
||||||
|
|
||||||
SetPause(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UEleriBaseWidget *AEleriPlayerController::ToggleAlchemyMenu(bool bOpen)
|
UEleriBaseWidget *AEleriPlayerController::ToggleAlchemyMenu(bool bOpen)
|
||||||
@@ -1139,20 +1106,7 @@ UEleriBaseWidget *AEleriPlayerController::ToggleDialogueWindow(bool bOpen)
|
|||||||
if (!IsValid(MainGameUI->GetDialogueWidget()) || MainGameUI->GetDialogueWidget()->IsAnimating())
|
if (!IsValid(MainGameUI->GetDialogueWidget()) || MainGameUI->GetDialogueWidget()->IsAnimating())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
MainGameUI->ToggleDialogueWidget(bOpen);
|
MainGameUI->OpenWidget(MainGameUI->GetDialogueWidget());
|
||||||
MainGameUI->GetDialogueWidget()->ToggleWidget(bOpen);
|
|
||||||
|
|
||||||
if (bOpen)
|
|
||||||
{
|
|
||||||
AddToMenuStack(MainGameUI->GetDialogueWidget());
|
|
||||||
SetInputMode(FInputModeGameAndUI());
|
|
||||||
SetShowMouseCursor(bOpen);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CloseGenericMenu(MainGameUI->GetDialogueWidget());
|
|
||||||
}
|
|
||||||
|
|
||||||
return MainGameUI->GetDialogueWidget();
|
return MainGameUI->GetDialogueWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1161,21 +1115,14 @@ UEleriBaseWidget *AEleriPlayerController::ToggleNotificationWindow(bool bOpen)
|
|||||||
if (!IsValid(MainGameUI->GetBigNotificationWidget()))
|
if (!IsValid(MainGameUI->GetBigNotificationWidget()))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
MainGameUI->ToggleBigNotificationWidget(bOpen);
|
if (MainGameUI->IsBigNotificationOpen())
|
||||||
|
|
||||||
if (bOpen)
|
|
||||||
{
|
{
|
||||||
AddToMenuStack(MainGameUI->GetBigNotificationWidget());
|
MainGameUI->CloseWidget(MainGameUI->GetBigNotificationWidget());
|
||||||
SetInputMode(FInputModeGameAndUI());
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CloseGenericMenu(MainGameUI->GetBigNotificationWidget());
|
MainGameUI->OpenWidget(MainGameUI->GetBigNotificationWidget());
|
||||||
SetInputMode(FInputModeGameOnly());
|
|
||||||
}
|
}
|
||||||
SetShowMouseCursor(bOpen);
|
|
||||||
SetPause(bOpen);
|
|
||||||
|
|
||||||
return MainGameUI->GetBigNotificationWidget();
|
return MainGameUI->GetBigNotificationWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1187,132 +1134,22 @@ UTradeWidget *AEleriPlayerController::OpenTradeWindow(UInventoryComponent *Inven
|
|||||||
if (UMainGameWidget *MainWidget = GetMainGameWidget())
|
if (UMainGameWidget *MainWidget = GetMainGameWidget())
|
||||||
{
|
{
|
||||||
MainWidget->OpenTradeWidget(Inventory, InRestrictTabs);
|
MainWidget->OpenTradeWidget(Inventory, InRestrictTabs);
|
||||||
UTradeWidget *TradeWidget = MainWidget->GetTradeWidget();
|
return MainGameUI->GetTradeWidget();
|
||||||
|
|
||||||
AddToMenuStack(TradeWidget);
|
|
||||||
SetInputMode(FInputModeGameAndUI());
|
|
||||||
SetShowMouseCursor(true);
|
|
||||||
SetPause(true);
|
|
||||||
|
|
||||||
return TradeWidget;
|
|
||||||
}
|
}
|
||||||
return nullptr;
|
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()
|
UCalendarScreen* AEleriPlayerController::OpenCalendarWindow()
|
||||||
{
|
{
|
||||||
MainGameUI->ToggleCalendarWidget(true);
|
MainGameUI->OpenWidget(MainGameUI->GetCalendarWidget());
|
||||||
AddToMenuStack(MainGameUI->GetCalendarWidget());
|
|
||||||
SetInputMode(FInputModeGameAndUI());
|
|
||||||
SetShowMouseCursor(true);
|
|
||||||
SetPause(true);
|
|
||||||
return MainGameUI->GetCalendarWidget();
|
return MainGameUI->GetCalendarWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AEleriPlayerController::CloseCalendarWindow()
|
|
||||||
{
|
|
||||||
MainGameUI->ToggleCalendarWidget(false);
|
|
||||||
RemoveFromMenuStack(MainGameUI->GetCalendarWidget());
|
|
||||||
SetInputMode(FInputModeGameOnly());
|
|
||||||
SetShowMouseCursor(false);
|
|
||||||
SetPause(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
UEleriBaseWidget* AEleriPlayerController::OpenBazarWindow() {
|
UEleriBaseWidget* AEleriPlayerController::OpenBazarWindow() {
|
||||||
MainGameUI->ToggleBazarWidget(true);
|
MainGameUI->OpenWidget(MainGameUI->GetBazarWidget());
|
||||||
AddToMenuStack(MainGameUI->GetBazarWidget());
|
|
||||||
SetInputMode(FInputModeGameAndUI());
|
|
||||||
SetShowMouseCursor(true);
|
|
||||||
return 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)
|
void AEleriPlayerController::OnInteract(const FInputActionValue &Value)
|
||||||
{
|
{
|
||||||
if (!IsValid(PlayerCharacter))
|
if (!IsValid(PlayerCharacter))
|
||||||
@@ -1347,10 +1184,7 @@ void AEleriPlayerController::StartMinigame(EMinigameType MinigameType, const TSo
|
|||||||
MinigameType == EMinigameType::NONE)
|
MinigameType == EMinigameType::NONE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (UEleriBaseWidget *MinigameWidget = MainGameUI->ToggleMinigamesWidget(MinigameType, DataAsset))
|
MainGameUI->ToggleMinigamesWidget(MinigameType, DataAsset);
|
||||||
{
|
|
||||||
OpenGenericMenu(MinigameWidget, false, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AEleriPlayerController::CloseMinigame(int32 Score)
|
void AEleriPlayerController::CloseMinigame(int32 Score)
|
||||||
@@ -1358,13 +1192,9 @@ void AEleriPlayerController::CloseMinigame(int32 Score)
|
|||||||
if (!IsValid(PlayerCharacter) || !IsValid(MainGameUI) || !MainGameUI->IsAnyMinigameOpen())
|
if (!IsValid(PlayerCharacter) || !IsValid(MainGameUI) || !MainGameUI->IsAnyMinigameOpen())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (UEleriBaseWidget *MinigameWidget = MainGameUI->GetCurrentlyOpenMinigameWidget())
|
MainGameUI->ToggleMinigamesWidget(EMinigameType::NONE, nullptr);
|
||||||
|
if (OnMinigameComplete.IsBound())
|
||||||
{
|
{
|
||||||
CloseGenericMenu(MinigameWidget);
|
OnMinigameComplete.Execute(Score);
|
||||||
MainGameUI->ToggleMinigamesWidget(EMinigameType::NONE, nullptr);
|
|
||||||
if (OnMinigameComplete.IsBound())
|
|
||||||
{
|
|
||||||
OnMinigameComplete.Execute(Score);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,12 +7,7 @@
|
|||||||
#include "Kismet/GameplayStatics.h"
|
#include "Kismet/GameplayStatics.h"
|
||||||
|
|
||||||
void UEleriBaseWidget::ToggleWidget_Implementation(bool bActive) {
|
void UEleriBaseWidget::ToggleWidget_Implementation(bool bActive) {
|
||||||
if (bActive) {
|
SetVisibility(bActive? ESlateVisibility::Visible : ESlateVisibility::Hidden);
|
||||||
//ActivateWidget();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//DeactivateWidget();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UEleriBaseWidget::HandleUiInputAction_Implementation(EEleriUIInputAction InputAction)
|
void UEleriBaseWidget::HandleUiInputAction_Implementation(EEleriUIInputAction InputAction)
|
||||||
|
|||||||
@@ -5,11 +5,10 @@
|
|||||||
#include "EleriPlayerController.h"
|
#include "EleriPlayerController.h"
|
||||||
#include "EnhancedInputSubsystems.h"
|
#include "EnhancedInputSubsystems.h"
|
||||||
#include "Kismet/GameplayStatics.h"
|
#include "Kismet/GameplayStatics.h"
|
||||||
#include "UI/InventoryWidget.h"
|
|
||||||
#include "UI/MainMenuWidget.h"
|
|
||||||
#include "UI/TradeWidget.h"
|
#include "UI/TradeWidget.h"
|
||||||
#include "UI/AlchemyWidget.h"
|
#include "UI/AlchemyWidget.h"
|
||||||
|
#include "ProjectEleri/UI/CalendarScreen.h"
|
||||||
|
#include "ProjectEleri/DialogueSystem/DialogueWidget.h"
|
||||||
|
|
||||||
void UMainGameWidget::TogglePlaceableUI(bool bEnabled)
|
void UMainGameWidget::TogglePlaceableUI(bool bEnabled)
|
||||||
{
|
{
|
||||||
@@ -46,83 +45,83 @@ void UMainGameWidget::CloseWidget(UEleriBaseWidget* Widget)
|
|||||||
CheckOpenWidgets();
|
CheckOpenWidgets();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMainGameWidget::ToggleBookWidget(bool bActive)
|
bool UMainGameWidget::IsBookOpen() const
|
||||||
{
|
{
|
||||||
if (bActive)
|
return WidgetStack.Contains(Book_Widget);
|
||||||
WidgetStack.AddUnique(GetBookWidget());
|
|
||||||
|
|
||||||
CheckOpenWidgets();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMainGameWidget::ToggleAlchemyWidget(bool bActive)
|
bool UMainGameWidget::IsInventoryOpen() const
|
||||||
{
|
{
|
||||||
AlchemyOpen = bActive;
|
return WidgetStack.Contains(Inventory_Widget);
|
||||||
if (bActive)
|
|
||||||
WidgetStack.AddUnique(GetAlchemyWidget());
|
|
||||||
|
|
||||||
CheckOpenWidgets();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMainGameWidget::ToggleBigNotificationWidget(bool bActive)
|
bool UMainGameWidget::IsAlchemyOpen() const
|
||||||
{
|
{
|
||||||
BigNotificationOpen = bActive;
|
return WidgetStack.Contains(Alchemy_Widget);
|
||||||
BigNotification_Widget->ToggleWidget(BigNotificationOpen);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
MinigameOpen = MinigameType;
|
||||||
CurrentlyOpenMinigameWidget = K2_OnMinigameOpen(MinigameOpen, DataAsset);
|
if (MinigameType == EMinigameType::NONE)
|
||||||
|
{
|
||||||
|
CloseWidget(CurrentlyOpenMinigameWidget);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CurrentlyOpenMinigameWidget = K2_OnMinigameOpen(MinigameOpen, DataAsset);
|
||||||
|
OpenWidget(CurrentlyOpenMinigameWidget);
|
||||||
|
}
|
||||||
|
|
||||||
return CurrentlyOpenMinigameWidget;
|
return CurrentlyOpenMinigameWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMainGameWidget::ToggleMainMenuWidget(bool bActive)
|
bool UMainGameWidget::IsMainMenuOpen() const
|
||||||
{
|
{
|
||||||
MainMenuOpen = bActive;
|
return WidgetStack.Contains(MainMenuScreenUI_Widget);
|
||||||
MainMenuScreenUI_Widget->ToggleWidget(MainMenuOpen);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UEleriBaseWidget *UMainGameWidget::ShowAmountPickerWidget()
|
UEleriBaseWidget* UMainGameWidget::ShowAmountPickerWidget()
|
||||||
{
|
{
|
||||||
AmountPicker_Widget->ToggleWidget(true);
|
OpenWidget(AmountPicker_Widget);
|
||||||
return AmountPicker_Widget;
|
return AmountPicker_Widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
UEleriBaseWidget *UMainGameWidget::ShowImportantDialoguePromptWidget()
|
UEleriBaseWidget* UMainGameWidget::ShowImportantDialoguePromptWidget()
|
||||||
{
|
{
|
||||||
ImportantDialoguePrompt_Widget->ToggleWidget(true);
|
OpenWidget(ImportantDialoguePrompt_Widget);
|
||||||
return 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->SetupTradeWidget(Inventory, InRestrictTabs);
|
||||||
Trade_Widget->OpenTradeWidget(Inventory, InRestrictTabs);
|
OpenWidget(GetTradeWidget());
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMainGameWidget::CloseTradeWidget()
|
bool UMainGameWidget::IsTradeOpen() const
|
||||||
{
|
{
|
||||||
TradeOpen = false;
|
return WidgetStack.Contains(Trade_Widget);
|
||||||
Trade_Widget->ToggleWidget(false);
|
|
||||||
CheckOpenWidgets();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMainGameWidget::ToggleCalendarWidget(bool bActive)
|
bool UMainGameWidget::IsCalendarOpen() const
|
||||||
{
|
{
|
||||||
CalendarOpen = bActive;
|
return WidgetStack.Contains(Calendar_Widget);
|
||||||
Calendar_Widget->ToggleWidget(CalendarOpen);
|
|
||||||
CheckOpenWidgets();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMainGameWidget::ToggleBazarWidget(bool bActive) {
|
bool UMainGameWidget::IsBazarWidgetOpen() const
|
||||||
BazarWidgetOpen = bActive;
|
{
|
||||||
Bazar_Widget->ToggleWidget(BazarWidgetOpen);
|
return WidgetStack.Contains(Bazar_Widget);
|
||||||
CheckOpenWidgets();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMainGameWidget::CheckOpenWidgets()
|
void UMainGameWidget::CheckOpenWidgets()
|
||||||
@@ -132,11 +131,7 @@ void UMainGameWidget::CheckOpenWidgets()
|
|||||||
PlayerController = UGameplayStatics::GetPlayerController(this, 0);
|
PlayerController = UGameplayStatics::GetPlayerController(this, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//const bool bAnyOpenWidgets = IsAlchemyOpen() || IsAnyMinigameOpen() || IsBazarWidgetOpen() || IsBigNotificationOpen() ||
|
|
||||||
// IsBookOpen() || IsCalendarOpen() || IsDialogueOpen() || IsInventoryOpen() || IsMainMenuOpen() || IsTradeOpen();
|
|
||||||
|
|
||||||
const bool bAnyOpenWidgets = AnyWidgetOpen();
|
const bool bAnyOpenWidgets = AnyWidgetOpen();
|
||||||
|
|
||||||
const bool bShouldBePaused = WidgetStack.Contains(GetBookWidget());
|
const bool bShouldBePaused = WidgetStack.Contains(GetBookWidget());
|
||||||
|
|
||||||
if (bAnyOpenWidgets)
|
if (bAnyOpenWidgets)
|
||||||
@@ -153,7 +148,8 @@ void UMainGameWidget::CheckOpenWidgets()
|
|||||||
|
|
||||||
|
|
||||||
// Get the Enhanced Input Local Player Subsystem from the Local Player related to our Player Controller.
|
// 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))
|
if (const AEleriPlayerController* EleriPC = Cast<AEleriPlayerController>(PlayerController))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#include "UI/TradeWidget.h"
|
#include "UI/TradeWidget.h"
|
||||||
#include "ProjectEleri/Public/InventoryComponent.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;
|
InventoryRef = Inventory;
|
||||||
|
|
||||||
if (InventoryRef) {
|
if (InventoryRef) {
|
||||||
@@ -13,6 +13,4 @@ void UTradeWidget::OpenTradeWidget(UInventoryComponent* Inventory, const TArray<
|
|||||||
bIsChest = InventoryRef->IsChest;
|
bIsChest = InventoryRef->IsChest;
|
||||||
RestrictedTabs = InRestrictTabs;
|
RestrictedTabs = InRestrictTabs;
|
||||||
}
|
}
|
||||||
|
|
||||||
ToggleWidget(true);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -353,29 +353,12 @@ public:
|
|||||||
|
|
||||||
UFUNCTION(BlueprintCallable, meta = (AutoCreateRefTerm = "InRestrictTabs"))
|
UFUNCTION(BlueprintCallable, meta = (AutoCreateRefTerm = "InRestrictTabs"))
|
||||||
UTradeWidget* OpenTradeWindow(UInventoryComponent* Inventory, const TArray<EInventoryTabType>& InRestrictTabs);
|
UTradeWidget* OpenTradeWindow(UInventoryComponent* Inventory, const TArray<EInventoryTabType>& InRestrictTabs);
|
||||||
UFUNCTION(BlueprintCallable)
|
|
||||||
void CloseTradeWindow();
|
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable)
|
UFUNCTION(BlueprintCallable)
|
||||||
UCalendarScreen* OpenCalendarWindow();
|
UCalendarScreen* OpenCalendarWindow();
|
||||||
UFUNCTION(BlueprintCallable)
|
|
||||||
void CloseCalendarWindow();
|
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable)
|
UFUNCTION(BlueprintCallable)
|
||||||
UEleriBaseWidget* OpenBazarWindow();
|
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 OnInteract(const FInputActionValue& Value);
|
||||||
void OnInteractExit(const FInputActionValue& Value);
|
void OnInteractExit(const FInputActionValue& Value);
|
||||||
|
|||||||
@@ -7,15 +7,15 @@
|
|||||||
#include "Components/Overlay.h"
|
#include "Components/Overlay.h"
|
||||||
#include "Components/WidgetSwitcher.h"
|
#include "Components/WidgetSwitcher.h"
|
||||||
#include "ProjectEleri/UI/MinigameBaseWidget.h"
|
#include "ProjectEleri/UI/MinigameBaseWidget.h"
|
||||||
#include "ProjectEleri/UI/CalendarScreen.h"
|
|
||||||
#include "ProjectEleri/Public/InventoryComponent.h"
|
#include "ProjectEleri/Public/InventoryComponent.h"
|
||||||
|
|
||||||
#include "MainGameWidget.generated.h"
|
#include "MainGameWidget.generated.h"
|
||||||
|
|
||||||
|
class UCalendarScreen;
|
||||||
|
class UAlchemyWidget;
|
||||||
class UInventoryWidget;
|
class UInventoryWidget;
|
||||||
class UBookOfAlchemyWidget;
|
class UBookOfAlchemyWidget;
|
||||||
class UInteractionWidget;
|
class UInteractionWidget;
|
||||||
class UAlchemyWidget;
|
|
||||||
class UMainMenuWidget;
|
class UMainMenuWidget;
|
||||||
class UTradeWidget;
|
class UTradeWidget;
|
||||||
class UDialogueWidget;
|
class UDialogueWidget;
|
||||||
@@ -68,40 +68,32 @@ public:
|
|||||||
// Book widget
|
// Book widget
|
||||||
UFUNCTION(BlueprintCallable, BlueprintPure)
|
UFUNCTION(BlueprintCallable, BlueprintPure)
|
||||||
UBookOfAlchemyWidget *GetBookWidget() { return Book_Widget; }
|
UBookOfAlchemyWidget *GetBookWidget() { return Book_Widget; }
|
||||||
UFUNCTION(BlueprintCallable)
|
|
||||||
void ToggleBookWidget(bool bActive);
|
|
||||||
UFUNCTION(BlueprintCallable, BlueprintPure)
|
UFUNCTION(BlueprintCallable, BlueprintPure)
|
||||||
bool IsBookOpen() const { return WidgetStack.Contains(Book_Widget); }
|
bool IsBookOpen() const;
|
||||||
|
|
||||||
// Inventory widget
|
// Inventory widget
|
||||||
UFUNCTION(BlueprintCallable, BlueprintPure)
|
UFUNCTION(BlueprintCallable, BlueprintPure)
|
||||||
UInventoryWidget *GetInventoryWidget() { return Inventory_Widget; }
|
UInventoryWidget *GetInventoryWidget() { return Inventory_Widget; }
|
||||||
UFUNCTION(BlueprintCallable, BlueprintPure)
|
UFUNCTION(BlueprintCallable, BlueprintPure)
|
||||||
bool IsInventoryOpen() const { return WidgetStack.Contains(Inventory_Widget); }
|
bool IsInventoryOpen() const;
|
||||||
|
|
||||||
// Alchemy widget
|
// Alchemy widget
|
||||||
UFUNCTION(BlueprintCallable, BlueprintPure)
|
UFUNCTION(BlueprintCallable, BlueprintPure)
|
||||||
UAlchemyWidget *GetAlchemyWidget() { return Alchemy_Widget; }
|
UAlchemyWidget *GetAlchemyWidget() { return Alchemy_Widget; }
|
||||||
UFUNCTION(BlueprintCallable)
|
|
||||||
void ToggleAlchemyWidget(bool bActive);
|
|
||||||
UFUNCTION(BlueprintCallable, BlueprintPure)
|
UFUNCTION(BlueprintCallable, BlueprintPure)
|
||||||
bool IsAlchemyOpen() const { return AlchemyOpen; }
|
bool IsAlchemyOpen() const;
|
||||||
|
|
||||||
// Big Notification widget
|
// Big Notification widget
|
||||||
UFUNCTION(BlueprintCallable, BlueprintPure)
|
UFUNCTION(BlueprintCallable, BlueprintPure)
|
||||||
UEleriBaseWidget *GetBigNotificationWidget() { return BigNotification_Widget; }
|
UEleriBaseWidget *GetBigNotificationWidget() { return BigNotification_Widget; }
|
||||||
UFUNCTION(BlueprintCallable)
|
|
||||||
void ToggleBigNotificationWidget(bool bActive);
|
|
||||||
UFUNCTION(BlueprintCallable, BlueprintPure)
|
UFUNCTION(BlueprintCallable, BlueprintPure)
|
||||||
bool IsBigNotificationOpen() const { return BigNotificationOpen; }
|
bool IsBigNotificationOpen() const;
|
||||||
|
|
||||||
// Dialogue widget
|
// Dialogue widget
|
||||||
UFUNCTION(BlueprintCallable, BlueprintPure)
|
UFUNCTION(BlueprintCallable, BlueprintPure)
|
||||||
UDialogueWidget*GetDialogueWidget() { return Dialogue_Widget; }
|
UDialogueWidget*GetDialogueWidget() { return Dialogue_Widget; }
|
||||||
UFUNCTION(BlueprintCallable)
|
|
||||||
void ToggleDialogueWidget(bool bActive);
|
|
||||||
UFUNCTION(BlueprintCallable, BlueprintPure)
|
UFUNCTION(BlueprintCallable, BlueprintPure)
|
||||||
bool IsDialogueOpen() const { return DialogueOpen; }
|
bool IsDialogueOpen() const;
|
||||||
|
|
||||||
// Minigames widget
|
// Minigames widget
|
||||||
UFUNCTION(BlueprintCallable)
|
UFUNCTION(BlueprintCallable)
|
||||||
@@ -119,10 +111,8 @@ public:
|
|||||||
// Main menu widget
|
// Main menu widget
|
||||||
UFUNCTION(BlueprintCallable, BlueprintPure)
|
UFUNCTION(BlueprintCallable, BlueprintPure)
|
||||||
UMainMenuWidget *GetMainMenuWidget() { return MainMenuScreenUI_Widget; }
|
UMainMenuWidget *GetMainMenuWidget() { return MainMenuScreenUI_Widget; }
|
||||||
UFUNCTION(BlueprintCallable)
|
|
||||||
void ToggleMainMenuWidget(bool bActive);
|
|
||||||
UFUNCTION(BlueprintCallable, BlueprintPure)
|
UFUNCTION(BlueprintCallable, BlueprintPure)
|
||||||
bool IsMainMenuOpen() const { return MainMenuOpen; }
|
bool IsMainMenuOpen() const;
|
||||||
|
|
||||||
// Amount Picker widget
|
// Amount Picker widget
|
||||||
UFUNCTION(BlueprintCallable, BlueprintPure)
|
UFUNCTION(BlueprintCallable, BlueprintPure)
|
||||||
@@ -140,25 +130,20 @@ public:
|
|||||||
UFUNCTION(BlueprintCallable, BlueprintPure)
|
UFUNCTION(BlueprintCallable, BlueprintPure)
|
||||||
UTradeWidget *GetTradeWidget() { return Trade_Widget; }
|
UTradeWidget *GetTradeWidget() { return Trade_Widget; }
|
||||||
void OpenTradeWidget(UInventoryComponent *Inventory, const TArray<EInventoryTabType>& InRestrictTabs = TArray<EInventoryTabType>{});
|
void OpenTradeWidget(UInventoryComponent *Inventory, const TArray<EInventoryTabType>& InRestrictTabs = TArray<EInventoryTabType>{});
|
||||||
void CloseTradeWidget();
|
|
||||||
UFUNCTION(BlueprintCallable, BlueprintPure)
|
UFUNCTION(BlueprintCallable, BlueprintPure)
|
||||||
bool IsTradeOpen() const { return TradeOpen; }
|
bool IsTradeOpen() const;
|
||||||
|
|
||||||
// Calendar widget
|
// Calendar widget
|
||||||
UFUNCTION(BlueprintCallable, BlueprintPure)
|
UFUNCTION(BlueprintCallable, BlueprintPure)
|
||||||
UCalendarScreen *GetCalendarWidget() { return Calendar_Widget; }
|
UCalendarScreen *GetCalendarWidget() { return Calendar_Widget; }
|
||||||
UFUNCTION(BlueprintCallable)
|
|
||||||
void ToggleCalendarWidget(bool bActive);
|
|
||||||
UFUNCTION(BlueprintCallable, BlueprintPure)
|
UFUNCTION(BlueprintCallable, BlueprintPure)
|
||||||
bool IsCalendarOpen() const { return CalendarOpen; }
|
bool IsCalendarOpen() const;
|
||||||
|
|
||||||
// Bazar widget
|
// Bazar widget
|
||||||
UFUNCTION(BlueprintCallable, BlueprintPure)
|
UFUNCTION(BlueprintCallable, BlueprintPure)
|
||||||
UEleriBaseWidget* GetBazarWidget() { return Bazar_Widget; }
|
UEleriBaseWidget* GetBazarWidget() { return Bazar_Widget; }
|
||||||
UFUNCTION(BlueprintCallable)
|
|
||||||
void ToggleBazarWidget(bool bActive);
|
|
||||||
UFUNCTION(BlueprintCallable, BlueprintPure)
|
UFUNCTION(BlueprintCallable, BlueprintPure)
|
||||||
bool IsBazarWidgetOpen() const { return BazarWidgetOpen; }
|
bool IsBazarWidgetOpen() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
UPROPERTY(BlueprintReadWrite, Category = "Gradient Picker Widget Binding", meta = (BindWidget))
|
UPROPERTY(BlueprintReadWrite, Category = "Gradient Picker Widget Binding", meta = (BindWidget))
|
||||||
@@ -173,32 +158,22 @@ protected:
|
|||||||
// Book
|
// Book
|
||||||
UPROPERTY(meta = (BindWidget))
|
UPROPERTY(meta = (BindWidget))
|
||||||
UBookOfAlchemyWidget *Book_Widget;
|
UBookOfAlchemyWidget *Book_Widget;
|
||||||
UPROPERTY()
|
|
||||||
bool BookOpen = false;
|
|
||||||
|
|
||||||
// Inventory
|
// Inventory
|
||||||
UPROPERTY(meta = (BindWidget))
|
UPROPERTY(meta = (BindWidget))
|
||||||
UInventoryWidget *Inventory_Widget;
|
UInventoryWidget *Inventory_Widget;
|
||||||
UPROPERTY()
|
|
||||||
bool InventoryOpen = false;
|
|
||||||
|
|
||||||
// Alchemy
|
// Alchemy
|
||||||
UPROPERTY(meta = (BindWidget))
|
UPROPERTY(meta = (BindWidget))
|
||||||
UAlchemyWidget *Alchemy_Widget;
|
UAlchemyWidget *Alchemy_Widget;
|
||||||
UPROPERTY()
|
|
||||||
bool AlchemyOpen = false;
|
|
||||||
|
|
||||||
// Notification Big
|
// Notification Big
|
||||||
UPROPERTY(meta = (BindWidget))
|
UPROPERTY(meta = (BindWidget))
|
||||||
UEleriBaseWidget *BigNotification_Widget;
|
UEleriBaseWidget *BigNotification_Widget;
|
||||||
UPROPERTY()
|
|
||||||
bool BigNotificationOpen = false;
|
|
||||||
|
|
||||||
// Dialogue UI
|
// Dialogue UI
|
||||||
UPROPERTY(meta = (BindWidget))
|
UPROPERTY(meta = (BindWidget))
|
||||||
UDialogueWidget*Dialogue_Widget;
|
UDialogueWidget*Dialogue_Widget;
|
||||||
UPROPERTY()
|
|
||||||
bool DialogueOpen = false;
|
|
||||||
|
|
||||||
// Important dialogue prompt
|
// Important dialogue prompt
|
||||||
UPROPERTY(meta = (BindWidget))
|
UPROPERTY(meta = (BindWidget))
|
||||||
@@ -211,20 +186,14 @@ protected:
|
|||||||
// Trade
|
// Trade
|
||||||
UPROPERTY(meta = (BindWidget))
|
UPROPERTY(meta = (BindWidget))
|
||||||
UTradeWidget *Trade_Widget;
|
UTradeWidget *Trade_Widget;
|
||||||
UPROPERTY()
|
|
||||||
bool TradeOpen = false;
|
|
||||||
|
|
||||||
// Calendar
|
// Calendar
|
||||||
UPROPERTY(meta = (BindWidget))
|
UPROPERTY(meta = (BindWidget))
|
||||||
UCalendarScreen *Calendar_Widget;
|
UCalendarScreen *Calendar_Widget;
|
||||||
UPROPERTY()
|
|
||||||
bool CalendarOpen = false;
|
|
||||||
|
|
||||||
// Calendar
|
// Calendar
|
||||||
UPROPERTY(meta = (BindWidget))
|
UPROPERTY(meta = (BindWidget))
|
||||||
UEleriBaseWidget* Bazar_Widget;
|
UEleriBaseWidget* Bazar_Widget;
|
||||||
UPROPERTY()
|
|
||||||
bool BazarWidgetOpen = false;
|
|
||||||
|
|
||||||
// Minigames UI
|
// Minigames UI
|
||||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, meta = (BindWidget))
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, meta = (BindWidget))
|
||||||
@@ -237,8 +206,6 @@ protected:
|
|||||||
// Main Menu
|
// Main Menu
|
||||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, meta = (BindWidget))
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, meta = (BindWidget))
|
||||||
UMainMenuWidget *MainMenuScreenUI_Widget;
|
UMainMenuWidget *MainMenuScreenUI_Widget;
|
||||||
UPROPERTY()
|
|
||||||
bool MainMenuOpen = false;
|
|
||||||
|
|
||||||
UPROPERTY()
|
UPROPERTY()
|
||||||
APlayerController* PlayerController;
|
APlayerController* PlayerController;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class PROJECTELERI_API UTradeWidget : public UEleriBaseWidget
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
void OpenTradeWidget(UInventoryComponent* Inventory, const TArray<EInventoryTabType>& InRestrictTabs = TArray<EInventoryTabType>{});
|
void SetupTradeWidget(UInventoryComponent* Inventory, const TArray<EInventoryTabType>& InRestrictTabs = TArray<EInventoryTabType>{});
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user