123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492 |
- var t = require;
- var e = module;
- var i = exports;
- var s =
- (this && this.__awaiter) ||
- function (t, n, r, l) {
- return new (r = r || Promise)(function (i, e) {
- function s(t) {
- try {
- a(l.next(t));
- } catch (t) {
- e(t);
- }
- }
- function o(t) {
- try {
- a(l.throw(t));
- } catch (t) {
- e(t);
- }
- }
- function a(t) {
- var e;
- t.done ?
- i(t.value) :
- ((e = t.value) instanceof r ?
- e :
- new r(function (t) {
- t(e);
- })
- ).then(s, o);
- }
- a((l = l.apply(t, n || [])).next());
- });
- };
- Object.defineProperty(i, "__esModule", { value: !0 }),
- (i.DiamondCostType = i.save_prop_Const = i.LoginDataSaveKey = void 0);
- const l = t("App"),
- o = t("GameText"),
- a = t("Toast"),
- n = t("NotificationConst"),
- r = t("ViewConst"),
- h = t("ADController"),
- c = t("ADManageBase"),
- d = t("TipView");
- (i.LoginDataSaveKey = { loginCache: "cars" }),
- ((t = i.save_prop_Const || (i.save_prop_Const = {}))[(t.YINDAO_LEVEL = 99)] = "YINDAO_LEVEL"),
- (t[(t.LEVEL = 1)] = "LEVEL"),
- ((t = i.DiamondCostType || (i.DiamondCostType = {}))[(t.SHOP_NORMAL_BOX = 0)] = "SHOP_NORMAL_BOX"),
- (t[(t.SHOP_HEIGHT_BOX = 1)] = "SHOP_HEIGHT_BOX"),
- (t[(t.EQUIPMENT_UPGRADE = 2)] = "EQUIPMENT_UPGRADE"),
- (t[(t.EQUIPMENT_GRADE_UPGRADE = 3)] = "EQUIPMENT_GRADE_UPGRADE"),
- (t[(t.ABILITY_UPGRADE = 4)] = "ABILITY_UPGRADE"),
- (t[(t.BUFF_DOUBLE__RATE_GOLD = 5)] = "BUFF_DOUBLE__RATE_GOLD"),
- (t[(t.BUFF_FIVE_RATE_GOLD = 6)] = "BUFF_FIVE_RATE_GOLD"),
- (t[(t.BUFF_FOUR_HOUR_GOLD = 7)] = "BUFF_FOUR_HOUR_GOLD"),
- (i.default = class {
- constructor() {
- (this.loginInfo = {}),
- (this._videoManage = null),
- (this.compelADVideoManage = null),
- (this.insterTime = 0),
- (this.insterFullTime = 0),
- (this.msgCache = []),
- (this._playrSpendMoney = 0),
- (l.default.Platform = this),
- l.default.SaveManage.add(this, i.LoginDataSaveKey.loginCache, !1, !1),
- l.default.SaveManage.load(i.LoginDataSaveKey.loginCache);
- }
- init() {
- this.initProductConfig(), this.initAd(), l.default.AnalyticMgr.sentDayRetain();
- }
- initProductConfig() {
- var t = l.default.ConfigManager.getConfig("ProductConfig");
- this._productConfigs = {};
- for (const e of t) this._productConfigs[e.payId] = e;
- }
- initAccountServer() { }
- getProductConfigByPayString(t) {
- return this._productConfigs[t];
- }
- getProductConfigById(t) {
- for (var e in this._productConfigs) {
- e = this._productConfigs[e];
- if (e.id == t) return e;
- }
- return null;
- }
- setEvent(t) { }
- showInteractionAd(t = h.InterAdType.normal, e) {
- return !0;
- }
- isAutoShowInteractionAd() {
- return !1;
- }
- isGetRemoteRes() {
- return !1;
- }
- isShowDebugUI() {
- return (-1 < this.getVersionStr().indexOf("debug") ||
- -1 < this.getVersionStr().indexOf("test") ||
- -1 < this.getVersionStr().indexOf("gm")
- );
- }
- vibrator(t = 0) { }
- resetGame() {
- window.location.reload();
- }
- checkIsNotch() {
- return !1;
- }
- exitGame() {
- this.saveData();
- }
- cal(t) { }
- initAd() {
- this._videoManage = new c.ADManageBase();
- }
- share(t, e) { }
- showBanner() { }
- hideBanner() { }
- showExpressAd(t) { }
- hideExpressAd() { }
- showAD(t, e) {
- this._videoManage && this._videoManage.show();
- }
- showCompelAD(t, e, i) { }
- isWXLogin() {
- return s(this, void 0, void 0, function* () {
- return !0;
- });
- }
- startGameRecorder(t) { }
- stopGameRecorder() { }
- shareRecorder() { }
- jumpToOtherGame(t, e) { }
- loadZipFile(t) {
- return Promise.resolve(!1);
- }
- isCanShare() {
- return !0;
- }
- getPackVersion() {
- return "test";
- }
- getPackVersionCode() {
- return 9999;
- }
- getDefaultLang() {
- return "0";
- }
- syncDataCallBack() { }
- getServerTime() {
- return s(this, void 0, void 0, function* () {
- let t = 3;
- do {
- try {
- var e = l.default.GameDataMsr.playerInfo,
- i = yield l.default.Http.requestAsync(
- l.default.ConfigManager.gameConf.serverInfos.interface + "/api/time", { token: e.token }
- ),
- s = JSON.parse(i);
- return l.default.DateUtils.setServerTime(1e3 * s.data.now_time), !0;
- } catch (t) {
- Log.error("获取后台时间失败", t), yield l.default.TimerManager.sleep(1e3);
- }
- } while (--t);
- return !1;
- });
- }
- saveDataToLocal() {
- (l.default.GameDataMsr.playerInfo.localSaveTime = Math.ceil(l.default.DateUtils.Now() / 1e3)),
- l.default.SaveManage.saveAll();
- }
- saveData() {
- return s(this, void 0, void 0, function* () {
- let t = l.default.GameDataMsr.playerInfo;
- (t.localSaveTime = t.saveTime = Math.ceil(l.default.DateUtils.Now() / 1e3)),
- (t.saveDevice = this.getDeviceId());
- var e = t.token;
- l.default.ConfigManager.gameConf.serverInfos.game, (t.token = null);
- var i = l.default.SaveManage.getAllAutoSaveData();
- // if (((t.token = e), t.token))
- // try {
- // var s = yield l.default.Http.post(
- // l.default.ConfigManager.gameConf.serverInfos.interface + "/api/user/file",
- // {api_token: t.token, file: l.default.StringUtil.zipStr(i), loginTime: t.timestamp},
- // 3
- // ),
- // o = JSON.parse(s);
- // if (o && 0 == o.code) return !0;
- // } catch (t) {
- // Log.error("存储数据失败", t);
- // }
- return !1;
- });
- }
- showLoginFailTipView() {
- return new Promise(t => {
- l.default.ViewManager.open(14, {
- curState: d.TIPSTATE.SURE,
- leftBtnText: o.GameText.getText(17),
- leftFunc: () => {
- t();
- },
- leftThisObj: this,
- tipsStr: o.GameText.getText(53)
- });
- });
- }
- isUseServerSave(i, s) {
- return new Promise(t => {
- var e = l.default.GameDataMsr.playerInfo;
- e.godsTotalPower && e.saveTime ?
- l.default.ViewManager.open(r.ViewConst.SaveSelectView, i, s, e.saveTime, e.godsTotalPower, t) :
- t(!0);
- });
- }
- getDeviceId() {
- let t = cc.sys.localStorage.getItem("DEVICEID");
- return t || ((t = "wx" + l.default.DateUtils.Now()), cc.sys.localStorage.setItem("DEVICEID", t)), t;
- }
- isShowGameCircle() {
- return !1;
- }
- getUseInfoFinish(t) { }
- getUserSaveData(i) {
- console.log('getUserSaveData同步数据');
- // return s(this, void 0, void 0, function*() {
- // let t = 3;
- // do {
- // var e = yield l.default.Http.requestAsync(
- // l.default.ConfigManager.gameConf.serverInfos.game + "/api/user/file", { api_token: i },
- // "GET"
- // ),
- // e = JSON.parse(e);
- // if (0 == e.code) return e.data;
- // } while (--t);
- // return null;
- // });
- }
- syncData() {
- console.log('syncData同步数据11111111111111111111111111');
- return s(this, void 0, void 0, function* () {
- let e = l.default.GameDataMsr,
- t = 3;
- {
- console.error('强制修改钻石数据');
- console.error(e);
- e.playerInfo.diamond = 19
- l.default.SaveManage.getAllAutoSaveData();
- }
- // do {
- // try {
- // let t = e.playerInfo;
- // Log.trace("获取登陆信息");
- // var i = yield this.login();
- // (t.account = this.loginInfo.unionid),
- // (t.openid = this.loginInfo.openid),
- // Log.trace("向管理后台请求用户数据", i.loginKey);
- // var s,
- // o,
- // a = yield l.default.Http.requestAsync(
- // l.default.ConfigManager.gameConf.serverInfos.interface + "/api/user", { api_token: i.loginKey },
- // "GET"
- // ),
- // n = JSON.parse(a);
- // if (
- // (!this.loginInfo.unionid && i.loginKey && (this.loginInfo.unionid = n.account),
- // 0 !== n.code)
- // ) {
- // -1001 === n.code || -1003 === n.code ?
- // this.logout() :
- // Log.trace("向管理后台获取数据失败!!!", n.code);
- // continue;
- // }
- // (t.id = n.data.id),
- // (t.token = i.loginKey),
- // (t.registerTime = 1e3 * n.data.reg_time),
- // (t.registerDaynumber = Math.ceil(
- // (l.default.DateUtils.Now() - 1e3 * n.data.reg_time) / 864e5
- // )),
- // l.default.DateUtils.setServerTime(1e3 * t.timestamp),
- // l.default.SaveManage.setSaveKey(t.id + ""),
- // l.default.AnalyticMgr.activityLogin();
- // const r = yield this.getUserSaveData(i.loginKey);
- // if (!r) return !1;
- // r.file &&
- // ((o = (s = JSON.parse(r.file.includes("{") ? r.file : l.default.StringUtil.unzip(r.file)))
- // .PLAYER_INFO),
- // (t.saveTime < r.time || (null != s && s.ISREPLACE)) &&
- // (l.default.SaveManage.syncByData(s),
- // (t.saveTime = r.time),
- // (t.localSaveTime = o.localSaveTime),
- // (t.finishTaskCnt = o.finishTaskCnt),
- // (t.head = o.head),
- // (t.nickName = o.nickName),
- // (t.diamond = o.diamond),
- // (t.gold = o.gold))),
- // this.syncDataCallBack(),
- // Log.trace("向管理后台请求用户数据成功!!!");
- // break;
- // } catch (t) {
- // Log.error("同步数据失败", t && t.toString());
- // }
- // Log.trace("请求数据失败!!!!,", t), yield l.default.TimerManager.sleep(1e3);
- // } while (--t);
- return (e.tempData.isSyncDataByServer = !0), !!t;
- });
- }
- getVersionStr() {
- return `v ${versionInfo.packVersion}_${versionInfo.version}`;
- }
- createMemento(t) {
- return this.loginInfo || {};
- }
- getAdTypeNum() {
- return 1;
- }
- getAdState(t) {
- return this._videoManage.adState;
- }
- setMemento(t, e) {
- this.loginInfo = t || {};
- }
- getAccountInfoSync() { }
- logout() {
- (this.loginInfo = {}), l.default.SaveManage.save(i.LoginDataSaveKey.loginCache);
- }
- getChannel() {
- return "cjkg";
- }
- tourist() {
- return s(this, void 0, void 0, function* () {
- if (this.loginInfo.token) return Promise.resolve({ code: 0, loginKey: this.loginInfo.token });
- var t = yield l.default.Http.requestAsync(
- l.default.ConfigManager.gameConf.serverInfos.interface + "/api/login/simple", { channel: this.getChannel() },
- "GET"
- );
- Log.trace(">>>>>>>>>>>>>>>游客登录", t);
- t = JSON.parse(t);
- return (
- (this.loginInfo.playerid = t.data.id),
- (this.loginInfo.token = t.token),
- l.default.SaveManage.save(i.LoginDataSaveKey.loginCache),
- (l.default.GameDataMsr.isNew = !0),
- 0 === t.code ?
- (this.setChannel(t.token), { code: t.code, loginKey: t.token }) : { code: t.code, loginKey: null }
- );
- });
- }
- buy(t) {
- return s(this, void 0, void 0, function* () {
- return a.default.launch("支付功能还在开发中!!!!"), !1;
- });
- }
- getPrice(t) {
- t = this.getProductConfigByPayString(t);
- return t ? "$ " + t.cost : null;
- }
- getPriceNum(t) {
- return this.getProductConfigByPayString(t).cost;
- }
- getCurrency(t) {
- var e,
- t = this.getPrice(t);
- if (!t) return "";
- let i = "";
- for (e of t) {
- if (("0" <= e && e <= "9") || "." === e) break;
- i += e;
- }
- return i;
- }
- getTitle(t) {
- return "";
- }
- isSignIn() {
- return cc.sys.localStorage.getItem("is_SignIn_Game");
- }
- signInSuccess(t) {
- cc.sys.localStorage.setItem("is_SignIn_Game", t);
- }
- signInFail() {
- cc.sys.localStorage.removeItem("is_SignIn_Game");
- }
- googleLogin() {
- return s(this, void 0, void 0, function* () {
- return !1;
- });
- }
- signOut() {
- l.default.EasyLoading.showLoadingByTime(10),
- this.clearAndResetGame(!0),
- cc.sys.localStorage.removeItem("is_SignIn_Game"),
- l.default.EasyLoading.hideLoading();
- }
- clearAndResetGame(t = !1) {
- return s(this, void 0, void 0, function* () {
- t && (yield this.saveData()),
- l.default.SaveManage.clear(),
- l.default.SaveManage.clearAllItem(),
- cc.audioEngine.stopAll(),
- cc.game.restart();
- });
- }
- isHaveAnomalyOrder(t) {
- return !1;
- }
- getOrderDataByPayId(t) {
- return null;
- }
- openAppReview() {
- return s(this, void 0, void 0, function* () {
- return !0;
- });
- }
- set playerSpendMoney(t) {
- (this._playrSpendMoney += t),
- (l.default.GameDataMsr.playerInfo.vipRecharge = this._playrSpendMoney),
- l.default.NotificationCenter.dispatch(n.NotificationConst.PAY_SUCCESS);
- }
- get playerSpendMoney() {
- return this._playrSpendMoney;
- }
- updatePlayerSpendMoeny() {
- return s(this, void 0, void 0, function* () {
- if (!this.isShowDebugUI() || !cc.sys.localStorage.getItem("vipTest")) {
- let t = 3;
- do {
- try {
- var e = yield l.default.Http.requestAsync(
- l.default.ConfigManager.gameConf.serverInfos.interface +
- "/Interface/recharge/total_amount.php", { token: l.default.GameDataMsr.playerInfo.token }
- ),
- i = JSON.parse(e);
- if (0 === i.code)
- return (
- (this.playerSpendMoney = i.data.amount),
- void (l.default.GameDataMsr.playerInfo.vipRecharge = i.data.amount)
- );
- } catch (t) { }
- } while ((yield l.default.TimerManager.sleep(1e3), --t));
- l.default.TimerManager.doTimer(12e4, 1, this.updatePlayerSpendMoeny, this);
- }
- });
- }
- setChannel(t) { }
- recordDiamondCost(t, e, i) {
- e = 0 < e ? -e : e;
- l.default.Http.requestAsync(
- l.default.ConfigManager.gameConf.serverInfos.interface + "/Interface/money/save.php", {
- token: l.default.GameDataMsr.playerInfo.token,
- type: t,
- money_type: 0,
- money_num: e,
- item_type: 0,
- item_id: i || 0,
- item_num: 1
- }
- );
- }
- record(t) {
- try {
- t.token = l.default.GameDataMsr.playerInfo.token;
- } catch (t) {
- Log.error("统计出错:", t);
- }
- }
- getIsShowPay() {
- return !0;
- }
- saveWxUserInfo() {
- return s(this, void 0, void 0, function* () { });
- }
- isAuthorization() {
- return s(this, void 0, void 0, function* () {
- return !0;
- });
- }
- resumOrder() {
- return s(this, void 0, void 0, function* () { });
- }
- });
|