Compare commits

...

4 Commits

82 changed files with 297 additions and 620 deletions

File diff suppressed because one or more lines are too long

View File

@@ -5,7 +5,7 @@ GameName=ProjectEleri
DefaultCompletionMode=KeepState
[/Script/EngineSettings.GameMapsSettings]
EditorStartupMap=/Game/Maps/Startmap.Startmap
EditorStartupMap=/Game/Maps/Persistent_GameWorld.Persistent_GameWorld
GameDefaultMap=/Game/Maps/Persistent_GameWorld.Persistent_GameWorld
TransitionMap=
bUseSplitscreen=True

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.

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

@@ -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)
@@ -1012,7 +997,7 @@ UUserWidget *AEleriPlayerController::OpenInventory(bool JustSelecting, bool Shop
UInventoryComponent *MainInv = PlayerInventory;
UInventoryComponent *OtherInv = IsValid(Inventory) ? Inventory : nullptr;
MainGameUI->OpenWidget(MainGameUI->GetInventoryWidget());
MainGameUI->GetInventoryWidget()->ToggleWidget(true);
//MainGameUI->GetInventoryWidget()->ToggleWidget(true);
MainGameUI->GetInventoryWidget()->Setup(MainInv, OtherInv, Shop, JustSelecting, RestrictTabs, bSelectMultiple, bShowDescription, bShowPropertyMap);
return MainGameUI->GetInventoryWidget();
@@ -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,56 +1080,23 @@ 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)
{
if (bOpen && MainGameUI->IsAlchemyOpen())
return MainGameUI->GetAlchemyWidget();
if (!bOpen && !MainGameUI->IsAlchemyOpen())
return MainGameUI->GetAlchemyWidget();
if (MainGameUI->AnyWidgetOpen())
return nullptr;
MainGameUI->GetAlchemyWidget()->ToggleWidget(bOpen);
if (bOpen)
{
AddToMenuStack(MainGameUI->GetAlchemyWidget());
SetInputMode(FInputModeGameAndUI());
}
else
{
CloseGenericMenu(MainGameUI->GetAlchemyWidget());
}
SetShowMouseCursor(bOpen);
MainGameUI->ToggleAlchemyWidget(bOpen);
MainGameUI->OpenWidget(MainGameUI->GetAlchemyWidget());
return MainGameUI->GetAlchemyWidget();
}
@@ -1154,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();
}
@@ -1176,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();
}
@@ -1202,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))
@@ -1362,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)
@@ -1373,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

@@ -5,14 +5,11 @@
#include "EleriPlayerController.h"
#include "Kismet/GameplayStatics.h"
#include "ProjectEleri/System/MainBlueprintFunctionLibrary.h"
#include "ProjectEleri/UI/Helpers/ScreenActionInputDisplay.h"
void UEleriBaseWidget::ToggleWidget_Implementation(bool bActive) {
if (bActive) {
//ActivateWidget();
}
else {
//DeactivateWidget();
}
SetVisibility(bActive? ESlateVisibility::Visible : ESlateVisibility::Hidden);
}
void UEleriBaseWidget::HandleUiInputAction_Implementation(EEleriUIInputAction InputAction)
@@ -25,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

@@ -5,10 +5,11 @@
#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"
#include "ProjectEleri/UI/Helpers/ScreenActionInputDisplay.h"
void UMainGameWidget::TogglePlaceableUI(bool bEnabled)
{
@@ -23,101 +24,129 @@ 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();
if (Widget->bShowInputMapsWhileOnScreen)
{
Widget->DisplayInputPrompts();
}
}
void UMainGameWidget::CloseWidget(UEleriBaseWidget* Widget)
{
if (!Widget) return;
Widget->ToggleWidget(false);
WidgetStack.Remove(Widget);
CheckOpenWidgets();
}
void UMainGameWidget::ToggleBookWidget(bool bActive)
{
if (bActive)
WidgetStack.AddUnique(GetBookWidget());
CheckOpenWidgets();
bool bShouldShowInputPrompts = false;
for (UEleriBaseWidget* WidgetInStack : WidgetStack)
{
if (WidgetInStack->bShowInputMapsWhileOnScreen)
{
WidgetInStack->DisplayInputPrompts();
bShouldShowInputPrompts = true;
}
}
if (!bShouldShowInputPrompts)
{
GetScreenActionInputDisplayWidget()->SetVisibility(ESlateVisibility::Hidden);
}
}
void UMainGameWidget::ToggleAlchemyWidget(bool bActive)
bool UMainGameWidget::IsBookOpen() const
{
AlchemyOpen = bActive;
return WidgetStack.Contains(Book_Widget);
}
void UMainGameWidget::ToggleBigNotificationWidget(bool bActive)
bool UMainGameWidget::IsInventoryOpen() const
{
BigNotificationOpen = bActive;
BigNotification_Widget->ToggleWidget(BigNotificationOpen);
return WidgetStack.Contains(Inventory_Widget);
}
void UMainGameWidget::ToggleDialogueWidget(bool bActive)
bool UMainGameWidget::IsAlchemyOpen() const
{
DialogueOpen = bActive;
return WidgetStack.Contains(Alchemy_Widget);
}
UMinigameBaseWidget *UMainGameWidget::ToggleMinigamesWidget(EMinigameType MinigameType, const TSoftObjectPtr<UBaseMinigameDataAsset> &DataAsset)
bool UMainGameWidget::IsBigNotificationOpen() const
{
return WidgetStack.Contains(BigNotification_Widget);
}
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);
}
bool UMainGameWidget::IsScreenActionInputDisplayWidgetOpen() const
{
return ScreenActionInputDisplay_Widget->GetVisibility() == ESlateVisibility::Visible;
}
void UMainGameWidget::CheckOpenWidgets()
@@ -126,14 +155,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());
@@ -142,13 +167,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

@@ -33,7 +33,7 @@ public class ProjectEleri : ModuleRules
"InteractionSystem"
});
PrivateDependencyModuleNames.AddRange(new string[] { "OnlineSubsystem", "OnlineSubsystemUtils", "UMGEditor" });
PrivateDependencyModuleNames.AddRange(new string[] { "OnlineSubsystem", "OnlineSubsystemUtils" });
// Uncomment if you are using Slate UI
// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });

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

@@ -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");
};

View File

@@ -7,15 +7,17 @@
#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"
struct FEleriActionInputData;
class UScreenActionInputDisplay;
class UCalendarScreen;
class UAlchemyWidget;
class UInventoryWidget;
class UBookOfAlchemyWidget;
class UInteractionWidget;
class UAlchemyWidget;
class UMainMenuWidget;
class UTradeWidget;
class UDialogueWidget;
@@ -68,40 +70,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 +113,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 +132,25 @@ 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;
UFUNCTION(BlueprintCallable, BlueprintPure)
UScreenActionInputDisplay* GetScreenActionInputDisplayWidget() { return ScreenActionInputDisplay_Widget; }
UFUNCTION(BlueprintCallable, BlueprintPure)
bool IsScreenActionInputDisplayWidgetOpen() const;
protected:
UPROPERTY(BlueprintReadWrite, Category = "Gradient Picker Widget Binding", meta = (BindWidget))
@@ -173,32 +165,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 +193,17 @@ 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;
UPROPERTY(meta = (BindWidget))
UScreenActionInputDisplay* ScreenActionInputDisplay_Widget;
// Minigames UI
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, meta = (BindWidget))
@@ -237,8 +216,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:

View File

@@ -85,10 +85,5 @@ public:
// MATH
UFUNCTION(BlueprintPure, Category = "Eleri|Math")
static float NegateFloat(const float& Value) { return Value * -1.f; }
#if WITH_EDITOR
// Editor shit
UFUNCTION(BlueprintCallable, Category = "Eleri|Audit")
static void LogAssetsUsingCommonUI();
#endif
};

View File

@@ -208,49 +208,3 @@ void UMainBlueprintFunctionLibrary::ModifyExp(const UObject* WorldContext, const
StatForgeComponent->ApplyGameplayStatEffect(ExpIncreaseEffect, DataValueMap);
}
#if WITH_EDITOR
#include "AssetRegistry/AssetRegistryModule.h"
#include "AssetRegistry/IAssetRegistry.h"
#include "WidgetBlueprint.h"
void UMainBlueprintFunctionLibrary::LogAssetsUsingCommonUI()
{
IAssetRegistry& AssetRegistry = FModuleManager::LoadModuleChecked<FAssetRegistryModule>("AssetRegistry").Get();
TArray<FAssetData> WidgetBlueprintAssets;
AssetRegistry.GetAssetsByClass(UWidgetBlueprint::StaticClass()->GetClassPathName(), WidgetBlueprintAssets, /*bSearchSubClasses*/ true);
TArray<FString> MatchedPaths;
for (const FAssetData& AssetData : WidgetBlueprintAssets)
{
UWidgetBlueprint* WidgetBP = Cast<UWidgetBlueprint>(AssetData.GetAsset());
if (!WidgetBP || !WidgetBP->GeneratedClass)
{
continue;
}
bool bUsesCommonUI = false;
for (const UClass* Test = WidgetBP->GeneratedClass; Test; Test = Test->GetSuperClass())
{
if (Test->GetName().Contains(TEXT("Common")))
{
bUsesCommonUI = true;
break;
}
}
if (bUsesCommonUI)
{
MatchedPaths.Add(AssetData.GetObjectPathString());
}
}
UE_LOG(LogTemp, Log, TEXT("Found %d widget asset(s) referencing a CommonUI class in their inheritance chain:"), MatchedPaths.Num());
for (const FString& Path : MatchedPaths)
{
UE_LOG(LogTemp, Log, TEXT(" %s"), *Path);
}
}
#endif

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: