123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324 |
- System.register(["__unresolved_0", "cc", "__unresolved_1", "__unresolved_2", "__unresolved_3", "__unresolved_4"], function (_export, _context) {
- "use strict";
- var _reporterNs, _cclegacy, ch, GameData, UINotify, Start, PlayerData, _crd, rand_type, data_type, day_data_type, week_data_type, month_data_type;
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
- function _reportPossibleCrUseOfch(extras) {
- _reporterNs.report("ch", "../../ch/ch", _context.meta, extras);
- }
- function _reportPossibleCrUseOfGameData(extras) {
- _reporterNs.report("GameData", "../../core/util_class/GameData", _context.meta, extras);
- }
- function _reportPossibleCrUseOfUINotify(extras) {
- _reporterNs.report("UINotify", "../../module_basic/ui_notify/UINotify", _context.meta, extras);
- }
- function _reportPossibleCrUseOfStart(extras) {
- _reporterNs.report("Start", "../../start/Start", _context.meta, extras);
- }
- _export("default", void 0);
- return {
- setters: [function (_unresolved_) {
- _reporterNs = _unresolved_;
- }, function (_cc) {
- _cclegacy = _cc.cclegacy;
- }, function (_unresolved_2) {
- ch = _unresolved_2.ch;
- }, function (_unresolved_3) {
- GameData = _unresolved_3.default;
- }, function (_unresolved_4) {
- UINotify = _unresolved_4.UINotify;
- }, function (_unresolved_5) {
- Start = _unresolved_5.Start;
- }],
- execute: function () {
- _crd = true;
- _cclegacy._RF.push({}, "b500dzoF+pEaLB1EsW0vW75", "PlayerData", undefined);
- //定义事件
- //排行榜key
- _export("rand_type", rand_type = /*#__PURE__*/function (rand_type) {
- rand_type["floor"] = "floor";
- return rand_type;
- }({})); //自定义数据
- _export("data_type", data_type = /*#__PURE__*/function (data_type) {
- data_type["last_gift_sidebar"] = "last_gift_sidebar";
- data_type["max_floor"] = "max_floor";
- data_type["coin"] = "coin";
- return data_type;
- }({})); //每日数据
- _export("day_data_type", day_data_type = /*#__PURE__*/function (day_data_type) {
- day_data_type["sign_gift"] = "sign_gift";
- day_data_type["isFavorite"] = "isFavorite";
- return day_data_type;
- }({})); //每周数据
- _export("week_data_type", week_data_type = /*#__PURE__*/function (week_data_type) {
- return week_data_type;
- }({})); //每月数据
- _export("month_data_type", month_data_type = /*#__PURE__*/function (month_data_type) {
- return month_data_type;
- }({}));
- _export("default", PlayerData = class PlayerData extends (_crd && GameData === void 0 ? (_reportPossibleCrUseOfGameData({
- error: Error()
- }), GameData) : GameData) {
- constructor() {
- super(...arguments);
- this.event = void 0;
- this.items = void 0;
- //////////////////////////////////////////////////////////////////////////////////////////
- this.user_info = void 0;
- }
- //道具容器
- static getInstance(gid, uid) {
- if (!this._instance) {
- this._instance = new PlayerData(gid, uid, "PlayerData", new Map([[data_type.coin, {
- min: 0,
- max: 1000000
- }]]), new Map([[day_data_type.sign_gift, {
- min: 0,
- max: 1
- }]]));
- }
- return this._instance;
- } //数据初始化
- on_init() {
- (_crd && ch === void 0 ? (_reportPossibleCrUseOfch({
- error: Error()
- }), ch) : ch).sign.init(2, null, 7); //道具初始化
- (_crd && ch === void 0 ? (_reportPossibleCrUseOfch({
- error: Error()
- }), ch) : ch).log.log("道具初始化", this);
- } //序列化加入自定义数据
- on_serialize(data) {
- data.sign = (_crd && ch === void 0 ? (_reportPossibleCrUseOfch({
- error: Error()
- }), ch) : ch).sign.getSignData();
- } //反序列化加入自定义数据
- on_unserialize(data) {
- (_crd && ch === void 0 ? (_reportPossibleCrUseOfch({
- error: Error()
- }), ch) : ch).sign.init(2, data.sign, 7);
- } //是否使用远程数据
- on_check(local, remote) {
- return true;
- } //使用道具
- useItem(type, count) {
- return _asyncToGenerator(function* () {})();
- } //增加道具
- add_item(type, count) {} //设置道具数量
- set_item(type, count) {} //获取道具数量
- get_item(type) {
- return 0;
- } //获取签到天数
- get_sign() {
- return this.day_data.get(day_data_type.sign_gift);
- } //设置签到天数
- set_sign(count) {
- this.day_data.set(day_data_type.sign_gift, count);
- } //获取是否当日首次通过收藏进入
- get_is_favorite() {
- return this.day_data.get(day_data_type.isFavorite);
- } //设置已从收藏进入
- set_is_favorite() {
- this.day_data.set(day_data_type.isFavorite, 1);
- this.setDirty();
- this.save();
- } //获取金币数量
- get_coin() {
- return this.data.get(data_type.coin);
- } //设置金币数量
- set_coin(coin) {
- this.data.set(data_type.coin, coin);
- }
- load_data() {
- var _superprop_getLoad_data = () => super.load_data,
- _this = this;
- return _asyncToGenerator(function* () {
- if ((_crd && Start === void 0 ? (_reportPossibleCrUseOfStart({
- error: Error()
- }), Start) : Start).packId == 1) {
- return new Promise((resolve, reject) => {});
- } else {
- return _superprop_getLoad_data().call(_this);
- }
- })();
- }
- get nickName() {
- return this.user_info.nickName;
- }
- get avatarUrl() {
- return this.user_info.avatar;
- }
- init_user_info() {
- var _this2 = this;
- return _asyncToGenerator(function* () {
- if ((_crd && Start === void 0 ? (_reportPossibleCrUseOfStart({
- error: Error()
- }), Start) : Start).packId == 1) {} else {
- _this2.user_info = {
- uid: _this2.uid,
- nickName: (_crd && ch === void 0 ? (_reportPossibleCrUseOfch({
- error: Error()
- }), ch) : ch).sdk.get_player_info().nickName,
- avatar: (_crd && ch === void 0 ? (_reportPossibleCrUseOfch({
- error: Error()
- }), ch) : ch).sdk.get_player_info().avatarUrl,
- province: (_crd && ch === void 0 ? (_reportPossibleCrUseOfch({
- error: Error()
- }), ch) : ch).sdk.get_player_info().province
- };
- }
- })();
- }
- save_data(save_data) {
- var _superprop_getSave_data = () => super.save_data,
- _this3 = this;
- return _asyncToGenerator(function* () {
- if ((_crd && Start === void 0 ? (_reportPossibleCrUseOfStart({
- error: Error()
- }), Start) : Start).packId == 1) {
- return true;
- } else {
- return _superprop_getSave_data().call(_this3, save_data);
- }
- })();
- }
- save_rank_floor() {
- if ((_crd && Start === void 0 ? (_reportPossibleCrUseOfStart({
- error: Error()
- }), Start) : Start).packId == 1) {} else {
- var floor = this.data.get(data_type.max_floor) - 1;
- (_crd && ch === void 0 ? (_reportPossibleCrUseOfch({
- error: Error()
- }), ch) : ch).sdk.saveRankData(rand_type.floor, floor, (_crd && ch === void 0 ? (_reportPossibleCrUseOfch({
- error: Error()
- }), ch) : ch).sdk.updateType.none, 0, {
- province: this.user_info.province
- });
- }
- }
- get_rank_floor() {
- return _asyncToGenerator(function* () {
- var index = 0;
- if ((_crd && Start === void 0 ? (_reportPossibleCrUseOfStart({
- error: Error()
- }), Start) : Start).packId == 1) {} else {
- var d = yield (_crd && ch === void 0 ? (_reportPossibleCrUseOfch({
- error: Error()
- }), ch) : ch).sdk.loadRankData(rand_type.floor, (_crd && ch === void 0 ? (_reportPossibleCrUseOfch({
- error: Error()
- }), ch) : ch).sdk.updateType.none, 100, true);
- if (d.data.own) {
- for (var i = 0; i < d.data.list.length; i++) {
- if (d.data.own.userId === d.data.list[i].userId) {
- index = i + 1;
- }
- }
- } else {
- index = 101;
- }
- return {
- list: d.data.list,
- owner: d.data.own,
- index: index
- };
- }
- })();
- }
- loadPfInfo() {
- return _asyncToGenerator(function* () {
- return new Promise( /*#__PURE__*/_asyncToGenerator(function* (resolve) {
- var k = yield (_crd && ch === void 0 ? (_reportPossibleCrUseOfch({
- error: Error()
- }), ch) : ch).sdk.getUserInfo();
- if (k) {
- if ((_crd && Start === void 0 ? (_reportPossibleCrUseOfStart({
- error: Error()
- }), Start) : Start).packId == 1) {}
- resolve(true);
- } else {
- (_crd && UINotify === void 0 ? (_reportPossibleCrUseOfUINotify({
- error: Error()
- }), UINotify) : UINotify).show("需要授权");
- resolve(false);
- }
- }));
- })();
- }
- });
- PlayerData._instance = void 0;
- _cclegacy._RF.pop();
- _crd = false;
- }
- };
- });
- //# sourceMappingURL=9fa0e63ffe0a92f6cd390b9195c28487e3487e7c.js.map
|