Skip to content

Commit 99e6e92

Browse files
committed
removed unnecessary underscore usage
1 parent c91e15e commit 99e6e92

File tree

3 files changed

+24
-26
lines changed

3 files changed

+24
-26
lines changed

src/clip/ComponentClip.js

+15-16
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,9 @@ export default class ComponentClip extends Phaser.GameObjects.Container {
192192
* @param {Boolean} [fromScene=false]
193193
*/
194194
destroy(fromScene) {
195-
_.each(this.childComponentClips, child => {
195+
for (let child of this.childComponentClips) {
196196
child.destroy(fromScene);
197-
}, this);
197+
}
198198
super.destroy(fromScene)
199199
}
200200

@@ -208,16 +208,16 @@ export default class ComponentClip extends Phaser.GameObjects.Container {
208208
* @ignore
209209
*/
210210
_createImagesMap(textures) {
211-
_.each(textures, (textureName) => {
211+
for (let textureName of textures) {
212212
const texture = this.scene.textures.get(textureName);
213213
if (!texture) {
214214
return;
215215
}
216216
const frames = texture.getFrameNames();
217-
_.each(frames, (frameName) => {
217+
for (let frameName of frames) {
218218
this.imageFramesMap[frameName] = textureName;
219-
}, this);
220-
}, this);
219+
}
220+
}
221221
}
222222

223223
/**
@@ -230,9 +230,9 @@ export default class ComponentClip extends Phaser.GameObjects.Container {
230230
_parseConfig() {
231231
//ComponentView._setupCommonParams(this, this._config);
232232
if (this._config.hasOwnProperty("children")) {
233-
_.each(this._config.children, (childConfig) => {
233+
for (let childConfig of this._config.children) {
234234
this._createChildFromConfig(childConfig);
235-
}, this);
235+
}
236236
}
237237
}
238238

@@ -263,10 +263,10 @@ export default class ComponentClip extends Phaser.GameObjects.Container {
263263
child = this._createPolygonFromConfig(config);
264264
if (config.hasOwnProperty("masking")) {
265265
let mask = child.createGeometryMask();
266-
_.each(config.masking, (maskedChildId) => {
266+
for (let maskedChildId of config.masking) {
267267
let maskedChild = this._childrenById[maskedChildId];
268268
maskedChild.setMask(mask);
269-
}, this);
269+
}
270270
addAsChild = false;
271271
}
272272
}
@@ -599,15 +599,14 @@ class StateManager {
599599
setupState() {
600600
let idsToShow = this._currentState.componentIds;
601601
let idsToHide = _.difference(this._dynamicChildrenIds, idsToShow);
602-
603-
_.each(idsToHide, (id) => {
602+
let id;
603+
for (id of idsToHide) {
604604
this._components[id].visible = false;
605-
}, this);
606-
607-
_.each(idsToShow, (id) => {
605+
}
606+
for (id of idsToShow) {
608607
let component = this._components[id];
609608
component.visible = true;
610609
ComponentClip._setupCommonParams(component, this._currentState.config[id]);
611-
}, this);
610+
}
612611
}
613612
}

src/components/UIContainer.js

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import UIComponentPrototype from "./UIComponentPrototype";
22
import 'phaser';
3-
import _ from 'underscore';
43

54
/**
65
* @memberOf PhaserComps.UIComponents
@@ -99,30 +98,30 @@ export default class UIContainer extends UIComponentPrototype {
9998
onClipAppend(clip) {
10099
super.onClipAppend(clip);
101100
if (clip) {
102-
_.each(this._children, child => {
101+
for (let child of this._children) {
103102
this._addUIComponentToContainerClip(child);
104-
}, this);
103+
}
105104
}
106105
}
107106

108107
onClipRemove(clip) {
109108
super.onClipRemove(clip);
110109
// hide and remove children from current container
111110
if (clip) {
112-
_.each(this._children, child => {
111+
for (let child of this._children) {
113112
this._removeUIComponentFromContainerClip(child);
114-
}, this);
113+
}
115114
}
116115
}
117116

118117
destroy() {
119118
// remove and destroy children
120-
_.each(this._children, child => {
119+
for (let child of this._children) {
121120
if (this._clip) { // TODO check if needed
122121
this._removeUIComponentFromContainerClip(child);
123122
}
124123
child.destroy();
125-
}, this);
124+
}
126125
this._children.length = 0;
127126
super.destroy();
128127
}

src/components/UIProgressBar.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ export default class UIProgressBar extends UIComponentPrototype {
131131
_makeSteps(clip) {
132132
let stateIds = clip.getStateIds();
133133
this._steps = [];
134-
_.each(stateIds, (stateId) => {
134+
for (let stateId of stateIds) {
135135
if (!PROGRESS_STATE_REGEX.test(stateId)) {
136-
return;
136+
continue;
137137
}
138138

139139
let stepConfig = {};
@@ -146,7 +146,7 @@ export default class UIProgressBar extends UIComponentPrototype {
146146
stepConfig[childId] = UIProgressBar._makeFullConfig(stateConfig[childId]);
147147
}
148148
this._steps.push(stepObject);
149-
}, this);
149+
}
150150
_.sortBy(this._steps, "stepValue");
151151
}
152152

0 commit comments

Comments
 (0)