Unity版问卷星接入
<p>[TOC]</p>
<h2>变更历史</h2>
<table>
<thead>
<tr>
<th>编写日期</th>
<th>编写人员</th>
<th>版本</th>
<th>修改内容</th>
<th>备注</th>
</tr>
</thead>
<tbody>
<tr>
<td>2019.11.18</td>
<td>buck.yu</td>
<td>1.4.2</td>
<td>分档拆分,添加调用参数</td>
<td>无</td>
</tr>
</tbody>
</table>
<h2>问卷星</h2>
<p>目前用户反馈模块,支持问卷调查功能。</p>
<h4>1.1 配置</h4>
<h4>1.1.1 问卷星后台配置</h4>
<ul>
<li>
<p>问卷调查功能目前使用<a href="https://www.wjx.cn/">问卷星</a>。开发者首先要在问卷星登录账号,创建问卷。并获取问卷的地址。
<img src="https://www.showdoc.cc/server/api/common/visitfile/sign/445cf16b349def41d60a7390e85a7109?showdoc=.jpg" alt="" /></p>
</li>
<li>
<p>创建问卷时,“提交答卷后的处理方式”修改为“跳转到指定网址”,地址<strong>必须</strong>填写为“<a href="http://localhost/survey_finish">http://localhost/survey_finish</a>” 跳转提示文字不做要求.
<img src="https://www.showdoc.cc/server/api/common/visitfile/sign/db768ae63be3363feaf980bd8f8aaaf9?showdoc=.jpg" alt="" /></p>
</li>
<li>“数据推送API”的“HTTP POST地址”<strong>必须</strong>填写为“<a href="http://j10.dapi.uu.cc/eai/wjdc">http://j10.dapi.uu.cc/eai/wjdc</a>”
<img src="https://www.showdoc.cc/server/api/common/visitfile/sign/96a8144e61dac6c4700f73d5c6055f2a?showdoc=.jpg" alt="" /></li>
</ul>
<h4>1.1.2 微服务业务控制台配置</h4>
<p>在在线参数配置项中,配置(1)问卷开关,用于控制整个问卷调查功能是否可用。(2)问卷地址。这个是3.4.1.1.1中问卷星上获取的问卷的地址。
<img src="https://www.showdoc.cc/server/api/common/visitfile/sign/a05e56a882bd8c01b2ef8fcf2053104b?showdoc=.jpg" alt="" /></p>
<h4>1.2 问卷调查功能是否可用</h4>
<p>调用MSLDFeedbackManager 类的方法 public static bool IsQuestionEnabled() 获取当前问卷调查功能是否可用。可用依赖这个值决定是否在游戏相应界面显示问卷调查路况。</p>
<p>```C#
using iDreamsky.MSLD.Feedback;
using iDreamsky.MSLD;</p>
<p>......</p>
<p>bool isEnable = MSLDFeedbackManager.IsQuestionEnabled();
if (isEnable)
{
isEnabledText.text = "问卷调查是否可用: 是";
}
else
{
isEnabledText.text = "问卷调查是否可用: 否";
}</p>
<pre><code>
#### 1.3 展示问卷调查面板
调用接口 MSLDFeedbackManager 类的方法 public static void ShowQuestion(ExtraInfo extInfo, APICallBack callback)
**extInfo** 为调用起问卷星所需要的一些额外信息。为ExtraInfo 类型。其中:
* level:用户等级 必填
* accruingAmounts:用户累计消费金额,必填
* consecutiveDays:用户连续登陆天数,必填
* playerId: 玩家Id
* serverId: 服务器Id
* roleId: 角色Id
* extra:扩展字段,非必填
* qUrl: 问卷地址,非必填
**这里特别注意**:如果开发者需要自己在特殊场景下弹出不同的问卷内容,可以通过传入 qUrl 的值来进行控制,但是如果客户端传入了此值,问卷调查将优先使用传入的值作为问卷地址展示给用户。如果此值为空,则使用后台配置的默认问卷地址。
如果想使用 qUrl 字段,需要升级MSSDK到1.4.2版本。
另外,问卷星支持客户端通知开发者客户端,也支持MSSDK服务端通知开发者服务端,具体可以参考 [问卷星服务端接入](https://www.showdoc.cc/mssdk?page_id=3169583440854192) 文档。
```C#
using iDreamsky.MSLD.Feedback;
using iDreamsky.MSLD;
MSLDFeedbackManager.ExtraInfo extInfo = new MSLDFeedbackManager.ExtraInfo();
extInfo.level = 100;
extInfo.accruingAmounts = 100;
extInfo.consecutiveDays = 100;
extInfo.playerId = "12345";
extInfo.serverId ="12345";
extInfo.roleId = "wesley";
extInfo.extra = "extra";
extInfo.qUrl = "http://abc.wxy.com";
MSLDFeedbackManager.ShowQuestion(extInfo, (MSLDErrorCode code, string msg) =>
{
if (code == MSLDErrorCode.Success)
{
MSLDInfoWindow.Info("成功!");
}
else if (code == MSLDErrorCode.UIUserClose)
{
MSLDInfoWindow.Info("用户关闭");
}
else
{
MSLDInfoWindow.Info("失败! code = " + code + " msg = " + msg);
}
});</code></pre>