Add missing Hyper Mode pieces

Some code was missing from the Hyper Mode feature addition. This
completes the use of `Engine.setTimeout` and adds doubleTime check in
button cooldowns.

Closes #374
This commit is contained in:
Blake Grotewold
2015-05-10 18:14:13 -04:00
parent 9cb94cb9c0
commit 7fd474d3c0
3 changed files with 20 additions and 15 deletions
+6 -1
View File
@@ -64,7 +64,12 @@ var Button = {
cooldown: function(btn) {
var cd = btn.data("cooldown");
if(cd > 0) {
$('div.cooldown', btn).stop(true, true).width("100%").animate({width: '0%'}, cd * 1000, 'linear', function() {
milliseconds = cd * 1000;
if (Engine.options.doubleTime){
milliseconds /= 2;
}
$('div.cooldown', btn).stop(true, true).width("100%").animate({width: '0%'}, milliseconds, 'linear', function() {
var b = $(this).closest('.button');
b.data('onCooldown', false);
if(!b.data('disabled')) {
+2 -2
View File
@@ -121,7 +121,7 @@
onChoose: function () {
DropboxConnector.log('Save to slot ' + n + ' initiated');
// timeout prevents error due to fade out animation of the previous event
window.setTimeout(function () {
Engine.setTimeout(function () {
DropboxConnector.log('Save to slot ' + n);
DropboxConnector.saveGameToDropbox(n, DropboxConnector.savedtoDropboxEvent);
}, 1000);
@@ -150,7 +150,7 @@
onChoose: function () {
DropboxConnector.log('Load from slot ' + n + ' initiated');
// timeout prevents error due to fade out animation of the previous event
window.setTimeout(function () {
Engine.setTimeout(function () {
DropboxConnector.log('Load from slot ' + n);
DropboxConnector.loadGameFromDropbox(n);
}, 1000);
+1 -1
View File
@@ -371,7 +371,7 @@ var StateManager = {
if(changed){
$SM.fireUpdate('income', true);
}
Engine._incomeTimeout = setTimeout($SM.collectIncome, 1000);
Engine._incomeTimeout = Engine.setTimeout($SM.collectIncome, 1000);
},
//Thieves