mirror of
https://github.com/doublespeakgames/adarkroom.git
synced 2026-06-09 14:07:14 +08:00
Hyper mode and LightsOff is now stored in the State
This commit is contained in:
committed by
Blake Grotewold
parent
f85b8fdf7e
commit
8320156f42
+37
-22
@@ -140,15 +140,9 @@
|
|||||||
.appendTo(menu);
|
.appendTo(menu);
|
||||||
|
|
||||||
$('<span>')
|
$('<span>')
|
||||||
.addClass('menuBtn')
|
.addClass('hyper menuBtn')
|
||||||
.text(_('hyper.'))
|
.text(_('hyper.'))
|
||||||
.click(function(){
|
.click(Engine.triggerHyperMode)
|
||||||
Engine.options.doubleTime = !Engine.options.doubleTime;
|
|
||||||
if(Engine.options.doubleTime)
|
|
||||||
$(this).text(_('classic.'));
|
|
||||||
else
|
|
||||||
$(this).text(_('hyper.'));
|
|
||||||
})
|
|
||||||
.appendTo(menu);
|
.appendTo(menu);
|
||||||
|
|
||||||
$('<span>')
|
$('<span>')
|
||||||
@@ -220,6 +214,14 @@
|
|||||||
Ship.init();
|
Ship.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($SM.get('config.lightsOff', true)){
|
||||||
|
Engine.turnLightsOff();
|
||||||
|
}
|
||||||
|
|
||||||
|
if($SM.get('config.hyperMode', true)){
|
||||||
|
Engine.triggerHyperMode();
|
||||||
|
}
|
||||||
|
|
||||||
Engine.saveLanguage();
|
Engine.saveLanguage();
|
||||||
Engine.travelTo(Room);
|
Engine.travelTo(Room);
|
||||||
|
|
||||||
@@ -476,16 +478,29 @@
|
|||||||
if (darkCss == null) {
|
if (darkCss == null) {
|
||||||
$('head').append('<link rel="stylesheet" href="css/dark.css" type="text/css" title="darkenLights" />');
|
$('head').append('<link rel="stylesheet" href="css/dark.css" type="text/css" title="darkenLights" />');
|
||||||
$('.lightsOff').text(_('lights on.'));
|
$('.lightsOff').text(_('lights on.'));
|
||||||
|
$SM.set('config.lightsOff', true, true);
|
||||||
} else if (darkCss.disabled) {
|
} else if (darkCss.disabled) {
|
||||||
darkCss.disabled = false;
|
darkCss.disabled = false;
|
||||||
$('.lightsOff').text(_('lights on.'));
|
$('.lightsOff').text(_('lights on.'));
|
||||||
|
$SM.set('config.lightsOff', true,true);
|
||||||
} else {
|
} else {
|
||||||
$("#darkenLights").attr("disabled", "disabled");
|
$("#darkenLights").attr("disabled", "disabled");
|
||||||
darkCss.disabled = true;
|
darkCss.disabled = true;
|
||||||
$('.lightsOff').text(_('lights off.'));
|
$('.lightsOff').text(_('lights off.'));
|
||||||
|
$SM.set('config.lightsOff', false, true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
triggerHyperMode: function(){
|
||||||
|
Engine.options.doubleTime = !Engine.options.doubleTime;
|
||||||
|
if(Engine.options.doubleTime)
|
||||||
|
$('.hyper').text(_('classic.'));
|
||||||
|
else
|
||||||
|
$('.hyper').text(_('hyper.'));
|
||||||
|
|
||||||
|
$SM.set('config.hyperMode', Engine.options.doubleTime, false);
|
||||||
|
},
|
||||||
|
|
||||||
// Gets a guid
|
// Gets a guid
|
||||||
getGuid: function() {
|
getGuid: function() {
|
||||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
||||||
@@ -732,27 +747,27 @@
|
|||||||
|
|
||||||
function inView(dir, elem){
|
function inView(dir, elem){
|
||||||
|
|
||||||
var scTop = $('#main').offset().top;
|
var scTop = $('#main').offset().top;
|
||||||
var scBot = scTop + $('#main').height();
|
var scBot = scTop + $('#main').height();
|
||||||
|
|
||||||
var elTop = elem.offset().top;
|
var elTop = elem.offset().top;
|
||||||
var elBot = elTop + elem.height();
|
var elBot = elTop + elem.height();
|
||||||
|
|
||||||
if( dir == 'up' ){
|
if( dir == 'up' ){
|
||||||
// STOP MOVING IF BOTTOM OF ELEMENT IS VISIBLE IN SCREEN
|
// STOP MOVING IF BOTTOM OF ELEMENT IS VISIBLE IN SCREEN
|
||||||
return ( elBot < scBot );
|
return ( elBot < scBot );
|
||||||
}else if( dir == 'down' ){
|
}else if( dir == 'down' ){
|
||||||
return ( elTop > scTop );
|
return ( elTop > scTop );
|
||||||
}else{
|
}else{
|
||||||
return ( ( elBot <= scBot ) && ( elTop >= scTop ) );
|
return ( ( elBot <= scBot ) && ( elTop >= scTop ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function scrollByX(elem, x){
|
function scrollByX(elem, x){
|
||||||
|
|
||||||
var elTop = parseInt( elem.css('top'), 10 );
|
var elTop = parseInt( elem.css('top'), 10 );
|
||||||
elem.css( 'top', ( elTop + x ) + "px" );
|
elem.css( 'top', ( elTop + x ) + "px" );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+16
-15
@@ -28,15 +28,16 @@ var StateManager = {
|
|||||||
|
|
||||||
//create categories
|
//create categories
|
||||||
var cats = [
|
var cats = [
|
||||||
'features', //big features like buildings, location availability, unlocks, etc
|
'features', //big features like buildings, location availability, unlocks, etc
|
||||||
'stores', //little stuff, items, weapons, etc
|
'stores', //little stuff, items, weapons, etc
|
||||||
'character', //this is for player's character stats such as perks
|
'character', //this is for player's character stats such as perks
|
||||||
'income',
|
'income',
|
||||||
'timers',
|
'timers',
|
||||||
'game', //mostly location related: fire temp, workers, population, world map, etc
|
'game', //mostly location related: fire temp, workers, population, world map, etc
|
||||||
'playStats', //anything play related: play time, loads, etc
|
'playStats', //anything play related: play time, loads, etc
|
||||||
'previous', // prestige, score, trophies (in future), achievements (again, not yet), etc
|
'previous', // prestige, score, trophies (in future), achievements (again, not yet), etc
|
||||||
'outfit' // used to temporarily store the items to be taken on the path
|
'outfit', // used to temporarily store the items to be taken on the path
|
||||||
|
'config'
|
||||||
];
|
];
|
||||||
|
|
||||||
for(var which in cats) {
|
for(var which in cats) {
|
||||||
@@ -343,18 +344,18 @@ var StateManager = {
|
|||||||
|
|
||||||
if(income.timeLeft <= 0) {
|
if(income.timeLeft <= 0) {
|
||||||
Engine.log('collection income from ' + source);
|
Engine.log('collection income from ' + source);
|
||||||
if(source == 'thieves') $SM.addStolen(income.stores);
|
if(source == 'thieves') $SM.addStolen(income.stores);
|
||||||
|
|
||||||
var cost = income.stores;
|
var cost = income.stores;
|
||||||
var ok = true;
|
var ok = true;
|
||||||
if (source != 'thieves') {
|
if (source != 'thieves') {
|
||||||
for (var k in cost) {
|
for (var k in cost) {
|
||||||
var have = $SM.get('stores["' + k + '"]', true);
|
var have = $SM.get('stores["' + k + '"]', true);
|
||||||
if (have + cost[k] < 0) {
|
if (have + cost[k] < 0) {
|
||||||
ok = false;
|
ok = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ok){
|
if(ok){
|
||||||
|
|||||||
Reference in New Issue
Block a user