觉醒时刻
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.
 
 
 
juexingshike/assets/Scripts/WenZiRes/ui/FirstLevelSelectView2.ts

104 lines
3.8 KiB

import { ryw_Event } from "../../../FrameWork/Event/EventEnum";
import EventMgr from "../../../FrameWork/Event/EventMgr";
import User from "../../../FrameWork/User/User";
import Common5 from "../../../Platform/th/Common5";
import TaskManager from "../../JuQingChat/TaskManager";
import PrefabManage, { GameType } from "../../PrefabManager/PrefabManage";
const {ccclass, property} = cc._decorator;
export let WenZiAwardMoney = [
5000,30000,100000,200000,500000]
export let WenZiGuoGuanLevel = [
50,40,20,5,1
]
@ccclass
export default class FirstLevelSelectView2 extends cc.Component {
@property(cc.Node)
zhaoChaJinDuProgress: cc.Node = null;
@property(cc.Node)
wenZiJinDuProgress: cc.Node = null;
@property(cc.Node)
pageNew: cc.Node = null;
// LIFE-CYCLE CALLBACKS:
// onLoad () {}
// curTypeStr = ''
start () {
EventMgr.onEvent_custom(ryw_Event.updateLevel, () => {
this.initView();
}, this)
PrefabManage.preloadPrefabByType(GameType.WZ_GameMain)
let callFunc = ()=>{
this.initView()
}
if(!Common5.gameConfig){
cc.loader.loadRes('Json/WenZiGameConfig/WZGameConfig.json', function (err, gameconfig) {
if (err) {
console.log(err);
return;
}
Common5.gameConfig = gameconfig.json;
console.log("文字配置加载成功", Common5.gameConfig);
callFunc()
});
}else{
callFunc()
}
}
protected onDestroy(): void {
// TaskManager.checkIsMainTask520Finish()
}
initView(){
// Common5.gameConfig.GameAllType[0].Levels = Common5.gameConfig.GameAllType[0].LevelsKangFu
// if(typeStr){
// this.curTypeStr = typeStr
// }
this.pageNew.active= true
let successArr = User.getSuccessLevels();
let successNum = 0
// if(this.curTypeStr == 'zhaoCha'){
// }else if(this.curTypeStr == 'wenZi'){
this.zhaoChaJinDuProgress.active = false
// this.wenZiJinDuProgress.active = true
let arr = Common5.gameConfig.GameAllType[0].Levels
for(let i=0;i<arr.length;i++){
if(successArr.indexOf(arr[i]) > -1){
successNum++
}
}
this.wenZiJinDuProgress.getComponent(cc.ProgressBar).progress = successNum/WenZiGuoGuanLevel[0]
for(let i=0;i<WenZiAwardMoney.length;i++){
let panzi = this.wenZiJinDuProgress.getChildByName('panziArray').getChildByName('panzi'+i)
let str = Common5.getNumberChangeHanzi(WenZiAwardMoney[i])
panzi.getChildByName('moneyStr').getComponent(cc.Label).string =str+''
}
for(let i=0;i<WenZiGuoGuanLevel.length;i++){
if(successNum >= WenZiGuoGuanLevel[i]){
for(let j=0;j<WenZiGuoGuanLevel.length;j++){
let panzi = this.wenZiJinDuProgress.getChildByName('panziArray').getChildByName('panzi'+j)
if(j<WenZiGuoGuanLevel.length -i){
panzi.getChildByName('panziHei').active = false
panzi.getChildByName('灰色钞票').active = false
panzi.getChildByName('发光钞票').active = true
}else{
panzi.getChildByName('panziHei').active = true
panzi.getChildByName('灰色钞票').active = true
panzi.getChildByName('发光钞票').active = false
}
}
break
}
}
// }
}
}