From 796ec47e91f2ddfd02dc55a454267f282433f3b2 Mon Sep 17 00:00:00 2001 From: 小川 费 <449111130@qq.com> Date: Sat, 21 Sep 2019 11:10:32 +0800 Subject: [PATCH] 1 --- images/sdk_021.png | Bin 58644 -> 0 bytes images/sdk_022.png | Bin 24686 -> 0 bytes images/sdk_023.png | Bin 86969 -> 0 bytes images/sdk_024.png | Bin 37645 -> 0 bytes images/sdk_025.png | Bin 57828 -> 0 bytes images/sdk_026.png | Bin 63328 -> 0 bytes images/sdk_027_1.png | Bin 47313 -> 0 bytes images/sdk_027_2.png | Bin 99323 -> 0 bytes images/sdk_027_3.png | Bin 101696 -> 0 bytes images/sdk_027_4.png | Bin 98836 -> 0 bytes images/sdk_028.png | Bin 83443 -> 0 bytes images/sdk_029.png | Bin 105752 -> 0 bytes images/sdk_030.png | Bin 0 -> 29660 bytes images/sdk_031.png | Bin 0 -> 64278 bytes images/sdk_032.png | Bin 0 -> 187827 bytes install.md | 4 ++-- platform.md | 96 ++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------ 17 files changed, 50 insertions(+), 50 deletions(-) mode change 100644 => 100755 images/sdk_027_1.png mode change 100644 => 100755 images/sdk_027_2.png mode change 100644 => 100755 images/sdk_027_3.png mode change 100644 => 100755 images/sdk_027_4.png mode change 100644 => 100755 images/sdk_028.png mode change 100644 => 100755 images/sdk_029.png create mode 100755 images/sdk_030.png create mode 100755 images/sdk_031.png create mode 100755 images/sdk_032.png diff --git a/images/sdk_021.png b/images/sdk_021.png index 512a29b..4f436ef 100755 Binary files a/images/sdk_021.png and b/images/sdk_021.png differ diff --git a/images/sdk_022.png b/images/sdk_022.png index 394532b..b95c222 100755 Binary files a/images/sdk_022.png and b/images/sdk_022.png differ diff --git a/images/sdk_023.png b/images/sdk_023.png index 7a38357..553ba14 100755 Binary files a/images/sdk_023.png and b/images/sdk_023.png differ diff --git a/images/sdk_024.png b/images/sdk_024.png index efe314d..5730377 100755 Binary files a/images/sdk_024.png and b/images/sdk_024.png differ diff --git a/images/sdk_025.png b/images/sdk_025.png index c482583..556a537 100755 Binary files a/images/sdk_025.png and b/images/sdk_025.png differ diff --git a/images/sdk_026.png b/images/sdk_026.png index 44f4fa4..c93bd61 100755 Binary files a/images/sdk_026.png and b/images/sdk_026.png differ diff --git a/images/sdk_027_1.png b/images/sdk_027_1.png old mode 100644 new mode 100755 index 732c8bc..52e491d Binary files a/images/sdk_027_1.png and b/images/sdk_027_1.png differ diff --git a/images/sdk_027_2.png b/images/sdk_027_2.png old mode 100644 new mode 100755 index a52f670..08d3a35 Binary files a/images/sdk_027_2.png and b/images/sdk_027_2.png differ diff --git a/images/sdk_027_3.png b/images/sdk_027_3.png old mode 100644 new mode 100755 index 66df9ee..d2894b3 Binary files a/images/sdk_027_3.png and b/images/sdk_027_3.png differ diff --git a/images/sdk_027_4.png b/images/sdk_027_4.png old mode 100644 new mode 100755 index e8f21e5..2f7e170 Binary files a/images/sdk_027_4.png and b/images/sdk_027_4.png differ diff --git a/images/sdk_028.png b/images/sdk_028.png old mode 100644 new mode 100755 index 355ddab..51b81de Binary files a/images/sdk_028.png and b/images/sdk_028.png differ diff --git a/images/sdk_029.png b/images/sdk_029.png old mode 100644 new mode 100755 index d724cce..f9582dc Binary files a/images/sdk_029.png and b/images/sdk_029.png differ diff --git a/images/sdk_030.png b/images/sdk_030.png new file mode 100755 index 0000000..e4daaf3 Binary files /dev/null and b/images/sdk_030.png differ diff --git a/images/sdk_031.png b/images/sdk_031.png new file mode 100755 index 0000000..b8273f1 Binary files /dev/null and b/images/sdk_031.png differ diff --git a/images/sdk_032.png b/images/sdk_032.png new file mode 100755 index 0000000..33cb56b Binary files /dev/null and b/images/sdk_032.png differ diff --git a/install.md b/install.md index 3e2eb2d..389ae8d 100644 --- a/install.md +++ b/install.md @@ -85,7 +85,7 @@ ZoneId: "1", // 分区ID,默认:1 Mode: "game", // 支付的类型,不同的支付类型有各自额外要传的附加参数,默认:game CurrencyType: "CNY", // 币种,默认:CNY - Platform: '' // 申请接入时的平台,platform与应用id有关。默认:android(ios暂时没有开放,这里需要配置Platform,开放后,删掉此配置,sdk已经判断平台) + Platform: '' // 申请接入时的平台,platform与OfferId(米大师申请的应用id)有关,详情请阅读文档config.js参数MidasPay下的Platform配置 } }; ``` @@ -193,7 +193,7 @@ CurrencyType:币种,默认:"CNY" - Platform:申请接入时的平台,platform与应用id有关。 + Platform:申请接入时的平台,platform与OfferId(米大师申请的应用id)有关。 1)接入了米大师,填写"android"(ios暂时没有开放) diff --git a/platform.md b/platform.md index 71e935b..c085693 100644 --- a/platform.md +++ b/platform.md @@ -8,27 +8,18 @@ #### **此模块是参照微信小游戏提供的api进行封装的公用方法,提供了以下游戏中常用到的功能:** -**支付打点:logPay** (此模块保留logPay调用只是为了兼容已经接入的游戏,该api已经归类到【统计模块】下面的[支付打点](stat_pay.md)栏)。 +1. **支付打点:logPay** (此模块保留logPay调用只是为了兼容已经接入的游戏,该api已经归类到【统计模块】下面的[支付打点](stat_pay.md)栏)。 +2. **打开客服消息:openCustomerServiceConversation** 整理[wx.openCustomerServiceConversation](https://developers.weixin.qq.com/minigame/dev/api/open-api/customer-message/wx.openCustomerServiceConversation.html) -**打开客服消息:openCustomerServiceConversation** 整理[wx.openCustomerServiceConversation](https://developers.weixin.qq.com/minigame/dev/api/open-api/customer-message/wx.openCustomerServiceConversation.html) - -**检测版本更新:checkUpdate** 整理来自:[wx.getUpdateManager](https://developers.weixin.qq.com/minigame/dev/api/base/update/UpdateManager.html) - -**显示模态弹出框:showModal** 整理来自:[wx.showModal](https://developers.weixin.qq.com/minigame/dev/api/ui/interaction/wx.showModal.html) - -**复制文本:copy** 整理来自:[wx.setClipboardData](https://developers.weixin.qq.com/minigame/dev/api/device/clipboard/wx.setClipboardData.html) - -**长震动:vibrateLong** 整理来自:[wx.vibrateLong](https://developers.weixin.qq.com/minigame/dev/api/device/vibrate/wx.vibrateLong.html) - -**短震动:vibrateShort** 整理来自:[wx.vibrateShort](https://developers.weixin.qq.com/minigame/dev/api/device/vibrate/wx.vibrateShort.html) - -**更新转发属性:updateShareMenu** 整理来自:[wx.updateShareMenu](https://developers.weixin.qq.com/minigame/dev/api/share/wx.updateShareMenu.html) - -**微信小游戏推荐弹窗组件GamePortal:isGamePortalPlaying 与 gamePortalShow** 整理来自:[wx.createGamePortal](https://developers.weixin.qq.com/minigame/dev/api/game-portal/GameBanner.html) - -**微信小游戏推荐icon组件GameIcon:gameIconShow 与 gameIconDestroy** 整理来自:[wx.createGameIcon](https://developers.weixin.qq.com/minigame/dev/api/game-portal/wx.createGameIcon.html) - -**微信小游戏插屏广告组件InterstitialAd:isInterstitialPlaying 与 interstitialShow** 整理来自:[wx.createInterstitialAd](https://developers.weixin.qq.com/minigame/dev/api/ad/InterstitialAd.html) +3. **检测版本更新:checkUpdate** 整理来自:[wx.getUpdateManager](https://developers.weixin.qq.com/minigame/dev/api/base/update/UpdateManager.html) +4. **显示模态弹出框:showModal** 整理来自:[wx.showModal](https://developers.weixin.qq.com/minigame/dev/api/ui/interaction/wx.showModal.html) +5. **复制文本:copy** 整理来自:[wx.setClipboardData](https://developers.weixin.qq.com/minigame/dev/api/device/clipboard/wx.setClipboardData.html) +6. **长震动:vibrateLong** 整理来自:[wx.vibrateLong](https://developers.weixin.qq.com/minigame/dev/api/device/vibrate/wx.vibrateLong.html) +7. **短震动:vibrateShort** 整理来自:[wx.vibrateShort](https://developers.weixin.qq.com/minigame/dev/api/device/vibrate/wx.vibrateShort.html) +8. **更新转发属性:updateShareMenu** 整理来自:[wx.updateShareMenu](https://developers.weixin.qq.com/minigame/dev/api/share/wx.updateShareMenu.html) +9. **微信小游戏推荐弹窗组件GamePortal:isGamePortalPlaying 与 gamePortalShow** 整理来自:[wx.createGamePortal](https://developers.weixin.qq.com/minigame/dev/api/game-portal/GameBanner.html) +10. **微信小游戏推荐icon组件GameIcon:gameIconShow 与 gameIconDestroy** 整理来自:[wx.createGameIcon](https://developers.weixin.qq.com/minigame/dev/api/game-portal/wx.createGameIcon.html) +11. **微信小游戏插屏广告组件InterstitialAd:isInterstitialPlaying 与 interstitialShow** 整理来自:[wx.createInterstitialAd](https://developers.weixin.qq.com/minigame/dev/api/ad/InterstitialAd.html) @@ -149,7 +140,6 @@ ``` 示例2:应用场景如进入客服会话跳转领取体力、钻石等等: 示例为跳转客服领取18888钻石奖励,success函数中记录数据状态(用于客服返回,执行onShow生命周期函数时逻辑判断)。 - ```javascript // 跳转客服领取18888钻石奖励,开发者可根据示例修改 PCSDK.platform.openCustomerServiceConversation({ @@ -169,20 +159,20 @@ console.log("openCustomerServiceConversation fail: ", err); } }); - - // 在游戏中全局注册的onShow事件监听中检测是 + + // 在游戏中全局注册的onShow事件监听中检测是 // 游戏入口:Main.cs class Main { constructor() { this.init(); } - - private init() { + + private init() { PCSDK.event.add('app.show', this.onShow, this); // 等同于wx.onShow(this.onShow.bind(this)); PCSDK.event.add('app.hide', this.onHide, this); // 等同于wx.onHide(this.onHide.bind(this)); } - - private onShow(opts) { + + private onShow(opts) { // 判断是否是来源于客服会话,上面的openCustomerServiceConversation的success设置的数据状态做判断 let serviceRewardData = AppDataManager.I.get('service.reward.data'); if (serviceRewardData && serviceRewardData.status === 1) { @@ -190,15 +180,14 @@ // 奖励发放,处理发放后的逻辑,比如每天只能领取一次的记录,防止重复刷奖励 } } - - private onHide(){ + + private onHide(){ // 监听平台的onHide事件 } } ``` 示例3:应用场景例如进入客服会话,success函数中记录数据状态(用于客服返回,执行onShow生命周期函数时逻辑判断),点击右下角的充值按钮后,跳转充值,充值完成后在onShow中处理:需要后台提供api接口,验证充值合理性并发放奖励,**此接口需要后端支持**。 - ```javascript // 跳转客服充值,开发者可根据示例修改,sendMessagePath请严格按照示例中提供的参数 /** @@ -226,21 +215,21 @@ } }); } - + // 在游戏中全局注册的onShow事件监听中检测是 - // 游戏入口:Main.cs + // 游戏入口:Main.cs class Main { constructor() { this.init(); } - + private init() { - PCSDK.event.add('app.show', this.onShow, this); // 等同于wx.onShow(this.onShow.bind(this)); + PCSDK.event.add('app.show', this.onShow, this); // 等同于wx.onShow(this.onShow.bind(this)); PCSDK.event.add('app.hide', this.onHide, this); // 等同于wx.onHide(this.onHide.bind(this)); } - + private onShow(opts) { - // 判断是否是来源于客服会话,上面的openCustomerServiceConversation的success设置的数据状态做判断 + // 判断是否是来源于客服会话,上面的openCustomerServiceConversation的success设置的数据状态做判断 let serviceRewardData = AppDataManager.I.get('service.pay.data'); if (serviceRewardData && serviceRewardData.status === 1) { AppDataManager.I.set('service.pay.data', null); @@ -248,9 +237,9 @@ // 请求后端接口验证奖励合理性 } } - + private onHide(){ - // 监听平台的onHide事件 + // 监听平台的onHide事件 } } ``` @@ -284,6 +273,8 @@ ``` 示例:在游戏入口类中检测是否有版本更新 + + 1)、依照下面的示例接入checkUpdate api ```javascript class Main { @@ -311,43 +302,52 @@ } ``` + 2)、接入代码完毕后,按照下图的操作本地开发工具调试是否接入成功。 + + I、选择:添加编译模式。 + ![sdk文件目录结构](https://dep.miso-lab.com/sdkword/sdk_030.png "🔍点击查看大图") + II、选择:自定义模式名称、勾选下次编译时模拟更新、选择模拟成功还是失败状态,点击确定。 + ![sdk文件目录结构](https://dep.miso-lab.com/sdkword/sdk_031.png "🔍点击查看大图") + III、开发工具会自动重新启动游戏,弹出更新框,看到弹出框接入成功。 + ![sdk文件目录结构](https://dep.miso-lab.com/sdkword/sdk_032.png "🔍点击查看大图") +
4.0 **vibrateShort** - + ```javascript PCSDK.platform.vibrateShort(): Promise ``` 定义:使手机发生较短时间的振动(15 ms)。仅在 iPhone 7 / 7 Plus 以上及 Android 机型生效 - + 参数: - + ```javascript 无 ``` - + 示例: - + ```javascript PCSDK.platform.vibrateShort(); ``` 4.1 **vibrateLong** - + ```javascript PCSDK.platform.vibrateShort(): Promise ``` 定义:使手机发生较长时间的振动(400 ms) - + 参数: - + ```javascript 无 ``` - + 示例: - + ```javascript PCSDK.platform.vibrateLong(); -- libgit2 0.21.0