|
@@ -28,6 +28,26 @@
|
28
|
28
|
return {top: offset.top + this.height() / 2, left: offset.left + this.width() / 2};
|
29
|
29
|
}
|
30
|
30
|
|
|
31
|
+ function updateDefenseUnits() {
|
|
32
|
+ var used = 0;
|
|
33
|
+
|
|
34
|
+ $.each(layout.towers, function() {
|
|
35
|
+ used += towers[this.type].units;
|
|
36
|
+ });
|
|
37
|
+
|
|
38
|
+ $('#du_used').text(used);
|
|
39
|
+
|
|
40
|
+ var hasClass = $('#du_wrapper').hasClass('over');
|
|
41
|
+
|
|
42
|
+ $('#du_wrapper').removeClass('over');
|
|
43
|
+ if (used > thisLevel.du) {
|
|
44
|
+ $('#du_wrapper').addClass('over');
|
|
45
|
+ if (!hasClass) {
|
|
46
|
+ $('#du_wrapper').effect('pulsate', {times: 2}, 'fast');
|
|
47
|
+ }
|
|
48
|
+ }
|
|
49
|
+ }
|
|
50
|
+
|
31
|
51
|
function getURLParameter(name) {
|
32
|
52
|
return decodeURIComponent((location.search.match(RegExp("[?|&]"+name+'=(.+?)(&|$)'))||[,null])[1]);
|
33
|
53
|
}
|
|
@@ -59,6 +79,7 @@
|
59
|
79
|
.dblclick(function() {
|
60
|
80
|
layout.towers = $.grep(layout.towers, function(value) { return value != tower; });
|
61
|
81
|
$(this).remove();
|
|
82
|
+ updateDefenseUnits();
|
62
|
83
|
})
|
63
|
84
|
.mousedown(function(e) {
|
64
|
85
|
if (!e.shiftKey) {
|
|
@@ -138,6 +159,7 @@
|
138
|
159
|
|
139
|
160
|
layout.towers.push(tower);
|
140
|
161
|
createElForTower(tower).appendTo($('#mapcontainer'));
|
|
162
|
+ updateDefenseUnits();
|
141
|
163
|
}
|
142
|
164
|
});
|
143
|
165
|
|
|
@@ -148,7 +170,10 @@
|
148
|
170
|
$('#notecontent').val(layout.notes);
|
149
|
171
|
$.each(layout.towers, function() {
|
150
|
172
|
createElForTower(this).appendTo($('#mapcontainer'));
|
|
173
|
+ updateDefenseUnits();
|
151
|
174
|
});
|
|
175
|
+
|
|
176
|
+ $('#du_total').text(thisLevel.du);
|
152
|
177
|
}
|
153
|
178
|
|
154
|
179
|
function getLayout(id) {
|
|
@@ -207,7 +232,7 @@
|
207
|
232
|
border-right: 1px solid rgb(244, 245, 242);
|
208
|
233
|
}
|
209
|
234
|
|
210
|
|
- #palette, #notes {
|
|
235
|
+ #sidebar > div {
|
211
|
236
|
text-align: center;
|
212
|
237
|
margin-bottom: 20px;
|
213
|
238
|
}
|
|
@@ -228,6 +253,11 @@
|
228
|
253
|
margin-top: 0;
|
229
|
254
|
}
|
230
|
255
|
|
|
256
|
+ #stats p {
|
|
257
|
+ margin: 0;
|
|
258
|
+ padding: 3px 0;
|
|
259
|
+ }
|
|
260
|
+
|
231
|
261
|
#mapcontainer {
|
232
|
262
|
position: relative;
|
233
|
263
|
width: 1024px;
|
|
@@ -235,6 +265,11 @@
|
235
|
265
|
margin-left: 221px;
|
236
|
266
|
}
|
237
|
267
|
|
|
268
|
+ #du_wrapper.over {
|
|
269
|
+ background-color: #600;
|
|
270
|
+ color: white;
|
|
271
|
+ }
|
|
272
|
+
|
238
|
273
|
.tower, .core { width: 40px; height: 40px; z-index: 100; }
|
239
|
274
|
</style>
|
240
|
275
|
</head>
|
|
@@ -247,6 +282,10 @@
|
247
|
282
|
<h2>Palette</h2>
|
248
|
283
|
<p>Drag and drop towers onto the map</p>
|
249
|
284
|
</div>
|
|
285
|
+ <div id="stats">
|
|
286
|
+ <h2>Stats</h2>
|
|
287
|
+ <p id="du_wrapper">Defense Units: <span id="du_used">0</span>/<span id="du_total">0</span></p>
|
|
288
|
+ </div>
|
250
|
289
|
<div id="notes">
|
251
|
290
|
<h2>Notes</h2>
|
252
|
291
|
<textarea id="notecontent"></textarea>
|