Add MVP loading screen
This commit is contained in:
@@ -334,7 +334,14 @@ void AAgrarianGamePlayerController::AgrarianShowMvpScreen(FName ScreenName)
|
||||
return;
|
||||
}
|
||||
|
||||
ClientMessage(TEXT("Usage: AgrarianShowMvpScreen main|character|join"));
|
||||
if (ScreenName == TEXT("loading") || ScreenName == TEXT("Loading"))
|
||||
{
|
||||
MvpFrontendWidget->SetActiveScreen(EAgrarianMvpFrontendScreen::Loading);
|
||||
ClientMessage(TEXT("MVP frontend screen: loading."));
|
||||
return;
|
||||
}
|
||||
|
||||
ClientMessage(TEXT("Usage: AgrarianShowMvpScreen main|character|join|loading"));
|
||||
}
|
||||
|
||||
void AAgrarianGamePlayerController::AgrarianTravel(float X, float Y, float Z)
|
||||
|
||||
@@ -39,6 +39,12 @@ FReply UAgrarianMvpFrontendWidget::NativeOnKeyDown(const FGeometry& InGeometry,
|
||||
else if (ActiveScreen == EAgrarianMvpFrontendScreen::JoinServer)
|
||||
{
|
||||
const FKey Key = InKeyEvent.GetKey();
|
||||
if (Key == EKeys::Enter || Key == EKeys::SpaceBar)
|
||||
{
|
||||
SetActiveScreen(EAgrarianMvpFrontendScreen::Loading);
|
||||
return FReply::Handled();
|
||||
}
|
||||
|
||||
if (Key == EKeys::BackSpace || Key == EKeys::Escape)
|
||||
{
|
||||
SetActiveScreen(EAgrarianMvpFrontendScreen::CharacterSelection);
|
||||
@@ -118,6 +124,10 @@ int32 UAgrarianMvpFrontendWidget::NativePaint(
|
||||
{
|
||||
DrawJoinServer(OutDrawElements, LayerId, AllottedGeometry, PanelPosition, PanelSize, Scale);
|
||||
}
|
||||
else if (ActiveScreen == EAgrarianMvpFrontendScreen::Loading)
|
||||
{
|
||||
DrawLoading(OutDrawElements, LayerId, AllottedGeometry, PanelPosition, PanelSize, Scale);
|
||||
}
|
||||
|
||||
return LayerId;
|
||||
}
|
||||
@@ -271,6 +281,45 @@ void UAgrarianMvpFrontendWidget::DrawJoinServer(
|
||||
DrawTextAt(OutDrawElements, LayerId, AllottedGeometry, FText::FromString(TEXT("Press Backspace or Escape to return to character selection.")), FVector2D(ContentX, PanelPosition.Y + PanelSize.Y - (46.0f * Scale)), ContentWidth, HintFont, FLinearColor(0.62f, 0.68f, 0.58f, 1.0f));
|
||||
}
|
||||
|
||||
void UAgrarianMvpFrontendWidget::DrawLoading(
|
||||
FSlateWindowElementList& OutDrawElements,
|
||||
int32& LayerId,
|
||||
const FGeometry& AllottedGeometry,
|
||||
const FVector2D& PanelPosition,
|
||||
const FVector2D& PanelSize,
|
||||
float Scale) const
|
||||
{
|
||||
const float ContentX = PanelPosition.X + (48.0f * Scale);
|
||||
const float ContentWidth = PanelSize.X - (96.0f * Scale);
|
||||
const FSlateFontInfo TitleFont = FCoreStyle::GetDefaultFontStyle("Bold", FMath::RoundToInt(34.0f * Scale));
|
||||
const FSlateFontInfo BodyFont = FCoreStyle::GetDefaultFontStyle("Regular", FMath::RoundToInt(18.0f * Scale));
|
||||
const FSlateFontInfo HintFont = FCoreStyle::GetDefaultFontStyle("Regular", FMath::RoundToInt(15.0f * Scale));
|
||||
|
||||
DrawTextAt(OutDrawElements, LayerId, AllottedGeometry, FText::FromString(TEXT("Preparing Ground Zero")), FVector2D(ContentX, PanelPosition.Y + (58.0f * Scale)), ContentWidth, TitleFont, FLinearColor(0.92f, 0.98f, 0.84f, 1.0f));
|
||||
DrawTextAt(OutDrawElements, LayerId, AllottedGeometry, FText::FromString(TEXT("Loading terrain, weather, survival state, and server session data.")), FVector2D(ContentX + (2.0f * Scale), PanelPosition.Y + (108.0f * Scale)), ContentWidth, BodyFont, FLinearColor(0.72f, 0.80f, 0.68f, 1.0f));
|
||||
|
||||
const FVector2D BarPosition(ContentX, PanelPosition.Y + (214.0f * Scale));
|
||||
const FVector2D BarSize(ContentWidth, 18.0f * Scale);
|
||||
FSlateDrawElement::MakeBox(
|
||||
OutDrawElements,
|
||||
++LayerId,
|
||||
AllottedGeometry.ToPaintGeometry(FVector2f(BarSize), FSlateLayoutTransform(FVector2f(BarPosition))),
|
||||
FCoreStyle::Get().GetBrush(TEXT("WhiteBrush")),
|
||||
ESlateDrawEffect::None,
|
||||
FLinearColor(0.065f, 0.075f, 0.06f, 1.0f));
|
||||
|
||||
FSlateDrawElement::MakeBox(
|
||||
OutDrawElements,
|
||||
++LayerId,
|
||||
AllottedGeometry.ToPaintGeometry(FVector2f(BarSize.X * 0.62f, BarSize.Y), FSlateLayoutTransform(FVector2f(BarPosition))),
|
||||
FCoreStyle::Get().GetBrush(TEXT("WhiteBrush")),
|
||||
ESlateDrawEffect::None,
|
||||
FLinearColor(0.45f, 0.72f, 0.40f, 1.0f));
|
||||
|
||||
DrawTextAt(OutDrawElements, LayerId, AllottedGeometry, FText::Format(FText::FromString(TEXT("Character: {0} | Server: {1}")), GetSelectedCharacterLabel(), JoinServerAddress), FVector2D(ContentX, PanelPosition.Y + (270.0f * Scale)), ContentWidth, BodyFont, FLinearColor(0.78f, 0.84f, 0.72f, 1.0f));
|
||||
DrawTextAt(OutDrawElements, LayerId, AllottedGeometry, FText::FromString(TEXT("MVP loading placeholder; final connection and map handoff will attach here.")), FVector2D(ContentX, PanelPosition.Y + PanelSize.Y - (46.0f * Scale)), ContentWidth, HintFont, FLinearColor(0.62f, 0.68f, 0.58f, 1.0f));
|
||||
}
|
||||
|
||||
FText UAgrarianMvpFrontendWidget::GetSelectedCharacterLabel() const
|
||||
{
|
||||
return SelectedCharacterArchetype == EAgrarianMvpCharacterArchetype::YoungAdultFemale
|
||||
|
||||
@@ -94,6 +94,14 @@ private:
|
||||
const FVector2D& PanelSize,
|
||||
float Scale) const;
|
||||
|
||||
void DrawLoading(
|
||||
FSlateWindowElementList& OutDrawElements,
|
||||
int32& LayerId,
|
||||
const FGeometry& AllottedGeometry,
|
||||
const FVector2D& PanelPosition,
|
||||
const FVector2D& PanelSize,
|
||||
float Scale) const;
|
||||
|
||||
FText GetSelectedCharacterLabel() const;
|
||||
|
||||
void DrawTextAt(
|
||||
|
||||
Reference in New Issue
Block a user