@oasiz/sdk 1.8.3 → 1.8.4

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/README.md CHANGED
@@ -138,30 +138,97 @@ Supported `device` presets:
138
138
 
139
139
  Use the Jibble animation constants when wiring a player character atlas so you can reference known animation IDs during local development instead of publishing first and reading logs.
140
140
 
141
+ The atlas animation IDs are stable strings. Directional animations use the pattern
142
+ `<action>_<direction>`, where the direction suffix is one of `n`, `ne`, `e`, `se`,
143
+ `s`, `sw`, `w`, or `nw`.
144
+
145
+ | Player-facing direction | Compass direction | Suffix |
146
+ | --- | --- | --- |
147
+ | `front`, `forward`, `forth` | South | `s` |
148
+ | `front-right`, `forward-right` | SouthEast | `se` |
149
+ | `right` | East | `e` |
150
+ | `back-right`, `backward-right` | NorthEast | `ne` |
151
+ | `back`, `backward` | North | `n` |
152
+ | `back-left`, `backward-left` | NorthWest | `nw` |
153
+ | `left` | West | `w` |
154
+ | `front-left`, `forward-left` | SouthWest | `sw` |
155
+
156
+ You can also pass compass names directly, such as `north`, `south`, `north-east`,
157
+ or `southwest`.
158
+
159
+ #### Animation catalog
160
+
161
+ | Action | Constant | Animation IDs |
162
+ | --- | --- | --- |
163
+ | Idle | `JIBBLE_ANIMATION.Idle` | `idle_n`, `idle_ne`, `idle_e`, `idle_se`, `idle_s`, `idle_sw`, `idle_w`, `idle_nw` |
164
+ | Walk | `JIBBLE_ANIMATION.Walk` | `walk_n`, `walk_ne`, `walk_e`, `walk_se`, `walk_s`, `walk_sw`, `walk_w`, `walk_nw` |
165
+ | Backflip | `JIBBLE_ANIMATION.Backflip` | `backflip` |
166
+
167
+ `backflip` is not directional, so `getJibbleAnimationId("backflip", "left")`
168
+ still returns `backflip`.
169
+
170
+ #### HTML5 / TypeScript
171
+
141
172
  ```ts
142
- import { JIBBLE_ANIMATION, getJibbleAnimationId, oasiz } from "@oasiz/sdk";
173
+ import {
174
+ JIBBLE_ANIMATION,
175
+ JIBBLE_ANIMATION_IDS,
176
+ getJibbleAnimationId,
177
+ oasiz,
178
+ } from "@oasiz/sdk";
143
179
 
144
180
  const character = await oasiz.getPlayerCharacter();
145
181
  if (!character) return;
146
182
 
147
183
  const atlas = character.textureAtlas;
184
+
185
+ // Print the full SDK catalog while debugging.
186
+ console.table(JIBBLE_ANIMATION_IDS);
187
+
148
188
  const walkBack = getJibbleAnimationId("walk", "back"); // "walk_n"
149
189
  const walkBackAnimation = atlas.animations.find((anim) => anim.animationId === walkBack);
190
+
150
191
  const idleFrontAnimation = atlas.animations.find(
151
192
  (anim) => anim.animationId === JIBBLE_ANIMATION.Idle.South,
152
193
  );
194
+
195
+ const backflipAnimation = atlas.animations.find(
196
+ (anim) => anim.animationId === JIBBLE_ANIMATION.Backflip,
197
+ );
198
+
199
+ const availableAnimations = new Set(atlas.animations.map((anim) => anim.animationId));
200
+ const animationToPlay = availableAnimations.has(walkBack)
201
+ ? walkBack
202
+ : JIBBLE_ANIMATION.Idle.South;
153
203
  ```
154
204
 
155
- Supported directional IDs use compass codes: `n`, `ne`, `e`, `se`, `s`, `sw`, `w`, `nw`. The helper accepts gameplay-facing aliases too: `front` -> `s`, `back` -> `n`, `left` -> `w`, `right` -> `e`.
205
+ Not every custom atlas is guaranteed to contain every catalog ID. Check
206
+ `atlas.animations` before playing an animation and choose a fallback, usually
207
+ `idle_s` or the closest available direction.
156
208
 
157
- Unity exposes the same IDs:
209
+ #### Unity
158
210
 
159
211
  ```csharp
160
- var walkBack = JibbleAnimations.GetId(
212
+ using Oasiz;
213
+
214
+ var walkBackId = JibbleAnimations.GetId(
161
215
  JibbleAnimationAction.Walk,
162
- JibbleDirection.Back);
216
+ JibbleDirection.Back); // "walk_n"
163
217
 
164
- var idleFront = JibbleAnimations.Idle.South;
218
+ var walkFrontRightId = JibbleAnimations.GetId(
219
+ JibbleAnimationAction.Walk,
220
+ JibbleDirection.FrontRight); // "walk_se"
221
+
222
+ var idleFrontId = JibbleAnimations.GetId(
223
+ JibbleAnimationAction.Idle,
224
+ JibbleDirection.Front); // "idle_s"
225
+
226
+ var backflipId = JibbleAnimations.Backflip; // "backflip"
227
+
228
+ foreach (var animationId in JibbleAnimations.All)
229
+ {
230
+ Debug.Log(animationId);
231
+ }
165
232
  ```
166
233
 
167
234
  ### Score
package/dist/index.cjs CHANGED
@@ -1514,6 +1514,43 @@ var JIBBLE_DIRECTIONS = [
1514
1514
  "w",
1515
1515
  "nw"
1516
1516
  ];
1517
+ var JIBBLE_DIRECTION_ALIASES = {
1518
+ n: "n",
1519
+ ne: "ne",
1520
+ e: "e",
1521
+ se: "se",
1522
+ s: "s",
1523
+ sw: "sw",
1524
+ w: "w",
1525
+ nw: "nw",
1526
+ north: "n",
1527
+ "north-east": "ne",
1528
+ northeast: "ne",
1529
+ east: "e",
1530
+ "south-east": "se",
1531
+ southeast: "se",
1532
+ south: "s",
1533
+ "south-west": "sw",
1534
+ southwest: "sw",
1535
+ west: "w",
1536
+ "north-west": "nw",
1537
+ northwest: "nw",
1538
+ front: "s",
1539
+ forward: "s",
1540
+ forth: "s",
1541
+ back: "n",
1542
+ backward: "n",
1543
+ left: "w",
1544
+ right: "e",
1545
+ "front-right": "se",
1546
+ "forward-right": "se",
1547
+ "front-left": "sw",
1548
+ "forward-left": "sw",
1549
+ "back-right": "ne",
1550
+ "backward-right": "ne",
1551
+ "back-left": "nw",
1552
+ "backward-left": "nw"
1553
+ };
1517
1554
  var JIBBLE_ANIMATION = {
1518
1555
  Idle: {
1519
1556
  North: "idle_n",
@@ -1556,20 +1593,6 @@ var JIBBLE_ANIMATION_IDS = [
1556
1593
  JIBBLE_ANIMATION.Walk.NorthWest,
1557
1594
  JIBBLE_ANIMATION.Backflip
1558
1595
  ];
1559
- var JIBBLE_DIRECTION_ALIASES = {
1560
- n: "n",
1561
- ne: "ne",
1562
- e: "e",
1563
- se: "se",
1564
- s: "s",
1565
- sw: "sw",
1566
- w: "w",
1567
- nw: "nw",
1568
- front: "s",
1569
- back: "n",
1570
- left: "w",
1571
- right: "e"
1572
- };
1573
1596
  function normalizeJibbleDirection(direction) {
1574
1597
  return JIBBLE_DIRECTION_ALIASES[direction];
1575
1598
  }
package/dist/index.d.cts CHANGED
@@ -251,7 +251,44 @@ declare function triggerHaptic(type: HapticType): void;
251
251
 
252
252
  declare const JIBBLE_DIRECTIONS: readonly ["n", "ne", "e", "se", "s", "sw", "w", "nw"];
253
253
  type JibbleDirectionCode = (typeof JIBBLE_DIRECTIONS)[number];
254
- type JibbleFacingDirection = JibbleDirectionCode | "front" | "back" | "left" | "right";
254
+ declare const JIBBLE_DIRECTION_ALIASES: {
255
+ readonly n: "n";
256
+ readonly ne: "ne";
257
+ readonly e: "e";
258
+ readonly se: "se";
259
+ readonly s: "s";
260
+ readonly sw: "sw";
261
+ readonly w: "w";
262
+ readonly nw: "nw";
263
+ readonly north: "n";
264
+ readonly "north-east": "ne";
265
+ readonly northeast: "ne";
266
+ readonly east: "e";
267
+ readonly "south-east": "se";
268
+ readonly southeast: "se";
269
+ readonly south: "s";
270
+ readonly "south-west": "sw";
271
+ readonly southwest: "sw";
272
+ readonly west: "w";
273
+ readonly "north-west": "nw";
274
+ readonly northwest: "nw";
275
+ readonly front: "s";
276
+ readonly forward: "s";
277
+ readonly forth: "s";
278
+ readonly back: "n";
279
+ readonly backward: "n";
280
+ readonly left: "w";
281
+ readonly right: "e";
282
+ readonly "front-right": "se";
283
+ readonly "forward-right": "se";
284
+ readonly "front-left": "sw";
285
+ readonly "forward-left": "sw";
286
+ readonly "back-right": "ne";
287
+ readonly "backward-right": "ne";
288
+ readonly "back-left": "nw";
289
+ readonly "backward-left": "nw";
290
+ };
291
+ type JibbleFacingDirection = keyof typeof JIBBLE_DIRECTION_ALIASES;
255
292
  type JibbleAnimationAction = "idle" | "walk" | "backflip";
256
293
  declare const JIBBLE_ANIMATION: {
257
294
  readonly Idle: {
package/dist/index.d.ts CHANGED
@@ -251,7 +251,44 @@ declare function triggerHaptic(type: HapticType): void;
251
251
 
252
252
  declare const JIBBLE_DIRECTIONS: readonly ["n", "ne", "e", "se", "s", "sw", "w", "nw"];
253
253
  type JibbleDirectionCode = (typeof JIBBLE_DIRECTIONS)[number];
254
- type JibbleFacingDirection = JibbleDirectionCode | "front" | "back" | "left" | "right";
254
+ declare const JIBBLE_DIRECTION_ALIASES: {
255
+ readonly n: "n";
256
+ readonly ne: "ne";
257
+ readonly e: "e";
258
+ readonly se: "se";
259
+ readonly s: "s";
260
+ readonly sw: "sw";
261
+ readonly w: "w";
262
+ readonly nw: "nw";
263
+ readonly north: "n";
264
+ readonly "north-east": "ne";
265
+ readonly northeast: "ne";
266
+ readonly east: "e";
267
+ readonly "south-east": "se";
268
+ readonly southeast: "se";
269
+ readonly south: "s";
270
+ readonly "south-west": "sw";
271
+ readonly southwest: "sw";
272
+ readonly west: "w";
273
+ readonly "north-west": "nw";
274
+ readonly northwest: "nw";
275
+ readonly front: "s";
276
+ readonly forward: "s";
277
+ readonly forth: "s";
278
+ readonly back: "n";
279
+ readonly backward: "n";
280
+ readonly left: "w";
281
+ readonly right: "e";
282
+ readonly "front-right": "se";
283
+ readonly "forward-right": "se";
284
+ readonly "front-left": "sw";
285
+ readonly "forward-left": "sw";
286
+ readonly "back-right": "ne";
287
+ readonly "backward-right": "ne";
288
+ readonly "back-left": "nw";
289
+ readonly "backward-left": "nw";
290
+ };
291
+ type JibbleFacingDirection = keyof typeof JIBBLE_DIRECTION_ALIASES;
255
292
  type JibbleAnimationAction = "idle" | "walk" | "backflip";
256
293
  declare const JIBBLE_ANIMATION: {
257
294
  readonly Idle: {
package/dist/index.js CHANGED
@@ -1455,6 +1455,43 @@ var JIBBLE_DIRECTIONS = [
1455
1455
  "w",
1456
1456
  "nw"
1457
1457
  ];
1458
+ var JIBBLE_DIRECTION_ALIASES = {
1459
+ n: "n",
1460
+ ne: "ne",
1461
+ e: "e",
1462
+ se: "se",
1463
+ s: "s",
1464
+ sw: "sw",
1465
+ w: "w",
1466
+ nw: "nw",
1467
+ north: "n",
1468
+ "north-east": "ne",
1469
+ northeast: "ne",
1470
+ east: "e",
1471
+ "south-east": "se",
1472
+ southeast: "se",
1473
+ south: "s",
1474
+ "south-west": "sw",
1475
+ southwest: "sw",
1476
+ west: "w",
1477
+ "north-west": "nw",
1478
+ northwest: "nw",
1479
+ front: "s",
1480
+ forward: "s",
1481
+ forth: "s",
1482
+ back: "n",
1483
+ backward: "n",
1484
+ left: "w",
1485
+ right: "e",
1486
+ "front-right": "se",
1487
+ "forward-right": "se",
1488
+ "front-left": "sw",
1489
+ "forward-left": "sw",
1490
+ "back-right": "ne",
1491
+ "backward-right": "ne",
1492
+ "back-left": "nw",
1493
+ "backward-left": "nw"
1494
+ };
1458
1495
  var JIBBLE_ANIMATION = {
1459
1496
  Idle: {
1460
1497
  North: "idle_n",
@@ -1497,20 +1534,6 @@ var JIBBLE_ANIMATION_IDS = [
1497
1534
  JIBBLE_ANIMATION.Walk.NorthWest,
1498
1535
  JIBBLE_ANIMATION.Backflip
1499
1536
  ];
1500
- var JIBBLE_DIRECTION_ALIASES = {
1501
- n: "n",
1502
- ne: "ne",
1503
- e: "e",
1504
- se: "se",
1505
- s: "s",
1506
- sw: "sw",
1507
- w: "w",
1508
- nw: "nw",
1509
- front: "s",
1510
- back: "n",
1511
- left: "w",
1512
- right: "e"
1513
- };
1514
1537
  function normalizeJibbleDirection(direction) {
1515
1538
  return JIBBLE_DIRECTION_ALIASES[direction];
1516
1539
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oasiz/sdk",
3
- "version": "1.8.3",
3
+ "version": "1.8.4",
4
4
  "description": "Typed SDK for Oasiz game platform bridge APIs.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",