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

@ -201,7 +201,7 @@ namespace GrassCutter
if (perk < 0 || perk >= (int)PerkId.Count) return;
var def = GameDefs.Perk((PerkId)perk);
int lvl = Level(def.id);
if (lvl >= def.maxLevel || !PerkAvailable(def) || Money.Value < def.PriceFor(lvl)) { DeniedRpc(RpcTarget.Single(rpc.Receive.SenderClientId, RpcTargetUse.Temp)); return; }
if (lvl >= def.maxLevel || !PerkAvailable(def) || Money.Value < def.PriceFor(lvl) || Demo.Over) { DeniedRpc(RpcTarget.Single(rpc.Receive.SenderClientId, RpcTargetUse.Temp)); return; }
Money.Value -= def.PriceFor(lvl);
Perks[perk] = (byte)(lvl + 1);
PurchasedRpc(PlayerName(rpc.Receive.SenderClientId), def.maxLevel > 1 ? Loc.Key(def.nameEn, GameDefs.ToRoman(lvl + 1)) : Loc.Key(def.nameEn));
@ -209,7 +209,11 @@ namespace GrassCutter
}
[Rpc(SendTo.SpecifiedInParams)]
public void DeniedRpc(RpcParams p = default) { Sfx.Play("error"); }
public void DeniedRpc(RpcParams p = default)
{
Sfx.Play("error");
if (Demo.Over) Hud.Toast(Loc.T("That's the end of the demo: the full game has the rest of the planet."), Hud.ToastKind.Warn);
}
[Rpc(SendTo.Everyone)]
void PurchasedRpc(FixedString64Bytes who, FixedString64Bytes what) => Purchased?.Invoke(who.ToString(), what.ToString());
@ -235,7 +239,7 @@ namespace GrassCutter
if (!who || tool >= GameDefs.ToolCount) return;
var d = GameDefs.Tool((ToolId)tool);
double price = ToolPrice(d);
if (who.Owns((ToolId)tool) || Money.Value < price) { DeniedRpc(RpcTarget.Single(rpc.Receive.SenderClientId, RpcTargetUse.Temp)); return; }
if (who.Owns((ToolId)tool) || Money.Value < price || Demo.Over) { DeniedRpc(RpcTarget.Single(rpc.Receive.SenderClientId, RpcTargetUse.Temp)); return; }
Money.Value -= price;
who.Owned.Value |= (ushort)(1 << tool);
SaveCrew(who);
@ -247,7 +251,7 @@ namespace GrassCutter
var who = PlayerOf(rpc.Receive.SenderClientId);
if (!who) return;
long price = GameDefs.BeltSlotPrice(who.BeltSlots.Value);
if (who.BeltSlots.Value >= GameDefs.MaxBeltSlots || Money.Value < price) { DeniedRpc(RpcTarget.Single(rpc.Receive.SenderClientId, RpcTargetUse.Temp)); return; }
if (who.BeltSlots.Value >= GameDefs.MaxBeltSlots || Money.Value < price || Demo.Over) { DeniedRpc(RpcTarget.Single(rpc.Receive.SenderClientId, RpcTargetUse.Temp)); return; }
Money.Value -= price;
who.BeltSlots.Value++;
SaveCrew(who);
@ -259,7 +263,7 @@ namespace GrassCutter
var who = PlayerOf(rpc.Receive.SenderClientId);
if (!who || gear < (byte)GearId.Jetpack || gear > (byte)GearId.NightVision) return;
long price = GameDefs.GearPrice((GearId)gear);
if (who.HasGear((GearId)gear) || Money.Value < price) { DeniedRpc(RpcTarget.Single(rpc.Receive.SenderClientId, RpcTargetUse.Temp)); return; }
if (who.HasGear((GearId)gear) || Money.Value < price || Demo.Over) { DeniedRpc(RpcTarget.Single(rpc.Receive.SenderClientId, RpcTargetUse.Temp)); return; }
Money.Value -= price;
who.Owned.Value |= (ushort)(1 << gear);
SaveCrew(who);