@oasiz/sdk 1.2.1 → 1.4.0
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 +2 -63
- package/dist/index.cjs +129 -911
- package/dist/index.d.cts +96 -40
- package/dist/index.d.ts +96 -40
- package/dist/index.js +119 -909
- package/package.json +1 -1
- package/dist/index.global.js +0 -252
package/README.md
CHANGED
|
@@ -35,12 +35,6 @@ oasiz.triggerHaptic("medium");
|
|
|
35
35
|
|
|
36
36
|
// 5. Submit score when the game ends
|
|
37
37
|
oasiz.submitScore(score);
|
|
38
|
-
|
|
39
|
-
// 6. Optionally surface console logs in-game while debugging
|
|
40
|
-
oasiz.enableLogOverlay({
|
|
41
|
-
enabled: new URLSearchParams(window.location.search).has("oasizLogs"),
|
|
42
|
-
collapsed: true,
|
|
43
|
-
});
|
|
44
38
|
```
|
|
45
39
|
|
|
46
40
|
---
|
|
@@ -134,34 +128,6 @@ Haptics are throttled internally (50ms cooldown) to prevent spam.
|
|
|
134
128
|
|
|
135
129
|
---
|
|
136
130
|
|
|
137
|
-
## Debugging
|
|
138
|
-
|
|
139
|
-
### `oasiz.enableLogOverlay(options?: LogOverlayOptions)`
|
|
140
|
-
|
|
141
|
-
Mount an opt-in in-game console viewer for local debugging, QA sessions, or creator support. It mirrors `console.log`, `console.info`, `console.warn`, `console.error`, and `console.debug` into a floating overlay inside the game iframe. The overlay can be collapsed, repositioned by dragging the top bar, and resized from the bottom-right corner while the action buttons remain clickable.
|
|
142
|
-
|
|
143
|
-
```ts
|
|
144
|
-
const logOverlay = oasiz.enableLogOverlay({
|
|
145
|
-
enabled: new URLSearchParams(window.location.search).has("oasizLogs"),
|
|
146
|
-
collapsed: true,
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
console.log("[Boot] Scene ready");
|
|
150
|
-
|
|
151
|
-
// Optional cleanup if your game tears down and remounts
|
|
152
|
-
logOverlay.destroy();
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
Options:
|
|
156
|
-
- `enabled`: defaults to `true`. Pass your own flag or query-param check here.
|
|
157
|
-
- `collapsed`: start with only the toggle pill visible.
|
|
158
|
-
- `maxEntries`: cap retained log lines. Defaults to `200`.
|
|
159
|
-
- `title`: optional label shown at the top of the panel. Defaults to `SDK Logs`.
|
|
160
|
-
|
|
161
|
-
The returned handle supports `show()`, `hide()`, `clear()`, `isVisible()`, and `destroy()`.
|
|
162
|
-
|
|
163
|
-
---
|
|
164
|
-
|
|
165
131
|
## Game state persistence
|
|
166
132
|
|
|
167
133
|
Persist cross-session data such as unlocked levels, inventory, or lifetime stats. State is stored per-user per-game in the Oasiz backend — available across devices and app reinstalls.
|
|
@@ -294,12 +260,10 @@ offLeave();
|
|
|
294
260
|
|
|
295
261
|
## Multiplayer
|
|
296
262
|
|
|
297
|
-
### `oasiz.shareRoomCode(code: string | null
|
|
263
|
+
### `oasiz.shareRoomCode(code: string | null)`
|
|
298
264
|
|
|
299
265
|
Notify the platform of the active multiplayer room so friends can join via the invite system. Pass `null` when leaving a room.
|
|
300
266
|
|
|
301
|
-
Set `inviteOverride: true` when your game wants to hide the platform invite pill and render its own invite button/UI. The platform still tracks the room code, but your game owns the invite entry point.
|
|
302
|
-
|
|
303
267
|
```ts
|
|
304
268
|
import { insertCoin, getRoomCode } from "playroomkit";
|
|
305
269
|
import { oasiz } from "@oasiz/sdk";
|
|
@@ -311,23 +275,6 @@ oasiz.shareRoomCode(getRoomCode());
|
|
|
311
275
|
oasiz.shareRoomCode(null);
|
|
312
276
|
```
|
|
313
277
|
|
|
314
|
-
```ts
|
|
315
|
-
// Game-owned invite UI: hide the platform pill, keep room tracking
|
|
316
|
-
oasiz.shareRoomCode(getRoomCode(), { inviteOverride: true });
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
If you still want to use the platform invite sheet from your own in-game button, combine it with `openInviteModal()`:
|
|
320
|
-
|
|
321
|
-
```ts
|
|
322
|
-
import { openInviteModal, shareRoomCode } from "@oasiz/sdk";
|
|
323
|
-
|
|
324
|
-
shareRoomCode("ABCD", { inviteOverride: true });
|
|
325
|
-
|
|
326
|
-
inviteButton.addEventListener("click", () => {
|
|
327
|
-
openInviteModal();
|
|
328
|
-
});
|
|
329
|
-
```
|
|
330
|
-
|
|
331
278
|
### Read-only injected values
|
|
332
279
|
|
|
333
280
|
These are populated by the platform before the game loads. Always check for `undefined` before using.
|
|
@@ -361,7 +308,6 @@ import {
|
|
|
361
308
|
saveGameState,
|
|
362
309
|
flushGameState,
|
|
363
310
|
shareRoomCode,
|
|
364
|
-
enableLogOverlay,
|
|
365
311
|
onPause,
|
|
366
312
|
onResume,
|
|
367
313
|
onBackButton,
|
|
@@ -379,14 +325,7 @@ import {
|
|
|
379
325
|
## TypeScript types
|
|
380
326
|
|
|
381
327
|
```ts
|
|
382
|
-
import type {
|
|
383
|
-
GameState,
|
|
384
|
-
HapticType,
|
|
385
|
-
LogOverlayHandle,
|
|
386
|
-
LogOverlayOptions,
|
|
387
|
-
ScoreAnchor,
|
|
388
|
-
ScoreConfig,
|
|
389
|
-
} from "@oasiz/sdk";
|
|
328
|
+
import type { HapticType, ScoreConfig, ScoreAnchor, GameState } from "@oasiz/sdk";
|
|
390
329
|
```
|
|
391
330
|
|
|
392
331
|
---
|