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:
@ -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)
|
||||
{
|
||||
|
||||
25
Assets/Scripts/Core/Demo.cs
Normal file
25
Assets/Scripts/Core/Demo.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Core/Demo.cs.meta
Normal file
2
Assets/Scripts/Core/Demo.cs.meta
Normal file
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cd1209cf5dfb99e44a1aace34f8042f6
|
||||
44
Assets/Scripts/Core/DemoBot.DemoEnd.cs
Normal file
44
Assets/Scripts/Core/DemoBot.DemoEnd.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Core/DemoBot.DemoEnd.cs.meta
Normal file
2
Assets/Scripts/Core/DemoBot.DemoEnd.cs.meta
Normal file
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1716542de5bb2ed4a8baec5130a35e0e
|
||||
@ -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();
|
||||
|
||||
Reference in New Issue
Block a user