1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- import hallScene from "../../hallScene";
- import { App } from "../../Manager/App";
- const {ccclass, property} = cc._decorator;
- @ccclass
- export default class NodeLevel extends cc.Component {
- labelDiamond: cc.Label[] = [];
- key: cc.Node[] = [];
- star: cc.Node[] = [];
- @property(cc.Label)
- labelExp: cc.Label = null;
- @property(cc.Button)
- btnStart:cc.Button = null;
- onLoad () {
- for (let i = 0; i < 3; i++) {
- this.labelDiamond[i] = this.node.getChildByName("LabelRewardDiamond" + i).getComponent(cc.Label);
- this.key[i] = this.node.getChildByName("key" + i);
- this.star[i] = this.node.getChildByName("star" + i);
- }
-
- this.btnStart.node.on("click", this.clickGameStart.bind(this), this);
- }
- start(){
- this.findPlayerLevel();
- }
- findPlayerLevel(){
- let curlevel = App.DataManager.PlayLevel;
- this.freshLevelNum(curlevel);
- }
- freshLevelNum(index: number){
- App.DataManager.PlayLevel = index;
- this.labelExp.string = "Level " + index + "_" + App.DataManager.PassProgress[index];
- for (let i = 0; i < this.labelDiamond.length; i++) {
- this.star[i].active = App.DataManager.PassProgress[index] >= i + 1;
- this.key[i].active = App.DataManager.keyPos[index - 1] == i + 1;
- this.labelDiamond[i].string = App.DataManager.diamondNum[index - 1][i] + "";
- }
- }
- clickGameStart(){
- hallScene.instance.StartGame(App.DataManager.PlayLevel);
- }
- // update (dt) {}
- }
|