Browse Source

State repro bugs fixed

Load_Fix
Robert Chen 11 years ago
parent
commit
1f5b5ff700
  1. 2
      index.html
  2. 1
      js/screens.js
  3. 25
      js/ui.js

2
index.html

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
<html>
<head>
<title>Turkey Baking Simulator</title>
<title>Turkey Cooking Simulator</title>
<style type="text/css">
</style>
</head>

1
js/screens.js

@ -246,7 +246,6 @@ function KitchenScreen( stage, gameState ){ @@ -246,7 +246,6 @@ function KitchenScreen( stage, gameState ){
this.uiElems = [];
this.uiElems.push( new WindowUI( stage, gameState ) );
new FinalConfirmationUI(stage, gameState );
this.background = new createjs.Bitmap( "res/screens/KitchenScreen/KitchenScreen.png" );
stage.addChild( this.background );
console.log(gameState.purchasedItems);

25
js/ui.js

@ -135,10 +135,10 @@ function FinalConfirmationUI(stage, gameState){ @@ -135,10 +135,10 @@ function FinalConfirmationUI(stage, gameState){
this.showFinalConfirm = function(){
console.log("Showing final confirm");
if( !that.showingConfirm ){
that.showingConfirm = true;
stage.addChild( finalImg );
stage.addChild( noButton );
stage.addChild( yesButton );
that.showingConfirm = true;
}
};
@ -208,6 +208,7 @@ function OvenUI( stage, gameState ){ @@ -208,6 +208,7 @@ function OvenUI( stage, gameState ){
var ovenLight = new createjs.Shape();
ovenLight.graphics.beginFill( "black" ).drawCircle( 181, 126, 2 );
var confirmation = new FinalConfirmationUI(stage, gameState );
// Oven light control
this.changeOvenLight = function( state ){
if( state == "On" ){
@ -231,15 +232,6 @@ function OvenUI( stage, gameState ){ @@ -231,15 +232,6 @@ function OvenUI( stage, gameState ){
turkeyStates[i].scaleX = turkeyStates[i].scaleY =1;
turkeyStates[i].x = 75;
turkeyStates[i].y = 258;
turkeyStates[i].addEventListener( "mouseover", function(){
document.body.style.cursor='pointer';
});
turkeyStates[i].addEventListener( "mouseout", function(){
document.body.style.cursor='default';
});
turkeyStates[i].addEventListener( "click", function(){
gameState.pubsub.publish("ShowFinalConfirm","");
});
}
var temperatureText = new createjs.Text( "OFF", "40px Arial", "#ff7700" );
@ -491,12 +483,17 @@ function OvenUI( stage, gameState ){ @@ -491,12 +483,17 @@ function OvenUI( stage, gameState ){
stage.addChild(turkeyStates[0]);
for(i in turkeyStates){
stage.addChild(turkeyStates[i]);
}
stage.addChild(panFront);
}
// Pan front goes here
stage.addChild( panFront );
//finalize button
stage.addChild( new Button( stage, gameState, 45, 250, 250, 175, null, null, function(){
gameState.pubsub.publish("ShowFinalConfirm","");
} ) );
stage.addChild( doorPeekLightOn);
stage.addChild( doorPeekLightOff);
@ -515,6 +512,7 @@ function OvenUI( stage, gameState ){ @@ -515,6 +512,7 @@ function OvenUI( stage, gameState ){
}
}) );
stage.addChild( handleBar);
return this;
}
}
@ -712,8 +710,8 @@ function MarketItem( gameState, name, x, y, cost, mouseOutImg, mouseOverImg, mou @@ -712,8 +710,8 @@ function MarketItem( gameState, name, x, y, cost, mouseOutImg, mouseOverImg, mou
getName: function(){return that.name;},
delete: function( stage ){
gameState.pubsub.publish("RemoveItems", [mouseOut, mouseOver]);
delete gameState.marketItems[that.name];
mouseOut.visible = false;
mouseOver.visible = false;
},
draw: function( stage, newx, newy ){
if( newx && newy ){
@ -778,7 +776,6 @@ function Button( stage, gameState, x_orig, y_orig, x_dest, y_dest, eventCmd, arg @@ -778,7 +776,6 @@ function Button( stage, gameState, x_orig, y_orig, x_dest, y_dest, eventCmd, arg
gameState.pubsub.publish( eventCmd, arg );
return;
}
console.log(altfunc);
altfunc();
gameState.pubsub.publish( eventCmd, arg );
} );

Loading…
Cancel
Save