Browse Source

Score screen

Load_Fix
Robert Chen 11 years ago
parent
commit
f8dd13886f
  1. 7
      js/main.js
  2. 57
      js/screens.js
  3. 1
      js/soundmanager.js
  4. 2
      js/stories.js
  5. 25
      js/ui.js
  6. BIN
      res/screens/.DS_Store
  7. BIN
      res/sound/.DS_Store
  8. BIN
      res/sound/GUI/.DS_Store
  9. BIN
      res/sound/GUI/ding.mp3

7
js/main.js

@ -71,6 +71,9 @@ function GameState(){ @@ -71,6 +71,9 @@ function GameState(){
queue.loadFile( {id: "HelpP5P6", src:"res/screens/HelpCreditsScreen/HelpP5P6.png" } );
queue.loadFile( {id: "HelpP7P8", src:"res/screens/HelpCreditsScreen/HelpP7P8.png" } );
queue.loadFile( {id: "ScoreScreenFile", src:"res/screens/ScoreScreen/Score-Tally.png" } );
queue.loadFile( {id: "HelpScreenFile", src:"res/screens/HelpCreditsScreen/Credits.png" } );
queue.loadFile( {id: "MarketScreenfile", src:"res/screens/MarketScreen/MarketScreen.png"} );
@ -85,6 +88,7 @@ function GameState(){ @@ -85,6 +88,7 @@ function GameState(){
queue.loadFile( {id: "UILowClickFile", src:"res/sound/GUI/lowclick.mp3"} );
queue.loadFile( {id: "UIClickFile", src:"res/sound/GUI/click.mp3"} );
queue.loadFile( {id: "UIBuzzFile", src:"res/sound/GUI/buzz.mp3"} );
queue.loadFile( {id: "UIDingFile", src:"res/sound/GUI/ding.mp3"} );
// Kitchen Items
queue.loadFile( {id: "res/screens/KitchenScreen/KitchenScreen.png", src:"res/screens/KitchenScreen/KitchenScreen.png"});
@ -313,8 +317,6 @@ function GameUI( canvasElem, gameState ){ @@ -313,8 +317,6 @@ function GameUI( canvasElem, gameState ){
"DifficultyScreen" : DifficultyScreen,
"KitchenScreen" : KitchenScreen,
"MarketScreen" : MarketScreen,
"TurkeyOutScreen" : TurkeyOutScreen,
"EndingScreen" : EndingScreen,
"ScoreScreen" : ScoreScreen,
"CreditsScreen" : CreditsScreen
}
@ -347,6 +349,7 @@ function GameUI( canvasElem, gameState ){ @@ -347,6 +349,7 @@ function GameUI( canvasElem, gameState ){
that.stage.addChild( overlay );
dialogManager.render();
};
new HelpUI(this.stage, gameState);
gameState.pubsub.subscribe( "SwitchScreen", this.switchScreen );
gameState.pubsub.subscribe( "ActuallySwitchScreen", this.actuallySwitchScreen );

57
js/screens.js

@ -79,7 +79,6 @@ function MainScreen( stage, gameState ){ @@ -79,7 +79,6 @@ function MainScreen( stage, gameState ){
animation.x = 140;
animation.y = 210;
new HelpUI(stage, gameState);
animation.addEventListener("tick", handleTick);
function handleTick(event){
if ( turkeyAnimations[event.currentTarget.currentAnimation][1] == event.currentTarget.currentFrame ){
@ -386,51 +385,33 @@ function MarketScreen( stage, gameState ){ @@ -386,51 +385,33 @@ function MarketScreen( stage, gameState ){
}
function TurkeyOutScreen( stage, gameState ){
var that = this;
this.background = new createjs.Bitmap( "res/Main.png" );
stage.addChild( this.background );
this.uiElems = [];
return {
blit : function(){
// Draw all the uiElements
for( var index in that.uiElems ){
that.uiElems[ index ].tick();
}
}
}
}
function ScoreScreen( stage, gameState ){
var that = this;
function EndingScreen( stage, gameState ){
var that = this;
gameState.pubsub.publish( "FadeOut", "" );
this.background = new createjs.Bitmap( "res/Main.png" );
this.background = new createjs.Bitmap( "res/screens/ScoreScreen/Score-Tally.png" );
stage.addChild( this.background );
gameState.pubsub.publish( "BackgroundLoop", {name:"TitleMusic", pos:5650, volume:1} );
this.uiElems = [];
return {
blit : function(){
// Draw all the uiElements
for( var index in that.uiElems ){
that.uiElems[ index ].tick();
}
}
}
//
// Retry button
stage.addChild( new Button( stage, gameState, 590, 350, 200, 55, null, null, function(){ document.location.reload(); } ) );
}
// All the text for the entries
var totalCookTime;
var realTimeElapsed;
var finalCoreTemperature;
var totalScore;
function ScoreScreen( stage, gameState ){
var that = this;
// Optimal Temperature to be served at
this.scoreDistribution= function(inputTemp) {
desiredAverage = 162;
variance = 1000; //Std Deviation 31.62
return(Math.exp(-(Math.pow((inputTemp-desiredAverage),2)/(2*variance))))
};
this.background = new createjs.Bitmap( "res/Main.png" );
stage.addChild( this.background );
this.uiElems = [];
return {

1
js/soundmanager.js

@ -21,6 +21,7 @@ function SoundManager( gameState ){ @@ -21,6 +21,7 @@ function SoundManager( gameState ){
createjs.Sound.registerSound("res/sound/GUI/buzz.mp3", "Error");
createjs.Sound.registerSound("res/sound/Store/buy.mp3", "Buy");
createjs.Sound.registerSound("res/sound/Store/entrance.mp3", "Entrance");
createjs.Sound.registerSound("res/sound/GUI/ding.mp3", "Ding");
// Kitchen sound
createjs.Sound.registerSound("res/sound/Kitchen/Oven_Door_Full_Open.mp3", "Oven_Door_Full_Open");

2
js/stories.js

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
var messages = {
"Null":["Me: "],
"KitchenInitial" : ["Me: I need to buy a turkey..."],
"CannotBuyTurkey" : ["Me: I've barely have time for ONE turkey, let alone TWO!"],
"CannotBuyTurkey" : ["Me: I barely have time for ONE turkey, let alone TWO!"],
"NoMoney" : ["Me: I can't afford this!"],
"BuyTurkeyFirst" : ["Me: I should buy a turkey first!"],
"EmptyOven" : ["Me: Ah, the oven is already preheated..."],

25
js/ui.js

@ -77,9 +77,6 @@ function HelpUI( stage, gameState ){ @@ -77,9 +77,6 @@ function HelpUI( stage, gameState ){
}
});
stage.addChild( this.background );
stage.addChild( closeButton );
this.hideHelp = function(){
helpImg.visible=false;
stage.removeChild( closeButton );
@ -104,6 +101,7 @@ function HelpUI( stage, gameState ){ @@ -104,6 +101,7 @@ function HelpUI( stage, gameState ){
}
helpPages[0].visible = true;
stage.addChild( that.background );
stage.addChild( closeButton );
stage.addChild( nextButton );
stage.addChild( prevButton );
@ -121,7 +119,11 @@ function FinalConfirmationUI(stage, gameState){ @@ -121,7 +119,11 @@ function FinalConfirmationUI(stage, gameState){
this.showingConfirm = false;
var finalImg = new createjs.Bitmap("res/screens/KitchenScreen/FinalConfirmation.png");
var yesButton = new Button( stage, gameState, 355, 338, 388, 50, null, null, function(){that.hideFinalConfirm();} );
var yesButton = new Button( stage, gameState, 355, 338, 388, 50, null, null, function(){
gameState.pubsub.publish( "Play", "Ding" );
gameState.pubsub.publish( "SwitchScreen", "ScoreScreen" );
that.hideFinalConfirm();
} );
var noButton = new Button( stage, gameState, 355, 395, 388, 50, null, null, function(){that.hideFinalConfirm();} );
this.hideFinalConfirm = function(){
@ -335,7 +337,7 @@ function OvenUI( stage, gameState ){ @@ -335,7 +337,7 @@ function OvenUI( stage, gameState ){
if( gameState.turkeyBought ){
var state = ovenModel.getTurkeyState();
gameState.pubsub.publish( "ShowDialog", {seq:"custom", autoAdvance:false, customText:"Hmm... Looks " + turkeyState["skin"]["cond"][2] + "." } );
gameState.pubsub.publish( "ShowDialog", {seq:"custom", autoAdvance:true, customText:"Hmm... Looks " + turkeyState["skin"]["cond"][2] + "." } );
gameState.pubsub.publish( "AddRecord", {type:"Open ", text:"The turkey looked " + turkeyState["skin"]["cond"][2]} );
}
@ -365,7 +367,7 @@ function OvenUI( stage, gameState ){ @@ -365,7 +367,7 @@ function OvenUI( stage, gameState ){
handleBar.y = 48;
if( gameState.turkeyBought ){
var state = ovenModel.getTurkeyState();
gameState.pubsub.publish( "ShowDialog", {seq:"custom", autoAdvance:false, customText:"Looks " + turkeyState["skin"]["cond"][2] } );
gameState.pubsub.publish( "ShowDialog", {seq:"custom", autoAdvance:true, customText:"Looks " + turkeyState["skin"]["cond"][2] } );
gameState.pubsub.publish( "AddRecord", {type:"Peek ", text:"The turkey looked " + turkeyState["skin"]["cond"][2]} );
that.ovenOpened++;
}
@ -389,7 +391,7 @@ function OvenUI( stage, gameState ){ @@ -389,7 +391,7 @@ function OvenUI( stage, gameState ){
}
else{
state = ovenModel.getTurkeyState();
gameState.pubsub.publish( "ShowDialog", {seq:"custom", autoAdvance:false, customText:"The core temperature of the turkey reads " + UtilityFunctions.C2F(state.core.temp).toFixed(2) + " F" } );
gameState.pubsub.publish( "ShowDialog", {seq:"custom", autoAdvance:true, customText:"The core temperature of the turkey reads " + UtilityFunctions.C2F(state.core.temp).toFixed(2) + " F" } );
gameState.pubsub.publish( "AddRecord", {type:"Probe", text:"Core temperature measured: " + UtilityFunctions.C2F(state.core.temp).toFixed(2) + " F"} );
that.ovenOpened++;
}
@ -490,9 +492,12 @@ function OvenUI( stage, gameState ){ @@ -490,9 +492,12 @@ function OvenUI( stage, gameState ){
stage.addChild( panFront );
//finalize button
stage.addChild( new Button( stage, gameState, 45, 250, 250, 175, null, null, function(){
gameState.pubsub.publish("ShowFinalConfirm","");
} ) );
if( gameState.turkeyBought ){
stage.addChild( new Button( stage, gameState, 45, 250, 250, 175, null, null, function(){
gameState.pubsub.publish("Play", "Error");
gameState.pubsub.publish("ShowFinalConfirm","");
} ) );
}
stage.addChild( doorPeekLightOn);
stage.addChild( doorPeekLightOff);

BIN
res/screens/.DS_Store vendored

Binary file not shown.

BIN
res/sound/.DS_Store vendored

Binary file not shown.

BIN
res/sound/GUI/.DS_Store vendored

Binary file not shown.

BIN
res/sound/GUI/ding.mp3

Binary file not shown.
Loading…
Cancel
Save