Sequence startup story before character selection
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "AgrarianCampfire.h"
|
||||
#include "AgrarianCraftingComponent.h"
|
||||
#include "AgrarianDebugHUD.h"
|
||||
#include "AgrarianDemoNoticeWidget.h"
|
||||
#include "AgrarianGameCharacter.h"
|
||||
#include "AgrarianInventoryComponent.h"
|
||||
#include "AgrarianItemPickup.h"
|
||||
@@ -102,22 +103,7 @@ void AAgrarianGamePlayerController::BeginPlay()
|
||||
|
||||
if (IsLocalPlayerController())
|
||||
{
|
||||
if (MvpFrontendStartupDelaySeconds > 0.0f)
|
||||
{
|
||||
SetMvpFrontendPresentationActive(true);
|
||||
SetInputMode(FInputModeUIOnly());
|
||||
bShowMouseCursor = false;
|
||||
GetWorldTimerManager().SetTimer(
|
||||
MvpFrontendStartupTimerHandle,
|
||||
this,
|
||||
&AAgrarianGamePlayerController::ShowMvpFrontend,
|
||||
MvpFrontendStartupDelaySeconds,
|
||||
false);
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowMvpFrontend();
|
||||
}
|
||||
StartStartupPresentation();
|
||||
}
|
||||
|
||||
// only spawn touch controls on local player controllers
|
||||
@@ -214,6 +200,80 @@ void AAgrarianGamePlayerController::ShowMvpFrontend()
|
||||
bShowMouseCursor = true;
|
||||
}
|
||||
|
||||
void AAgrarianGamePlayerController::StartStartupPresentation()
|
||||
{
|
||||
if (!IsLocalPlayerController())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SetMvpFrontendPresentationActive(true);
|
||||
|
||||
if (!StartupPresentationWidget)
|
||||
{
|
||||
StartupPresentationWidget = CreateWidget<UAgrarianDemoNoticeWidget>(this, UAgrarianDemoNoticeWidget::StaticClass());
|
||||
}
|
||||
|
||||
if (StartupPresentationWidget && !StartupPresentationWidget->IsInViewport())
|
||||
{
|
||||
StartupPresentationWidget->AddToPlayerScreen(100);
|
||||
}
|
||||
|
||||
ShowStartupPresentationSegment(EAgrarianStartupPresentationSegment::Splash, StartupSplashSeconds);
|
||||
}
|
||||
|
||||
void AAgrarianGamePlayerController::ShowStartupPresentationSegment(EAgrarianStartupPresentationSegment Segment, float DurationSeconds)
|
||||
{
|
||||
StartupPresentationSegment = Segment;
|
||||
if (StartupPresentationWidget)
|
||||
{
|
||||
StartupPresentationWidget->SetPresentationSegment(Segment);
|
||||
SetInputMode(FInputModeUIOnly().SetWidgetToFocus(StartupPresentationWidget->TakeWidget()).SetLockMouseToViewportBehavior(EMouseLockMode::DoNotLock));
|
||||
}
|
||||
else
|
||||
{
|
||||
SetInputMode(FInputModeUIOnly());
|
||||
}
|
||||
|
||||
bShowMouseCursor = false;
|
||||
GetWorldTimerManager().ClearTimer(StartupPresentationTimerHandle);
|
||||
GetWorldTimerManager().SetTimer(
|
||||
StartupPresentationTimerHandle,
|
||||
this,
|
||||
&AAgrarianGamePlayerController::AdvanceStartupPresentation,
|
||||
FMath::Max(0.1f, DurationSeconds),
|
||||
false);
|
||||
}
|
||||
|
||||
void AAgrarianGamePlayerController::AdvanceStartupPresentation()
|
||||
{
|
||||
if (StartupPresentationSegment == EAgrarianStartupPresentationSegment::Splash)
|
||||
{
|
||||
ShowStartupPresentationSegment(EAgrarianStartupPresentationSegment::Story, StartupStorySeconds);
|
||||
return;
|
||||
}
|
||||
|
||||
if (StartupPresentationSegment == EAgrarianStartupPresentationSegment::Story)
|
||||
{
|
||||
ShowStartupPresentationSegment(EAgrarianStartupPresentationSegment::Credits, StartupCreditsSeconds);
|
||||
return;
|
||||
}
|
||||
|
||||
FinishStartupPresentation();
|
||||
}
|
||||
|
||||
void AAgrarianGamePlayerController::FinishStartupPresentation()
|
||||
{
|
||||
GetWorldTimerManager().ClearTimer(StartupPresentationTimerHandle);
|
||||
if (StartupPresentationWidget)
|
||||
{
|
||||
StartupPresentationWidget->RemoveFromParent();
|
||||
StartupPresentationWidget = nullptr;
|
||||
}
|
||||
|
||||
ShowMvpFrontend();
|
||||
}
|
||||
|
||||
void AAgrarianGamePlayerController::ShowMvpPauseMenu()
|
||||
{
|
||||
if (!IsLocalPlayerController())
|
||||
@@ -789,10 +849,26 @@ void AAgrarianGamePlayerController::AgrarianCompleteFrontend()
|
||||
void AAgrarianGamePlayerController::AgrarianRepairGameplayInput()
|
||||
{
|
||||
bMvpFrontendPresentationActive = false;
|
||||
GetWorldTimerManager().ClearTimer(StartupPresentationTimerHandle);
|
||||
if (StartupPresentationWidget)
|
||||
{
|
||||
StartupPresentationWidget->RemoveFromParent();
|
||||
StartupPresentationWidget = nullptr;
|
||||
}
|
||||
RestoreGameplayControlState();
|
||||
ClientMessage(TEXT("Agrarian gameplay input repaired."));
|
||||
}
|
||||
|
||||
void AAgrarianGamePlayerController::AgrarianSkipStartupPresentation()
|
||||
{
|
||||
if (!StartupPresentationWidget)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AdvanceStartupPresentation();
|
||||
}
|
||||
|
||||
void AAgrarianGamePlayerController::AgrarianShowMvpScreen(FName ScreenName)
|
||||
{
|
||||
if (!MvpFrontendWidget)
|
||||
|
||||
Reference in New Issue
Block a user