123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- System.register(["__unresolved_0", "cc", "__unresolved_1", "__unresolved_2", "__unresolved_3", "__unresolved_4"], function (_export, _context) {
- "use strict";
- var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, Node, Sprite, SpriteFrame, PoolManager, Game, Constants, BaseExp, _dec, _dec2, _dec3, _dec4, _dec5, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _crd, ccclass, property, BulletMagazine;
- function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
- function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
- function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
- function _reportPossibleCrUseOfPoolManager(extras) {
- _reporterNs.report("PoolManager", "../core/manager/PoolManager", _context.meta, extras);
- }
- function _reportPossibleCrUseOfGame(extras) {
- _reporterNs.report("Game", "./Game", _context.meta, extras);
- }
- function _reportPossibleCrUseOfConstants(extras) {
- _reporterNs.report("Constants", "../data/Constants", _context.meta, extras);
- }
- function _reportPossibleCrUseOfBaseExp(extras) {
- _reporterNs.report("BaseExp", "../core/base/BaseExp", _context.meta, extras);
- }
- return {
- setters: [function (_unresolved_) {
- _reporterNs = _unresolved_;
- }, function (_cc) {
- _cclegacy = _cc.cclegacy;
- __checkObsolete__ = _cc.__checkObsolete__;
- __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
- _decorator = _cc._decorator;
- Node = _cc.Node;
- Sprite = _cc.Sprite;
- SpriteFrame = _cc.SpriteFrame;
- }, function (_unresolved_2) {
- PoolManager = _unresolved_2.PoolManager;
- }, function (_unresolved_3) {
- Game = _unresolved_3.Game;
- }, function (_unresolved_4) {
- Constants = _unresolved_4.Constants;
- }, function (_unresolved_5) {
- BaseExp = _unresolved_5.BaseExp;
- }],
- execute: function () {
- _crd = true;
- _cclegacy._RF.push({}, "83c6ckag1RAjY4TUul1spSN", "BulletMagazine", undefined);
- __checkObsolete__(['_decorator', 'Node', 'Sprite', 'SpriteFrame']);
- ({
- ccclass,
- property
- } = _decorator);
- _export("BulletMagazine", BulletMagazine = (_dec = ccclass('BulletMagazine'), _dec2 = property({
- type: Node,
- tooltip: "滚动内容"
- }), _dec3 = property({
- type: Node,
- tooltip: "子弹预制体"
- }), _dec4 = property({
- type: SpriteFrame,
- tooltip: "用过的子弹图片"
- }), _dec5 = property({
- type: SpriteFrame,
- tooltip: "正常的子弹图片"
- }), _dec(_class = (_class2 = class BulletMagazine extends (_crd && BaseExp === void 0 ? (_reportPossibleCrUseOfBaseExp({
- error: Error()
- }), BaseExp) : BaseExp) {
- constructor() {
- super(...arguments);
- _initializerDefineProperty(this, "content", _descriptor, this);
- _initializerDefineProperty(this, "bullet", _descriptor2, this);
- _initializerDefineProperty(this, "use_sf", _descriptor3, this);
- _initializerDefineProperty(this, "nor_sf", _descriptor4, this);
- //当前子弹总数量
- this._magazineNum = 0;
- //弹夹中的子弹图片节点
- this.bullets = [];
- }
- set magazineNum(value) {
- this._magazineNum = value;
- this.loadMagazine();
- }
- get magazineNum() {
- return this._magazineNum;
- }
- start() {
- this.bullet.active = false; //更换弹夹
- this.register((_crd && Constants === void 0 ? (_reportPossibleCrUseOfConstants({
- error: Error()
- }), Constants) : Constants).eventName.magazine_num_change, this.loadMagazine.bind(this));
- }
- /**
- * 加载子弹 弹夹
- */
- loadMagazine() {
- if (!(_crd && Game === void 0 ? (_reportPossibleCrUseOfGame({
- error: Error()
- }), Game) : Game).I.player.gun || (_crd && Game === void 0 ? (_reportPossibleCrUseOfGame({
- error: Error()
- }), Game) : Game).I.isGameOver) return;
- this.recycle();
- var gData = (_crd && Game === void 0 ? (_reportPossibleCrUseOfGame({
- error: Error()
- }), Game) : Game).I.player.pData;
- var s_bullet = gData.magazine - (_crd && Game === void 0 ? (_reportPossibleCrUseOfGame({
- error: Error()
- }), Game) : Game).I.player.gun.shotBullets;
- for (var idx = 0; idx < this._magazineNum; idx++) {
- var n = (_crd && PoolManager === void 0 ? (_reportPossibleCrUseOfPoolManager({
- error: Error()
- }), PoolManager) : PoolManager).getNode(this.bullet, this.content);
- this.bullets.push(n);
- n.getChildByName("kd_sp").getComponent(Sprite).spriteFrame = idx < s_bullet ? this.nor_sf : this.use_sf;
- }
- }
- onDisable() {
- this.recycle();
- }
- recycle() {
- this.bullets.forEach(item => {
- if (item.parent) {
- (_crd && PoolManager === void 0 ? (_reportPossibleCrUseOfPoolManager({
- error: Error()
- }), PoolManager) : PoolManager).putNode(item);
- }
- });
- this.bullets = [];
- }
- }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "content", [_dec2], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: null
- }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "bullet", [_dec3], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: null
- }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "use_sf", [_dec4], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: null
- }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "nor_sf", [_dec5], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: null
- })), _class2)) || _class));
- _cclegacy._RF.pop();
- _crd = false;
- }
- };
- });
- //# sourceMappingURL=a038c291e67008cfb5431f862bc951b95d2f25c0.js.map
|