Merge pull request #10 from doublespeakgames/master

Update 2015-05-18
This commit is contained in:
Andrea Rendine
2015-05-18 17:24:32 +02:00
6 changed files with 137 additions and 97 deletions
+4
View File
@@ -508,6 +508,10 @@ body.noMask #description {
padding-bottom: 20px; padding-bottom: 20px;
} }
.take-all-button {
float: none;
}
#buttons > .button { #buttons > .button {
margin: 0 5px 5px; margin: 0 5px 5px;
margin-right: 15px; margin-right: 15px;
+1
View File
@@ -42,6 +42,7 @@ div#storesContainer {
div#stores { div#stores {
position: relative; position: relative;
z-index:10;
border: 1px solid black; border: 1px solid black;
cursor: default; cursor: default;
padding: 5px 10px; padding: 5px 10px;
+40 -5
View File
@@ -42,6 +42,11 @@ var Events = {
Events.activeScene = name; Events.activeScene = name;
var scene = Events.activeEvent().scenes[name]; var scene = Events.activeEvent().scenes[name];
// onLoad
if(scene.onLoad) {
scene.onLoad();
}
// Notify the scene change // Notify the scene change
if(scene.notification) { if(scene.notification) {
Notifications.notify(null, scene.notification); Notifications.notify(null, scene.notification);
@@ -52,11 +57,6 @@ var Events = {
$SM.addM('stores', scene.reward); $SM.addM('stores', scene.reward);
} }
// onLoad
if(scene.onLoad) {
scene.onLoad();
}
$('#description', Events.eventPanel()).empty(); $('#description', Events.eventPanel()).empty();
$('#buttons', Events.eventPanel()).empty(); $('#buttons', Events.eventPanel()).empty();
if(scene.combat) { if(scene.combat) {
@@ -503,9 +503,44 @@ var Events = {
$('<div>').addClass('clear').appendTo(lootButtons); $('<div>').addClass('clear').appendTo(lootButtons);
if(lootButtons.children().length > 1) { if(lootButtons.children().length > 1) {
lootButtons.appendTo(desc); lootButtons.appendTo(desc);
var takeAll = new Button.Button({
id: 'loot_take_all',
text: _('take all'),
click: Events.takeAllLoot
}).addClass('take-all-button').appendTo(lootButtons);
} }
}, },
takeAllLoot: function(){
var stoppedEarly = false;
$('#lootButtons')
.children('.button')
.each(function(){
if( $(this).hasClass('take-all-button') ) {
return;
}
var weight = $(this).data('numLeft') * Path.getWeight($(this).attr('id').substring(5).replace('-', ' '));
while( $(this).data('numLeft') > 0 && weight < Path.getFreeSpace() ){
$(this).click();
}
if(weight > Path.getFreeSpace()){
stoppedEarly = true;
return;
}
});
if( !stoppedEarly ){
$('#leave').click();
$('#leaveBtn').click();
}
},
dropStuff: function(e) { dropStuff: function(e) {
e.stopPropagation(); e.stopPropagation();
var btn = $(this); var btn = $(this);
+1 -1
View File
@@ -431,7 +431,7 @@ var Outside = {
} }
if(needsAppend && village.children().length > 1) { if(needsAppend && village.children().length > 1) {
village.appendTo('#outsidePanel'); village.prependTo('#outsidePanel');
village.animate({opacity:1}, 300, 'linear'); village.animate({opacity:1}, 300, 'linear');
} }
+1 -1
View File
@@ -112,7 +112,7 @@ var Path = {
} }
if(needsAppend && perks.children().length > 0) { if(needsAppend && perks.children().length > 0) {
perks.appendTo(Path.panel); perks.prependTo(Path.panel);
} }
if(!ignoreStores && Engine.activeModule === Path) { if(!ignoreStores && Engine.activeModule === Path) {
+1 -1
View File
@@ -511,7 +511,7 @@ var Room = {
}).appendTo('div#roomPanel'); }).appendTo('div#roomPanel');
// Create the stores container // Create the stores container
$('<div>').attr('id', 'storesContainer').appendTo('div#roomPanel'); $('<div>').attr('id', 'storesContainer').prependTo('div#roomPanel');
//subscribe to stateUpdates //subscribe to stateUpdates
$.Dispatch('stateUpdate').subscribe(Room.handleStateUpdates); $.Dispatch('stateUpdate').subscribe(Room.handleStateUpdates);