Spaces:
Sleeping
Sleeping
fix: use cat sprites for guest agents instead of lobster sprites
Browse files- Guests now use cats-spritesheet (sleeping cats on cushions) instead of guest_anim lobsters
- Adam mapped to cat frame 1, Eve to cat frame 3
- All three frontends (Office, Adam, Eve) now show consistent cat characters
- Adjusted name label Y offset for cat sprite size
frontend/electron-standalone.html
CHANGED
|
@@ -4454,43 +4454,21 @@ function toggleBrokerPanel() {
|
|
| 4454 |
sprite = game.add.sprite(p.x, p.y, animKey, f).setOrigin(0.5, 1).setScale(1.1);
|
| 4455 |
if (sprite.anims && sprite.anims.play) sprite.anims.play(animKey, true);
|
| 4456 |
} else {
|
| 4457 |
-
// 非 demo 访客:
|
| 4458 |
-
//
|
| 4459 |
-
|
| 4460 |
-
|
| 4461 |
-
|
| 4462 |
-
if (
|
| 4463 |
-
|
| 4464 |
-
|
| 4465 |
-
|
| 4466 |
-
animIdx = KNOWN_AGENTS[aid.toLowerCase()];
|
| 4467 |
-
if (!animIdx) {
|
| 4468 |
-
let hash = 0;
|
| 4469 |
-
for (let i = 0; i < aid.length; i++) hash = (hash * 31 + aid.charCodeAt(i)) >>> 0;
|
| 4470 |
-
animIdx = (hash % 6) + 1;
|
| 4471 |
-
}
|
| 4472 |
}
|
| 4473 |
-
const animKey = `guest_anim_${animIdx}`;
|
| 4474 |
-
const animIdleKey = `guest_anim_${animIdx}_idle`;
|
| 4475 |
|
| 4476 |
-
if (game.textures.exists(
|
| 4477 |
-
sprite = game.add.sprite(p.x, p.y,
|
| 4478 |
-
sprite.anims.play(animIdleKey, true);
|
| 4479 |
} else {
|
| 4480 |
-
|
| 4481 |
-
? agent.avatar
|
| 4482 |
-
: (() => {
|
| 4483 |
-
const aid = String(agent.agentId || '');
|
| 4484 |
-
let hash = 0;
|
| 4485 |
-
for (let i = 0; i < aid.length; i++) hash = (hash * 31 + aid.charCodeAt(i)) >>> 0;
|
| 4486 |
-
return GUEST_AVATARS[hash % GUEST_AVATARS.length];
|
| 4487 |
-
})();
|
| 4488 |
-
|
| 4489 |
-
if (staticAvatarKey && game.textures.exists(staticAvatarKey)) {
|
| 4490 |
-
sprite = game.add.image(p.x, p.y, staticAvatarKey).setOrigin(0.5, 1).setScale(1.15);
|
| 4491 |
-
} else {
|
| 4492 |
-
sprite = game.add.text(p.x, p.y, '⭐', { fontFamily: 'ArkPixel, monospace', fontSize: '30px' }).setOrigin(0.5, 1);
|
| 4493 |
-
}
|
| 4494 |
}
|
| 4495 |
}
|
| 4496 |
sprite.setDepth(2600);
|
|
@@ -4501,7 +4479,7 @@ function toggleBrokerPanel() {
|
|
| 4501 |
// demo 水星下移 10px(仅 demo_mercury)
|
| 4502 |
const yOffset = (DEMO_MODE && (agent.agentId === 'demo_mercury' || agent.name === '水星')) ? 10 : 0;
|
| 4503 |
|
| 4504 |
-
const nameTextY = isDemo ? ((p.y + yOffset) - 80) : ((p.y + yOffset) -
|
| 4505 |
const nameText = game.add.text(p.x, nameTextY, agent.name || '访客', {
|
| 4506 |
fontFamily: 'ArkPixel, monospace',
|
| 4507 |
fontSize: isDemo ? '16px' : '15px',
|
|
|
|
| 4454 |
sprite = game.add.sprite(p.x, p.y, animKey, f).setOrigin(0.5, 1).setScale(1.1);
|
| 4455 |
if (sprite.anims && sprite.anims.play) sprite.anims.play(animKey, true);
|
| 4456 |
} else {
|
| 4457 |
+
// 非 demo 访客:使用 cats spritesheet 中的猫咪形象
|
| 4458 |
+
// Known agents get fixed cat frames; others hash to a frame
|
| 4459 |
+
const KNOWN_CAT_FRAMES = { 'adam': 1, 'eve': 3 };
|
| 4460 |
+
const aid = String(agent.agentId || '');
|
| 4461 |
+
let catFrame = KNOWN_CAT_FRAMES[aid.toLowerCase()];
|
| 4462 |
+
if (catFrame === undefined) {
|
| 4463 |
+
let hash = 0;
|
| 4464 |
+
for (let i = 0; i < aid.length; i++) hash = (hash * 31 + aid.charCodeAt(i)) >>> 0;
|
| 4465 |
+
catFrame = hash % 16;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4466 |
}
|
|
|
|
|
|
|
| 4467 |
|
| 4468 |
+
if (game.textures.exists('cats')) {
|
| 4469 |
+
sprite = game.add.sprite(p.x, p.y, 'cats', catFrame).setOrigin(0.5, 1).setScale(0.6);
|
|
|
|
| 4470 |
} else {
|
| 4471 |
+
sprite = game.add.text(p.x, p.y, '🐱', { fontFamily: 'ArkPixel, monospace', fontSize: '30px' }).setOrigin(0.5, 1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4472 |
}
|
| 4473 |
}
|
| 4474 |
sprite.setDepth(2600);
|
|
|
|
| 4479 |
// demo 水星下移 10px(仅 demo_mercury)
|
| 4480 |
const yOffset = (DEMO_MODE && (agent.agentId === 'demo_mercury' || agent.name === '水星')) ? 10 : 0;
|
| 4481 |
|
| 4482 |
+
const nameTextY = isDemo ? ((p.y + yOffset) - 80) : ((p.y + yOffset) - 105);
|
| 4483 |
const nameText = game.add.text(p.x, nameTextY, agent.name || '访客', {
|
| 4484 |
fontFamily: 'ArkPixel, monospace',
|
| 4485 |
fontSize: isDemo ? '16px' : '15px',
|