| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- import { GameProp } from "../../game/data/GameData";
- /**
- * 新手引导模块
- */
- export default class GuideSystem {
- private crtGuideID: number;
- public open(id) {
- this.crtGuideID = gData.gameData.getProp(GameProp.guideID);
- this.setGuideID(this.crtGuideID++);
- if (id == 9999) {
- mk.console.log("新手引导已做完");
- return;
- }
- if (id >= this.crtGuideID && this.crtGuideID > 0) {
- mk.console.log("当前引导已做过:" + id);
- return;
- }
- gData.guideData.crtID = id;
- this.crtGuideID = id;
- mk.ui.openPanel("module/guide/guide");
- }
- /** 开启一个引导后直接默认已完成 */
- private setGuideID(id: number) {
- let guide = gData.guideData.getGuidesByID(id);
- if (guide == null) {
- id = 9999;
- }
- gData.gameData.setProp(GameProp.guideID, id);
- }
- public close() {
- this.crtGuideID++;
- }
- /**
- * 引导是否完成
- * @returns true 已完成
- */
- public isGuideComplete(): Boolean {
- if (!this.crtGuideID || this.crtGuideID === 999) {
- return true;
- } else {
- return false;
- }
- }
- }
|