| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596 |
- import Main from "../Main";
- import { GuideStep, GuideTask } from "../other/guide/GuideFile";
- import GuideRunner from "../other/guide/GuideRunner";
- import ZnhTest from "../other/guide/ZnhTest";
- import { EventMng } from "../tools/EventMng";
- import { PlayerPrefs } from "../tools/MyExtends";
- import AdM from "./AdM";
- import GameM from "./GameM";
- import UiM from "./UiM";
- const { ccclass, property } = cc._decorator;
- @ccclass
- export default class GuideMng {
- private static _ins: GuideMng;
- public static get Ins(): GuideMng {
- if (this._ins == null) {
- console.log("Guide cons");
- this._ins = new GuideMng();
- }
- return this._ins;
- }
- Destroy() {
- GuideMng._ins = null;
- }
- private guideFile: any = null;
- private guideTask1: GuideTask = null;
- private guideTask2: GuideTask = null;
- private guideTask3: GuideTask = null;
- private guideTask4: GuideTask = null;
- private guideTask5: GuideTask = null;
- private guideTask6: GuideTask = null;
- private guideTask7: GuideTask = null;
- private guideTask8: GuideTask = null;
- private guideTask9: GuideTask = null;
- private guideTask10: GuideTask = null;
- private guideTask11: GuideTask = null;
- private guideTask12: GuideTask = null;
- private guideTask13: GuideTask = null;
- private guideTask14: GuideTask = null;
- private guideTask15: GuideTask = null;
- private guideTask16: GuideTask = null;
- /**财神降临 财神献礼*/
- private guideTask17: GuideTask = null;
- private guideTask18: GuideTask = null;
- private guideTask19: GuideTask = null;
- /**取经引导 20-25*/
- private guideTask20: GuideTask = null;
- //public znhTest: Main = null;
- private guideRunner: GuideRunner = null;
- private guideNode: cc.Node = null;
- private curGuidePause: boolean = false;
- isGuiding: boolean = false;
- get IsGuideing() {
- return this.isGuiding;
- }
- private steps: GuideStep[] = null;
- private step: GuideStep = null;
- private curStepIndex: number = 0;
- private isOpenGuide: boolean = true;
- private curGuideId: number = 0;
- get CurGuideId(): number {
- return this.curGuideId;
- }
- set CurGuideId(value) {
- this.curGuideId = value;
- }
- constructor() {
- this.Init();
- }
- Init() {
- this.guideFile = cc.loader.getRes("configs/guide").json;
- //console.log("Guide File:" + JSON.stringify(this.guideFile));
- this.guideTask1 = (this.guideFile.task.task1) as GuideTask;
- this.guideTask2 = (this.guideFile.task.task2) as GuideTask;
- this.guideTask3 = (this.guideFile.task.task3) as GuideTask;
- this.guideTask4 = (this.guideFile.task.task4) as GuideTask;
- this.guideTask5 = (this.guideFile.task.task5) as GuideTask;
- this.guideTask6 = (this.guideFile.task.task6) as GuideTask;
- this.guideTask7 = (this.guideFile.task.task7) as GuideTask;
- this.guideTask8 = (this.guideFile.task.task8) as GuideTask;
- this.guideTask9 = (this.guideFile.task.task9) as GuideTask;
- this.guideTask10 = (this.guideFile.task.task10) as GuideTask;
- this.guideTask11 = (this.guideFile.task.task11) as GuideTask;
- this.guideTask12 = (this.guideFile.task.task12) as GuideTask;
- this.guideTask13 = (this.guideFile.task.task13) as GuideTask;
- this.guideTask14 = (this.guideFile.task.task14) as GuideTask;
- this.guideTask15 = (this.guideFile.task.task15) as GuideTask;
- this.guideTask16 = (this.guideFile.task.task16) as GuideTask;
- this.guideTask17 = (this.guideFile.task.task17) as GuideTask;
- this.guideTask18 = (this.guideFile.task.task18) as GuideTask;
- this.guideTask19 = (this.guideFile.task.task19) as GuideTask;
- //console.log("Task2:", this.guideTask2);
- }
- /**1 新用户首次引导*/
- CheckGuide1() {
- if (GameM.commonData.isAuth) {
- return
- }
- let isGuide = PlayerPrefs.GetInt("GGuide1", 0) == 1;
- if (!isGuide && this.isOpenGuide) {
- this.curGuideId = 1;
- this.CheckCreateGuide();
- this.SetTask(this.guideTask1);
- PlayerPrefs.SetInt("GGuide" + this.curGuideId, 1);
- AdM.onSendEvent(`guide_${this.curGuideId}`, `引导${this.curGuideId}`, 'guide');
- }
- }
- /**2 五福引导 弃用*/
- CheckFiveluckGuide2() {
- let isGuide = PlayerPrefs.GetInt("GGuide2", 0) == 1;
- if (!isGuide && this.isOpenGuide) {
- this.curGuideId = 2;
- this.CheckCreateGuide();
- this.SetTask(this.guideTask2);
- //PlayerPrefs.SetInt("GGuide" + this.curGuideId, 2);
- AdM.onSendEvent(`guide_${this.curGuideId}`, `引导${this.curGuideId}`, 'guide');
- }
- }
- /**3 伙伴引导*/
- CheckMateGuide3() {
- let isGuide = PlayerPrefs.GetInt("GGuide3", 0) == 1;
- if (!isGuide && this.isOpenGuide) {
- this.curGuideId = 3;
- this.CheckCreateGuide();
- this.SetTask(this.guideTask3);
- PlayerPrefs.SetInt("GGuide" + this.curGuideId, 2);
- AdM.onSendEvent(`guide_${this.curGuideId}`, `引导${this.curGuideId}`, 'guide');
- }
- }
- /**4 战斗引导*/
- CheckFightGuide4() {
- let isGuide = PlayerPrefs.GetInt("GGuide4", 0) == 1;
- if (!isGuide && this.isOpenGuide) {
- this.curGuideId = 4;
- this.CheckCreateGuide();
- this.SetTask(this.guideTask4);
- //PlayerPrefs.SetInt("GGuide" + this.curGuideId, 2);
- AdM.onSendEvent(`guide_${this.curGuideId}`, `引导${this.curGuideId}`, 'guide');
- }
- }
- /**5 探索引导*/
- CheckInvestGuide5() {
- let isGuide = PlayerPrefs.GetInt("GGuide5", 0) == 1;
- if (!isGuide && this.isOpenGuide) {
- this.curGuideId = 5;
- this.CheckCreateGuide();
- this.SetTask(this.guideTask5);
- PlayerPrefs.SetInt("GGuide" + this.curGuideId, 1);
- AdM.onSendEvent(`guide_${this.curGuideId}`, `引导${this.curGuideId}`, 'guide');
- }
- }
- /**6 夺宝引导 6 和 13*/
- CheckTreasureGuide6() {
- let isGuide = PlayerPrefs.GetInt("GGuide6", 0) == 1;
- if (!isGuide && this.isOpenGuide) {
- this.curGuideId = 6;
- this.CheckCreateGuide();
- this.SetTask(this.guideTask6);
- AdM.onSendEvent(`guide_${this.curGuideId}`, `引导${this.curGuideId}`, 'guide');
- }
- }
- /**7 钱庄引导*/
- CheckBankGuide7() {
- let isGuide = PlayerPrefs.GetInt("GGuide7", 0) == 1;
- if (!isGuide && this.isOpenGuide) {
- this.curGuideId = 7;
- this.CheckCreateGuide();
- this.SetTask(this.guideTask7);
- AdM.onSendEvent(`guide_${this.curGuideId}`, `引导${this.curGuideId}`, 'guide');
- }
- }
- /**8 日常任务引导*/
- CheckTaskGuide8() {
- let isGuide = PlayerPrefs.GetInt("GGuide8", 0) == 1;
- if (!isGuide && this.isOpenGuide) {
- this.curGuideId = 8;
- this.CheckCreateGuide();
- this.SetTask(this.guideTask8);
- PlayerPrefs.SetInt("GGuide" + this.curGuideId, 1);
- AdM.onSendEvent(`guide_${this.curGuideId}`, `引导${this.curGuideId}`, 'guide');
- }
- }
- /**9 登录豪礼引导*/
- CheckDailyGuide9() {
- let isGuide = PlayerPrefs.GetInt("GGuide9", 0) == 1;
- if (!isGuide && this.isOpenGuide) {
- this.curGuideId = 9;
- this.CheckCreateGuide();
- this.SetTask(this.guideTask9);
- PlayerPrefs.SetInt("GGuide" + this.curGuideId, 2);
- AdM.onSendEvent(`guide_${this.curGuideId}`, `引导${this.curGuideId}`, 'guide');
- }
- }
- /**10 提现引导*/
- CheckCashGuide10() {
- let isGuide = PlayerPrefs.GetInt("GGuide10", 0) == 1;
- if (!isGuide && this.isOpenGuide) {
- this.curGuideId = 10;
- this.CheckCreateGuide();
- this.SetTask(this.guideTask10);
- PlayerPrefs.SetInt("GGuide" + this.curGuideId, 1);
- AdM.onSendEvent(`guide_${this.curGuideId}`, `引导${this.curGuideId}`, 'guide');
- }
- }
- /**11 点击武将生产金币*/
- CheckStrikeGuide11() {
- let isGuide = PlayerPrefs.GetInt("GGuide11", 0) == 1;
- if (!isGuide && this.isOpenGuide) {
- let name = UiM.Instance.hallNode.getComponent(Main).GetRoleSpaceIndex();
- console.log("-->StrikeGuideName:" + name);
- this.UpdateGuideStrikeFile(name);
- //this.CheckUnlockStrike();
- this.curGuideId = 11;
- this.CheckCreateGuide();
- this.SetTask(this.guideTask11);
- PlayerPrefs.SetInt("GGuide" + this.curGuideId, 1);
- AdM.onSendEvent(`guide_${this.curGuideId}`, `引导${this.curGuideId}`, 'guide');
- }
- }
- /**12 五福提现引导*/
- CheckFiveluck2Guide12() {
- let isGuide = PlayerPrefs.GetInt("GGuide12", 0) == 1;
- if (!isGuide && this.isOpenGuide) {
- this.curGuideId = 12;
- this.CheckCreateGuide();
- this.SetTask(this.guideTask12);
- PlayerPrefs.SetInt("GGuide" + this.curGuideId, 2);
- AdM.onSendEvent(`guide_${this.curGuideId}`, `引导${this.curGuideId}`, 'guide');
- }
- }
- /**13 夺宝引导 6 和 13*/
- CheckTreasureGuide13() {
- let isGuide = PlayerPrefs.GetInt("GGuide13", 0) == 1;
- if (!isGuide && this.isOpenGuide) {
- this.curGuideId = 13;
- this.CheckCreateGuide();
- this.SetTask(this.guideTask13);
- AdM.onSendEvent(`guide_${this.curGuideId}`, `引导${this.curGuideId}`, 'guide');
- }
- }
- /**14 提现功能开启引导*/
- CheckCashGuide14() {
- let isGuide = PlayerPrefs.GetInt("GGuide14", 0) == 1;
- if (!isGuide && this.isOpenGuide) {
- this.curGuideId = 14;
- this.CheckCreateGuide();
- this.SetTask(this.guideTask14);
- PlayerPrefs.SetInt("GGuide" + this.curGuideId, 2);
- AdM.onSendEvent(`guide_${this.curGuideId}`, `引导${this.curGuideId}`, 'guide');
- }
- }
- /**15 转盘开启引导*/
- CheckTurntableGuide15() {
- let isGuide = PlayerPrefs.GetInt("GGuide15", 0) == 1;
- if (!isGuide && this.isOpenGuide) {
- this.curGuideId = 15;
- this.CheckCreateGuide();
- this.SetTask(this.guideTask15);
- PlayerPrefs.SetInt("GGuide" + this.curGuideId, 2);
- AdM.onSendEvent(`guide_${this.curGuideId}`, `引导${this.curGuideId}`, 'guide');
- }
- }
- /**16 登录豪礼引导*/
- CheckDailyGuide16() {
- let isGuide = PlayerPrefs.GetInt("GGuide16", 0) == 1;
- if (!isGuide && this.isOpenGuide) {
- this.curGuideId = 16;
- this.CheckCreateGuide();
- this.SetTask(this.guideTask16);
- PlayerPrefs.SetInt("GGuide" + this.curGuideId, 2);
- AdM.onSendEvent(`guide_${this.curGuideId}`, `引导${this.curGuideId}`, 'guide');
- }
- }
- /**17 财神点击引导*/
- CheckWealthGuide17() {
- let isGuide = PlayerPrefs.GetInt("GGuide17", 0) == 1;
- if (!isGuide && this.isOpenGuide) {
- this.curGuideId = 17;
- this.CheckCreateGuide();
- this.SetTask(this.guideTask17);
- PlayerPrefs.SetInt("GGuide" + this.curGuideId, 2);
- AdM.onSendEvent(`guide_${this.curGuideId}`, `引导${this.curGuideId}`, 'guide');
- }
- }
- /**18 财神领取献礼引导*/
- CheckWealthGiftGuide18() {
- let isGuide = PlayerPrefs.GetInt("GGuide18", 0) == 1;
- if (!isGuide && this.isOpenGuide) {
- this.curGuideId = 18;
- this.CheckCreateGuide();
- this.SetTask(this.guideTask18);
- PlayerPrefs.SetInt("GGuide" + this.curGuideId, 2);
- AdM.onSendEvent(`guide_${this.curGuideId}`, `引导${this.curGuideId}`, 'guide');
- }
- }
- /**19 明日提现引导*/
- CheckNextDailyCashGuide19() {
- let isGuide = PlayerPrefs.GetInt("GGuide19", 0) == 1;
- if (!isGuide && this.isOpenGuide) {
- this.curGuideId = 19;
- this.CheckCreateGuide();
- this.SetTask(this.guideTask19);
- PlayerPrefs.SetInt("GGuide" + this.curGuideId, 1);
- AdM.onSendEvent(`guide_${this.curGuideId}`, `引导${this.curGuideId}`, 'guide');
- }
- }
- //------------------------------------------------------------------------------------------------
- /**20 取经引导 取经引导,开启*/
- CheckRichGuide20() {
- let isGuide = PlayerPrefs.GetInt("GGuide20", 0) == 1;
- if (!isGuide && this.isOpenGuide) {
- this.guideTask20 = (this.guideFile.task.task20) as GuideTask;
- this.curGuideId = 20;
- this.CheckCreateGuide();
- this.SetTask(this.guideTask20);
- PlayerPrefs.SetInt("GGuide" + this.curGuideId, 1);
- AdM.onSendEvent(`guide_${this.curGuideId}`, `引导${this.curGuideId}`, 'guide');
- }
- }
- /**21 取经引导 取经引导,掷骰子1 弃用 放在 27 中*/
- CheckRichGuide21() {
- let isGuide = PlayerPrefs.GetInt("GGuide21", 0) == 1;
- if (!isGuide && this.isOpenGuide) {
- this.guideTask20 = (this.guideFile.task.task21) as GuideTask;
- this.curGuideId = 21;
- this.CheckCreateGuide();
- this.SetTask(this.guideTask20);
- PlayerPrefs.SetInt("GGuide" + this.curGuideId, 1);
- AdM.onSendEvent(`guide_${this.curGuideId}`, `引导${this.curGuideId}`, 'guide');
- }
- }
- /**22 取经引导 取经引导,掷骰子2*/
- CheckRichGuide22() {
- let isGuide = PlayerPrefs.GetInt("GGuide22", 0) == 1;
- if (!isGuide && this.isOpenGuide) {
- this.guideTask20 = (this.guideFile.task.task22) as GuideTask;
- this.curGuideId = 22;
- this.CheckCreateGuide();
- this.SetTask(this.guideTask20);
- PlayerPrefs.SetInt("GGuide" + this.curGuideId, 1);
- AdM.onSendEvent(`guide_${this.curGuideId}`, `引导${this.curGuideId}`, 'guide');
- }
- }
- /**23 取经引导 取经引导,经书引导*/
- CheckRichGuide23() {
- let isGuide = PlayerPrefs.GetInt("GGuide23", 0) == 1;
- if (!isGuide && this.isOpenGuide) {
- this.guideTask20 = (this.guideFile.task.task23) as GuideTask;
- this.curGuideId = 23;
- this.CheckCreateGuide();
- this.SetTask(this.guideTask20);
- PlayerPrefs.SetInt("GGuide" + this.curGuideId, 2);
- AdM.onSendEvent(`guide_${this.curGuideId}`, `引导${this.curGuideId}`, 'guide');
- }
- }
- /**24 取经引导 取经引导,遥控卡引导*/
- CheckRichGuide24() {
- let isGuide = PlayerPrefs.GetInt("GGuide24", 0) == 1;
- if (!isGuide && this.isOpenGuide) {
- this.guideTask20 = (this.guideFile.task.task24) as GuideTask;
- this.curGuideId = 24;
- this.CheckCreateGuide();
- this.SetTask(this.guideTask20);
- PlayerPrefs.SetInt("GGuide" + this.curGuideId, 1);
- AdM.onSendEvent(`guide_${this.curGuideId}`, `引导${this.curGuideId}`, 'guide');
- }
- }
- /**25 取经引导 取经引导,双倍卡引导*/
- CheckRichGuide25() {
- let isGuide = PlayerPrefs.GetInt("GGuide25", 0) == 1;
- if (!isGuide && this.isOpenGuide) {
- this.guideTask20 = (this.guideFile.task.task25) as GuideTask;
- this.curGuideId = 25;
- this.CheckCreateGuide();
- this.SetTask(this.guideTask20);
- PlayerPrefs.SetInt("GGuide" + this.curGuideId, 1);
- AdM.onSendEvent(`guide_${this.curGuideId}`, `引导${this.curGuideId}`, 'guide');
- }
- }
- /**26 取经引导 取经引导,欢迎引导*/
- CheckRichGuide26() {
- let isGuide = PlayerPrefs.GetInt("GGuide26", 0) == 1;
- if (!isGuide && this.isOpenGuide) {
- this.guideTask20 = (this.guideFile.task.task26) as GuideTask;
- this.curGuideId = 26;
- this.CheckCreateGuide();
- this.SetTask(this.guideTask20);
- PlayerPrefs.SetInt("GGuide" + this.curGuideId, 1);
- AdM.onSendEvent(`guide_${this.curGuideId}`, `引导${this.curGuideId}`, 'guide');
- }
- }
- /**27 取经引导 取经引导,欢迎引导2*/
- CheckRichGuide27() {
- let isGuide = PlayerPrefs.GetInt("GGuide27", 0) == 1;
- if (!isGuide && this.isOpenGuide) {
- this.guideTask20 = (this.guideFile.task.task27) as GuideTask;
- this.curGuideId = 27;
- this.CheckCreateGuide();
- this.SetTask(this.guideTask20);
- PlayerPrefs.SetInt("GGuide" + this.curGuideId, 1);
- AdM.onSendEvent(`guide_${this.curGuideId}`, `引导${this.curGuideId}`, 'guide');
- }
- }
- /**28 看视频领红包引导1*/
- CheckAdRbGuide28() {
- let isGuide = PlayerPrefs.GetInt("GGuide28", 0) == 1;
- if (!isGuide && this.isOpenGuide) {
- this.guideTask20 = (this.guideFile.task.task28) as GuideTask;
- this.curGuideId = 28;
- this.CheckCreateGuide();
- this.SetTask(this.guideTask20);
- PlayerPrefs.SetInt("GGuide" + this.curGuideId, 1);
- AdM.onSendEvent(`guide_${this.curGuideId}`, `引导${this.curGuideId}`, 'guide');
- }
- }
- /**29 看视频领红包引导2*/
- CheckAdRbGuide29() {
- let isGuide = PlayerPrefs.GetInt("GGuide29", 0) == 1;
- if (!isGuide && this.isOpenGuide) {
- this.guideTask20 = (this.guideFile.task.task29) as GuideTask;
- this.curGuideId = 29;
- this.CheckCreateGuide();
- this.SetTask(this.guideTask20);
- PlayerPrefs.SetInt("GGuide" + this.curGuideId, 1);
- AdM.onSendEvent(`guide_${this.curGuideId}`, `引导${this.curGuideId}`, 'guide');
- }
- }
- //CheckGuide2() {
- // let isGuide = PlayerPrefs.GetInt("GGuide2", 0) == 1;
- // if (!isGuide && this.isOpenGuide) {
- // this.curGuideId = 2;
- // this.CheckCreateGuide();
- // this.SetTask(this.guideTask2);
- // }
- //}
- /**解锁点击生产金币功能*/
- CheckUnlockStrike() {
- let isGuide = PlayerPrefs.GetInt("GGuide2", 0) == 1;
- if (!isGuide && this.isOpenGuide) {
- console.log("-->Task2:", this.guideTask2);
- this.curGuideId = 2;
- this.CheckCreateGuide();
- this.SetTask(this.guideTask2);
- }
- }
- /**点击生产金币 是否解锁*/
- IsUnlockStrike() {
- return PlayerPrefs.GetInt("GGuide2", 0) == 1;
- }
- /**更新 点击生产金币引导文件参数*/
- UpdateGuideStrikeFile(carSpaceName: string) {
- this.guideTask11.steps[0].args[0] = "HallNode/CarPark/" + carSpaceName + "/chewei";
- this.guideTask11.steps[1].args[0] = "HallNode/CarPark/" + carSpaceName + "/chewei";
- this.guideTask11.steps[2].args[0] = "HallNode/CarPark/" + carSpaceName + "/chewei";
- this.guideTask11.steps[3].args[0] = "HallNode/CarPark/" + carSpaceName + "/chewei";
- }
- NextGuide() {
- this.curStepIndex++;
- if (this.curStepIndex >= this.steps.length) {
- this.guideRunner.GuideEnd();
- PlayerPrefs.SetInt("GGuide" + this.curGuideId, 1);
- this.isGuiding = false;
- //取经 新手福利
- if (this.curGuideId == 26) {
- EventMng.Execute_Event("NewPlayGift");
- }
- this.curGuideId = 0;
- } else {
- this.step = this.steps[this.curStepIndex];
- this.guideRunner.RunGuide(this.step);
- }
- }
- /** 结束此步引导 */
- FinishGuide() {
- this.guideRunner.Click_CloseBtn();
- }
- ResumeGuide() {
- if (this.curGuidePause) {
- this.curGuidePause = false;
- this.NextGuide();
- }
- }
- PauseGuide() {
- this.curGuidePause = true;
- }
- CheckCreateGuide() {
- if (this.guideRunner == null) {
- //this.guideNode = this.znhTest.GetGuide();
- this.guideNode = UiM.Instance.hallNode.getComponent(Main).GetGuide();
- this.guideNode.parent = cc.find("Canvas");
- this.guideRunner = this.guideNode.getComponent(GuideRunner);
- console.log("---------------");
- }
- }
- SetTask(task: GuideTask) {
- this.steps = task.steps;
- this.curStepIndex = 0;
- this.step = this.steps[this.curStepIndex];
- this.guideRunner.RunGuide(this.step);
- this.isGuiding = true;
- }
- }
|