b75a0e27-fe5d-43c1-86b8-b6d7742683a6.js
8.46 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
"use strict";
cc._RF.push(module, 'b75a04n/l1DwYa4ttd0JoOm', 'MapView');
// scripts/kernel/battle/map/MapView.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.MapView = void 0;
var SaveDataManager_1 = require("../../../component/SaveDataManager");
var Global_1 = require("../../../Global");
var ObjBaseView_1 = require("../../../prefabs/ObjBaseView");
var TableDefine_1 = require("../../table/TableDefine");
var BattleConst_1 = require("../BattleConst");
var RectBlockData_1 = require("./RectBlockData");
var MapView = /** @class */ (function (_super) {
__extends(MapView, _super);
function MapView() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this._rectBlcokUidList = [];
return _this;
}
Object.defineProperty(MapView.prototype, "colliderLayer", {
get: function () { return this._colliderLayer; },
enumerable: false,
configurable: true
});
Object.defineProperty(MapView.prototype, "blockImgLayer", {
/**砖块图层 */
get: function () { return this._blockImgLayer; },
enumerable: false,
configurable: true
});
Object.defineProperty(MapView.prototype, "blockIconLayer", {
/**砖块的图标图层 */
get: function () { return this._blockIconLayer; },
enumerable: false,
configurable: true
});
Object.defineProperty(MapView.prototype, "effectLayer", {
/**砖块的效果特效图层 */
get: function () { return this._effectLayer; },
enumerable: false,
configurable: true
});
Object.defineProperty(MapView.prototype, "lightLayer", {
/**砖块的高亮图层 */
get: function () { return this._lightLayer; },
enumerable: false,
configurable: true
});
Object.defineProperty(MapView.prototype, "txtLayer", {
/**数字图层 */
get: function () { return this._txtLayer; },
enumerable: false,
configurable: true
});
Object.defineProperty(MapView.prototype, "txtUpLayer", {
/** 遮住数字的图层*/
get: function () { return this._txtUpLayer; },
enumerable: false,
configurable: true
});
Object.defineProperty(MapView.prototype, "ballLayer", {
/**弹球 */
get: function () { return this._ballLayer; },
enumerable: false,
configurable: true
});
Object.defineProperty(MapView.prototype, "prefabCollection", {
get: function () { return this._prefabCollection; },
enumerable: false,
configurable: true
});
Object.defineProperty(MapView.prototype, "testBall", {
get: function () { return this._testBall; },
enumerable: false,
configurable: true
});
MapView.prototype.init = function (data, prefabCollection, preview) {
var _this = this;
this._mapData = data;
this._prefabCollection = prefabCollection;
var height = data.mapGridSize.y * data.gridSize.y;
this.setContentSize(data.mapGridSize.x * data.gridSize.x, height);
this._colliderLayer = this.createLayer('colliderLayer');
this.addChild(this._colliderLayer);
this._blockImgLayer = this.createLayer('blockImgLayer');
this.addChild(this._blockImgLayer);
this._blockIconLayer = this.createLayer('blockIconLayer');
this.addChild(this._blockIconLayer);
this._effectLayer = this.createLayer('effectLayer');
this.addChild(this._effectLayer);
this._lightLayer = this.createLayer('lightLayer');
this.addChild(this._lightLayer);
this._txtLayer = this.createLayer('txtLayer');
this.addChild(this._txtLayer);
this._txtUpLayer = this.createLayer('txtUpLayer');
this.addChild(this._txtUpLayer);
this._ballLayer = this.createLayer('ballLayer');
this.addChild(this._ballLayer);
var foo;
var cmpt;
data.objData.forEach(function (obj, index, map) {
foo = null;
if (obj.type == BattleConst_1.ObjType.PLUS_ONE || obj.type == BattleConst_1.ObjType.SPLITER) {
foo = cc.instantiate(prefabCollection.getChildByName('dotSkill'));
}
else if (obj.type >= BattleConst_1.ObjType.LANCER_1 && obj.type <= BattleConst_1.ObjType.LANCER_3) {
foo = cc.instantiate(prefabCollection.getChildByName('laser'));
}
else if (obj.type == BattleConst_1.ObjType.BIG_BOMB || obj.type == BattleConst_1.ObjType.BIG_BOMB_33) {
foo = cc.instantiate(prefabCollection.getChildByName('bigBomb'));
;
}
else if (obj.type == BattleConst_1.ObjType.TRANGLE_1 || obj.type == BattleConst_1.ObjType.TRANGLE_2 || obj.type == BattleConst_1.ObjType.TRANGLE_3 || obj.type == BattleConst_1.ObjType.TRANGLE_4) {
var fff = obj.type - 2;
foo = cc.instantiate(prefabCollection.getChildByName('trangleBlock' + fff.toString()));
}
else if (obj.type == BattleConst_1.ObjType.POT) {
foo = cc.instantiate(prefabCollection.getChildByName('pot'));
}
else if (obj.type == BattleConst_1.ObjType.ROTATER) {
foo = cc.instantiate(prefabCollection.getChildByName('rotater'));
}
else if (obj.type == BattleConst_1.ObjType.STATIC_IRON) {
foo = cc.instantiate(prefabCollection.getChildByName('staticNail'));
}
else if (obj.type == BattleConst_1.ObjType.PATROL) {
foo = cc.instantiate(prefabCollection.getChildByName('patrol'));
}
else {
if (obj instanceof RectBlockData_1.RectBlockData) {
if (!_this._rectBlcokUidList.includes(obj.uid)) {
_this._rectBlcokUidList.push(obj.uid);
foo = cc.instantiate(prefabCollection.getChildByName('rectBlock'));
;
}
}
else {
foo = cc.instantiate(prefabCollection.getChildByName('block'));
;
}
}
if (foo) {
var cmpt_1 = foo.getComponent(ObjBaseView_1.default);
cmpt_1.init(obj, _this);
preview && cmpt_1.onPreview();
}
}, this);
this._testBall = cc.instantiate(prefabCollection.getChildByName('testBall'));
this._ballLayer.addChild(this._testBall);
};
MapView.prototype.createLayer = function (name) {
var layer = new cc.Node(name);
layer.setContentSize(this._mapData.mapGridSize.x * this._mapData.gridSize.x, this._mapData.mapGridSize.y * this._mapData.gridSize.y);
return layer;
};
MapView.prototype.playBlockParticle = function (node) {
var parPrefab = this._prefabCollection.getChildByName('parBlockBoom');
var par = cc.instantiate(parPrefab);
par.setPosition(node.position);
par.active = false;
var skinId = SaveDataManager_1.SaveDataManager.ins.runtimeData.ballSkinCurrent;
SaveDataManager_1.SaveDataManager.ins.runtimeData.ballSkinTry > 0 && (skinId = SaveDataManager_1.SaveDataManager.ins.runtimeData.ballSkinTry);
var ballSkin = Global_1.tMgr.getConfig(TableDefine_1.TableName.BALL_SKIN, skinId);
cc.resources.load('battle/' + ballSkin.Particle, cc.SpriteFrame, function (error, asset) {
if (!error) {
par.active = true;
par.getComponent(cc.ParticleSystem).custom = true;
par.getComponent(cc.ParticleSystem).spriteFrame = asset;
par.getComponent(cc.ParticleSystem).resetSystem();
}
});
// par.getComponent(cc.ParticleSystem).resetSystem();
this._effectLayer.addChild(par);
};
return MapView;
}(cc.Node));
exports.MapView = MapView;
cc._RF.pop();