Online co-op browser remake of Arknights' Stronghold Protocol: Alliance (client-simulated combat, official waves/bonds/items/strategies, 3D board, facing wheel, operator loadout, official emotes, deployment scripts).
29 lines
1.4 KiB
JavaScript
29 lines
1.4 KiB
JavaScript
// Active effects list (m.private.effects: band / 机变 / team / item / garrison effects with counters):
|
|
// compact icon column at the right edge, rich-text tooltip per effect.
|
|
|
|
import { html, Tooltip, MicroLabel } from './components.js';
|
|
import { Img, RichText, GIcon } from './gameComponents.js';
|
|
import { effectIconUrl } from './assetUrls.js';
|
|
import { data } from '../data.js';
|
|
|
|
const KIND = { band: '策略', choice: '机变', team: '团队增益', item: '道具', garrison: '特质' };
|
|
|
|
/** @param {{ effects: any[] }} props */
|
|
export function EffectsList({ effects }) {
|
|
const list = (Array.isArray(effects) ? effects : []).filter((e) => e && (e.name || e.desc));
|
|
if (!list.length) return null;
|
|
const m = data.get('assets');
|
|
return html`<div class="effects" aria-label="生效中的效果">
|
|
<${MicroLabel}>EFFECTS</${MicroLabel}>
|
|
${list.slice(0, 10).map((e, i) => html`<${Tooltip} key=${e.id ?? i} placement="bottom" text=${html`<div class="efftip">
|
|
<b>${e.name || '效果'}</b><span class="efftip__kind">${KIND[e.iconKind] || ''}${e.counter != null ? ` · ${e.counter}` : ''}</span>
|
|
<${RichText} as="p" text=${e.desc || ''} />
|
|
</div>`}>
|
|
<span class=${`effect effect--${e.iconKind || 'x'}`}>
|
|
<${Img} src=${effectIconUrl(m, e)} fallback=${html`<${GIcon} name="bolt" />`} />
|
|
${e.counter != null && e.counter !== '' ? html`<b class="effect__n num">${e.counter}</b>` : null}
|
|
</span>
|
|
<//>`)}
|
|
</div>`;
|
|
}
|