咸鱼的反击
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.
 
 
 
xianyudefanji/assets/Scripts/Mishu/MishuPeiXun.ts

131 lines
3.9 KiB

// Learn TypeScript:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
import { ryw_Event } from "../../FrameWork/Event/EventEnum";
import EventMgr from "../../FrameWork/Event/EventMgr";
import AppPlatform from "../../FrameWork/Util/AppPlatform";
import Common5 from "../../Platform/th/Common5";
import UiBase from "../GameBase/UiBase";
import MiShuManager from "../Manager/MiShuManager";
const {ccclass, property} = cc._decorator;
@ccclass
export default class MishuPeiXun extends UiBase {
@property(cc.Node)
mishuBG: cc.Node = null;
@property(cc.Node)
maxNode: cc.Node = null;
@property(cc.Node)
shengjiNode: cc.Node = null;
@property(cc.Node)
duiyouBg: cc.Node = null;
@property(cc.Label)
maxLabel: cc.Label = null;
@property(cc.Label)
maxPercent: cc.Label = null;
// LIFE-CYCLE CALLBACKS:
// onLoad () {}
gameType = 'Mishu' //Duiyou
start () {
if(this.gameType == 'Mishu'){
this.mishuBG.active = true
}else{
this.duiyouBg.active = true
}
this.refreshView()
}
refreshView(){
let isMax = MiShuManager.isMaxPeixunLavel(this.gameType)
if(isMax){
this.maxNode.active = true
this.maxNode.opacity = 255
this.shengjiNode.active = false
this.refresMax()
}else{
this.shengjiNode.active = true
this.maxNode.active = false
this.shengjiNode.opacity = 255
this.refresLevel()
}
}
refresMax(){
let configs = MiShuManager.getMishuPeiXunConfig()
let maxConfig = configs[configs.length-1]
//{peixunLevel:13, incomeMutiple:30},
this.maxLabel.string = maxConfig.peixunLevel+''
let percent = maxConfig.incomeMutiple*100
this.maxPercent.string = percent+'%'
}
refresLevel(){
let curLevel = this.shengjiNode.getChildByName('curLevel').getComponent(cc.Label)
let nextLevel= this.shengjiNode.getChildByName('nextLevel').getComponent(cc.Label)
let curShouyi= this.shengjiNode.getChildByName('curShouyi').getComponent(cc.Label)
let nextShouyi= this.shengjiNode.getChildByName('nextShouyi').getComponent(cc.Label)
let level = MiShuManager.getPeiXunLevel(this.gameType)
let nLevel = level+1
let curDate = MiShuManager.getPeixunIncomeMutipleConfig(level)
let nextDate = MiShuManager.getPeixunIncomeMutipleConfig(nLevel)
curLevel.string = curDate.peixunLevel+''
nextLevel.string = nextDate.peixunLevel+''
curShouyi.string = curDate.incomeMutiple*100+'%'
nextShouyi.string = nextDate.incomeMutiple*100+'%'
}
setViewDate(gameType){
this.gameType = gameType
}
shengjiClickEvent(){
//Common5.playEffect("sound/按键点击")
let tab = {
onClose: (finish)=>{
if (finish) {
let str = this.gameType == 'Mishu'?'秘书培训':'队友培训'
console.log(str, 'str+++++++++===')
Common5.ReportDY("inLevel", str+"-AD-升级");
let level = MiShuManager.getPeiXunLevel(this.gameType)
let levelUp = level+1
MiShuManager.setPeiXunLevel(levelUp,this.gameType)
this.refreshView()
EventMgr.emitEvent_custom(ryw_Event.MishuPeixun)
}
else{
Common5.showTips_custom("广告未观看完");
}
},onFailed:()=>{
}
}
AppPlatform.playVideo_custom(tab)
}
// update (dt) {}
}