mirror of
https://github.com/doublespeakgames/adarkroom.git
synced 2026-06-30 00:02:29 +08:00
Add variable for blink interval and remove unnecessary type checking
Cleans up global variable that was introduced in favor of a variable in Events. Removes type checking from conditionals and instead sets BLINK_INTERVAL variable to false when stopped.
This commit is contained in:
+11
-7
@@ -9,6 +9,7 @@ var Events = {
|
|||||||
_EAT_COOLDOWN: 5,
|
_EAT_COOLDOWN: 5,
|
||||||
_MEDS_COOLDOWN: 7,
|
_MEDS_COOLDOWN: 7,
|
||||||
STUN_DURATION: 4000,
|
STUN_DURATION: 4000,
|
||||||
|
BLINK_INTERVAL: false,
|
||||||
|
|
||||||
init: function(options) {
|
init: function(options) {
|
||||||
this.options = $.extend(
|
this.options = $.extend(
|
||||||
@@ -727,17 +728,20 @@ var Events = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//blinks the browser window title
|
// blinks the browser window title
|
||||||
blinkTitle: function() {
|
blinkTitle: function() {
|
||||||
var title = document.title;
|
var title = document.title;
|
||||||
blinkInterval = setInterval(function() {
|
|
||||||
document.title = '*** EVENT ***';
|
// every 3 seconds change title to '*** EVENT ***', then 1.5 seconds later, change it back to the original title.
|
||||||
setTimeout(function() {document.title = title;}, 1500);
|
Events.BLINK_INTERVAL = setInterval(function() {
|
||||||
|
document.title = _('*** EVENT ***');
|
||||||
|
setTimeout(function() {document.title = title;}, 1500);
|
||||||
}, 3000);
|
}, 3000);
|
||||||
},
|
},
|
||||||
|
|
||||||
stopTitleBlink: function() {
|
stopTitleBlink: function() {
|
||||||
clearInterval(blinkInterval);
|
clearInterval(Events.BLINK_INTERVAL);
|
||||||
|
Events.BLINK_INTERVAL = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Makes an event happen!
|
// Makes an event happen!
|
||||||
@@ -803,7 +807,7 @@ var Events = {
|
|||||||
$('div#wrapper').append(Events.eventPanel());
|
$('div#wrapper').append(Events.eventPanel());
|
||||||
Events.eventPanel().animate({opacity: 1}, Events._PANEL_FADE, 'linear');
|
Events.eventPanel().animate({opacity: 1}, Events._PANEL_FADE, 'linear');
|
||||||
var currentSceneInformation = Events.activeEvent().scenes[Events.activeScene];
|
var currentSceneInformation = Events.activeEvent().scenes[Events.activeScene];
|
||||||
if (typeof currentSceneInformation.blink == 'boolean' && currentSceneInformation.blink == true) {
|
if (currentSceneInformation.blink) {
|
||||||
Events.blinkTitle();
|
Events.blinkTitle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -823,7 +827,7 @@ var Events = {
|
|||||||
Events.eventStack.shift();
|
Events.eventStack.shift();
|
||||||
Engine.log(Events.eventStack.length + ' events remaining');
|
Engine.log(Events.eventStack.length + ' events remaining');
|
||||||
Engine.keyLock = false;
|
Engine.keyLock = false;
|
||||||
if (typeof blinkInterval != 'undefined') {
|
if (Events.BLINK_INTERVAL) {
|
||||||
Events.stopTitleBlink();
|
Events.stopTitleBlink();
|
||||||
}
|
}
|
||||||
// Force refocus on the body. I hate you, IE.
|
// Force refocus on the body. I hate you, IE.
|
||||||
|
|||||||
Reference in New Issue
Block a user