Action交接内容
<p>[TOC]</p>
<h2>文档地址</h2>
<p>[策划案地址](<a href="http://cube.nd.com.cn/svn/prototype/VirtualLab/tocvlab/HCI/V2.0/#id=qiqxm6&p=%E7%A7%BB%E5%8A%A8-3d%E4%BD%8D%E7%A7%BB">http://cube.nd.com.cn/svn/prototype/VirtualLab/tocvlab/HCI/V2.0/#id=qiqxm6&p=%E7%A7%BB%E5%8A%A8-3d%E4%BD%8D%E7%A7%BB</a> "策划案地址")
[通用交互表](<a href="https://docs.qq.com/sheet/DWlBVSlZvRXJIVU94?tab=e9t6zk">https://docs.qq.com/sheet/DWlBVSlZvRXJIVU94?tab=e9t6zk</a> "通用交互表")
[接口文档地址](<a href="https://www.showdoc.com.cn/VLab/9980883540423480">https://www.showdoc.com.cn/VLab/9980883540423480</a> "接口文档地址")</p>
<h2>待办</h2>
<h3>非功能需求</h3>
<h4>自动移动</h4>
<p>之前考虑到像镊子伸入到容器内部,这种无法用自动寻路算法来实现,因此没有使用,而是采用了多段直线来寻路,这种方法效果比较差,还没有优化,后面使用的过程中发现,可以把需要深入到器材内部的移动,让周竑使用直线移动,不用自动寻路的方案。<strong>因此后续优化可以考虑使用自动寻路的方案</strong>。
关键代码如下:
<img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=9fbd10318a00a5f52f44c5fc95601df8&amp;file=file.png" alt="" /></p>
<h4>虚影和包围盒</h4>
<p>Action这边有两个需求,一个是生成虚影,一个是器材的Meshbound,虚影的生成在上层交互中已经有GhostHelpComponent组件,它会合并器材的Mesh来生成虚影,为了能快速计算Meshbound,对器材的虚影做了缓存,通过combine的mesh生成bound才比较准确,因此有了GhostCacheManager这个类。
但是有些器材的Mesh在运行时会经常变,比如滤纸,所以又做了忽略缓存的配置
IgnoreElements,具体使用如下:</p>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=72447f3ec670341053514b4217a121e8&amp;file=file.png" alt="" /></p>
<p>后续优化可以考虑取消对虚影的缓存,就是去掉对GhostCacheManager的使用,因为只要避免Action这层在update在计算Meshbound就可以,避免一直合并Mesh,这个问题会导致iPad下内存耗尽,崩溃。</p>
<h4>多语言</h4>
<p>目前Action的多语言文件和应用绑在一起,后续可以抽出来单独在组件中更新
1)在安装组件时把多语言文件拷贝到StreamAsset目录下,这个目前有这个流程
2)在初始化时使用自己的多语言文件
<img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=e5803b221221c3a1ce18801b798cd00d&amp;file=file.png" alt="" /></p>
<h4>资源优化</h4>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=2e6ca121387c5165fa9ac8a31d154fca&amp;file=file.png" alt="" /></p>
<h3>优化需求</h3>
<h4>点击UI大小调整</h4>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=de5d2dfaacf9ddf082798638ef57c0d5&amp;file=file.png" alt="" /></p>
<h4>双击特效</h4>
<p>群号:5057753919069944
打开显微镜UI双击效果
<img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=15979ffcb037efb0a092cf3884a18715&amp;file=file.png" alt="" /></p>
<h4>移动箭头特效</h4>
<p>资源群号:4942305198534159
需求澄清群号:5042360756595178
<img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=226444a0372f7aaa344f2cab216c9d02&amp;file=file.png" alt="" /></p>
<p>对应需求:
<img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=c2e424e954d15cd011b9d73ac17c8a98&amp;file=file.png" alt="" /></p>
<h4>镜头控制优化</h4>
<p>需求澄清群号:5042360756595178
这块张煜园前期有做了一部分镜头控制的Action,后续可能时集成到交互Action中使用
<img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=42566801241bd58712c7af5c89d9dceb&amp;file=file.png" alt="" /></p>
<h4>观察优化</h4>
<p>需求澄清群号:5042360756595178
<img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=c77cec297d6ec43631f705984cf2dad8&amp;file=file.png" alt="" /></p>
<h2>开发新交互Action的流程</h2>
<h4>需求澄清</h4>
<p>设计师对接沈秋娟</p>
<h4>开发过程</h4>
<p>一般采用软连接的方案,直接在U3D工程中开发,开发结束后接触软链接</p>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=a0a49be9bc50a3ce1dc3ffba088d30d6&amp;file=file.png" alt="" /></p>
<p>Action一般要考虑引导和自动,分别放在这两个目录</p>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=48ec8b2f550e4638f8ccc4904188efc8&amp;file=file.png" alt="" /></p>
<p>引导的Action继承自InteracLimitAction,这个基类有交互禁用相关的功能,通常在实验开始前,所有的交互被禁用
<img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=3ff50a0e4ef96040d51a13ef29d908ba&amp;file=file.png" alt="" /></p>
<p>在Action执行时需要自己设置下面的值来开启Action业务相关的交互。
<img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=d1daf29255337cd705db6e329765133c&amp;file=file.png" alt="" /></p>
<p>自动的Action继承自InteracAction</p>
<h4>资源</h4>
<p>资源的管理目前放在应用端统一打包,详情咨询涂畅
资源存放路径:
<img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=d82f8f752471a86d96cdddc66aa6bc74&amp;file=file.png" alt="" /></p>
<p>资源打包
<img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=a1fb114be7d5b2aaa122f90daa4cd60b&amp;file=file.png" alt="" /></p>
<h4>自测</h4>
<p>文件的编号建议和这个[文档](<a href="https://docs.qq.com/sheet/DWlBVSlZvRXJIVU94?tab=e9t6zk">https://docs.qq.com/sheet/DWlBVSlZvRXJIVU94?tab=e9t6zk</a> "文档")里的编号一致,方便查找</p>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=54def1fe15bef9ac68ac176f8d0804aa&amp;file=file.png" alt="" /></p>
<p>关键测试Action的方法
<img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=a080ef53adaa5fbebc351d6416e025ac&amp;file=file.png" alt="" /></p>
<h4>发布</h4>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=4881b2043cb13871e24e35664b45eab4&amp;file=file.png" alt="" /></p>
<h2>FAQ</h2>
<h4>怎么创建虚影</h4>
<p>核心是使用这个类GuidePositionTip</p>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=a1630fdf2525a8b528f8f2cee7613668&amp;file=file.png" alt="" /></p>
<h4>怎么加载资源</h4>
<p>核心是使用这个类ResourcesUtil</p>
<pre><code class="language-csharp">//加载预制
ResourcesUtil.Load&lt;GameObject&gt;(&quot;GuideArrow/GuideArrow.prefab&quot;)
//加载UI
ResourcesUtil.Load&lt;Sprite&gt;(System.IO.Path.Combine(GuideUtils.GuideUIRootPath, (&quot;dump_content_icon_slider_hov@2x.png&quot;)
//加载声音
ResourcesUtil.Load&lt;AudioClip&gt;(&quot;Audios/音效/PourWater&quot;);</code></pre>
<p>另外七佛有封装了一个专门针对UI资源的加载类LoadActionUI
<img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=ba1e6885f1b58f13641be854ea353696&amp;file=file.png" alt="" /></p>
<h4>怎么调用交互组件</h4>
<h5>注册移动回调</h5>
<pre><code class="language-csharp">_SRMoveComponent = SRPerformanceFacade.GetPerformance&lt;ISRMoveComponent&gt;(ElementGo);
_SRMoveComponent?.SetCallBack(InteractiveLibConst.MASTER_CONTROL_0, EndMoveEvent);
private void EndMoveEvent(SRInteractiveData info)
{
if (info.m_strType.Equals(InteractiveLibConst.END_MOVE))
{
bFinish = GuideMoveToEnd();
}
}
//移除
_SRMoveComponent?.RemoveCallBack(InteractiveLibConst.MASTER_CONTROL_0, EndMoveEvent);</code></pre>
<h5>注册点击回调</h5>
<pre><code class="language-csharp">var clickComponent = SRPerformanceFacade.GetPerformance&lt;ISRClickDownComponent&gt;(sourceElementGo.FindChildGameObject(this.subTransPath));
if (clickComponent != null)
{
clickComponent.SetCallBack(InteractiveLibConst.MASTER_CONTROL_0, ClickEventHandler);
}
private void ClickEventHandler(SRInteractiveData obj)
{
}
//移除
clickComponent.RemoveCallBack(InteractiveLibConst.MASTER_CONTROL_0, ClickEventHandler);</code></pre>
<h5>主动触发交互</h5>
<p>这块比较复杂可以先看下这两个类有没有前人封装好的方法InteractUtil,JointUtil
如果没有的话,建议咨询张煜园,可能业务不同,方法也不一样,让他给出对应的接口和方法
<strong>拼接</strong>
<img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=5f3e99e336402c5a9a74c1e0a096fffe&amp;file=file.png" alt="" /></p>
<p><strong>夹取</strong>
<img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=04dad95083afa18234b3b3e19df89267&amp;file=file.png" alt="" /></p>
<p><strong>舀取</strong>
<img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=e15ee6175bb07dcf9e123da8d253c5aa&amp;file=file.png" alt="" /></p>