MSSDK

SDK 文档


Unity3D SDK Doc

<p>[TOC]</p> <h2>Change history</h2> <table> <thead> <tr> <th>Date of preparation</th> <th>Writer</th> <th>Version</th> <th>Modify content</th> <th>Remarks</th> </tr> </thead> <tbody> <tr> <td>2019.05.18</td> <td>jack.deng</td> <td>1.0.0</td> <td>Create</td> <td>None</td> </tr> <tr> <td>2019.06.14</td> <td>fluty.xie</td> <td>1.0.1</td> <td>Add Android Q platform configuration and share configuration</td> <td>None</td> </tr> <tr> <td>2019.06.28</td> <td>jack.deng</td> <td>1.3.3</td> <td>update the part of iOS.</td> <td>None</td> </tr> <tr> <td>2019.08.15</td> <td>jack.deng</td> <td>1.3.5</td> <td>Description of the new user feedback questionnaire module</td> <td>None</td> </tr> <tr> <td>2019.09.26</td> <td>buck.yu</td> <td>1.3.9</td> <td>New Android Auto Package Instructions Supplements</td> <td>None</td> </tr> <tr> <td>2019.09.26</td> <td>jack.deng</td> <td>1.4.1</td> <td>1. After there is an automatic script, the part of the automatic configuration has a script implementation, does not need user operation, delete. 2. Instructions for adding Android hot updates</td> <td>None</td> </tr> <tr> <td>2019.11.07</td> <td>buck.yu</td> <td>1.4.1.2</td> <td>Add user privacy protocol ui interface, add get custom configuration interface</td> <td>None</td> </tr> <tr> <td>2019.11.25</td> <td>buck.yu</td> <td>1.4.2</td> <td>Advertising tracking interface, policy demand global callback added</td> <td>None</td> </tr> <tr> <td>2019.12.11</td> <td>buck.yu</td> <td>1.5.0</td> <td>Sync Wechat user information, lbs function to get people nearby</td> <td>None</td> </tr> <tr> <td>2019.12.25</td> <td>buck.yu</td> <td>1.5.1</td> <td>1. Increase user information update global event notification; 2, increase channel real-name authentication interface; 3, support the client to import the payment callback address</td> <td>None</td> </tr> <tr> <td>2020.01.08</td> <td>buck.yu</td> <td>1.6.0</td> <td>1. Integrated jpush; 2. LBS / Get the current location</td> <td>None</td> </tr> <tr> <td>2020.01.18</td> <td>buck.yu</td> <td>1.7.0</td> <td>1. Update qq/wechat sdk 2, add exchange code function</td> <td>None</td> </tr> </tbody> </table> <h2>Important information</h2> <ul> <li> <p>Before accessing the SDK, you need to apply for an account in our background and create application parameters. For details, please refer to the <a href="https://www.showdoc.cc/mssdk?page_id=2692703335764519">Technical Middle Taiwan Service Access Guide</a>。</p> </li> <li> <p>Please <a href="https://www.showdoc.cc/mssdk?page_id=2615409307929897">contact us</a> if you encounter any problems or ambiguities in the access process.</p> </li> <li>After the developer's access to the SDK is complete, it can be self-tested according to the test cases we provide. The test cases are as follows: <img src="https://github.com/veryitman/MSSDKResource/blob/mark-feature/sdk_test_case.png?raw=true" alt="" /></li> </ul> <p>This document describes how to integrate the music tease public version of the method, if you want to come out of the channel package outside the music tease can refer to <a href="https://www.showdoc.cc/mssdk?page_id=3651814975352989">Unity 渠道接入</a> 文档;</p> <h2>1. Introduction to the Unity SDK</h2> <p>For Unity game developers, access to the native SDK (iOS / Android) Although all the functions of the SDK can be used normally, considering that many studios use the Unity engine for game development, Zhongtai has developed a Unity version of the SDK on the basis of the native SDK, and game developers using Unity only need to care about their business logic and further reduce development costs.</p> <h3>1.1 Unity SDK Features</h3> <p>The Unity SDK implements the following functions based on the native SDK:</p> <ul> <li> <p><strong>Interface Service Layer Package</strong> For the need of flexibility, the native SDK adopts the design scheme of common parameters, that is, the incoming parameter is the dictionary type, and the meaning of the dictionary is explained by the document. The result of the output is the generic type id / Object. Although it is flexible in use, it is not clear. Business parties usually need to query the corresponding documents to know what parameters need to be passed in and what type the interface will return. On this basis, the Unity interface does a business-level encapsulation. When in use, the business clearly calls a specific interface according to specific business needs, passes in business-related parameters, and when returned, it also clearly returns the object of C #. The object structure and content are clearly visible at the business level without going through documents.</p> </li> <li> <p><strong>Encapsulate the communication process between Unity and Native</strong> To access the Native SDK, it is necessary to realize two-way communication between the Native end and the C # end. This communication process, not game business-related content, belongs to platform-related content. It should not let game developers care. Therefore, the Unity SDK encapsulates the relevant communication technology details, only need to call the C # business-related interface in the business layer, can realize the corresponding functions. There is no need to maintain and implement these underlying communication mechanisms.</p> </li> <li><strong>Automatically configure some information about the platform.</strong> For platform access, it is usually necessary to configure some platform-related content, such as the addition Framework for iOS, adding compilation parameters, and so on. These work are also related to the access SDK and do not belong to the business side, and the Unity SDK, combined with Unity's own mechanism, helps developers complete the corresponding content automatically, simplifying access-related work.</li> </ul> <p>Therefore, for ordinary Unity game developers, the Unity SDK is highly recommended.</p> <h3>1.2 Special Note</h3> <p><strong>Special note: If the developer's application has server (such as strong login APP) resources can consider accessing our relevant interfaces on the server side, which can ensure the security of login and payment. Specific access documents can be viewed <a href="https://www.showdoc.cc/mssdk?page_id=2640157465255050">MSSDK Service-side access to documents</a></strong></p> <p><strong>This integration document explains how to access the public version of Letease, channel access and integration can refer to <a href="https://www.showdoc.cc/mssdk?page_id=3651814975352989">channel access</a></strong></p> <h2>2. Integrated Unity SDK</h2> <h3>2.1 Get Unity SDK package</h3> <p>Please <a href="https://www.showdoc.cc/mssdk?page_id=2615409307929897">Contact Us</a> Get SDK.</p> <h4>Unity SDK structure</h4> <p><img src="https://www.showdoc.cc/server/api/common/visitfile/sign/31b68d3ed7dfa73dc9abf966df5d0617?showdoc=.jpg" alt="" /></p> <p><strong>html Folder</strong> This folder contains documents related to the SDK. The API folder is an API document. Double-click index.html to view the API description</p> <p><strong>MSLDSDK.unitypackage</strong></p> <p>The MSLDSDK.unitypackage includes the Native SDK for iOS and Android, as well as some configurations.</p> <p><strong>MSLDSDKSample.unitypackage</strong></p> <p>MSLDSDKSample.unitypackage. Shows how to call the MSLD SDK interface to implement relevant functions. You can import this package and refer to the invocation method.</p> <h3>2.2 Import MSLDSDK.unitypackage to Unity project</h3> <p>Double-click <code>MSLDSDK.unitypackage</code>to open the import interface. Click &quot;import&quot;. Import all files</p> <p><img src="https://www.showdoc.cc/server/api/common/visitfile/sign/ad17be8715533b4728753e50d4e8ef34?showdoc=.jpg" alt="" /></p> <h3>2.3 SDK integration</h3> <h4>2.3.1 Application for SDK parameters</h4> <ul> <li>Enter the [microservice business console] (<a href="http://biz.cloud.idreamsky.com">http://biz.cloud.idreamsky.com</a>) and create the application. Configure the content according to the application.</li> <li>Download the SDK configuration file msConfig.json to local. <img src="https://www.showdoc.cc/server/api/common/visitfile/sign/36b54eae086135c849e8f7417f832947?showdoc=.jpg" alt="" /></li> </ul> <h4>2.3.2 Configuration msConfig.json file</h4> <blockquote> <p>Both Android and IOS need a separate msconfig.json file.</p> </blockquote> <h5>iOS</h5> <p>Place the downloaded configuration file msConfig.json in the Assets / Plugins / iDreamsky / msld / iOS directory in the Unity project directory.</p> <h5>Android</h5> <p>Place the downloaded profile msConfig.json in the Assets / Plugins / iDreamsky / msld / Android directory in the Unity project directory.</p> <h4>2.3.3 Public Logic Integration</h4> <h5>2.3.3.1 Initialize SDK</h5> <blockquote> <p>You must initialize SDK before using SDK.</p> </blockquote> <p>When the game starts, call the MSLDSDK.Init (API CallBack callback) method. The callback returns the result asynchronously for the initialization</p> <p>```C# using iDreamsky.MSLD; ......</p> <p>void Start() { MSLDSDK.InitSDK(InitSDKCallBack); ...... }</p> <p>void InitSDKCallBack(MSLDErrorCode code, string msg) { if (code == MSLDErrorCode.Success) { MSLDInfoWindow.Info(&quot;init success!&quot;); } else { MSLDInfoWindow.Info(&quot;init failed! code = &quot; + code + &quot; msg = &quot; + msg); } }</p> <pre><code> ##### 2.3.3.2 Set up a global callback. When something happens, the SDK will inform the game that the game does dependent logic according to its own business. After the initialization is complete, set the global callback listening. SDK V1.4.2 Add minors, visitor policy restrictions, and 4 new callback types to the global callback (see example) ```C# using iDreamsky.MSLD; ...... void Start() { ...... MSLDSDK.SetEventCallBack(OnSDKEventCallBack); } // Global event callback void OnSDKEventCallBack(MSLDSDK.Event eventID, object eventObj) { MSLDInfoWindow.Info("收到SDK全局事件回调:" + eventID); switch (eventID) { case MSLDSDK.Event.SwitchAccount: // This callback is received when an account switch occurs within the SDK break; case MSLDSDK.Event.LogOut: // This callback is received when an account is logged out within the SDK break; case MSLDSDK.Event.RedeliveryOrder: //This callback is received when a supplement occurs within the SDK. eventObj is the payment result structure. break; case MSLDSDK.Event.PolicyMinorsPaymentLimit: //V1.4.2 added, minor recharge limit, currently not allowed to recharge. break; case MSLDSDK.Event.PolicyMinorsPlayTimeLimit: //V1.4.2 added, Minors' playtime has reached the limit. break; case MSLDSDK.Event.PolicyNoAuthPaymentLimit: //V1.9.5 added, guest accounts are not allowed to recharge. break; case MSLDSDK.Event.PolicyNoAuthPlayTimeLimit: //V1.9.5 added, guest accounts have reached the upper limit of game time. break; case MSLDSDK.Event.PolicyMinorsCurfewLimit: //V1.9.5 added, Minor users have reached the curfew time limit. break; case MSLDSDK.Event.AccountInfoUpdated: //V1.5.1 added, When the user information is updated, it will be triggered in time. break; default: //"unknow callback:id =" + eventID); break; } }</code></pre> <h2>3. Functional integration</h2> <p>The game according to its own business situation, access the corresponding functions. At present, the SDK provides account system, payment system, sharing, lbs, push, bbs and other functions</p> <p><strong>Before you integrate the functionality, make sure you have completed the integration part of section 2.3.3 common logic.</strong></p> <h3><strong> Access Precautions </strong></h3> <ul> <li>Channel logout interface, some channels do not log out function, need to judge whether to support before use。</li> </ul> <h3>3.1 Integrated Account</h3> <p>Functions related to the account system, in the MSLDAccount Manager class。</p> <h4>3.1.1 Login panel</h4> <h5>3.1.1.1 Normal login panel</h5> <p>Call the MSLDAccountManager.ShowLoginPannel(APICallBack &lt; MSLDAccount &gt; callback) to exhale the login panel.</p> <p>```C# using iDreamsky.MSLD; using iDreamsky.MSLD.Account; ......</p> <p>MSLDAccountManager.ShowLoginPannel((MSLDErrorCode code, string msg, MSLDAccount account) =&gt; { if (code == MSLDErrorCode.Success) { MSLDInfoWindow.Info(&quot;login success! account:&quot; + account.desc()); } else if (code == MSLDErrorCode.UIUserClose) { MSLDInfoWindow.Info(&quot;login failed! code = &quot; + code + &quot; msg = &quot; + msg); } else { MSLDInfoWindow.Info(&quot;login failed! code:&quot; + code + &quot; msg:&quot; + msg); } });</p> <pre><code> ##### 3.1.1.2 One-click login(quick login) The SDK has a built-in one-click login function. If the one-click login function is configured and the phone number can be obtained normally, the one-click login page will be displayed first in the process of exhaling the login panel. See the documents in detail. [Unity版极光集成](https://www.showdoc.cc/mssdk?page_id=3742980023778348) #### 3.1.2 Login as Guest Call the MSLDAccountManager.GuestLogin(APICallBack &lt; MSLDAccount &gt; callback) to call the Guest login process. ```C# MSLDAccountManager.GuestLogin((MSLDErrorCode code, string msg, MSLDAccount account) =&gt; { if (code == MSLDErrorCode.Success) { MSLDInfoWindow.Info("login guest success! account:" + account.desc()); } else if (code == MSLDErrorCode.UIUserClose) { MSLDInfoWindow.Info("user cancel login code = " + code + " msg = " + msg); } else { MSLDInfoWindow.Info("login guest faile ! code = " + code + " msg = " + msg); } });</code></pre> <h4>3.1.3 Automatic Login</h4> <p>Call MSLDAccountManager.AutoLogin(APICallBack callback) and log in with the local save token.</p> <p>Automatic login is to log in using the last login information. If the user does not log in last time or the login information fails, the automatic login will fail. At this point, the user should be allowed to log in in another way.</p> <p>```C# using iDreamsky.MSLD; using iDreamsky.MSLD.Account; ......</p> <p>MSLDAccountManager.AutoLogin(OnAutoLoginCallBack); ......</p> <p>/*</p> <ul> <li>Automatic login callback */ void OnAutoLoginCallBack(MSLDErrorCode code, string msg, MSLDAccount account) { if (code == MSLDErrorCode.Success) { MSLDInfoWindow.Info(&quot;Automatic login successful! account:&quot; + account.desc()); } else if (code == MSLDErrorCode.UIUserClose) { MSLDInfoWindow.Info(&quot;user cancel login! code = &quot; + code + &quot; msg = &quot; + msg); } else { MSLDInfoWindow.Info(&quot;Automatic login failed! code = &quot; + code + &quot; msg = &quot; + msg); } } <pre><code></code></pre></li> </ul> <h4>3.1.4 User Center</h4> <p>MSLDAccountManager.ShowUserCenterPannel(APICallBack callback) is called to display the user center panel.</p> <p>```C# using iDreamsky.MSLD; using iDreamsky.MSLD.Account; ......</p> <p>MSLDAccountManager.ShowUserCenterPannel(OnShowUserCenterPannelCallBack); ......</p> <p>/*</p> <ul> <li>callback */ void OnShowUserCenterPannelCallBack(MSLDErrorCode code, string msg, object data) { if (code == MSLDErrorCode.Success) { MSLDInfoWindow.Info(&quot;show success!&quot;); } else if (code == MSLDErrorCode.UIUserClose) { MSLDInfoWindow.Info(&quot;user close UserCenter! code = &quot; + code + &quot; msg = &quot; + msg); } else { MSLDInfoWindow.Info(&quot;show failed! code = &quot; + code + &quot; msg = &quot; + msg); } } <pre><code></code></pre></li> </ul> <h4>3.1.5 Real name authentication</h4> <p>Call MSLDAccountManager.AuthenticationPanel(APICallBack callback) to display the real name authentication panel.</p> <p>```C#</p> <p>using iDreamsky.MSLD; using iDreamsky.MSLD.Account; ......</p> <p>MSLDAccountManager.AuthenticationPanel(OnAuthenticationPanelCallBack); ......</p> <p>/*</p> <ul> <li>callback<br /> */ void OnAuthenticationPanelCallBack(MSLDErrorCode code, string msg, object data) { if (code == MSLDErrorCode.Success) { MSLDInfoWindow.Info(&quot;authentication success!&quot;); } else if (code == MSLDErrorCode.UIUserClose) { MSLDInfoWindow.Info(&quot;user cancel ! code = &quot; + code + &quot; msg = &quot; + msg); } else { MSLDInfoWindow.Info(&quot;authentication failed! code = &quot; + code + &quot; msg = &quot; + msg); } } <pre><code></code></pre></li> </ul> <h4>3.1.6 Get user information</h4> <p>User information is obtained by calling MSLDAccountManager.GetLoginedUserInfo(). When the user is not logged in, return null, otherwise return the user information currently logged in.</p> <p>```C# MSLDAccount account = MSLDAccountManager.GetLoginedUserInfo(); if (account != null) { MSLDInfoWindow.Info(&quot;user info: &quot; + account.desc()); } else { MSLDInfoWindow.Info(&quot;info is null &quot;); }</p> <pre><code> #### 3.1.7 Agreement Privacy Terms ##### 3.1.7.1 User Protocol - no ui version Return User Protocol Content (rich text) Example: ```C# MSLDAccountManager.AgreementDirect((MSLDErrorCode code, string msg, MSLDWebContent data) =&gt; { if (code == MSLDErrorCode.Success) { MSLDInfoWindow.Info("Get User Protocol Success! webContent:" + data.desc()); } else { MSLDInfoWindow.Info("Get User Protocol Failed! code = " + code + " msg = " + msg); } });</code></pre> <ul> <li>ui version There will be a callback when the user closes the protocol.</li> </ul> <p>Example:</p> <p>```C# MSLDAccountManager.Agreement((MSLDErrorCode code, string msg, string data) =&gt; { if(code ==MSLDErrorCode.UIUserBack){ MSLDInfoWindow.Info(&quot;user back game&quot;); } });</p> <pre><code> ##### 3.1.7.1 Privacy Terms - no ui version Return to privacy clause content (rich text) Example: ```C# MSLDAccountManager.PrivacyDirect((MSLDErrorCode code, string msg, MSLDWebContent data) =&gt; { if (code == MSLDErrorCode.Success) { MSLDInfoWindow.Info("Access to Privacy Protocol Successful! webContent:" + data.desc()); } else { MSLDInfoWindow.Info("Access to Privacy Protocol Failed! code = " + code + " msg = " + msg); } });</code></pre> <ul> <li>ui version</li> </ul> <p>There will be a callback when users close privacy terms</p> <p>Example:</p> <p>```C# MSLDAccountManager.Privacy((MSLDErrorCode code, string msg, string data) =&gt; { if(code ==MSLDErrorCode.UIUserBack){ MSLDInfoWindow.Info(&quot;user back game&quot;); } });</p> <pre><code> #### 3.1.8 Custom local configuration &gt; This feature is supported from the `MSSDK 1.4.1.2 'version, only valid for Android platform, and can be modified and replaced by a packaged system. &gt;Developers can use this profile to determine the functionality of the game to call MSSDK, such as a channel package or a public version of the package.。 - Background In order to meet the special functional requirements of the game side under different channels, the corresponding values are written into the game package according to different channels during subcontracting processing. - Example Channel A needs to use channel login, channel B needs to use SDK visitor login, at this time you can use configuration file * * customConfig.json * * (in Unity project), can write the key value to "login type": 1, use 1 to represent channel login, 2 for visitor login, The key and value of the key value pair can be customized. When the game is used, it will be returned in the form of a json string, and the meaning of each key value pair needs to be synchronized to the business BP and make corresponding configuration modifications in the packaging background. - use Add a custom value to the file customConfig.json (Assets/Plugins/iDreamsky/msld/Android/customConfig.json ), such as {"xxx": 121213 "abc": "cccc"} Read the file (valid only under Android, empty characters return on other platforms) ```C# string rStr = MSLDSDK.GetCustomConfig();</code></pre> <h4>3.1.9 Synchronize Wechat user information (nickname, avatar)</h4> <blockquote> <p><code>MSSDK 1.5.0</code> Begin to provide Wechat parameters (wx <em> app </em> id and wx <em> app </em> secret) must be configured to msconfig (android iOS) for normal use you need to log in before you can call.</p> </blockquote> <p>Brief description:</p> <p>Obtain Wechat nicknames and avatars, Wechat authorization is successful and the information is synchronized to return the new MSLDAccount object</p> <p>Example:</p> <p>```c# using iDreamsky.MSLD.Account;</p> <p>MSLDAccountManager.SyncWechatInfo((MSLDErrorCode code, string msg, MSLDAccount data) =&gt; { if (code == MSLDErrorCode.Success) { MSLDInfoWindow.Info(&quot;Synchronizing the Wechat information.:&quot; + data.desc()); } else { MSLDInfoWindow.Info(&quot;Synchronizing Wechat information failed! code = &quot; + code + &quot; msg = &quot; + msg); } });</p> <pre><code> ### 3.2 Payment System Calling public static void PurchaseProduct(MSLDProduct product, MSLDCPInfo cpInfo, MSLDPayMethod payMethod, APICallBack &lt; MSLDPayResult &gt; callback), you can initiate a purchase request. **product** Parameter product represents commodity-related information. Information such as commodity ID, commodity type, commodity name, price, currency, etc., is passed into the purchase process through this object. You need to go to [Business Console] (http://biz.cloud.idreamsky.com) to configure the corresponding props, get the commodity ID. ![](https://github.com/veryitman/MSSDKResource/blob/mark-feature/Unity3D/guide-main/guide_04.png?raw=true) For iOS, you need to go to [Apple Developer Backstage] (https://developer.apple.com/) to configure props, and the configured prop ID is the commodity ID. For other fields in the product object, you can pull from Apple later through the interface QueryProduct(string productID, APICallBack &lt; MSLDProduct &gt; callback). For Android, all kinds of information in the product is processed by the CP side itself, such as reading from a local profile. **cpInfo** Parameter cpInfo represents a variety of information related to the CP side. Player ID, CP order number, CP data, notes, order title, transparent field, etc., are passed into the purchase process through this object. **payMethod** PayMethod is a purchase method, and iOS supports Apple Pay. Android supports pull-up payment panels, direct-to-Wechat, and direct-to-Alipay payment methods. Access selects according to their scenario. **Payment results** For stand-alone games, all payment results are returned from the global callback MSLDSDK. Event. Redelivery Order event. When the order is dropped and the order is successful, the SDK global callback receives the MSLDSDK. Event. Redelivery Order event and brings back the payment result. Be sure to handle the patch event of MSLDSDK. Event. Redelivery Order. #### 3.2.1 Buying goods ```C# ...... using iDreamsky.MSLD.Payment; using iDreamsky.MSLD; ...... public MSLDProduct product; public MSLDCPInfo cpInfo; ...... //From version MSS DK 1.5.1, support the client to pass in the payment callback address, the payment callback address, if this value is empty, the callback address configured by the microservice console product = new MSLDProduct("0", "test01", "测试商品1", "1.23", "人民币","Pay callback address, pass empty use server configuration address"); cpInfo = new MSLDCPInfo("pid1234", "mchNO123456", "cpDataxxxxx", "remarkXXXXX", "subjectXXXXX", "attachXXX"); ...... //Call this interface to initiate a purchase request. Product represents commodity-related information, please refer to the description of the MSLDProduct class. CPInfo represents some information on the CP side. Including CP's order number, user ID, transparent field, and so on. MSLDPaymentManager.PurchaseProduct(this.product, this.cpInfo, payMethod, (MSLDErrorCode code, string msg, MSLDPayResult order) =&gt; { if (MSLDErrorCode.Success == code) { MSLDInfoWindow.Info("pay Success msg = " + msg + "order: " + order.desc()); } else { MSLDInfoWindow.Info("pay failed! code = " + code + " msg = " + msg); } });</code></pre> <h4>3.2.2 Realization of order supplement agent method (client-side distribution of goods must be received)</h4> <p>Processing the supplement event in the global callback function that receives the SDK.</p> <p>```C# using iDreamsky.MSLD.Payment; using iDreamsky.MSLD;</p> <p>// Global event callback // see more at 2.3.3.2 void OnSDKEventCallBack(MSLDSDK.Event eventID, object eventObj) {</p> <pre><code>MSLDInfoWindow.Info("收到SDK全局事件回调:" + eventID); switch (eventID) { case MSLDSDK.Event.RedeliveryOrder: { // This callback is received when a supplement occurs within the SDK. MSLDInfoWindow.Info("[补单]支付信息:" + eventObj.ToString()); MSLDPayResult mSLDPayResult = (MSLDPayResult)eventObj; // After receiving the supplement result, the access party needs to reissue the props ...... MSLDInfoWindow.Info("Add corresponding props..."); // After the success of the corresponding props, the consumption results need to be reported. MSLDPaymentManager.ReportOrderConsumed(mSLDPayResult.orderNo, (MSLDErrorCode codeROC, string msgROC) =&gt; { MSLDInfoWindow.Info("Report consumption results completed! code:" + codeROC + " msg:" + msgROC); }); } break; }</code></pre> <p>}</p> <pre><code> #### 3.2.3 Restore purchases(iOS) This feature is unique to the iOS platform. Call the Restore Transactions (API CallBack &lt; string [] &gt; callback) function. This interface returns a list of productid purchases. ```C# using iDreamsky.MSLD.Payment; using iDreamsky.MSLD; MSLDPaymentManager.RestoreTransactions((MSLDErrorCode code, string msg, string[] restoreIDs) =&gt; { if (code == MSLDErrorCode.Success) { MSLDInfoWindow.Info("Restore purchase success!" + restoreIDs + "count:" + restoreIDs.Length); foreach (string restore in restoreIDs) { MSLDInfoWindow.Info("--- productID:" + restore); } } else { MSLDInfoWindow.Info("Restore purchase failed!"); } });</code></pre> <h4>3.2.4 Query commodity information(iOS)</h4> <p>This feature is unique to the iOS platform. Commodity-related information can be queried according to ID. Commodity information for Android is stored by the access party itself. There may generally be a list of commodity configurations locally.</p> <p>```C# using iDreamsky.MSLD.Payment; using iDreamsky.MSLD;</p> <p>......</p> <p>string queryProductId = &quot;test_01&quot;; MSLDPaymentManager.QueryProduct(queryProductId, (MSLDErrorCode code, string msg, MSLDProduct product) =&gt; { if (code == MSLDErrorCode.Success) { MSLDInfoWindow.Info(&quot;Query props successful! &quot; + product.desc()); } else { MSLDInfoWindow.Info(&quot;Query props failed! code = &quot; + code + &quot; msg = &quot; + msg); } });</p> <pre><code> ### 3.3 share #### 3.3.1 分享平台应用信息获取 Currently supported sharing SNS including QQ and Wechat, developers need to create applications on the corresponding platform and set up relevant information. Create an app in [Wechat Open Platform] (https://open.weixin.qq.com/) and get the Wechat AppId, contact channel business colleagues specifically. Create apps in [Tencent Open Platform] (https://open.tencent.com/) and get QQ AppId, contact channel business colleagues. #### 3.3.2 Platform engineering settings Fill in Wechat AppId, QQAppId in the MSSDK profile msConfig.json for Android and iOS platforms. Note that the keys are "wx _ app _ id" and "qq _ app _ id", respectively. ![](https://www.showdoc.cc/server/api/common/visitfile/sign/03ac18f172191d5b192be2010b6d7338?showdoc=.jpg) #### 3.3.3 Share interface calls Call the public static void Share(MSLDShareContent content, MSLDShareScence scence, APICallBack callBack) interface, you can complete the sharing function. Sharing currently supports sharing pictures, sharing links, and sharing applets. Support sharing to QQ, Qzone, Wechat circle of friends, Wechat session four scenarios. ** content ** Parameters Please do not use the objects of the MSLDShareContent class, use its subclass objects. The subclasses currently supported are MSLDShareContent Image (Image), MSLDShareContent Web page (link), and MSLDShareContent Mini Program (small program). Select the corresponding content object according to the business, fill in the corresponding value, and then pass the object into the sharing interface. ** scence ** For sharing scenarios. If sharing applets only support sharing to Wechat, this parameter can be ignored. ** callBack ** To share results.。 ```C# using iDreamsky.MSLD.Share; using iDreamsky.MSLD; ...... public void OnClickShare() { MSLDShareContent shareContent = null; MSLDShareContentType scType = contentTypeList[shareContentDropdown.value]; switch (scType) { case MSLDShareContentType.Image: shareContent = FindObjectOfType&lt;share_panel_content_image&gt;().shareContentImage; break; case MSLDShareContentType.Web: shareContent = FindObjectOfType&lt;share_panel_content_webpage&gt;().shareContentWebpage; break; case MSLDShareContentType.MiniProgram: shareContent = FindObjectOfType&lt;share_panel_content_miniprogram&gt;().shareContentMiniProgram; break; } MSLDShareScence scence = scenceTypeList[shareScenceDropdown.value]; MSLDInfoWindow.Info("Share content[" + shareContent.Desc() + "]" + " scence[" + scence + "]"); MSLDShareManager.Share(shareContent, scence, shareCallBack); } void shareCallBack(MSLDErrorCode code, string msg) { if (code == iDreamsky.MSLD.MSLDErrorCode.Success) { Debug.Log("share success"); } else { Debug.Log("share failed"); } }</code></pre> <h3>3.4 Questionnaire</h3> <p>At present, the questionnaire star supports the following functions:</p> <ul> <li> <ol> <li>Support the specified questionnaire star address, need to configure the questionnaire star address in the console;</li> </ol> </li> <li> <ol> <li>Support custom scenarios into different questionnaire star addresses, do not need console configuration, only need the client to enter the questionnaire star address;</li> </ol> </li> <li> <ol> <li>Support the callback of the results of the client callback questionnaire star;</li> </ol> </li> <li> <ol> <li>Support the callback of the completion results of the server-side callback questionnaire star, and the server-side callback address of the developer needs to be configured on the console;</li> </ol> </li> </ul> <p>Detailed documentation can be found in the [Unity version of the questionnaire star integration] (<a href="https://www.showdoc.cc/mssdk?page_id=3370316907650536">https://www.showdoc.cc/mssdk?page_id=3370316907650536</a>).</p> <h3>3.5 hot update(Android)</h3> <p>Hot updates on the Android side are currently supported.</p> <h4>3.5.1 Gets lebian Parameters</h4> <p>The thermal update adopts the technical scheme of encapsulating music change. The business needs to apply the corresponding parameters in the lebian user center: MainChId and LEBIAN_SECID.</p> <h4>3.5.2 Configuration hot update</h4> <p>Fill in the parameters of lebian in the MSSDK configuration file msConfig.json for Android and iOS platforms</p> <p>Note that the key are &quot;lb_MainChId&quot; and &quot;lb_LEBIAN_SECID&quot;, respectively, with the following screenshot examples:</p> <p><img src="https://www.showdoc.cc/server/api/common/visitfile/sign/718cc99627952b00cc40d793d8aa7e16?showdoc=.jpg" alt="" /></p> <p>When the configuration is complete, re-export the Android project to integrate the thermal update feature.</p> <h4>3.6 Advertising Tracking</h4> <p>MSSDK-Unity integrates ad tracking - related features in V1.4.2. Advertising tracking requires the access party to call the corresponding interface in the corresponding business logic part.</p> <h5>3.6.1 After the login is successful, please call ReportADLogin to report the login information</h5> <p>``` C# ADTrackManager.ReportADLogin(&quot;test123&quot;,null);</p> <pre><code> ##### 3.6.2 After the purchase is successful, please call ReportAD Purchase to report the purchase information. ``` C# ADTrackManager.ReportADPurchase("test123", 99.00f, null);</code></pre> <h5>3.6.3 After clicking on the ad, please call the Report AD Click to report the relevant information.</h5> <p>``` C# ADTrackManager.ReportADClick(ADPlatforms.Adcolony, ADTypes.Banner,null);</p> <pre><code> ##### 3.6.4 Call the Report AD Custom to report custom information ``` C# Hashtable ht = new Hashtable(); ht["k"] = "v"; string key = "key"; ADTrackManager.ReportADCustom(key,iDreamsky.Common.MSLDJSON.jsonEncode(ht), null);</code></pre> <h4>3.7 bugly</h4> <p>After filling the app id applied in the background of the bugly developer into msConfig.json (Android &amp; IOS), MSSDK will automatically start bugly. The corresponding key in the msConfig.json file is bugly_app_id.</p> <h4>3.8 LBS</h4> <p>Features included:</p> <ul> <li> <ol> <li>Get people nearby</li> </ol> </li> <li> <ol> <li>Obtain current location information</li> </ol> </li> </ul> <p>Detailed documentation can be seen <a href="https://www.showdoc.cc/mssdk?page_id=3742789464476580">Unity version of LBS integration</a>.</p> <h4>3.9 jiguang push</h4> <p>Features included:</p> <ul> <li> <ol> <li>one-click login</li> </ol> </li> <li> <ol> <li>push</li> </ol> </li> </ul> <p>Detailed documentation can be seen <a href="https://www.showdoc.cc/mssdk?page_id=3742980023778348">Unity jiguang push</a>.</p> <h4>3.10 Redeem</h4> <h5>3.10.1 ui version</h5> <p>Example:</p> <p>``` C#</p> <p>using iDreamsky.MSLD;</p> <p>MSLDRedeemManager.ShowRedeem((MSLDErrorCode code, string msg, string data) =&gt; { if (code == MSLDErrorCode.Success) { MSLDInfoWindow.Info(&quot;redeem success:&quot; + msg + &quot;,produceID =&quot; + data); } else { MSLDInfoWindow.Info(&quot;redeem failed:code =&quot; + code + &quot;, msg = &quot; + msg); } });</p> <pre><code> ##### 3.10.2 no ui version Example: ``` C# using iDreamsky.MSLD; string getCode = "xxxx"; MSLDRedeemManager.RedeemDirect( getCode, (MSLDErrorCode code, string msg, string data) =&gt; { if (code == MSLDErrorCode.Success) { MSLDInfoWindow.Info("redeem success:" + msg + ",produceID =" + data); } else { MSLDInfoWindow.Info("redeem failed :code =" + code + ", msg = " + msg); } });</code></pre> <h4>3.11 bbs</h4> <p>Features included:</p> <ul> <li> <ol> <li>Community initialization</li> </ol> </li> <li> <ol> <li>Showcase the community</li> </ol> </li> <li> <ol> <li>Number of messages obtained</li> </ol> </li> </ul> <p>Detailed documentation can be seen <a href="https://www.showdoc.cc/mssdk?page_id=3812293863039627">Unity-bbs</a>。</p>

页面列表

ITEM_HTML