System.register(["cc"], function (_export, _context) { "use strict"; var _cclegacy, State, _crd; function get_new_state() { return new State(); } _export("default", get_new_state); return { setters: [function (_cc) { _cclegacy = _cc.cclegacy; }], execute: function () { _crd = true; _cclegacy._RF.push({}, "d9db0FDjAhNuLA9MVTSVAgv", "State", undefined); /*enum states{ Read = 1, //0001 Write = 2, //0010 Create = 4,//0100 Delete = 8 //1000 }/**状态类型不算合并的不超过32种 export enum StateType { Unmatched = 1<<1,//无敌 Swoon = 1<<2,//晕眩 }*/ /**状态对像*/ State = class State { constructor() { this._state = 0; } //无状态 Init() { this._state = 0; } /**是否满足传入的状态*/ Meet(state) { return State.Has(this._state, state); } /**传入的状态是组合型时只要满足其一 */ MeetAny(state) { let a = this._state & state; if (a === state) return true; if (a == 0) return false; return State.Has(state, a); } /**是否满足所有传入的状态*/ MeetAll(...params) { let result = 0; for (let i = 0; i < params.length; i++) { result |= params[i]; } return this.Meet(State.CombieState(result)); } /**是否满足其中传入的状态*/ MeetAnyOne(...params) { for (let i = 0; i < params.length; i++) { if (this.Meet(params[i])) return true; } return false; } /**加入状态*/ Add(state) { this._state |= state; } /**删除状态*/ Delete(state) { if (!this.Meet(state)) return; this._state ^= state; } /**转成状态*/ static ToState(Id) { return 1 << Id; } /**合并状态*/ static CombieState(...params) { let result = 0; for (let i = 0; i < params.length; i++) { result |= params[i]; } return result; } static Has(statss, state) { return (statss & state) === state; } }; _cclegacy._RF.pop(); _crd = false; } }; }); //# sourceMappingURL=5f91b0c989c2a479c1da04fdb508bd586eba443c.js.map