You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
103 lines
3.4 KiB
103 lines
3.4 KiB
import { ryw_Event } from "../../../FrameWork/Event/EventEnum";
|
|
import EventMgr from "../../../FrameWork/Event/EventMgr";
|
|
import User from "../../../FrameWork/User/User";
|
|
import AppPlatform from "../../../FrameWork/Util/AppPlatform";
|
|
import Common5 from "../../../Platform/th/Common5";
|
|
import TTAPI from "../../../Platform/tt/TTAPI";
|
|
import TaskManager from "../../JuQingChat/TaskManager";
|
|
import UserManager from "../../Manager/UserManager";
|
|
import PrefabManage from "../../PrefabManager/PrefabManage";
|
|
import MaoYiFenHongManager from "./MaoYiFenHongManager";
|
|
|
|
|
|
const {ccclass, property} = cc._decorator;
|
|
|
|
@ccclass
|
|
export default class MaoYiFenHong extends cc.Component {
|
|
|
|
@property(cc.Label)
|
|
moneyStr: cc.Label = null;
|
|
|
|
@property(cc.Label)
|
|
timeStr: cc.Label = null;
|
|
|
|
@property(cc.Node)
|
|
spineNode: cc.Node = null;
|
|
|
|
@property(cc.Node)
|
|
boxNode: cc.Node = null;
|
|
|
|
curConfig = null
|
|
// LIFE-CYCLE CALLBACKS:
|
|
|
|
// onLoad () {}
|
|
|
|
start () {
|
|
|
|
|
|
}
|
|
initView(tag){
|
|
let dingDanIndex = User.getDaoyeIndex()
|
|
this.curConfig = MaoYiFenHongManager.getConfigByDingDanIndex(dingDanIndex)
|
|
console.log('dingDanIndex,this.curConfig=',dingDanIndex,this.curConfig)
|
|
|
|
|
|
this.showStr()
|
|
if(tag == 0){
|
|
this.spineNode.active = true
|
|
this.boxNode.active = false
|
|
this.scheduleOnce(()=>{
|
|
this.spineNode.active = false
|
|
this.boxNode.active = true
|
|
//第x张订单弹插屏广告
|
|
let daoYeIndex = User.getDaoyeIndex()
|
|
if(daoYeIndex >= 5 && daoYeIndex <= 9){
|
|
TTAPI.showInterstitialAd()
|
|
console.log('弹插屏广告==',daoYeIndex)
|
|
}
|
|
},3.6)
|
|
}else{
|
|
this.spineNode.active = false
|
|
this.boxNode.active = true
|
|
}
|
|
}
|
|
showStr(){
|
|
let leftTimes = User.getMaoYiFenHongTimes()
|
|
|
|
this.timeStr.string = `还可领取${leftTimes}次`
|
|
this.moneyStr.string = `${Common5.getNumberChangeHanzi(this.curConfig.moneyArr[5-leftTimes], '1', 1)}`
|
|
}
|
|
onBtnLingQuClick(){
|
|
let tab = {
|
|
onClose: (finish)=>{
|
|
if(finish) {
|
|
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
|
|
let mainId = mainTaskInfo.Id
|
|
Common5.ReportDY("inLevel", `任务${mainId}-AD-贸易分红领取分红`);
|
|
|
|
let leftTimes = User.getMaoYiFenHongTimes()
|
|
let money = this.curConfig.moneyArr[5-leftTimes]
|
|
UserManager.addMoney(money)
|
|
PrefabManage.showTextTips(`恭喜获得分红${Common5.getNumberChangeHanzi(money, '1', 1)}`)
|
|
leftTimes -= 1
|
|
User.setMaoYiFenHongTimes(leftTimes)
|
|
EventMgr.emitEvent_custom(ryw_Event.updateDaoYe);
|
|
if(leftTimes <= 0){
|
|
this.node.removeFromParent()
|
|
this.node.destroy()
|
|
return
|
|
}
|
|
this.showStr()
|
|
}
|
|
else{
|
|
|
|
Common5.showTips_custom("广告未观看完");
|
|
}
|
|
|
|
},onFailed:()=>{
|
|
|
|
}
|
|
}
|
|
AppPlatform.playVideo_custom(tab)
|
|
}
|
|
}
|
|
|