| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- import { Data } from "../../../mk/data/Data";
- import GuideVO from "../../module/guide/GuideVO";
- /**
- * @description 新手引导
- * @author 邹勇
- */
- export class GuideData {
- /** 新手引导数据 */
- public data: Map<number, GuideVO[]>;
- /** 当前引导id */
- public crtID: number = null;
- public async init() {
- let config = gData.gameData.configs.Guide
- // //test
- // config = null;
- if (!config) {
- let result = await mk.loader.load("data/guide_data", cc.JsonAsset);
- if (result && result.json) {
- config = result.json;
- }
- cc.log('无远程引导数据,使用本地测试数据');
- }
- this.data = new Map<number, GuideVO[]>();
- let arr = [];
- let id = 1;
- for (let i = 0; i < config.length; i++) {
- let guide = {} as GuideVO;
- let o = config[i];
- let a = o.id.split("_");
- guide.id = parseInt(a[0]);
- guide.step = parseInt(a[1]);
- guide.trigger = o.trigger;
- guide.tr_num = o.trNum;
- guide.tr_form = o.trForm;
- guide.dialog = o.dialog;
- guide.dialog_pos = o.dialogPos;
- guide.dialog_pos1 = o.dialogPos1;
- guide.dialog_alignment = o.dialogAlignment;
- guide.display_rect = o.displayRect;
- guide.click_rect = o.clickRect;
- guide.finger = o.finger;
- guide.lag_next = parseFloat(o.lagNext);
- guide.display_type = parseInt(o.trNum);
- if (id != guide.id) {
- this.data.set(id, arr);
- arr = [];
- id = guide.id;
- }
- arr.push(guide);
- }
- this.data.set(id, arr);
- }
- public getGuidesByID(id): GuideVO[] {
- return this.data.get(id);
- }
- }
|