| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- import { DataEventId, GameProp } from "../../game/data/GameData";
- import { OpenActionType } from "./UISystem";
- /**
- * 新手引导模块
- */
- export default class GuideSystem {
- public crtGuideID: number;
- public ui: cc.Node;
- public curDes = '';
- //当前进行到哪一步的拼接字符串
- public curGuideIdStr: string = null;
- //判断继续当前步骤的回调函数
- public continueCallBack: Function = null;
-
- public open(id, curDes = '') {
- if (gData.gameData.configs.ServerConfig.NewUserGuide == '0') {
- return false;
- }
- this.curDes = curDes;
- this.crtGuideID = gData.gameData.getProp(GameProp.guideID);
- if (this.crtGuideID == undefined) {
- this.crtGuideID = 0;
- }
- // //测试永远新手引导,永远第一关
- // if (!cc.sys.isNative) {
- // this.crtGuideID = 1;
- // }
- //test
- // this.crtGuideID = 0
- if (this.crtGuideID >= 9999) {
- mk.console.log("新手引导已做完");
- return false;
- }
- if (id <= this.crtGuideID && this.crtGuideID > 0) {
- mk.console.log("当前引导已做过:" + id);
- return false;
- }
- gData.guideData.crtID = id;
- this.crtGuideID = id;
- mk.ui.openPanel("module/guide/guide", OpenActionType.normal, this.ui);
- this.setGuideID(this.crtGuideID++);
- return true;
- }
- /** 开启一个引导后直接默认已完成 */
- private setGuideID(id: number) {
- if (id == 14) {
- id = 9999;
- mk.data.sendXYEvent("guide_end", "新手引导结束");
- }
- gData.gameData.setProp(GameProp.guideID, id);
- }
- public close() {
- this.crtGuideID++;
- }
- /**
- * 引导是否完成
- * @returns true 已完成
- */
- public isGuideComplete(): boolean {
- let id = gData.gameData.getProp(GameProp.guideID);
- if (!this.crtGuideID || id === 9999) {
- return true;
- } else {
- return false;
- }
- }
- /**
- * 当前是否正在引导
- * @returns
- */
- public isGuiding(): boolean {
- return mk.ui.getCurOnPanel("guide") != null;
- }
- public getCurGuideIdString()
- {
- return this.curGuideIdStr;
- }
- }
|