Add MVP loading screen

This commit is contained in:
2026-05-18 21:04:25 -07:00
parent 2009295c18
commit e8d46c8238
5 changed files with 118 additions and 2 deletions
+1 -1
View File
@@ -797,7 +797,7 @@ Target deliverable: A small group can join a server, spawn into one biome, gathe
- [x] After splash/startup screens, land on an MVP character selection landing page. The local player controller now opens the MVP frontend on `CharacterSelection`, and the native frontend widget paints a scalable character-selection landing page before gameplay.
- [x] Let players choose a realistic young adult male or female character with average proportions for the MVP. Added a selectable MVP character archetype enum, visible selected state, keyboard selection, and `AgrarianSelectCharacter male|female` dev command while keeping both choices on the same MVP survival baseline until real character art arrives.
- [x] Add join server screen. Added a native `JoinServer` frontend screen showing the selected character and `play.agrariangame.com:7777`, with keyboard flow from character selection and a dev command to display the screen directly.
- [ ] Add loading screen.
- [x] Add loading screen. Added a native `Loading` frontend screen with Ground Zero preparation copy, selected character/server context, a deterministic placeholder progress bar, and join-screen keyboard flow into loading.
- [~] Add HUD.
- [ ] Add inventory UI.
- [ ] Add crafting UI.
+52
View File
@@ -0,0 +1,52 @@
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
FILES = {
"AgrarianMvpFrontendWidget.h": ROOT / "Source" / "AgrarianGame" / "AgrarianMvpFrontendWidget.h",
"AgrarianMvpFrontendWidget.cpp": ROOT / "Source" / "AgrarianGame" / "AgrarianMvpFrontendWidget.cpp",
"AgrarianGamePlayerController.cpp": ROOT / "Source" / "AgrarianGame" / "AgrarianGamePlayerController.cpp",
"AGRARIAN_DEVELOPMENT_ROADMAP.md": ROOT / "AGRARIAN_DEVELOPMENT_ROADMAP.md",
}
EXPECTED = {
"AgrarianMvpFrontendWidget.h": [
"Loading",
"DrawLoading",
],
"AgrarianMvpFrontendWidget.cpp": [
"EAgrarianMvpFrontendScreen::Loading",
"SetActiveScreen(EAgrarianMvpFrontendScreen::Loading)",
"Preparing Ground Zero",
"Loading terrain, weather, survival state, and server session data.",
"MVP loading placeholder",
"BarSize.X * 0.62f",
],
"AgrarianGamePlayerController.cpp": [
"MVP frontend screen: loading.",
"Usage: AgrarianShowMvpScreen main|character|join|loading",
],
"AGRARIAN_DEVELOPMENT_ROADMAP.md": [
"[x] Add loading screen.",
"`Loading`",
"Ground Zero preparation",
],
}
def main():
missing = []
for label, path in FILES.items():
text = path.read_text(encoding="utf-8")
for snippet in EXPECTED[label]:
if snippet not in text:
missing.append(f"{label}: {snippet}")
if missing:
raise RuntimeError("MVP loading screen verification failed: " + "; ".join(missing))
print("Agrarian MVP loading screen verification complete.")
if __name__ == "__main__":
main()
@@ -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(