Demo build: 150 kg goal, end screen, separate AppId and store assets

GC_DEMO define (ProjectBuilder GC_DEMO=1 / -demo) builds GrassCutterDemo.exe
for app 5668050 with its own product name, version 0.1-demo and no
achievements. Purchases lock after shipping 150 kg; a goal label and a
thanks/wishlist card follow. Menu gets a DEMO badge and wishlist button.
Store texts (12 languages) and DEMO-badged capsules for the demo page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
NiemandKG
2026-11-20 19:07:43 +06:00
parent ad2154b38c
commit ae558b8e77
66 changed files with 917 additions and 83 deletions

View File

@ -0,0 +1,63 @@
using UnityEngine;
using UnityEngine.UIElements;
namespace GrassCutter
{
/// <summary>The demo's goal on screen while it's being played for, and the thank-you screen when it's reached.</summary>
public partial class UIRoot
{
Label _demoGoal;
bool _demoEndSeen;
void TickDemo()
{
if (!Demo.On) return;
if (_demoGoal == null)
{
_demoGoal = UIK.Text("", "t-small t-outline", _hud, false);
_demoGoal.pickingMode = PickingMode.Ignore;
_demoGoal.style.position = Position.Absolute;
_demoGoal.style.top = 76;
_demoGoal.style.left = 0;
_demoGoal.style.right = 0;
_demoGoal.style.unityTextAlign = TextAnchor.MiddleCenter;
}
bool show = _inGame && TeamState.Instance;
_demoGoal.style.display = show ? DisplayStyle.Flex : DisplayStyle.None;
if (!show) { _demoEndSeen = false; return; }
_demoGoal.text = Demo.Over
? Loc.T("DEMO COMPLETE · thanks for playing!")
: Loc.F("DEMO · goal: ship {0} of {1} kg of grass", Loc.Num(Mathf.Floor((float)Demo.Shipped), "0"), Loc.Num((float)Demo.GoalKg, "0"));
if (Demo.Over && !_demoEndSeen && !AnyModal && !Phone.Focused)
{
_demoEndSeen = true;
OpenDemoEnd();
}
}
/// <summary>The end of the demo: thanks, the wishlist and feedback, and the choice to stay on this planet or go.</summary>
internal void OpenDemoEnd()
{
Sfx.Play("milestone", 0.8f);
OpenModal(layer =>
{
var card = UIK.El("card", layer);
card.pickingMode = PickingMode.Position;
card.style.width = 760;
card.style.alignItems = Align.Stretch;
UIK.Text(Loc.T("THANKS FOR PLAYING THE DEMO!"), "t-h1 t-dark t-center", card);
var body = UIK.Text(Loc.F("Your crew shipped {0} kg of grass and reached the end of the demo. In the full game the whole planet is yours: machines, belts, robots, far stations and up to 16 players.", Loc.Num((float)Demo.Shipped, "0")), "t-body t-dark t-center", card, false);
body.style.whiteSpace = WhiteSpace.Normal;
body.style.marginBottom = 10;
var note = UIK.Text(Loc.T("You can keep mowing here, but nothing more is for sale in the demo."), "t-small t-muted t-center", card, false);
note.style.whiteSpace = WhiteSpace.Normal;
note.style.marginBottom = 16;
UIK.Btn(Loc.T("WISHLIST THE FULL GAME"), () => SteamManager.OpenStore(), "btn btn-green", card);
UIK.Btn(Loc.T("LEAVE FEEDBACK"), () => SteamManager.OpenWeb(SteamManager.FeedbackUrl), "btn btn-blue", card);
UIK.Btn(Loc.T("KEEP MOWING"), () => CloseModal(layer), "btn btn-white", card);
UIK.Btn(Loc.T("LEAVE TO MENU"), () => { CloseModal(layer); NetSession.Instance.Leave(); }, "btn btn-red", card);
return card;
});
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 9197efad190236e4ca5f8a292e7c1428

View File

@ -120,6 +120,7 @@ namespace GrassCutter
Ctl.UIOpen = _modalStack.Count > 0 || !_inGame;
if (_inGame) Ctl.SetCursor(!AnyModal && !Phone.Focused && !SteamManager.OverlayActive);
Hud?.Tick(_inGame && !AnyModal);
TickDemo();
Hud?.SetTabList(_inGame && !AnyModal && Ctl.TabHeld);
_spinAngle += Time.unscaledDeltaTime * 360f;
var sp = _connecting?.Q(className: "spinner");
@ -152,6 +153,17 @@ namespace GrassCutter
UIK.Btn(Loc.T("SETTINGS"), OpenSettings, "btn btn-white btn-wide", side),
UIK.Btn(Loc.T("QUIT"), Quit, "btn btn-red btn-wide", side),
};
if (Demo.On)
{
// the demo says so under the logo, and the wishlist sits with the big buttons
var badge = UIK.Text(Loc.T("DEMO"), "menu-tagline t-outline", _menu);
badge.style.top = Length.Percent(63);
badge.style.fontSize = 44;
badge.style.color = new Color(1f, 0.83f, 0.25f);
var wish = UIK.Btn(Loc.T("WISHLIST THE FULL GAME"), () => SteamManager.OpenStore(), "btn btn-green btn-wide", side);
wish.PlaceBehind(buttons[buttons.Count - 1]);
buttons.Insert(buttons.Count - 1, wish);
}
var hint = UIK.Text(Loc.T(SteamManager.Initialized ? Loc.N("PLAY alone, on your LAN, or in a Steam lobby: invite friends with Shift+Tab.") : Loc.N("Steam not running: play alone or on your LAN.")), "t-small t-outline", side, false);
hint.style.marginTop = 14;
// the language in a click (Chinese above all), the store page and where to tell us what's wrong
@ -161,7 +173,7 @@ namespace GrassCutter
links.style.marginTop = 18;
var langBtn = UIK.Btn(Loc.T("Language") + ": " + Loc.Current.native, OpenLanguages, "btn btn-white btn-small", links);
SetLangFont(langBtn, Loc.Current);
UIK.Btn(Loc.T("STEAM PAGE"), () => SteamManager.OpenStore(), "btn btn-blue btn-small", links).style.marginLeft = 10;
if (!Demo.On) UIK.Btn(Loc.T("STEAM PAGE"), () => SteamManager.OpenStore(), "btn btn-blue btn-small", links).style.marginLeft = 10;
UIK.Btn(Loc.T("FEEDBACK"), () => SteamManager.OpenWeb(SteamManager.FeedbackUrl), "btn btn-green btn-small", links).style.marginLeft = 10;
var footer = UIK.El("menu-footer", _menu);