Browse Source

Fixed market persistence bug

Load_Fix
Robert Chen 11 years ago
parent
commit
02a15f489c
  1. 1
      js/screens.js
  2. 14
      js/ui.js

1
js/screens.js

@ -335,6 +335,7 @@ function MarketScreen( stage, gameState ){ @@ -335,6 +335,7 @@ function MarketScreen( stage, gameState ){
this.uiElems = [];
this.uiElems.push( new ImgButton( stage, gameState, 690,0, "res/items/ExitSign.png", "res/items/ExitGlow.png","SwitchScreen", "KitchenScreen", "Click" ) );
var marketItemKeys = Object.keys(gameState.marketItems);
for (var index in marketItemKeys ) {
gameState.marketItems[marketItemKeys[index]].draw( stage );

14
js/ui.js

@ -569,9 +569,6 @@ return { @@ -569,9 +569,6 @@ return {
secondCounter = 0;
}
// move the overlay
console.log("Mood"+mood.x);
if( dayNight.x < -15583 )
dayNight.x = 0;
@ -671,6 +668,7 @@ function MarketItem( gameState, name, x, y, cost, mouseOutImg, mouseOverImg, mou @@ -671,6 +668,7 @@ function MarketItem( gameState, name, x, y, cost, mouseOutImg, mouseOverImg, mou
gameState.turkeyBought = true;
gameState.turkeyWeight = weight;
gameState.marketItems[ that.name ].delete();
that.bought = true;
gameState.pubsub.publish("Play", {name:"Buy", volume:0.7} );
gameState.pubsub.publish("WalletAmount", gameState.wallet - Math.abs(cost))
gameState.pubsub.publish("StartTurkeyModel","");
@ -703,33 +701,35 @@ function MarketItem( gameState, name, x, y, cost, mouseOutImg, mouseOverImg, mou @@ -703,33 +701,35 @@ function MarketItem( gameState, name, x, y, cost, mouseOutImg, mouseOverImg, mou
gameState.pubsub.publish( "Play", "Error" );
}
});
mouseOver.visible = false;
var objReturn = {
tick: function(){},
getName: function(){return that.name;},
delete: function( stage ){
that.visible = false;
gameState.pubsub.publish("RemoveItems", [mouseOut, mouseOver]);
mouseOut.visible = false;
mouseOver.visible = false;
},
draw: function( stage, newx, newy ){
if( newx && newy ){
mouseOut.x = mouseOver.x = newx;
mouseOut.y = mouseOver.y = newy;
}
console.log("NewScreen for item "+that.name +" is " +gameState.newScreen );
if( gameState.newScreen == "KitchenScreen" ){
mouseOutKitchen.visible = true;
stage.addChild( mouseOutKitchen );
mouseOverKitchen.visible = false;
stage.addChild( mouseOverKitchen );
return;
}
if( !that.bought ){
stage.addChild( mouseOut );
stage.addChild( mouseOver );
}
}
}
return objReturn;
}

Loading…
Cancel
Save