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:
63
Assets/Scripts/UI/UIRoot.Demo.cs
Normal file
63
Assets/Scripts/UI/UIRoot.Demo.cs
Normal 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;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user