Slowly replacing Common UI
This commit is contained in:
@@ -28,7 +28,7 @@ AppliedDefaultGraphicsPerformance=Scalable
|
||||
[/Script/Engine.Engine]
|
||||
+ActiveGameNameRedirects=(OldGameName="TP_ThirdPersonBP",NewGameName="/Script/ProjectEleri")
|
||||
+ActiveGameNameRedirects=(OldGameName="/Script/TP_ThirdPersonBP",NewGameName="/Script/ProjectEleri")
|
||||
GameViewportClientClassName=/Script/CommonUI.CommonGameViewportClient
|
||||
GameViewportClientClassName=/Script/StevesUEHelpers.StevesGameViewportClientBase
|
||||
SmoothedFrameRateRange=(LowerBound=(Type=Inclusive,Value=0.000000),UpperBound=(Type=Exclusive,Value=200.000000))
|
||||
|
||||
[/Script/Engine.RendererSettings]
|
||||
@@ -419,3 +419,4 @@ pcg.GlobalDisableRefresh=True
|
||||
|
||||
[/Script/Engine.WorldPartitionSettings]
|
||||
bNewMapsEnableWorldPartition=True
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
BIN
Content/Editor/EWBP_FindCommonSHit.uasset
LFS
Normal file
BIN
Content/Editor/EWBP_FindCommonSHit.uasset
LFS
Normal file
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.
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.
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.
Binary file not shown.
Binary file not shown.
BIN
Content/UI/Styles/Text/DT_EleriTextStyles.uasset
LFS
Normal file
BIN
Content/UI/Styles/Text/DT_EleriTextStyles.uasset
LFS
Normal file
Binary file not shown.
Binary file not shown.
@@ -14,6 +14,7 @@
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
#include "BookOfAlchemyManager.h"
|
||||
#include "AlchemyManager.h"
|
||||
#include "TimerManager.h"
|
||||
#include "ProjectEleri/UI/CalendarScreen.h"
|
||||
#include "ProjectEleri/UI/InteractionWidget.h"
|
||||
#include "UI/AlchemyWidget.h"
|
||||
@@ -81,11 +82,11 @@ void AEleriPlayerController::Tick(float DeltaTime)
|
||||
i--;
|
||||
}
|
||||
}
|
||||
if (!InMenu && !bIsInteractionMenuVisible)
|
||||
if (!IsInMenu() && !bIsInteractionMenuVisible)
|
||||
{
|
||||
ToggleInteractionMenu(true);
|
||||
}
|
||||
else if (InMenu && bIsInteractionMenuVisible)
|
||||
else if (IsInMenu() && bIsInteractionMenuVisible)
|
||||
{
|
||||
ToggleInteractionMenu(false);
|
||||
}
|
||||
@@ -327,7 +328,7 @@ void AEleriPlayerController::ClientRestart_Implementation(APawn *NewPawn)
|
||||
|
||||
void AEleriPlayerController::OnMove(const FInputActionValue &Value)
|
||||
{
|
||||
if (InMenu)
|
||||
if (IsInMenu())
|
||||
return;
|
||||
|
||||
FVector2D AnalogueValue = Value.Get<FInputActionValue::Axis2D>();
|
||||
@@ -351,7 +352,7 @@ void AEleriPlayerController::OnMove(const FInputActionValue &Value)
|
||||
|
||||
void AEleriPlayerController::OnSprint(const FInputActionValue &Value)
|
||||
{
|
||||
if (InMenu || Watering)
|
||||
if (IsInMenu() || Watering)
|
||||
return;
|
||||
|
||||
ACharacter *Char = GetCharacter();
|
||||
@@ -380,7 +381,7 @@ void AEleriPlayerController::OnStopSprint(const FInputActionValue &Value)
|
||||
|
||||
void AEleriPlayerController::OnJump(const FInputActionValue &Value)
|
||||
{
|
||||
if (InMenu || Watering)
|
||||
if (IsInMenu() || Watering)
|
||||
return;
|
||||
|
||||
ACharacter *Char = GetCharacter();
|
||||
@@ -401,7 +402,7 @@ void AEleriPlayerController::OnStopJump(const FInputActionValue &Value)
|
||||
|
||||
void AEleriPlayerController::OnLook(const FInputActionValue &Value)
|
||||
{
|
||||
if (InMenu)
|
||||
if (IsInMenu())
|
||||
return;
|
||||
|
||||
FVector2D AnalogueValue = Value.Get<FInputActionValue::Axis2D>();
|
||||
@@ -415,7 +416,7 @@ void AEleriPlayerController::OnLook(const FInputActionValue &Value)
|
||||
|
||||
void AEleriPlayerController::OnLookEnable(const FInputActionValue &Value)
|
||||
{
|
||||
if (InMenu)
|
||||
if (IsInMenu())
|
||||
return;
|
||||
|
||||
AMyCharacter *Char = Cast<AMyCharacter>(GetCharacter());
|
||||
@@ -427,7 +428,7 @@ void AEleriPlayerController::OnLookEnable(const FInputActionValue &Value)
|
||||
|
||||
void AEleriPlayerController::OnLookDisable(const FInputActionValue &Value)
|
||||
{
|
||||
if (InMenu)
|
||||
if (IsInMenu())
|
||||
return;
|
||||
|
||||
AMyCharacter *Char = Cast<AMyCharacter>(GetCharacter());
|
||||
@@ -550,7 +551,7 @@ void AEleriPlayerController::OnStartObjectRemovalAction(const FInputActionValue
|
||||
return;
|
||||
}
|
||||
|
||||
if (InMenu || Paused)
|
||||
if (IsInMenu() || Paused)
|
||||
return;
|
||||
|
||||
MoveActorsComp->StartObjectRemoval(!MoveActorsComp->IsRemovingMode());
|
||||
@@ -789,7 +790,7 @@ void AEleriPlayerController::OnInteractionMenuDownAction(const FInputActionValue
|
||||
|
||||
void AEleriPlayerController::OnControllerUpAction(const FInputActionValue &Value)
|
||||
{
|
||||
if (InMenu)
|
||||
if (IsInMenu())
|
||||
{
|
||||
OnUiButtonPressed.Broadcast(UiInputType::UP);
|
||||
}
|
||||
@@ -797,7 +798,7 @@ void AEleriPlayerController::OnControllerUpAction(const FInputActionValue &Value
|
||||
|
||||
void AEleriPlayerController::OnControllerDownAction(const FInputActionValue &Value)
|
||||
{
|
||||
if (InMenu)
|
||||
if (IsInMenu())
|
||||
{
|
||||
OnUiButtonPressed.Broadcast(UiInputType::DOWN);
|
||||
}
|
||||
@@ -805,7 +806,7 @@ void AEleriPlayerController::OnControllerDownAction(const FInputActionValue &Val
|
||||
|
||||
void AEleriPlayerController::OnControllerLeftAction(const FInputActionValue &Value)
|
||||
{
|
||||
if (InMenu)
|
||||
if (IsInMenu())
|
||||
{
|
||||
OnUiButtonPressed.Broadcast(UiInputType::LEFT);
|
||||
}
|
||||
@@ -813,7 +814,7 @@ void AEleriPlayerController::OnControllerLeftAction(const FInputActionValue &Val
|
||||
|
||||
void AEleriPlayerController::OnControllerRightAction(const FInputActionValue &Value)
|
||||
{
|
||||
if (InMenu)
|
||||
if (IsInMenu())
|
||||
{
|
||||
OnUiButtonPressed.Broadcast(UiInputType::RIGHT);
|
||||
}
|
||||
@@ -821,34 +822,43 @@ void AEleriPlayerController::OnControllerRightAction(const FInputActionValue &Va
|
||||
|
||||
void AEleriPlayerController::OnControllerConfirmAction(const FInputActionValue &Value)
|
||||
{
|
||||
if (InMenu)
|
||||
if (MainGameUI->GetWidgetStack().IsEmpty())
|
||||
{
|
||||
OnUiButtonPressed.Broadcast(UiInputType::SELECT);
|
||||
return;
|
||||
}
|
||||
|
||||
MainGameUI->GetWidgetStack()[MainGameUI->GetWidgetStack().Num() - 1]->HandleUiInputAction(EEleriUIInputAction::Select);
|
||||
}
|
||||
|
||||
void AEleriPlayerController::OnControllerBackAction(const FInputActionValue &Value)
|
||||
{
|
||||
if (InMenu)
|
||||
OnUiButtonPressed.Broadcast(UiInputType::BACK);
|
||||
if (MainGameUI->GetWidgetStack().IsEmpty())
|
||||
{
|
||||
OnUiButtonPressed.Broadcast(UiInputType::BACK);
|
||||
return;
|
||||
}
|
||||
|
||||
MainGameUI->GetWidgetStack()[MainGameUI->GetWidgetStack().Num() - 1]->HandleUiInputAction(EEleriUIInputAction::Back);
|
||||
}
|
||||
|
||||
void AEleriPlayerController::OnControllerTabLeftAction(const FInputActionValue &Value)
|
||||
{
|
||||
if (InMenu)
|
||||
if (MainGameUI->GetWidgetStack().IsEmpty())
|
||||
{
|
||||
OnUiButtonPressed.Broadcast(UiInputType::TABLEFT);
|
||||
return;
|
||||
}
|
||||
|
||||
MainGameUI->GetWidgetStack()[MainGameUI->GetWidgetStack().Num() - 1]->HandleUiInputAction(EEleriUIInputAction::TabLeft);
|
||||
}
|
||||
|
||||
void AEleriPlayerController::OnControllerTabRightAction(const FInputActionValue &Value)
|
||||
{
|
||||
if (InMenu)
|
||||
if (MainGameUI->GetWidgetStack().IsEmpty())
|
||||
{
|
||||
OnUiButtonPressed.Broadcast(UiInputType::TABRIGHT);
|
||||
return;
|
||||
}
|
||||
|
||||
MainGameUI->GetWidgetStack()[MainGameUI->GetWidgetStack().Num() - 1]->HandleUiInputAction(EEleriUIInputAction::TabRight);
|
||||
}
|
||||
|
||||
// UI BIND
|
||||
@@ -870,39 +880,23 @@ void AEleriPlayerController::OnMainMenuToggle(const FInputActionValue &Value)
|
||||
|
||||
void AEleriPlayerController::OnInventoryToggle(const FInputActionValue &Value)
|
||||
{
|
||||
if (Paused || IsDialogueOpen() || !MoveActorsComp || MoveActorsComp->IsRemovingMode())
|
||||
if (Paused || (IsInMenu() && !MainGameUI->IsInventoryOpen()) || !MoveActorsComp || MoveActorsComp->IsRemovingMode())
|
||||
return;
|
||||
|
||||
if (!MainGameUI->IsInventoryOpen())
|
||||
{
|
||||
// Open inventory
|
||||
OpenInventory(false, false, nullptr, TArray<EInventoryTabType>());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Closing inventory
|
||||
CloseInventory();
|
||||
}
|
||||
OpenInventory(false, false, nullptr, TArray<EInventoryTabType>());
|
||||
}
|
||||
|
||||
void AEleriPlayerController::OnBookToggle(const FInputActionValue &Value)
|
||||
{
|
||||
if (Paused || IsDialogueOpen() || (InMenu && !MainGameUI->IsBookOpen()) || !MoveActorsComp || MoveActorsComp->IsRemovingMode())
|
||||
if (Paused || IsDialogueOpen() || (IsInMenu() && !MainGameUI->IsBookOpen()) || !MoveActorsComp || MoveActorsComp->IsRemovingMode())
|
||||
return;
|
||||
|
||||
if (!MainGameUI->IsBookOpen())
|
||||
{
|
||||
OpenBookOfAlchemy(nullptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
CloseBookOfAlchemy();
|
||||
}
|
||||
OpenBookOfAlchemy(nullptr);
|
||||
}
|
||||
|
||||
void AEleriPlayerController::OnOrdersToggle(const FInputActionValue &Value)
|
||||
{
|
||||
if (Paused || IsDialogueOpen() || InMenu || !MoveActorsComp || MoveActorsComp->IsRemovingMode())
|
||||
if (Paused || IsDialogueOpen() || IsInMenu() || !MoveActorsComp || MoveActorsComp->IsRemovingMode())
|
||||
return;
|
||||
|
||||
if (OrdersOpen)
|
||||
@@ -925,7 +919,7 @@ void AEleriPlayerController::OnOrdersToggle(const FInputActionValue &Value)
|
||||
|
||||
void AEleriPlayerController::OnCalendarToggle(const FInputActionValue &Value)
|
||||
{
|
||||
if (Paused || IsDialogueOpen() || (InMenu && !MainGameUI->IsBookOpen()) || !MoveActorsComp || MoveActorsComp->IsRemovingMode())
|
||||
if (Paused || IsDialogueOpen() || (IsInMenu() && !MainGameUI->IsBookOpen()) || !MoveActorsComp || MoveActorsComp->IsRemovingMode())
|
||||
return;
|
||||
|
||||
if (!MainGameUI->IsCalendarOpen())
|
||||
@@ -1017,31 +1011,16 @@ UUserWidget *AEleriPlayerController::OpenInventory(bool JustSelecting, bool Shop
|
||||
// If we pass something we're opening a shop/trade and the other inventory is the npc inventory
|
||||
UInventoryComponent *MainInv = PlayerInventory;
|
||||
UInventoryComponent *OtherInv = IsValid(Inventory) ? Inventory : nullptr;
|
||||
MainGameUI->ToggleInventoryWidget(true);
|
||||
MainGameUI->OpenWidget(MainGameUI->GetInventoryWidget());
|
||||
MainGameUI->GetInventoryWidget()->ToggleWidget(true);
|
||||
MainGameUI->GetInventoryWidget()->Setup(MainInv, OtherInv, Shop, JustSelecting, RestrictTabs, bSelectMultiple, bShowDescription, bShowPropertyMap);
|
||||
AddToMenuStack(MainGameUI->GetInventoryWidget());
|
||||
SetShowMouseCursor(true);
|
||||
SetInputMode(FInputModeGameAndUI());
|
||||
InMenu = true;
|
||||
|
||||
// Get the Enhanced Input Local Player Subsystem from the Local Player related to our Player Controller.
|
||||
if (UEnhancedInputLocalPlayerSubsystem *Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(GetLocalPlayer()))
|
||||
{
|
||||
// If for whatever reason...
|
||||
Subsystem->RemoveMappingContext(MainUiContext);
|
||||
// Add each mapping context, along with their priority values. Higher values outprioritize lower values.
|
||||
Subsystem->AddMappingContext(MainUiContext, 98);
|
||||
}
|
||||
|
||||
// SetPause(true);
|
||||
return MainGameUI->GetInventoryWidget();
|
||||
}
|
||||
|
||||
void AEleriPlayerController::CloseInventory()
|
||||
{
|
||||
MainGameUI->ToggleInventoryWidget(false);
|
||||
CloseGenericMenu(MainGameUI->GetInventoryWidget());
|
||||
MainGameUI->CloseWidget(MainGameUI->GetInventoryWidget());
|
||||
}
|
||||
|
||||
UUserWidget *AEleriPlayerController::OpenBookOfAlchemy(UItemDataAsset *ItemToPresent)
|
||||
@@ -1052,11 +1031,7 @@ UUserWidget *AEleriPlayerController::OpenBookOfAlchemy(UItemDataAsset *ItemToPre
|
||||
bBookAnimating = true;
|
||||
MainGameUI->GetBookWidget()->Setup(ItemToPresent, false);
|
||||
PlayerCharacter->ToggleBook(true);
|
||||
AddToMenuStack(MainGameUI->GetBookWidget());
|
||||
SetShowMouseCursor(true);
|
||||
SetInputMode(FInputModeGameAndUI());
|
||||
MainGameUI->ToggleBookWidget(true);
|
||||
InMenu = true;
|
||||
|
||||
MainGameUI->ToggleGameMenu(false);
|
||||
|
||||
@@ -1070,7 +1045,6 @@ UUserWidget *AEleriPlayerController::OpenBookOfAlchemy(UItemDataAsset *ItemToPre
|
||||
}
|
||||
|
||||
TickBookAnimating = true;
|
||||
SetPause(true);
|
||||
|
||||
return MainGameUI->GetBookWidget();
|
||||
}
|
||||
@@ -1081,14 +1055,13 @@ void AEleriPlayerController::CloseBookOfAlchemy()
|
||||
return;
|
||||
|
||||
bBookAnimating = true;
|
||||
MainGameUI->ToggleBookWidget(false);
|
||||
CloseGenericMenu(MainGameUI->GetBookWidget());
|
||||
|
||||
// for the animation of closing
|
||||
FTimerHandle TimerHandle;
|
||||
GetWorld()->GetTimerManager().SetTimer(TimerHandle, FTimerDelegate::CreateLambda([this]()
|
||||
{ MainGameUI->ToggleGameMenu(true); }),
|
||||
0.5f, false);
|
||||
{
|
||||
MainGameUI->ToggleGameMenu(true);
|
||||
}), 0.5f, false);
|
||||
|
||||
// Get the Enhanced Input Local Player Subsystem from the Local Player related to our Player Controller.
|
||||
if (UEnhancedInputLocalPlayerSubsystem *Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(GetLocalPlayer()))
|
||||
@@ -1172,8 +1145,6 @@ UEleriBaseWidget *AEleriPlayerController::ToggleAlchemyMenu(bool bOpen)
|
||||
|
||||
SetShowMouseCursor(bOpen);
|
||||
MainGameUI->ToggleAlchemyWidget(bOpen);
|
||||
InMenu = bOpen;
|
||||
// SetPause(bOpen);
|
||||
|
||||
return MainGameUI->GetAlchemyWidget();
|
||||
}
|
||||
@@ -1185,7 +1156,6 @@ UEleriBaseWidget *AEleriPlayerController::ToggleDialogueWindow(bool bOpen)
|
||||
|
||||
MainGameUI->ToggleDialogueWidget(bOpen);
|
||||
MainGameUI->GetDialogueWidget()->ToggleWidget(bOpen);
|
||||
InMenu = bOpen;
|
||||
|
||||
if (bOpen)
|
||||
{
|
||||
@@ -1207,7 +1177,6 @@ UEleriBaseWidget *AEleriPlayerController::ToggleNotificationWindow(bool bOpen)
|
||||
return nullptr;
|
||||
|
||||
MainGameUI->ToggleBigNotificationWidget(bOpen);
|
||||
InMenu = bOpen;
|
||||
|
||||
if (bOpen)
|
||||
{
|
||||
@@ -1307,7 +1276,7 @@ void AEleriPlayerController::RemoveFromMenuStack(UUserWidget *Widget)
|
||||
|
||||
bool AEleriPlayerController::OpenGenericMenu(UUserWidget *Widget, bool CloseOthers = false, bool IgnoreInMenu = false)
|
||||
{
|
||||
if (!IgnoreInMenu && InMenu)
|
||||
if (!IgnoreInMenu && IsInMenu())
|
||||
return false;
|
||||
|
||||
for (const UUserWidget *StackWidget : MenuStack)
|
||||
@@ -1315,9 +1284,7 @@ bool AEleriPlayerController::OpenGenericMenu(UUserWidget *Widget, bool CloseOthe
|
||||
if (StackWidget == Widget)
|
||||
return false;
|
||||
}
|
||||
|
||||
InMenu = true;
|
||||
|
||||
|
||||
if (CloseOthers)
|
||||
{
|
||||
for (UUserWidget *StackWidget : MenuStack)
|
||||
@@ -1344,12 +1311,6 @@ void AEleriPlayerController::CloseGenericMenu(UEleriBaseWidget *Widget)
|
||||
{
|
||||
SetShowMouseCursor(false);
|
||||
SetInputMode(FInputModeGameOnly());
|
||||
InMenu = false;
|
||||
// Get the Enhanced Input Local Player Subsystem from the Local Player related to our Player Controller.
|
||||
if (UEnhancedInputLocalPlayerSubsystem *Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(GetLocalPlayer()))
|
||||
{
|
||||
Subsystem->RemoveMappingContext(MainUiContext);
|
||||
}
|
||||
SetPause(false);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -3,11 +3,25 @@
|
||||
|
||||
#include "UI/EleriBaseWidget.h"
|
||||
|
||||
#include "EleriPlayerController.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
|
||||
void UEleriBaseWidget::ToggleWidget_Implementation(bool bActive) {
|
||||
if (bActive) {
|
||||
ActivateWidget();
|
||||
//ActivateWidget();
|
||||
}
|
||||
else {
|
||||
DeactivateWidget();
|
||||
//DeactivateWidget();
|
||||
}
|
||||
}
|
||||
|
||||
void UEleriBaseWidget::HandleUiInputAction_Implementation(EEleriUIInputAction InputAction)
|
||||
{
|
||||
if (InputAction == EEleriUIInputAction::Back)
|
||||
{
|
||||
if (AEleriPlayerController* EleriPlayerController = Cast<AEleriPlayerController>(UGameplayStatics::GetPlayerController(this, 0)))
|
||||
{
|
||||
EleriPlayerController->GetMainGameWidget()->CloseWidget(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,4 +2,65 @@
|
||||
|
||||
|
||||
#include "UI/EleriTextBlock.h"
|
||||
#include "UObject/ConstructorHelpers.h"
|
||||
|
||||
UEleriTextBlock::UEleriTextBlock(const FObjectInitializer& ObjectInitializer)
|
||||
: Super(ObjectInitializer)
|
||||
{
|
||||
static ConstructorHelpers::FObjectFinder<UDataTable> Finder(
|
||||
TEXT("/Game/UI/Styles/Text/DT_EleriTextStyles.DT_EleriTextStyles"));
|
||||
if (Finder.Succeeded())
|
||||
{
|
||||
StyleTable = Finder.Object;
|
||||
}
|
||||
}
|
||||
|
||||
void UEleriTextBlock::SynchronizeProperties()
|
||||
{
|
||||
Super::SynchronizeProperties();
|
||||
ApplyStyle();
|
||||
}
|
||||
|
||||
TArray<FString> UEleriTextBlock::GetStyleNames() const
|
||||
{
|
||||
TArray<FString> Names;
|
||||
if (StyleTable)
|
||||
{
|
||||
for (const auto& Pair : StyleTable->GetRowMap())
|
||||
{
|
||||
Names.Add(Pair.Key.ToString());
|
||||
}
|
||||
}
|
||||
return Names;
|
||||
}
|
||||
|
||||
void UEleriTextBlock::ApplyStyle()
|
||||
{
|
||||
if (!StyleTable)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static const FString Context(TEXT("EleriTextBlock Style Lookup"));
|
||||
if (const FEleriTextStyleRow* Row = StyleTable->FindRow<FEleriTextStyleRow>(StyleName, Context, /*bWarnIfMissing*/ false))
|
||||
{
|
||||
FSlateFontInfo FinalFont = Row->Font;
|
||||
if (FontSizeOverride != INDEX_NONE)
|
||||
{
|
||||
FinalFont.Size = FontSizeOverride;
|
||||
}
|
||||
SetFont(FinalFont);
|
||||
|
||||
const FLinearColor FinalColor = (ColorOverride.A > 0.f) ? ColorOverride : Row->Color;
|
||||
SetColorAndOpacity(FSlateColor(FinalColor));
|
||||
|
||||
SetShadowOffset(Row->ShadowOffset);
|
||||
SetShadowColorAndOpacity(Row->ShadowColor);
|
||||
SetLineHeightPercentage(Row->LineHeightPercentage);
|
||||
}
|
||||
else
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("EleriTextBlock '%s': style row '%s' not found in %s"),
|
||||
*GetName(), *StyleName.ToString(), *StyleTable->GetName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#include "UI/MainGameWidget.h"
|
||||
|
||||
#include "EleriPlayerController.h"
|
||||
#include "EnhancedInputSubsystems.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
#include "UI/InventoryWidget.h"
|
||||
#include "UI/MainMenuWidget.h"
|
||||
#include "UI/TradeWidget.h"
|
||||
@@ -16,14 +20,37 @@ void UMainGameWidget::SwitchKeybindsDisplay(int32 Index)
|
||||
KeybindsSwitcher->SetActiveWidgetIndex(Index);
|
||||
}
|
||||
|
||||
void UMainGameWidget::ToggleBookWidget(bool bActive)
|
||||
void UMainGameWidget::CloseLastWidget()
|
||||
{
|
||||
BookOpen = bActive;
|
||||
if (WidgetStack.IsEmpty()) return;
|
||||
|
||||
CloseWidget(WidgetStack[WidgetStack.Num() - 1]);
|
||||
}
|
||||
|
||||
void UMainGameWidget::ToggleInventoryWidget(bool bActive)
|
||||
void UMainGameWidget::OpenWidget(UEleriBaseWidget* Widget)
|
||||
{
|
||||
InventoryOpen = bActive;
|
||||
if (!Widget) return;
|
||||
|
||||
Widget->ToggleWidget(true);
|
||||
WidgetStack.AddUnique(Widget);
|
||||
CheckOpenWidgets();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
void UMainGameWidget::ToggleAlchemyWidget(bool bActive)
|
||||
@@ -77,15 +104,68 @@ void UMainGameWidget::CloseTradeWidget()
|
||||
{
|
||||
TradeOpen = false;
|
||||
Trade_Widget->ToggleWidget(false);
|
||||
CheckOpenWidgets();
|
||||
}
|
||||
|
||||
void UMainGameWidget::ToggleCalendarWidget(bool bActive)
|
||||
{
|
||||
CalendarOpen = bActive;
|
||||
Calendar_Widget->ToggleWidget(CalendarOpen);
|
||||
CheckOpenWidgets();
|
||||
}
|
||||
|
||||
void UMainGameWidget::ToggleBazarWidget(bool bActive) {
|
||||
BazarWidgetOpen = bActive;
|
||||
Bazar_Widget->ToggleWidget(BazarWidgetOpen);
|
||||
CheckOpenWidgets();
|
||||
}
|
||||
|
||||
void UMainGameWidget::CheckOpenWidgets()
|
||||
{
|
||||
if (!PlayerController)
|
||||
{
|
||||
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());
|
||||
}
|
||||
else
|
||||
{
|
||||
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 (const AEleriPlayerController* EleriPC = Cast<AEleriPlayerController>(PlayerController))
|
||||
{
|
||||
if (bAnyOpenWidgets)
|
||||
{
|
||||
if (!Subsystem->HasMappingContext(EleriPC->MainUiContext))
|
||||
{
|
||||
Subsystem->AddMappingContext(EleriPC->MainUiContext, 98);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Subsystem->HasMappingContext(EleriPC->MainUiContext))
|
||||
{
|
||||
Subsystem->RemoveMappingContext(EleriPC->MainUiContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public class ProjectEleri : ModuleRules
|
||||
"InteractionSystem"
|
||||
});
|
||||
|
||||
PrivateDependencyModuleNames.AddRange(new string[] { "OnlineSubsystem", "OnlineSubsystemUtils" });
|
||||
PrivateDependencyModuleNames.AddRange(new string[] { "OnlineSubsystem", "OnlineSubsystemUtils", "UMGEditor" });
|
||||
|
||||
// Uncomment if you are using Slate UI
|
||||
// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
|
||||
|
||||
@@ -125,9 +125,6 @@ public:
|
||||
UPROPERTY(BlueprintReadOnly)
|
||||
AMyCharacter* PlayerCharacter;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
bool InMenu;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
bool Paused;
|
||||
|
||||
@@ -269,7 +266,7 @@ public:
|
||||
UFUNCTION(BlueprintCallable)
|
||||
UMainGameWidget* GetMainGameWidget() { return MainGameUI; }
|
||||
|
||||
const inline bool IsInMenu() { return InMenu; }
|
||||
const inline bool IsInMenu() { return MainGameUI->AnyWidgetOpen(); }
|
||||
const inline bool IsSprinting() { return Sprinting; }
|
||||
const inline bool IsPaused() { return Paused; }
|
||||
const inline bool IsDialogueOpen() { return MainGameUI ? MainGameUI->IsDialogueOpen() : false; }
|
||||
|
||||
@@ -3,15 +3,24 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "CommonActivatableWidget.h"
|
||||
#include "Blueprint/UserWidget.h"
|
||||
|
||||
#include "EleriBaseWidget.generated.h"
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum class EEleriUIInputAction : uint8
|
||||
{
|
||||
Select,
|
||||
Back,
|
||||
TabLeft,
|
||||
TabRight
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class PROJECTELERI_API UEleriBaseWidget : public UCommonActivatableWidget
|
||||
class PROJECTELERI_API UEleriBaseWidget : public UUserWidget
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
@@ -20,10 +29,8 @@ public:
|
||||
UFUNCTION(BlueprintNativeEvent, BlueprintCallable)
|
||||
void ToggleWidget(bool bActive);
|
||||
virtual void ToggleWidget_Implementation(bool bActive);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Eleri Base Widget")
|
||||
void LockWidget() { bIsBackHandler = false; }
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Eleri Base Widget")
|
||||
void UnlockWidget() { bIsBackHandler = true; }
|
||||
|
||||
UFUNCTION(BlueprintNativeEvent, BlueprintCallable)
|
||||
void HandleUiInputAction(EEleriUIInputAction InputAction);
|
||||
virtual void HandleUiInputAction_Implementation(EEleriUIInputAction InputAction);
|
||||
};
|
||||
|
||||
@@ -4,10 +4,32 @@
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Components/TextBlock.h"
|
||||
#include "Engine/DataTable.h"
|
||||
#include "Math/Color.h"
|
||||
|
||||
#include "EleriTextBlock.generated.h"
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct FEleriTextStyleRow : public FTableRowBase
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Style")
|
||||
FSlateFontInfo Font;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Style")
|
||||
FLinearColor Color = FLinearColor::White;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Style")
|
||||
FVector2D ShadowOffset = FVector2D::ZeroVector;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Style")
|
||||
FLinearColor ShadowColor = FLinearColor(0.f, 0.f, 0.f, 0.f);
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Style")
|
||||
float LineHeightPercentage = 1.f;
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -17,10 +39,26 @@ class PROJECTELERI_API UEleriTextBlock : public UTextBlock
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UEleriTextBlock(const FObjectInitializer& ObjectInitializer);
|
||||
virtual void SynchronizeProperties() override;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
FLinearColor ColorOverride;
|
||||
FLinearColor ColorOverride =FLinearColor(0.f, 0.f, 0.f, 0.f);
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
int32 FontSizeOverride;
|
||||
int32 FontSizeOverride = INDEX_NONE;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Style", meta = (GetOptions = "GetStyleNames"))
|
||||
FName StyleName = "Normal";
|
||||
|
||||
protected:
|
||||
|
||||
UFUNCTION()
|
||||
TArray<FString> GetStyleNames() const;
|
||||
|
||||
private:
|
||||
UPROPERTY()
|
||||
TObjectPtr<UDataTable> StyleTable;
|
||||
|
||||
void ApplyStyle();
|
||||
};
|
||||
|
||||
@@ -51,6 +51,19 @@ public:
|
||||
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure)
|
||||
UInteractionWidget *GetInteractionWidget() { return WBP_InteractionWidget; }
|
||||
|
||||
void CloseLastWidget();
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Eleri|UI")
|
||||
void OpenWidget(UEleriBaseWidget* Widget);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Eleri|UI")
|
||||
void CloseWidget(UEleriBaseWidget* Widget);
|
||||
|
||||
UFUNCTION(BlueprintPure, Category = "Eleri|UI")
|
||||
bool AnyWidgetOpen() const { return !WidgetStack.IsEmpty(); }
|
||||
|
||||
TArray<UEleriBaseWidget*>& GetWidgetStack() { return WidgetStack; }
|
||||
|
||||
// Book widget
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure)
|
||||
@@ -58,15 +71,13 @@ public:
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void ToggleBookWidget(bool bActive);
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure)
|
||||
bool IsBookOpen() const { return BookOpen; }
|
||||
bool IsBookOpen() const { return WidgetStack.Contains(Book_Widget); }
|
||||
|
||||
// Inventory widget
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure)
|
||||
UInventoryWidget *GetInventoryWidget() { return Inventory_Widget; }
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void ToggleInventoryWidget(bool bActive);
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure)
|
||||
bool IsInventoryOpen() const { return InventoryOpen; }
|
||||
bool IsInventoryOpen() const { return WidgetStack.Contains(Inventory_Widget); }
|
||||
|
||||
// Alchemy widget
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure)
|
||||
@@ -228,4 +239,12 @@ protected:
|
||||
UMainMenuWidget *MainMenuScreenUI_Widget;
|
||||
UPROPERTY()
|
||||
bool MainMenuOpen = false;
|
||||
|
||||
UPROPERTY()
|
||||
APlayerController* PlayerController;
|
||||
|
||||
UPROPERTY()
|
||||
TArray<UEleriBaseWidget*> WidgetStack;
|
||||
|
||||
void CheckOpenWidgets();
|
||||
};
|
||||
|
||||
@@ -85,4 +85,10 @@ 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
|
||||
};
|
||||
|
||||
@@ -208,4 +208,49 @@ 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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user