| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- import Util from "../../../before/util/Util";
- import { AdFun } from "../../data/AdData";
- import { VideoAdType } from "../../data/GameData";
- const { ccclass, property } = cc._decorator;
- @ccclass
- export default class NewOpenRedBag extends cc.Component{
- @property({displayName: '数字组', type: cc.Label})
- private lbl_value: cc.Label[] = [];
- start(){
- this.showChangePart();
- }
- update(dt)
- {
- if (gData.reward.adData) {
- this.showWatchAdReward();
- gData.turnable.adData = null;
- }
- }
- private showWatchAdReward()
- {
- if(gData.reward.adData)
- {
- let v= '0.30';
- v.replace('.','');
- let c = v.split('');
- for(let i = 0; i != this.lbl_value.length; ++i)
- {
- if(i < c.length)
- {
- this.lbl_value[i].string = c[i];
- }else
- {
- this.lbl_value[i].string = '0';
- }
- }
- }
- }
- showChangePart() {
- //this.changePart.active = true
- let len = this.lbl_value.length;
- this.schedule(() => {
- for (var i = 0; i < len; i++) {
- let ran = Util.rnd(0, 9);
- this.lbl_value[i].string = `${ran}`;
- }
- }, 0.1)
- }
- private clickOpenBtn(){
- mk.audio.playEffect("button");
- mk.ad.videoAdType = VideoAdType.StartQiPaoRedBag;
- mk.ad.watchAd((success: boolean) => {
- mk.console.log("watchAD:" + success);
- if (success) {
- gData.adData.watchVideo(AdFun.bubble);
- }
- });
- }
- private clickCloseBtn(){
- mk.audio.playEffect("closeButton");
- }
- }
|