System.register(["__unresolved_0", "cc", "__unresolved_1", "__unresolved_2", "__unresolved_3"], function (_export, _context) { "use strict"; var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, Label, instantiate, math, Layout_UI_Notify, GameUILayers, gui, ui_base, ModuleDef, NotifyInfo, UINotify, _crd; 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 _reportPossibleCrUseOfLayout_UI_Notify(extras) { _reporterNs.report("Layout_UI_Notify", "./Layout_UI_Notify", _context.meta, extras); } function _reportPossibleCrUseOfGameUILayers(extras) { _reporterNs.report("GameUILayers", "../../core/ui/ui", _context.meta, extras); } function _reportPossibleCrUseOfgui(extras) { _reporterNs.report("gui", "../../core/ui/ui", _context.meta, extras); } function _reportPossibleCrUseOfui_base(extras) { _reporterNs.report("ui_base", "../../core/ui/ui", _context.meta, extras); } function _reportPossibleCrUseOfModuleDef(extras) { _reporterNs.report("ModuleDef", "../../Scripts/ModuleDef", _context.meta, extras); } _export("UINotify", void 0); return { setters: [function (_unresolved_) { _reporterNs = _unresolved_; }, function (_cc) { _cclegacy = _cc.cclegacy; __checkObsolete__ = _cc.__checkObsolete__; __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__; Label = _cc.Label; instantiate = _cc.instantiate; math = _cc.math; }, function (_unresolved_2) { Layout_UI_Notify = _unresolved_2.Layout_UI_Notify; }, function (_unresolved_3) { GameUILayers = _unresolved_3.GameUILayers; gui = _unresolved_3.gui; ui_base = _unresolved_3.ui_base; }, function (_unresolved_4) { ModuleDef = _unresolved_4.ModuleDef; }], execute: function () { _crd = true; _cclegacy._RF.push({}, "2e622idLyVJBYf//0497gj2", "UINotify", undefined); __checkObsolete__(['Label', 'Prefab', 'instantiate', 'Node', 'math']); NotifyInfo = class NotifyInfo { constructor(node, parent, txt) { //正常大小 this.time = void 0; this.node = void 0; this.state = void 0; this._state_time = 0; this.time = NotifyInfo.time; this.node = node; this.state = 0; this._state_time = 0; var label = node.getComponentInChildren(Label); label.string = txt; node.parent = parent; node.setPosition(0, NotifyInfo.init_y, 0); node.setScale(NotifyInfo.sc_state0, NotifyInfo.sc_state0, NotifyInfo.sc_state0); node.active = true; } up() {// this.node.setPosition(this.node.position.x, this.node.position.y + NotifyInfo.up_y, this.node.position.z); } run(dt) { this.time -= dt; if (this.time <= 0) { this.node.destroy(); this.node = null; return true; } else if (this.time < 0.5) {// this.node.setPosition(this.node.position.x, this.node.position.y + NotifyInfo.move_speed * dt, this.node.position.z); } else { if (this.state === 0) { this._state_time += dt; var ratio = this._state_time / NotifyInfo.sc_state0_time; if (ratio >= 1) { this.state = 1; this._state_time = 0; this.node.setScale(NotifyInfo.sc_state1, NotifyInfo.sc_state1, NotifyInfo.sc_state1); } else { var sc = math.lerp(NotifyInfo.sc_state0, NotifyInfo.sc_state1, ratio); this.node.setScale(sc, sc, sc); } } else if (this.state === 1) { this._state_time += dt; var _ratio = this._state_time / NotifyInfo.sc_state1_time; if (_ratio >= 1) { this.state = 2; this._state_time = 0; this.node.setScale(NotifyInfo.sc_state2, NotifyInfo.sc_state2, NotifyInfo.sc_state2); } else { var _sc = math.lerp(NotifyInfo.sc_state1, NotifyInfo.sc_state2, _ratio); this.node.setScale(_sc, _sc, _sc); } } } return false; } }; NotifyInfo.time = 2; NotifyInfo.init_y = 120; NotifyInfo.up_y = 80; //上升一格 NotifyInfo.move_speed = 880; //向上移动速度 NotifyInfo.sc_state0 = 0.8; //变小大小 NotifyInfo.sc_state0_time = 0.22; NotifyInfo.sc_state1 = 1.2; //变大大小 NotifyInfo.sc_state1_time = 0.41; NotifyInfo.sc_state2 = 1; _export("UINotify", UINotify = class UINotify extends (_crd && ui_base === void 0 ? (_reportPossibleCrUseOfui_base({ error: Error() }), ui_base) : ui_base) { constructor() { super((_crd && ModuleDef === void 0 ? (_reportPossibleCrUseOfModuleDef({ error: Error() }), ModuleDef) : ModuleDef).BASIC, 'ui_notify/UI_Notify', (_crd && GameUILayers === void 0 ? (_reportPossibleCrUseOfGameUILayers({ error: Error() }), GameUILayers) : GameUILayers).NOTICE, _crd && Layout_UI_Notify === void 0 ? (_reportPossibleCrUseOfLayout_UI_Notify({ error: Error() }), Layout_UI_Notify) : Layout_UI_Notify); this._info_prefab = void 0; this.notifys = []; } static show(msg) { return _asyncToGenerator(function* () { var ui = (_crd && gui === void 0 ? (_reportPossibleCrUseOfgui({ error: Error() }), gui) : gui).get(UINotify); if (!ui) ui = yield (_crd && gui === void 0 ? (_reportPossibleCrUseOfgui({ error: Error() }), gui) : gui).show(UINotify); ui.newNotify(msg); })(); } onCreated() { var layout = this.getLayout(); this._info_prefab = layout.info_prefab; } newNotify(txt) { var info = new NotifyInfo(instantiate(this._info_prefab), this.node, txt); for (var i = this.notifys.length - 1; i >= 0; i--) this.notifys[i].up(); this.notifys.push(info); } onUpdate(dt) { for (var i = this.notifys.length - 1; i >= 0; i--) if (this.notifys[i].run(dt)) this.notifys.splice(i, 1); } dispose() { this._info_prefab = null; } }); _cclegacy._RF.pop(); _crd = false; } }; }); //# sourceMappingURL=7a060cba1d5a032475d6578a562fb8df8171eb0b.js.map