12345678910111213141516171819202122232425262728293031323334353637383940 |
- import { ResMgr } from "./resMgr";
- let pass = 3;
- /**
- * 1 切换关卡
- */
- export class LevelMgr {
- parent: cc.Node;
- title: cc.Label;
- passCnt: number = 0;
- private static _inst: LevelMgr;
- public static get inst(): LevelMgr {
- if (this._inst == null) {
- this._inst = new LevelMgr();
- }
- return this._inst;
- }
-
- begin(){
- this.passCnt = 0;
- this.load();
- }
- next(){
- this.passCnt ++;
- if(this.passCnt >= pass) return;
- this.load();
- }
-
- private load() {
- this.title.string = `level${this.passCnt + 1}`;
- this.parent.destroyAllChildren();
- ResMgr.inst.loadPrefab(`level/level${this.passCnt + 1}`, this.parent);
- }
- }
|