@oasiz/sdk 1.8.2 → 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 +97 -0
- package/dist/index.cjs +114 -0
- package/dist/index.d.cts +96 -1
- package/dist/index.d.ts +96 -1
- package/dist/index.js +109 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -134,6 +134,103 @@ Supported `device` presets:
|
|
|
134
134
|
| `iphone-17e` | `390 × 844` |
|
|
135
135
|
| `iphone-air` | `420 × 912` |
|
|
136
136
|
|
|
137
|
+
### Player character animations
|
|
138
|
+
|
|
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
|
+
|
|
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
|
+
|
|
172
|
+
```ts
|
|
173
|
+
import {
|
|
174
|
+
JIBBLE_ANIMATION,
|
|
175
|
+
JIBBLE_ANIMATION_IDS,
|
|
176
|
+
getJibbleAnimationId,
|
|
177
|
+
oasiz,
|
|
178
|
+
} from "@oasiz/sdk";
|
|
179
|
+
|
|
180
|
+
const character = await oasiz.getPlayerCharacter();
|
|
181
|
+
if (!character) return;
|
|
182
|
+
|
|
183
|
+
const atlas = character.textureAtlas;
|
|
184
|
+
|
|
185
|
+
// Print the full SDK catalog while debugging.
|
|
186
|
+
console.table(JIBBLE_ANIMATION_IDS);
|
|
187
|
+
|
|
188
|
+
const walkBack = getJibbleAnimationId("walk", "back"); // "walk_n"
|
|
189
|
+
const walkBackAnimation = atlas.animations.find((anim) => anim.animationId === walkBack);
|
|
190
|
+
|
|
191
|
+
const idleFrontAnimation = atlas.animations.find(
|
|
192
|
+
(anim) => anim.animationId === JIBBLE_ANIMATION.Idle.South,
|
|
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;
|
|
203
|
+
```
|
|
204
|
+
|
|
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.
|
|
208
|
+
|
|
209
|
+
#### Unity
|
|
210
|
+
|
|
211
|
+
```csharp
|
|
212
|
+
using Oasiz;
|
|
213
|
+
|
|
214
|
+
var walkBackId = JibbleAnimations.GetId(
|
|
215
|
+
JibbleAnimationAction.Walk,
|
|
216
|
+
JibbleDirection.Back); // "walk_n"
|
|
217
|
+
|
|
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
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
137
234
|
### Score
|
|
138
235
|
|
|
139
236
|
#### `oasiz.submitScore(score: number)`
|
package/dist/index.cjs
CHANGED
|
@@ -20,6 +20,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
JIBBLE_ANIMATION: () => JIBBLE_ANIMATION,
|
|
24
|
+
JIBBLE_ANIMATION_IDS: () => JIBBLE_ANIMATION_IDS,
|
|
25
|
+
JIBBLE_DIRECTIONS: () => JIBBLE_DIRECTIONS,
|
|
23
26
|
addScore: () => addScore,
|
|
24
27
|
enableAppSimulator: () => enableAppSimulator,
|
|
25
28
|
enableBackButtonTesting: () => enableBackButtonTesting,
|
|
@@ -27,6 +30,7 @@ __export(index_exports, {
|
|
|
27
30
|
flushGameState: () => flushGameState,
|
|
28
31
|
getGameId: () => getGameId,
|
|
29
32
|
getGraphicsPerformance: () => getGraphicsPerformance,
|
|
33
|
+
getJibbleAnimationId: () => getJibbleAnimationId,
|
|
30
34
|
getPlayerAvatar: () => getPlayerAvatar,
|
|
31
35
|
getPlayerCharacter: () => getPlayerCharacter,
|
|
32
36
|
getPlayerId: () => getPlayerId,
|
|
@@ -36,6 +40,7 @@ __export(index_exports, {
|
|
|
36
40
|
getViewportInsets: () => getViewportInsets,
|
|
37
41
|
leaveGame: () => leaveGame,
|
|
38
42
|
loadGameState: () => loadGameState,
|
|
43
|
+
normalizeJibbleDirection: () => normalizeJibbleDirection,
|
|
39
44
|
oasiz: () => oasiz,
|
|
40
45
|
onBackButton: () => onBackButton,
|
|
41
46
|
onLeaveGame: () => onLeaveGame,
|
|
@@ -1498,6 +1503,106 @@ function triggerHaptic(type) {
|
|
|
1498
1503
|
}
|
|
1499
1504
|
}
|
|
1500
1505
|
|
|
1506
|
+
// src/jibble.ts
|
|
1507
|
+
var JIBBLE_DIRECTIONS = [
|
|
1508
|
+
"n",
|
|
1509
|
+
"ne",
|
|
1510
|
+
"e",
|
|
1511
|
+
"se",
|
|
1512
|
+
"s",
|
|
1513
|
+
"sw",
|
|
1514
|
+
"w",
|
|
1515
|
+
"nw"
|
|
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
|
+
};
|
|
1554
|
+
var JIBBLE_ANIMATION = {
|
|
1555
|
+
Idle: {
|
|
1556
|
+
North: "idle_n",
|
|
1557
|
+
NorthEast: "idle_ne",
|
|
1558
|
+
East: "idle_e",
|
|
1559
|
+
SouthEast: "idle_se",
|
|
1560
|
+
South: "idle_s",
|
|
1561
|
+
SouthWest: "idle_sw",
|
|
1562
|
+
West: "idle_w",
|
|
1563
|
+
NorthWest: "idle_nw"
|
|
1564
|
+
},
|
|
1565
|
+
Walk: {
|
|
1566
|
+
North: "walk_n",
|
|
1567
|
+
NorthEast: "walk_ne",
|
|
1568
|
+
East: "walk_e",
|
|
1569
|
+
SouthEast: "walk_se",
|
|
1570
|
+
South: "walk_s",
|
|
1571
|
+
SouthWest: "walk_sw",
|
|
1572
|
+
West: "walk_w",
|
|
1573
|
+
NorthWest: "walk_nw"
|
|
1574
|
+
},
|
|
1575
|
+
Backflip: "backflip"
|
|
1576
|
+
};
|
|
1577
|
+
var JIBBLE_ANIMATION_IDS = [
|
|
1578
|
+
JIBBLE_ANIMATION.Idle.North,
|
|
1579
|
+
JIBBLE_ANIMATION.Idle.NorthEast,
|
|
1580
|
+
JIBBLE_ANIMATION.Idle.East,
|
|
1581
|
+
JIBBLE_ANIMATION.Idle.SouthEast,
|
|
1582
|
+
JIBBLE_ANIMATION.Idle.South,
|
|
1583
|
+
JIBBLE_ANIMATION.Idle.SouthWest,
|
|
1584
|
+
JIBBLE_ANIMATION.Idle.West,
|
|
1585
|
+
JIBBLE_ANIMATION.Idle.NorthWest,
|
|
1586
|
+
JIBBLE_ANIMATION.Walk.North,
|
|
1587
|
+
JIBBLE_ANIMATION.Walk.NorthEast,
|
|
1588
|
+
JIBBLE_ANIMATION.Walk.East,
|
|
1589
|
+
JIBBLE_ANIMATION.Walk.SouthEast,
|
|
1590
|
+
JIBBLE_ANIMATION.Walk.South,
|
|
1591
|
+
JIBBLE_ANIMATION.Walk.SouthWest,
|
|
1592
|
+
JIBBLE_ANIMATION.Walk.West,
|
|
1593
|
+
JIBBLE_ANIMATION.Walk.NorthWest,
|
|
1594
|
+
JIBBLE_ANIMATION.Backflip
|
|
1595
|
+
];
|
|
1596
|
+
function normalizeJibbleDirection(direction) {
|
|
1597
|
+
return JIBBLE_DIRECTION_ALIASES[direction];
|
|
1598
|
+
}
|
|
1599
|
+
function getJibbleAnimationId(action, direction = "front") {
|
|
1600
|
+
if (action === "backflip") {
|
|
1601
|
+
return JIBBLE_ANIMATION.Backflip;
|
|
1602
|
+
}
|
|
1603
|
+
return `${action}_${normalizeJibbleDirection(direction)}`;
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1501
1606
|
// src/log-overlay.ts
|
|
1502
1607
|
var CONSOLE_METHODS = [
|
|
1503
1608
|
"debug",
|
|
@@ -3344,6 +3449,10 @@ function getGraphicsPerformance() {
|
|
|
3344
3449
|
var oasiz = {
|
|
3345
3450
|
submitScore,
|
|
3346
3451
|
enableAppSimulator,
|
|
3452
|
+
getJibbleAnimationId,
|
|
3453
|
+
jibbleAnimations: JIBBLE_ANIMATION,
|
|
3454
|
+
jibbleAnimationIds: JIBBLE_ANIMATION_IDS,
|
|
3455
|
+
jibbleDirections: JIBBLE_DIRECTIONS,
|
|
3347
3456
|
addScore,
|
|
3348
3457
|
setScore,
|
|
3349
3458
|
getPlayerCharacter,
|
|
@@ -3392,6 +3501,9 @@ var oasiz = {
|
|
|
3392
3501
|
};
|
|
3393
3502
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3394
3503
|
0 && (module.exports = {
|
|
3504
|
+
JIBBLE_ANIMATION,
|
|
3505
|
+
JIBBLE_ANIMATION_IDS,
|
|
3506
|
+
JIBBLE_DIRECTIONS,
|
|
3395
3507
|
addScore,
|
|
3396
3508
|
enableAppSimulator,
|
|
3397
3509
|
enableBackButtonTesting,
|
|
@@ -3399,6 +3511,7 @@ var oasiz = {
|
|
|
3399
3511
|
flushGameState,
|
|
3400
3512
|
getGameId,
|
|
3401
3513
|
getGraphicsPerformance,
|
|
3514
|
+
getJibbleAnimationId,
|
|
3402
3515
|
getPlayerAvatar,
|
|
3403
3516
|
getPlayerCharacter,
|
|
3404
3517
|
getPlayerId,
|
|
@@ -3408,6 +3521,7 @@ var oasiz = {
|
|
|
3408
3521
|
getViewportInsets,
|
|
3409
3522
|
leaveGame,
|
|
3410
3523
|
loadGameState,
|
|
3524
|
+
normalizeJibbleDirection,
|
|
3411
3525
|
oasiz,
|
|
3412
3526
|
onBackButton,
|
|
3413
3527
|
onLeaveGame,
|
package/dist/index.d.cts
CHANGED
|
@@ -249,6 +249,75 @@ declare function getPlayerCharacter(): Promise<PlayerCharacter | null>;
|
|
|
249
249
|
|
|
250
250
|
declare function triggerHaptic(type: HapticType): void;
|
|
251
251
|
|
|
252
|
+
declare const JIBBLE_DIRECTIONS: readonly ["n", "ne", "e", "se", "s", "sw", "w", "nw"];
|
|
253
|
+
type JibbleDirectionCode = (typeof JIBBLE_DIRECTIONS)[number];
|
|
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;
|
|
292
|
+
type JibbleAnimationAction = "idle" | "walk" | "backflip";
|
|
293
|
+
declare const JIBBLE_ANIMATION: {
|
|
294
|
+
readonly Idle: {
|
|
295
|
+
readonly North: "idle_n";
|
|
296
|
+
readonly NorthEast: "idle_ne";
|
|
297
|
+
readonly East: "idle_e";
|
|
298
|
+
readonly SouthEast: "idle_se";
|
|
299
|
+
readonly South: "idle_s";
|
|
300
|
+
readonly SouthWest: "idle_sw";
|
|
301
|
+
readonly West: "idle_w";
|
|
302
|
+
readonly NorthWest: "idle_nw";
|
|
303
|
+
};
|
|
304
|
+
readonly Walk: {
|
|
305
|
+
readonly North: "walk_n";
|
|
306
|
+
readonly NorthEast: "walk_ne";
|
|
307
|
+
readonly East: "walk_e";
|
|
308
|
+
readonly SouthEast: "walk_se";
|
|
309
|
+
readonly South: "walk_s";
|
|
310
|
+
readonly SouthWest: "walk_sw";
|
|
311
|
+
readonly West: "walk_w";
|
|
312
|
+
readonly NorthWest: "walk_nw";
|
|
313
|
+
};
|
|
314
|
+
readonly Backflip: "backflip";
|
|
315
|
+
};
|
|
316
|
+
declare const JIBBLE_ANIMATION_IDS: readonly ["idle_n", "idle_ne", "idle_e", "idle_se", "idle_s", "idle_sw", "idle_w", "idle_nw", "walk_n", "walk_ne", "walk_e", "walk_se", "walk_s", "walk_sw", "walk_w", "walk_nw", "backflip"];
|
|
317
|
+
type JibbleAnimationId = (typeof JIBBLE_ANIMATION_IDS)[number];
|
|
318
|
+
declare function normalizeJibbleDirection(direction: JibbleFacingDirection): JibbleDirectionCode;
|
|
319
|
+
declare function getJibbleAnimationId(action: JibbleAnimationAction, direction?: JibbleFacingDirection): JibbleAnimationId;
|
|
320
|
+
|
|
252
321
|
declare function enableLogOverlay(options?: LogOverlayOptions): LogOverlayHandle;
|
|
253
322
|
|
|
254
323
|
interface ShareRoomCodeOptions {
|
|
@@ -315,6 +384,32 @@ declare function flushGameState(): void;
|
|
|
315
384
|
declare const oasiz: {
|
|
316
385
|
submitScore: typeof submitScore;
|
|
317
386
|
enableAppSimulator: typeof enableAppSimulator;
|
|
387
|
+
getJibbleAnimationId: typeof getJibbleAnimationId;
|
|
388
|
+
jibbleAnimations: {
|
|
389
|
+
readonly Idle: {
|
|
390
|
+
readonly North: "idle_n";
|
|
391
|
+
readonly NorthEast: "idle_ne";
|
|
392
|
+
readonly East: "idle_e";
|
|
393
|
+
readonly SouthEast: "idle_se";
|
|
394
|
+
readonly South: "idle_s";
|
|
395
|
+
readonly SouthWest: "idle_sw";
|
|
396
|
+
readonly West: "idle_w";
|
|
397
|
+
readonly NorthWest: "idle_nw";
|
|
398
|
+
};
|
|
399
|
+
readonly Walk: {
|
|
400
|
+
readonly North: "walk_n";
|
|
401
|
+
readonly NorthEast: "walk_ne";
|
|
402
|
+
readonly East: "walk_e";
|
|
403
|
+
readonly SouthEast: "walk_se";
|
|
404
|
+
readonly South: "walk_s";
|
|
405
|
+
readonly SouthWest: "walk_sw";
|
|
406
|
+
readonly West: "walk_w";
|
|
407
|
+
readonly NorthWest: "walk_nw";
|
|
408
|
+
};
|
|
409
|
+
readonly Backflip: "backflip";
|
|
410
|
+
};
|
|
411
|
+
jibbleAnimationIds: readonly ["idle_n", "idle_ne", "idle_e", "idle_se", "idle_s", "idle_sw", "idle_w", "idle_nw", "walk_n", "walk_ne", "walk_e", "walk_se", "walk_s", "walk_sw", "walk_w", "walk_nw", "backflip"];
|
|
412
|
+
jibbleDirections: readonly ["n", "ne", "e", "se", "s", "sw", "w", "nw"];
|
|
318
413
|
addScore: typeof addScore;
|
|
319
414
|
setScore: typeof setScore;
|
|
320
415
|
getPlayerCharacter: typeof getPlayerCharacter;
|
|
@@ -346,4 +441,4 @@ declare const oasiz: {
|
|
|
346
441
|
readonly graphicsPerformance: GraphicsPerformanceMetric;
|
|
347
442
|
};
|
|
348
443
|
|
|
349
|
-
export { type AppSimulatorDevice, type AppSimulatorDeviceName, type AppSimulatorHandle, type AppSimulatorOptions, type AppSimulatorOrientation, type BackButtonTestingHandle, type BackButtonTestingOptions, type FacingFrameMap, type GameState, type GraphicsPerformanceMetric, type GraphicsPerformanceTier, type HapticType, type LogOverlayEntry, type LogOverlayHandle, type LogOverlayLevel, type LogOverlayOptions, type PlayerCharacter, type ScoreEditResult, type ShareRequest, type ShareRoomCodeOptions, type TextureAtlas, type TextureAtlasAnimation, type TextureAtlasFrame, type Unsubscribe, type ViewportInsetEdges, type ViewportInsetSide, type ViewportInsets, addScore, enableAppSimulator, enableBackButtonTesting, enableLogOverlay, flushGameState, getGameId, getGraphicsPerformance, getPlayerAvatar, getPlayerCharacter, getPlayerId, getPlayerName, getRoomCode, getSafeAreaTop, getViewportInsets, leaveGame, loadGameState, oasiz, onBackButton, onLeaveGame, onPause, onResume, openInviteModal, saveGameState, setLeaderboardVisible, setScore, share, shareRoomCode, submitScore, triggerHaptic };
|
|
444
|
+
export { type AppSimulatorDevice, type AppSimulatorDeviceName, type AppSimulatorHandle, type AppSimulatorOptions, type AppSimulatorOrientation, type BackButtonTestingHandle, type BackButtonTestingOptions, type FacingFrameMap, type GameState, type GraphicsPerformanceMetric, type GraphicsPerformanceTier, type HapticType, JIBBLE_ANIMATION, JIBBLE_ANIMATION_IDS, JIBBLE_DIRECTIONS, type JibbleAnimationAction, type JibbleAnimationId, type JibbleDirectionCode, type JibbleFacingDirection, type LogOverlayEntry, type LogOverlayHandle, type LogOverlayLevel, type LogOverlayOptions, type PlayerCharacter, type ScoreEditResult, type ShareRequest, type ShareRoomCodeOptions, type TextureAtlas, type TextureAtlasAnimation, type TextureAtlasFrame, type Unsubscribe, type ViewportInsetEdges, type ViewportInsetSide, type ViewportInsets, addScore, enableAppSimulator, enableBackButtonTesting, enableLogOverlay, flushGameState, getGameId, getGraphicsPerformance, getJibbleAnimationId, getPlayerAvatar, getPlayerCharacter, getPlayerId, getPlayerName, getRoomCode, getSafeAreaTop, getViewportInsets, leaveGame, loadGameState, normalizeJibbleDirection, oasiz, onBackButton, onLeaveGame, onPause, onResume, openInviteModal, saveGameState, setLeaderboardVisible, setScore, share, shareRoomCode, submitScore, triggerHaptic };
|
package/dist/index.d.ts
CHANGED
|
@@ -249,6 +249,75 @@ declare function getPlayerCharacter(): Promise<PlayerCharacter | null>;
|
|
|
249
249
|
|
|
250
250
|
declare function triggerHaptic(type: HapticType): void;
|
|
251
251
|
|
|
252
|
+
declare const JIBBLE_DIRECTIONS: readonly ["n", "ne", "e", "se", "s", "sw", "w", "nw"];
|
|
253
|
+
type JibbleDirectionCode = (typeof JIBBLE_DIRECTIONS)[number];
|
|
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;
|
|
292
|
+
type JibbleAnimationAction = "idle" | "walk" | "backflip";
|
|
293
|
+
declare const JIBBLE_ANIMATION: {
|
|
294
|
+
readonly Idle: {
|
|
295
|
+
readonly North: "idle_n";
|
|
296
|
+
readonly NorthEast: "idle_ne";
|
|
297
|
+
readonly East: "idle_e";
|
|
298
|
+
readonly SouthEast: "idle_se";
|
|
299
|
+
readonly South: "idle_s";
|
|
300
|
+
readonly SouthWest: "idle_sw";
|
|
301
|
+
readonly West: "idle_w";
|
|
302
|
+
readonly NorthWest: "idle_nw";
|
|
303
|
+
};
|
|
304
|
+
readonly Walk: {
|
|
305
|
+
readonly North: "walk_n";
|
|
306
|
+
readonly NorthEast: "walk_ne";
|
|
307
|
+
readonly East: "walk_e";
|
|
308
|
+
readonly SouthEast: "walk_se";
|
|
309
|
+
readonly South: "walk_s";
|
|
310
|
+
readonly SouthWest: "walk_sw";
|
|
311
|
+
readonly West: "walk_w";
|
|
312
|
+
readonly NorthWest: "walk_nw";
|
|
313
|
+
};
|
|
314
|
+
readonly Backflip: "backflip";
|
|
315
|
+
};
|
|
316
|
+
declare const JIBBLE_ANIMATION_IDS: readonly ["idle_n", "idle_ne", "idle_e", "idle_se", "idle_s", "idle_sw", "idle_w", "idle_nw", "walk_n", "walk_ne", "walk_e", "walk_se", "walk_s", "walk_sw", "walk_w", "walk_nw", "backflip"];
|
|
317
|
+
type JibbleAnimationId = (typeof JIBBLE_ANIMATION_IDS)[number];
|
|
318
|
+
declare function normalizeJibbleDirection(direction: JibbleFacingDirection): JibbleDirectionCode;
|
|
319
|
+
declare function getJibbleAnimationId(action: JibbleAnimationAction, direction?: JibbleFacingDirection): JibbleAnimationId;
|
|
320
|
+
|
|
252
321
|
declare function enableLogOverlay(options?: LogOverlayOptions): LogOverlayHandle;
|
|
253
322
|
|
|
254
323
|
interface ShareRoomCodeOptions {
|
|
@@ -315,6 +384,32 @@ declare function flushGameState(): void;
|
|
|
315
384
|
declare const oasiz: {
|
|
316
385
|
submitScore: typeof submitScore;
|
|
317
386
|
enableAppSimulator: typeof enableAppSimulator;
|
|
387
|
+
getJibbleAnimationId: typeof getJibbleAnimationId;
|
|
388
|
+
jibbleAnimations: {
|
|
389
|
+
readonly Idle: {
|
|
390
|
+
readonly North: "idle_n";
|
|
391
|
+
readonly NorthEast: "idle_ne";
|
|
392
|
+
readonly East: "idle_e";
|
|
393
|
+
readonly SouthEast: "idle_se";
|
|
394
|
+
readonly South: "idle_s";
|
|
395
|
+
readonly SouthWest: "idle_sw";
|
|
396
|
+
readonly West: "idle_w";
|
|
397
|
+
readonly NorthWest: "idle_nw";
|
|
398
|
+
};
|
|
399
|
+
readonly Walk: {
|
|
400
|
+
readonly North: "walk_n";
|
|
401
|
+
readonly NorthEast: "walk_ne";
|
|
402
|
+
readonly East: "walk_e";
|
|
403
|
+
readonly SouthEast: "walk_se";
|
|
404
|
+
readonly South: "walk_s";
|
|
405
|
+
readonly SouthWest: "walk_sw";
|
|
406
|
+
readonly West: "walk_w";
|
|
407
|
+
readonly NorthWest: "walk_nw";
|
|
408
|
+
};
|
|
409
|
+
readonly Backflip: "backflip";
|
|
410
|
+
};
|
|
411
|
+
jibbleAnimationIds: readonly ["idle_n", "idle_ne", "idle_e", "idle_se", "idle_s", "idle_sw", "idle_w", "idle_nw", "walk_n", "walk_ne", "walk_e", "walk_se", "walk_s", "walk_sw", "walk_w", "walk_nw", "backflip"];
|
|
412
|
+
jibbleDirections: readonly ["n", "ne", "e", "se", "s", "sw", "w", "nw"];
|
|
318
413
|
addScore: typeof addScore;
|
|
319
414
|
setScore: typeof setScore;
|
|
320
415
|
getPlayerCharacter: typeof getPlayerCharacter;
|
|
@@ -346,4 +441,4 @@ declare const oasiz: {
|
|
|
346
441
|
readonly graphicsPerformance: GraphicsPerformanceMetric;
|
|
347
442
|
};
|
|
348
443
|
|
|
349
|
-
export { type AppSimulatorDevice, type AppSimulatorDeviceName, type AppSimulatorHandle, type AppSimulatorOptions, type AppSimulatorOrientation, type BackButtonTestingHandle, type BackButtonTestingOptions, type FacingFrameMap, type GameState, type GraphicsPerformanceMetric, type GraphicsPerformanceTier, type HapticType, type LogOverlayEntry, type LogOverlayHandle, type LogOverlayLevel, type LogOverlayOptions, type PlayerCharacter, type ScoreEditResult, type ShareRequest, type ShareRoomCodeOptions, type TextureAtlas, type TextureAtlasAnimation, type TextureAtlasFrame, type Unsubscribe, type ViewportInsetEdges, type ViewportInsetSide, type ViewportInsets, addScore, enableAppSimulator, enableBackButtonTesting, enableLogOverlay, flushGameState, getGameId, getGraphicsPerformance, getPlayerAvatar, getPlayerCharacter, getPlayerId, getPlayerName, getRoomCode, getSafeAreaTop, getViewportInsets, leaveGame, loadGameState, oasiz, onBackButton, onLeaveGame, onPause, onResume, openInviteModal, saveGameState, setLeaderboardVisible, setScore, share, shareRoomCode, submitScore, triggerHaptic };
|
|
444
|
+
export { type AppSimulatorDevice, type AppSimulatorDeviceName, type AppSimulatorHandle, type AppSimulatorOptions, type AppSimulatorOrientation, type BackButtonTestingHandle, type BackButtonTestingOptions, type FacingFrameMap, type GameState, type GraphicsPerformanceMetric, type GraphicsPerformanceTier, type HapticType, JIBBLE_ANIMATION, JIBBLE_ANIMATION_IDS, JIBBLE_DIRECTIONS, type JibbleAnimationAction, type JibbleAnimationId, type JibbleDirectionCode, type JibbleFacingDirection, type LogOverlayEntry, type LogOverlayHandle, type LogOverlayLevel, type LogOverlayOptions, type PlayerCharacter, type ScoreEditResult, type ShareRequest, type ShareRoomCodeOptions, type TextureAtlas, type TextureAtlasAnimation, type TextureAtlasFrame, type Unsubscribe, type ViewportInsetEdges, type ViewportInsetSide, type ViewportInsets, addScore, enableAppSimulator, enableBackButtonTesting, enableLogOverlay, flushGameState, getGameId, getGraphicsPerformance, getJibbleAnimationId, getPlayerAvatar, getPlayerCharacter, getPlayerId, getPlayerName, getRoomCode, getSafeAreaTop, getViewportInsets, leaveGame, loadGameState, normalizeJibbleDirection, oasiz, onBackButton, onLeaveGame, onPause, onResume, openInviteModal, saveGameState, setLeaderboardVisible, setScore, share, shareRoomCode, submitScore, triggerHaptic };
|
package/dist/index.js
CHANGED
|
@@ -1444,6 +1444,106 @@ function triggerHaptic(type) {
|
|
|
1444
1444
|
}
|
|
1445
1445
|
}
|
|
1446
1446
|
|
|
1447
|
+
// src/jibble.ts
|
|
1448
|
+
var JIBBLE_DIRECTIONS = [
|
|
1449
|
+
"n",
|
|
1450
|
+
"ne",
|
|
1451
|
+
"e",
|
|
1452
|
+
"se",
|
|
1453
|
+
"s",
|
|
1454
|
+
"sw",
|
|
1455
|
+
"w",
|
|
1456
|
+
"nw"
|
|
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
|
+
};
|
|
1495
|
+
var JIBBLE_ANIMATION = {
|
|
1496
|
+
Idle: {
|
|
1497
|
+
North: "idle_n",
|
|
1498
|
+
NorthEast: "idle_ne",
|
|
1499
|
+
East: "idle_e",
|
|
1500
|
+
SouthEast: "idle_se",
|
|
1501
|
+
South: "idle_s",
|
|
1502
|
+
SouthWest: "idle_sw",
|
|
1503
|
+
West: "idle_w",
|
|
1504
|
+
NorthWest: "idle_nw"
|
|
1505
|
+
},
|
|
1506
|
+
Walk: {
|
|
1507
|
+
North: "walk_n",
|
|
1508
|
+
NorthEast: "walk_ne",
|
|
1509
|
+
East: "walk_e",
|
|
1510
|
+
SouthEast: "walk_se",
|
|
1511
|
+
South: "walk_s",
|
|
1512
|
+
SouthWest: "walk_sw",
|
|
1513
|
+
West: "walk_w",
|
|
1514
|
+
NorthWest: "walk_nw"
|
|
1515
|
+
},
|
|
1516
|
+
Backflip: "backflip"
|
|
1517
|
+
};
|
|
1518
|
+
var JIBBLE_ANIMATION_IDS = [
|
|
1519
|
+
JIBBLE_ANIMATION.Idle.North,
|
|
1520
|
+
JIBBLE_ANIMATION.Idle.NorthEast,
|
|
1521
|
+
JIBBLE_ANIMATION.Idle.East,
|
|
1522
|
+
JIBBLE_ANIMATION.Idle.SouthEast,
|
|
1523
|
+
JIBBLE_ANIMATION.Idle.South,
|
|
1524
|
+
JIBBLE_ANIMATION.Idle.SouthWest,
|
|
1525
|
+
JIBBLE_ANIMATION.Idle.West,
|
|
1526
|
+
JIBBLE_ANIMATION.Idle.NorthWest,
|
|
1527
|
+
JIBBLE_ANIMATION.Walk.North,
|
|
1528
|
+
JIBBLE_ANIMATION.Walk.NorthEast,
|
|
1529
|
+
JIBBLE_ANIMATION.Walk.East,
|
|
1530
|
+
JIBBLE_ANIMATION.Walk.SouthEast,
|
|
1531
|
+
JIBBLE_ANIMATION.Walk.South,
|
|
1532
|
+
JIBBLE_ANIMATION.Walk.SouthWest,
|
|
1533
|
+
JIBBLE_ANIMATION.Walk.West,
|
|
1534
|
+
JIBBLE_ANIMATION.Walk.NorthWest,
|
|
1535
|
+
JIBBLE_ANIMATION.Backflip
|
|
1536
|
+
];
|
|
1537
|
+
function normalizeJibbleDirection(direction) {
|
|
1538
|
+
return JIBBLE_DIRECTION_ALIASES[direction];
|
|
1539
|
+
}
|
|
1540
|
+
function getJibbleAnimationId(action, direction = "front") {
|
|
1541
|
+
if (action === "backflip") {
|
|
1542
|
+
return JIBBLE_ANIMATION.Backflip;
|
|
1543
|
+
}
|
|
1544
|
+
return `${action}_${normalizeJibbleDirection(direction)}`;
|
|
1545
|
+
}
|
|
1546
|
+
|
|
1447
1547
|
// src/log-overlay.ts
|
|
1448
1548
|
var CONSOLE_METHODS = [
|
|
1449
1549
|
"debug",
|
|
@@ -3290,6 +3390,10 @@ function getGraphicsPerformance() {
|
|
|
3290
3390
|
var oasiz = {
|
|
3291
3391
|
submitScore,
|
|
3292
3392
|
enableAppSimulator,
|
|
3393
|
+
getJibbleAnimationId,
|
|
3394
|
+
jibbleAnimations: JIBBLE_ANIMATION,
|
|
3395
|
+
jibbleAnimationIds: JIBBLE_ANIMATION_IDS,
|
|
3396
|
+
jibbleDirections: JIBBLE_DIRECTIONS,
|
|
3293
3397
|
addScore,
|
|
3294
3398
|
setScore,
|
|
3295
3399
|
getPlayerCharacter,
|
|
@@ -3337,6 +3441,9 @@ var oasiz = {
|
|
|
3337
3441
|
}
|
|
3338
3442
|
};
|
|
3339
3443
|
export {
|
|
3444
|
+
JIBBLE_ANIMATION,
|
|
3445
|
+
JIBBLE_ANIMATION_IDS,
|
|
3446
|
+
JIBBLE_DIRECTIONS,
|
|
3340
3447
|
addScore,
|
|
3341
3448
|
enableAppSimulator,
|
|
3342
3449
|
enableBackButtonTesting,
|
|
@@ -3344,6 +3451,7 @@ export {
|
|
|
3344
3451
|
flushGameState,
|
|
3345
3452
|
getGameId,
|
|
3346
3453
|
getGraphicsPerformance,
|
|
3454
|
+
getJibbleAnimationId,
|
|
3347
3455
|
getPlayerAvatar,
|
|
3348
3456
|
getPlayerCharacter,
|
|
3349
3457
|
getPlayerId,
|
|
@@ -3353,6 +3461,7 @@ export {
|
|
|
3353
3461
|
getViewportInsets,
|
|
3354
3462
|
leaveGame,
|
|
3355
3463
|
loadGameState,
|
|
3464
|
+
normalizeJibbleDirection,
|
|
3356
3465
|
oasiz,
|
|
3357
3466
|
onBackButton,
|
|
3358
3467
|
onLeaveGame,
|