From 903847c20766edafc0e4275ed852bc9f73b8adc5 Mon Sep 17 00:00:00 2001 From: 小川 费 <449111130@qq.com> Date: Sat, 21 Sep 2019 15:35:51 +0800 Subject: [PATCH] 1 --- SUMMARY.md | 3 +++ book.json | 2 -- platform.md | 289 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------- 3 files changed, 272 insertions(+), 22 deletions(-) diff --git a/SUMMARY.md b/SUMMARY.md index 8716b3b..7f461b9 100644 --- a/SUMMARY.md +++ b/SUMMARY.md @@ -19,6 +19,9 @@ * [检测自动更新](platform.md#checkUpdate) * [打开客服消息](platform.md#service) * [震动接口](platform.md#vibrate) + * [小游戏推荐弹窗组件GamePortal](platform.md#gamePortal) + * [小游戏插屏广告组件InterstitialAd](platform.md#interstitialAd) + * [小游戏推荐icon组件GameIcon](platform.md#gameicon) * [数据模块](data.md) * [事件模块](event.md) * [FAQ❎](faq.md) \ No newline at end of file diff --git a/book.json b/book.json index 6201203..5054dde 100644 --- a/book.json +++ b/book.json @@ -30,8 +30,6 @@ "include-csv@^0.1.0", "puml@^1.0.1", "musicxml@^1.0.2", - "klipse@^1.2.0", - "versions-select@^0.1.1", "graph@^0.1.0", "chart@^0.2.0", "popup" diff --git a/platform.md b/platform.md index c085693..c7bc1c0 100644 --- a/platform.md +++ b/platform.md @@ -9,17 +9,16 @@ #### **此模块是参照微信小游戏提供的api进行封装的公用方法,提供了以下游戏中常用到的功能:** 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) +2. **打开客服消息:openCustomerServiceConversation** 整理来自[wx.openCustomerServiceConversation](https://developers.weixin.qq.com/minigame/dev/api/open-api/customer-message/wx.openCustomerServiceConversation.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) +10. **微信小游戏插屏广告组件InterstitialAd:isInterstitialPlaying 与 interstitialShow** 整理来自:[wx.createInterstitialAd](https://developers.weixin.qq.com/minigame/dev/api/ad/InterstitialAd.html) +11. **微信小游戏推荐icon组件GameIcon:gameIconShow 与 gameIconDestroy** 整理来自:[wx.createGameIcon](https://developers.weixin.qq.com/minigame/dev/api/game-portal/wx.createGameIcon.html) @@ -32,6 +31,12 @@ | PCSDK.platform.checkUpdate | 检测版本是否有更新,如果版本更新会弹出确认框 | | PCSDK.platform.vibrateShort | 使手机发生较短时间的振动(15 ms) | | PCSDK.platform.vibrateLong | 使手机发生较长时间的振动(400 ms) | +| PCSDK.platform.gamePortalShow | 传入adUnitId创建并展示小游戏推荐弹窗组件 | +| PCSDK.platform.isGamePortalPlaying | 是否正在加载小游戏推荐弹窗组件 | +| PCSDK.platform.interstitialShow | 传入adUnitId创建并展示小游戏插屏广告组件 | +| PCSDK.platform.isInterstitialPlaying | 是否正在加载小游戏插屏广告组件 | +| PCSDK.platform.gameIconShow | 创建并显示小游戏推荐icon组件 | +| PCSDK.platform.gameIconDestroy | 销毁正在展示的小游戏推荐icon组件 | @@ -159,19 +164,18 @@ console.log("openCustomerServiceConversation fail: ", err); } }); - - // 在游戏中全局注册的onShow事件监听中检测是 + // 在游戏中全局注册的onShow事件监听中检测是 // 游戏入口: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.hide', this.onHide, this); // 等同于wx.onHide(this.onHide.bind(this)); } - + private onShow(opts) { // 判断是否是来源于客服会话,上面的openCustomerServiceConversation的success设置的数据状态做判断 let serviceRewardData = AppDataManager.I.get('service.reward.data'); @@ -180,7 +184,7 @@ // 奖励发放,处理发放后的逻辑,比如每天只能领取一次的记录,防止重复刷奖励 } } - + private onHide(){ // 监听平台的onHide事件 } @@ -217,7 +221,7 @@ } // 在游戏中全局注册的onShow事件监听中检测是 - // 游戏入口:Main.cs + // 游戏入口:Main.cs class Main { constructor() { this.init(); @@ -249,7 +253,6 @@ ```javascript PCSDK.platform.checkUpdate( params?: _ShowModalObject ): void ``` - 定义:检测版本是否有更新,如果版本有更新会弹出确认框,参数可不传递,不传递有版本更新会弹出下图的默认确认框;开发者可自定义弹出框的显示样式,参数与[wx.showModal](https://developers.weixin.qq.com/minigame/dev/api/ui/interaction/wx.showModal.html)一模一样。 建议此api在游戏的入口调用。  @@ -310,45 +313,291 @@  III、开发工具会自动重新启动游戏,弹出更新框,看到弹出框接入成功。  +
+4. **vibrateShort** +```javascript + PCSDK.platform.vibrateShort(): Promise