|
@@ -1,6 +1,6 @@
|
|
|
import GamePlay from "../../../before/GamePlay";
|
|
import GamePlay from "../../../before/GamePlay";
|
|
|
import { AdFun } from "../../data/AdData";
|
|
import { AdFun } from "../../data/AdData";
|
|
|
-import { RewardType } from "../../data/GameData";
|
|
|
|
|
|
|
+import { GameProp, RewardType } from "../../data/GameData";
|
|
|
|
|
|
|
|
const { ccclass, property } = cc._decorator;
|
|
const { ccclass, property } = cc._decorator;
|
|
|
/**
|
|
/**
|
|
@@ -50,6 +50,9 @@ export default class Reward extends cc.Component {
|
|
|
private lbl_cash_out: cc.Label = null;
|
|
private lbl_cash_out: cc.Label = null;
|
|
|
@property({ displayName: '提现金额', type: cc.Label })
|
|
@property({ displayName: '提现金额', type: cc.Label })
|
|
|
private lbl_cash: cc.Label = null;
|
|
private lbl_cash: cc.Label = null;
|
|
|
|
|
+ @property({ displayName: '提现按钮', type: cc.Animation })
|
|
|
|
|
+ private node_cash: cc.Animation = null;
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 当前阶段 */
|
|
/** 当前阶段 */
|
|
@@ -124,13 +127,31 @@ export default class Reward extends cc.Component {
|
|
|
const fillRange = newRedMoney / cash_data.type_value >= 1 ? 1 : newRedMoney / cash_data.type_value;
|
|
const fillRange = newRedMoney / cash_data.type_value >= 1 ? 1 : newRedMoney / cash_data.type_value;
|
|
|
// this.spr_cash_out.fillRange = fillRange;
|
|
// this.spr_cash_out.fillRange = fillRange;
|
|
|
cc.tween(this.spr_cash_out).to(fillRange, { fillRange: fillRange }).start();
|
|
cc.tween(this.spr_cash_out).to(fillRange, { fillRange: fillRange }).start();
|
|
|
|
|
+ if (redMoney >= cash_data.type_value) {
|
|
|
|
|
+ this.node_cash.play();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.node_cash.stop();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 看广告
|
|
* 看广告
|
|
|
*/
|
|
*/
|
|
|
- private clickWatchVideo() {
|
|
|
|
|
|
|
+ private async clickWatchVideo() {
|
|
|
cc.log('看广告请求');
|
|
cc.log('看广告请求');
|
|
|
|
|
+ if (gData.gameData.gameData.isFirstRedMoney) {
|
|
|
|
|
+ gData.gameData.gameData.isFirstRedMoney = 0;
|
|
|
|
|
+ // 用户第一次看此视频时,可不需要看直接领取奖励
|
|
|
|
|
+ let response = await mk.http.sendData('getFreeRedMoney', {});
|
|
|
|
|
+ if (response.errcode != 0) {
|
|
|
|
|
+ mk.tip.pop(response.errmsg);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ gData.reward.adData = {}
|
|
|
|
|
+ gData.reward.adData.videoRedMoney = {}
|
|
|
|
|
+ gData.reward.adData.videoRedMoney.videoRewardList = [{ rewardType: RewardType.redBag, rewardNum: response.data.freeRedMoney }]
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
if (this.lid_type === LidType.mission) {
|
|
if (this.lid_type === LidType.mission) {
|
|
|
// 关卡结算红包
|
|
// 关卡结算红包
|
|
|
mk.ad.watchAd((success: boolean) => {
|
|
mk.ad.watchAd((success: boolean) => {
|