| | |
| | | } |
| | | |
| | | onClickWatchAd() { |
| | | if (Sdk.isToutiao) { |
| | | SdkToutiao.showRewardVideoAd(() => { |
| | | Userdata.giveVideoRewardRuby(); |
| | | Global.showTip("获得 " + Global.WATCH_VIDEO_GEM + " 钻石 !"); |
| | | this.updateGems(); |
| | | Global.debounceClicks(() => { |
| | | let isGot = false; |
| | | if (Sdk.isToutiao) { |
| | | SdkToutiao.showRewardVideoAd(() => { |
| | | if (!isGot) { |
| | | Userdata.giveVideoRewardRuby(); |
| | | // Global.showTip("Got " + Global.WATCH_VIDEO_GEM + " Gems !"); |
| | | Global.showTip("获得 " + Global.WATCH_VIDEO_GEM + " 钻石 !"); |
| | | this.updateGems(); |
| | | |
| | | Userdata.saveUserdata(); |
| | | let node = cc.find('Canvas'); |
| | | if (node) { |
| | | node.emit('updateInfo'); |
| | | Userdata.saveUserdata(); |
| | | let node = cc.find('Canvas'); |
| | | if (node) { |
| | | node.emit('updateInfo'); |
| | | } |
| | | } |
| | | }, () => { |
| | | Global.showTip('广告展示失败, 请稍后重试!'); |
| | | }); |
| | | |
| | | return; |
| | | } |
| | | |
| | | Sdk.ins.showVideoAd(result => { |
| | | if (result) { |
| | | if (!isGot) { |
| | | Userdata.giveVideoRewardRuby(); |
| | | // Global.showTip("Got " + Global.WATCH_VIDEO_GEM + " Gems !"); |
| | | Global.showTip("获得 " + Global.WATCH_VIDEO_GEM + " 钻石 !"); |
| | | this.updateGems(); |
| | | |
| | | Userdata.saveUserdata(); |
| | | let node = cc.find('Canvas'); |
| | | if (node) { |
| | | node.emit('updateInfo'); |
| | | } |
| | | } |
| | | } else { |
| | | Global.showTip('广告展示失败, 请稍后重试!'); |
| | | // Global.showTip('Ads not ready!'); |
| | | } |
| | | }, () => { |
| | | Global.showTip('广告展示失败, 请稍后重试!'); |
| | | }); |
| | | |
| | | return; |
| | | } |
| | | |
| | | Sdk.ins.showVideoAd(result => { |
| | | if (result) { |
| | | Userdata.giveVideoRewardRuby(); |
| | | Global.showTip("Got " + Global.WATCH_VIDEO_GEM + " Gems !"); |
| | | this.updateGems(); |
| | | |
| | | Userdata.saveUserdata(); |
| | | let node = cc.find('Canvas'); |
| | | if (node) { |
| | | node.emit('updateInfo'); |
| | | } |
| | | } else { |
| | | Global.showTip('Ads not ready!'); |
| | | } |
| | | }); |
| | | }, 'SkinLayer-onClickWatchAd'); |
| | | } |
| | | } |