mirror of
https://github.com/doublespeakgames/adarkroom.git
synced 2026-05-28 00:01:54 +08:00
Property for tab navigation
Added Engine.tabNavigation property. When true, it enables keyboard navigation to/from tabs. It is disabled on world and enabled some milliseconds after Path.onArrival(), so that when player returns s/he finds him/herself on Path tab instead of navigating.
This commit is contained in:
committed by
Blake Grotewold
parent
64a02c162c
commit
daf5de3973
@@ -593,6 +593,14 @@
|
||||
//return (num > 0 ? "+" : "") + num + " per " + delay + "s";
|
||||
},
|
||||
|
||||
tabNavigation: true,
|
||||
|
||||
restoreNavigation: function(){
|
||||
setTimeout(function(){
|
||||
Engine.tabNavigation = true;
|
||||
},100);
|
||||
},
|
||||
|
||||
keyDown: function(e) {
|
||||
e = e || window.event;
|
||||
if(!Engine.keyPressed && !Engine.keyLock) {
|
||||
@@ -628,6 +636,7 @@
|
||||
break;
|
||||
case 37: // Left
|
||||
case 65:
|
||||
if(Engine.tabNavigation){
|
||||
if(Engine.activeModule == Ship && Path.tab)
|
||||
Engine.travelTo(Path);
|
||||
else if(Engine.activeModule == Path && Outside.tab){
|
||||
@@ -637,10 +646,12 @@
|
||||
Engine.activeModule.scrollSidebar('left', true);
|
||||
Engine.travelTo(Room);
|
||||
}
|
||||
}
|
||||
Engine.log('left');
|
||||
break;
|
||||
case 39: // Right
|
||||
case 68:
|
||||
if(Engine.tabNavigation){
|
||||
if(Engine.activeModule == Room && Outside.tab)
|
||||
Engine.travelTo(Outside);
|
||||
else if(Engine.activeModule == Outside && Path.tab){
|
||||
@@ -650,6 +661,7 @@
|
||||
Engine.activeModule.scrollSidebar('right', true);
|
||||
Engine.travelTo(Ship);
|
||||
}
|
||||
}
|
||||
Engine.log('right');
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -823,6 +823,7 @@ var World = {
|
||||
$('#outerSlider').animate({opacity:'1'}, 600, 'linear');
|
||||
Button.cooldown($('#embarkButton'));
|
||||
Engine.keyLock = false;
|
||||
Engine.restoreNavigation();
|
||||
}, 2000, true);
|
||||
});
|
||||
}
|
||||
@@ -865,6 +866,7 @@ var World = {
|
||||
$('#outerSlider').animate({left: '0px'}, 300);
|
||||
Engine.activeModule = Path;
|
||||
Path.onArrival();
|
||||
Engine.restoreNavigation();
|
||||
},
|
||||
|
||||
leaveItAtHome: function(thing) {
|
||||
|
||||
Reference in New Issue
Block a user