Icone a pixel per gli oggetti dell'inventario: squama, libro e chiave
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017egeN2amL84ErjfgQFtEDn
This commit is contained in:
+12
-3
@@ -177,12 +177,21 @@ function updateInventory() {
|
||||
inventoryKey = key;
|
||||
const box = $('inventory');
|
||||
box.replaceChildren(...game.state.inventory.map(id => {
|
||||
const b = document.createElement('button'), item = story.items[id], dot = document.createElement('i');
|
||||
const b = document.createElement('button'), item = story.items[id];
|
||||
b.type = 'button';
|
||||
b.dataset.item = id;
|
||||
b.setAttribute('aria-pressed', String(command.item === id));
|
||||
dot.style.background = item.icon?.fill ?? '#ccc';
|
||||
b.append(dot, item.name);
|
||||
// L'icona a pixel dell'oggetto (assets/icons); senza, un pallino del suo colore.
|
||||
let icon;
|
||||
if (item.icon?.src) {
|
||||
icon = document.createElement('img');
|
||||
icon.src = item.icon.src;
|
||||
icon.alt = '';
|
||||
} else {
|
||||
icon = document.createElement('i');
|
||||
icon.style.background = item.icon?.fill ?? '#ccc';
|
||||
}
|
||||
b.append(icon, item.name);
|
||||
let timer = null, long = false;
|
||||
b.addEventListener('pointerdown', () => { long = false; timer = setTimeout(() => { long = true; command.clickItem(id, { look: true }); }, LONG_PRESS); });
|
||||
b.addEventListener('pointerup', () => clearTimeout(timer));
|
||||
|
||||
Reference in New Issue
Block a user