@littlepartytime/dev-kit 1.9.0 → 1.11.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.
|
@@ -41,7 +41,7 @@ export default function PhoneFrame({ children }: { children: React.ReactNode })
|
|
|
41
41
|
<div
|
|
42
42
|
ref={containerRef}
|
|
43
43
|
className="flex items-center justify-center h-full overflow-hidden"
|
|
44
|
-
style={{ minWidth: 0, minHeight: 0 }}
|
|
44
|
+
style={{ flex: 1, minWidth: 0, minHeight: 0 }}
|
|
45
45
|
>
|
|
46
46
|
{/* Wrapper sized to the scaled phone for correct layout flow */}
|
|
47
47
|
<div style={{ width: BODY_W * scale, height: BODY_H * scale, flexShrink: 0 }}>
|
|
@@ -53,6 +53,10 @@ export default function Play() {
|
|
|
53
53
|
},
|
|
54
54
|
reportResult: () => {},
|
|
55
55
|
getAssetUrl: (assetPath: string) => `/assets/${assetPath}`,
|
|
56
|
+
getDeviceCapabilities: () => ({ haptics: false, motion: false }),
|
|
57
|
+
haptic: () => {},
|
|
58
|
+
onShake: () => () => {},
|
|
59
|
+
onTilt: () => () => {},
|
|
56
60
|
} : null;
|
|
57
61
|
|
|
58
62
|
if (!joined) {
|
|
@@ -122,6 +122,10 @@ export default function Preview() {
|
|
|
122
122
|
console.log('Game result reported:', result);
|
|
123
123
|
},
|
|
124
124
|
getAssetUrl: (assetPath: string) => `/assets/${assetPath}`,
|
|
125
|
+
getDeviceCapabilities: () => ({ haptics: false, motion: false }),
|
|
126
|
+
haptic: () => {},
|
|
127
|
+
onShake: () => () => {},
|
|
128
|
+
onTilt: () => () => {},
|
|
125
129
|
};
|
|
126
130
|
}, [engine]);
|
|
127
131
|
|
|
@@ -180,8 +184,8 @@ export default function Preview() {
|
|
|
180
184
|
|
|
181
185
|
return (
|
|
182
186
|
<div className="flex gap-4 h-[calc(100vh-80px)]">
|
|
183
|
-
{/* Renderer —
|
|
184
|
-
<div className="
|
|
187
|
+
{/* Renderer — half the screen width */}
|
|
188
|
+
<div className="h-full" style={{ width: '50%' }}>
|
|
185
189
|
<PhoneFrame>
|
|
186
190
|
{GameRenderer && platform && viewState ? (
|
|
187
191
|
<GameRenderer platform={platform} state={viewState} />
|
|
@@ -218,10 +222,25 @@ export default function Preview() {
|
|
|
218
222
|
const isActive = i === playerIndex;
|
|
219
223
|
const hue = (i * 137) % 360; // deterministic color per player
|
|
220
224
|
const playerState = fullState?.players?.find((ps: any) => ps.id === p.id);
|
|
225
|
+
// Fallback chain: 1) PlayerState field 2) GameState.data mapping table
|
|
221
226
|
const ROLE_KEYS = ['role', 'character', 'team', 'class', 'job', 'faction', 'type'];
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
|
|
227
|
+
const DATA_MAP_KEYS = ['playerRoles', 'roles', 'playerCharacters', 'characters', 'playerTeams', 'teams'];
|
|
228
|
+
let roleLabel: string | undefined;
|
|
229
|
+
// Try PlayerState direct field
|
|
230
|
+
if (playerState) {
|
|
231
|
+
const entry = Object.entries(playerState).find(([k]) => ROLE_KEYS.includes(k.toLowerCase()));
|
|
232
|
+
if (entry) roleLabel = String(entry[1]);
|
|
233
|
+
}
|
|
234
|
+
// Try GameState.data lookup table
|
|
235
|
+
if (!roleLabel && fullState?.data) {
|
|
236
|
+
for (const mapKey of DATA_MAP_KEYS) {
|
|
237
|
+
const map = fullState.data[mapKey];
|
|
238
|
+
if (map && typeof map === 'object' && !Array.isArray(map)) {
|
|
239
|
+
const val = (map as Record<string, unknown>)[p.id];
|
|
240
|
+
if (val != null) { roleLabel = String(val); break; }
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
225
244
|
return (
|
|
226
245
|
<button
|
|
227
246
|
key={p.id}
|
|
@@ -246,9 +265,9 @@ export default function Preview() {
|
|
|
246
265
|
<span className="text-[10px] text-amber-400 shrink-0">HOST</span>
|
|
247
266
|
)}
|
|
248
267
|
</div>
|
|
249
|
-
{
|
|
268
|
+
{roleLabel && (
|
|
250
269
|
<div className="text-[10px] text-zinc-500 truncate">
|
|
251
|
-
{
|
|
270
|
+
{roleLabel}
|
|
252
271
|
</div>
|
|
253
272
|
)}
|
|
254
273
|
</div>
|