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

@ -63,18 +63,27 @@ namespace GrassCutter.EditorTools
// GC_BUILD_DIR builds somewhere else, so a copy of the game that is running doesn't lock the build
// a development build also reports GPU and render-thread frame times (FrameTimingManager), for -demoperf
PlayerSettings.enableFrameTimingStats = CommandLineHas("-devbuild");
var dir = Environment.GetEnvironmentVariable("GC_BUILD_DIR") is string d && d.Length > 0 ? d : "Builds/GrassCutter";
// GC_DEMO=1 builds the demo: its own app, name (so its own saves and settings) and folder
bool demo = Environment.GetEnvironmentVariable("GC_DEMO") == "1" || CommandLineHas("-demo");
var dir = Environment.GetEnvironmentVariable("GC_BUILD_DIR") is string d && d.Length > 0 ? d : demo ? "Builds/GrassCutterDemo" : "Builds/GrassCutter";
var opts = new BuildPlayerOptions
{
scenes = new[] { ScenePath },
locationPathName = dir + "/GrassCutter.exe",
locationPathName = dir + "/" + (demo ? "GrassCutterDemo.exe" : "GrassCutter.exe"),
target = BuildTarget.StandaloneWindows64,
options = CommandLineHas("-devbuild") ? BuildOptions.Development : BuildOptions.None,
extraScriptingDefines = demo ? new[] { "GC_DEMO" } : null,
};
var report = BuildPipeline.BuildPlayer(opts);
string name = PlayerSettings.productName;
if (demo) PlayerSettings.productName = "Grass Cutters Together Demo";
UnityEditor.Build.Reporting.BuildReport report;
try { report = BuildPipeline.BuildPlayer(opts); }
finally { PlayerSettings.productName = name; }
if (report.summary.result != UnityEditor.Build.Reporting.BuildResult.Succeeded)
throw new Exception("Build failed: " + report.summary.result);
File.Copy("steam_appid.txt", dir + "/steam_appid.txt", true);
// only for our own runs: never upload it to Steam (with it the game skips the Steam ownership check)
if (demo) File.WriteAllText(dir + "/steam_appid.txt", "5668050");
else File.Copy("steam_appid.txt", dir + "/steam_appid.txt", true);
Debug.Log($"[Builder] Player built: {report.summary.totalSize / (1024 * 1024)} MB");
}

View File

@ -997,3 +997,13 @@ The view rocks a little with each step. Off keeps it still. Die Sicht wippt bei
STEAM PAGE STEAM-SEITE
FEEDBACK FEEDBACK
Grass Cutters Together needs Steam. Start Steam, sign in to the account that owns the game, and launch it from your library. Grass Cutters Together braucht Steam. Starte Steam, melde dich mit dem Konto an, dem das Spiel gehört, und starte es aus deiner Bibliothek.
That's the end of the demo: the full game has the rest of the planet. Hier endet die Demo: Den Rest des Planeten gibt es im vollen Spiel.
DEMO DEMO
WISHLIST THE FULL GAME VOLLES SPIEL AUF DIE WUNSCHLISTE
DEMO COMPLETE · thanks for playing! DEMO GESCHAFFT · danke fürs Spielen!
DEMO · goal: ship {0} of {1} kg of grass DEMO · Ziel: {0} von {1} kg Gras abliefern
THANKS FOR PLAYING THE DEMO! DANKE FÜRS SPIELEN DER DEMO!
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. Deine Crew hat {0} kg Gras abgeliefert und das Ende der Demo erreicht. Im vollen Spiel gehört dir der ganze Planet: Maschinen, Förderbänder, Roboter, ferne Stationen und bis zu 16 Spieler.
You can keep mowing here, but nothing more is for sale in the demo. Du kannst hier weitermähen, aber in der Demo gibt es nichts mehr zu kaufen.
LEAVE FEEDBACK FEEDBACK GEBEN
KEEP MOWING WEITERMÄHEN

View File

@ -997,3 +997,13 @@ The view rocks a little with each step. Off keeps it still. La vista se mece un
STEAM PAGE PÁGINA DE STEAM
FEEDBACK OPINIONES
Grass Cutters Together needs Steam. Start Steam, sign in to the account that owns the game, and launch it from your library. Grass Cutters Together necesita Steam. Abre Steam, inicia sesión con la cuenta que tiene el juego y ejecútalo desde tu biblioteca.
That's the end of the demo: the full game has the rest of the planet. Aquí termina la demo: el resto del planeta te espera en el juego completo.
DEMO DEMO
WISHLIST THE FULL GAME AÑADIR EL JUEGO A LA LISTA DE DESEADOS
DEMO COMPLETE · thanks for playing! DEMO COMPLETADA · ¡gracias por jugar!
DEMO · goal: ship {0} of {1} kg of grass DEMO · objetivo: entregar {0} de {1} kg de hierba
THANKS FOR PLAYING THE DEMO! ¡GRACIAS POR JUGAR LA DEMO!
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. Tu equipo ha entregado {0} kg de hierba y ha llegado al final de la demo. En el juego completo todo el planeta es tuyo: máquinas, cintas, robots, estaciones lejanas y hasta 16 jugadores.
You can keep mowing here, but nothing more is for sale in the demo. Puedes seguir segando aquí, pero en la demo ya no hay nada más a la venta.
LEAVE FEEDBACK DAR MI OPINIÓN
KEEP MOWING SEGUIR SEGANDO

View File

@ -997,3 +997,13 @@ The view rocks a little with each step. Off keeps it still. La vue oscille un pe
STEAM PAGE PAGE STEAM
FEEDBACK VOS AVIS
Grass Cutters Together needs Steam. Start Steam, sign in to the account that owns the game, and launch it from your library. Grass Cutters Together a besoin de Steam. Lancez Steam, connectez-vous au compte qui possède le jeu et lancez-le depuis votre bibliothèque.
That's the end of the demo: the full game has the rest of the planet. La démo s'arrête ici : le reste de la planète vous attend dans le jeu complet.
DEMO DÉMO
WISHLIST THE FULL GAME AJOUTER LE JEU À MA LISTE DE SOUHAITS
DEMO COMPLETE · thanks for playing! DÉMO TERMINÉE · merci d'avoir joué !
DEMO · goal: ship {0} of {1} kg of grass DÉMO · objectif : livrer {0} kg d'herbe sur {1}
THANKS FOR PLAYING THE DEMO! MERCI D'AVOIR JOUÉ À LA DÉMO !
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. Votre équipe a livré {0} kg d'herbe et atteint la fin de la démo. Dans le jeu complet, toute la planète est à vous : machines, convoyeurs, robots, stations lointaines et jusqu'à 16 joueurs.
You can keep mowing here, but nothing more is for sale in the demo. Vous pouvez continuer à tondre ici, mais plus rien n'est en vente dans la démo.
LEAVE FEEDBACK DONNER MON AVIS
KEEP MOWING CONTINUER À TONDRE

View File

@ -997,3 +997,13 @@ The view rocks a little with each step. Off keeps it still. La visuale oscilla u
STEAM PAGE PAGINA STEAM
FEEDBACK FEEDBACK
Grass Cutters Together needs Steam. Start Steam, sign in to the account that owns the game, and launch it from your library. Grass Cutters Together richiede Steam. Avvia Steam, accedi con l'account che possiede il gioco e avvialo dalla tua libreria.
That's the end of the demo: the full game has the rest of the planet. La demo finisce qui: il resto del pianeta è nel gioco completo.
DEMO DEMO
WISHLIST THE FULL GAME AGGIUNGI IL GIOCO ALLA LISTA DEI DESIDERI
DEMO COMPLETE · thanks for playing! DEMO COMPLETATA · grazie per aver giocato!
DEMO · goal: ship {0} of {1} kg of grass DEMO · obiettivo: consegna {0} di {1} kg d'erba
THANKS FOR PLAYING THE DEMO! GRAZIE PER AVER GIOCATO LA DEMO!
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. La tua squadra ha consegnato {0} kg d'erba e ha raggiunto la fine della demo. Nel gioco completo tutto il pianeta è tuo: macchine, nastri, robot, stazioni lontane e fino a 16 giocatori.
You can keep mowing here, but nothing more is for sale in the demo. Puoi continuare a falciare qui, ma nella demo non c'è più niente in vendita.
LEAVE FEEDBACK LASCIA UN FEEDBACK
KEEP MOWING CONTINUA A FALCIARE

View File

@ -997,3 +997,13 @@ The view rocks a little with each step. Off keeps it still. 歩くたびに視
STEAM PAGE STEAMページ
FEEDBACK フィードバック
Grass Cutters Together needs Steam. Start Steam, sign in to the account that owns the game, and launch it from your library. Grass Cutters Together には Steam が必要です。Steam を起動し、ゲームを所有するアカウントでサインインして、ライブラリから起動してください。
That's the end of the demo: the full game has the rest of the planet. 体験版はここまで:惑星の残りは製品版で待っています。
DEMO 体験版
WISHLIST THE FULL GAME 製品版をウィッシュリストに追加
DEMO COMPLETE · thanks for playing! 体験版クリア · プレイありがとう!
DEMO · goal: ship {0} of {1} kg of grass 体験版 · 目標:草を {1} kg 中 {0} kg 納品
THANKS FOR PLAYING THE DEMO! 体験版をプレイしてくれてありがとう!
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. クルーは草を {0} kg 納品し、体験版の最後に到達しました。製品版では惑星全体があなたのもの:マシン、ベルト、ロボット、遠方のステーション、最大16人のプレイヤー。
You can keep mowing here, but nothing more is for sale in the demo. ここで草刈りを続けられますが、体験版ではこれ以上何も買えません。
LEAVE FEEDBACK フィードバックを送る
KEEP MOWING 草刈りを続ける

View File

@ -997,3 +997,13 @@ The view rocks a little with each step. Off keeps it still. 걸을 때마다 시
STEAM PAGE STEAM 페이지
FEEDBACK 피드백
Grass Cutters Together needs Steam. Start Steam, sign in to the account that owns the game, and launch it from your library. Grass Cutters Together는 Steam이 필요합니다. Steam을 실행하고 게임을 보유한 계정으로 로그인한 뒤 라이브러리에서 실행하세요.
That's the end of the demo: the full game has the rest of the planet. 데모는 여기까지입니다: 행성의 나머지는 정식 버전에서 기다립니다.
DEMO 데모
WISHLIST THE FULL GAME 정식 버전을 찜 목록에 추가
DEMO COMPLETE · thanks for playing! 데모 완료 · 플레이해 주셔서 감사합니다!
DEMO · goal: ship {0} of {1} kg of grass 데모 · 목표: 풀 {1} kg 중 {0} kg 납품
THANKS FOR PLAYING THE DEMO! 데모를 플레이해 주셔서 감사합니다!
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. 크루가 풀 {0} kg을 납품하고 데모의 끝에 도달했습니다. 정식 버전에서는 행성 전체가 여러분의 것입니다: 기계, 컨베이어, 로봇, 먼 정거장, 최대 16명의 플레이어.
You can keep mowing here, but nothing more is for sale in the demo. 여기서 계속 풀을 벨 수 있지만, 데모에서는 더 이상 살 수 있는 것이 없습니다.
LEAVE FEEDBACK 피드백 남기기
KEEP MOWING 계속 풀 베기

View File

@ -997,3 +997,13 @@ The view rocks a little with each step. Off keeps it still. Widok lekko się ko
STEAM PAGE STRONA STEAM
FEEDBACK OPINIE
Grass Cutters Together needs Steam. Start Steam, sign in to the account that owns the game, and launch it from your library. Grass Cutters Together wymaga Steam. Uruchom Steam, zaloguj się na konto, które ma grę, i uruchom ją z biblioteki.
That's the end of the demo: the full game has the rest of the planet. Tu demo się kończy: reszta planety czeka w pełnej grze.
DEMO DEMO
WISHLIST THE FULL GAME DODAJ GRĘ DO LISTY ŻYCZEŃ
DEMO COMPLETE · thanks for playing! DEMO UKOŃCZONE · dzięki za grę!
DEMO · goal: ship {0} of {1} kg of grass DEMO · cel: dostarcz {0} z {1} kg trawy
THANKS FOR PLAYING THE DEMO! DZIĘKUJEMY ZA ZAGRANIE W DEMO!
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. Twoja ekipa dostarczyła {0} kg trawy i dotarła do końca demo. W pełnej grze cała planeta jest twoja: maszyny, taśmociągi, roboty, dalekie stacje i do 16 graczy.
You can keep mowing here, but nothing more is for sale in the demo. Możesz dalej kosić, ale w demo nic więcej nie jest na sprzedaż.
LEAVE FEEDBACK WYŚLIJ OPINIĘ
KEEP MOWING KOŚ DALEJ

View File

@ -997,3 +997,13 @@ The view rocks a little with each step. Off keeps it still. A visão balança um
STEAM PAGE PÁGINA NA STEAM
FEEDBACK FEEDBACK
Grass Cutters Together needs Steam. Start Steam, sign in to the account that owns the game, and launch it from your library. Grass Cutters Together precisa da Steam. Abra a Steam, entre na conta que possui o jogo e inicie-o pela sua biblioteca.
That's the end of the demo: the full game has the rest of the planet. A demo termina aqui: o resto do planeta está no jogo completo.
DEMO DEMO
WISHLIST THE FULL GAME ADICIONAR O JOGO À LISTA DE DESEJOS
DEMO COMPLETE · thanks for playing! DEMO CONCLUÍDA · obrigado por jogar!
DEMO · goal: ship {0} of {1} kg of grass DEMO · meta: entregar {0} de {1} kg de grama
THANKS FOR PLAYING THE DEMO! OBRIGADO POR JOGAR A DEMO!
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. Sua equipe entregou {0} kg de grama e chegou ao fim da demo. No jogo completo o planeta inteiro é seu: máquinas, esteiras, robôs, estações distantes e até 16 jogadores.
You can keep mowing here, but nothing more is for sale in the demo. Você pode continuar cortando aqui, mas nada mais está à venda na demo.
LEAVE FEEDBACK DAR FEEDBACK
KEEP MOWING CONTINUAR CORTANDO

View File

@ -997,3 +997,13 @@ The view rocks a little with each step. Off keeps it still. Вид слегка
STEAM PAGE СТРАНИЦА В STEAM
FEEDBACK ОТЗЫВ
Grass Cutters Together needs Steam. Start Steam, sign in to the account that owns the game, and launch it from your library. Для Grass Cutters Together нужен Steam. Запустите Steam, войдите в аккаунт, на котором куплена игра, и запустите её из библиотеки.
That's the end of the demo: the full game has the rest of the planet. Демо на этом заканчивается: остальная планета ждёт в полной игре.
DEMO ДЕМО
WISHLIST THE FULL GAME В ЖЕЛАЕМОЕ: ПОЛНАЯ ИГРА
DEMO COMPLETE · thanks for playing! ДЕМО ПРОЙДЕНО · спасибо за игру!
DEMO · goal: ship {0} of {1} kg of grass ДЕМО · цель: сдать {0} из {1} кг травы
THANKS FOR PLAYING THE DEMO! СПАСИБО, ЧТО СЫГРАЛИ В ДЕМО!
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. Ваша команда сдала {0} кг травы и дошла до конца демо. В полной игре вся планета ваша: машины, конвейеры, роботы, дальние станции и до 16 игроков.
You can keep mowing here, but nothing more is for sale in the demo. Косить здесь можно и дальше, но больше ничего в демо не продаётся.
LEAVE FEEDBACK ОСТАВИТЬ ОТЗЫВ
KEEP MOWING КОСИТЬ ДАЛЬШЕ

View File

@ -997,3 +997,13 @@ The view rocks a little with each step. Off keeps it still. Her adımda görüş
STEAM PAGE STEAM SAYFASI
FEEDBACK GERİ BİLDİRİM
Grass Cutters Together needs Steam. Start Steam, sign in to the account that owns the game, and launch it from your library. Grass Cutters Together için Steam gerekir. Steam'i açın, oyuna sahip hesapla giriş yapın ve oyunu kütüphanenizden başlatın.
That's the end of the demo: the full game has the rest of the planet. Demo burada bitiyor: gezegenin geri kalanı tam oyunda.
DEMO DEMO
WISHLIST THE FULL GAME TAM OYUNU İSTEK LİSTESİNE EKLE
DEMO COMPLETE · thanks for playing! DEMO TAMAMLANDI · oynadığın için teşekkürler!
DEMO · goal: ship {0} of {1} kg of grass DEMO · hedef: {1} kg çimin {0} kg'ını teslim et
THANKS FOR PLAYING THE DEMO! DEMOYU OYNADIĞIN İÇİN TEŞEKKÜRLER!
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. Ekibin {0} kg çim teslim etti ve demonun sonuna ulaştı. Tam oyunda bütün gezegen senin: makineler, bantlar, robotlar, uzak istasyonlar ve 16 oyuncuya kadar.
You can keep mowing here, but nothing more is for sale in the demo. Burada biçmeye devam edebilirsin ama demoda satılık başka bir şey yok.
LEAVE FEEDBACK GERİ BİLDİRİM VER
KEEP MOWING BİÇMEYE DEVAM

View File

@ -997,3 +997,13 @@ The view rocks a little with each step. Off keeps it still. 走路时视角会
STEAM PAGE STEAM 商店页
FEEDBACK 反馈
Grass Cutters Together needs Steam. Start Steam, sign in to the account that owns the game, and launch it from your library. Grass Cutters Together 需要 Steam。请启动 Steam,登录拥有本游戏的账户,然后从库中启动游戏。
That's the end of the demo: the full game has the rest of the planet. 试玩版到此结束:星球的其余部分在完整版中等着你。
DEMO 试玩版
WISHLIST THE FULL GAME 将完整版加入愿望单
DEMO COMPLETE · thanks for playing! 试玩完成 · 感谢游玩!
DEMO · goal: ship {0} of {1} kg of grass 试玩版 · 目标:交付 {0} / {1} 千克草
THANKS FOR PLAYING THE DEMO! 感谢游玩试玩版!
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. 你的团队交付了 {0} 千克草,已到达试玩版的终点。完整版中整个星球都属于你:机器、传送带、机器人、远方站点,最多 16 名玩家。
You can keep mowing here, but nothing more is for sale in the demo. 你可以继续在这里割草,但试玩版中不再出售任何东西。
LEAVE FEEDBACK 提交反馈
KEEP MOWING 继续割草

View File

@ -97,7 +97,7 @@ namespace GrassCutter
s_next = Time.time + Every;
var ts = TeamState.Instance;
var me = PlayerAgent.Local;
if (!ts || !me) return;
if (!ts || !me || Demo.On) return;
Read();
foreach (var a in All)
{

View File

@ -0,0 +1,25 @@
namespace GrassCutter
{
/// <summary>
/// The demo build (built with GC_DEMO): its own Steam app, its own saves (another product name, so another data
/// folder and other settings), no achievements, and an end once the crew has shipped <see cref="GoalKg"/>: a thank-you
/// screen with the wishlist and feedback links, and nothing more for sale after it.
/// </summary>
public static class Demo
{
#if GC_DEMO
public const bool On = true;
#else
public const bool On = false;
#endif
/// <summary>The full game: what the wishlist and feedback links go to.</summary>
public const uint FullAppId = 5551720;
public const uint DemoAppId = 5668050;
/// <summary>About half an hour for a first-time player: the paced opening ships 178 kg in 30 minutes knowing exactly what to do.</summary>
public const double GoalKg = 150;
public static double Shipped => TeamState.Instance ? TeamState.Instance.Shipped.Value : 0d;
/// <summary>The crew has reached the end of the demo.</summary>
public static bool Over => On && Shipped >= GoalKg;
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: cd1209cf5dfb99e44a1aace34f8042f6

View File

@ -0,0 +1,44 @@
using System.Collections;
using UnityEngine;
namespace GrassCutter
{
public partial class DemoBot
{
/// <summary>
/// -demoend (in a GC_DEMO build): the menu with its wishlist button, the goal on screen, the thank-you screen once
/// the goal is shipped, and a purchase refused after it.
/// </summary>
IEnumerator DemoEndDemo()
{
Log($"demo build: {Demo.On}, app {SteamManager.AppId}, version {NetSession.Version}, data {Application.persistentDataPath}");
BotCapture.From = null;
yield return new WaitForSeconds(3f);
yield return Shot("demo_0_menu");
TeamState.DeleteSave();
NetSession.Instance.HostLocal();
while (!Me || !Ts) yield return null;
yield return new WaitForSeconds(3f);
Ts.ServerSetMoney(1000d);
yield return new WaitForSeconds(0.5f);
yield return Shot("demo_1_goal");
Ts.BuyToolRpc((byte)ToolId.Scythe);
yield return new WaitForSeconds(1f);
Log($"before the goal: scythe bought {(Me.Owns(ToolId.Scythe) ? "yes" : "NO")}, over {Demo.Over}");
Ts.Shipped.Value = Demo.GoalKg + 3;
yield return new WaitForSeconds(2f);
Log($"at the goal: over {Demo.Over}");
yield return Shot("demo_2_end");
UIRoot.I.CloseTopModal();
yield return new WaitForSeconds(0.5f);
double cash = Ts.Money.Value;
Ts.BuyToolRpc((byte)ToolId.LongScythe);
Ts.BuyBeltSlotRpc();
yield return new WaitForSeconds(1f);
Log($"after the goal: long scythe {(Me.Owns(ToolId.LongScythe) ? "BOUGHT" : "refused")}, money {cash:0} -> {Ts.Money.Value:0}");
yield return Shot("demo_3_refused");
Log("demoend done");
Application.Quit();
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 1716542de5bb2ed4a8baec5130a35e0e

View File

@ -3078,6 +3078,11 @@ namespace GrassCutter
yield return gameObject.AddComponent<Trailer>().Shoot(folder);
yield break;
}
if (CommandLine.Has("-demoend"))
{
yield return DemoEndDemo();
yield break;
}
if (CommandLine.Has("-demoyt"))
{
yield return TubeDemo();

View File

@ -58,7 +58,7 @@ namespace GrassCutter
var ts = TeamState.Instance;
if (!ts || Upgrades == UpgradeKind.None || Tier.Value >= GameDefs.MaxTier) return;
double price = GameDefs.UpgradePrice(this, Tier.Value);
if (ts.Money.Value < price) { ts.DeniedRpc(RpcTarget.Single(rpc.Receive.SenderClientId, RpcTargetUse.Temp)); return; }
if (ts.Money.Value < price || Demo.Over) { ts.DeniedRpc(RpcTarget.Single(rpc.Receive.SenderClientId, RpcTargetUse.Temp)); return; }
ts.Money.Value -= price;
Tier.Value++;
UpgradedRpc();

View File

@ -16,7 +16,7 @@ namespace GrassCutter
bool belt = d.id == PieceId.Belt;
double price = belt ? GameDefs.BeltPrice(Vector3.Distance(at, to)) : d.price;
bool fits = belt ? BuildRules.CanRun(at, to, out _) : BuildRules.CanPlace(d, at, rot, null, out _);
if (d.company || !who || !who.Owns(ToolId.Hammer) || Money.Value < price || !fits) { DeniedRpc(sender); return; }
if (d.company || !who || !who.Owns(ToolId.Hammer) || Money.Value < price || Demo.Over || !fits) { DeniedRpc(sender); return; }
Money.Value -= price;
ServerSpawnPiece(d.id, at, belt ? BuildRules.RunRotation(at, to) : rot, to);
Save();

View File

@ -92,7 +92,7 @@ namespace GrassCutter
var who = PlayerOf(rpc.Receive.SenderClientId);
if (!who || !who.ClaimedSave || kind >= (byte)VehicleKind.Count) return;
var d = GameDefs.Vehicle((VehicleKind)kind);
if (Money.Value < d.price || Vehicle.Mine(d.kind, who.SaveId)) { DeniedRpc(sender); return; }
if (Money.Value < d.price || Demo.Over || Vehicle.Mine(d.kind, who.SaveId)) { DeniedRpc(sender); return; }
Money.Value -= d.price;
var shed = ShedFor(garage);
Vector3 at;
@ -131,7 +131,7 @@ namespace GrassCutter
int level = v.Level(t);
if (level >= GameDefs.Tune(t).prices.Length) { DeniedRpc(sender); return; }
double price = GameDefs.TunePrice(v.kind, t, level);
if (Money.Value < price) { DeniedRpc(sender); return; }
if (Money.Value < price || Demo.Over) { DeniedRpc(sender); return; }
Money.Value -= price;
v.Tuned[tune] = (byte)(level + 1);
Save();

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);

View File

@ -22,7 +22,7 @@ namespace GrassCutter
public class NetSession : MonoBehaviour
{
public const string GameKey = "grasscutter";
public const string Version = "0.1";
public const string Version = Demo.On ? "0.1-demo" : "0.1";
public const int MaxPlayers = 16;
const ushort LocalPort = 7777;

View File

@ -8,7 +8,7 @@ namespace GrassCutter
[DefaultExecutionOrder(-1000)]
public class SteamManager : MonoBehaviour
{
public const uint AppId = 5551720;
public const uint AppId = Demo.On ? Demo.DemoAppId : Demo.FullAppId;
public static SteamManager Instance { get; private set; }
public static bool Initialized { get; private set; }
@ -106,15 +106,16 @@ namespace GrassCutter
if (Initialized) SteamAPI.RunCallbacks();
}
public static string StoreUrl => $"https://store.steampowered.com/app/{AppId}/";
public static string FeedbackUrl => $"https://steamcommunity.com/app/{AppId}/discussions/";
// always the full game: the demo has no hub of its own, and its wishlist button is for the game
public static string StoreUrl => $"https://store.steampowered.com/app/{Demo.FullAppId}/";
public static string FeedbackUrl => $"https://steamcommunity.com/app/{Demo.FullAppId}/discussions/";
/// <summary>The game's store page (wishlist, follow, review): in the Steam overlay, else the browser.</summary>
public static void OpenStore()
{
try
{
if (Initialized && SteamUtils.IsOverlayEnabled()) { SteamFriends.ActivateGameOverlayToStore(new AppId_t(AppId), EOverlayToStoreFlag.k_EOverlayToStoreFlag_None); return; }
if (Initialized && SteamUtils.IsOverlayEnabled()) { SteamFriends.ActivateGameOverlayToStore(new AppId_t(Demo.FullAppId), EOverlayToStoreFlag.k_EOverlayToStoreFlag_None); return; }
}
catch (Exception) { }
Application.OpenURL(StoreUrl);

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);