|
|
@ -146,8 +146,10 @@ function OvenUI( stage, gameState ){ |
|
|
|
doorPeekLightOff.alpha = doorClosedLightOff.alpha = 0; |
|
|
|
doorPeekLightOff.alpha = doorClosedLightOff.alpha = 0; |
|
|
|
doorOpen.alpha = 1; |
|
|
|
doorOpen.alpha = 1; |
|
|
|
handleBar.y = 330; |
|
|
|
handleBar.y = 330; |
|
|
|
|
|
|
|
gameState.pubsub.publish( "Play", "Oven_Door_Full_Open" ); |
|
|
|
}else if (that.ovenDoor == OVEN_OPEN ){ |
|
|
|
}else if (that.ovenDoor == OVEN_OPEN ){ |
|
|
|
that.ovenDoor = OVEN_PEEK; |
|
|
|
that.ovenDoor = OVEN_PEEK; |
|
|
|
|
|
|
|
gameState.pubsub.publish( "Play", "Oven_Door_Full_Close" ); |
|
|
|
ovenPeek(); |
|
|
|
ovenPeek(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -155,13 +157,15 @@ function OvenUI( stage, gameState ){ |
|
|
|
handleBar.addEventListener( "click", ovenPeek ); |
|
|
|
handleBar.addEventListener( "click", ovenPeek ); |
|
|
|
|
|
|
|
|
|
|
|
function ovenPeek(){ |
|
|
|
function ovenPeek(){ |
|
|
|
if( that.ovenDoor == OVEN_CLOSED || that.ovenDoor == OVEN_OPEN ){ |
|
|
|
if( that.ovenDoor == OVEN_CLOSED && that.ovenDoor != OVEN_OPEN ){ |
|
|
|
|
|
|
|
gameState.pubsub.publish( "Play", "Oven_Door_Peek_Open" ); |
|
|
|
doorPeekLightOn.alpha = lightPressedImg.alpha == 0 ? 0 : 1; |
|
|
|
doorPeekLightOn.alpha = lightPressedImg.alpha == 0 ? 0 : 1; |
|
|
|
doorPeekLightOff.alpha = lightPressedImg.alpha == 0 ? 1 : 0; |
|
|
|
doorPeekLightOff.alpha = lightPressedImg.alpha == 0 ? 1 : 0; |
|
|
|
doorClosedLightOn.alpha = 0; |
|
|
|
doorClosedLightOn.alpha = 0; |
|
|
|
doorClosedLightOff.alpha = 0; |
|
|
|
doorClosedLightOff.alpha = 0; |
|
|
|
doorOpen.alpha = 0; |
|
|
|
doorOpen.alpha = 0; |
|
|
|
that.ovenDoor = OVEN_PEEK; |
|
|
|
that.ovenDoor = OVEN_PEEK; |
|
|
|
|
|
|
|
|
|
|
|
handleBar.y = 48; |
|
|
|
handleBar.y = 48; |
|
|
|
} |
|
|
|
} |
|
|
|
else if (that.ovenDoor == OVEN_PEEK){ |
|
|
|
else if (that.ovenDoor == OVEN_PEEK){ |
|
|
@ -170,6 +174,7 @@ function OvenUI( stage, gameState ){ |
|
|
|
doorPeekLightOn.alpha = 0; |
|
|
|
doorPeekLightOn.alpha = 0; |
|
|
|
doorPeekLightOff.alpha = 0; |
|
|
|
doorPeekLightOff.alpha = 0; |
|
|
|
that.ovenDoor = OVEN_CLOSED; |
|
|
|
that.ovenDoor = OVEN_CLOSED; |
|
|
|
|
|
|
|
gameState.pubsub.publish( "Play", "Oven_Door_Peek_Close" ); |
|
|
|
doorOpen.alpha = 0; |
|
|
|
doorOpen.alpha = 0; |
|
|
|
handleBar.y = 0; |
|
|
|
handleBar.y = 0; |
|
|
|
} |
|
|
|
} |
|
|
@ -185,28 +190,29 @@ function OvenUI( stage, gameState ){ |
|
|
|
|
|
|
|
|
|
|
|
setInterval(this.secondTick, 1000); |
|
|
|
setInterval(this.secondTick, 1000); |
|
|
|
|
|
|
|
|
|
|
|
stage.addChild( this.text ); |
|
|
|
|
|
|
|
stage.addChild(lightPressedImg); |
|
|
|
|
|
|
|
// Turkey goes here
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stage.addChild(doorPeekLightOn); |
|
|
|
|
|
|
|
stage.addChild(doorPeekLightOff); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stage.addChild(doorClosedLightOn); |
|
|
|
|
|
|
|
stage.addChild(doorClosedLightOff); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stage.addChild(doorOpen); |
|
|
|
|
|
|
|
stage.addChild(handleBar); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
tick: function(){}, |
|
|
|
tick: function(){}, |
|
|
|
render: function(){ |
|
|
|
render: function(){ |
|
|
|
//Set position of Shape instance.
|
|
|
|
|
|
|
|
stage.addChild( ovenLight ); |
|
|
|
stage.addChild( ovenLight ); |
|
|
|
|
|
|
|
stage.addChild( temperatureText ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stage.addChild( this.text ); |
|
|
|
|
|
|
|
stage.addChild( lightPressedImg); |
|
|
|
|
|
|
|
// Turkey goes here
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stage.addChild( doorPeekLightOn); |
|
|
|
|
|
|
|
stage.addChild( doorPeekLightOff); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stage.addChild( doorClosedLightOn); |
|
|
|
|
|
|
|
stage.addChild( doorClosedLightOff); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stage.addChild( doorOpen); |
|
|
|
stage.addChild( new Button( stage, gameState, 45, 163, 41, 17, "ChangeTemperature", "Up" ) ); |
|
|
|
stage.addChild( new Button( stage, gameState, 45, 163, 41, 17, "ChangeTemperature", "Up" ) ); |
|
|
|
stage.addChild( new Button( stage, gameState, 95, 163, 41, 17, "ChangeTemperature", "Down" ) ); |
|
|
|
stage.addChild( new Button( stage, gameState, 95, 163, 41, 17, "ChangeTemperature", "Down" ) ); |
|
|
|
stage.addChild( new Button( stage, gameState, 145, 163, 41, 17, "OvenLightToggle", "" ) ); |
|
|
|
stage.addChild( new Button( stage, gameState, 145, 163, 41, 17, "OvenLightToggle", "" ) ); |
|
|
|
stage.addChild( temperatureText ); |
|
|
|
stage.addChild( handleBar); |
|
|
|
return this; |
|
|
|
return this; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -263,7 +269,7 @@ function MarketItem( gameState, name, x, y, cost, mouseOutImg, mouseOverImg, fun |
|
|
|
gameState.pubsub.publish("WalletAmount", gameState.wallet - Math.abs(cost)) |
|
|
|
gameState.pubsub.publish("WalletAmount", gameState.wallet - Math.abs(cost)) |
|
|
|
} |
|
|
|
} |
|
|
|
// can we buy this? Only possible if you already bought a turkey
|
|
|
|
// can we buy this? Only possible if you already bought a turkey
|
|
|
|
else if( !that.name.indexOf("Turkey") != -1 && gameState.turkeyBought == true ){ |
|
|
|
else if( that.name.indexOf("Turkey") == -1 && gameState.turkeyBought == true ){ |
|
|
|
gameState.purchasedItems.push( objReturn ); |
|
|
|
gameState.purchasedItems.push( objReturn ); |
|
|
|
gameState.marketItems[ that.name ].delete(); |
|
|
|
gameState.marketItems[ that.name ].delete(); |
|
|
|
that.bought = true; |
|
|
|
that.bought = true; |
|
|
@ -341,7 +347,9 @@ function Button( stage, gameState, x_orig, y_orig, x_dest, y_dest, eventCmd, arg |
|
|
|
button.addEventListener( "click", function(){ gameState.pubsub.publish( eventCmd, arg ) } ); |
|
|
|
button.addEventListener( "click", function(){ gameState.pubsub.publish( eventCmd, arg ) } ); |
|
|
|
button.addEventListener( "mouseover", function(){ document.body.style.cursor='pointer'; } ); |
|
|
|
button.addEventListener( "mouseover", function(){ document.body.style.cursor='pointer'; } ); |
|
|
|
button.addEventListener( "mouseout", function(){ document.body.style.cursor='default'; } ); |
|
|
|
button.addEventListener( "mouseout", function(){ document.body.style.cursor='default'; } ); |
|
|
|
gameState.pubsub.publish( "Play", "Click" ); |
|
|
|
button.addEventListener( "click", function(){ |
|
|
|
return button; |
|
|
|
gameState.pubsub.publish( "Play", "Click" ); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return button; |
|
|
|
} |
|
|
|
} |