-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
113 lines (97 loc) · 3.7 KB
/
index.js
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
// Generated by CoffeeScript 1.10.0
(function() {
var COLOR_LENGTH, COLOR_OFF, COLOR_ON, KEYS, KEYS_LONG, Phaser, _areaRect, _lengthRect, _totalRect, emitterColor, isArray, stringValueForKey;
Phaser = this.Phaser;
isArray = Array.isArray;
COLOR_LENGTH = 'rgba(127,127,127,0.4)';
COLOR_OFF = 'rgba(255,0,0,0.4)';
COLOR_ON = 'rgba(0,255,0,0.4)';
KEYS = ["area", "emitX", "emitY", "exists", "frequency", "length", "lifespan", "maxParticles", "name", "on", "total", "visible", "_counter", "_explode", "_flowQuantity", "_flowTotal", "_frames", "_id", "_quantity", "_timer"];
KEYS_LONG = ["alive", "alphaData", "angularDrag", "area", "autoAlpha", "autoScale", "bounce", "emitX", "emitY", "exists", "frequency", "gravity", "lifespan", "maxParticleAlpha", "maxParticles", "maxParticleScale", "maxParticleSpeed", "maxRotation", "minParticleAlpha", "minParticleScale", "minParticleSpeed", "minRotation", "name", "on", "particleAnchor", "particleBringToTop", "particleClass", "particleDrag", "particleSendToBack", "scaleData", "visible", "_counter", "_explode", "_flowQuantity", "_flowTotal", "_frames", "_id", "_maxParticleScale", "_minParticleScale", "_quantity", "_timer"];
emitterColor = function(emitter) {
if (emitter.on) {
return COLOR_ON;
} else {
return COLOR_OFF;
}
};
stringValueForKey = function(key, emitter) {
var ref, typ, val;
val = emitter[key];
typ = typeof val;
switch (false) {
case !isArray(val):
return "(" + val.length + ")";
case typ !== "number":
if (val % 1) {
return val.toFixed(1);
} else {
return val;
}
case !(typ === "object" && (val != null ? (ref = val.constructor) != null ? ref.name : void 0 : void 0)):
return val.constructor.name;
case typeof val !== "function":
return "[Function]";
case !(val != null ? val.toString : void 0):
return val.toString();
}
return val;
};
_areaRect = new Phaser.Rectangle;
Phaser.Utils.Debug.prototype.emitter = function(emitter, color, filled) {
var debug;
if (filled == null) {
filled = true;
}
debug = this.game.debug;
if (color == null) {
color = emitterColor(emitter);
}
if (emitter.width > 1 || emitter.height > 1) {
_areaRect.setTo(emitter.left, emitter.top, emitter.width, emitter.height);
debug.geom(_areaRect, color, filled);
}
debug.pixel(emitter.emitX, emitter.emitY, color);
};
Phaser.Utils.Debug.prototype.emitterInfo = function(emitter, x, y, color, long) {
var debug, i, key, len, ref;
if (long == null) {
long = false;
}
debug = this.game.debug;
debug.start(x, y, color);
debug.line(emitter.name);
ref = (long ? KEYS_LONG : KEYS);
for (i = 0, len = ref.length; i < len; i++) {
key = ref[i];
debug.line(key + ": " + (stringValueForKey(key, emitter)));
}
debug.stop();
};
_lengthRect = new Phaser.Rectangle;
_totalRect = new Phaser.Rectangle;
Phaser.Utils.Debug.prototype.emitterTotal = function(emitter, x, y, width, height, color, label) {
var debug, length, total;
if (width == null) {
width = 100;
}
if (height == null) {
height = 10;
}
if (label == null) {
label = emitter.name;
}
debug = this.game.debug;
length = emitter.length, total = emitter.total;
if (color == null) {
color = emitterColor(emitter);
}
_lengthRect.setTo(x, y, ~~width, height);
debug.geom(_lengthRect, COLOR_LENGTH);
_totalRect.setTo(x, y, ~~(width * total / length), height);
debug.geom(_totalRect, color);
if (label) {
debug.text(label, x, y + ~~(debug.lineHeight / 2), null, debug.font);
}
};
}).call(this);