引擎大包(含交互/表现/通用能力等)重构指南
<table>
<thead>
<tr>
<th>开发文档</th>
<th>重构指南</th>
</tr>
</thead>
<tbody>
<tr>
<td>作者</td>
<td>赖俊贤</td>
</tr>
<tr>
<td>Review</td>
<td>QFord</td>
</tr>
<tr>
<td>创建时间</td>
<td>2023-12-22</td>
</tr>
<tr>
<td>修改时间</td>
<td>2023-12-22</td>
</tr>
<tr>
<td>注意</td>
<td>此文档会随着重构进程而不定期更新</td>
</tr>
</tbody>
</table>
<h1>背景</h1>
<p>物件播放组件的重构的主要任务是解除对PlayerCore等和颗粒播放器相关的依赖。
除了器材业务的重构,还包括各个引擎大包组件(引擎、通用能力、交互等)的重构。
为了明确重构的细节和指导各个组件的负责人如何进行重构,故编写了本指南。</p>
<h1>重构案例</h1>
<p>引擎大包组件重构的主要任务是将原先组件对Player组件的依赖调整为对物件播放组件的依赖
以通用能力组件(vlab-generalability)为例,示意图如下
<img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=f580f2bb05180ab12e8881a817a1b3d8&amp;file=file.png" alt="" /></p>
<h2>依赖调整步骤(以通用能力组件 vlab-generalability为例)</h2>
<h4>1、使用Unity打开组件UPM工程</h4>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=578756ca57d5391c1e4175bedd778d92&amp;file=file.png" alt="" /></p>
<h4>2、添加物件播放组件UPM包</h4>
<h5>2.1 设置UPM URL</h5>
<pre><code class="language-json">&quot;scopedRegistries&quot;: [
{
&quot;url&quot;: &quot;http://nexus.sdp.nd/repository/unity-upm/&quot;,
&quot;scopes&quot;: [
&quot;com.nd&quot;
],
&quot;name&quot;: &quot;SDP&quot;
}
]</code></pre>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=d20bc1548280970efe9151532c3a9eab&amp;file=file.png" alt="" /></p>
<h5>2.2 打开工程目录\Packages\manifest.json,添加UPM包依赖:"com.nd.vlab-equipmentplayer" : "x.x.x"(具体版本号咨询赖俊贤)</h5>
<h4>3、逐步修改程序集依赖</h4>
<h5>3.1 查看目标程序集的依赖</h5>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=a92e795ab898aea240786e2faccff9e5&amp;file=file.png" alt="" /></p>
<h5>3.2 增加对物件播放组件的依赖</h5>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=a9814db35c9d60e8464c1eb527133d59&amp;file=file.png" alt="" /></p>
<h5>3.2 删除其中对Player组件程序集的依赖</h5>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=120e728793dec00e6c6a4c847343492a&amp;file=file.png" alt="" /></p>
<p>Player组件程序集清单</p>
<pre><code class="language-json">&quot;VLabCoreCommon&quot;,
&quot;VLabPlatform&quot;,
&quot;VLabPlayerCommonUI&quot;
&quot;VlabTools&quot;,
&quot;VLabCoursewareView&quot;,
&quot;VLabPlayerCore&quot;,
&quot;VLabPlayerView&quot;,
&quot;LabFramework&quot;,
&quot;LabFramework.Interface&quot;,
&quot;VLabResource&quot;</code></pre>
<h5>3.3 修改代码报错</h5>
<p>报错一般是引用丢失,物件播放组件一般不改动类名,所以只需引入物件播放组件的命名空间即可
<img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=c2482301f102bbb0c951f99723b2693f&amp;file=file.png" alt="" /></p>
<h4>4、发包测试</h4>
<h1>FAQ和典型问题</h1>