gs2-studio-dsl 2026.11.16 → 2026.11.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LLM.md CHANGED
@@ -41,9 +41,9 @@ To start a new `<dsl>`, run `"<GS2 Studio>" dsl init --dir <project> --out <dsl>
41
41
  `tsconfig.json`, a starter `index.ts`, `surfaces/`, these documents under `docs/`, and an `AGENTS.md` that lists the
42
42
  commands below with the executable's path; the first build writes the ledger. It refuses when one of its files exists.
43
43
 
44
- 1. Put every dependency in the project first: install it in GS2 Studio ("Add dependency", under any package of the
45
- project), or, for a package you author too, build it into the project with `dsl build`. The DSL cannot install
46
- packages.
44
+ 1. Put every dependency in the project first: add it with `"<GS2 Studio>" package add --dir <project> ...`
45
+ (`"<GS2 Studio>" package search` finds it and prints the arguments), or, for a package you author too, build it into
46
+ the project with `dsl build`. The DSL cannot install packages.
47
47
  2. If the package depends on other packages, write their surfaces (one file per package of the project):
48
48
  `"<GS2 Studio>" dsl surfaces --dir <project> --out <dsl>/surfaces`
49
49
  3. Write or edit `<dsl>/index.ts`. When the package depends on other packages, declare the dependencies first and build
@@ -98,6 +98,10 @@ MUST:
98
98
  Start while a quest is in progress (`alreadyExists`). A player with no quest in progress, including one who never
99
99
  started any, still has that row, with `inProgress` `false`, so this check passes once the `ProgressHandler` has loaded.
100
100
  See [Rows in the game](REFERENCE.md#rows-in-the-game).
101
+ - Show the time left until a timestamp (a stamina's next recovery) with a `UiItem.countdown`, or the one a dependency
102
+ lists in `types.<Type>.uiComponents` (`foundation-economy-energy`'s `NextRecoveryCountdown`), never with a hand-written
103
+ timer: it counts on the session's GS2 clock, which `DateTime.UtcNow` is not. See
104
+ [UI components](REFERENCE.md#ui-components).
101
105
  - Place an `activeToggle` such as `ProgressIdleActiveToggle` on a GameObject that stays active below the type's
102
106
  Handler, with what it shows or hides as its targets, never on a GameObject it hides: once hidden it stops listening
103
107
  and never shows it again. See [UI components](REFERENCE.md#ui-components).
@@ -251,7 +255,7 @@ Names and ids:
251
255
  | A method that runs a GS2 action | `delegatedActions: { Method: { targetActionKey, targetResource } }` on the type, or `definePackage({ delegatedActions: [{ target, methodName, action: { targetActionKey, targetResource } }] })` | [Delegated actions](REFERENCE.md#delegated-actions) |
252
256
  | Generated UI | `defineUiComponent(T, { items: [UiItem.label(...), UiItem.buttonAction(...)] })`, `UiSource.*`, `UiCond.*` | [UI components](REFERENCE.md#ui-components) |
253
257
  | Enable a button by another type's row (stamina, coins) | `UiItem.interactable("StartInteractable", UiCond.gte(UiSource.rowProp(energy.type("Energy"), "stamina", "currentValue"), UiSource.prop("cost")))` | [Another type's row](REFERENCE.md#another-types-row) |
254
- | Choose a UI item and its options | `label` shows text, `templateLabel` text around values, `value` sends a typed value the game formats; a button never disables itself (add `interactable`). `{ name, description }` only label the item in GS2 Studio's editor; leave them out | [UI components](REFERENCE.md#ui-components), [Item options](REFERENCE.md#item-options) |
258
+ | Choose a UI item and its options | `label` shows text, `templateLabel` text around values, `countdown` the time left until a timestamp, `value` sends a typed value the game formats; a button never disables itself (add `interactable`). `{ name, description }` only label the item in GS2 Studio's editor; leave them out | [UI components](REFERENCE.md#ui-components), [Item options](REFERENCE.md#item-options) |
255
259
  | Show every row in the game, in order | A UI component describes one row; the generated `<T>ListHandler` makes one instance of a prefab per row, in the order of `sort` (an overlay: the dependency's order unless it sets a `sort` other than id ascending) | [Rows in the game](REFERENCE.md#rows-in-the-game) |
256
260
  | A button on a dependency's delegated action | `UiItem.buttonAction("ReceiveButton", "Receive", args, options)` (first check `types.<T>.uiComponents`, keyed by class name without the `<T>` prefix: a package may already ship the button); `args` takes only the names under `types.<T>.delegatedActions.Receive.parameters` of the surface and needs each `required: true` one; with none required it may be `undefined` | [Dependencies](REFERENCE.md#dependencies) |
257
261
  | Code template | `codeTemplates: [{ outputFileName: "File.cs", templateSource: text }]` with a `?raw` import | [Code templates](REFERENCE.md#code-templates) |
@@ -482,10 +486,9 @@ The game signs in to GS2 with a client ID and a client secret. Take them from th
482
486
  - In Unity, they go into a `Gs2Environment` asset (Create > Game Server Services > Core > Environment) with `region`,
483
487
  `clientId`, `clientSecret` and `name`. `Gs2ClientHolder` lists the asset under Environments, and its Active
484
488
  Environment Name must equal the asset's `name` field, not its file name.
485
- - The GS2 Studio executable runs only `dsl` commands, so ask the user for the values: in GS2 Studio, they sign in to
486
- GS2 and choose the destination on Publish, then press "Copy settings" under "Gs2Environment settings" on the Usage
487
- tab of a table in Simple mode (Region, Client ID, Client Secret). Until GS2 Studio has read the values, it copies
488
- `YOUR_CLIENT_ID` and `YOUR_CLIENT_SECRET`; never put those into the game.
489
- - In a checkout of the GS2 Studio repository, its development CLI (`npx vite-node cli/gs2studio.ts`) reads them:
490
- `deploy outputs --stack Default --project <project> --region <region>`. It signs in with the developer's account only
491
- to read them; only the two output values go into the game.
489
+ - `"<GS2 Studio>" deploy unity-environment --unity-project <unity>` writes them into
490
+ `Assets/GS2Studio/Gs2Environment.asset` (environment name `GS2Studio`) without printing them; pass `--project` and
491
+ `--region`. It signs in with the developer's account only to read them, with the sign-in the user saved by running
492
+ `"<GS2 Studio>" login` in their own terminal (your shell cannot answer its password prompt: ask the user to run it);
493
+ only the two output values go into the game. `deploy outputs --stack Default` prints them; do not run it where the
494
+ terminal is recorded or shared.
package/README.md CHANGED
@@ -9,11 +9,11 @@ type-check; use these declarations in your editor and with `tsc --noEmit`.
9
9
  - For LLM coding agents: [LLM.md](LLM.md)
10
10
 
11
11
  ```sh
12
- npm install --save-dev gs2-studio-dsl@2026.11.16
12
+ npm install --save-dev gs2-studio-dsl@2026.11.17
13
13
  ```
14
14
 
15
15
  The version is the GS2 Studio version whose DSL these declarations describe: a DSL written
16
- against gs2-studio-dsl 2026.11.16 builds with GS2 Studio 2026.11.16 and later. Install the version that
16
+ against gs2-studio-dsl 2026.11.17 builds with GS2 Studio 2026.11.17 and later. Install the version that
17
17
  matches the oldest GS2 Studio you build with.
18
18
 
19
19
  ```ts
@@ -73,9 +73,12 @@ The GS2 Studio executable runs the `dsl` commands headless and exits with their
73
73
  "<GS2 Studio>" dsl build --dir <project> --entry <dsl/index.ts> --write-ledger
74
74
  ```
75
75
 
76
- `<GS2 Studio>` is `/Applications/GS2 Studio.app/Contents/MacOS/GS2 Studio` on macOS and the
77
- `GS2-Studio-<version>-linux-<arch>.AppImage` file on Linux. On Windows the executable does not write to the console, so the commands cannot
78
- be run from a terminal yet. `--help` after `dsl` lists every option.
76
+ `<GS2 Studio>` is `/Applications/GS2 Studio.app/Contents/MacOS/GS2 Studio` on macOS, the
77
+ `GS2-Studio-<version>-linux-<arch>.AppImage` file on Linux, and `bin\gs2studio.cmd` in the install directory on Windows. `gs2studio`
78
+ runs it when it is on PATH (the installer puts it there on Windows; on macOS and Linux, "Install 'gs2studio' Command in PATH"
79
+ in the app's menu). `"<GS2 Studio>" guide` prints every step from creating a project and adding packages, through
80
+ `dsl init`, to deploying to GS2 and generating the Unity code.
81
+ `--help` lists every command and option.
79
82
 
80
83
  ## License
81
84
 
package/REFERENCE.md CHANGED
@@ -406,8 +406,10 @@ UiItem.label("NameLabel", UiSource.prop("displayName")),
406
406
  - Only `.assetDelivery()` is accepted: no GS2 resource field holds text per locale, so it is neither a binding nor an
407
407
  action transform argument. It cannot be a list element, a key or sort member, a transform parameter, or a property of
408
408
  an inline element.
409
- - Unity: generated code reads it as `Gs2Bind.Localization.Gs2LocalizedText`, which `io.gs2.bind` releases after
410
- 2026.9.11 provide; a project without localized properties needs no newer `io.gs2.bind`.
409
+ - Unity: generated code reads it as `Gs2Bind.Localization.Gs2LocalizedText`, which `io.gs2.bind` 2026.11.1 and later
410
+ provide, so code generation raises the Unity project's `io.gs2.bind` to that release and `io.gs2.unity.sdk` /
411
+ `io.gs2.csharp.sdk` to 2026.11.12 / 2026.11.9, the SDKs it compiles against (it never lowers a pin). A project
412
+ without localized properties needs no newer `io.gs2.bind`.
411
413
  A `label` shows the translation for `Gs2Locale.Current`: the exact locale, then the same language, then `en`, then
412
414
  `ja`, then the first one. The locale starts from the device language; with `com.unity.localization` installed it
413
415
  follows Unity Localization's selected locale with nothing to set up, and without it the game calls
@@ -1136,6 +1138,7 @@ row again when it is shown. `interactable` changes only `interactable`, so it ca
1136
1138
  | --- | --- | --- |
1137
1139
  | `UiItem.label(className, source, options?)` | `source`: `UiSource.prop(...)` or `UiSource.lit(...)`. `options.fallbackText`: the text sent while the property has no value. | Sends the value as text through `OnUpdate` (`UnityEvent<string>`). A `timestamp` is written `yyyy-MM-dd HH:mm`; other values are converted with `Convert.ToString`, so a list or inline element property does not show its contents. A `PT.localizedString` source sends the translation for the player's locale and sends again when the locale changes ([Localized text](#localized-text)); of the other items only `templateLabel` and the `UiCond` of `activeToggle` and `interactable` accept that source. |
1138
1140
  | `UiItem.value(className, propertySource, options?)` | `propertySource`: `UiSource.prop(...)` of a property of a primitive type, a `ref`, or `"id"`. No literal. | Sends the value in its own C# type through `OnUpdate`: `UnityEvent<int>` for `int32`, `long` for `int64`, `float`, `double`, `bool`, `string`, `DateTime` for `timestamp`, and `string` for a `ref` or `"id"`. A missing value is sent as the type's default (`0`, `""`). `Select(value)` raises `OnSelect` with a value the game passes. Any other property type (`enum`, a list, an inline element) leaves the item out with a warning. |
1141
+ | `UiItem.countdown(className, propertySource, options?)` | `propertySource`: `UiSource.prop(...)` of a `timestamp` property. No literal. `options.fallbackText`: the text sent while the property holds no time. | Counts down to the time on GS2's clock for the player's session (UTC shifted by the access token's time offset) with GS2-Bind's `Gs2Countdown`, so code generation raises the Unity project's `io.gs2.bind` to 2026.11.3 or later, with `io.gs2.unity.sdk` 2026.11.12 and `io.gs2.csharp.sdk` 2026.11.9 or later. Once a second, reading the clock each time, and again whenever the row changes, it sends the time left as text through `OnUpdate` (`UnityEvent<string>`: `m:ss`, `h:mm:ss` from an hour on) and in whole seconds through `OnRemaining` (`UnityEvent<TimeSpan>`), ending at `0:00`; `OnCounting` (`UnityEvent<bool>`) sends `true` when it starts. A time of 0 or before, or no value, is no time (GS2's next recovery of a full stamina): it sends the fallback text through `OnUpdate` and `false` through `OnCounting`, and nothing through `OnRemaining`. It reads the session from the scene's `Gs2HolderRuntimeContextProvider` (or the provider given to its `SetRuntimeProvider`) and warns once when there is none, counting on UTC alone. Any other property type leaves the item out with a warning. |
1139
1142
  | `UiItem.templateLabel(className, template, sources, options?)` | `template` with `{key}` placeholders; `sources` maps each key to a source. Every placeholder needs exactly one source and every source a placeholder. `options.fallbackText`: the text sent while no row is loaded. | Sends `template` with each `{key}` replaced by its value through `OnUpdate` (`UnityEvent<string>`). A `PT.localizedString` source is replaced by the translation for the player's locale, and the text is sent again when the locale changes ([Localized text](#localized-text)). |
1140
1143
  | `UiItem.image(className, source, imageMode, options?)` | `imageMode`: `"spriteResourcePath"`, `"addressableKey"`, `"url"` or `"assetReference"`. `options.fallback`: the reference used while the property has no value. | Calls `partial void ApplyImage(Image target, string reference)`, which the game implements in its own part of the class to load the image; `ImageMode` names the mode. The generated code loads nothing. |
1141
1144
  | `UiItem.gauge(className, current, max, options?)` | Numeric sources. `options.min` accepts the same sources as `max` and defaults to 0; `options.clamp` (default `true`) keeps the fill between 0 and 1. | Sets `fillAmount` of its target `Image` to `(current - min) / (max - min)`, or 0 when that range is not positive. A non-numeric source leaves the item out with a warning. |
@@ -1143,8 +1146,8 @@ row again when it is shown. `interactable` changes only `interactable`, so it ca
1143
1146
  | `UiItem.activeToggle(className, condition, options?)` | A `UiCond` condition. | Activates the GameObjects in `_activeWhenTrue` and deactivates those in `_activeWhenFalse` while the condition holds, and the reverse while it does not. List siblings or children, never the component's own GameObject or an ancestor of it (see above). |
1144
1147
  | `UiItem.interactable(className, condition, options?)` | A `UiCond` condition. | Sets `interactable` of the `Selectable`s (such as a `Button`) in `_interactableWhenTrue` to the condition and of those in `_interactableWhenFalse` to its negation. |
1145
1148
 
1146
- Choose `label` for a value shown as text as it is, `templateLabel` for text with words around values, and `value` for a
1147
- value the game formats or uses itself (a number it animates, a date it counts down to). Sources read only the target row,
1149
+ Choose `label` for a value shown as text as it is, `templateLabel` for text with words around values, `countdown` for
1150
+ the time left until a timestamp, and `value` for a value the game formats or uses itself (a number it animates). Sources read only the target row,
1148
1151
  apart from the table band sources of `gauge`; a condition also reads the parent row with `UiCond.rowElement` and one row
1149
1152
  of any type with `UiSource.rowProp`.
1150
1153
 
@@ -1279,6 +1282,10 @@ component and no `UiSource.rowProp`, unless your package mounts its overlay of t
1279
1282
  A list shows the rows GS2 holds at run time (the deployed master data, or the player's user data), each with the values
1280
1283
  of its asset-delivered properties.
1281
1284
 
1285
+ To show the time left until a timestamp of a row, such as a stamina's next recovery, use a `UiItem.countdown` (or the one
1286
+ the dependency lists in `types.<Type>.uiComponents`) instead of a hand-written timer: it counts on the session's GS2 clock,
1287
+ which `DateTime.UtcNow` is not.
1288
+
1282
1289
  A dependency's own UI components are generated with it, so a dependency used as it is needs nothing in the DSL beyond
1283
1290
  the dependency and what its surface asks for. `foundation-economy-currency` is an example: the transforms that deposit
1284
1291
  into a wallet (`DepositFreeCurrency`, `DepositCurrency`) are all the DSL needs, and no `Wallet` row is needed. The game
package/index.d.ts CHANGED
@@ -543,6 +543,11 @@ export type UiItemSpec<TName extends string = string> = ({
543
543
  readonly kind: "value";
544
544
  readonly componentClassName: string;
545
545
  readonly source: UiPropertySourceSpec<TName>;
546
+ } & UiItemOptions) | ({
547
+ readonly kind: "countdown";
548
+ readonly componentClassName: string;
549
+ readonly source: UiPropertySourceSpec<TName>;
550
+ readonly fallbackText?: string;
546
551
  } & UiItemOptions) | ({
547
552
  readonly kind: "image";
548
553
  readonly componentClassName: string;
@@ -605,6 +610,9 @@ export declare const UiItem: {
605
610
  readonly fallbackText?: string;
606
611
  }) => UiItemSpec<TName>;
607
612
  readonly value: <TName extends string = never>(componentClassName: string, source: NoInfer<UiPropertySourceSpec<TName>>, options?: UiItemOptions) => UiItemSpec<TName>;
613
+ readonly countdown: <TName extends string = never>(componentClassName: string, source: NoInfer<UiPropertySourceSpec<TName>>, options?: UiItemOptions & {
614
+ readonly fallbackText?: string;
615
+ }) => UiItemSpec<TName>;
608
616
  readonly image: <TName extends string = never>(componentClassName: string, source: NoInfer<UiValueSourceSpec<TName>>, imageMode: UiImageMode, options?: UiItemOptions & {
609
617
  readonly fallback?: string;
610
618
  }) => UiItemSpec<TName>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gs2-studio-dsl",
3
- "version": "2026.11.16",
3
+ "version": "2026.11.17",
4
4
  "description": "Type definitions for the GS2 Studio package DSL.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {