12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- import DataMgr from "../../data/DataMgr";
- import ui_PutBallLevelDisplay from "../../fgui/res/game/ui_PutBallLevelDisplay";
- import { xGame } from "../../xGame";
- import UILevelProp from "../UILevelProp";
- export default class PutBallLevelDisplay {
- public ui: ui_PutBallLevelDisplay;
- public index: number = 0;
- public data: any;
- constructor(ui: ui_PutBallLevelDisplay, index) {
- this.ui = ui;
- this.index = index;
- this.ui.onClick(this, this.clickSelf);
- this.updateSelf();
- this.ui.levelTxt.text = (this.index + 1) + "";
- this.ui.challenge.levelTxt.text = (this.index + 1) + "";
- this.ui.special.levelTxt.text = (this.index + 1) + "";
- }
- updateSelf() {
- let level = this.index + 1;
- this.data = DataMgr.getPlaceBallLevel(level);
- //console.log("zh:lev this.data","level="+level,this.data);
- this.ui.starNode.c1.selectedIndex = this.data.star;
- let isChallenge = cfgTable.placeballData[level].type;
- //
- if (this.data.isCur) {
- //当前关卡,未通关
- if (isChallenge) {
- this.ui.c1.selectedIndex = 5;
- }
- else {
- this.ui.c1.selectedIndex = 2;
- }
- }
- else {
- if (this.data.play) {
- //已经通关
- if (this.data.star == 3) {
- this.ui.c1.selectedIndex = 0;
- }
- else {
- this.ui.c1.selectedIndex = 1;
- }
- }
- else {
- //未通过,未解锁
- if (isChallenge) {
- this.ui.c1.selectedIndex = 4;
- }
- else {
- this.ui.c1.selectedIndex = 3;
- }
- }
- }
- }
- clickSelf() {
- if (!this.data.play) return;
- xGame.soundMgr.playSound(xGame.common.btnClickStr);
- xGame.uiMgr.Show(UILevelProp, this.index + 1);
- }
- }
|