feat: 实现游戏核心功能与前端界面
- 添加游戏核心系统:战斗、任务、日志、随机数生成等 - 实现前端主界面、HUD、底部导航和各类卡片组件 - 添加用户认证系统与游戏存档持久化 - 配置项目基础架构与开发环境 - 补充文档说明与Docker部署支持
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
export function StatMeter({
|
||||
label,
|
||||
value,
|
||||
maxValue,
|
||||
tone,
|
||||
}: {
|
||||
label: string;
|
||||
value: number;
|
||||
maxValue: number;
|
||||
tone: 'health' | 'neutral' | 'danger';
|
||||
}) {
|
||||
const percentage = Math.max(0, Math.min(100, (value / maxValue) * 100));
|
||||
|
||||
return (
|
||||
<article className={`stat-meter tone-${tone}`}>
|
||||
<div>
|
||||
<span>{label}</span>
|
||||
<strong>
|
||||
{Math.round(value)}
|
||||
<small>/{Math.round(maxValue)}</small>
|
||||
</strong>
|
||||
</div>
|
||||
<div className="meter-track">
|
||||
<div className="meter-fill" style={{ width: `${percentage}%` }} />
|
||||
</div>
|
||||
</article>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user