123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405 |
- System.register(["__unresolved_0", "cc", "__unresolved_1", "__unresolved_2", "__unresolved_3", "__unresolved_4", "__unresolved_5", "__unresolved_6", "__unresolved_7", "__unresolved_8", "__unresolved_9"], function (_export, _context) {
- "use strict";
- var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, Node, SkeletalAnimation, BaseExp, ResUtil, Game, autoBind, PoolManager, uiMgr, Constants, userIns, GunBase, _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _crd, ccclass, property, Player;
- 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 _reportPossibleCrUseOfBaseExp(extras) {
- _reporterNs.report("BaseExp", "../../core/base/BaseExp", _context.meta, extras);
- }
- function _reportPossibleCrUseOfResUtil(extras) {
- _reporterNs.report("ResUtil", "../../utils/ResUtil", _context.meta, extras);
- }
- function _reportPossibleCrUseOfGame(extras) {
- _reporterNs.report("Game", "../../game/Game", _context.meta, extras);
- }
- function _reportPossibleCrUseOfautoBind(extras) {
- _reporterNs.report("autoBind", "../../extend/AutoBind", _context.meta, extras);
- }
- function _reportPossibleCrUseOfPoolManager(extras) {
- _reporterNs.report("PoolManager", "../../core/manager/PoolManager", _context.meta, extras);
- }
- function _reportPossibleCrUseOfuiMgr(extras) {
- _reporterNs.report("uiMgr", "../../core/manager/UIManager", _context.meta, extras);
- }
- function _reportPossibleCrUseOfConstants(extras) {
- _reporterNs.report("Constants", "../../data/Constants", _context.meta, extras);
- }
- function _reportPossibleCrUseOfGunfightShootUI(extras) {
- _reporterNs.report("GunfightShootUI", "../../ui/GunfightShootUI", _context.meta, extras);
- }
- function _reportPossibleCrUseOfuserIns(extras) {
- _reporterNs.report("userIns", "../../data/UserData", _context.meta, extras);
- }
- function _reportPossibleCrUseOfGunBase(extras) {
- _reporterNs.report("GunBase", "../base/GunBase", _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;
- SkeletalAnimation = _cc.SkeletalAnimation;
- }, function (_unresolved_2) {
- BaseExp = _unresolved_2.BaseExp;
- }, function (_unresolved_3) {
- ResUtil = _unresolved_3.ResUtil;
- }, function (_unresolved_4) {
- Game = _unresolved_4.Game;
- }, function (_unresolved_5) {
- autoBind = _unresolved_5.autoBind;
- }, function (_unresolved_6) {
- PoolManager = _unresolved_6.PoolManager;
- }, function (_unresolved_7) {
- uiMgr = _unresolved_7.uiMgr;
- }, function (_unresolved_8) {
- Constants = _unresolved_8.Constants;
- }, function (_unresolved_9) {
- userIns = _unresolved_9.userIns;
- }, function (_unresolved_10) {
- GunBase = _unresolved_10.GunBase;
- }],
- execute: function () {
- _crd = true;
- _cclegacy._RF.push({}, "2ff50wmAl5EppYKqh0ngPHz", "Player", undefined);
- __checkObsolete__(['_decorator', 'AnimationState', 'Node', 'SkeletalAnimation']);
- ({
- ccclass,
- property
- } = _decorator);
- _export("Player", Player = (_dec = ccclass('Player'), _dec2 = property({
- type: [Node],
- tooltip: "玩家的位置节点"
- }), _dec3 = (_crd && autoBind === void 0 ? (_reportPossibleCrUseOfautoBind({
- error: Error()
- }), autoBind) : autoBind)({
- type: Node,
- tooltip: "创建枪的位置"
- }), _dec4 = (_crd && autoBind === void 0 ? (_reportPossibleCrUseOfautoBind({
- error: Error()
- }), autoBind) : autoBind)({
- type: Node,
- tooltip: "玩家头的位置"
- }), _dec5 = (_crd && autoBind === void 0 ? (_reportPossibleCrUseOfautoBind({
- error: Error()
- }), autoBind) : autoBind)({
- type: Node,
- tooltip: "敌人埋伏点"
- }), _dec6 = (_crd && autoBind === void 0 ? (_reportPossibleCrUseOfautoBind({
- error: Error()
- }), autoBind) : autoBind)({
- type: Node,
- tooltip: "玩家身子的位置"
- }), _dec7 = (_crd && autoBind === void 0 ? (_reportPossibleCrUseOfautoBind({
- error: Error()
- }), autoBind) : autoBind)({
- type: SkeletalAnimation,
- tooltip: "玩家人物动画节点"
- }), _dec(_class = (_class2 = class Player extends (_crd && BaseExp === void 0 ? (_reportPossibleCrUseOfBaseExp({
- error: Error()
- }), BaseExp) : BaseExp) {
- constructor() {
- super(...arguments);
- _initializerDefineProperty(this, "playPosNodes", _descriptor, this);
- _initializerDefineProperty(this, "gun_pos", _descriptor2, this);
- _initializerDefineProperty(this, "header", _descriptor3, this);
- _initializerDefineProperty(this, "ambush", _descriptor4, this);
- _initializerDefineProperty(this, "body", _descriptor5, this);
- _initializerDefineProperty(this, "player_skeletal", _descriptor6, this);
- /**玩家当前血量*/
- this.curHP = 0;
- /**玩家是否死亡*/
- this.isDead = false;
- /**玩家拥有的枪*/
- this.gun = null;
- //玩家数据
- this.pData = null;
- //是否去设置gunfightShootUI的基础信息
- this.isCutShoot = false;
- //射击ui类
- this._shootUI = null;
- //是否是换弹夹状态
- this.isReloadMagazine = false;
- //玩家击杀敌人过后 敌人累加的精准度 玩家每杀3个敌人AI增加1%的精准度
- this.addPrecision = 0;
- //连续通关 玩家每杀3个敌人AI增加15%的血量 AI增加5%的精准度
- this.addhp = 0;
- }
- //懒获取射击界面
- get shootUI() {
- if (!this._shootUI) {
- this._shootUI = (_crd && uiMgr === void 0 ? (_reportPossibleCrUseOfuiMgr({
- error: Error()
- }), uiMgr) : uiMgr).getPageComponent((_crd && Constants === void 0 ? (_reportPossibleCrUseOfConstants({
- error: Error()
- }), Constants) : Constants).popUIs.gunfightShootUI);
- }
- return this._shootUI;
- }
- start() {
- this.gun_pos.active = false;
- this.playPosNodes.forEach(e => e.active = false);
- this.pData = (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
- error: Error()
- }), userIns) : userIns).getCurUseGun(); //创建玩家拥有的枪
- this.loadGunName(this.pData.prb_name);
- }
- /**
- * 加载枪
- * @param name 枪的名字
- * @param isCut 是否是切换枪
- */
- loadGunName(name, isCut) {
- if (isCut === void 0) {
- isCut = false;
- }
- //玩家待机状态
- this.player_skeletal.play('idle');
- this.pData = (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
- error: Error()
- }), userIns) : userIns).getCurUseGun();
- this.curHP = this.pData.hp;
- if (!isCut && this.gun) return;
- if (isCut) {
- (_crd && PoolManager === void 0 ? (_reportPossibleCrUseOfPoolManager({
- error: Error()
- }), PoolManager) : PoolManager).putNode(this.gun.node);
- }
- (_crd && ResUtil === void 0 ? (_reportPossibleCrUseOfResUtil({
- error: Error()
- }), ResUtil) : ResUtil).loadGunRes("player/" + name).then(gunNode => {
- if (!gunNode) return;
- this.isCutShoot = true;
- gunNode.parent = this.node;
- this.gun = gunNode.getComponent(_crd && GunBase === void 0 ? (_reportPossibleCrUseOfGunBase({
- error: Error()
- }), GunBase) : GunBase);
- gunNode.worldPosition = this.gun_pos.worldPosition;
- gunNode.eulerAngles = this.gun_pos.eulerAngles; //Y轴旋转180度
- //gunNode.eulerAngles = new Vec3(0,-180,0);
- this.gun.init(this.pData, this, () => {}, this.reloadMagazine.bind(this));
- });
- }
- /**
- * 更换弹匣
- */
- reloadMagazine(data) {
- if (!data || this.isReloadMagazine) return;
- this.isReloadMagazine = true;
- var time = data.reloadingSpeed * 4 / 1000; //换弹匣动画
- this.shootUI.reloadMagazineing(time, () => {
- this.isReloadMagazine = false;
- this.shootUI.gunDataUI();
- });
- }
- /**
- * 玩家发射子弹
- */
- shoot() {
- if (!this.gun || this.isReloadMagazine) return;
- this.gun.fire();
- this.shootUI.crossHairStability();
- }
- /**
- * 随机切枪
- */
- randomCutGun() {
- var guns = (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
- error: Error()
- }), userIns) : userIns).data.guns;
- if (guns.length > 1) {
- var idx = guns.findIndex(e => e.id == this.pData.id);
- var next = (idx + 1) % guns.length;
- var cutGun = guns[next];
- (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
- error: Error()
- }), userIns) : userIns).changeGun(cutGun.id);
- this.loadGunName(cutGun.prb_name, true);
- }
- }
- /**
- * 移除枪回收武器
- */
- removeGun() {
- if (!this.gun) return;
- this.gun.endFire();
- (_crd && PoolManager === void 0 ? (_reportPossibleCrUseOfPoolManager({
- error: Error()
- }), PoolManager) : PoolManager).putNode(this.gun.node);
- this.gun = null;
- }
- /**
- * 玩家扣掉血
- * @param hp 血
- * @param eData 敌人数据
- */
- subHP(hp, eData) {
- if ((_crd && Game === void 0 ? (_reportPossibleCrUseOfGame({
- error: Error()
- }), Game) : Game).I.isPause || (_crd && Game === void 0 ? (_reportPossibleCrUseOfGame({
- error: Error()
- }), Game) : Game).I.isGameOver || this.isDead || hp <= 0) {
- return;
- }
- this.curHP -= hp; //这种是伤害超级高直接死亡了 或者血量为小于等于0
- if (hp > this.curHP && this.curHP <= 0) {}
- this.curHP = this.curHP < 0 ? 0 : this.curHP; //设置血条
- var progress = this.curHP / this.pData.hp;
- this.shootUI.hpProgressBar.progress = progress;
- this.shootUI.playerHurtTwinkle(progress < 0.3); //敌人死亡
- if (this.curHP <= 0 && !this.isDead) {
- //英雄死亡回收节点 看广告
- // Game.I.buildHeros.addAndSubHeros(this,true);
- // Game.I.buildHeros.heroDeadPop(this);
- this.isDead = true;
- (_crd && Game === void 0 ? (_reportPossibleCrUseOfGame({
- error: Error()
- }), Game) : Game).I.isGameOver = true;
- this.removeGun();
- this.player_skeletal.play('die');
- this.scheduleOnce(() => {
- this.player_skeletal.stop();
- this.player_skeletal.node.active = false;
- }, 2);
- }
- }
- /**
- * 根据关卡设置玩家的位置
- */
- setPlayerPos() {
- if (!this.pData) return;
- var length = this.playPosNodes.length;
- var data = (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
- error: Error()
- }), userIns) : userIns).getCurLevelData();
- var safeIndex = Math.min(data.point - 1, length - 1);
- var n = this.playPosNodes[safeIndex];
- this.node.worldPosition = n.worldPosition.clone();
- }
- /**
- * 设置枪的数据
- */
- update(dt) {
- if (this.isCutShoot) {
- //设置玩家枪的信息
- if (this.shootUI && this.pData) {
- this.shootUI.gunDataUI();
- this.isCutShoot = false;
- }
- }
- }
- }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "playPosNodes", [_dec2], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: function initializer() {
- return [];
- }
- }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "gun_pos", [_dec3], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: function initializer() {
- return null;
- }
- }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "header", [_dec4], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: function initializer() {
- return null;
- }
- }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "ambush", [_dec5], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: function initializer() {
- return null;
- }
- }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, "body", [_dec6], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: function initializer() {
- return null;
- }
- }), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "player_skeletal", [_dec7], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: function initializer() {
- return null;
- }
- })), _class2)) || _class));
- _cclegacy._RF.pop();
- _crd = false;
- }
- };
- });
- //# sourceMappingURL=be9dd4bdd4be05e645ab9c0df067aee908e7a7cd.js.map
|