Merge branch 'title-blink'

This commit is contained in:
Michael Townsend
2014-07-29 18:24:20 -04:00
4 changed files with 44 additions and 3 deletions
+24
View File
@@ -10,6 +10,7 @@ var Events = {
_MEDS_COOLDOWN: 7, _MEDS_COOLDOWN: 7,
_LEAVE_COOLDOWN: 1, _LEAVE_COOLDOWN: 1,
STUN_DURATION: 4000, STUN_DURATION: 4000,
BLINK_INTERVAL: false,
init: function(options) { init: function(options) {
this.options = $.extend( this.options = $.extend(
@@ -732,6 +733,22 @@ var Events = {
} }
} }
}, },
// blinks the browser window title
blinkTitle: function() {
var title = document.title;
// every 3 seconds change title to '*** EVENT ***', then 1.5 seconds later, change it back to the original title.
Events.BLINK_INTERVAL = setInterval(function() {
document.title = _('*** EVENT ***');
setTimeout(function() {document.title = title;}, 1500);
}, 3000);
},
stopTitleBlink: function() {
clearInterval(Events.BLINK_INTERVAL);
Events.BLINK_INTERVAL = false;
},
// Makes an event happen! // Makes an event happen!
triggerEvent: function() { triggerEvent: function() {
@@ -795,6 +812,10 @@ var Events = {
Events.loadScene('start'); Events.loadScene('start');
$('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];
if (currentSceneInformation.blink) {
Events.blinkTitle();
}
} }
}, },
@@ -812,6 +833,9 @@ 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 (Events.BLINK_INTERVAL) {
Events.stopTitleBlink();
}
// Force refocus on the body. I hate you, IE. // Force refocus on the body. I hate you, IE.
$('body').focus(); $('body').focus();
}); });
+1
View File
@@ -15,6 +15,7 @@ Events.Global = [
_('say he should be strung up as an example.') _('say he should be strung up as an example.')
], ],
notification: _('a thief is caught'), notification: _('a thief is caught'),
blink: true,
buttons: { buttons: {
'kill': { 'kill': {
text: _('hang him'), text: _('hang him'),
+10 -3
View File
@@ -20,6 +20,7 @@ Events.Outside = [
Outside.updateTrapButton(); Outside.updateTrapButton();
}, },
notification: _('some traps have been destroyed'), notification: _('some traps have been destroyed'),
blink: true,
buttons: { buttons: {
'track': { 'track': {
text: _('track them'), text: _('track them'),
@@ -74,6 +75,8 @@ Events.Outside = [
_('a sickness is spreading through the village.'), _('a sickness is spreading through the village.'),
_('medicine is needed immediately.') _('medicine is needed immediately.')
], ],
blink: true,
buttons: { buttons: {
'heal': { 'heal': {
text: _('1 medicine'), text: _('1 medicine'),
@@ -128,6 +131,7 @@ Events.Outside = [
_('a terrible plague is fast spreading through the village.'), _('a terrible plague is fast spreading through the village.'),
_('medicine is needed immediately.') _('medicine is needed immediately.')
], ],
blink: true,
buttons: { buttons: {
'heal': { 'heal': {
text: _('5 medicine'), text: _('5 medicine'),
@@ -193,12 +197,13 @@ Events.Outside = [
var numKilled = Math.floor(Math.random() * 10) + 1; var numKilled = Math.floor(Math.random() * 10) + 1;
Outside.killVillagers(numKilled); Outside.killVillagers(numKilled);
}, },
reward: { reward: {
fur: 100, fur: 100,
meat: 100, meat: 100,
teeth: 10 teeth: 10
}, },
buttons: { blink: true,
buttons: {
'end': { 'end': {
text: _('go home'), text: _('go home'),
nextScene: 'end' nextScene: 'end'
@@ -228,6 +233,8 @@ Events.Outside = [
bullets: 10, bullets: 10,
'cured meat': 50 'cured meat': 50
}, },
blink: true,
buttons: { buttons: {
'end': { 'end': {
text: _('go home'), text: _('go home'),
+9
View File
@@ -14,6 +14,7 @@ Events.Room = [
_("won't say from where he came, but it's clear that he's not staying.") _("won't say from where he came, but it's clear that he's not staying.")
], ],
notification: _('a nomad arrives, looking to trade'), notification: _('a nomad arrives, looking to trade'),
blink: true,
buttons: { buttons: {
'buyScales': { 'buyScales': {
text: _('buy scales'), text: _('buy scales'),
@@ -60,6 +61,7 @@ Events.Room = [
_("can't tell what they're up to.") _("can't tell what they're up to.")
], ],
notification: _('strange noises can be heard through the walls'), notification: _('strange noises can be heard through the walls'),
blink: true,
buttons: { buttons: {
'investigate': { 'investigate': {
text: _('investigate'), text: _('investigate'),
@@ -110,6 +112,7 @@ Events.Room = [
_('something\'s in there.') _('something\'s in there.')
], ],
notification: _('something\'s in the store room'), notification: _('something\'s in the store room'),
blink: true,
buttons: { buttons: {
'investigate': { 'investigate': {
text: _('investigate'), text: _('investigate'),
@@ -195,6 +198,7 @@ Events.Room = [
_('asks for any spare furs to keep him warm at night.') _('asks for any spare furs to keep him warm at night.')
], ],
notification: _('a beggar arrives'), notification: _('a beggar arrives'),
blink: true,
buttons: { buttons: {
'50furs': { '50furs': {
text: _('give 50'), text: _('give 50'),
@@ -266,6 +270,7 @@ Events.Room = [
_("builder's not sure he's to be trusted.") _("builder's not sure he's to be trusted.")
], ],
notification: _('a mysterious wanderer arrives'), notification: _('a mysterious wanderer arrives'),
blink: true,
buttons: { buttons: {
'100wood': { '100wood': {
text: _('give 100'), text: _('give 100'),
@@ -336,6 +341,7 @@ Events.Room = [
_("builder's not sure she's to be trusted.") _("builder's not sure she's to be trusted.")
], ],
notification: _('a mysterious wanderer arrives'), notification: _('a mysterious wanderer arrives'),
blink: true,
buttons: { buttons: {
'100fur': { '100fur': {
text: _('give 100'), text: _('give 100'),
@@ -406,6 +412,7 @@ Events.Room = [
_("willing to talk about it, for a price.") _("willing to talk about it, for a price.")
], ],
notification: _('a scout stops for the night'), notification: _('a scout stops for the night'),
blink: true,
buttons: { buttons: {
'buyMap': { 'buyMap': {
text: _('buy map'), text: _('buy map'),
@@ -444,6 +451,7 @@ Events.Room = [
_('he smiles warmly and asks for lodgings for the night.') _('he smiles warmly and asks for lodgings for the night.')
], ],
notification: _('an old wanderer arrives'), notification: _('an old wanderer arrives'),
blink: true,
buttons: { buttons: {
'agree': { 'agree': {
text: _('agree'), text: _('agree'),
@@ -516,6 +524,7 @@ Events.Room = [
_("he begs for medicine.") _("he begs for medicine.")
], ],
notification: _('a sick man hobbles up'), notification: _('a sick man hobbles up'),
blink: true,
buttons: { buttons: {
'help': { 'help': {
text: _('give 1 medicine'), text: _('give 1 medicine'),