123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- System.register(["__unresolved_0", "cc", "__unresolved_1", "__unresolved_2", "__unresolved_3"], function (_export, _context) {
- "use strict";
- var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, Singleton, Constants, userIns, _dec, _class, _crd, ccclass, property, StateManager, stateMgr;
- function _reportPossibleCrUseOfSingleton(extras) {
- _reporterNs.report("Singleton", "./Singleton", _context.meta, extras);
- }
- function _reportPossibleCrUseOfConstants(extras) {
- _reporterNs.report("Constants", "../../data/Constants", _context.meta, extras);
- }
- function _reportPossibleCrUseOfuserIns(extras) {
- _reporterNs.report("userIns", "../../data/UserData", _context.meta, extras);
- }
- return {
- setters: [function (_unresolved_) {
- _reporterNs = _unresolved_;
- }, function (_cc) {
- _cclegacy = _cc.cclegacy;
- __checkObsolete__ = _cc.__checkObsolete__;
- __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
- _decorator = _cc._decorator;
- }, function (_unresolved_2) {
- Singleton = _unresolved_2.Singleton;
- }, function (_unresolved_3) {
- Constants = _unresolved_3.Constants;
- }, function (_unresolved_4) {
- userIns = _unresolved_4.userIns;
- }],
- execute: function () {
- _crd = true;
- _cclegacy._RF.push({}, "d10a2XpdK9L24FMMF9uqCTp", "StateManager", undefined);
- __checkObsolete__(['_decorator', 'Label', 'Node']);
- ({
- ccclass,
- property
- } = _decorator);
- StateManager = (_dec = ccclass('StateManager'), _dec(_class = class StateManager extends (_crd && Singleton === void 0 ? (_reportPossibleCrUseOfSingleton({
- error: Error()
- }), Singleton) : Singleton) {
- constructor() {
- super(...arguments);
- //存储状态字段与 UI 组件的绑定关系
- this.uiBindings = new Map();
- }
- /**
- * 注册UI组件
- * @param field 注册的key uiName
- * @param label 具体的文本
- */
- registerUI(field, label) {
- if (!this.uiBindings.has(field)) {
- this.uiBindings.set(field, []);
- } //将UI组件添加到绑定列表
- var uiArr = this.uiBindings.get(field);
- if (!uiArr.includes(label)) {
- uiArr.push(label);
- } //初始化UI显示
- this.updateSingleUI(field, label);
- }
- /**
- * 全局更新所有绑定该字段
- * @param field 注册的key uiName
- */
- updateAllUI(field) {
- var labels = this.uiBindings.get(field);
- if (labels) {
- labels.forEach(label => {
- this.updateSingleUI(field, label);
- });
- }
- }
- /**
- * 更新单个UI组件
- * @param field
- * @param label
- */
- updateSingleUI(field, com) {
- if (field == (_crd && Constants === void 0 ? (_reportPossibleCrUseOfConstants({
- error: Error()
- }), Constants) : Constants).gold) {
- //金币数量
- com.string = "" + (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
- error: Error()
- }), userIns) : userIns).data.gold;
- } else if (field == (_crd && Constants === void 0 ? (_reportPossibleCrUseOfConstants({
- error: Error()
- }), Constants) : Constants).diamond) {
- //钻石数量
- com.string = "" + (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
- error: Error()
- }), userIns) : userIns).data.diamond;
- } else if (field == (_crd && Constants === void 0 ? (_reportPossibleCrUseOfConstants({
- error: Error()
- }), Constants) : Constants).levelTask) {//任务数据变化
- }
- }
- }) || _class); //全局单例
- _export("stateMgr", stateMgr = StateManager.ins());
- _cclegacy._RF.pop();
- _crd = false;
- }
- };
- });
- //# sourceMappingURL=ef4650e3d820747f29e4bf013638014f42bf57bb.js.map
|