Files
Fishdice/analysis/FishDice/ui.html
2026-06-25 10:46:23 +08:00

65 lines
3.6 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>FishDice UI 管理分析</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<main class="shell">
<div class="topbar"><a href="index.html">← 返回总览</a><span class="brand">UI 管理</span></div>
<section class="hero">
<h1>UI 管理Demo 是运行时构建 UGUI核心框架尚未定义 UI 系统</h1>
<p class="subtitle">当前 UI 设计思想是“表现层消费核心结果”。核心不依赖 UIDemo Controller 用 Canvas、Text、Button 手写一个最小可交互界面。</p>
</section>
<section>
<h2>现有 UI 链路</h2>
<pre>LuckyDiceDemoController.Awake
-> BuildUi
-> ShowReady
Button.onClick
-> StartRoll
-> PlayRollFlow coroutine
-> LuckyDiceDemoRunner.RunRandom
-> ApplyDiceTexts / ShowResult</pre>
<p>UI 在点击后播放普通骰子文本轮播,再把核心结果写回 Text。若结果是 Lucky Dice则显示 3 个 Lucky slot再展示目标玩法信息。</p>
</section>
<section>
<h2>UI 设计思想</h2>
<table>
<tr><th></th><th>当前实现</th><th>含义</th></tr>
<tr><td>核心和表现分离</td><td>核心先一次性算出 <code>LuckyDiceDemoSnapshot</code></td><td>UI 动画不会参与规则、随机或目标模式决策。</td></tr>
<tr><td>状态展示集中</td><td><code>ShowReady</code><code>ShowResult</code><code>SetStatus</code><code>ApplyDiceTexts</code></td><td>Demo 可读,但还不是可复用 UI 框架。</td></tr>
<tr><td>运行时构建界面</td><td><code>BuildUi</code> 代码创建 Canvas、Board、Text、Button。</td><td>方便演示,生产项目应改为 prefab/scene-authored UI。</td></tr>
<tr><td>缺少导航系统</td><td>没有 panel stack、modal、screen router、layer manager。</td><td>当前不能直接承担完整游戏 UI 管理。</td></tr>
</table>
</section>
<section>
<h2>生产化建议</h2>
<div class="grid-2">
<div class="card"><h3>保留核心输出模型</h3><p>继续让核心输出 <code>RollFlowResult</code><code>TargetModeEntry</code><code>RollTrace</code>UI 只消费这些结构。</p></div>
<div class="card"><h3>拆 Presenter</h3><p>把 Demo 中的格式化和状态展示拆成 Presenter/ViewModel避免 UI 文本拼接散落在 Controller。</p></div>
<div class="card"><h3>Prefab 化</h3><p>把 Canvas、骰子格、结果槽、按钮做成 prefab运行时只绑定数据和触发动画。</p></div>
<div class="card"><h3>建立玩法启动 UI 协议</h3><p><code>EnterTargetModeEffect</code><code>TargetModeEntry</code> 应交给上层流程/UI router而不是 Demo Controller 直接决定跳转。</p></div>
</div>
</section>
<section class="evidence">
<h2>证据</h2>
<ul>
<li><span class="path">LuckyDiceDemoController.cs:11</span>Demo UI 是 <code>MonoBehaviour</code></li>
<li><span class="path">LuckyDiceDemoController.cs:131-178</span>:运行时创建 Canvas、Board、Text 和 Button。</li>
<li><span class="path">LuckyDiceDemoController.cs:46-74</span>UI coroutine 消费核心结果并播放表现。</li>
<li><span class="path">LuckyDiceDemoRunner.cs:40-76</span>DemoRunner 把核心结果格式化成 snapshot。</li>
<li><span class="path">Runtime asmdef</span>:核心不引用 Unity UI。</li>
</ul>
</section>
</main>
</body>
</html>