123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467 |
- System.register(["__unresolved_0", "cc", "__unresolved_1", "__unresolved_2", "__unresolved_3", "__unresolved_4", "__unresolved_5", "__unresolved_6", "__unresolved_7", "__unresolved_8", "__unresolved_9", "__unresolved_10", "__unresolved_11"], function (_export, _context) {
- "use strict";
- var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, Node, SkeletalAnimation, BaseExp, PoolManager, uiMgr, Constants, userIns, autoBind, GunBase, ResUtil, Game, MsgHints, PlayerCamera, _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _crd, ccclass, property, PAnimType, 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 _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 _reportPossibleCrUseOfuserIns(extras) {
- _reporterNs.report("userIns", "../data/UserData", _context.meta, extras);
- }
- function _reportPossibleCrUseOfautoBind(extras) {
- _reporterNs.report("autoBind", "../extend/AutoBind", _context.meta, extras);
- }
- function _reportPossibleCrUseOfGunBase(extras) {
- _reporterNs.report("GunBase", "../items/base/GunBase", _context.meta, extras);
- }
- function _reportPossibleCrUseOfGunfightShootUI(extras) {
- _reporterNs.report("GunfightShootUI", "../ui/GunfightShootUI", _context.meta, extras);
- }
- function _reportPossibleCrUseOfResUtil(extras) {
- _reporterNs.report("ResUtil", "../utils/ResUtil", _context.meta, extras);
- }
- function _reportPossibleCrUseOfGame(extras) {
- _reporterNs.report("Game", "./Game", _context.meta, extras);
- }
- function _reportPossibleCrUseOfMsgHints(extras) {
- _reporterNs.report("MsgHints", "../utils/MsgHints", _context.meta, extras);
- }
- function _reportPossibleCrUseOfPlayerCamera(extras) {
- _reporterNs.report("PlayerCamera", "./PlayerCamera", _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) {
- PoolManager = _unresolved_3.PoolManager;
- }, function (_unresolved_4) {
- uiMgr = _unresolved_4.uiMgr;
- }, function (_unresolved_5) {
- Constants = _unresolved_5.Constants;
- }, function (_unresolved_6) {
- userIns = _unresolved_6.userIns;
- }, function (_unresolved_7) {
- autoBind = _unresolved_7.autoBind;
- }, function (_unresolved_8) {
- GunBase = _unresolved_8.GunBase;
- }, function (_unresolved_9) {
- ResUtil = _unresolved_9.ResUtil;
- }, function (_unresolved_10) {
- Game = _unresolved_10.Game;
- }, function (_unresolved_11) {
- MsgHints = _unresolved_11.default;
- }, function (_unresolved_12) {
- PlayerCamera = _unresolved_12.PlayerCamera;
- }],
- execute: function () {
- _crd = true;
- _cclegacy._RF.push({}, "2ff50wmAl5EppYKqh0ngPHz", "Player", undefined);
- __checkObsolete__(['_decorator', 'Node', 'SkeletalAnimation']);
- ({
- ccclass,
- property
- } = _decorator); //玩家动作类型
- _export("PAnimType", PAnimType = /*#__PURE__*/function (PAnimType) {
- PAnimType["idle"] = "idle";
- PAnimType["die"] = "die";
- PAnimType["reload"] = "reload";
- return PAnimType;
- }({}));
- _export("Player", Player = (_dec = ccclass('Player'), _dec2 = (_crd && autoBind === void 0 ? (_reportPossibleCrUseOfautoBind({
- error: Error()
- }), autoBind) : autoBind)({
- 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: SkeletalAnimation,
- tooltip: "玩家人物动画节点"
- }), _dec7 = (_crd && autoBind === void 0 ? (_reportPossibleCrUseOfautoBind({
- error: Error()
- }), autoBind) : autoBind)({
- type: _crd && PlayerCamera === void 0 ? (_reportPossibleCrUseOfPlayerCamera({
- error: Error()
- }), PlayerCamera) : PlayerCamera,
- tooltip: "玩家摄像机抖动控制"
- }), _dec(_class = (_class2 = class Player extends (_crd && BaseExp === void 0 ? (_reportPossibleCrUseOfBaseExp({
- error: Error()
- }), BaseExp) : BaseExp) {
- constructor() {
- super(...arguments);
- _initializerDefineProperty(this, "gun_pos", _descriptor, this);
- _initializerDefineProperty(this, "head", _descriptor2, this);
- _initializerDefineProperty(this, "ambush", _descriptor3, this);
- _initializerDefineProperty(this, "body", _descriptor4, this);
- _initializerDefineProperty(this, "player_skeletal", _descriptor5, this);
- _initializerDefineProperty(this, "mainCamera", _descriptor6, this);
- /**玩家的位置节点*/
- this.playPosNodes = [];
- /**玩家当前血量*/
- 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;
- //玩家打敌人爆头的个数
- this.headShotNum = 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.playPosNodes = this.node.parent.getChildByName('player_points').children).forEach(e => e.active = false); //隐藏的枪的位置节点
- this.gun_pos.children.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(PAnimType.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);
- var pos_ui = this.gun_pos.children.find(e => e.name == this.pData.prb_name);
- if (!pos_ui) {
- (_crd && MsgHints === void 0 ? (_reportPossibleCrUseOfMsgHints({
- error: Error()
- }), MsgHints) : MsgHints).show("未找到武器没有对应的位置节点");
- }
- pos_ui = pos_ui || this.gun_pos;
- if (pos_ui) {
- gunNode.worldPosition = pos_ui.worldPosition.clone();
- gunNode.eulerAngles = pos_ui.parent.eulerAngles.clone();
- gunNode.scale = pos_ui.scale.clone();
- }
- 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.player_skeletal.play(PAnimType.reload); //获取动画原始时长
- var clip = this.player_skeletal.clips.find(c => c.name === PAnimType.reload); //计算需要设置的速度
- clip.speed = clip.duration / time;
- this.shootUI.reloadMagazineing(time, () => {
- this.isReloadMagazine = false;
- this.shootUI.gunDataUI();
- this.player_skeletal.play(PAnimType.idle);
- });
- }
- /**
- * 玩家发射子弹
- */
- shoot() {
- if (!this.gun || this.isReloadMagazine) return;
- this.gun.fire();
- this.shootUI.crossHairStability();
- (_crd && Game === void 0 ? (_reportPossibleCrUseOfGame({
- error: Error()
- }), Game) : Game).I.player.mainCamera.shake(0.2, 0, 0.1);
- }
- /**
- * 随机切枪
- */
- 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.playerHurtTwinkle(progress); //敌人死亡
- 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.recycle();
- 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();
- }
- /**
- * 回收
- */
- recycle() {
- this.removeGun();
- this.isReloadMagazine = false;
- this.addPrecision = 0;
- this.addhp = 0;
- this.headShotNum = 0;
- }
- /**
- * 设置枪的数据
- */
- update(dt) {
- if (this.isCutShoot) {
- //设置玩家枪的信息
- if (this.shootUI && this.pData) {
- this.shootUI.gunDataUI();
- this.isCutShoot = false;
- }
- }
- }
- }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "gun_pos", [_dec2], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: function initializer() {
- return null;
- }
- }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "head", [_dec3], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: function initializer() {
- return null;
- }
- }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "ambush", [_dec4], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: function initializer() {
- return null;
- }
- }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "body", [_dec5], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: function initializer() {
- return null;
- }
- }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, "player_skeletal", [_dec6], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: function initializer() {
- return null;
- }
- }), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "mainCamera", [_dec7], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: function initializer() {
- return null;
- }
- })), _class2)) || _class));
- _cclegacy._RF.pop();
- _crd = false;
- }
- };
- });
- //# sourceMappingURL=7faea8489e2f0a7c6157dd3918e306f443925d26.js.map
|