@adminide-stack/yantra-mobile 12.0.174-alpha.0 → 12.0.174-alpha.2
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/lib/features/games/cubeforge3D.js +114 -7
- package/lib/features/games/cubeforge3D.js.map +1 -1
- package/lib/features/games/cubeforgeFriends.js +25 -4
- package/lib/features/games/cubeforgeFriends.js.map +1 -1
- package/lib/features/games/cubeforgeHelper.js +105 -0
- package/lib/features/games/cubeforgeHelper.js.map +1 -0
- package/lib/features/games/useCubeforgeFriends.js +5 -2
- package/lib/features/games/useCubeforgeFriends.js.map +1 -1
- package/lib/features/games/useCubeforgeHelper.js +25 -0
- package/lib/features/games/useCubeforgeHelper.js.map +1 -0
- package/lib/features/games/vendored/core/cubeforge/helper.js +13 -0
- package/lib/features/games/vendored/core/cubeforge/helper.js.map +1 -0
- package/lib/features/games/vendored/core/cubeforge/nativeWorlds.js +36 -1
- package/lib/features/games/vendored/core/cubeforge/nativeWorlds.js.map +1 -1
- package/lib/features/games/vendored/core/cubeforge/sharedWorlds.js.map +1 -1
- package/lib/features/games/vendored/core/cubeforge/skin.js +2 -2
- package/lib/features/games/vendored/core/cubeforge/skin.js.map +1 -1
- package/lib/features/games/vendored/ui/GamesRoot.js +25 -5
- package/lib/features/games/vendored/ui/GamesRoot.js.map +1 -1
- package/lib/features/games/vendored/ui/screens/Cubeforge3DHomeScreen.js +164 -43
- package/lib/features/games/vendored/ui/screens/Cubeforge3DHomeScreen.js.map +1 -1
- package/lib/features/games/vendored/ui/theme.js +3 -1
- package/lib/features/games/vendored/ui/theme.js.map +1 -1
- package/lib/screens/GamesNative/index.js +6 -4
- package/lib/screens/GamesNative/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import {nativeWorldKey}from'./nativeWorld.js';import {seedFromString}from'./worldgen.js';var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
2
7
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
3
20
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
21
|
const MAX_NAME_CHARS = 40;
|
|
5
22
|
const FIRST_WORLD_NAME = "My world";
|
|
@@ -40,7 +57,10 @@ class NativeWorldRepository {
|
|
|
40
57
|
}
|
|
41
58
|
/** The org's first world, then the others, newest first. */
|
|
42
59
|
async list() {
|
|
43
|
-
|
|
60
|
+
var _a;
|
|
61
|
+
const stored = await this.read();
|
|
62
|
+
const first = (_a = stored.find((w) => w.key === this.first.key)) != null ? _a : this.first;
|
|
63
|
+
return [first, ...stored.filter((w) => w.key !== this.first.key)];
|
|
44
64
|
}
|
|
45
65
|
async create(name) {
|
|
46
66
|
const worlds = await this.read();
|
|
@@ -56,6 +76,21 @@ class NativeWorldRepository {
|
|
|
56
76
|
await this.write([world, ...worlds]);
|
|
57
77
|
return world;
|
|
58
78
|
}
|
|
79
|
+
/** Give a world a new name. Returns false if there is no such world. */
|
|
80
|
+
async rename(key, name) {
|
|
81
|
+
const trimmed = name.trim().slice(0, MAX_NAME_CHARS);
|
|
82
|
+
if (!trimmed) return false;
|
|
83
|
+
const worlds = await this.read();
|
|
84
|
+
const known = worlds.some((w) => w.key === key);
|
|
85
|
+
if (!known && key !== this.first.key) return false;
|
|
86
|
+
const next = known ? worlds.map((w) => w.key === key ? __spreadProps(__spreadValues({}, w), {
|
|
87
|
+
name: trimmed
|
|
88
|
+
}) : w) : [...worlds, __spreadProps(__spreadValues({}, this.first), {
|
|
89
|
+
name: trimmed
|
|
90
|
+
})];
|
|
91
|
+
await this.write(next);
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
59
94
|
/** Forget a world. The org's first world cannot be removed. */
|
|
60
95
|
async remove(key) {
|
|
61
96
|
if (key === this.first.key) return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nativeWorlds.js","sources":["../../../../../../src/features/games/vendored/core/cubeforge/nativeWorlds.ts"],"sourcesContent":["/**\n * The list of solo 3D worlds on this device. Each world's terrain and progress\n * live in the engine's own save file, named by `key`; this is just the index.\n * The org's first world always exists and keeps the key older builds used.\n */\nimport type { KeyValueStorage } from '../storage/storage';\nimport { nativeWorldKey } from './nativeWorld';\nimport { seedFromString } from './worldgen';\n\nexport interface NativeWorld {\n key: string;\n name: string;\n seed: number;\n}\n\nconst MAX_NAME_CHARS = 40;\nconst FIRST_WORLD_NAME = 'My world';\nconst NEW_WORLD_NAME = 'New world';\n\ninterface StoredList {\n worlds: NativeWorld[];\n}\n\nfunction isNativeWorld(v: unknown): v is NativeWorld {\n const w = v as NativeWorld;\n return !!w && typeof w.key === 'string' && !!w.key && typeof w.name === 'string' && Number.isFinite(w.seed);\n}\n\nexport class NativeWorldRepository {\n private readonly storageKey: string;\n private readonly first: NativeWorld;\n\n constructor(\n private readonly storage: KeyValueStorage,\n orgName: string,\n /** Injected so tests are repeatable. */\n private readonly now: () => number = Date.now,\n ) {\n const org = orgName || 'default';\n this.storageKey = `yantra-games:cubeforge3d-worlds:${org}`;\n this.first = { key: nativeWorldKey(org), name: FIRST_WORLD_NAME, seed: seedFromString(org) };\n }\n\n private async read(): Promise<NativeWorld[]> {\n const raw = await this.storage.getItem(this.storageKey);\n if (!raw) return [];\n try {\n const parsed = JSON.parse(raw) as StoredList;\n return Array.isArray(parsed.worlds) ? parsed.worlds.filter(isNativeWorld) : [];\n } catch {\n return [];\n }\n }\n\n private async write(worlds: NativeWorld[]): Promise<void> {\n const payload: StoredList = { worlds };\n await this.storage.setItem(this.storageKey, JSON.stringify(payload));\n }\n\n /** The org's first world, then the others, newest first. */\n async list(): Promise<NativeWorld[]> {\n
|
|
1
|
+
{"version":3,"file":"nativeWorlds.js","sources":["../../../../../../src/features/games/vendored/core/cubeforge/nativeWorlds.ts"],"sourcesContent":["/**\n * The list of solo 3D worlds on this device. Each world's terrain and progress\n * live in the engine's own save file, named by `key`; this is just the index.\n * The org's first world always exists and keeps the key older builds used.\n */\nimport type { KeyValueStorage } from '../storage/storage';\nimport { nativeWorldKey } from './nativeWorld';\nimport { seedFromString } from './worldgen';\n\nexport interface NativeWorld {\n key: string;\n name: string;\n seed: number;\n}\n\nconst MAX_NAME_CHARS = 40;\nconst FIRST_WORLD_NAME = 'My world';\nconst NEW_WORLD_NAME = 'New world';\n\ninterface StoredList {\n worlds: NativeWorld[];\n}\n\nfunction isNativeWorld(v: unknown): v is NativeWorld {\n const w = v as NativeWorld;\n return !!w && typeof w.key === 'string' && !!w.key && typeof w.name === 'string' && Number.isFinite(w.seed);\n}\n\nexport class NativeWorldRepository {\n private readonly storageKey: string;\n private readonly first: NativeWorld;\n\n constructor(\n private readonly storage: KeyValueStorage,\n orgName: string,\n /** Injected so tests are repeatable. */\n private readonly now: () => number = Date.now,\n ) {\n const org = orgName || 'default';\n this.storageKey = `yantra-games:cubeforge3d-worlds:${org}`;\n this.first = { key: nativeWorldKey(org), name: FIRST_WORLD_NAME, seed: seedFromString(org) };\n }\n\n private async read(): Promise<NativeWorld[]> {\n const raw = await this.storage.getItem(this.storageKey);\n if (!raw) return [];\n try {\n const parsed = JSON.parse(raw) as StoredList;\n return Array.isArray(parsed.worlds) ? parsed.worlds.filter(isNativeWorld) : [];\n } catch {\n return [];\n }\n }\n\n private async write(worlds: NativeWorld[]): Promise<void> {\n const payload: StoredList = { worlds };\n await this.storage.setItem(this.storageKey, JSON.stringify(payload));\n }\n\n /** The org's first world, then the others, newest first. */\n async list(): Promise<NativeWorld[]> {\n const stored = await this.read();\n // The first world is implied, so a saved copy only exists once it is renamed.\n const first = stored.find((w) => w.key === this.first.key) ?? this.first;\n return [first, ...stored.filter((w) => w.key !== this.first.key)];\n }\n\n async create(name: string): Promise<NativeWorld> {\n const worlds = await this.read();\n const stamp = this.now().toString(36);\n let key = `${this.first.key}-${stamp}`;\n for (let n = 2; worlds.some((w) => w.key === key); n += 1) key = `${this.first.key}-${stamp}-${n}`;\n const trimmed = name.trim().slice(0, MAX_NAME_CHARS) || NEW_WORLD_NAME;\n const world: NativeWorld = { key, name: trimmed, seed: seedFromString(key) };\n await this.write([world, ...worlds]);\n return world;\n }\n\n /** Give a world a new name. Returns false if there is no such world. */\n async rename(key: string, name: string): Promise<boolean> {\n const trimmed = name.trim().slice(0, MAX_NAME_CHARS);\n if (!trimmed) return false;\n const worlds = await this.read();\n const known = worlds.some((w) => w.key === key);\n if (!known && key !== this.first.key) return false;\n const next = known\n ? worlds.map((w) => (w.key === key ? { ...w, name: trimmed } : w))\n : [...worlds, { ...this.first, name: trimmed }];\n await this.write(next);\n return true;\n }\n\n /** Forget a world. The org's first world cannot be removed. */\n async remove(key: string): Promise<boolean> {\n if (key === this.first.key) return false;\n const worlds = await this.read();\n const next = worlds.filter((w) => w.key !== key);\n if (next.length === worlds.length) return false;\n await this.write(next);\n return true;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAaA,MAAM,cAAiB,GAAA,EAAA;AACvB,MAAM,gB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B,IAAO,OAAA,IAAA;AAAA;AACT;AAAA,EAGA,MAAM,OAAO,GAA+B,EAAA;AAC1C,IAAA,IAAI,GAAQ,KAAA,IAAA,CAAK,KAAM,CAAA,GAAA,EAAY,OAAA,KAAA;AACnC,IAAM,MAAA,MAAA,GAAS,MAAM,IAAA,CAAK,IAAK,EAAA;AAC/B,IAAA,MAAM,OAAO,MAAO,CAAA,MAAA,CAAO,CAAK,CAAA,KAAA,CAAA,CAAE,QAAQ,GAAG,CAAA;AAC7C,IAAA,IAAI,IAAK,CAAA,MAAA,KAAW,MAAO,CAAA,MAAA,EAAe,OAAA,KAAA;AAC1C,IAAM,MAAA,IAAA,CAAK,MAAM,IAAI,CAAA;AACrB,IAAO,OAAA,IAAA;AAAA;AAEX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedWorlds.js","sources":["../../../../../../src/features/games/vendored/core/cubeforge/sharedWorlds.ts"],"sourcesContent":["/**\n * Playing Cubeforge 3D with friends. The host app implements `CubeforgeFriends`\n * over its own backend and chat, so this package stays free of both.\n */\n\nexport interface SharedWorld {\n id: string;\n name: string;\n /** World seed; the server is the authority once connected. */\n seed: number;\n memberCount: number;\n inviteCode: string | null;\n ownedByMe: boolean;\n}\n\n/** A chat group or person who can receive an invite. */\nexport interface InviteChat {\n id: string;\n title: string;\n detail: string;\n}\n\n/** What the engine needs to enter a shared world. */\nexport interface RoomAccess {\n /** `wss://host/rooms/<worldId>`. */\n url: string;\n token: string;\n playerName: string;\n}\n\nexport interface CubeforgeFriends {\n listWorlds(): Promise<SharedWorld[]>;\n createWorld(name: string, chatId: string): Promise<SharedWorld>;\n joinWorld(inviteCode: string): Promise<SharedWorld>;\n leaveWorld(world: SharedWorld): Promise<void>;\n deleteWorld(world: SharedWorld): Promise<void>;\n listChats(): Promise<InviteChat[]>;\n /** Post a join card for `world` into the chat. */\n inviteToChat(world: SharedWorld, chatId: string): Promise<void>;\n /** `renewToken` asks for new credentials after the old token expired. */\n roomAccess(world: SharedWorld, options?: { renewToken?: boolean }): Promise<RoomAccess>;\n}\n\nconst CODE = /^[2-9A-HJKMNP-Z]{8,}$/;\n\n/**\n * The invite code in what someone typed or pasted: a bare code in any case, or\n * a link ending in one. Returns null when there is no valid code.\n */\nexport function parseInviteCode(input: string): string | null {\n const last =\n input\n .trim()\n .split(/[/?#=]/)\n .filter(Boolean)\n .pop() ?? '';\n const code = last.replace(/[\\s-]/g, '').toUpperCase();\n return CODE.test(code) ? code : null;\n}\n\n/** The save file name for a shared world on this device. */\nexport function sharedWorldKey(worldId: string): string {\n return `room-${worldId.toLowerCase().replace(/[^a-z0-9_-]+/g, '-')}`;\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sharedWorlds.js","sources":["../../../../../../src/features/games/vendored/core/cubeforge/sharedWorlds.ts"],"sourcesContent":["/**\n * Playing Cubeforge 3D with friends. The host app implements `CubeforgeFriends`\n * over its own backend and chat, so this package stays free of both.\n */\n\nexport interface SharedWorld {\n id: string;\n name: string;\n /** World seed; the server is the authority once connected. */\n seed: number;\n memberCount: number;\n inviteCode: string | null;\n ownedByMe: boolean;\n}\n\n/** A chat group or person who can receive an invite. */\nexport interface InviteChat {\n id: string;\n title: string;\n detail: string;\n}\n\n/** What the engine needs to enter a shared world. */\nexport interface RoomAccess {\n /** `wss://host/rooms/<worldId>`. */\n url: string;\n token: string;\n playerName: string;\n}\n\nexport interface CubeforgeFriends {\n listWorlds(): Promise<SharedWorld[]>;\n createWorld(name: string, chatId: string): Promise<SharedWorld>;\n joinWorld(inviteCode: string): Promise<SharedWorld>;\n leaveWorld(world: SharedWorld): Promise<void>;\n deleteWorld(world: SharedWorld): Promise<void>;\n /** Hosts that predate world names leave this out. */\n renameWorld?(world: SharedWorld, name: string): Promise<void>;\n listChats(): Promise<InviteChat[]>;\n /** Post a join card for `world` into the chat. */\n inviteToChat(world: SharedWorld, chatId: string): Promise<void>;\n /** `renewToken` asks for new credentials after the old token expired. */\n roomAccess(world: SharedWorld, options?: { renewToken?: boolean }): Promise<RoomAccess>;\n}\n\nconst CODE = /^[2-9A-HJKMNP-Z]{8,}$/;\n\n/**\n * The invite code in what someone typed or pasted: a bare code in any case, or\n * a link ending in one. Returns null when there is no valid code.\n */\nexport function parseInviteCode(input: string): string | null {\n const last =\n input\n .trim()\n .split(/[/?#=]/)\n .filter(Boolean)\n .pop() ?? '';\n const code = last.replace(/[\\s-]/g, '').toUpperCase();\n return CODE.test(code) ? code : null;\n}\n\n/** The save file name for a shared world on this device. */\nexport function sharedWorldKey(worldId: string): string {\n return `room-${worldId.toLowerCase().replace(/[^a-z0-9_-]+/g, '-')}`;\n}\n"],"names":[],"mappings":"AA6CA,MAAM,IAAO,GAAA,uBAAA;AAMN,SAAS,gBAAgB,KAA8B,EAAA;AAnD9D,EAAA,IAAA,EAAA;AAoDE,EAAA,MAAM,IAAO,GAAA,CAAA,EAAA,GAAA,KAAA,CAAM,IAAK,EAAA,CAAE,KAAM,CAAA,QAAQ,CAAE,CAAA,MAAA,CAAO,OAAO,CAAA,CAAE,GAAI,EAAA,KAAjD,IAAsD,GAAA,EAAA,GAAA,EAAA;AACnE,EAAA,MAAM,OAAO,IAAK,CAAA,OAAA,CAAQ,QAAU,EAAA,EAAE,EAAE,WAAY,EAAA;AACpD,EAAA,OAAO,IAAK,CAAA,IAAA,CAAK,IAAI,CAAA,GAAI,IAAO,GAAA,IAAA;AAClC;AAGO,SAAS,eAAe,OAAyB,EAAA;AACtD,EAAA,OAAO,QAAQ,OAAQ,CAAA,WAAA,GAAc,OAAQ,CAAA,eAAA,EAAiB,GAAG,CAAC,CAAA,CAAA;AACpE"}
|
|
@@ -27,12 +27,12 @@ const SKIN_GRIDS = {
|
|
|
27
27
|
};
|
|
28
28
|
const TONES = [2, 3];
|
|
29
29
|
const HAIRS = [4, 0, 6, 15];
|
|
30
|
-
const OUTFITS = [[
|
|
30
|
+
const OUTFITS = [[6, 9], [5, 4], [8, 9], [6, 4], [13, 12], [10, 9], [14, 12], [1, 15], [0, 15], [3, 4], [12, 0], [9, 4], [5, 0], [15, 12], [7, 4], [9, 0]];
|
|
31
31
|
const SKIN_PRESET_COUNT = OUTFITS.length;
|
|
32
32
|
function presetSkin(index) {
|
|
33
33
|
var _a, _b, _c;
|
|
34
34
|
const i = (index % SKIN_PRESET_COUNT + SKIN_PRESET_COUNT) % SKIN_PRESET_COUNT;
|
|
35
|
-
const [shirt, trousers] = (_a = OUTFITS[i]) != null ? _a : [
|
|
35
|
+
const [shirt, trousers] = (_a = OUTFITS[i]) != null ? _a : [6, 9];
|
|
36
36
|
const tone = (_b = TONES[i % 2]) != null ? _b : 2;
|
|
37
37
|
const hair = (_c = HAIRS[Math.floor(i / 2) % HAIRS.length]) != null ? _c : 4;
|
|
38
38
|
const cells = new Array(SKIN_CELLS).fill(0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skin.js","sources":["../../../../../../src/features/games/vendored/core/cubeforge/skin.ts"],"sourcesContent":["/**\n * Player skins for Cubeforge 3D: 256 cells on a fixed 16-colour palette, one\n * hex digit per cell. The same format as `native/cubeforge/src/game/skin.rs`.\n */\nimport type { KeyValueStorage } from '../storage/storage';\n\nexport const SKIN_CELLS = 256;\n\nexport const SKIN_PALETTE = [\n '#1f242a',\n '#f4f4f0',\n '#e0b48c',\n '#9c6b45',\n '#5c4028',\n '#bf4f3f',\n '#d9a33c',\n '#e9d36a',\n '#4f9f5f',\n '#2f6b45',\n '#3fbfb0',\n '#3f7fbf',\n '#2f4a6b',\n '#8f5fbf',\n '#d96a9a',\n '#7f8f9f',\n] as const;\n\nexport type SkinPart = 'head' | 'body' | 'arms' | 'legs';\n\nexport interface SkinGrid {\n start: number;\n width: number;\n height: number;\n}\n\nexport const SKIN_GRIDS: Record<SkinPart, SkinGrid> = {\n head: { start: 0, width: 8, height: 8 },\n body: { start: 64, width: 8, height: 12 },\n arms: { start: 160, width: 4, height: 12 },\n legs: { start: 208, width: 4, height: 12 },\n};\n\nconst TONES = [2, 3];\nconst HAIRS = [4, 0, 6, 15];\n/** Shirt and trousers of each ready-made person. */\nconst OUTFITS: readonly (readonly [number, number])[] = [\n [
|
|
1
|
+
{"version":3,"file":"skin.js","sources":["../../../../../../src/features/games/vendored/core/cubeforge/skin.ts"],"sourcesContent":["/**\n * Player skins for Cubeforge 3D: 256 cells on a fixed 16-colour palette, one\n * hex digit per cell. The same format as `native/cubeforge/src/game/skin.rs`.\n */\nimport type { KeyValueStorage } from '../storage/storage';\n\nexport const SKIN_CELLS = 256;\n\nexport const SKIN_PALETTE = [\n '#1f242a',\n '#f4f4f0',\n '#e0b48c',\n '#9c6b45',\n '#5c4028',\n '#bf4f3f',\n '#d9a33c',\n '#e9d36a',\n '#4f9f5f',\n '#2f6b45',\n '#3fbfb0',\n '#3f7fbf',\n '#2f4a6b',\n '#8f5fbf',\n '#d96a9a',\n '#7f8f9f',\n] as const;\n\nexport type SkinPart = 'head' | 'body' | 'arms' | 'legs';\n\nexport interface SkinGrid {\n start: number;\n width: number;\n height: number;\n}\n\nexport const SKIN_GRIDS: Record<SkinPart, SkinGrid> = {\n head: { start: 0, width: 8, height: 8 },\n body: { start: 64, width: 8, height: 12 },\n arms: { start: 160, width: 4, height: 12 },\n legs: { start: 208, width: 4, height: 12 },\n};\n\nconst TONES = [2, 3];\nconst HAIRS = [4, 0, 6, 15];\n/** Shirt and trousers of each ready-made person. */\nconst OUTFITS: readonly (readonly [number, number])[] = [\n [6, 9],\n [5, 4],\n [8, 9],\n [6, 4],\n [13, 12],\n [10, 9],\n [14, 12],\n [1, 15],\n [0, 15],\n [3, 4],\n [12, 0],\n [9, 4],\n [5, 0],\n [15, 12],\n [7, 4],\n [9, 0],\n];\n\nexport const SKIN_PRESET_COUNT = OUTFITS.length;\n\n/** One of the ready-made people, as cell values. */\nexport function presetSkin(index: number): number[] {\n const i = ((index % SKIN_PRESET_COUNT) + SKIN_PRESET_COUNT) % SKIN_PRESET_COUNT;\n const [shirt, trousers] = OUTFITS[i] ?? [6, 9];\n const tone = TONES[i % 2] ?? 2;\n const hair = HAIRS[Math.floor(i / 2) % HAIRS.length] ?? 4;\n const cells = new Array<number>(SKIN_CELLS).fill(0);\n const paint = (grid: SkinGrid, f: (x: number, y: number) => number) => {\n for (let y = 0; y < grid.height; y += 1) {\n for (let x = 0; x < grid.width; x += 1) cells[grid.start + y * grid.width + x] = f(x, y);\n }\n };\n paint(SKIN_GRIDS.head, (x, y) => {\n if (y <= 1) return hair;\n if (y === 2 && (x === 0 || x === 7)) return hair;\n if (y === 3 && (x === 2 || x === 5)) return 1;\n if (y === 4 && (x === 2 || x === 5)) return 0;\n if (y === 6 && (x === 3 || x === 4)) return 5;\n return tone;\n });\n paint(SKIN_GRIDS.body, (x, y) => {\n if (y === 11) return trousers;\n return x >= 3 && x < 5 && y < 2 ? tone : shirt;\n });\n paint(SKIN_GRIDS.arms, (_x, y) => (y >= 9 ? tone : shirt));\n paint(SKIN_GRIDS.legs, (_x, y) => (y >= 10 ? 0 : trousers));\n return cells;\n}\n\nexport function skinToHex(cells: readonly number[]): string {\n return cells.map((c) => (c & 15).toString(16)).join('');\n}\n\n/** Cells from hex, or null if the text is not a skin. */\nexport function skinFromHex(hex: string): number[] | null {\n if (!/^[0-9a-f]{256}$/.test(hex)) return null;\n return Array.from(hex, (c) => parseInt(c, 16));\n}\n\n/** Remembers this person's painted skin on the device, across worlds. */\nexport class SkinRepository {\n private readonly key: string;\n\n constructor(\n private readonly storage: KeyValueStorage,\n orgName: string,\n ) {\n this.key = `yantra-games:cubeforge3d-skin:${orgName || 'default'}`;\n }\n\n async load(): Promise<number[] | null> {\n const raw = await this.storage.getItem(this.key);\n return raw ? skinFromHex(raw) : null;\n }\n\n async save(cells: readonly number[]): Promise<void> {\n await this.storage.setItem(this.key, skinToHex(cells));\n }\n\n async clear(): Promise<void> {\n await this.storage.removeItem(this.key);\n }\n}\n"],"names":[],"mappings":";;;AAKO,MAAM,UAAa,GAAA;AACnB,MAAM,eAAe,CAA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AAK,EAAE,CAAA;AACtD;AAGO,SAAS,YAAY,GAA8B,EAAA;AACxD,EAAA,IAAI,CAAC,iBAAA,CAAkB,IAAK,CAAA,GAAG,GAAU,OAAA,IAAA;AACzC,EAAA,OAAO,MAAM,IAAK,CAAA,GAAA,EAAK,OAAK,QAAS,CAAA,CAAA,EAAG,EAAE,CAAC,CAAA;AAC7C;AAGO,MAAM,cAAe,CAAA;AAAA,EAE1B,WAAA,CAA6B,SAA0B,OAAiB,EAAA;AAA3C,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AAD7B,IAAiB,aAAA,CAAA,IAAA,EAAA,KAAA,CAAA;AAEf,IAAK,IAAA,CAAA,GAAA,GAAM,CAAiC,8BAAA,EAAA,OAAA,IAAW,SAAS,CAAA,CAAA;AAAA;AAClE,EACA,MAAM,IAAiC,GAAA;AACrC,IAAA,MAAM,MAAM,MAAM,IAAA,CAAK,OAAQ,CAAA,OAAA,CAAQ,KAAK,GAAG,CAAA;AAC/C,IAAO,OAAA,GAAA,GAAM,WAAY,CAAA,GAAG,CAAI,GAAA,IAAA;AAAA;AAClC,EACA,MAAM,KAAK,KAAyC,EAAA;AAClD,IAAA,MAAM,KAAK,OAAQ,CAAA,OAAA,CAAQ,KAAK,GAAK,EAAA,SAAA,CAAU,KAAK,CAAC,CAAA;AAAA;AACvD,EACA,MAAM,KAAuB,GAAA;AAC3B,IAAA,MAAM,IAAK,CAAA,OAAA,CAAQ,UAAW,CAAA,IAAA,CAAK,GAAG,CAAA;AAAA;AAE1C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {jsxs,jsx}from'react/jsx-runtime';import {useMemo,useState,useEffect,useCallback}from'react';import {useColorScheme,View,StyleSheet,Text}from'react-native';import'../core/engine/palette.js';import'../core/lessons/lessons.js';import'../core/cubeforge/items.js';import'../core/cubeforge/recipes.js';import {seedFromString}from'../core/cubeforge/worldgen.js';import {nativeWorldKey}from'../core/cubeforge/nativeWorld.js';import {NativeWorldRepository}from'../core/cubeforge/nativeWorlds.js';import {SkinRepository,skinToHex}from'../core/cubeforge/skin.js';import {sharedWorldKey,parseInviteCode}from'../core/cubeforge/sharedWorlds.js';import {Cubeforge3DHomeScreen}from'./screens/Cubeforge3DHomeScreen.js';import {ScreenHeader}from'./screens/ScreenHeader.js';import {SkinEditorScreen}from'./screens/SkinEditorScreen.js';import {createAsyncStorageAdapter}from'./storage/asyncStorageAdapter.js';import {getTheme,spacing}from'./theme.js';var __defProp = Object.defineProperty;
|
|
1
|
+
import {jsxs,jsx}from'react/jsx-runtime';import {useMemo,useState,useEffect,useCallback}from'react';import {useColorScheme,View,StyleSheet,Text}from'react-native';import'../core/engine/palette.js';import'../core/lessons/lessons.js';import'../core/cubeforge/items.js';import'../core/cubeforge/recipes.js';import {seedFromString}from'../core/cubeforge/worldgen.js';import {worthNaming,hasDefaultName}from'../core/cubeforge/helper.js';import {nativeWorldKey}from'../core/cubeforge/nativeWorld.js';import {NativeWorldRepository}from'../core/cubeforge/nativeWorlds.js';import {SkinRepository,skinToHex}from'../core/cubeforge/skin.js';import {sharedWorldKey,parseInviteCode}from'../core/cubeforge/sharedWorlds.js';import {Cubeforge3DHomeScreen}from'./screens/Cubeforge3DHomeScreen.js';import {ScreenHeader}from'./screens/ScreenHeader.js';import {SkinEditorScreen}from'./screens/SkinEditorScreen.js';import {createAsyncStorageAdapter}from'./storage/asyncStorageAdapter.js';import {getTheme,spacing}from'./theme.js';var __defProp = Object.defineProperty;
|
|
2
2
|
var __defProps = Object.defineProperties;
|
|
3
3
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
4
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
@@ -27,7 +27,9 @@ function YantraGames(props) {
|
|
|
27
27
|
cubeforgeFriends: friends,
|
|
28
28
|
cubeforgeInvite,
|
|
29
29
|
onCubeforgeInviteHandled,
|
|
30
|
-
deleteCubeforge3DSave
|
|
30
|
+
deleteCubeforge3DSave,
|
|
31
|
+
cubeforgeHelper: helper,
|
|
32
|
+
cubeforge3DPicture
|
|
31
33
|
} = props;
|
|
32
34
|
const systemScheme = useColorScheme();
|
|
33
35
|
const theme = getTheme((_a = props.theme) != null ? _a : systemScheme === "dark" ? "dark" : "light");
|
|
@@ -44,6 +46,7 @@ function YantraGames(props) {
|
|
|
44
46
|
live = false;
|
|
45
47
|
};
|
|
46
48
|
}, [skins]);
|
|
49
|
+
const [worldsRevision, setWorldsRevision] = useState(0);
|
|
47
50
|
const [screen, setScreen] = useState(() => cubeforgeInvite ? {
|
|
48
51
|
name: "worlds"
|
|
49
52
|
} : {
|
|
@@ -69,6 +72,22 @@ function YantraGames(props) {
|
|
|
69
72
|
room
|
|
70
73
|
});
|
|
71
74
|
}, [friends]);
|
|
75
|
+
const nameAfterPlaying = useCallback(async (played, summary) => {
|
|
76
|
+
var _a2, _b, _c;
|
|
77
|
+
if (played.name !== "game" || !helper || !worthNaming(summary)) return;
|
|
78
|
+
const {
|
|
79
|
+
shared,
|
|
80
|
+
worldKey
|
|
81
|
+
} = played;
|
|
82
|
+
const current = (_b = shared == null ? void 0 : shared.name) != null ? _b : (_a2 = (await worlds.list()).find((w) => w.key === worldKey)) == null ? void 0 : _a2.name;
|
|
83
|
+
if (!current || !hasDefaultName(current)) return;
|
|
84
|
+
if (shared && !(shared.ownedByMe && (friends == null ? void 0 : friends.renameWorld))) return;
|
|
85
|
+
const name = await helper.nameWorld(summary);
|
|
86
|
+
if (!name) return;
|
|
87
|
+
if (shared) await ((_c = friends == null ? void 0 : friends.renameWorld) == null ? void 0 : _c.call(friends, shared, name));
|
|
88
|
+
else await worlds.rename(worldKey, name);
|
|
89
|
+
setWorldsRevision((n) => n + 1);
|
|
90
|
+
}, [friends, helper, worlds]);
|
|
72
91
|
const refreshRoom = useCallback(() => {
|
|
73
92
|
if (screen.name !== "game" || !screen.shared || !friends) return;
|
|
74
93
|
const {
|
|
@@ -119,7 +138,7 @@ function YantraGames(props) {
|
|
|
119
138
|
if (screen.name === "worlds") {
|
|
120
139
|
return /* @__PURE__ */ jsx(Cubeforge3DHomeScreen, { theme, worlds, friends, onBack: () => onExit == null ? void 0 : onExit(), onPlaySolo: playSolo, onPlayShared: playShared, onDeleteSave: deleteCubeforge3DSave, onEditAvatar: () => setScreen({
|
|
121
140
|
name: "avatar"
|
|
122
|
-
}) });
|
|
141
|
+
}), pictureOf: cubeforge3DPicture, revision: worldsRevision });
|
|
123
142
|
}
|
|
124
143
|
if (screen.name === "avatar") {
|
|
125
144
|
return /* @__PURE__ */ jsx(SkinEditorScreen, { theme, initial: skin, onBack: () => setScreen({
|
|
@@ -132,13 +151,14 @@ function YantraGames(props) {
|
|
|
132
151
|
});
|
|
133
152
|
} });
|
|
134
153
|
}
|
|
135
|
-
const leaveWorld = () => {
|
|
154
|
+
const leaveWorld = (summary) => {
|
|
155
|
+
if (helper && summary) void nameAfterPlaying(screen, summary).catch(() => void 0);
|
|
136
156
|
if (friends) setScreen({
|
|
137
157
|
name: "worlds"
|
|
138
158
|
});
|
|
139
159
|
else onExit == null ? void 0 : onExit();
|
|
140
160
|
};
|
|
141
|
-
return /* @__PURE__ */ jsx(Cubeforge3D, { seed: screen.seed, worldKey: screen.worldKey, room: screen.room, skin: skin ? skinToHex(skin) : void 0, onExit: leaveWorld, onRoomClosed: () => setScreen({
|
|
161
|
+
return /* @__PURE__ */ jsx(Cubeforge3D, { seed: screen.seed, worldKey: screen.worldKey, room: screen.room, skin: skin ? skinToHex(skin) : void 0, onExit: leaveWorld, helper: screen.shared && !screen.shared.ownedByMe ? void 0 : helper, onRoomClosed: () => setScreen({
|
|
142
162
|
name: "worlds"
|
|
143
163
|
}), onTokenExpired: refreshRoom });
|
|
144
164
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GamesRoot.js","sources":["../../../../../src/features/games/vendored/ui/GamesRoot.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useCallback, useEffect, useMemo, useState } from 'react';\nimport { StyleSheet, Text, useColorScheme, View } from 'react-native';\nimport {\n NativeWorldRepository,\n SkinRepository,\n nativeWorldKey,\n parseInviteCode,\n seedFromString,\n sharedWorldKey,\n skinToHex,\n type CubeforgeFriends,\n type KeyValueStorage,\n type NativeWorld,\n type RoomAccess,\n type SharedWorld,\n} from '../core';\nimport { Cubeforge3DHomeScreen } from './screens/Cubeforge3DHomeScreen';\nimport { ScreenHeader } from './screens/ScreenHeader';\nimport { SkinEditorScreen } from './screens/SkinEditorScreen';\nimport { createAsyncStorageAdapter } from './storage/asyncStorageAdapter';\nimport { getTheme, spacing, type ThemeMode } from './theme';\n\nexport interface YantraGamesProps {\n /** Organisation the signed-in user is in; each org has its own world. */\n orgName: string;\n /** Called when the user leaves the game (back out to the app). */\n onExit?: () => void;\n /** Force a theme; defaults to the system colour scheme. */\n theme?: ThemeMode;\n /** Override persistence; defaults to AsyncStorage. */\n storage?: KeyValueStorage;\n /**\n * The native first-person Cubeforge (the Rust engine in `native/cubeforge`).\n * It is the game: without one on this device there is nothing to play, and\n * the player is told so.\n */\n cubeforge3D?: React.ComponentType<Cubeforge3DProps>;\n /** Shared worlds and chat invites, when the host offers them. */\n cubeforgeFriends?: CubeforgeFriends;\n /** An invite to accept right away, for example from a tapped chat card. */\n cubeforgeInvite?: string;\n /** Called once `cubeforgeInvite` has been accepted or refused. */\n onCubeforgeInviteHandled?: (error: string | null) => void;\n /** Removes a 3D world's save from this device. */\n deleteCubeforge3DSave?: (worldKey: string) => void;\n}\n\n/** Props the host's native Cubeforge 3D component receives. */\nexport interface Cubeforge3DProps {\n /** Seed for a new world, stable per org. */\n seed: number;\n /** Stable key for the world's save (the org), safe as a file name part. */\n worldKey: string;\n /** Leave the game. */\n onExit: () => void;\n /** Connect to this shared world; omitted when playing alone. */\n room?: RoomAccess;\n /** The server refused the player for good (removed, deleted, joined elsewhere). */\n onRoomClosed?: () => void;\n /** The token expired; the next `room` carries a fresh one. */\n onTokenExpired?: () => void;\n /** This person's painted avatar as 256 hex digits, when they have one. */\n skin?: string;\n}\n\ntype Screen =\n | { name: 'worlds' }\n | { name: 'avatar' }\n | { name: 'game'; seed: number; worldKey: string; shared?: SharedWorld; room?: RoomAccess };\n\n/**\n * Yantra Games is Cubeforge in 3D: opening it opens the game. Where the host\n * offers friends, leaving a world goes to the list of worlds and Play with\n * friends; otherwise it leaves Games.\n */\nexport function YantraGames(props: YantraGamesProps): React.ReactElement {\n const {\n orgName,\n onExit,\n storage: storageProp,\n cubeforge3D: Cubeforge3D,\n cubeforgeFriends: friends,\n cubeforgeInvite,\n onCubeforgeInviteHandled,\n deleteCubeforge3DSave,\n } = props;\n const systemScheme = useColorScheme();\n const theme = getTheme(props.theme ?? (systemScheme === 'dark' ? 'dark' : 'light'));\n\n const storage = useMemo(() => storageProp ?? createAsyncStorageAdapter(), [storageProp]);\n const worlds = useMemo(() => new NativeWorldRepository(storage, orgName || 'default'), [storage, orgName]);\n const skins = useMemo(() => new SkinRepository(storage, orgName || 'default'), [storage, orgName]);\n const [skin, setSkin] = useState<number[] | null>(null);\n\n useEffect(() => {\n let live = true;\n skins\n .load()\n .then((cells) => {\n if (live) setSkin(cells);\n })\n .catch(() => undefined);\n return () => {\n live = false;\n };\n }, [skins]);\n\n // An invite goes straight to its world, so it starts from the list, not a solo world.\n const [screen, setScreen] = useState<Screen>(() =>\n cubeforgeInvite\n ? { name: 'worlds' }\n : { name: 'game', seed: seedFromString(orgName || 'default'), worldKey: nativeWorldKey(orgName) },\n );\n\n const playSolo = useCallback((world: NativeWorld) => {\n setScreen({ name: 'game', seed: world.seed, worldKey: world.key });\n }, []);\n\n const playShared = useCallback(\n async (world: SharedWorld) => {\n if (!friends) return;\n const room = await friends.roomAccess(world);\n setScreen({ name: 'game', seed: world.seed, worldKey: sharedWorldKey(world.id), shared: world, room });\n },\n [friends],\n );\n\n // Fresh credentials for the world in play, after the old token expired.\n const refreshRoom = useCallback(() => {\n if (screen.name !== 'game' || !screen.shared || !friends) return;\n const { shared } = screen;\n friends\n .roomAccess(shared)\n .then((room) => setScreen((s) => (s.name === 'game' && s.shared?.id === shared.id ? { ...s, room } : s)))\n .catch(() => setScreen({ name: 'worlds' }));\n }, [friends, screen]);\n\n // Accept an invite handed in by the host (a tapped chat card).\n useEffect(() => {\n if (!cubeforgeInvite || !friends || !Cubeforge3D) return undefined;\n let live = true;\n const code = parseInviteCode(cubeforgeInvite);\n const accept = async () => {\n if (!code) throw new Error('That invite is not valid.');\n const world = await friends.joinWorld(code);\n if (live) await playShared(world);\n };\n accept()\n .then(() => {\n if (live) onCubeforgeInviteHandled?.(null);\n })\n .catch((e: unknown) => {\n if (live) onCubeforgeInviteHandled?.(e instanceof Error ? e.message : 'Could not join that world.');\n });\n return () => {\n live = false;\n };\n }, [cubeforgeInvite, friends, Cubeforge3D, playShared, onCubeforgeInviteHandled]);\n\n if (!Cubeforge3D) {\n return (\n <View style={[styles.fill, { backgroundColor: theme.bg }]}>\n <ScreenHeader theme={theme} title=\"Cubeforge\" onBack={onExit} backLabel=\"Close\" />\n <View style={styles.message}>\n <Text style={[styles.title, { color: theme.text }]}>Cubeforge is not on this device yet</Text>\n <Text style={[styles.body, { color: theme.textMuted }]}>\n It is a 3D game that needs the latest Yantra app on a 64-bit phone.\n </Text>\n </View>\n </View>\n );\n }\n\n if (screen.name === 'worlds') {\n return (\n <Cubeforge3DHomeScreen\n theme={theme}\n worlds={worlds}\n friends={friends}\n onBack={() => onExit?.()}\n onPlaySolo={playSolo}\n onPlayShared={playShared}\n onDeleteSave={deleteCubeforge3DSave}\n onEditAvatar={() => setScreen({ name: 'avatar' })}\n />\n );\n }\n\n if (screen.name === 'avatar') {\n return (\n <SkinEditorScreen\n theme={theme}\n initial={skin}\n onBack={() => setScreen({ name: 'worlds' })}\n onSave={(cells) => {\n setSkin(cells);\n void skins.save(cells);\n setScreen({ name: 'worlds' });\n }}\n />\n );\n }\n\n const leaveWorld = () => {\n if (friends) setScreen({ name: 'worlds' });\n else onExit?.();\n };\n\n return (\n <Cubeforge3D\n seed={screen.seed}\n worldKey={screen.worldKey}\n room={screen.room}\n skin={skin ? skinToHex(skin) : undefined}\n onExit={leaveWorld}\n onRoomClosed={() => setScreen({ name: 'worlds' })}\n onTokenExpired={refreshRoom}\n />\n );\n}\n\nconst styles = StyleSheet.create({\n fill: { flex: 1 },\n message: { flex: 1, alignItems: 'center', justifyContent: 'center', padding: spacing.lg, gap: spacing.sm },\n title: { fontSize: 18, fontWeight: '700', textAlign: 'center' },\n body: { fontSize: 15, lineHeight: 21, textAlign: 'center' },\n});\n\nexport default YantraGames;\n"],"names":["_a"],"mappings":";;;;;;;;;;;;;;;;;;;AAoEO,SAAS,YAAY,KAA6C,EAAA;AApEzE,EAAA,IAAA,EAAA;AAqEE,EAAM,MAAA;AAAA,IACJ,OAAA;AAAA,IACA,MAAA;AAAA,IACA,OAAS,EAAA,WAAA;AAAA,IACT,WAAa,EAAA,WAAA;AAAA,IACb,gBAAkB,EAAA,OAAA;AAAA,IAClB,eAAA;AAAA,IACA,wBAAA;AAAA,IACA;AAAA,GACE,GAAA,KAAA;AACJ,EAAA,MAAM,eAAe,cAAe,EAAA;AACpC,EAAM,MAAA,KAAA,GAAQ,UAAS,EAAM,GAAA,KAAA,CAAA,KAAA,KAAN,YAAgB,YAAiB,KAAA,MAAA,GAAS,SAAS,OAAQ,CAAA;AAClF,EAAM,MAAA,OAAA,GAAU,QAAQ,MAAM,WAAA,IAAA,IAAA,GAAA,WAAA,GAAe,2BAA6B,EAAA,CAAC,WAAW,CAAC,CAAA;AACvF,EAAA,MAAM,MAAS,GAAA,OAAA,CAAQ,MAAM,IAAI,qBAAsB,CAAA,OAAA,EAAS,OAAW,IAAA,SAAS,CAAG,EAAA,CAAC,OAAS,EAAA,OAAO,CAAC,CAAA;AACzG,EAAA,MAAM,KAAQ,GAAA,OAAA,CAAQ,MAAM,IAAI,cAAe,CAAA,OAAA,EAAS,OAAW,IAAA,SAAS,CAAG,EAAA,CAAC,OAAS,EAAA,OAAO,CAAC,CAAA;AACjG,E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Y,YAAc,EAAA,MAAM,SAAU,CAAA;AAAA,IAC/K,IAAM,EAAA;AAAA,GACP,CAAG,EAAA,cAAA,EAAgB,WAAa,EAAA,CAAA;AACnC;AACA,MAAM,MAAA,GAAS,WAAW,MAAO,CAAA;AAAA,EAC/B,IAAM,EAAA;AAAA,IACJ,IAAM,EAAA;AAAA,GACR;AAAA,EACA,OAAS,EAAA;AAAA,IACP,IAAM,EAAA,CAAA;AAAA,IACN,UAAY,EAAA,QAAA;AAAA,IACZ,cAAgB,EAAA,QAAA;AAAA,IAChB,SAAS,OAAQ,CAAA,EAAA;AAAA,IACjB,KAAK,OAAQ,CAAA;AAAA,GACf;AAAA,EACA,KAAO,EAAA;AAAA,IACL,QAAU,EAAA,EAAA;AAAA,IACV,UAAY,EAAA,KAAA;AAAA,IACZ,SAAW,EAAA;AAAA,GACb;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,QAAU,EAAA,EAAA;AAAA,IACV,UAAY,EAAA,EAAA;AAAA,IACZ,SAAW,EAAA;AAAA;AAEf,CAAC,CAAA"}
|
|
1
|
+
{"version":3,"file":"GamesRoot.js","sources":["../../../../../src/features/games/vendored/ui/GamesRoot.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useCallback, useEffect, useMemo, useState } from 'react';\nimport { StyleSheet, Text, useColorScheme, View } from 'react-native';\nimport {\n NativeWorldRepository,\n SkinRepository,\n nativeWorldKey,\n parseInviteCode,\n seedFromString,\n sharedWorldKey,\n skinToHex,\n type CubeforgeFriends,\n type KeyValueStorage,\n type NativeWorld,\n type RoomAccess,\n type SharedWorld,\n hasDefaultName,\n worthNaming,\n type CubeforgeHelper,\n} from '../core';\nimport { Cubeforge3DHomeScreen } from './screens/Cubeforge3DHomeScreen';\nimport { ScreenHeader } from './screens/ScreenHeader';\nimport { SkinEditorScreen } from './screens/SkinEditorScreen';\nimport { createAsyncStorageAdapter } from './storage/asyncStorageAdapter';\nimport { getTheme, spacing, type ThemeMode } from './theme';\n\nexport interface YantraGamesProps {\n /** Organisation the signed-in user is in; each org has its own world. */\n orgName: string;\n /** Called when the user leaves the game (back out to the app). */\n onExit?: () => void;\n /** Force a theme; defaults to the system colour scheme. */\n theme?: ThemeMode;\n /** Override persistence; defaults to AsyncStorage. */\n storage?: KeyValueStorage;\n /**\n * The native first-person Cubeforge (the Rust engine in `native/cubeforge`).\n * It is the game: without one on this device there is nothing to play, and\n * the player is told so.\n */\n cubeforge3D?: React.ComponentType<Cubeforge3DProps>;\n /** Shared worlds and chat invites, when the host offers them. */\n cubeforgeFriends?: CubeforgeFriends;\n /** An invite to accept right away, for example from a tapped chat card. */\n cubeforgeInvite?: string;\n /** Called once `cubeforgeInvite` has been accepted or refused. */\n onCubeforgeInviteHandled?: (error: string | null) => void;\n /** Removes a 3D world's save from this device. */\n deleteCubeforge3DSave?: (worldKey: string) => void;\n /** The AI build helper, when the host can reach one. */\n cubeforgeHelper?: CubeforgeHelper;\n /** Address of a world's saved picture, or null when it has none. */\n cubeforge3DPicture?: (worldKey: string) => string | null;\n}\n\n/** Props the host's native Cubeforge 3D component receives. */\nexport interface Cubeforge3DProps {\n /** Seed for a new world, stable per org. */\n seed: number;\n /** Stable key for the world's save (the org), safe as a file name part. */\n worldKey: string;\n /** Leave the game. `summary` describes the world, when the engine can. */\n onExit: (summary?: string) => void;\n /** The build helper, when this player may change this world. */\n helper?: CubeforgeHelper;\n /** Connect to this shared world; omitted when playing alone. */\n room?: RoomAccess;\n /** The server refused the player for good (removed, deleted, joined elsewhere). */\n onRoomClosed?: () => void;\n /** The token expired; the next `room` carries a fresh one. */\n onTokenExpired?: () => void;\n /** This person's painted avatar as 256 hex digits, when they have one. */\n skin?: string;\n}\n\ntype Screen =\n | { name: 'worlds' }\n | { name: 'avatar' }\n | { name: 'game'; seed: number; worldKey: string; shared?: SharedWorld; room?: RoomAccess };\n\n/**\n * Yantra Games is Cubeforge in 3D: opening it opens the game. Where the host\n * offers friends, leaving a world goes to the list of worlds and Play with\n * friends; otherwise it leaves Games.\n */\nexport function YantraGames(props: YantraGamesProps): React.ReactElement {\n const {\n orgName,\n onExit,\n storage: storageProp,\n cubeforge3D: Cubeforge3D,\n cubeforgeFriends: friends,\n cubeforgeInvite,\n onCubeforgeInviteHandled,\n deleteCubeforge3DSave,\n cubeforgeHelper: helper,\n cubeforge3DPicture,\n } = props;\n const systemScheme = useColorScheme();\n const theme = getTheme(props.theme ?? (systemScheme === 'dark' ? 'dark' : 'light'));\n\n const storage = useMemo(() => storageProp ?? createAsyncStorageAdapter(), [storageProp]);\n const worlds = useMemo(() => new NativeWorldRepository(storage, orgName || 'default'), [storage, orgName]);\n const skins = useMemo(() => new SkinRepository(storage, orgName || 'default'), [storage, orgName]);\n const [skin, setSkin] = useState<number[] | null>(null);\n\n useEffect(() => {\n let live = true;\n skins\n .load()\n .then((cells) => {\n if (live) setSkin(cells);\n })\n .catch(() => undefined);\n return () => {\n live = false;\n };\n }, [skins]);\n\n // Bumped when the helper renames a world, so the list shows it.\n const [worldsRevision, setWorldsRevision] = useState(0);\n\n // An invite goes straight to its world, so it starts from the list, not a solo world.\n const [screen, setScreen] = useState<Screen>(() =>\n cubeforgeInvite\n ? { name: 'worlds' }\n : { name: 'game', seed: seedFromString(orgName || 'default'), worldKey: nativeWorldKey(orgName) },\n );\n\n const playSolo = useCallback((world: NativeWorld) => {\n setScreen({ name: 'game', seed: world.seed, worldKey: world.key });\n }, []);\n\n const playShared = useCallback(\n async (world: SharedWorld) => {\n if (!friends) return;\n const room = await friends.roomAccess(world);\n setScreen({ name: 'game', seed: world.seed, worldKey: sharedWorldKey(world.id), shared: world, room });\n },\n [friends],\n );\n\n // A world nobody has named gets one from what was built in it.\n const nameAfterPlaying = useCallback(\n async (played: Screen, summary: string) => {\n if (played.name !== 'game' || !helper || !worthNaming(summary)) return;\n const { shared, worldKey } = played;\n const current = shared?.name ?? (await worlds.list()).find((w) => w.key === worldKey)?.name;\n if (!current || !hasDefaultName(current)) return;\n if (shared && !(shared.ownedByMe && friends?.renameWorld)) return;\n const name = await helper.nameWorld(summary);\n if (!name) return;\n if (shared) await friends?.renameWorld?.(shared, name);\n else await worlds.rename(worldKey, name);\n setWorldsRevision((n) => n + 1);\n },\n [friends, helper, worlds],\n );\n\n // Fresh credentials for the world in play, after the old token expired.\n const refreshRoom = useCallback(() => {\n if (screen.name !== 'game' || !screen.shared || !friends) return;\n const { shared } = screen;\n friends\n .roomAccess(shared)\n .then((room) => setScreen((s) => (s.name === 'game' && s.shared?.id === shared.id ? { ...s, room } : s)))\n .catch(() => setScreen({ name: 'worlds' }));\n }, [friends, screen]);\n\n // Accept an invite handed in by the host (a tapped chat card).\n useEffect(() => {\n if (!cubeforgeInvite || !friends || !Cubeforge3D) return undefined;\n let live = true;\n const code = parseInviteCode(cubeforgeInvite);\n const accept = async () => {\n if (!code) throw new Error('That invite is not valid.');\n const world = await friends.joinWorld(code);\n if (live) await playShared(world);\n };\n accept()\n .then(() => {\n if (live) onCubeforgeInviteHandled?.(null);\n })\n .catch((e: unknown) => {\n if (live) onCubeforgeInviteHandled?.(e instanceof Error ? e.message : 'Could not join that world.');\n });\n return () => {\n live = false;\n };\n }, [cubeforgeInvite, friends, Cubeforge3D, playShared, onCubeforgeInviteHandled]);\n\n if (!Cubeforge3D) {\n return (\n <View style={[styles.fill, { backgroundColor: theme.bg }]}>\n <ScreenHeader theme={theme} title=\"Cubeforge\" onBack={onExit} backLabel=\"Close\" />\n <View style={styles.message}>\n <Text style={[styles.title, { color: theme.text }]}>Cubeforge is not on this device yet</Text>\n <Text style={[styles.body, { color: theme.textMuted }]}>\n It is a 3D game that needs the latest Yantra app on a 64-bit phone.\n </Text>\n </View>\n </View>\n );\n }\n\n if (screen.name === 'worlds') {\n return (\n <Cubeforge3DHomeScreen\n theme={theme}\n worlds={worlds}\n friends={friends}\n onBack={() => onExit?.()}\n onPlaySolo={playSolo}\n onPlayShared={playShared}\n onDeleteSave={deleteCubeforge3DSave}\n onEditAvatar={() => setScreen({ name: 'avatar' })}\n pictureOf={cubeforge3DPicture}\n revision={worldsRevision}\n />\n );\n }\n\n if (screen.name === 'avatar') {\n return (\n <SkinEditorScreen\n theme={theme}\n initial={skin}\n onBack={() => setScreen({ name: 'worlds' })}\n onSave={(cells) => {\n setSkin(cells);\n void skins.save(cells);\n setScreen({ name: 'worlds' });\n }}\n />\n );\n }\n\n const leaveWorld = (summary?: string) => {\n if (helper && summary) void nameAfterPlaying(screen, summary).catch(() => undefined);\n if (friends) setScreen({ name: 'worlds' });\n else onExit?.();\n };\n\n return (\n <Cubeforge3D\n seed={screen.seed}\n worldKey={screen.worldKey}\n room={screen.room}\n skin={skin ? skinToHex(skin) : undefined}\n onExit={leaveWorld}\n helper={screen.shared && !screen.shared.ownedByMe ? undefined : helper}\n onRoomClosed={() => setScreen({ name: 'worlds' })}\n onTokenExpired={refreshRoom}\n />\n );\n}\n\nconst styles = StyleSheet.create({\n fill: { flex: 1 },\n message: { flex: 1, alignItems: 'center', justifyContent: 'center', padding: spacing.lg, gap: spacing.sm },\n title: { fontSize: 18, fontWeight: '700', textAlign: 'center' },\n body: { fontSize: 15, lineHeight: 21, textAlign: 'center' },\n});\n\nexport default YantraGames;\n"],"names":["_a"],"mappings":";;;;;;;;;;;;;;;;;;;AA0EO,SAAS,YAAY,KAA6C,EAAA;AA1EzE,EAAA,IAAA,EAAA;AA2EE,EAAM,MAAA;AAAA,IACJ,OAAA;AAAA,IACA,MAAA;AAAA,IACA,OAAS,EAAA,WAAA;AAAA,IACT,WAAa,EAAA,WAAA;AAAA,IACb,gBAAkB,EAAA,OAAA;AAAA,IAClB,eAAA;AAAA,IACA,wBAAA;AAAA,IACA,qBAAA;AAAA,IACA,eAAiB,EAAA,MAAA;AAAA,IACjB;AAAA,GACE,GAAA,KAAA;AACJ,EAAA,MAAM,eAAe,cAAe,EAAA;AACpC,EAAM,MAAA,KAAA,GAAQ,UAAS,EAAM,GAAA,KAAA,CAAA,KAAA,KAAN,YAAgB,YAAiB,KAAA,MAAA,GAAS,SAAS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