f33c71a8-ea5e-431d-8561-77f1cafbe968.js
3.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
"use strict";
cc._RF.push(module, 'f33c7Go6l5DHYVhd/HK++lo', 'BattleManager');
// scripts/kernel/battle/BattleManager.ts
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.BattleManager = void 0;
var SaveDataManager_1 = require("../../component/SaveDataManager");
var Battle_1 = require("./Battle");
var BattleConst_1 = require("./BattleConst");
var BattleManager = /** @class */ (function (_super) {
__extends(BattleManager, _super);
function BattleManager() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this._eventNode = new cc.Node("battleManagerEventNode");
_this._paused = false;
/**是否可以滑动控制发射指示器 */
_this.shootTouchEnable = false;
return _this;
}
Object.defineProperty(BattleManager, "ins", {
get: function () {
if (this._ins == null) {
this._ins = BattleConst_1.getGlobalNode().addComponent(BattleManager);
BattleConst_1.getGlobalNode().addChild(this._ins.eventNode);
// this._ins.eventNode.event
}
return this._ins;
},
enumerable: false,
configurable: true
});
Object.defineProperty(BattleManager.prototype, "curBattle", {
get: function () { return this._curBattle; },
enumerable: false,
configurable: true
});
Object.defineProperty(BattleManager.prototype, "eventNode", {
/**事件节点,BattleEvent的派发和监听都在此节点进行 */
get: function () { return this._eventNode; },
enumerable: false,
configurable: true
});
Object.defineProperty(BattleManager.prototype, "paused", {
get: function () { return this._paused; },
set: function (value) {
this._paused = value;
if (this.curBattle && this.curBattle.roundRunning) {
// PhysicsControl.ins.setPhysicsEnable(!value);
}
},
enumerable: false,
configurable: true
});
// private _prefabCollection:cc.Prefab
BattleManager.prototype.startBattle = function (levelId, callBack, thisObj, prefab) {
this.shootTouchEnable = false;
this._paused = false;
if (this.curBattle) {
//销毁
this._curBattle.destroy();
this._curBattle = null;
}
this._curBattle = new Battle_1.Battle();
this._curBattle.init(levelId, function () {
callBack.call(thisObj);
}, this, prefab);
this.eventNode.emit(BattleConst_1.BattleEvent.BATTLE_START);
};
/**直接离开战斗,不会触发战斗结算 */
BattleManager.prototype.leaveBattle = function () {
//#region 恢复试用数据
SaveDataManager_1.SaveDataManager.ins.runtimeData.ballSkinTry = 0;
SaveDataManager_1.SaveDataManager.ins.runtimeData.goldenAimTry = false;
SaveDataManager_1.SaveDataManager.ins.saveData();
//#endregion
this._curBattle.destroy();
this._curBattle = null;
};
BattleManager.prototype.update = function (dt) {
// super.update(dt);
if (this._curBattle && !this._paused) {
this._curBattle.update(dt);
}
};
return BattleManager;
}(cc.Component));
exports.BattleManager = BattleManager;
cc._RF.pop();