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

64 lines
4.3 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 资源管理分析</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<main class="shell">
<div class="topbar"><a href="index.html">← 返回总览</a><span class="brand">资源管理</span></div>
<section class="hero">
<h1>资源管理:当前是“配置内建 + Demo 极简资源”,还不是完整资源系统</h1>
<p class="subtitle">源码里没有 Addressables、AssetBundle、Prefab 加载器或资源生命周期管理器。核心资源概念主要体现为内建配置数据Demo UI 只通过 <code>Resources.GetBuiltinResource</code> 取 Unity 内置字体。</p>
</section>
<section>
<h2>当前资源形态</h2>
<table>
<tr><th>资源/配置</th><th>当前位置</th><th>管理方式</th><th>评价</th></tr>
<tr><td>普通骰子面</td><td><code>LuckyDiceDefaultConfig</code></td><td>硬编码默认集合2、3、4、5、6、clover。</td><td>适合第一版可测闭环,不适合策划热改。</td></tr>
<tr><td>Lucky Dice 结果</td><td><code>LuckyDiceDefaultConfig</code></td><td>硬编码 rocket、thief 和默认 slot count。</td><td>语义清楚,但还缺图标/Prefab 资源绑定。</td></tr>
<tr><td>规则表</td><td><code>ComboRuleDefinition</code></td><td>定义行加载为运行时 <code>ComboRule</code></td><td>已经具备迁移到 JSON/ScriptableObject 的形状。</td></tr>
<tr><td>目标模式映射</td><td><code>TargetModeDefinition</code></td><td>result key + target key -> mode key。</td><td>适合作为玩法启动器的配置入口。</td></tr>
<tr><td>Demo 字体</td><td><code>LuckyDiceDemoController</code></td><td><code>Resources.GetBuiltinResource&lt;Font&gt;("LegacyRuntime.ttf")</code></td><td>仅 Demo 兜底,不是业务资源系统。</td></tr>
</table>
</section>
<section>
<h2>资源边界判断</h2>
<p>当前框架刻意把核心运行时做成纯 C#,所以资源加载不能直接放入 Runtime 核心。真正落地生产时,建议在 Unity 接入层增加“配置提供者”和“表现资源解析器”:</p>
<pre>Runtime Core
只认识 ResultKey / TargetKey / ModeKey / DiceFace
Unity Integration Layer
ResultKey -> Icon Sprite / Animation / Prefab
TargetKey + ModeKey -> Scene / Controller / Launcher
Remote or Local Config -> ComboRuleDefinition / LuckyDiceCandidateDefinition</pre>
</section>
<section>
<h2>后续资源系统建议</h2>
<div class="grid-2">
<div class="card"><h3>配置资源</h3><p><code>ComboRuleDefinition</code><code>LuckyDiceCandidateDefinition</code><code>TargetModeDefinition</code> 迁移为 JSON、ScriptableObject 或远端表时,保持先校验再创建 runtime config。</p></div>
<div class="card"><h3>表现资源</h3><p>新增一个独立的 Unity 层映射:<code>ResultKey -> icon/prefab/animation</code>,不要让 Runtime 持有 Sprite 或 GameObject。</p></div>
<div class="card"><h3>目标玩法资源</h3><p><code>TargetModeEntry</code> 驱动目标玩法 launcherlauncher 再决定加载 scene、panel、prefab 或 addressable。</p></div>
<div class="card"><h3>资源失败处理</h3><p>资源加载失败应回到表现层兜底;核心选择结果不应因为图标缺失而改变。</p></div>
</div>
</section>
<section class="evidence">
<h2>证据</h2>
<ul>
<li><span class="path">Packages/manifest.json</span>:项目含 <code>com.unity.modules.assetbundle</code>,但源码未发现实际 AssetBundle/Addressables 使用。</li>
<li><span class="path">LuckyDiceDefaultConfig.cs:65-88</span>:普通骰子和 Lucky Dice set 由代码内建。</li>
<li><span class="path">LuckyDiceDefaultConfig.cs:151-238</span>:规则、候选和 target mode 默认定义在代码中。</li>
<li><span class="path">LuckyDiceDemoController.cs:244</span>Demo 唯一明确资源读取是内置字体。</li>
<li><span class="path">rg Addressables/AssetBundle/LoadAsset</span>:当前 FishDice 源码没有业务资源加载器证据。</li>
</ul>
</section>
</main>
</body>
</html>