@oasiz/sdk 1.8.1 → 1.8.3
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 +571 -80
- package/dist/index.cjs +3166 -225
- package/dist/index.d.cts +362 -110
- package/dist/index.d.ts +362 -110
- package/dist/index.js +3149 -214
- package/package.json +15 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,143 @@
|
|
|
1
|
+
type GraphicsPerformanceTier = "minimal" | "low" | "medium" | "high";
|
|
2
|
+
interface GraphicsPerformanceMetric {
|
|
3
|
+
/** Recommended graphics/rendering frame-rate target for the current device. */
|
|
4
|
+
fps: number;
|
|
5
|
+
/** Suggested graphics/rendering tier for the current device. */
|
|
6
|
+
tier: GraphicsPerformanceTier;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Return the current device's recommended graphics performance profile.
|
|
10
|
+
*
|
|
11
|
+
* Hosts can provide an FPS/tier recommendation through
|
|
12
|
+
* `window.getGraphicsPerformance()` or `window.__OASIZ_GRAPHICS_PERFORMANCE__`.
|
|
13
|
+
* When no host value exists, the SDK estimates from browser/device/WebGL
|
|
14
|
+
* capability signals so games still get a usable recommendation in local
|
|
15
|
+
* development and unsupported hosts.
|
|
16
|
+
*/
|
|
17
|
+
declare function getGraphicsPerformance(): GraphicsPerformanceMetric;
|
|
18
|
+
|
|
19
|
+
type ViewportInsetSide = "top" | "right" | "bottom" | "left";
|
|
20
|
+
interface ViewportInsetEdges {
|
|
21
|
+
top: number;
|
|
22
|
+
right: number;
|
|
23
|
+
bottom: number;
|
|
24
|
+
left: number;
|
|
25
|
+
}
|
|
26
|
+
interface ViewportInsets {
|
|
27
|
+
pixels: ViewportInsetEdges;
|
|
28
|
+
percent: ViewportInsetEdges;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Effective viewport insets that game UI should avoid.
|
|
32
|
+
*
|
|
33
|
+
* `top` preserves the existing Oasiz game-safe top behavior: host chrome and
|
|
34
|
+
* invite/leaderboard clearance can contribute to it. Other sides are device
|
|
35
|
+
* safe-area insets today, and can include future host UI obstructions.
|
|
36
|
+
*/
|
|
37
|
+
declare function getViewportInsets(): ViewportInsets;
|
|
38
|
+
/**
|
|
39
|
+
* Legacy alias for the top entry of `getViewportInsets().percent`.
|
|
40
|
+
*/
|
|
41
|
+
declare function getSafeAreaTop(): number;
|
|
42
|
+
declare function setLeaderboardVisible(visible: boolean): void;
|
|
43
|
+
|
|
44
|
+
type Unsubscribe = () => void;
|
|
45
|
+
declare function onPause(callback: () => void): Unsubscribe;
|
|
46
|
+
declare function onResume(callback: () => void): Unsubscribe;
|
|
47
|
+
|
|
48
|
+
interface BackButtonTestingOptions {
|
|
49
|
+
/**
|
|
50
|
+
* When true, pressing Escape dispatches the same event the host app sends for
|
|
51
|
+
* back actions. Defaults to true.
|
|
52
|
+
*/
|
|
53
|
+
keyboard?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* When true, the SDK traps one browser-history entry while back override is
|
|
56
|
+
* active, so the browser Back button can be used for local testing. Defaults
|
|
57
|
+
* to true.
|
|
58
|
+
*/
|
|
59
|
+
browserHistory?: boolean;
|
|
60
|
+
/** Log setup details to the console. Defaults to false. */
|
|
61
|
+
log?: boolean;
|
|
62
|
+
}
|
|
63
|
+
interface BackButtonTestingHandle {
|
|
64
|
+
destroy: () => void;
|
|
65
|
+
isBackOverrideActive: () => boolean;
|
|
66
|
+
triggerBack: () => void;
|
|
67
|
+
triggerLeave: () => void;
|
|
68
|
+
}
|
|
69
|
+
declare function enableBackButtonTesting(options?: BackButtonTestingOptions): BackButtonTestingHandle;
|
|
70
|
+
declare function onBackButton(callback: () => void): Unsubscribe;
|
|
71
|
+
declare function onLeaveGame(callback: () => void): Unsubscribe;
|
|
72
|
+
declare function leaveGame(): void;
|
|
73
|
+
|
|
74
|
+
type AppSimulatorDeviceName = "iphone-11" | "iphone-11-pro" | "iphone-11-pro-max" | "iphone-12-mini" | "iphone-12" | "iphone-12-pro" | "iphone-12-pro-max" | "iphone-13-mini" | "iphone-13" | "iphone-13-pro" | "iphone-13-pro-max" | "iphone-14" | "iphone-14-plus" | "iphone-14-pro" | "iphone-14-pro-max" | "iphone-15" | "iphone-15-plus" | "iphone-15-pro" | "iphone-15-pro-max" | "iphone-16" | "iphone-16-plus" | "iphone-16-pro" | "iphone-16-pro-max" | "iphone-16e" | "iphone-17" | "iphone-17-pro" | "iphone-17-pro-max" | "iphone-17e" | "iphone-air" | "iphone-se" | "pixel-8";
|
|
75
|
+
type AppSimulatorOrientation = "portrait" | "landscape";
|
|
76
|
+
interface AppSimulatorDevice {
|
|
77
|
+
height: number;
|
|
78
|
+
name?: string;
|
|
79
|
+
safeArea?: Partial<ViewportInsetEdges>;
|
|
80
|
+
width: number;
|
|
81
|
+
}
|
|
82
|
+
interface AppSimulatorOptions {
|
|
83
|
+
browserHistoryBack?: BackButtonTestingOptions["browserHistory"];
|
|
84
|
+
comments?: number;
|
|
85
|
+
device?: AppSimulatorDeviceName | AppSimulatorDevice;
|
|
86
|
+
enabled?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* When true, the SDK tries to place the current game DOM inside a centered
|
|
89
|
+
* phone viewport on desktop. Use false if your game already runs in browser
|
|
90
|
+
* device emulation or owns its own preview frame. Defaults to true.
|
|
91
|
+
*/
|
|
92
|
+
frame?: boolean | "auto";
|
|
93
|
+
keyboardBack?: BackButtonTestingOptions["keyboard"];
|
|
94
|
+
leaderboardVisible?: boolean;
|
|
95
|
+
likes?: number;
|
|
96
|
+
log?: boolean;
|
|
97
|
+
orientation?: AppSimulatorOrientation;
|
|
98
|
+
score?: number;
|
|
99
|
+
title?: string;
|
|
100
|
+
}
|
|
101
|
+
interface AppSimulatorHandle {
|
|
102
|
+
closeSheet: () => void;
|
|
103
|
+
destroy: () => void;
|
|
104
|
+
getViewportInsets: () => ViewportInsets;
|
|
105
|
+
hide: () => void;
|
|
106
|
+
isVisible: () => boolean;
|
|
107
|
+
openComments: () => void;
|
|
108
|
+
openLeaderboard: () => void;
|
|
109
|
+
setCounts: (counts: {
|
|
110
|
+
comments?: number;
|
|
111
|
+
likes?: number;
|
|
112
|
+
}) => void;
|
|
113
|
+
setLeaderboardVisible: (visible: boolean) => void;
|
|
114
|
+
setLiked: (liked: boolean) => void;
|
|
115
|
+
show: () => void;
|
|
116
|
+
triggerBack: () => void;
|
|
117
|
+
triggerLeave: () => void;
|
|
118
|
+
}
|
|
119
|
+
declare function enableAppSimulator(options?: AppSimulatorOptions): AppSimulatorHandle;
|
|
120
|
+
|
|
1
121
|
type HapticType = "light" | "medium" | "heavy" | "success" | "error";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
122
|
+
type LogOverlayLevel = "debug" | "log" | "info" | "warn" | "error";
|
|
123
|
+
interface LogOverlayEntry {
|
|
124
|
+
id: number;
|
|
125
|
+
level: LogOverlayLevel;
|
|
126
|
+
message: string;
|
|
127
|
+
timestamp: number;
|
|
5
128
|
}
|
|
6
|
-
interface
|
|
7
|
-
|
|
129
|
+
interface LogOverlayOptions {
|
|
130
|
+
collapsed?: boolean;
|
|
131
|
+
enabled?: boolean;
|
|
132
|
+
maxEntries?: number;
|
|
133
|
+
title?: string;
|
|
134
|
+
}
|
|
135
|
+
interface LogOverlayHandle {
|
|
136
|
+
clear: () => void;
|
|
137
|
+
destroy: () => void;
|
|
138
|
+
hide: () => void;
|
|
139
|
+
isVisible: () => boolean;
|
|
140
|
+
show: () => void;
|
|
8
141
|
}
|
|
9
142
|
type GameState = Record<string, unknown>;
|
|
10
143
|
interface ShareRequest {
|
|
@@ -12,88 +145,198 @@ interface ShareRequest {
|
|
|
12
145
|
score?: number;
|
|
13
146
|
text?: string;
|
|
14
147
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
interface StoreProduct {
|
|
27
|
-
description: string | null;
|
|
28
|
-
gameId: string;
|
|
29
|
-
jemPrice: number;
|
|
30
|
-
metadata: Record<string, unknown>;
|
|
31
|
-
productId: string;
|
|
32
|
-
status: StoreProductStatus;
|
|
33
|
-
title: string;
|
|
34
|
-
type: StoreProductType;
|
|
35
|
-
version: number;
|
|
36
|
-
}
|
|
37
|
-
interface StoreEntitlement {
|
|
38
|
-
gameId: string;
|
|
39
|
-
grantedAt: string | null;
|
|
40
|
-
lastEventId: string | null;
|
|
41
|
-
owned: boolean;
|
|
42
|
-
productId: string;
|
|
43
|
-
quantity: number;
|
|
44
|
-
status: StoreEntitlementStatus;
|
|
45
|
-
updatedAt: string;
|
|
46
|
-
}
|
|
47
|
-
interface StoreStateSnapshot {
|
|
48
|
-
catalogVersion: number;
|
|
49
|
-
entitlements: StoreEntitlement[];
|
|
50
|
-
gameId: string;
|
|
51
|
-
jemBalance: number;
|
|
52
|
-
products: StoreProduct[];
|
|
53
|
-
}
|
|
54
|
-
interface StorePurchaseSuccess {
|
|
55
|
-
attemptId: string;
|
|
56
|
-
entitlement: StoreEntitlement;
|
|
57
|
-
jemBalance: number;
|
|
58
|
-
ok: true;
|
|
59
|
-
state: StoreStateSnapshot;
|
|
60
|
-
transactionId: string;
|
|
61
|
-
}
|
|
62
|
-
interface StorePurchaseFailure {
|
|
63
|
-
attemptId: string;
|
|
64
|
-
code: "ALREADY_OWNED" | "INSUFFICIENT_JEMS" | "INVALID_PRODUCT" | "PRODUCT_DISABLED" | "INVALID_QUANTITY" | "ENTITLEMENT_EXHAUSTED" | "STALE_CATALOG_VERSION" | "UNAUTHORIZED";
|
|
65
|
-
jemBalance: number;
|
|
66
|
-
message: string;
|
|
67
|
-
ok: false;
|
|
68
|
-
state?: StoreStateSnapshot;
|
|
69
|
-
topUpIntentId?: string;
|
|
70
|
-
topUpRedirectUrl?: string;
|
|
71
|
-
}
|
|
72
|
-
type StorePurchaseResult = StorePurchaseSuccess | StorePurchaseFailure;
|
|
73
|
-
interface StoreConsumeSuccess {
|
|
74
|
-
entitlement: StoreEntitlement;
|
|
75
|
-
ok: true;
|
|
76
|
-
state: StoreStateSnapshot;
|
|
77
|
-
}
|
|
78
|
-
interface StoreConsumeFailure {
|
|
79
|
-
code: "INVALID_PRODUCT" | "INVALID_QUANTITY" | "NOT_CONSUMABLE" | "ENTITLEMENT_EXHAUSTED";
|
|
80
|
-
jemBalance: number;
|
|
81
|
-
message: string;
|
|
82
|
-
ok: false;
|
|
83
|
-
state?: StoreStateSnapshot;
|
|
148
|
+
/**
|
|
149
|
+
* One frame in a texture atlas. Coordinates are in pixels, top-left origin
|
|
150
|
+
* (matches HTML canvas / WebGL texture coordinates after Y-flip).
|
|
151
|
+
*/
|
|
152
|
+
interface TextureAtlasFrame {
|
|
153
|
+
name: string;
|
|
154
|
+
x: number;
|
|
155
|
+
y: number;
|
|
156
|
+
width: number;
|
|
157
|
+
height: number;
|
|
84
158
|
}
|
|
85
|
-
|
|
159
|
+
/**
|
|
160
|
+
* Per-direction frame indexes inside an animation. `left` is either an
|
|
161
|
+
* integer index or the literal string `"mirror"`, indicating the renderer
|
|
162
|
+
* should mirror the right-facing frame instead of using a dedicated one.
|
|
163
|
+
*/
|
|
164
|
+
interface FacingFrameMap {
|
|
165
|
+
front: number;
|
|
166
|
+
back: number;
|
|
167
|
+
right: number;
|
|
168
|
+
left: number | "mirror";
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* One named animation in a texture atlas. `frames` is the playback-ordered
|
|
172
|
+
* list of frame names; resolve each name against the parent atlas's
|
|
173
|
+
* `frames` array to get pixel coordinates.
|
|
174
|
+
*/
|
|
175
|
+
interface TextureAtlasAnimation {
|
|
176
|
+
animationId: string;
|
|
177
|
+
role: string | null;
|
|
178
|
+
group: string | null;
|
|
179
|
+
direction: string | null;
|
|
180
|
+
frameRate: number;
|
|
181
|
+
frames: string[];
|
|
182
|
+
facingFrameMap: FacingFrameMap | null;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* TexturePacker / Phaser-style texture atlas describing a baked sprite
|
|
186
|
+
* image. Drop-in compatible with Phaser via `addAtlas(key, img, atlas)`
|
|
187
|
+
* after a tiny shape transform; usable directly in custom GL renderers.
|
|
188
|
+
*/
|
|
189
|
+
interface TextureAtlas {
|
|
190
|
+
imageUrl: string;
|
|
191
|
+
imageWidth: number;
|
|
192
|
+
imageHeight: number;
|
|
193
|
+
frames: TextureAtlasFrame[];
|
|
194
|
+
animations: TextureAtlasAnimation[];
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* The authenticated player's character, returned by `getPlayerCharacter()`.
|
|
198
|
+
* `editorTextureAtlas` is the higher-detail variant intended for character
|
|
199
|
+
* previews / customizer UI and may be `null`.
|
|
200
|
+
*/
|
|
201
|
+
interface PlayerCharacter {
|
|
202
|
+
characterName: string | null;
|
|
203
|
+
baseCharacterId: string;
|
|
204
|
+
compositionCode: string;
|
|
205
|
+
textureAtlas: TextureAtlas;
|
|
206
|
+
editorTextureAtlas: TextureAtlas | null;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Result of `addScore(delta)` / `setScore(score)`. Returns `null` when the
|
|
210
|
+
* host bridge is unavailable (e.g. local development) or when the backend
|
|
211
|
+
* refused the request; production code should treat `null` as "no change
|
|
212
|
+
* was persisted, do not update local UI".
|
|
213
|
+
*/
|
|
214
|
+
interface ScoreEditResult {
|
|
215
|
+
playerId: string;
|
|
216
|
+
previousScore: number;
|
|
217
|
+
newScore: number;
|
|
218
|
+
previousWeeklyScore: number;
|
|
219
|
+
newWeeklyScore: number;
|
|
220
|
+
normalizedScore: number | null;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Fetch the authenticated player's character, including a TexturePacker /
|
|
225
|
+
* Phaser-style texture atlas describing the baked sprite image.
|
|
226
|
+
*
|
|
227
|
+
* Returns:
|
|
228
|
+
* - `null` when the user has no character composition yet, OR
|
|
229
|
+
* - `null` when the host bridge is unavailable (local dev / unauthenticated)
|
|
230
|
+
*
|
|
231
|
+
* The host transparently caches and proxies to `GET /api/sdk/me/character`,
|
|
232
|
+
* so calling this multiple times in a session is cheap. The returned
|
|
233
|
+
* `imageUrl` is content-addressed (R2 key derives from the composition
|
|
234
|
+
* hash), so games can safely cache the downloaded texture by `compositionCode`.
|
|
235
|
+
*
|
|
236
|
+
* Example (Phaser):
|
|
237
|
+
*
|
|
238
|
+
* const character = await oasiz.getPlayerCharacter();
|
|
239
|
+
* if (!character) return;
|
|
240
|
+
* const atlas = character.textureAtlas;
|
|
241
|
+
* scene.load.image("player-tex", atlas.imageUrl);
|
|
242
|
+
* scene.load.atlas("player", atlas.imageUrl, {
|
|
243
|
+
* frames: Object.fromEntries(
|
|
244
|
+
* atlas.frames.map((f) => [f.name, { frame: { x: f.x, y: f.y, w: f.width, h: f.height } }]),
|
|
245
|
+
* ),
|
|
246
|
+
* });
|
|
247
|
+
*/
|
|
248
|
+
declare function getPlayerCharacter(): Promise<PlayerCharacter | null>;
|
|
86
249
|
|
|
87
250
|
declare function triggerHaptic(type: HapticType): void;
|
|
88
251
|
|
|
89
|
-
declare
|
|
252
|
+
declare const JIBBLE_DIRECTIONS: readonly ["n", "ne", "e", "se", "s", "sw", "w", "nw"];
|
|
253
|
+
type JibbleDirectionCode = (typeof JIBBLE_DIRECTIONS)[number];
|
|
254
|
+
type JibbleFacingDirection = JibbleDirectionCode | "front" | "back" | "left" | "right";
|
|
255
|
+
type JibbleAnimationAction = "idle" | "walk" | "backflip";
|
|
256
|
+
declare const JIBBLE_ANIMATION: {
|
|
257
|
+
readonly Idle: {
|
|
258
|
+
readonly North: "idle_n";
|
|
259
|
+
readonly NorthEast: "idle_ne";
|
|
260
|
+
readonly East: "idle_e";
|
|
261
|
+
readonly SouthEast: "idle_se";
|
|
262
|
+
readonly South: "idle_s";
|
|
263
|
+
readonly SouthWest: "idle_sw";
|
|
264
|
+
readonly West: "idle_w";
|
|
265
|
+
readonly NorthWest: "idle_nw";
|
|
266
|
+
};
|
|
267
|
+
readonly Walk: {
|
|
268
|
+
readonly North: "walk_n";
|
|
269
|
+
readonly NorthEast: "walk_ne";
|
|
270
|
+
readonly East: "walk_e";
|
|
271
|
+
readonly SouthEast: "walk_se";
|
|
272
|
+
readonly South: "walk_s";
|
|
273
|
+
readonly SouthWest: "walk_sw";
|
|
274
|
+
readonly West: "walk_w";
|
|
275
|
+
readonly NorthWest: "walk_nw";
|
|
276
|
+
};
|
|
277
|
+
readonly Backflip: "backflip";
|
|
278
|
+
};
|
|
279
|
+
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"];
|
|
280
|
+
type JibbleAnimationId = (typeof JIBBLE_ANIMATION_IDS)[number];
|
|
281
|
+
declare function normalizeJibbleDirection(direction: JibbleFacingDirection): JibbleDirectionCode;
|
|
282
|
+
declare function getJibbleAnimationId(action: JibbleAnimationAction, direction?: JibbleFacingDirection): JibbleAnimationId;
|
|
283
|
+
|
|
284
|
+
declare function enableLogOverlay(options?: LogOverlayOptions): LogOverlayHandle;
|
|
285
|
+
|
|
286
|
+
interface ShareRoomCodeOptions {
|
|
287
|
+
inviteOverride?: boolean;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Notify the platform of the active multiplayer room so friends can join.
|
|
291
|
+
* Pass `{ inviteOverride: true }` when the game wants to hide the platform
|
|
292
|
+
* invite pill and own the invite UI itself.
|
|
293
|
+
*/
|
|
294
|
+
declare function shareRoomCode(roomCode: string | null, options?: ShareRoomCodeOptions): void;
|
|
295
|
+
/**
|
|
296
|
+
* Ask the platform to open the invite-friends modal for the current game room.
|
|
297
|
+
* Only has effect when the platform has a room code (game has called shareRoomCode).
|
|
298
|
+
* No-op when the bridge is unavailable (e.g. local development).
|
|
299
|
+
*/
|
|
300
|
+
declare function openInviteModal(): void;
|
|
90
301
|
declare function getGameId(): string | undefined;
|
|
91
302
|
declare function getRoomCode(): string | undefined;
|
|
303
|
+
/**
|
|
304
|
+
* Stable, unique, opaque identifier for the authenticated player, injected
|
|
305
|
+
* by the platform. Safe to use as a primary key for save slots, matchmaking,
|
|
306
|
+
* per-player analytics, or anywhere you need a reliable per-user key —
|
|
307
|
+
* unlike `getPlayerName()` (mutable, not unique).
|
|
308
|
+
*
|
|
309
|
+
* Mirrors the backend's `playerId` field returned by `GET /api/sdk/me`
|
|
310
|
+
* (= the Better Auth `user.id`). Returns `undefined` when the platform
|
|
311
|
+
* has not injected an identity (e.g. unauthenticated preview).
|
|
312
|
+
*/
|
|
313
|
+
declare function getPlayerId(): string | undefined;
|
|
92
314
|
declare function getPlayerName(): string | undefined;
|
|
93
315
|
declare function getPlayerAvatar(): string | undefined;
|
|
94
316
|
|
|
95
317
|
declare function submitScore(score: number): void;
|
|
96
|
-
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Add (or subtract) `delta` from the player's current score for this game.
|
|
321
|
+
* The new score is clamped to >= 0 server-side.
|
|
322
|
+
*
|
|
323
|
+
* Unlike `submitScore()` (which is high-water and only ever raises the
|
|
324
|
+
* score), this endpoint always overwrites the row. Use it for game models
|
|
325
|
+
* where the leaderboard tracks an accumulator, balance, or persistent state
|
|
326
|
+
* instead of a single best-run value.
|
|
327
|
+
*
|
|
328
|
+
* Returns the resulting score values, or `null` when the bridge is
|
|
329
|
+
* unavailable. The integer must be a non-zero integer (positive or negative).
|
|
330
|
+
*/
|
|
331
|
+
declare function addScore(delta: number): Promise<ScoreEditResult | null>;
|
|
332
|
+
/**
|
|
333
|
+
* Force the player's score to an absolute value (clamped to >= 0).
|
|
334
|
+
*
|
|
335
|
+
* Same overwrite semantics as `addScore`. Use when the game has computed
|
|
336
|
+
* the authoritative score locally (e.g. after offline play) and wants to
|
|
337
|
+
* sync it back to the leaderboard.
|
|
338
|
+
*/
|
|
339
|
+
declare function setScore(score: number): Promise<ScoreEditResult | null>;
|
|
97
340
|
|
|
98
341
|
declare function share(options: ShareRequest): Promise<void>;
|
|
99
342
|
|
|
@@ -101,55 +344,64 @@ declare function loadGameState(): GameState;
|
|
|
101
344
|
declare function saveGameState(state: GameState): void;
|
|
102
345
|
declare function flushGameState(): void;
|
|
103
346
|
|
|
104
|
-
type Unsubscribe = () => void;
|
|
105
|
-
declare function onPause(callback: () => void): Unsubscribe;
|
|
106
|
-
declare function onResume(callback: () => void): Unsubscribe;
|
|
107
|
-
|
|
108
|
-
declare function onBackButton(callback: () => void): Unsubscribe;
|
|
109
|
-
declare function onLeaveGame(callback: () => void): Unsubscribe;
|
|
110
|
-
declare function leaveGame(): void;
|
|
111
|
-
|
|
112
|
-
declare function syncProducts(products: StoreManifestProduct[], expectedVersion?: number | null): Promise<StoreStateSnapshot>;
|
|
113
|
-
declare function getProducts(): Promise<StoreProduct[]>;
|
|
114
|
-
declare function getEntitlements(): Promise<StoreEntitlement[]>;
|
|
115
|
-
declare function hasEntitlement(productId: string): Promise<boolean>;
|
|
116
|
-
declare function getQuantity(productId: string): Promise<number>;
|
|
117
|
-
declare function purchase(productId: string, quantity?: number): Promise<StorePurchaseResult>;
|
|
118
|
-
declare function consume(productId: string, quantity?: number): Promise<StoreConsumeResult>;
|
|
119
|
-
declare function getJemBalance(): Promise<number>;
|
|
120
|
-
declare function onEntitlementsChanged(callback: (entitlements: StoreEntitlement[]) => void): () => void;
|
|
121
|
-
declare function onJemBalanceChanged(callback: (jemBalance: number) => void): () => void;
|
|
122
|
-
|
|
123
347
|
declare const oasiz: {
|
|
124
348
|
submitScore: typeof submitScore;
|
|
125
|
-
|
|
349
|
+
enableAppSimulator: typeof enableAppSimulator;
|
|
350
|
+
getJibbleAnimationId: typeof getJibbleAnimationId;
|
|
351
|
+
jibbleAnimations: {
|
|
352
|
+
readonly Idle: {
|
|
353
|
+
readonly North: "idle_n";
|
|
354
|
+
readonly NorthEast: "idle_ne";
|
|
355
|
+
readonly East: "idle_e";
|
|
356
|
+
readonly SouthEast: "idle_se";
|
|
357
|
+
readonly South: "idle_s";
|
|
358
|
+
readonly SouthWest: "idle_sw";
|
|
359
|
+
readonly West: "idle_w";
|
|
360
|
+
readonly NorthWest: "idle_nw";
|
|
361
|
+
};
|
|
362
|
+
readonly Walk: {
|
|
363
|
+
readonly North: "walk_n";
|
|
364
|
+
readonly NorthEast: "walk_ne";
|
|
365
|
+
readonly East: "walk_e";
|
|
366
|
+
readonly SouthEast: "walk_se";
|
|
367
|
+
readonly South: "walk_s";
|
|
368
|
+
readonly SouthWest: "walk_sw";
|
|
369
|
+
readonly West: "walk_w";
|
|
370
|
+
readonly NorthWest: "walk_nw";
|
|
371
|
+
};
|
|
372
|
+
readonly Backflip: "backflip";
|
|
373
|
+
};
|
|
374
|
+
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"];
|
|
375
|
+
jibbleDirections: readonly ["n", "ne", "e", "se", "s", "sw", "w", "nw"];
|
|
376
|
+
addScore: typeof addScore;
|
|
377
|
+
setScore: typeof setScore;
|
|
378
|
+
getPlayerCharacter: typeof getPlayerCharacter;
|
|
126
379
|
share: typeof share;
|
|
127
380
|
triggerHaptic: typeof triggerHaptic;
|
|
381
|
+
enableLogOverlay: typeof enableLogOverlay;
|
|
128
382
|
loadGameState: typeof loadGameState;
|
|
129
383
|
saveGameState: typeof saveGameState;
|
|
130
384
|
flushGameState: typeof flushGameState;
|
|
131
385
|
shareRoomCode: typeof shareRoomCode;
|
|
386
|
+
openInviteModal: typeof openInviteModal;
|
|
132
387
|
onPause: typeof onPause;
|
|
133
388
|
onResume: typeof onResume;
|
|
389
|
+
getSafeAreaTop: typeof getSafeAreaTop;
|
|
390
|
+
getViewportInsets: typeof getViewportInsets;
|
|
391
|
+
setLeaderboardVisible: typeof setLeaderboardVisible;
|
|
392
|
+
getGraphicsPerformance: typeof getGraphicsPerformance;
|
|
393
|
+
enableBackButtonTesting: typeof enableBackButtonTesting;
|
|
134
394
|
onBackButton: typeof onBackButton;
|
|
135
395
|
onLeaveGame: typeof onLeaveGame;
|
|
136
396
|
leaveGame: typeof leaveGame;
|
|
137
|
-
store: {
|
|
138
|
-
syncProducts: typeof syncProducts;
|
|
139
|
-
getProducts: typeof getProducts;
|
|
140
|
-
getEntitlements: typeof getEntitlements;
|
|
141
|
-
hasEntitlement: typeof hasEntitlement;
|
|
142
|
-
getQuantity: typeof getQuantity;
|
|
143
|
-
purchase: typeof purchase;
|
|
144
|
-
consume: typeof consume;
|
|
145
|
-
getJemBalance: typeof getJemBalance;
|
|
146
|
-
onEntitlementsChanged: typeof onEntitlementsChanged;
|
|
147
|
-
onJemBalanceChanged: typeof onJemBalanceChanged;
|
|
148
|
-
};
|
|
149
397
|
readonly gameId: string | undefined;
|
|
150
398
|
readonly roomCode: string | undefined;
|
|
399
|
+
readonly playerId: string | undefined;
|
|
151
400
|
readonly playerName: string | undefined;
|
|
152
401
|
readonly playerAvatar: string | undefined;
|
|
402
|
+
readonly safeAreaTop: number;
|
|
403
|
+
readonly viewportInsets: ViewportInsets;
|
|
404
|
+
readonly graphicsPerformance: GraphicsPerformanceMetric;
|
|
153
405
|
};
|
|
154
406
|
|
|
155
|
-
export { type GameState, type
|
|
407
|
+
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 };
|