@ -0,0 +1,27 @@ |
|||||||
|
<html> |
||||||
|
<head> |
||||||
|
<title>Turkey Cooking Simulator</title> |
||||||
|
<style type="text/css"> |
||||||
|
</style> |
||||||
|
</head> |
||||||
|
<body> |
||||||
|
|
||||||
|
<center> |
||||||
|
<div class="canvasContainer"> |
||||||
|
<canvas id="demoCanvas" width="800" height="600" style="border:1px solid #000000"></canvas> |
||||||
|
</div> |
||||||
|
</center> |
||||||
|
</body> |
||||||
|
<script src="http://code.createjs.com/createjs-2013.09.25.min.js"></script> |
||||||
|
<script src="js/model.js"></script> |
||||||
|
<script src="js/soundmanager.js"></script> |
||||||
|
<script src="js/stories.js"></script> |
||||||
|
<script src="js/dialogue.js"></script> |
||||||
|
<script src="js/ui.js"></script> |
||||||
|
<script src="js/screens.js"></script> |
||||||
|
<script src="js/main.js"></script> |
||||||
|
<script> |
||||||
|
new GameState(); |
||||||
|
</script> |
||||||
|
<!-- Load all the things! --> |
||||||
|
</html> |
@ -0,0 +1,227 @@ |
|||||||
|
function DialogueSequence( sequence ){ |
||||||
|
|
||||||
|
var targetStory = story[sequence] ? story[sequence].slice(0) : ( messages[sequence] ? messages[sequence].slice(0) : [] ); |
||||||
|
|
||||||
|
return { |
||||||
|
next: function(){ |
||||||
|
return targetStory.shift().split(": "); |
||||||
|
}, |
||||||
|
more: function(){ |
||||||
|
return targetStory.length > 0; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
function DialogUI( stage, gameState ){ |
||||||
|
var that = this; |
||||||
|
// Dialog States
|
||||||
|
var DIALOG_RECEDING = 0; |
||||||
|
var DIALOG_SHOWING = 1; |
||||||
|
var DIALOG_PAUSING = 2; |
||||||
|
var MILLIS_PER_CHAR = 100; |
||||||
|
|
||||||
|
var peopleImg = { |
||||||
|
"Boyfriend": new createjs.Bitmap("res/people/Boyfriend.png"), |
||||||
|
"Brother": new createjs.Bitmap("res/people/Brother.png"), |
||||||
|
"Cat": new createjs.Bitmap("res/people/Cat.png"), |
||||||
|
"Dad": new createjs.Bitmap("res/people/Dad.png"), |
||||||
|
"Girlfriend": new createjs.Bitmap("res/people/Girlfriend.png"), |
||||||
|
"Grandma": new createjs.Bitmap("res/people/Grandma.png"), |
||||||
|
"Grandpa": new createjs.Bitmap("res/people/Grandpa.png"), |
||||||
|
"Mom": new createjs.Bitmap("res/people/Mom.png"), |
||||||
|
"Female": new createjs.Bitmap("res/people/PlayerFemale.png"), |
||||||
|
"Male": new createjs.Bitmap("res/people/PlayerMale.png"), |
||||||
|
"Turkey": new createjs.Bitmap("res/people/TurkeyGhost.png") |
||||||
|
}; |
||||||
|
|
||||||
|
var dialogueList = Object.keys(story); |
||||||
|
|
||||||
|
this.dialogSpeed = 30; |
||||||
|
this.dialogState = DIALOG_PAUSING; |
||||||
|
|
||||||
|
this.dialogMotionQueue = [DIALOG_RECEDING]; |
||||||
|
this.currDialogueSeq = new DialogueSequence("Null"); |
||||||
|
dialogQueue = []; |
||||||
|
|
||||||
|
this.dialogBox = new createjs.Bitmap("res/screens/GUI/DialogueBox.png"); |
||||||
|
this.dialogBox.x = 0; |
||||||
|
this.dialogBox.y = 250; |
||||||
|
|
||||||
|
this.currentFace = peopleImg["Male"]; |
||||||
|
this.currentFace.x = 0; |
||||||
|
|
||||||
|
this.textContent = new createjs.Text( "", "24px Arial", "black" ); |
||||||
|
this.textContent.x = 205; |
||||||
|
this.textContent.y = 705; |
||||||
|
this.textContent.lineWidth = 565; |
||||||
|
this.textContent.lineHeight = 30; |
||||||
|
this.textContent.textBaseline = "alphabetic"; |
||||||
|
|
||||||
|
this.dialogBox.addEventListener( "mouseover", function(){ document.body.style.cursor='pointer'; } ); |
||||||
|
this.dialogBox.addEventListener( "mouseout", function(){ document.body.style.cursor='default'; } ); |
||||||
|
this.dialogBox.addEventListener( "click", function(){ setTimeout( clickEvent, 100); }); |
||||||
|
|
||||||
|
this.textContent.addEventListener( "mouseover", function(){ document.body.style.cursor='pointer'; } ); |
||||||
|
this.textContent.addEventListener( "mouseout", function(){ document.body.style.cursor='default'; } ); |
||||||
|
this.textContent.addEventListener( "click", function(){ setTimeout( clickEvent, 100); }); |
||||||
|
|
||||||
|
this.endFunc = function(){}; |
||||||
|
|
||||||
|
this.showDialog= function( textSeq ){ |
||||||
|
if(DEBUG) console.log("showing"+ textSeq); |
||||||
|
if( !peopleImg["Me"] ){ |
||||||
|
peopleImg["Me"] = peopleImg[gameState.gender]; |
||||||
|
} |
||||||
|
|
||||||
|
if( !peopleImg["Spouse"] ){ |
||||||
|
if( gameState.gender == "Male" ){ |
||||||
|
peopleImg["Spouse"] = peopleImg["Girlfriend"] ; |
||||||
|
}else{ |
||||||
|
peopleImg["Spouse"] = peopleImg["Boyfriend"] ; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if( textSeq.seq == "custom" ){ |
||||||
|
messages["custom"] = ["Me: " + textSeq.customText ]; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
if( textSeq.random ){ |
||||||
|
that.showRandomConvo(); |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
that.currDialogueSeq = new DialogueSequence( textSeq.seq ); |
||||||
|
var nextDialogue = that.currDialogueSeq.next(); |
||||||
|
|
||||||
|
that.endFunc = textSeq.endFunc || function(){}; |
||||||
|
|
||||||
|
that.textContent.text=nextDialogue[1].replace(/\[GenderPronoun\]/g, gameState.pronoun ).replace(/\[Player\]/g, gameState.name ); |
||||||
|
that.currentFace.y = 250; |
||||||
|
that.currentFace = peopleImg[nextDialogue[0]] || that.currentFace; |
||||||
|
that.autoAdvance = textSeq.autoAdvance; |
||||||
|
that.dialogMotionQueue = [DIALOG_SHOWING]; |
||||||
|
} |
||||||
|
|
||||||
|
this.showRandomConvo = function(){ |
||||||
|
// No more stories, thanks for playing
|
||||||
|
if( dialogueList.length == 0 ) return; |
||||||
|
|
||||||
|
dialogueList = Object.keys(story); |
||||||
|
var randomKey = UtilityFunctions.randRange(0, dialogueList.length); |
||||||
|
|
||||||
|
// check if there is something going on
|
||||||
|
if( !that.currDialogueSeq.more() ){ |
||||||
|
if(DEBUG) console.log("random story"); |
||||||
|
this.showDialog( {seq: dialogueList[ randomKey ] || "Dad Tells a bad Joke", autoAdvance:true } ); |
||||||
|
delete story[ dialogueList[ randomKey ] ]; |
||||||
|
gameState.dialogueHeard++; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
gameState.pubsub.subscribe( "ShowDialog", this.showDialog ); |
||||||
|
|
||||||
|
// negate double setTimeout if clicked
|
||||||
|
var oldTime = new Date().getTime(); |
||||||
|
var delayCounter = 0; |
||||||
|
var clickEvent = function( timer ){ |
||||||
|
|
||||||
|
if( !peopleImg["Me"] ){ |
||||||
|
peopleImg["Me"] = peopleImg[gameState.gender]; |
||||||
|
} |
||||||
|
|
||||||
|
// if there is more dialogue text, then keep going, otherwise, recede
|
||||||
|
if( that.currDialogueSeq.more() ){ |
||||||
|
var nextDialogue = that.currDialogueSeq.next(); |
||||||
|
|
||||||
|
that.dialogMotionQueue.push(DIALOG_SHOWING); |
||||||
|
that.textContent.text=nextDialogue[1]; |
||||||
|
if(DEBUG) console.log("showing face:" +nextDialogue[0] ); |
||||||
|
|
||||||
|
// swap out face immediately
|
||||||
|
that.currentFace.y = 250; |
||||||
|
that.currentFace = peopleImg[nextDialogue[0]] || that.currentFace; |
||||||
|
that.currentFace.y = 0; |
||||||
|
}else{ |
||||||
|
// pause and close dialog
|
||||||
|
setTimeout( function(){ |
||||||
|
that.dialogMotionQueue.push(DIALOG_RECEDING); |
||||||
|
if( that.endFunc ) |
||||||
|
that.endFunc(); |
||||||
|
}, 250 ); |
||||||
|
} |
||||||
|
delayCounter = 0; |
||||||
|
oldTime = new Date().getTime(); |
||||||
|
} |
||||||
|
|
||||||
|
stage.addChild( this.dialogBox ); |
||||||
|
stage.addChild( this.textContent ); |
||||||
|
|
||||||
|
for(var i in peopleImg ){ |
||||||
|
peopleImg[i].alpha = 1; |
||||||
|
peopleImg[i].y = 250; |
||||||
|
stage.addChild( peopleImg[i] ); |
||||||
|
} |
||||||
|
|
||||||
|
return { |
||||||
|
tick: function(){ |
||||||
|
delayCounter = new Date().getTime() - oldTime; |
||||||
|
|
||||||
|
if( that.autoAdvance == true && that.dialogBox.y ==0 && delayCounter > ( (that.textContent.text.length * MILLIS_PER_CHAR) < 2000 ? 2000 : (that.textContent.text.length * MILLIS_PER_CHAR) ) ){ |
||||||
|
clickEvent(); |
||||||
|
} |
||||||
|
|
||||||
|
if( that.dialogState == DIALOG_RECEDING ){ |
||||||
|
that.dialogBox.y+=that.dialogSpeed; |
||||||
|
that.textContent.y += that.dialogSpeed; |
||||||
|
that.currentFace.y += that.dialogSpeed; |
||||||
|
//if(DEBUG) console.log( "Receding" + that.dialogBox.y );
|
||||||
|
} |
||||||
|
if( that.dialogState == DIALOG_SHOWING ){ |
||||||
|
that.dialogBox.y-=that.dialogSpeed; |
||||||
|
that.textContent.y -= that.dialogSpeed; |
||||||
|
that.currentFace.y -= that.dialogSpeed; |
||||||
|
//if(DEBUG) console.log( "Advancing" + that.dialogBox.y );
|
||||||
|
} |
||||||
|
|
||||||
|
// toggle states
|
||||||
|
if( that.dialogBox.y > 250 && that.dialogState == DIALOG_RECEDING ){ |
||||||
|
that.dialogBox.y = 250; |
||||||
|
that.textContent.y = 735; |
||||||
|
that.currentFace.y = 250; |
||||||
|
that.dialogState = DIALOG_PAUSING; |
||||||
|
//if(DEBUG) console.log( "Pausing on recede" + that.dialogBox.y );
|
||||||
|
|
||||||
|
} |
||||||
|
if( that.dialogBox.y < 0 && that.dialogState == DIALOG_SHOWING ){ |
||||||
|
that.dialogBox.y = 0; |
||||||
|
that.textContent.y = 480; |
||||||
|
that.currentFace.y = 0; |
||||||
|
that.dialogState = DIALOG_PAUSING; |
||||||
|
//if(DEBUG) console.log( "Pausing on showing" + that.dialogBox.y );
|
||||||
|
} |
||||||
|
|
||||||
|
/* next states if there are any on the queue */ |
||||||
|
if( that.dialogMotionQueue.length > 0 && that.dialogState == DIALOG_PAUSING ){ |
||||||
|
that.dialogState = that.dialogMotionQueue.shift(); |
||||||
|
} |
||||||
|
}, |
||||||
|
|
||||||
|
minDialog: function(){ |
||||||
|
that.dialogMotionQueue.push( DIALOG_RECEDING ); |
||||||
|
}, |
||||||
|
|
||||||
|
maxDialog: function(){ |
||||||
|
that.dialogMotionQueue.push( DIALOG_SHOWING ); |
||||||
|
}, |
||||||
|
render: function(){ |
||||||
|
stage.addChild( that.dialogBox ); |
||||||
|
stage.addChild( that.textContent ); |
||||||
|
|
||||||
|
for(var i in peopleImg ){ |
||||||
|
peopleImg[i].alpha = 1; |
||||||
|
stage.addChild( peopleImg[i] ); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,484 @@ |
|||||||
|
// Robert- Here be dragons
|
||||||
|
|
||||||
|
var DEBUG = 1; |
||||||
|
|
||||||
|
function GameState(){ |
||||||
|
var that = this; |
||||||
|
|
||||||
|
this.pubsub = {}; |
||||||
|
BindPubSub( this.pubsub ); |
||||||
|
this.currentTime = Date.now(); //new Date().getTime();
|
||||||
|
this.startTime = Date.now();//new Date().getTime()
|
||||||
|
this.oldTime = Date.now();// new Date().getTime();
|
||||||
|
this.oldDialogueTime = Date.now();//new Date().getTime();
|
||||||
|
|
||||||
|
this.gameStarted = false; |
||||||
|
this.name = ""; |
||||||
|
this.gender = "Male"; |
||||||
|
this.pronoun = "he"; |
||||||
|
this.wallet = 45.00; |
||||||
|
this.hard = false; |
||||||
|
this.boughtOvenLight = false; |
||||||
|
this.turkeyWeight = 8; |
||||||
|
this.peekRecords = []; |
||||||
|
this.turkeyCooking = false; |
||||||
|
this.turkeyType = ""; |
||||||
|
this.alarmTimer = 0; |
||||||
|
this.alarmBought = false; |
||||||
|
this.alarmActivated = false; |
||||||
|
this.turkeyCookCounter = 0; |
||||||
|
|
||||||
|
// stats
|
||||||
|
this.storeVisits = 0; |
||||||
|
this.dialogueHeard = 0; |
||||||
|
this.ovenOpened = 0; |
||||||
|
|
||||||
|
// modifiers
|
||||||
|
this.turkeyTypeModifier = 1; |
||||||
|
this.stuffingTypeModifier = 1; |
||||||
|
this.frillsModifier = 1; |
||||||
|
this.hardcoreModifier = 1; |
||||||
|
|
||||||
|
// Game State flags
|
||||||
|
this.turkeyBought = false; |
||||||
|
var randomWeight = [ (UtilityFunctions.randRange(10,22)+"."+UtilityFunctions.randRange(10,99)), |
||||||
|
(UtilityFunctions.randRange(10,22)+"."+UtilityFunctions.randRange(10,99)), |
||||||
|
(UtilityFunctions.randRange(10,22)+"."+UtilityFunctions.randRange(10,99)), |
||||||
|
(UtilityFunctions.randRange(10,22)+"."+UtilityFunctions.randRange(10,99)), |
||||||
|
(UtilityFunctions.randRange(10,22)+"."+UtilityFunctions.randRange(10,99)) |
||||||
|
]; |
||||||
|
|
||||||
|
// Load all our resources:
|
||||||
|
var queue = new createjs.LoadQueue(true); |
||||||
|
queue.addEventListener("progress", function(event){ |
||||||
|
that.pubsub.publish("Load", (event.progress*100/25)); |
||||||
|
}); |
||||||
|
|
||||||
|
that.mainUI = new GameUI( "demoCanvas", that ); |
||||||
|
createjs.Ticker.addEventListener( "tick", gameLoop ); |
||||||
|
queue.addEventListener("complete", function(event){ |
||||||
|
// Finished loading
|
||||||
|
}); |
||||||
|
queue.installPlugin(createjs.Sound); |
||||||
|
|
||||||
|
//
|
||||||
|
queue.loadFile( {id: "DialogueBoxFile", src:"res/screens/GUI/DialogueBox.png"} ); |
||||||
|
/*queue.loadFile( {id:"res/screens/LoadingScreen/Turkey0.png", src: "res/screens/LoadingScreen/Turkey0.png"} ); |
||||||
|
queue.loadFile( {id:"res/screens/LoadingScreen/Turkey25.png", src: "res/screens/LoadingScreen/Turkey25.png"} ); |
||||||
|
queue.loadFile( {id:"res/screens/LoadingScreen/Turkey50.png", src: "res/screens/LoadingScreen/Turkey50.png"} ); |
||||||
|
queue.loadFile( {id:"res/screens/LoadingScreen/Turkey75.png", src: "res/screens/LoadingScreen/Turkey75.png"} ); |
||||||
|
queue.loadFile( {id:"res/screens/LoadingScreen/TurkeyDone.png", src: "res/screens/LoadingScreen/TurkeyDone.png"} );*/ |
||||||
|
|
||||||
|
// Screens
|
||||||
|
queue.loadFile( {id: "res/screens/DifficultyScreen/Difficulty-Selection.png", src:"res/screens/DifficultyScreen/Difficulty-Selection.png"} ); |
||||||
|
queue.loadFile( {id: "res/screens/DifficultyScreen/ButtonMale.png", src:"res/screens/DifficultyScreen/ButtonMale.png"} ); |
||||||
|
queue.loadFile( {id: "res/screens/DifficultyScreen/ButtonFemale.png", src:"res/screens/DifficultyScreen/ButtonFemale.png"} ); |
||||||
|
|
||||||
|
// Load image assets
|
||||||
|
queue.loadFile( {id: "TurkeySpriteFile", src:"res/screens/MainScreen/TurkeySprite.png"} ); |
||||||
|
queue.loadFile( {id: "MainBackgroundFile", src:"res/screens/MainScreen/Main-Screen.png"} ); |
||||||
|
queue.loadFile( {id: "OverlayGrassFile", src:"res/screens/MainScreen/Grass.png"} ); |
||||||
|
queue.loadFile( {id: "StartButtonFile", src:"res/screens/MainScreen/ButtonStart.png"} ); |
||||||
|
queue.loadFile( {id: "HelpButtonFile", src:"res/screens/MainScreen/ButtonHelp.png"} ); |
||||||
|
queue.loadFile( {id: "CreditsButtonFile", src:"res/screens/MainScreen/ButtonCredits.png"} ); |
||||||
|
|
||||||
|
queue.loadFile( {id: "CreditsScreenFile", src:"res/screens/HelpCreditsScreen/Credits.png" } ); |
||||||
|
queue.loadFile( {id: "HelpP1P2", src:"res/screens/HelpCreditsScreen/HelpP1P2.png" } ); |
||||||
|
queue.loadFile( {id: "HelpP3P4", src:"res/screens/HelpCreditsScreen/HelpP3P4.png" } ); |
||||||
|
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-Evaluation-1.png" } ); |
||||||
|
queue.loadFile( {id: "ScoreScreenFile", src:"res/screens/ScoreScreen/Score-Evaluation-2.png" } ); |
||||||
|
queue.loadFile( {id: "HelpScreenFile", src:"res/screens/HelpCreditsScreen/Credits.png" } ); |
||||||
|
|
||||||
|
queue.loadFile( {id: "MarketScreenfile", src:"res/screens/MarketScreen/MarketScreen.png"} ); |
||||||
|
|
||||||
|
// Load sound assets
|
||||||
|
queue.loadFile( {id: "TitleMusicFile", src:"res/sound/turkey_in_the_straw.mp3"} ); |
||||||
|
queue.loadFile( {id: "MarketSoundFile", src:"res/sound/Store/Waterford.mp3"} ); |
||||||
|
|
||||||
|
// UI sounds
|
||||||
|
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"}); |
||||||
|
queue.loadFile( {id: "res/screens/KitchenScreen/FinalConfirmation.png", src:"res/screens/KitchenScreen/FinalConfirmation.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/KitchenScreen/TurkeyState1Small.svg", src:"res/screens/KitchenScreen/TurkeyState1Small.svg"}); |
||||||
|
queue.loadFile( {id: "res/screens/KitchenScreen/TurkeyState2Small.svg", src:"res/screens/KitchenScreen/TurkeyState2Small.svg"}); |
||||||
|
queue.loadFile( {id: "res/screens/KitchenScreen/TurkeyState3Small.svg", src:"res/screens/KitchenScreen/TurkeyState3Small.svg"}); |
||||||
|
queue.loadFile( {id: "res/screens/KitchenScreen/TurkeyState4Small.svg", src:"res/screens/KitchenScreen/TurkeyState4Small.svg"}); |
||||||
|
queue.loadFile( {id: "res/screens/KitchenScreen/TurkeyState5Small.svg", src:"res/screens/KitchenScreen/TurkeyState5Small.svg"}); |
||||||
|
|
||||||
|
queue.loadFile( {id: "res/screens/KitchenScreen/CookbookKitchenGlow.png", src:"res/screens/KitchenScreen/CookbookKitchenGlow.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/KitchenScreen/CookbookKitchen.png", src:"res/screens/KitchenScreen/CookbookKitchen.png"}); |
||||||
|
|
||||||
|
queue.loadFile( {id: "res/screens/KitchenScreen/AlarmKitchenGlow.png", src:"res/screens/KitchenScreen/AlarmKitchenGlow.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/KitchenScreen/AlarmKitchen.png", src:"res/screens/KitchenScreen/AlarmKitchen.png"}); |
||||||
|
|
||||||
|
queue.loadFile( {id: "res/screens/KitchenScreen/TempProbeKitchenGlow.png", src:"res/screens/KitchenScreen/TempProbeKitchenGlow.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/KitchenScreen/TempProbeKitchen.png", src:"res/screens/KitchenScreen/TempProbeKitchen.png"}); |
||||||
|
|
||||||
|
queue.loadFile( {id: "res/screens/KitchenScreen/StuffingSpecialKitchenGlow.png", src:"res/screens/KitchenScreen/StuffingSpecialKitchenGlow.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/KitchenScreen/StuffingSpecialKitchen.png", src:"res/screens/KitchenScreen/StuffingSpecialKitchen.png"}); |
||||||
|
|
||||||
|
queue.loadFile( {id: "res/screens/KitchenScreen/StuffingRepurposedKitchenGlow.png", src:"res/screens/KitchenScreen/StuffingRepurposedKitchenGlow.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/KitchenScreen/StuffingRepurposedKitchen.png", src:"res/screens/KitchenScreen/StuffingRepurposedKitchen.png"}); |
||||||
|
|
||||||
|
queue.loadFile( {id: "res/screens/KitchenScreen/StuffingExquisiteKitchenGlow.png", src:"res/screens/KitchenScreen/StuffingExquisiteKitchenGlow.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/KitchenScreen/StuffingExquisiteKitchen.png", src:"res/screens/KitchenScreen/StuffingExquisiteKitchen.png"}); |
||||||
|
|
||||||
|
queue.loadFile( {id: "res/screens/KitchenScreen/StoreBrochureGlow.png", src:"res/screens/KitchenScreen/StoreBrochureGlow.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/KitchenScreen/StoreBrochure.png", src:"res/screens/KitchenScreen/StoreBrochure.png"}); |
||||||
|
|
||||||
|
queue.loadFile( {id: "res/screens/KitchenScreen/FrillsBoxKitchenGlow.png", src:"res/screens/KitchenScreen/FrillsBoxKitchenGlow.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/KitchenScreen/FrillsBoxKitchen.png", src:"res/screens/KitchenScreen/FrillsBoxKitchen.png"}); |
||||||
|
|
||||||
|
queue.loadFile( {id: "res/screens/KitchenScreen/DoorPeekLightOn.png", src:"res/screens/KitchenScreen/DoorPeekLightOn.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/KitchenScreen/DoorPeekLightOff.png", src:"res/screens/KitchenScreen/DoorPeekLightOff.png"}); |
||||||
|
|
||||||
|
queue.loadFile( {id: "res/screens/KitchenScreen/DoorOpen.png", src:"res/screens/KitchenScreen/DoorOpen.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/KitchenScreen/DoorClosedLightOn.png", src:"res/screens/KitchenScreen/DoorClosedLightOn.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/KitchenScreen/DoorClosedLightOff.png", src:"res/screens/KitchenScreen/DoorClosedLightOff.png"}); |
||||||
|
|
||||||
|
queue.loadFile( {id: "res/screens/KitchenScreen/PanFront.png", src:"res/screens/KitchenScreen/PanFront.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/KitchenScreen/OvenTurnRedState.png", src:"res/screens/KitchenScreen/OvenTurnRedState.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/KitchenScreen/LightButtonDepressed.png", src:"res/screens/KitchenScreen/LightButtonDepressed.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/KitchenScreen/Cookbook-Open.png", src:"res/screens/KitchenScreen/Cookbook-Open.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/KitchenScreen/Explosion_AnimationLowRes.png", src:"res/screens/KitchenScreen/Explosion_AnimationLowRes.png"}); |
||||||
|
|
||||||
|
|
||||||
|
// Kitchen Sounds
|
||||||
|
queue.loadFile( {id: "res/sound/Kitchen/Oven_Door_Full_Open.mp3", src:"res/sound/Kitchen/Oven_Door_Full_Open.mp3"}); |
||||||
|
queue.loadFile( {id: "res/sound/Kitchen/Oven_Door_Full_Close.mp3", src:"res/sound/Kitchen/Oven_Door_Full_Close.mp3"}); |
||||||
|
queue.loadFile( {id: "res/sound/Kitchen/Oven_Door_Peek_Close.mp3", src:"res/sound/Kitchen/Oven_Door_Peek_Close.mp3"}); |
||||||
|
queue.loadFile( {id: "res/sound/Kitchen/Oven_Door_Peek_Open.mp3", src:"res/sound/Kitchen/Oven_Door_Peek_Open.mp3"}); |
||||||
|
queue.loadFile( {id: "res/sound/Kitchen/Close_Cookbook.mp3", src:"res/sound/Kitchen/Close_Cookbook.mp3"}); |
||||||
|
queue.loadFile( {id: "res/sound/Kitchen/Open_Cookbook.mp3", src:"res/sound/Kitchen/Open_Cookbook.mp3"}); |
||||||
|
queue.loadFile( {id: "res/sound/Kitchen/sizzle.mp3", src:"res/sound/Kitchen/sizzle.mp3"} ); |
||||||
|
queue.loadFile( {id: "res/sound/Kitchen/Double_Beep.mp3", src:"res/sound/Kitchen/Double_Beep.mp3"} ); |
||||||
|
|
||||||
|
// Market Items
|
||||||
|
queue.loadFile( {id: "res/screens/MarketScreen/MarketTopShelf.png", src:"res/screens/MarketScreen/MarketTopShelf.png"}); |
||||||
|
|
||||||
|
queue.loadFile( {id: "res/items/Clipboard.png", src:"res/items/Clipboard.png"}); |
||||||
|
queue.loadFile( {id: "res/items/Wallet.png", src:"res/items/Wallet.png"}); |
||||||
|
|
||||||
|
queue.loadFile( {id: "res/items/FrillsBox.png", src:"res/items/ExitSign.png"}); |
||||||
|
queue.loadFile( {id: "res/items/FrillsBoxGlow.png", src:"res/items/ExitGlow.png"}); |
||||||
|
|
||||||
|
queue.loadFile( {id: "res/items/FrillsBox.png", src:"res/items/FrillsBox.png"}); |
||||||
|
queue.loadFile( {id: "res/items/FrillsBoxGlow.png", src:"res/items/FrillsBoxGlow.png"}); |
||||||
|
|
||||||
|
queue.loadFile( {id: "res/items/TempProbe.png", src:"res/items/TempProbe.png"}); |
||||||
|
queue.loadFile( {id: "res/items/TempProbeGlow.png", src:"res/items/TempProbeGlow.png"}); |
||||||
|
|
||||||
|
queue.loadFile( {id: "res/items/OvenLightBox.png", src:"res/items/OvenLightBox.png"}); |
||||||
|
queue.loadFile( {id: "res/items/OvenLightBoxGlow.png", src:"res/items/OvenLightBoxGlow.png"}); |
||||||
|
|
||||||
|
queue.loadFile( {id: "res/items/Alarm.png", src:"res/items/Alarm.png"}); |
||||||
|
queue.loadFile( {id: "res/items/AlarmGlow.png", src:"res/items/AlarmGlow.png"}); |
||||||
|
|
||||||
|
queue.loadFile( {id: "res/items/Cookbook1.png", src:"res/items/Cookbook1.png"}); |
||||||
|
queue.loadFile( {id: "res/items/Cookbook1Glow.png", src:"res/items/Cookbook1Glow.png"}); |
||||||
|
|
||||||
|
queue.loadFile( {id: "res/items/StuffingRepurposed.png", src:"res/items/StuffingRepurposed.png"}); |
||||||
|
queue.loadFile( {id: "res/items/StuffingRepurposedGlow.png", src:"res/items/StuffingRepurposedGlow.png"}); |
||||||
|
|
||||||
|
queue.loadFile( {id: "res/items/StuffingExquisite.png", src:"res/items/StuffingExquisite.png"}); |
||||||
|
queue.loadFile( {id: "res/items/StuffingExquisiteGlow.png", src:"res/items/StuffingExquisiteGlow.png"}); |
||||||
|
|
||||||
|
queue.loadFile( {id: "res/items/StuffingSpecial.png", src:"res/items/StuffingSpecial.png"}); |
||||||
|
queue.loadFile( {id: "res/items/StuffingSpecialGlow.png", src:"res/items/StuffingSpecialGlow.png"}); |
||||||
|
|
||||||
|
queue.loadFile( {id: "res/items/Turkey5.png", src:"res/items/Turkey5.png"}); |
||||||
|
queue.loadFile( {id: "res/items/Turkey5Glow.png", src:"res/items/Turkey5Glow.png"}); |
||||||
|
|
||||||
|
queue.loadFile( {id: "res/items/Turkey4.png", src:"res/items/Turkey4.png"}); |
||||||
|
queue.loadFile( {id: "res/items/Turkey4Glow.png", src:"res/items/Turkey4Glow.png"}); |
||||||
|
|
||||||
|
queue.loadFile( {id: "res/items/Turkey3.png", src:"res/items/Turkey3.png"}); |
||||||
|
queue.loadFile( {id: "res/items/Turkey3Glow.png", src:"res/items/Turkey3Glow.png"}); |
||||||
|
|
||||||
|
queue.loadFile( {id: "res/items/Turkey2.png", src:"res/items/Turkey2.png"}); |
||||||
|
queue.loadFile( {id: "res/items/Turkey2Glow.png", src:"res/items/Turkey2Glow.png"}); |
||||||
|
|
||||||
|
queue.loadFile( {id: "res/items/Turkey1.png", src:"res/items/Turkey1.png"}); |
||||||
|
queue.loadFile( {id: "res/items/Turkey1Glow.png", src:"res/items/Turkey1Glow.png"}); |
||||||
|
|
||||||
|
// People photos
|
||||||
|
queue.loadFile( {id: "res/people/Boyfriend.png", src:"res/people/Boyfriend.png"}); |
||||||
|
queue.loadFile( {id: "res/people/Brother.png", src:"res/people/Brother.png"}); |
||||||
|
queue.loadFile( {id: "res/people/Cat.png", src:"res/people/Cat.png"}); |
||||||
|
queue.loadFile( {id: "res/people/Dad.png", src:"res/people/Dad.png"}); |
||||||
|
queue.loadFile( {id: "res/people/Girlfriend.png", src:"res/people/Girlfriend.png"}); |
||||||
|
queue.loadFile( {id: "res/people/Grandma.png", src:"res/people/Grandma.png"}); |
||||||
|
queue.loadFile( {id: "res/people/Grandpa.png", src:"res/people/Grandpa.png"}); |
||||||
|
queue.loadFile( {id: "res/people/Mom.png", src:"res/people/Mom.png"}); |
||||||
|
queue.loadFile( {id: "res/people/PlayerFemale.png", src:"res/people/PlayerFemale.png"}); |
||||||
|
queue.loadFile( {id: "res/people/PlayerMale.png", src:"res/people/PlayerMale.png"}); |
||||||
|
queue.loadFile( {id: "res/people/TurkeyGhost.png", src:"res/people/TurkeyGhost.png"}); |
||||||
|
|
||||||
|
// Load Window elements
|
||||||
|
queue.loadFile( {id: "res/screens/Window/Door1.png", src:"res/screens/Window/Door1.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/Window/Door2.png", src:"res/screens/Window/Door2.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/Window/Ground.png", src:"res/screens/Window/Ground.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/Window/Housefar.png", src:"res/screens/Window/Housefar.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/Window/Small1.png", src:"res/screens/Window/Small1.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/Window/Small2.png", src:"res/screens/Window/Small2.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/Window/Small3.png", src:"res/screens/Window/Small3.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/Window/Small4.png", src:"res/screens/Window/Small4.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/Window/Small5.png", src:"res/screens/Window/Small5.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/Window/StreetlightGlow.png", src:"res/screens/Window/StreetlightGlow.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/Window/Win1.png", src:"res/screens/Window/Win1.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/Window/Win2.png", src:"res/screens/Window/Win2.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/Window/Win3.png", src:"res/screens/Window/Win3.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/Window/Win4.png", src:"res/screens/Window/Win4.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/Window/Win5.png", src:"res/screens/Window/Win5.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/Window/Win6.png", src:"res/screens/Window/Win6.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/Window/Win7.png", src:"res/screens/Window/Win7.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/Window/Win8.png", src:"res/screens/Window/Win8.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/Window/Win9.png", src:"res/screens/Window/Win9.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/Window/Win10.png", src:"res/screens/Window/Win10.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/Window/Win11.png", src:"res/screens/Window/Win11.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/Window/Tree_Animation.png", src:"res/screens/Window/Tree_Animation.png"}); |
||||||
|
queue.loadFile( {id: "res/screens/Window/Test4TransparencyFull.svg", src:"res/screens/Window/Test4TransparencyFull.svg"}); |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
this.screenState = 0; |
||||||
|
this.newScreen = ""; |
||||||
|
|
||||||
|
this.marketItems = { |
||||||
|
"Frills Box" : new MarketItem( this, "Frills Box", 133,92, 3.00, "res/items/FrillsBox.png", "res/items/FrillsBoxGlow.png", "res/screens/KitchenScreen/FrillsBoxKitchen.png", "res/screens/KitchenScreen/FrillsBoxKitchenGlow.png", |
||||||
|
"Some people dress up their dogs. Others dress up their house. Why not dress up your turkey?" ), |
||||||
|
|
||||||
|
|
||||||
|
"Temperature Probe" : new MarketItem( this, "Temperature Probe", 200, 57, 9.00, "res/items/TempProbe.png", "res/items/TempProbeGlow.png", "res/screens/KitchenScreen/TempProbeKitchen.png", "res/screens/KitchenScreen/TempProbeKitchenGlow.png", "Ensure your food is cooked with this handy thermometer. Now with easy to read LED display" ), |
||||||
|
"Oven Light in a Box" : new MarketItem( this, "Oven Light in a Box", 131,222, 15.00, "res/items/OvenLightBox.png", "res/items/OvenLightBoxGlow.png", null,null, "This will allow checking on your turkey without letting the heat out." ), |
||||||
|
|
||||||
|
"Alarm Clock" : new MarketItem( this, "Alarm Clock", 173,248, 6.00, "res/items/Alarm.png", "res/items/AlarmGlow.png", "res/screens/KitchenScreen/AlarmKitchen.png", "res/screens/KitchenScreen/AlarmKitchenGlow.png", "Have you ever wanted to control time? Now you can. Digital readout counts down until time of choice. Audible alarm" ), |
||||||
|
"Cookbook" : new MarketItem( this, "Cookbook", 283,203, 3.00, "res/items/Cookbook1.png", "res/items/Cookbook1Glow.png","res/screens/KitchenScreen/CookbookKitchen.png", "res/screens/KitchenScreen/CookbookKitchenGlow.png", "How do I cook turkey? Handy note space included for writing down temperature measurements" ), |
||||||
|
"Repurposed Stuffing" : new MarketItem( this, "Repurposed Stuffing", 510,197, 2.00, "res/items/StuffingRepurposed.png", "res/items/StuffingRepurposedGlow.png", "res/screens/KitchenScreen/StuffingRepurposedKitchen.png", "res/screens/KitchenScreen/StuffingRepurposedKitchenGlow.png","At least 80% original breadcrumb. Guaranteed to contain no avian products" ), |
||||||
|
"Exquisite Stuffing" : new MarketItem( this, "Exquisite Stuffing", 458,210, 3.00, "res/items/StuffingExquisite.png", "res/items/StuffingExquisiteGlow.png", "res/screens/KitchenScreen/StuffingExquisiteKitchen.png","res/screens/KitchenScreen/StuffingExquisiteKitchenGlow.png", "Colonial merchants once traveled the four reaches of the Earth to bring back the ingredients contained in this very box" ), |
||||||
|
|
||||||
|
"Special Stuffing" : new MarketItem( this, "Special Stuffing", 390,220, 6.00, "res/items/StuffingSpecial.png", "res/items/StuffingSpecialGlow.png", |
||||||
|
"res/screens/KitchenScreen/StuffingSpecialKitchen.png","res/screens/KitchenScreen/StuffingSpecialKitchenGlow.png", |
||||||
|
"Once rated as the most handsome man in the universe. Scott and his patented special stuffing will set you on the path to food heaven" ), |
||||||
|
|
||||||
|
"Organic Turkey" : new MarketItem( this, "Organic Turkey", 180,360, randomWeight[0]*1.2, "res/items/Turkey5.png", "res/items/Turkey5Glow.png",null,null, "All natural. No hormones. No antibiotics. Free Range. Lead Free", parseFloat(randomWeight[0]) ), |
||||||
|
"Free Range Turkey": new MarketItem( this, "Free Range Turkey", 540,320, randomWeight[1]*1.00, "res/items/Turkey4.png", "res/items/Turkey4Glow.png",null,null, "Our turkeys have wide open spaces to roam and are fed with only the highest quality feed.", parseFloat(randomWeight[1]) ), |
||||||
|
"Sunny Farms Turkey" : new MarketItem( this, "Sunny Farms Turkey", 265,415, randomWeight[2]*0.60, "res/items/Turkey3.png", "res/items/Turkey3Glow.png",null,null, "100% Turkey product from Sunny Farms Heavy Industries, Ltd.", parseFloat(randomWeight[2]) ), |
||||||
|
"Pastured Turkey": new MarketItem( this, "Pastured Turkey", 474,357, randomWeight[3]*1.4, "res/items/Turkey2.png", "res/items/Turkey2Glow.png",null,null, "Grassy fields and natural ingredients allow our turkeys to have a better life, and taste great.", parseFloat(randomWeight[3]) ), |
||||||
|
"General Turkey": new MarketItem( this, "General Turkey", 378,426, randomWeight[4]*0.80, "res/items/Turkey1.png", "res/items/Turkey1Glow.png",null,null, "100% General Satisfaction Guaranteed", parseFloat(randomWeight[4]) ) |
||||||
|
}; |
||||||
|
|
||||||
|
// Important Model, dummy placeholder
|
||||||
|
this.ovenModel = { secondTick:function(){}, setRawTemp:function(){}, getRawTemp:function(){}, getCookTime:function(){return 1000;} }; |
||||||
|
|
||||||
|
|
||||||
|
/* all turkeys */ |
||||||
|
this.turkeyStates = [ |
||||||
|
new createjs.Bitmap( "res/screens/KitchenScreen/TurkeyState1Small.svg" ), |
||||||
|
new createjs.Bitmap( "res/screens/KitchenScreen/TurkeyState2Small.svg" ), |
||||||
|
new createjs.Bitmap( "res/screens/KitchenScreen/TurkeyState3Small.svg" ), |
||||||
|
new createjs.Bitmap( "res/screens/KitchenScreen/TurkeyState4Small.svg" ), |
||||||
|
new createjs.Bitmap( "res/screens/KitchenScreen/TurkeyState5Small.svg" ) |
||||||
|
]; |
||||||
|
|
||||||
|
this.purchasedItems = []; |
||||||
|
|
||||||
|
// did we already show the player the kitchen intro?
|
||||||
|
this.kitchenIntro = false; |
||||||
|
|
||||||
|
this.addRecord = function( record ){ |
||||||
|
that.peekRecords.push( new Record( record.type, that.currentTime, record.text ) ); |
||||||
|
} |
||||||
|
that.pubsub.subscribe( "AddRecord", this.addRecord ); |
||||||
|
|
||||||
|
|
||||||
|
function addHighScore(name, turkeyPoundage, cookTime, score){ |
||||||
|
var scores = {}; |
||||||
|
var now = new Date(); |
||||||
|
if( !localStorage.getItem("highScores") ){ |
||||||
|
scores = JSON.parse( localStorage.getItem("highScores") ); |
||||||
|
} |
||||||
|
|
||||||
|
scores[now.getYear()+"/"+now.getMonth()+"/"+now.getDay()] = { |
||||||
|
"name" : name, |
||||||
|
"weight" : turkeyPoundage, |
||||||
|
"cookTime" : cookTime, |
||||||
|
"score" : score |
||||||
|
}; |
||||||
|
|
||||||
|
localStorage.setItem("highScores", JSON.stringfy(scores)); |
||||||
|
} |
||||||
|
|
||||||
|
function gameLoop(){ |
||||||
|
that.mainUI.draw(); |
||||||
|
} |
||||||
|
|
||||||
|
return { |
||||||
|
// "main": this
|
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
function GameUI( canvasElem, gameState ){ |
||||||
|
var that = this; |
||||||
|
|
||||||
|
var SCREEN_OUT = 1; |
||||||
|
var SCREEN_IN = 2; |
||||||
|
var SCREEN_STABLE = 0; |
||||||
|
|
||||||
|
this.stage = new createjs.Stage( canvasElem ); |
||||||
|
this.stage.enableMouseOver(25); |
||||||
|
|
||||||
|
this.activeScreenName = "EndingScreen"; |
||||||
|
this.activeScreenObj = {}; |
||||||
|
|
||||||
|
/* Initialize All Screens */ |
||||||
|
this.screens = { |
||||||
|
"LoadingScreen" : LoadingScreen, |
||||||
|
"MainScreen" : MainScreen, |
||||||
|
"DifficultyScreen" : DifficultyScreen, |
||||||
|
"KitchenScreen" : KitchenScreen, |
||||||
|
"MarketScreen" : MarketScreen, |
||||||
|
"ScoreScreen" : ScoreScreen, |
||||||
|
"CreditsScreen" : CreditsScreen |
||||||
|
} |
||||||
|
|
||||||
|
var soundManager = new SoundManager( gameState ); |
||||||
|
|
||||||
|
this.activeScreenObj = new LoadingScreen( this.stage, gameState ); |
||||||
|
var textContent = new createjs.Text( "", "20px Arial", "black" ); |
||||||
|
textContent.x = 750; |
||||||
|
textContent.y = 30; |
||||||
|
//this.stage.addChild( textContent);
|
||||||
|
var overlay = new createjs.Shape(); |
||||||
|
overlay.graphics.beginFill("#fffffff").drawRect(0, 0, 800, 600 ); |
||||||
|
overlay.alpha = 0; |
||||||
|
this.stage.addChild(overlay); |
||||||
|
|
||||||
|
var dialogManager = new DialogUI( this.stage, gameState ); |
||||||
|
|
||||||
|
// delay for fade in and fade-out
|
||||||
|
this.switchScreen = function( screenName ){ |
||||||
|
gameState.screenState = SCREEN_OUT; |
||||||
|
dialogManager.minDialog(); |
||||||
|
if(DEBUG) console.log("Switch screen called with" + screenName); |
||||||
|
gameState.newScreen = screenName; |
||||||
|
}; |
||||||
|
this.actuallySwitchScreen = function( screenName ){ |
||||||
|
that.stage.removeAllChildren(); |
||||||
|
that.activeScreenObj = new that.screens[ screenName ]( that.stage, gameState ); |
||||||
|
//that.stage.addChild( textContent );
|
||||||
|
that.stage.addChild( overlay ); |
||||||
|
dialogManager.render(); |
||||||
|
}; |
||||||
|
new HelpUI(this.stage, gameState); |
||||||
|
|
||||||
|
gameState.pubsub.subscribe( "SwitchScreen", this.switchScreen ); |
||||||
|
gameState.pubsub.subscribe( "ActuallySwitchScreen", this.actuallySwitchScreen ); |
||||||
|
|
||||||
|
// Allow items to be removed if they don't have access to stage
|
||||||
|
gameState.pubsub.subscribe( "RemoveItems", function(items){ |
||||||
|
for (var index in items ){ |
||||||
|
that.stage.removeChild(items[index]); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
return { |
||||||
|
draw : function(){ |
||||||
|
if( gameState.screenState == SCREEN_OUT ){ |
||||||
|
overlay.alpha +=0.3; |
||||||
|
} |
||||||
|
if( gameState.screenState == SCREEN_IN ){ |
||||||
|
overlay.alpha -=0.3; |
||||||
|
} |
||||||
|
if( overlay.alpha > 1.0 ){ |
||||||
|
gameState.screenState = SCREEN_IN; |
||||||
|
overlay.alpha = 1; |
||||||
|
gameState.pubsub.publish( "ActuallySwitchScreen", gameState.newScreen ); |
||||||
|
} |
||||||
|
if( overlay.alpha < 0.0 ){ |
||||||
|
gameState.screenState = SCREEN_STABLE; |
||||||
|
overlay.alpha = 0; |
||||||
|
} |
||||||
|
soundManager.tick(); |
||||||
|
that.activeScreenObj.blit(); |
||||||
|
dialogManager.tick(); |
||||||
|
textContent.text = createjs.Ticker.getMeasuredFPS().toFixed(1); |
||||||
|
that.stage.update(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
function Record( type, dateTime, record ){ |
||||||
|
return { |
||||||
|
getTime: function(){ |
||||||
|
return dateTime; |
||||||
|
}, |
||||||
|
getContent: function(){ |
||||||
|
return record; |
||||||
|
}, |
||||||
|
getType: function(){ |
||||||
|
return type; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
//"Turkey weight, "
|
||||||
|
//"Opened oven for X seconds"
|
||||||
|
//"Core temperature measured at "
|
||||||
|
|
||||||
|
|
||||||
|
function BindPubSub( obj ){ |
||||||
|
(function(q) { |
||||||
|
var topics = {}, subUid = -1; |
||||||
|
q.subscribe = function(topic, func) { |
||||||
|
if (!topics[topic]) { |
||||||
|
topics[topic] = []; |
||||||
|
} |
||||||
|
var token = (++subUid).toString(); |
||||||
|
topics[topic].push({ |
||||||
|
token: token, |
||||||
|
func: func |
||||||
|
}); |
||||||
|
return token; |
||||||
|
}; |
||||||
|
|
||||||
|
q.publish = function(topic, args) { |
||||||
|
if (!topics[topic]) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
setTimeout(function() { |
||||||
|
var subscribers = topics[topic], |
||||||
|
len = subscribers ? subscribers.length : 0; |
||||||
|
|
||||||
|
while (len--) { |
||||||
|
subscribers[len].func(args); |
||||||
|
} |
||||||
|
}, 0); |
||||||
|
return true; |
||||||
|
|
||||||
|
}; |
||||||
|
|
||||||
|
q.unsubscribe = function(token) { |
||||||
|
for (var m in topics) { |
||||||
|
if (topics[m]) { |
||||||
|
for (var i = 0, j = topics[m].length; i < j; i++) { |
||||||
|
if (topics[m][i].token === token) { |
||||||
|
topics[m].splice(i, 1); |
||||||
|
return token; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
return false; |
||||||
|
}; |
||||||
|
}(obj)); |
||||||
|
} |
@ -0,0 +1,329 @@ |
|||||||
|
function TurkeyLayer( name, percentRadius, turkeyModel, ovenModel ){ |
||||||
|
var that = this; |
||||||
|
|
||||||
|
this.name = name; |
||||||
|
this.percentRadius=percentRadius; |
||||||
|
this.initialTemp = 20; |
||||||
|
this.waterLost = 0; |
||||||
|
this.finalTemperature = 20; |
||||||
|
this.cookCondition = "Raw";
|
||||||
|
|
||||||
|
return { |
||||||
|
updateTemperatureTick: function(){ |
||||||
|
that.finalTemperature = UtilityFunctions.transientSphereSeries( turkeyModel.density, |
||||||
|
turkeyModel.thermalConduct, |
||||||
|
turkeyModel.heatConvection, |
||||||
|
turkeyModel.cp, |
||||||
|
percentRadius * turkeyModel.totalRadius, |
||||||
|
turkeyModel.totalRadius, |
||||||
|
that.initialTemp, |
||||||
|
ovenModel.steadyTemp, |
||||||
|
ovenModel.globalTime ); |
||||||
|
that.waterLost = that.waterLost + UtilityFunctions.waterLoss( that.finalTemperature ); |
||||||
|
that.cookCondition = UtilityFunctions.cookCondition(that.waterLost); |
||||||
|
if(DEBUG) console.log( that.name + ": "+ that.waterLost + " " + that.cookCondition); |
||||||
|
}, |
||||||
|
resetLayerTemps: function(){ |
||||||
|
that.initialTemp = that.finalTemperature; |
||||||
|
}, |
||||||
|
getCondition: function(){ |
||||||
|
return that.cookCondition; |
||||||
|
}, |
||||||
|
getTemperature: function(){ |
||||||
|
return that.finalTemperature; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
function TurkeyModel( weight, ovenModel ){ |
||||||
|
this.density = 1050; // kg/m3 Assuming Density of Water 1000 kg/m3
|
||||||
|
this.cp = 2000; // 2810 J/kg K for Turkey. Extra is to semi-account for water evaporation energy
|
||||||
|
this.heatConvection = 9; // W/m2 K Some Reasonable estimate for natural Convection. Change as needed. 5-25
|
||||||
|
this.thermalConduct = 0.412; // W/m K // Chicken
|
||||||
|
this.skin = {}; |
||||||
|
this.body = {}; |
||||||
|
this.core = {}; |
||||||
|
|
||||||
|
this.totalRadius = UtilityFunctions.calculateRadius( weight, this.density ); |
||||||
|
|
||||||
|
|
||||||
|
this.totalLayers = [ new TurkeyLayer("Skin", 0.85, this, ovenModel ), |
||||||
|
new TurkeyLayer("Body", 0.45, this, ovenModel ), |
||||||
|
new TurkeyLayer("Core", 0.01, this, ovenModel ) ]; |
||||||
|
|
||||||
|
// Whenever temperature is changed
|
||||||
|
this.updateLayerTemps = function(){ |
||||||
|
for (var i in this.totalLayers ){ |
||||||
|
this.totalLayers[i].updateTemperatureTick(); |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
this.resetLayerTemps = function(){ |
||||||
|
for (var i in this.totalLayers ){ |
||||||
|
this.totalLayers[i].resetLayerTemps(); |
||||||
|
} |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
function OvenModel( turkeyWeight, gameState ) { |
||||||
|
var that = this; |
||||||
|
this.tempInfini=20; //C
|
||||||
|
this.setTemp = 20; |
||||||
|
this.steadyTemp = 20; |
||||||
|
this.steadyTimer = 0; |
||||||
|
this.globalTime = 0; |
||||||
|
|
||||||
|
var turkey = new TurkeyModel(9.07185, this ); |
||||||
|
|
||||||
|
var proportional = 0.004; // This value is arbitrary to how fast you want the temperatures to converge. (Or oscillate, which could be realistic as well)
|
||||||
|
var errorTolerance = 10; //Stove is accurate to 1 degree Celcius Should hopefully oscillate below that value.
|
||||||
|
// Equalize temp will need to be sent each time iteration
|
||||||
|
this.equalizeTemp= function(){ |
||||||
|
var error = Math.abs(this.setTemp-this.tempInfini); |
||||||
|
if( this.setTemp>this.tempInfini ){ |
||||||
|
this.tempInfini = this.tempInfini + error*proportional; |
||||||
|
} |
||||||
|
else if( this.setTemp<this.tempInfini ){ |
||||||
|
this.tempInfini = this.tempInfini - error*proportional; |
||||||
|
} |
||||||
|
|
||||||
|
if( error>errorTolerance ) { |
||||||
|
if (this.steadyTimer>=80) { |
||||||
|
//Reset the model's time calculation if there are major changes in the tolerance of the temperature or the steady timer expires
|
||||||
|
this.steadyTimer = 0; |
||||||
|
this.globalTime = 0; |
||||||
|
this.steadyTemp = this.tempInfini |
||||||
|
turkey.resetLayerTemps(); |
||||||
|
} |
||||||
|
return(true); |
||||||
|
} |
||||||
|
} |
||||||
|
return { |
||||||
|
getTurkeyState: function(){ |
||||||
|
return { |
||||||
|
"skin" : { |
||||||
|
"temp": turkey.totalLayers[0].getTemperature(), |
||||||
|
"cond": turkey.totalLayers[0].getCondition() |
||||||
|
}, |
||||||
|
"body" : { |
||||||
|
"temp": turkey.totalLayers[1].getTemperature(), |
||||||
|
"cond": turkey.totalLayers[1].getCondition() |
||||||
|
}, |
||||||
|
"core" : { |
||||||
|
"temp": turkey.totalLayers[2].getTemperature(), |
||||||
|
"cond": turkey.totalLayers[2].getCondition() |
||||||
|
} |
||||||
|
}; |
||||||
|
}, |
||||||
|
changeTemp: function(setTemp){ |
||||||
|
if(DEBUG) console.log("temp changed to " + setTemp); |
||||||
|
that.setTemp = setTemp; |
||||||
|
}, |
||||||
|
// set the tempInfini
|
||||||
|
setRawTemp: function(newTemp){ |
||||||
|
if(DEBUG) console.log("raw temp changed to" + that.tempInfini); |
||||||
|
that.tempInfini = newTemp; |
||||||
|
}, |
||||||
|
getRawTemp: function(){ |
||||||
|
return that.tempInfini; |
||||||
|
}, |
||||||
|
getCookTime: function(){ |
||||||
|
return that.globalTime; |
||||||
|
}, |
||||||
|
secondTick: function(){ |
||||||
|
that.globalTime = that.globalTime + 1; |
||||||
|
that.steadyTimer = that.steadyTimer + 1; |
||||||
|
if ( that.equalizeTemp() ) { |
||||||
|
|
||||||
|
// Turn on oven light
|
||||||
|
gameState.pubsub.publish( "OvenLight", "On" ); |
||||||
|
} |
||||||
|
else { |
||||||
|
that.steadyTemp = that.tempInfini; |
||||||
|
// Turn off oven light
|
||||||
|
gameState.pubsub.publish( "OvenLight", "Off" ); |
||||||
|
} |
||||||
|
if(DEBUG) console.log("Steady Temp " + that.steadyTemp) |
||||||
|
if(DEBUG) console.log("Steady Timer " + that.steadyTimer) |
||||||
|
if(DEBUG) console.log("Oven Temp " + that.tempInfini ) |
||||||
|
turkey.updateLayerTemps(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
UtilityFunctions = { |
||||||
|
|
||||||
|
// Cache the lambda if the Biot number does not change, to avoid expensive root-finding operations
|
||||||
|
cachedBiot: null, |
||||||
|
cachedLambda: null, |
||||||
|
|
||||||
|
// Using Ratios for a rectangular Box Turkey
|
||||||
|
calculateRadius: function(weight, density) { |
||||||
|
|
||||||
|
var ratioLvG=1.4; //1.4, Turkey length vs shoulder girth
|
||||||
|
var ratioLvH=2; //2, Turkey length vs height from resting position
|
||||||
|
|
||||||
|
var length = Math.pow(weight/((1/ratioLvG)*(1/ratioLvH)*density),(1/3)) |
||||||
|
var depth = 1/(ratioLvG /length); |
||||||
|
var height = 1/(ratioLvH /length); |
||||||
|
var simpleRadius = length/2; //Doesn't take into account equal Volume
|
||||||
|
|
||||||
|
var rectangleVolume = depth*height*length; //m^3 Multiple by 1/4 to account for triangular shape and empty Space
|
||||||
|
var complexRadius = Math.pow(rectangleVolume/((4/3)*Math.PI), 1/3); //Volume of 3D Box = 3D Sphere
|
||||||
|
|
||||||
|
//if(DEBUG) console.log("Simple Radius " + simpleRadius + " Meters")
|
||||||
|
//if(DEBUG) console.log("Complex Radius " + complexRadius + " Meters")
|
||||||
|
return complexRadius; |
||||||
|
}, |
||||||
|
|
||||||
|
findAllRoots: function(min,max,splitsNum,Biot) { |
||||||
|
var step = ( max - min ) / ( splitsNum - 1 ); |
||||||
|
var answer; |
||||||
|
var negativeTest; |
||||||
|
var storage = []; |
||||||
|
for (var i = step; i < max; i=i+step ) { |
||||||
|
negativeTest = this.lambdaFormula(i-step, Biot)*this.lambdaFormula(i, Biot); |
||||||
|
if (negativeTest <= 0) { |
||||||
|
answer = this.bisectionMethod(i-step,i,Biot); |
||||||
|
if (answer !=undefined) { |
||||||
|
storage.push(answer); |
||||||
|
} |
||||||
|
} |
||||||
|
else { |
||||||
|
//if(DEBUG) console.log("No Bracketed Root " + negativeTest)
|
||||||
|
} |
||||||
|
} |
||||||
|
return storage; |
||||||
|
}, |
||||||
|
|
||||||
|
sphereVolume: function(radius) { |
||||||
|
return((4/3)*Math.PI*Math.pow(radius,3)) |
||||||
|
}, |
||||||
|
|
||||||
|
waterLoss: function(temperature) { |
||||||
|
return (Math.pow(10,(temperature-20)/80)-1) |
||||||
|
}, |
||||||
|
|
||||||
|
|
||||||
|
bisectionMethod: function(min,max,Biot) { |
||||||
|
errorTolerance = (1/Math.pow(10,8)) |
||||||
|
result = Infinity // some large value to ensure the calculation goes through.
|
||||||
|
negativeTest =this.lambdaFormula(min, Biot)*this.lambdaFormula(max, Biot) |
||||||
|
if (negativeTest <=0 ) { |
||||||
|
var antiFreeze=0; |
||||||
|
while (Math.abs(result) > errorTolerance && antiFreeze<=500) { //The greater the antiFreeze, the more wasted cycles around a singularity
|
||||||
|
lambdaN = (min+max)/2 |
||||||
|
result=this.lambdaFormula(lambdaN, Biot) |
||||||
|
if (Math.abs(result) <= errorTolerance && result<=errorTolerance) { |
||||||
|
return (lambdaN); //At Root
|
||||||
|
} |
||||||
|
else if ((this.lambdaFormula(min, Biot)*this.lambdaFormula(lambdaN, Biot))>=0) { |
||||||
|
min=lambdaN; |
||||||
|
} |
||||||
|
else if ((this.lambdaFormula(max, Biot)*this.lambdaFormula(lambdaN, Biot))>=0) { |
||||||
|
max=lambdaN; |
||||||
|
} |
||||||
|
antiFreeze++ |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
|
||||||
|
lambdaFormula: function( lambdaN, Biot ) { |
||||||
|
var result = 1-lambdaN*(1/Math.tan(lambdaN))-Biot; |
||||||
|
return(result) |
||||||
|
}, |
||||||
|
|
||||||
|
transientSphereSeries: function( density, thermalConduct, heatConvection, cp, rPosition, rTotal, tempInitial, tempInfini, t ){ |
||||||
|
var min = 0; |
||||||
|
var max = 10000; // This are for setting Lambda boundaries and nothing else
|
||||||
|
|
||||||
|
var sum=0; |
||||||
|
var alpha = thermalConduct/(density*cp); |
||||||
|
var lambdaN; |
||||||
|
var sinPortion; |
||||||
|
var exponentialPortion; |
||||||
|
var frontCoefficientPortion; |
||||||
|
|
||||||
|
|
||||||
|
//if(DEBUG) console.log("Alpha is " + alpha)
|
||||||
|
|
||||||
|
var Fourier = (alpha*t)/Math.pow(rTotal,2) |
||||||
|
//if(DEBUG) console.log("Fourier is " + Fourier)
|
||||||
|
|
||||||
|
var biotNum = heatConvection * rTotal/thermalConduct |
||||||
|
|
||||||
|
if ( biotNum != this.cachedBiot ) { |
||||||
|
if(DEBUG) console.log("Recalculating Lambda Terms") |
||||||
|
this.cachedLambda = this.findAllRoots(min,max,max*Math.PI*10,biotNum) |
||||||
|
this.cachedBiot = biotNum; |
||||||
|
} |
||||||
|
|
||||||
|
//if(DEBUG) console.log("The Biot Value is " + biotNum)
|
||||||
|
|
||||||
|
for (var i = 0; i<this.cachedLambda.length; i++) { |
||||||
|
var lambdaN = this.cachedLambda[i]; |
||||||
|
var sinPortion= Math.sin(lambdaN*rPosition/rTotal)/(lambdaN*rPosition/rTotal); |
||||||
|
var exponentialPortion = (1/Math.exp(Math.pow(lambdaN,2)*Fourier)); |
||||||
|
var frontCoefficientPortion = 4*(Math.sin(lambdaN)-(lambdaN*Math.cos(lambdaN)))/ (2*lambdaN-Math.sin(2*lambdaN)); |
||||||
|
sum = frontCoefficientPortion*exponentialPortion*sinPortion + sum; |
||||||
|
} |
||||||
|
|
||||||
|
tempAtTimeAndRadius=(sum*(tempInitial-tempInfini))+tempInfini |
||||||
|
|
||||||
|
if(DEBUG) console.log("The Temperature at radius " + rPosition + " m and time " + t/60/60 + " hours is " + tempAtTimeAndRadius + " C or " + this.C2F(tempAtTimeAndRadius) + " F"); |
||||||
|
return(tempAtTimeAndRadius) |
||||||
|
}, |
||||||
|
|
||||||
|
/* Utility Functions */ |
||||||
|
C2F: function( celsius ){ |
||||||
|
return ( (celsius*(9/5)) + 32 ); |
||||||
|
}, |
||||||
|
F2C: function( farenheit ) { |
||||||
|
return ( (farenheit-32) *(5/9) ); |
||||||
|
}, |
||||||
|
lbs2kgs: function(pounds){ |
||||||
|
return pounds * 0.453592 |
||||||
|
}, |
||||||
|
randRange: function(min, max){ |
||||||
|
return Math.floor(Math.random()*(max-min+1))+min; |
||||||
|
}, |
||||||
|
cookCondition: function(cookValue,volume){ |
||||||
|
var multiplier = 1; |
||||||
|
if (cookValue>=multiplier*600000) { |
||||||
|
return ["Fire", (cookValue-600000)/(multiplier*600000),"fire"]; |
||||||
|
} |
||||||
|
else if(cookValue>=multiplier*250000) { |
||||||
|
return ["Burnt", (cookValue-250000)/(multiplier*600000), "burnt"]; |
||||||
|
} |
||||||
|
else if (cookValue>=multiplier*150000) { |
||||||
|
return ["Dry", (cookValue-150000)/(multiplier*250000), "dry"]; |
||||||
|
} |
||||||
|
else if (cookValue>=multiplier*85000){ |
||||||
|
return ["Cooked", (cookValue-12000)/(multiplier*150000), "overcooked"]; |
||||||
|
} |
||||||
|
else if (cookValue>=multiplier*12000) { |
||||||
|
return ["Cooked", (cookValue-12000)/(multiplier*150000), "cooked"]; |
||||||
|
} |
||||||
|
else if (cookValue>=multiplier*10000){ |
||||||
|
return ["Undercooked", (cookValue-5000)/(multiplier*12000), "slightly cooked"]; |
||||||
|
} |
||||||
|
else if (cookValue>=multiplier*5000) { |
||||||
|
return ["Undercooked", (cookValue-5000)/(multiplier*12000), "undercooked"]; |
||||||
|
} |
||||||
|
else { |
||||||
|
return ["Raw", 1, "raw"]; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
//Running the Program Stuff
|
||||||
|
/* |
||||||
|
var ovenObject = new OvenModel(); |
||||||
|
var turkey = new TurkeyModel(9.07185, ovenObject ); |
||||||
|
|
||||||
|
globalTime=0; |
||||||
|
setInterval(function(){ovenObject.secondTick();},10); |
||||||
|
*/ |
@ -0,0 +1,657 @@ |
|||||||
|
/* Screens, inheritance would be nice */ |
||||||
|
function LoadingScreen( stage, gameState ){ |
||||||
|
var that = this; |
||||||
|
this.lastPercent = -1; |
||||||
|
this.picture = new createjs.Bitmap( "res/screens/LoadingScreen/Loading-Title.png" ); |
||||||
|
this.pictureFront = new createjs.Bitmap( "res/screens/LoadingScreen/PanFront.png" ); |
||||||
|
this.cooking = new createjs.Bitmap( "res/screens/LoadingScreen/TextCooking.png" ); |
||||||
|
this.done = new createjs.Bitmap( "res/screens/LoadingScreen/TextDone.png" ); |
||||||
|
this.turkeyState = [ new createjs.Bitmap( "res/screens/LoadingScreen/Turkey0.png" ), |
||||||
|
new createjs.Bitmap( "res/screens/LoadingScreen/Turkey25.png" ), |
||||||
|
new createjs.Bitmap( "res/screens/LoadingScreen/Turkey50.png" ), |
||||||
|
new createjs.Bitmap( "res/screens/LoadingScreen/Turkey75.png" ), |
||||||
|
new createjs.Bitmap( "res/screens/LoadingScreen/TurkeyDone.png" ) ]; |
||||||
|
|
||||||
|
this.done.alpha= 0; |
||||||
|
stage.addChild( this.picture ); |
||||||
|
stage.addChild( this.cooking ); |
||||||
|
stage.addChild( this.done ); |
||||||
|
stage.addChild( this.turkeyState[0] ); |
||||||
|
|
||||||
|
var textContent = new createjs.Text( "0 %", "25px Arial", "black" ); |
||||||
|
textContent.x = 500; |
||||||
|
textContent.y = 20; |
||||||
|
stage.addChild( textContent); |
||||||
|
|
||||||
|
gameState.pubsub.subscribe( "Load", function(percent){ |
||||||
|
textContent.text = (percent * 25).toFixed(2) + " %"; |
||||||
|
var wholeNum = percent.toFixed(0); |
||||||
|
if( that.lastPercent != percent){ |
||||||
|
that.lastPercent = percent; |
||||||
|
stage.addChild( that.turkeyState[wholeNum] ); |
||||||
|
stage.addChild( that.pictureFront ); |
||||||
|
} |
||||||
|
|
||||||
|
//If we're still on image one, don't fade it out, it's the base image!
|
||||||
|
if( wholeNum != 0 ) |
||||||
|
that.turkeyState[wholeNum].alpha = percent.toFixed(2) - wholeNum; |
||||||
|
|
||||||
|
// Done!
|
||||||
|
if( wholeNum == 4 ){ |
||||||
|
that.turkeyState[4].alpha = 1; |
||||||
|
that.cooking.alpha=0; |
||||||
|
that.done.alpha = 1; |
||||||
|
|
||||||
|
that.done.addEventListener( "mouseover", function(){ document.body.style.cursor='pointer'; } ); |
||||||
|
that.done.addEventListener( "mouseout", function(){ document.body.style.cursor='default'; } ); |
||||||
|
that.done.addEventListener( "click", function(){ gameState.pubsub.publish("SwitchScreen", "MainScreen"); }); |
||||||
|
|
||||||
|
that.turkeyState[4].addEventListener( "mouseover", function(){ document.body.style.cursor='pointer'; } ); |
||||||
|
that.turkeyState[4].addEventListener( "mouseout", function(){ document.body.style.cursor='default'; } ); |
||||||
|
that.turkeyState[4].addEventListener( "click", function(){ gameState.pubsub.publish("SwitchScreen", "MainScreen"); }); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
stage.addChild( this.pictureFront ); |
||||||
|
|
||||||
|
return { |
||||||
|
blit : function(){ |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
function MainScreen( stage, gameState ){ |
||||||
|
var that = this; |
||||||
|
|
||||||
|
this.background = new createjs.Bitmap( "res/screens/MainScreen/Main-Screen.png" ); |
||||||
|
stage.addChild( this.background ); |
||||||
|
|
||||||
|
var turkeyAnimations = { peck:[14,24,"peck"], ruffle:[0,13,"ruffle"], stare:[25,35,"stare"] }; |
||||||
|
var data = { |
||||||
|
images: ["res/screens/MainScreen/TurkeySprite.png"], |
||||||
|
frames: { width:400, height:350 }, |
||||||
|
animations: turkeyAnimations |
||||||
|
}; |
||||||
|
|
||||||
|
var spriteSheet = new createjs.SpriteSheet(data); |
||||||
|
var animation = new createjs.Sprite(spriteSheet, "stare"); |
||||||
|
animation.x = 140; |
||||||
|
animation.y = 210; |
||||||
|
|
||||||
|
animation.addEventListener("tick", handleTick); |
||||||
|
function handleTick(event){ |
||||||
|
if ( turkeyAnimations[event.currentTarget.currentAnimation][1] == event.currentTarget.currentFrame ){ |
||||||
|
event.currentTarget.paused = true; |
||||||
|
} |
||||||
|
// Click happened.
|
||||||
|
} |
||||||
|
stage.addChild(animation); |
||||||
|
|
||||||
|
this.grassLayer = new createjs.Bitmap( "res/screens/MainScreen/Grass.png" ); |
||||||
|
this.grassLayer.x = -60; |
||||||
|
stage.addChild( this.grassLayer ); |
||||||
|
|
||||||
|
// buttons info/credits/start
|
||||||
|
new ImgButton( stage, gameState, 571,527, "res/screens/MainScreen/ButtonStart.png", "res/screens/MainScreen/ButtonStart.png","SwitchScreen", "DifficultyScreen", "Click" ); |
||||||
|
new ImgButton( stage, gameState, 17,470, "res/screens/MainScreen/ButtonHelp.png", "res/screens/MainScreen/ButtonHelp.png",null, null, "Click", function(){ gameState.pubsub.publish("ShowHelp",""); } ); |
||||||
|
new ImgButton( stage, gameState, 17,527, "res/screens/MainScreen/ButtonCredits.png", "res/screens/MainScreen/ButtonCredits.png","SwitchScreen", "CreditsScreen", "Click" ); |
||||||
|
|
||||||
|
gameState.pubsub.publish( "BackgroundLoop", {name:"TitleMusic", pos:5650, volume:0.7} ); |
||||||
|
this.uiElems = []; |
||||||
|
|
||||||
|
return { |
||||||
|
blit : function(){ |
||||||
|
if( createjs.Ticker.getTicks() %50 == 0 ){ |
||||||
|
|
||||||
|
animation.gotoAndPlay(["peck", "ruffle", "stare"][UtilityFunctions.randRange(0,2)]); |
||||||
|
} |
||||||
|
// Draw all the uiElements
|
||||||
|
for( var index in that.uiElems ){ |
||||||
|
that.uiElems[ index ].tick(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
//start button
|
||||||
|
} |
||||||
|
|
||||||
|
function DifficultyScreen( stage, gameState ){ |
||||||
|
var that = this; |
||||||
|
|
||||||
|
this.background = new createjs.Bitmap( "res/screens/DifficultyScreen/Difficulty-Selection.png" ); |
||||||
|
stage.addChild( this.background ); |
||||||
|
|
||||||
|
var turkeyAnimations = { peck:[14,24,"peck"], ruffle:[0,13,"ruffle"], stare:[25,35,"stare"] }; |
||||||
|
var data = { |
||||||
|
images: ["res/screens/MainScreen/TurkeySprite.png"], |
||||||
|
frames: { width:400, height:350 }, |
||||||
|
animations: turkeyAnimations |
||||||
|
}; |
||||||
|
|
||||||
|
var spriteSheet = new createjs.SpriteSheet(data); |
||||||
|
var animation = new createjs.Sprite(spriteSheet, "stare"); |
||||||
|
animation.x = 140; |
||||||
|
animation.y = 210; |
||||||
|
|
||||||
|
animation.addEventListener("tick", handleTick); |
||||||
|
function handleTick(event) { |
||||||
|
if ( turkeyAnimations[event.currentTarget.currentAnimation][1] == event.currentTarget.currentFrame ){ |
||||||
|
event.currentTarget.paused = true; |
||||||
|
} |
||||||
|
// Click happened.
|
||||||
|
} |
||||||
|
stage.addChild(animation); |
||||||
|
|
||||||
|
this.grassLayer = new createjs.Bitmap( "res/screens/MainScreen/Grass.png" ); |
||||||
|
this.grassLayer.x = -60; |
||||||
|
stage.addChild( this.grassLayer ); |
||||||
|
|
||||||
|
// Difficulty selection UI
|
||||||
|
this.buttonsAndText = new createjs.Bitmap( "res/screens/DifficultyScreen/ButtonsandText.png" ); |
||||||
|
stage.addChild( this.buttonsAndText ); |
||||||
|
|
||||||
|
this.maleSelection = new createjs.Bitmap( "res/screens/DifficultyScreen/ButtonMale.png" ); |
||||||
|
stage.addChild( this.maleSelection ); |
||||||
|
|
||||||
|
this.femaleSelection = new createjs.Bitmap( "res/screens/DifficultyScreen/ButtonFemale.png" ); |
||||||
|
this.femaleSelection.alpha = 0; |
||||||
|
stage.addChild( this.femaleSelection ); |
||||||
|
|
||||||
|
var nameInput = new createjs.Text( "", "48px Arial", "black" ); |
||||||
|
nameInput.x = 47; |
||||||
|
nameInput.y = 85; |
||||||
|
nameInput.lineWidth = 175; |
||||||
|
|
||||||
|
stage.addChild( nameInput ); |
||||||
|
|
||||||
|
// handle keyboard typing
|
||||||
|
document.onkeyup = function(event){ |
||||||
|
// keycode
|
||||||
|
var keynum = 48; |
||||||
|
if(window.event){ // IE
|
||||||
|
keynum = event.keyCode; |
||||||
|
} |
||||||
|
else{ |
||||||
|
if(event.which){ // Netscape/Firefox/Opera
|
||||||
|
keynum = event.which; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if( keynum != 8 && keynum < 91 && keynum > 47 && nameInput.text.length < 22 ) |
||||||
|
nameInput.text += String.fromCharCode(keynum); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
// Backspace gets special treatment
|
||||||
|
document.onkeydown = function(event){ |
||||||
|
var keynum = 0; |
||||||
|
if(window.event){ // IE
|
||||||
|
keynum = event.keyCode; |
||||||
|
} |
||||||
|
else{ |
||||||
|
if(event.which){ // Netscape/Firefox/Opera
|
||||||
|
keynum = event.which; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if(keynum == 8 && nameInput.text.length > 0 ) |
||||||
|
nameInput.text = nameInput.text.substr(0, nameInput.text.length-1); |
||||||
|
event.preventDefault(); |
||||||
|
} |
||||||
|
|
||||||
|
gameState.name = nameInput.text; |
||||||
|
|
||||||
|
// Easy/Hard Button
|
||||||
|
stage.addChild( new Button( stage, gameState, 500, 235, 100, 55, "ChangeGender", "Male" ) ); |
||||||
|
stage.addChild( new Button( stage, gameState, 500, 300, 100, 55, "ChangeGender", "Female" ) ); |
||||||
|
|
||||||
|
stage.addChild( new Button( stage, gameState, 503, 370, 200, 55, null, null, function(){ gameState.hard = false; gameState.gameStarted = true; gameState.hardcoreModifier=20; gameState.pubsub.publish("SwitchScreen", "KitchenScreen"); } ) ); |
||||||
|
stage.addChild( new Button( stage, gameState, 500, 495, 205, 55, null, null, function(){ gameState.hard = true; gameState.gameStarted = true; gameState.hardcoreModifier=1; gameState.pubsub.publish("SwitchScreen", "KitchenScreen"); } ) ); |
||||||
|
|
||||||
|
stage.addChild( new Button( stage, gameState, 35, 495, 85, 55, "SwitchScreen", "MainScreen" ) ); |
||||||
|
|
||||||
|
gameState.pubsub.subscribe( "ChangeGender", function(gender){ |
||||||
|
gameState.gender=gender; |
||||||
|
if( gender == "Male" ){ |
||||||
|
that.maleSelection.alpha = 1; |
||||||
|
that.femaleSelection.alpha = 0; |
||||||
|
gameState.pronoun = "he"; |
||||||
|
}else{ |
||||||
|
that.maleSelection.alpha = 0; |
||||||
|
that.femaleSelection.alpha = 1; |
||||||
|
gameState.pronoun = "she"; |
||||||
|
} |
||||||
|
}) |
||||||
|
return { |
||||||
|
blit : function(){ |
||||||
|
if( createjs.Ticker.getTicks() %50 == 0 ){ |
||||||
|
animation.gotoAndPlay(["peck", "ruffle", "stare"][UtilityFunctions.randRange(0,2)]); |
||||||
|
} |
||||||
|
|
||||||
|
// Draw all the uiElements
|
||||||
|
for( var index in that.uiElems ){ |
||||||
|
that.uiElems[ index ].tick(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
function KitchenScreen( stage, gameState ){ |
||||||
|
var that = this; |
||||||
|
|
||||||
|
// Fade out any other sounds
|
||||||
|
gameState.pubsub.publish( "FadeOut", "" ); |
||||||
|
|
||||||
|
//gameState.pubsub.publish( "BackgroundLoop", {name:"Sizzle", pos:0, volume:0.5} );
|
||||||
|
this.uiElems = []; |
||||||
|
|
||||||
|
this.uiElems.push( new WindowUI( stage, gameState ) ); |
||||||
|
this.background = new createjs.Bitmap( "res/screens/KitchenScreen/KitchenScreen.png" ); |
||||||
|
stage.addChild( this.background ); |
||||||
|
if(DEBUG) console.log(gameState.purchasedItems); |
||||||
|
if(DEBUG) console.log("KitchenScreen"); |
||||||
|
for(var i in gameState.purchasedItems ){ |
||||||
|
if(DEBUG) console.log(gameState.purchasedItems); |
||||||
|
gameState.purchasedItems[i].draw( stage ); |
||||||
|
} |
||||||
|
|
||||||
|
this.uiElems.push( gameState.ovenUI ? gameState.ovenUI.render() : ( gameState.ovenUI = new OvenUI( stage, gameState ) ).render() ); |
||||||
|
this.uiElems.push( new ClockUI( stage, gameState ) ); |
||||||
|
|
||||||
|
if( gameState.alarmBought ) |
||||||
|
this.uiElems.push( new AlarmUI(stage, gameState) ); |
||||||
|
|
||||||
|
|
||||||
|
stage.addChild( new Button( stage, gameState, 14, 17, 73, 45, null,null, function(){ gameState.pubsub.publish("ShowHelp","");} ) ); |
||||||
|
|
||||||
|
new ImgButton( stage, gameState, 0,0, "res/screens/KitchenScreen/StoreBrochure.png", "res/screens/KitchenScreen/StoreBrochureGlow.png", null,null, "Click", function(){ |
||||||
|
gameState.pubsub.publish("SwitchScreen", "MarketScreen"); |
||||||
|
gameState.storeVisits++; |
||||||
|
} ); |
||||||
|
|
||||||
|
// If player did not buy a turkey, tell them
|
||||||
|
if( !gameState.turkeyBought ){ |
||||||
|
gameState.pubsub.publish( "ShowDialog", {seq:"KitchenInitial", autoAdvance:false} ); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
return { |
||||||
|
blit : function(){ |
||||||
|
|
||||||
|
// Draw all the uiElements
|
||||||
|
for( var index in that.uiElems ){ |
||||||
|
that.uiElems[ index ].tick(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
function MarketScreen( stage, gameState ){ |
||||||
|
var that = this; |
||||||
|
|
||||||
|
this.background = new createjs.Bitmap( "res/screens/MarketScreen/MarketScreen.png" ); |
||||||
|
var price = new createjs.Text( "", "16px Arial", "black" ); |
||||||
|
price.x = 120; |
||||||
|
price.y = 560; |
||||||
|
|
||||||
|
var wallet = new createjs.Text( "$" + parseFloat(gameState.wallet).toFixed(2), "20px Arial", "black" ); |
||||||
|
wallet.x = 725; |
||||||
|
wallet.y = 550; |
||||||
|
|
||||||
|
var walletTag = new createjs.Bitmap("res/items/Wallet.png"); |
||||||
|
walletTag.x = 670; |
||||||
|
walletTag.y = 535; |
||||||
|
|
||||||
|
var clipboardImg = new createjs.Bitmap("res/items/Clipboard.png"); |
||||||
|
clipboardImg.x = 5; |
||||||
|
clipboardImg.y = 315; |
||||||
|
|
||||||
|
var clipboardTitle = new createjs.Text( "Shopping List", "18px Arial", "black" ); |
||||||
|
clipboardTitle.x = 25; |
||||||
|
clipboardTitle.y = 385; |
||||||
|
clipboardTitle.lineWidth = 175; |
||||||
|
|
||||||
|
var clipboardText = new createjs.Text( "Turkey", "16px Arial", "black" ); |
||||||
|
clipboardText.x = 23; |
||||||
|
clipboardText.y = 425; |
||||||
|
clipboardText.lineWidth = 173; |
||||||
|
|
||||||
|
var clipboardWeight = new createjs.Text( "", "16px Arial", "black" ); |
||||||
|
clipboardWeight.x = 120; |
||||||
|
clipboardWeight.y = 540; |
||||||
|
clipboardWeight.lineWidth = 175; |
||||||
|
|
||||||
|
// Play soundz
|
||||||
|
gameState.pubsub.publish( "Play", {name:"Entrance", volume:0.3} ); |
||||||
|
gameState.pubsub.publish( "BackgroundLoop", {name:"MarketMusic", volume:1} ); |
||||||
|
gameState.pubsub.publish( "BackgroundLoop", {name:"MarketBackgroundSound", volume:0.4} ); |
||||||
|
|
||||||
|
stage.addChild(this.background); |
||||||
|
|
||||||
|
stage.addChild(wallet); |
||||||
|
stage.addChild(walletTag); |
||||||
|
stage.addChild(clipboardImg); |
||||||
|
|
||||||
|
stage.addChild(clipboardTitle); |
||||||
|
stage.addChild(clipboardText); |
||||||
|
stage.addChild(clipboardWeight); |
||||||
|
stage.addChild(price); |
||||||
|
|
||||||
|
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 ); |
||||||
|
} |
||||||
|
|
||||||
|
this.topground = new createjs.Bitmap( "res/screens/MarketScreen/MarketTopShelf.png" ); |
||||||
|
stage.addChild( this.topground ); |
||||||
|
|
||||||
|
|
||||||
|
this.showPrice = function( cost ){ |
||||||
|
price.text = "$ " + ( cost == NaN ? "" : parseFloat(cost).toFixed(2) ); |
||||||
|
} |
||||||
|
|
||||||
|
this.clearClipboard = function(){ |
||||||
|
price.text = ""; |
||||||
|
clipboardTitle.text = ""; |
||||||
|
clipboardText.text = ""; |
||||||
|
clipboardWeight.text = ""; |
||||||
|
} |
||||||
|
|
||||||
|
this.showDesc = function( desc ){ |
||||||
|
clipboardTitle.text = desc.title; |
||||||
|
clipboardText.text = desc.desc; |
||||||
|
if( desc.weight ){ |
||||||
|
clipboardWeight.text = desc.weight.toFixed(2) + " lbs."; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
this.setWalletAmount = function(newAmount){ |
||||||
|
wallet.text="$" + ( gameState.wallet=newAmount.toFixed(2) ); |
||||||
|
} |
||||||
|
|
||||||
|
gameState.pubsub.subscribe("ShowDesc", this.showDesc); |
||||||
|
gameState.pubsub.subscribe("ShowPrice", this.showPrice ); |
||||||
|
gameState.pubsub.subscribe("WalletAmount", this.setWalletAmount); |
||||||
|
gameState.pubsub.subscribe("ClearClipboard", this.clearClipboard); |
||||||
|
|
||||||
|
return { |
||||||
|
blit : function(){ |
||||||
|
|
||||||
|
// Draw all the uiElements
|
||||||
|
for( var index in that.uiElems ){ |
||||||
|
that.uiElems[ index ].tick(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
function ScoreScreen( stage, gameState ){ |
||||||
|
var that = this; |
||||||
|
|
||||||
|
// All the text for the entries
|
||||||
|
var totalCookTime = gameState.turkeyCookCounter; |
||||||
|
var realTimeElapsed = Date.now() - gameState.startTime; |
||||||
|
console.log("total cook time:"+ realTimeElapsed); |
||||||
|
|
||||||
|
var turkeyState = gameState.ovenModel.getTurkeyState(); |
||||||
|
var totalScore = 0; |
||||||
|
|
||||||
|
var skinScoreChart = { |
||||||
|
"raw": 0, |
||||||
|
"undercooked": -100, |
||||||
|
"slightly cooked": 75, |
||||||
|
"cooked": 500, |
||||||
|
"overcooked": 200, |
||||||
|
"dry": -300, |
||||||
|
"burnt": -500 |
||||||
|
}; |
||||||
|
|
||||||
|
var coreScoreChart = { |
||||||
|
"raw": 0, |
||||||
|
"undercooked": 125, |
||||||
|
"slightly cooked": 750, |
||||||
|
"cooked": 1000, |
||||||
|
"overcooked": 1000, |
||||||
|
"dry": 400, |
||||||
|
"burnt": 0 |
||||||
|
}; |
||||||
|
|
||||||
|
var typeToMod = { |
||||||
|
"Organic Turkey" : 1.03, |
||||||
|
"Free Range Turkey" : 1.02, |
||||||
|
"Sunny Farms Turkey" : 0.98, |
||||||
|
"Pastured Turkey": 1.05, |
||||||
|
"General Turkey": 1.00 |
||||||
|
}; |
||||||
|
// Optimal Temperature to be served at
|
||||||
|
this.scoreDistribution= function(inputTemp, layer) { |
||||||
|
desiredAverage = 165; |
||||||
|
if(layer=="skin") desiredAverage = 260; |
||||||
|
|
||||||
|
variance = 1000; //Std Deviation 31.62
|
||||||
|
return(Math.exp(-(Math.pow((inputTemp-desiredAverage),2)/(2*variance)))) |
||||||
|
}; |
||||||
|
|
||||||
|
// Temperature Score
|
||||||
|
var outerTemp = UtilityFunctions.C2F(turkeyState.skin.temp).toFixed(2); |
||||||
|
var coreTemp = UtilityFunctions.C2F(turkeyState.core.temp).toFixed(2); |
||||||
|
|
||||||
|
var outerTempScore = that.scoreDistribution( outerTemp ) * 200; |
||||||
|
var coreTempScore = that.scoreDistribution( coreTemp ) * 200; |
||||||
|
|
||||||
|
totalScore += parseInt(skinScoreChart[ turkeyState.skin.cond[2]]); |
||||||
|
totalScore += parseInt(skinScoreChart[ turkeyState.core.cond[2]]); |
||||||
|
totalScore += parseInt(outerTempScore.toFixed(0)); |
||||||
|
totalScore += parseInt(coreTempScore.toFixed(0)); |
||||||
|
|
||||||
|
|
||||||
|
resultsDialogue = []; |
||||||
|
if (totalScore>=2000) { |
||||||
|
randomDiag = perfect; |
||||||
|
} |
||||||
|
else if (totalScore>=1200) { |
||||||
|
randomDiag = great; |
||||||
|
} |
||||||
|
else if (totalScore>=625) { |
||||||
|
randomDiag = average; |
||||||
|
} |
||||||
|
else if (totalScore>=300) { |
||||||
|
randomDiag = subPar; |
||||||
|
} |
||||||
|
else { |
||||||
|
randomDiag = terrible; |
||||||
|
} |
||||||
|
|
||||||
|
for (var i = 0; i<=5; i++) { |
||||||
|
resultsDialogue.push(randomString(randomDiag)); |
||||||
|
} |
||||||
|
messages["end"] = resultsDialogue; |
||||||
|
|
||||||
|
function randomString(stringArray) { |
||||||
|
var index = UtilityFunctions.randRange(0, stringArray.length-1); |
||||||
|
var stringResult = stringArray[index]; |
||||||
|
stringArray.splice(index,1); |
||||||
|
return (stringResult) |
||||||
|
} |
||||||
|
|
||||||
|
gameState.pubsub.publish( "FadeOut", "" ); |
||||||
|
|
||||||
|
this.background = new createjs.Bitmap( "res/screens/ScoreScreen/Score-Evaluation-1.png" ); |
||||||
|
this.background.alpha = 1; |
||||||
|
stage.addChild( this.background ); |
||||||
|
|
||||||
|
background1 = new createjs.Bitmap( "res/screens/ScoreScreen/Score-Evaluation-2.png" ); |
||||||
|
background1.alpha = 0; |
||||||
|
stage.addChild( background1 ); |
||||||
|
|
||||||
|
for (i in gameState.turkeyStates){ |
||||||
|
gameState.turkeyStates[i].scaleX = gameState.turkeyStates[i].scaleY = 1; |
||||||
|
gameState.turkeyStates[i].x = 490; |
||||||
|
gameState.turkeyStates[i].y = 110; |
||||||
|
stage.addChild(gameState.turkeyStates[i]); |
||||||
|
} |
||||||
|
|
||||||
|
gameState.pubsub.publish( "BackgroundLoop", {name:"TitleMusic", pos:5650, volume:0.7} ); |
||||||
|
|
||||||
|
gameState.pubsub.publish( "ShowDialog", {seq:"end", autoAdvance:true, endFunc:function(){ |
||||||
|
background1.alpha=1; |
||||||
|
|
||||||
|
stage.addChild( new Button( stage, gameState, 590, 540, 190, 50, null, null, function(){ document.location.reload(); } ) ); |
||||||
|
|
||||||
|
// Cooking stats
|
||||||
|
var hours = parseInt( totalCookTime / 3600 ) % 24; |
||||||
|
var minutes = parseInt( totalCookTime / 60 ) % 60; |
||||||
|
var seconds = totalCookTime % 60; |
||||||
|
var timeText = ("00"+hours.toFixed(0)).slice(-2) + ":" + ("00"+minutes.toFixed(0)).slice(-2) + ":" + ("00"+seconds.toFixed(0)).slice(-2); |
||||||
|
|
||||||
|
var totalCookTimeText = new createjs.Text( timeText, "20px Arial", "black" ); |
||||||
|
totalCookTimeText.x = 270; |
||||||
|
totalCookTimeText.y = 107; |
||||||
|
|
||||||
|
realTimeElapsed = realTimeElapsed / 1000; |
||||||
|
hours = parseInt( realTimeElapsed / 3600 ) % 24; |
||||||
|
minutes = parseInt( realTimeElapsed / 60 ) % 60; |
||||||
|
seconds = realTimeElapsed % 60; |
||||||
|
timeText = ("00"+hours.toFixed(0)).slice(-2) + ":" + ("00"+minutes.toFixed(0)).slice(-2) + ":" + ("00"+seconds.toFixed(0)).slice(-2); |
||||||
|
|
||||||
|
var realtimeElapsedText = new createjs.Text( timeText, "20px Arial", "black" ); |
||||||
|
realtimeElapsedText.x = 270; |
||||||
|
realtimeElapsedText.y = 127; |
||||||
|
|
||||||
|
var ovenOpenedText = new createjs.Text( gameState.ovenOpened, "20px Arial", "black" ); |
||||||
|
ovenOpenedText.x = 270; |
||||||
|
ovenOpenedText.y = 147; |
||||||
|
|
||||||
|
var dialogueHeardText = new createjs.Text( gameState.dialogueHeard, "20px Arial", "black" ); |
||||||
|
dialogueHeardText.x = 270; |
||||||
|
dialogueHeardText.y = 167; |
||||||
|
|
||||||
|
stage.addChild( totalCookTimeText ); |
||||||
|
stage.addChild( realtimeElapsedText ); |
||||||
|
stage.addChild( ovenOpenedText ); |
||||||
|
stage.addChild( dialogueHeardText ); |
||||||
|
|
||||||
|
// Cookedness Score
|
||||||
|
|
||||||
|
var outerConditionDesc = new createjs.Text( turkeyState.skin.cond[2], "20px Arial", "black" ); |
||||||
|
outerConditionDesc.x = 150; |
||||||
|
outerConditionDesc.y = 320; |
||||||
|
|
||||||
|
var coreConditionDesc = new createjs.Text( turkeyState.core.cond[2], "20px Arial", "black" ); |
||||||
|
coreConditionDesc.x = 150; |
||||||
|
coreConditionDesc.y = 340; |
||||||
|
|
||||||
|
var outerConditionText = new createjs.Text( skinScoreChart[ turkeyState.skin.cond[2] ], "20px Arial", "black" ); |
||||||
|
outerConditionText.x = 310; |
||||||
|
outerConditionText.y = 320; |
||||||
|
|
||||||
|
var coreConditionText = new createjs.Text( coreScoreChart[ turkeyState.skin.cond[2] ], "20px Arial", "black" ); |
||||||
|
coreConditionText.x = 310; |
||||||
|
coreConditionText.y = 340; |
||||||
|
|
||||||
|
|
||||||
|
stage.addChild( coreConditionText ); |
||||||
|
stage.addChild( outerConditionText ); |
||||||
|
|
||||||
|
stage.addChild( coreConditionDesc ); |
||||||
|
stage.addChild( outerConditionDesc ); |
||||||
|
|
||||||
|
// Temperature Score
|
||||||
|
|
||||||
|
var outerTemperatureText = new createjs.Text( outerTempScore.toFixed(0), "20px Arial", "black" ); |
||||||
|
outerTemperatureText.x = 680; |
||||||
|
outerTemperatureText.y = 320; |
||||||
|
|
||||||
|
var coreTemperatureText = new createjs.Text( coreTempScore.toFixed(0), "20px Arial", "black" ); |
||||||
|
coreTemperatureText.x = 680; |
||||||
|
coreTemperatureText.y = 340; |
||||||
|
|
||||||
|
var outerTemperatureDesc = new createjs.Text( outerTemp + " F", "20px Arial", "black" ); |
||||||
|
outerTemperatureDesc.x = 530; |
||||||
|
outerTemperatureDesc.y = 320; |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var coreTemperatureDesc = new createjs.Text( coreTemp + " F", "20px Arial", "black" ); |
||||||
|
coreTemperatureDesc.x = 530; |
||||||
|
coreTemperatureDesc.y = 340; |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
stage.addChild( outerTemperatureText ); |
||||||
|
stage.addChild( coreTemperatureText ); |
||||||
|
|
||||||
|
stage.addChild( coreTemperatureDesc ); |
||||||
|
stage.addChild( outerTemperatureDesc ); |
||||||
|
|
||||||
|
// Modifiers
|
||||||
|
var turkeyMod = typeToMod[gameState.turkeyType]; |
||||||
|
var turkeyTypeModifierText = new createjs.Text( "+"+(Math.abs(turkeyMod-1)*100).toFixed(0) + "%", "20px Arial", "black" ); |
||||||
|
turkeyTypeModifierText.x = 310; |
||||||
|
turkeyTypeModifierText.y = 437; |
||||||
|
|
||||||
|
totalScore *= turkeyMod; |
||||||
|
|
||||||
|
|
||||||
|
var stuffingTypeModifierText = new createjs.Text( "+"+(Math.abs(gameState.stuffingTypeModifier-1)*100).toFixed(0)+"%" , "20px Arial", "black" ); |
||||||
|
stuffingTypeModifierText.x = 310 |
||||||
|
stuffingTypeModifierText.y = 457; |
||||||
|
|
||||||
|
totalScore *= gameState.stuffingTypeModifier; |
||||||
|
|
||||||
|
var frillsModifierText = new createjs.Text( "x"+gameState.frillsModifier, "20px Arial", "black" ); |
||||||
|
frillsModifierText.x = 310 |
||||||
|
frillsModifierText.y = 477; |
||||||
|
|
||||||
|
totalScore *= gameState.frillsModifier; |
||||||
|
|
||||||
|
var hardcoreModifierText = new createjs.Text( "x"+gameState.hardcoreModifier, "20px Arial", "black" ); |
||||||
|
hardcoreModifierText.x = 310 |
||||||
|
hardcoreModifierText.y = 497; |
||||||
|
|
||||||
|
totalScore *= gameState.hardcoreModifier; |
||||||
|
|
||||||
|
var totalText = new createjs.Text( totalScore.toFixed(0), "32px Arial", "black" ); |
||||||
|
totalText.x = 250; |
||||||
|
totalText.y = 550; |
||||||
|
stage.addChild( totalText ); |
||||||
|
|
||||||
|
stage.addChild( stuffingTypeModifierText ); |
||||||
|
stage.addChild( turkeyTypeModifierText ); |
||||||
|
stage.addChild( frillsModifierText ); |
||||||
|
stage.addChild( hardcoreModifierText ); |
||||||
|
|
||||||
|
|
||||||
|
}} ); |
||||||
|
|
||||||
|
|
||||||
|
return { |
||||||
|
blit : function(){} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
function CreditsScreen( stage, gameState ){ |
||||||
|
var that = this; |
||||||
|
|
||||||
|
this.background = new createjs.Bitmap( "res/screens/HelpCreditsScreen/Credits.png" ); |
||||||
|
stage.addChild( this.background ); |
||||||
|
stage.addChild( new Button( stage, gameState, 698, 533, 80, 50, "SwitchScreen", "MainScreen" ) ); |
||||||
|
|
||||||
|
this.uiElems = []; |
||||||
|
return { |
||||||
|
blit : function(){ |
||||||
|
|
||||||
|
// Draw all the uiElements
|
||||||
|
for( var index in that.uiElems ){ |
||||||
|
that.uiElems[ index ].tick(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
//
|
||||||
|
} |
@ -0,0 +1,112 @@ |
|||||||
|
function SoundInstance( soundObj, loop ){ |
||||||
|
this.soundObj = soundObj; |
||||||
|
} |
||||||
|
function SoundManager( gameState ){ |
||||||
|
var that = this; |
||||||
|
var soundCache = {}; |
||||||
|
|
||||||
|
var AUDIO_OUT = 1; |
||||||
|
var AUDIO_IN = 2; |
||||||
|
var AUDIO_STABLE = 0; |
||||||
|
|
||||||
|
this.audioState = AUDIO_STABLE; |
||||||
|
|
||||||
|
// Register all sounds loaded in gameState
|
||||||
|
createjs.Sound.registerSound("res/sound/turkey_in_the_straw.mp3", "TitleMusic"); |
||||||
|
createjs.Sound.registerSound("res/sound/Store/Waterford.mp3", "MarketMusic"); |
||||||
|
createjs.Sound.registerSound("res/sound/GUI/lowclick.mp3", "LowClick"); |
||||||
|
createjs.Sound.registerSound("res/sound/GUI/click.mp3", "Click"); |
||||||
|
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"); |
||||||
|
createjs.Sound.registerSound("res/sound/Kitchen/Double_Beep.mp3", "BeepBeep"); |
||||||
|
|
||||||
|
// Kitchen sound
|
||||||
|
createjs.Sound.registerSound("res/sound/Kitchen/Oven_Door_Full_Open.mp3", "Oven_Door_Full_Open"); |
||||||
|
createjs.Sound.registerSound("res/sound/Kitchen/Oven_Door_Full_Close.mp3", "Oven_Door_Full_Close"); |
||||||
|
createjs.Sound.registerSound("res/sound/Kitchen/Oven_Door_Peek_Close.mp3", "Oven_Door_Peek_Close"); |
||||||
|
createjs.Sound.registerSound("res/sound/Kitchen/Oven_Door_Peek_Open.mp3", "Oven_Door_Peek_Open"); |
||||||
|
createjs.Sound.registerSound("res/sound/Kitchen/sizzle.mp3", "Sizzle"); |
||||||
|
|
||||||
|
createjs.Sound.registerSound("res/sound/Kitchen/Open_Cookbook.mp3", "Open_Cookbook"); |
||||||
|
createjs.Sound.registerSound("res/sound/Kitchen/Close_Cookbook.mp3", "Close_Cookbook"); |
||||||
|
|
||||||
|
|
||||||
|
this.backgroundSounds = []; |
||||||
|
this.backgroundSoundsQueue = []; |
||||||
|
this.fadeOut = function(){ |
||||||
|
for ( var i in that.backgroundSounds ){ |
||||||
|
that.backgroundSounds[i].audioState = AUDIO_OUT; |
||||||
|
} |
||||||
|
}; |
||||||
|
this.play = function( soundName ){ |
||||||
|
var channel = createjs.Sound.createInstance("Click"); |
||||||
|
if( typeof soundName != "object" ){ |
||||||
|
|
||||||
|
channel = ( soundCache[soundName] ? soundCache[soundName] : soundCache[soundName] = createjs.Sound.createInstance(soundName) ); |
||||||
|
channel.volume = 1; |
||||||
|
} |
||||||
|
else{ |
||||||
|
channel = ( soundCache[soundName.name] ? soundCache[soundName.name] : soundCache[soundName.name] = createjs.Sound.createInstance(soundName.name) ); |
||||||
|
channel.volume = soundName.volume; |
||||||
|
} |
||||||
|
channel.play(); |
||||||
|
}; |
||||||
|
|
||||||
|
this.backgroundLoop = function( soundName ){ |
||||||
|
var newBackgroundSound; |
||||||
|
if( typeof soundName != "object" ){ |
||||||
|
newBackgroundSound = soundCache[soundName] ? soundCache[soundName] : soundCache[soundName] = createjs.Sound.createInstance(soundName); |
||||||
|
} |
||||||
|
else{ |
||||||
|
newBackgroundSound = soundCache[soundName.name] ? soundCache[soundName.name] : soundCache[soundName.name] = createjs.Sound.createInstance( soundName.name ); |
||||||
|
newBackgroundSound.setPosition(soundName.pos || 0); |
||||||
|
newBackgroundSound.volume = newBackgroundSound.desiredVolume = soundName.volume || 1; |
||||||
|
newBackgroundSound.play(); |
||||||
|
|
||||||
|
// loop-de-loop
|
||||||
|
newBackgroundSound.addEventListener("complete", function(){ |
||||||
|
if( newBackgroundSound.volume == 0 ){ newBackgroundSound.stop(); return; } |
||||||
|
newBackgroundSound.setPosition(soundName.pos || 0); |
||||||
|
newBackgroundSound.volume = newBackgroundSound.desiredVolume = soundName.volume || 1; |
||||||
|
newBackgroundSound.play(); |
||||||
|
}); |
||||||
|
} |
||||||
|
that.backgroundSoundsQueue.push(newBackgroundSound); |
||||||
|
}; |
||||||
|
|
||||||
|
gameState.pubsub.subscribe( "Play", this.play ); |
||||||
|
gameState.pubsub.subscribe( "BackgroundLoop", this.backgroundLoop ); |
||||||
|
gameState.pubsub.subscribe( "FadeOut", this.fadeOut ); |
||||||
|
|
||||||
|
return { |
||||||
|
tick: function(){ |
||||||
|
for ( var i in that.backgroundSounds ){ |
||||||
|
if( that.backgroundSounds[i].audioState == AUDIO_OUT ){ |
||||||
|
that.backgroundSounds[i].volume -=0.03; |
||||||
|
} |
||||||
|
if( that.backgroundSounds[i].audioState == AUDIO_IN ){ |
||||||
|
that.backgroundSounds[i].volume +=0.03; |
||||||
|
} |
||||||
|
if( that.backgroundSounds[i].volume >= that.backgroundSounds[i].desiredVolume ){ |
||||||
|
that.backgroundSounds[i].volume = that.backgroundSounds[i].desiredVolume; |
||||||
|
} |
||||||
|
if( that.backgroundSounds[i].volume <= 0.0 ){ |
||||||
|
that.backgroundSounds[i].volume = 0; |
||||||
|
that.backgroundSounds[i].stop(); |
||||||
|
that.backgroundSounds.splice( i, 1 ); |
||||||
|
} |
||||||
|
} |
||||||
|
if( that.backgroundSounds.length == 0 ){ |
||||||
|
for ( var i in that.backgroundSoundsQueue ){ |
||||||
|
var newSound = that.backgroundSoundsQueue[i]; |
||||||
|
newSound.audioState = AUDIO_IN; |
||||||
|
that.backgroundSounds.push( newSound ); |
||||||
|
} |
||||||
|
that.backgroundSoundsQueue = []; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,664 @@ |
|||||||
|
var messages = { |
||||||
|
"Null":["Me: "], |
||||||
|
"KitchenInitial" : ["Me: I should run to the store and buy a delicious turkey!"], |
||||||
|
"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..."], |
||||||
|
"OpenDoor" :["Me: I should probably try opening the oven door to measure the turkey's temperature"] |
||||||
|
} |
||||||
|
|
||||||
|
//Terrible Results
|
||||||
|
var terrible = [ |
||||||
|
"Grandpa: Outrageous. I didn't fight for freedom for this kind of meal.", |
||||||
|
"Grandpa: I could have cooked a better fowl with a flamethrower in Korea.", |
||||||
|
"Grandma: My sister can make feast out of a potato. What is this?", |
||||||
|
"Dad: Don't expect my blessing.", |
||||||
|
"Mom: No thanks, I'm actually a vegetarian.", |
||||||
|
"Brother: Who taught you how to cook?", |
||||||
|
"Brother: What an awful turkey.", |
||||||
|
"Girlfriend: I'm leaving you honey. It's not you, its the turkey.", |
||||||
|
"Cat: Meow Meow ('Get out of my house!')"]; |
||||||
|
|
||||||
|
//Subpar Results
|
||||||
|
var subPar = [ |
||||||
|
"Grandpa: My fake teeth can't chew through this tough turkey.", |
||||||
|
"Grandpa: Treat the turkey with respect next time.", |
||||||
|
"Grandma: Dear grandchild, next year let Grandmother do cooking.", |
||||||
|
"Dad: I had high expectations from you.", |
||||||
|
"Dad: You've brought shame to your family.", |
||||||
|
"Dad: Not bad, but it could have been better.", |
||||||
|
"Mom: Remember, it is the thought that matters.", |
||||||
|
"Mom: You are welcome here no matter how well you cook.", |
||||||
|
"Mom: Honey, I think this turkey could have turned out better.", |
||||||
|
"Brother: Uhh, What's for dessert?", |
||||||
|
"Brother: We should get a pre-baked turkey next time", |
||||||
|
"Girlfriend: Hey, the cat seems to like it.", |
||||||
|
"Girlfriend: We'll have to go to some cooking classes together.", |
||||||
|
"Cat: Hisssssss"]; |
||||||
|
|
||||||
|
//Average Results
|
||||||
|
var average = [ |
||||||
|
"Grandpa: Hmm. Passable.", |
||||||
|
"Grandma: This turkey tastes good, you have done well.", |
||||||
|
"Dad: Pretty decent turkey have you cooked here.", |
||||||
|
"Mom: Tastes better than store cooked turkeys.", |
||||||
|
"Brother: This is way better than I expected.", |
||||||
|
"Girlfriend: Not bad.", |
||||||
|
"Cat: Meow meow ('I may not leave a present in your shoes today')"]; |
||||||
|
|
||||||
|
//Great Results
|
||||||
|
var great = [ |
||||||
|
"Grandpa: Fine job, sonny! Just like the golden days.", |
||||||
|
"Grandpa: Tender and juicy, just the way I like it.", |
||||||
|
"Grandma: Such a talented little cook. Welcome to family.", |
||||||
|
"Grandma: Most enjoyable dinner. Now, who wants baked apples?", |
||||||
|
"Dad: Good and meaty, mmm-mmm!", |
||||||
|
"Mom: The second best turkey I have ever had!", |
||||||
|
"Mom: You should teach me your secrets", |
||||||
|
"Brother: Way to go, this turkey is fantastic.", |
||||||
|
"Girlfriend: Oh, what a nice turkey.", |
||||||
|
"Cat: Meow MEOW! ('I am pleased, human')"]; |
||||||
|
|
||||||
|
//Perfect Results
|
||||||
|
var perfect = [ |
||||||
|
"Grandpa: Damn good gobsmackingly delicious piece of freedom!", |
||||||
|
"Grandma: Excellent! You will cook festival dinner next year, yes?", |
||||||
|
"Dad: Finger-licking perfection!", |
||||||
|
"Mom: This turkey is delicious. Let's get you two wed immediately!", |
||||||
|
"Mom: Never have I had a more scrumptious turkey!", |
||||||
|
"Brother: All-praise the turkeymeister!", |
||||||
|
"Girlfriend: Bite after bite of gourmet delight!", |
||||||
|
"Girlfriend: We should get married. Tonight!", |
||||||
|
"Cat: Puuuurrrrrrr"]; |
||||||
|
|
||||||
|
|
||||||
|
var story = { |
||||||
|
|
||||||
|
"Duck Story": |
||||||
|
["Dad: So I was in the office last week, typing up the TPS reports that need to be turned in every Friday, when I heard a quacking sound.", |
||||||
|
"Dad: I thought it was Larry again. He has one of those old Blackintosh computers at his desk, you know, the ones with the smiley winking face.", |
||||||
|
"Brother: Dad, that's such old technology. When is your company going to upgrade to SuckBox 87?", |
||||||
|
"Dad: I know, but let me finish my story. Well, you know how when you click or an alert box comes up the computer can be set to a quacking sound?", |
||||||
|
"Dad: So I tell Larry, what's up with all his alert boxes.", |
||||||
|
"Mom: Who's Larry again hun?", |
||||||
|
"Dad: He's my stall partner. We share he cubicle remember? So he turns around in his office chair, and asks 'what?'", |
||||||
|
"Dad: 'The quacking, what's with all the quacking?'", |
||||||
|
"Dad: 'I'm not doing it', he tells me.", |
||||||
|
"Dad: 'Well, It isn't me.'", |
||||||
|
"Dad: Just then the quacking noise happened again.", |
||||||
|
"Dad: 'Did you hear that Larry?'", |
||||||
|
"Dad: 'Yeah.'", |
||||||
|
"Dad: We poked our head above the cubicle to look out and didn't see anybody else in the room. Yet the quacking came again.", |
||||||
|
"Dad: Besides the quacking, the room had fallen very silent.", |
||||||
|
"Mom: So, what did ya do?", |
||||||
|
"Dad: I droop down on my hands and knees, and that's when it got me.", |
||||||
|
"Mom: Mercy!", |
||||||
|
"Brother: You got attacked by a duck?", |
||||||
|
"Dad: That duck ran into me, face first. In its flight to escape, it pooped on my hands. Lucky me.", |
||||||
|
"Dad: Larry and I grabbed a few guys on break and we corralled the duck out of the office.", |
||||||
|
"Dad: Some of the guys wanted to keep it as a pet, but these are the same guys who don't get much done anyways. No help to office productivity.", |
||||||
|
"Grandma: Son, You let a good meal go to waste.", |
||||||
|
"Dad: Mom, we don't eat ducks we find on the street. That's just cruel.", |
||||||
|
"Grandma: That doesn't stop those Chinese from eating street cats and dogs. Why do you think there are all those missing pet posters in the neighborhood?", |
||||||
|
"Mom: Oh good lord!", |
||||||
|
"Dad: Mom, you should stop spreading those rumors. It is cars and wild animals.", |
||||||
|
"Grandma: Oh I'm sure those are SOME of the reasons. But lying to yourself isn't good honey.", |
||||||
|
"Cat: Meow.", |
||||||
|
"Dad: Oh hey Kasey. You like being an indoor cat don't you? Don't have to worry about all those cars and wild animals. Don't you little girl?", |
||||||
|
"Grandma: And Chinese.", |
||||||
|
"Dad: Mooom!"], |
||||||
|
|
||||||
|
"Golf Story": |
||||||
|
["Grandpa: Son, what's your par on the John Milton Golf Course?.", |
||||||
|
"Dad: I'm a little rusty, but my average is about 76.", |
||||||
|
"Grandpa: Oh really? Chaahooooo I am down to 69.", |
||||||
|
"Dad: Congratulations Dad.", |
||||||
|
"Grandpa: How about you and I hit a few around next week?", |
||||||
|
"Dad: I will have to check my calendar, but I would love to."], |
||||||
|
|
||||||
|
"Creeper Worker": |
||||||
|
["Brother: ...and so this guy kept trying to see what I wrote down on my notepad, and I keep trying to hide it from his prying eyes. Anyways...", |
||||||
|
"Dad: Hey that reminds me of this guy at work.", |
||||||
|
"Brother: I'm trying to tell a story here Dad.", |
||||||
|
"Mom: Let Greg finish.", |
||||||
|
"Dad: Ok, finish your story.", |
||||||
|
"Brother: Well... I forgot where I was going with it. Err, the guy was trying to view my notepad...and well, that's about it. Look what you did Dad.", |
||||||
|
"Dad: Sorry. But hey! Now you can hear my story.", |
||||||
|
"Dad: Just like you, we had a nosey co-worker. This co-worker was showing around a new customer to our branch when a screensaver caught his in a nearby room.", |
||||||
|
"Grandma: What is a screensaver?", |
||||||
|
"Dad: You know on a computer when you don't use it and the screen goes black? It is like that, except this computer has an animated display like a slide show.", |
||||||
|
"Grandma: Ok, a slide show on the computer.", |
||||||
|
"Dad: Yes, sort of like that.", |
||||||
|
"Dad: Well, the co-worker enters the room, with the new customer, to check out the screen saver. Now this room belongs to Julia, our PR rep.", |
||||||
|
"Dad: I'm not sure why he entered the room. He could have just viewed the screen saver through the office window.", |
||||||
|
"Dad: Julia wasn't there at the time, but word gets around quickly in the office.", |
||||||
|
"Dad: She found out that Rob, that's the co-worker, entered the room, and filed a complaint with Internal Relations.", |
||||||
|
"Dad: Then Internal relations sends a message to Rob, asking if he did enter the room.", |
||||||
|
"Dad: And then Rob sends a long email response back, all the while with our customer in tow, even asking the customer advice about what to include in the E-mail.", |
||||||
|
"Brother: Wow, so did you lose the customer?", |
||||||
|
"Dad: We don't know yet, but management did send an internal memo around re-affirming the boundaries of privacy.", |
||||||
|
"Dad: This whole thing was completely overblown though. Rob was just looking at a screensaver. He didn't even try and hide it either.", |
||||||
|
"Dad: But that's life. People who get excited over nothing.", |
||||||
|
"Wife: Well, he did seem kind of creepy asking for the customer's advice on the E-mail.", |
||||||
|
"Brother: And what about Julia? She seemed to know a littttle bit too much about the goings on in her office cubicle.", |
||||||
|
"Dad: Maybe she has an office camera or something. I'm not sure.", |
||||||
|
"Brother: Do you have one?", |
||||||
|
"Dad: No, but then again I'm not in PR. Sometimes workers try and find out what the dirt is on them, or try and change their records on the computer.", |
||||||
|
"Brother: Sorry to say, it honestly sounds like a terrible place to work.", |
||||||
|
"Dad: It isn't as bad as it seems. Every now and then sometime like this happens and it becomes the talk of the town.", |
||||||
|
"Brother: Maybe just a boring place."], |
||||||
|
|
||||||
|
"Paint Bucket Sucks": |
||||||
|
["Brother: Hey Grandpa, I've got a funny story about that primer you gave me.", |
||||||
|
"Grandpa: You'll have to remind me again, my memory isn't too good in my old age.", |
||||||
|
"Brother: Well, you gave me some primer to redo my room.", |
||||||
|
"Mom: How is the painting going? Last I heard you had the priming done.", |
||||||
|
"Brother: Yup. Well, almost. I still have a mess to clean up.", |
||||||
|
"Mom: What happened?", |
||||||
|
"Brother: Yeaahh well, grandpa's can of primer was pretty old. And it rusted on the bottom and developed small holes.", |
||||||
|
"Brother: So, there I was prepping everything, ready to go to town on the walls, when I start feeling some wetness on my pants.", |
||||||
|
"Brother: I look down and there are primer drops all over my pants.", |
||||||
|
"Dad: Why were you holding the paint bucket though? Don't you just pour it in a roller pan and do it that way like I taught you?", |
||||||
|
"Brother: Well yes, but I was also cutting the edges of the room before hand, like you taught me. And that was easier with the paint bucket in my hand.", |
||||||
|
"Brother: Or so I thought...", |
||||||
|
"Mom: What happened next Greggy?", |
||||||
|
"Brother: Mom, don't call me 'Greggy'.", |
||||||
|
"Brother: Anywaaays, I quickly put the can down in the roller pan I had nearby. I turned around to find some paper towels to clean myself off with.", |
||||||
|
"Brother: That's when I noticed a drip line all the way from the garage. That's not good.", |
||||||
|
"Brother: I dashed for the towels and once I reached them, I tried to soak up as much as possible. And well... not good.", |
||||||
|
"Brother: In the future, I probably won't go for your primer Grandpa.", |
||||||
|
"Grandpa: You know what'll get that paint out? Some turpentine. If you don't have some of that handy you should try out some kerosene.", |
||||||
|
"Brother: I tried some paint remover already, but it also took out the color in my pants. Luckily, I wasn't wearing my best pants.", |
||||||
|
"Brother: I did have to go for a heavy duty carpet cleaning service. My wife wasn't too happy about that", |
||||||
|
"Grandpa: You should have asked me for help. I would have shown you how to do it, and I would have done it for free too.", |
||||||
|
"Brother: Thanks Grandpa, I'll definitely keep that in mind."], |
||||||
|
|
||||||
|
"Hanging Doorway Ornaments":[ |
||||||
|
"Grandma: A real bother these days are the people that decorations in their doorways. They get in your face as you try to walk through.", |
||||||
|
"Grandma: And what if there is an Earthquake!", |
||||||
|
"Grandpa: It isn't like we live on a fault line.", |
||||||
|
"Grandma: Just stop hanging your bears in the doorway.", |
||||||
|
"Grandpa: I have the kitchen and you have the garage, that was the deal.", |
||||||
|
"Grandma: Maybe I'll just take both the garage and the kitchen and then put you out on the street with your keychain bears.", |
||||||
|
"Grandpa: I'd like to see you try.", |
||||||
|
"Grandma: Oohh don't make me get my shotgun.", |
||||||
|
"Grandpa: Err, speaking of kitchens. HOW IS THAT TURKEY COMING ALONG IN THERE. YOU NEED A HAND?"], |
||||||
|
|
||||||
|
"Spouse gets surprise movie tickets": |
||||||
|
["Mom: Hey, seen any interesting movies y'all?", |
||||||
|
"Spouse: I have. Recently I was...", |
||||||
|
"Grandpa: Back in my day, we burned rats for fun.", |
||||||
|
"Spouse: errr.. Grandpa?", |
||||||
|
"Grandma: Don't mind him. He's losing his mind.", |
||||||
|
"Grandpa: I keep it right here. *Taps head* But where did you put the lock on that mouse of yours?", |
||||||
|
"Dad: Dad, Mom, don't keep interrupting the story.", |
||||||
|
"Grandpa: Well, she started it.", |
||||||
|
"Grandma: Ahh, you old coot.", |
||||||
|
"Mom: Please continue.", |
||||||
|
"Spouse: ummmmm", |
||||||
|
"Spouse: Ah, now I remember. [Player] and I were at the mall when a woman came up to us.", |
||||||
|
"Spouse: 'Hey guys, sorry to bother you. I'm the host of a free movie screening preview, and we are trying to fill as many seats as possible.'", |
||||||
|
"Spouse: 'We severely underestimated the number of people who were going to show up. If you have time, it would really help me out if you two would attend.'", |
||||||
|
"Spouse: [Player] thought going to see the free movie was a no brainer, but I knew that we had somewhere to be in less than two hours.", |
||||||
|
"Spouse: 'How long is the movie', I asked. She replied, 'About an hour and a half'. Which is about standard.", |
||||||
|
"Grandpa: Back in my day...", |
||||||
|
"Spouse: 'WE CAN ALWAYS leave early', [Player] whispered to me.", |
||||||
|
"Dad: Did you end up seeing it?", |
||||||
|
"Spouse: Actually, yes.", |
||||||
|
"Spouse: We lined up at the theater, and noticed that all the others in line had a pamphlet ticket. We might be in the wrong line!", |
||||||
|
"Spouse: The women told us to mention her name 'Stephanine' at the door to get in, but what if we go up to the doorman, mention 'Stephanine', and they respond ' Stephanine, who is Stephaine?' ", |
||||||
|
"Spouse: The line begins to move, and we approach to the ticket-taker.", |
||||||
|
"Spouse: 'Stephanie told us to come'. After a heart wrenching pause, the doorman nodded, and we were allowed in.", |
||||||
|
"Dad: What movie was it?", |
||||||
|
"Spouse: Stephanie mentioned it was going to be an action documentary about Poland but when we got our seats, the pre-ads were all childish.", |
||||||
|
"Spouse: Legos, Toys, cartoons, etc. [Player] and I wondered if the movie we were about to see wasn't even what they told us.", |
||||||
|
"Brother: Legos aren't just for kids.", |
||||||
|
"Spouse: Maybe not, but the marketing is primarily kid focused. Anyhow, the movie turned out to be the Poland one.", |
||||||
|
"Spouse: However, the movie was two hours rather than the expected one hour thirty.", |
||||||
|
"Mom: Did you stay the whole time? I could not see myself walking out. I would feel too embarrassed about the whole audience staring at me.", |
||||||
|
"Spouse: It isn't that hard, you just treat it like you are headed to the bathroom. Except you never come back.", |
||||||
|
"Spouse: But yes, we did leave early, so we'll have to check the rest of the movie on DVD, or see it in theatres when it officially releases.", |
||||||
|
"Mom: Good thing the staff didn't send a search party for you. Maybe you fell into the toilet", |
||||||
|
"Spouse: Haha", |
||||||
|
"Dad: Say, what was the title of the movie?", |
||||||
|
"Spouse: 'Randy Staples Shares the Pain.' We saw all the build up, but missed the payoff.", |
||||||
|
"Grandpa: Back in my day, we used to watch movies for a nickel.", |
||||||
|
"Mom: I remember when gas used to be twenty cents a gallon.", |
||||||
|
"Brother: And I remember when the PS3 cost $599 US dollars.", |
||||||
|
"Cat: Meow, meow meow"], |
||||||
|
|
||||||
|
"Youtube Sensation": |
||||||
|
["Grandpa: Back in my day, we burned rats for fun.", |
||||||
|
"Brother: Ok Grandpa. Anyways, I was at Frankfort mall the other day.", |
||||||
|
"Brother: Just walking around, not really focused on any particular purchase when I noticed a long line. Naturally, you see the line, and wonder what's for.", |
||||||
|
"Brother: So, my buddies and I walked up the line to find out the sitch.", |
||||||
|
"Mom: What's a 'sitch'.", |
||||||
|
"Brother: It means situation.", |
||||||
|
"Mom: I see. How long was the line?", |
||||||
|
"Brother: Oh, it stretched, maybe, half the mall. There were security guards out, to make sure that traffic could get through gaps in the line.", |
||||||
|
"Brother: As we neared the front, we saw that the line moved into some kind of makeup store.", |
||||||
|
"Brother: The flier outside said they had one of those video sensations, you know the one who does the makeup? I can't remember her name.", |
||||||
|
"Mom: So did you go in?", |
||||||
|
"Brother: And wait in that long line? I don't even wear makeup!", |
||||||
|
"Mom: Yeah, but what about your fiancee'? Why not get her something nice?", |
||||||
|
"Brother: I'm sure she would love some makeup, but I can buy that stuff on any day.", |
||||||
|
"Brother: One kind of interesting, but obvious, thing about the line composition was that it was majorly women. There was a handful of guys, but I'd assume they were boyfriends.", |
||||||
|
"Grandpa: Back in my day, I would have gotten in that line and wooed all the women.", |
||||||
|
"Grandma: You can't even grab the attention of a taxi.", |
||||||
|
"Grandpa: You're not making sense. Why would I want to take a taxi out to dinner?", |
||||||
|
"Grandma: No, not taking a taxi out to dinner. Forget it. Just forget it."], |
||||||
|
|
||||||
|
"Girlfriend's Boba Keeps on a-flowing": |
||||||
|
["Girlfriend: You know what boba is right Mom?", |
||||||
|
"Mom: What's Boba?", |
||||||
|
"Girlfriend: Ok, I guess not.", |
||||||
|
"Grandma: What's booba?", |
||||||
|
"Girlfriend: I take it you mean boba?", |
||||||
|
"Grandma: Yes, that thing.", |
||||||
|
"Girlfriend: What most people talk about when they mean 'boba' are tea drinks with milk in them.", |
||||||
|
"Girlfriend: The boba tea drinks are not hard to make, just make black tea, and then add any kind of milk you have, some sweetener, then chill with ice.", |
||||||
|
"Girlfriend: [Player] and I made it at home one time, but that's another story. Anyways, the 'boba' itself are these little black balls that are made out of sweet potato.", |
||||||
|
"Dad: Sweet Potatoes, like a yam?", |
||||||
|
"Brother: Dad, you know that sweet potatoes and yams are not the same right?", |
||||||
|
"Dad: What? They aren't?", |
||||||
|
"Brother: No", |
||||||
|
"Dad: Well, what's the difference?", |
||||||
|
"Brother: I don't know, but the point is they are different.", |
||||||
|
"Girlfriend: Boba is usually made from sweet potatoes, but it can also be made from other starchy materials, I suppose.", |
||||||
|
"Dad: What's it taste like? Kind of...potatoey?", |
||||||
|
"Girlfriend: Not really, it is chewy, a bit like... when you take the first bite into some gum. Right before it gets soft.", |
||||||
|
"Girlfriend: Though when places heat it up, it is really soft and moldable.", |
||||||
|
"Grandma: Hmm. I wouldn't mind trying this boba sometime.", |
||||||
|
"Girlfriend: You definitely should since I know you like your morning tea.", |
||||||
|
"Girlfriend: Now that you all know what boba is, I can tell you about this cool, and somewhat awkward event that happened.", |
||||||
|
"Girlfriend: [Player] and I were driving down the freeway when we remembered that a new boba place was opening up on Teller St.", |
||||||
|
"Girlfriend: As part of their opening promotion, they were offering one free boba drink per customer.", |
||||||
|
"Girlfriend: Since I was thirsty, I suggested we drop by and see what's up.", |
||||||
|
"Girlfriend: We parked and walk up to the building. There weren't too many people about, and a sign revealed why.", |
||||||
|
"Girlfriend: The free boba promotion ended at 8PM, and it was already 10!", |
||||||
|
"Mom: Aww, that's too bad", |
||||||
|
"Girlfriend: I decided to get a drink anyways.", |
||||||
|
"Girlfriend: But when I ordered, the worker said 'Would you like to try one of our free drinks?', and motioned towards the sign", |
||||||
|
"Girlfriend: 'Sure!', Then he asked [Player] what [GenderPronoun] wanted.", |
||||||
|
"Girlfriend: So we both got a full-sized free drink!", |
||||||
|
"Mom: What flavor did you get? I assume there are flavors of boba?", |
||||||
|
"Girlfriend: Yes, there are. I ordered Strawberry. It tasted ok, but was really missing that strawberry flavor.", |
||||||
|
"Girlfriend: The worker asked how they were, and well Mom, you raised me to be an honest individual, so it was lacking in flavor.", |
||||||
|
"Girlfriend: So the worker says, 'Alright, let me make you another one'", |
||||||
|
"Girlfriend: He makes me a completely new boba drink, while letting me keep the old one to drink. At this point I haven't even paid for anything yet", |
||||||
|
"Dad: That's just good customer service. Since this place is new, he is trying to build up customer relations.", |
||||||
|
"Girlfriend: True, but I feel like it got a little out of hand. The next drink also lacked the strawberry flavor. The worker said it is probably because of the syrup.", |
||||||
|
"Girlfriend: He then proceeded to make another drink, still free, using fresh strawberries in lieu of the syrup flavoring.", |
||||||
|
"Girlfriend: Now the syrup drinks were probably really cheap to make, but making drinks with real fruit costs considerably more.", |
||||||
|
"Girlfriend: By the end of our time at the place, the two of us had six drinks in hand without a cent spent.", |
||||||
|
"Girlfriend: The worker just kept offering us samples and I felt really guilty about being so honest.", |
||||||
|
"Girlfriend: I decided to order the drink I was originally going to get, even though I had consumed 2 whole boba drinks already. Sugar overload!", |
||||||
|
"Brother: I hope you left him a fat tip for his troubles.", |
||||||
|
"Girlfriend: Yes, I tipped, [Player] made sure of that.", |
||||||
|
"Girlfriend: With all the caffeine and sugar, I couldn't sleep all night. My heart was in trepidation even through the next morning.", |
||||||
|
"Girlfriend: I probably wouldn't do that again.", |
||||||
|
"Grandma: This sounds like the place I should try my first boba.", |
||||||
|
"Girlfriend: I don't think I could boba for at least a month I'm so burnt out.", |
||||||
|
"Brother: It is settled, right after this meal we're all going out for boba.", |
||||||
|
"Girlfriend: Hah, no.", |
||||||
|
"Brother: No, seriously.", |
||||||
|
"Girlfriend: And seriously. No"], |
||||||
|
|
||||||
|
|
||||||
|
"Grandmother reveals the virtues of the bread line": |
||||||
|
["Brother: The Turkey is taking a while to cook. [Player] isn't too good at cooking is [GenderPronoun]?", |
||||||
|
"Girlfriend: How dare you talk about [Player] like that. [Player] is a great cook. You'll see!", |
||||||
|
"Grandma: You guys have it lucky. Where I grew up we had bread lines.", |
||||||
|
"Grandma: My family would stand in a bread line for over six hours with the POSSIBILITY of receiving a loaf of bread.", |
||||||
|
"Grandma: I remember one particular occasion where my mom told me to take my baby sister with me and go stand in the bread line.", |
||||||
|
"Grandma: I was only 8 years old, and my baby sister was less than a year.", |
||||||
|
"Grandma: Standing is a whole day affair. Some people brought laundry. Others did their crafts in line.", |
||||||
|
"Grandma: My sister and I stood in that line together for over eight hours until we finally reached the front.", |
||||||
|
"Grandma: When we got there. The man with the bread said, 'One loaf of Bread.'", |
||||||
|
"Grandma: I held my baby sister outstretched and said 'Two.'", |
||||||
|
"Grandma: The bread man responded. 'Baby doesn't count. One loaf of bread.' We were then pushed out of line with our one loaf.", |
||||||
|
"Mom: Jesus, that sounds horrible.", |
||||||
|
"Grandma: It was, but it was also necessary. Though when I hear people complaining how they are tired of waiting, I like to retell that story.", |
||||||
|
"Brother: Alright, I suppose it could be worse, but let's hope that [Player] can do better than that."], |
||||||
|
|
||||||
|
"Father talks about the virtues of Automated Cars": |
||||||
|
["Mom: Roger, tell everyone about your automated cars meeting.", |
||||||
|
"Dad: It wasn't a meeting, it was closer to a seminar.", |
||||||
|
"Dad: At work, we accrue credits that can be put towards educational events. Our managers think that an educated workforce is a happy and productive workforce.", |
||||||
|
"Dad: So we are required to spend these credits every year on our choice of relevant education events.", |
||||||
|
"Girlfriend: That's cool. What kind of choices for educational events are there?", |
||||||
|
"Dad: As one example, employees can go to a local college or high school and present about their work at the company.", |
||||||
|
"Dad: Other options are to attend talks about various topics, such as aerospace engineering, materials science, manager relations, customer relations, etc.", |
||||||
|
"Dad: I decided to spend my credits on a five person panel from the various automotive manufacturers about the future of automated vehicles.", |
||||||
|
"Dad: Disappointingly, the panel never went in-depth about the technology side of automated cars.", |
||||||
|
"Dad: The panel just already affirmed what I already knew. Self-driving cars are coming.", |
||||||
|
"Grandpa: Why would you want a self-driving car anyways? Driving is fun!", |
||||||
|
"Grandpa: I remember driving my old station wagon across country to California. Now that was a trip to remember.", |
||||||
|
"Grandpa: The sun was beating down, and we didn't have air conditioning in the car, so you rolled down the window and enjoyed the breeze.", |
||||||
|
"Grandpa: Nowadays, you are spoiled with automatic windows, automatic car washers, automatic transmission.", |
||||||
|
"Grandpa: Why even call it a car? Sounds to me more like a train you ride.", |
||||||
|
"Dad: Yes Dad, which was the general gist of the whole thing. Some people like to drive their car.", |
||||||
|
"Dad: Though one panelist seemed confident that it will eventually take over.", |
||||||
|
"Dad: They quoted 48 minutes as the average amount of time a driver spends in their car per day.", |
||||||
|
"Dad: If most of that time is spent in traffic, or just getting somewhere, then people will adopt a car that can do the nitty gritty driving.", |
||||||
|
"Dad: Drivers can then spend their five leisure minutes on the beach boulevard cruising with manual control.", |
||||||
|
"Grandpa: Enjoy your fandangled self-driving cars, if they ever come.", |
||||||
|
"Grandpa: In the 1960s they used to say we'd have flying cars in the 2000s, but you don't see that now.", |
||||||
|
"Brother: Maybe in my generation. First the self-driving cars, then the flying ones.", |
||||||
|
"Cat: Meow (and then the world!)"], |
||||||
|
|
||||||
|
"Brother recounts a hockey game he saw recently, and his friend has to go to the hospital": |
||||||
|
["Brother: Yo, I watched a hockey game recently. There were cheap group tickets, so a bunch of my friends jumped on it to watch the game.", |
||||||
|
"Girlfriend: Who was playing?", |
||||||
|
"Brother: Some minor league team, the 'Raging Tornados', I believe? It isn't important. The point is seeing two teams pummel each other over a little puck.", |
||||||
|
"Grandpa: Yes, exactly!", |
||||||
|
"Girlfriend: I suppose since we're glorifying the violence of the sport, were there any fights?", |
||||||
|
"Brother: Ah hell yeah! The gloves were thrown to the ice, and the two players starting man-hugging each other.", |
||||||
|
"Brother: The refs just let it go. There was no blood, but it was the intention that mattered.", |
||||||
|
"Brother: Sadly, it isn't like some video games where the winner of the fight gets to stay on the ice. The perpetrator in this case got the penalty.", |
||||||
|
"Brother: But anyways, what was cool was we were allowed to play some broomball on the ice before the game due to our group size.", |
||||||
|
"Brother: That was loads of fun. Until someone got injured.", |
||||||
|
"Mom: Heavens no!", |
||||||
|
"Brother: Well, it wasn't from the broomball.", |
||||||
|
"Brother: Later, when our group was walking around, waiting for the actual game to start, the two hockey teams were practicing and a puck flew into the crowd.", |
||||||
|
"Brother: It smacked one of my friends in the neck, and they had to go to the infirmary.", |
||||||
|
"Mom: But were they okay?", |
||||||
|
"Brother: Yeah, they were fine. They decided to go home however. Too much trauma. They would be flinching with every one-timer during the game.", |
||||||
|
"Mom: Aww, that's a shame. It wasn't Charles was it? Poor Charles...", |
||||||
|
"Brother: No, Mom, Charles is fine.", |
||||||
|
"Girlfriend: Close game?", |
||||||
|
"Brother: Hardly. 3-0", |
||||||
|
"Brother: The tornado mascot kept it interesting though, with his kazoo.", |
||||||
|
"Brother: 'Bzzzwoooooo'", |
||||||
|
"Brother: Ah, here's something. A Catholic girl's school came to sing the national anthem.", |
||||||
|
"Brother: You have to imagine these girls were about five to six years old. So it was mind-numbingly cute.", |
||||||
|
"Brother: The stadium was filled with 'awwws' when they approached the mics.", |
||||||
|
"Brother: Well anyways, these girls were out near the mechanical bull before the game started.", |
||||||
|
"Dad: The stadium has a mechanical bull?", |
||||||
|
"Brother: Yup, pay your five dollars and take it for a ride. The operators know their clientele.", |
||||||
|
"Brother: They let young kids 'tame the bull' while they throw the wrath of God down on the teenagers. Cause they know the teens want to flex their muscle.", |
||||||
|
"Brother: I watched one teen tumble backwards over his head and shoulders in one bout.", |
||||||
|
"Brother: The best part though was those little girls I mentioned earlier.", |
||||||
|
"Brother: They surrounded the bull-riding-rink, all dressed in their school outfits.", |
||||||
|
"Brother: 'Ride the bull. Ride the Bull!', They shouted in unison.", |
||||||
|
"Brother: Then when someone got on.", |
||||||
|
"Brother: 'Make them fall, make them fall!'", |
||||||
|
"Mom: Dawwww", |
||||||
|
"Brother: No Mom! Those little girls are evil!", |
||||||
|
"Brother: But, it was definitely a lot of fun to watch."], |
||||||
|
|
||||||
|
"Mom talks about her students and reading over summer vacation": |
||||||
|
["Girlfriend: Well Mom, how are your students doing?", |
||||||
|
"Mom: Thank you for asking. They are doing well.", |
||||||
|
"Brother: Still teaching the third grade?", |
||||||
|
"Mom: Yessum", |
||||||
|
"Girlfriend: Soo, lay on the juicy stories.", |
||||||
|
"Mom: Mmmm, well, for the winter break coming up I'm planning on having them read 'The BFG'.", |
||||||
|
"Girlfriend: oooh, I liked that book.", |
||||||
|
"Brother: Mom, winter break reading is THE reason that students hate their teachers. Can't you let them enjoy their break in peace?", |
||||||
|
"Mom: But reading is fundamental. We can't let our students forget what they learned.", |
||||||
|
"Girlfriend: It isn't that bad, 'The BFG' is a fun and entertaining book.", |
||||||
|
"Brother: Granted, but forcing one to read kills their love of reading. It did for me.", |
||||||
|
"Brother: After I began reading for fun rather than the school forcing me to do it, I could really appreciate the work for what they are.", |
||||||
|
"Mom: Greg, you are right. But you have to remember that if we don't force kids to do a little reading, they may not do the reading at all.", |
||||||
|
"Mom: I sleep better knowing that my students have been given the opportunity discover works they like, whether or not a little encouragement was given.", |
||||||
|
"Brother: You are an inspiration to us all.", |
||||||
|
"Mom: That's very kind of you to say."], |
||||||
|
|
||||||
|
"Grandmother reveals her name": |
||||||
|
["Grandpa: Lana, did I ever tell you that I am blessed to be married to you?", |
||||||
|
"Grandma: Well, you just know all the right things to say to make a woman feel good.", |
||||||
|
"Brother: Grandma, if you don't mind me asking, I was wondering if your name, 'Lana' had any special meaning in Russian.", |
||||||
|
"Brother: Like, I know some American names, like Mark, are biblical in nature.", |
||||||
|
"Grandma: Ahh, well yes. Very similar", |
||||||
|
"Grandma: Lana is short for Svetlana, which was my given name. I shortened it to 'Lana' because it was easier to pronounce in those parts.", |
||||||
|
"Brother: Sweatlana?", |
||||||
|
"Grandma: Close, but you need to put more 'V' into it.", |
||||||
|
"Grandma: Stalin's daughter was named Svetlana, and so many mothers named their daughters the same in honor.", |
||||||
|
"Grandma: It was be loosely translated to light, and holy. Sort of biblical as you mentioned.", |
||||||
|
"Brother: That's very interesting. Mom, Dad, was there any special reason for naming me Greg?", |
||||||
|
"Mom: Well.", |
||||||
|
"Dad: We looked at a lot baby naming books, and we were having trouble deciding.", |
||||||
|
"Mom: I had a good friend named Greg when I was growing up so I liked that name.", |
||||||
|
"Dad: It sounded good to me, and you ended up a boy, so it worked out.", |
||||||
|
"Brother: So, did the 'Greg' you knew Mom, do anything special or notable? Like, was he famous?", |
||||||
|
"Mom: Uhhh, well, we dated for a while, but it didn't work out.", |
||||||
|
"Brother: Whaat? I'm named after your former lover?! Did you know about this Dad?!", |
||||||
|
"Dad: Yes, but what's the big deal? I still like the name Greg. It's a good strong name.", |
||||||
|
"Brother: I don't think I'll be able to think about my name the same way ever again.", |
||||||
|
"Girlfriend: Hah ha brother. Sucks to be you. Hah ha!", |
||||||
|
"Girlfriend: But please Mom and Dad, don't tell ever me how I got my name.", |
||||||
|
"Mom: Ooh, but your name origin is quite special.", |
||||||
|
"Girlfriend: La la la, I'm not listening!"], |
||||||
|
|
||||||
|
"Grandparents sings a Patriotist song": |
||||||
|
["Grandpa: Since dinner is taking a while, it seems like a good time for a song don't you think?", |
||||||
|
"Dad: Dad, please no...", |
||||||
|
"Grandpa: Ooooh, I saw Mussolini sitting on a log", |
||||||
|
"Grandpa: All puffed up like a great big frog", |
||||||
|
"Grandpa: Sneaked up close and stuck him with a wire", |
||||||
|
"Grandpa: And he just went poof like an old flat tire.", |
||||||
|
"Grandpa: took his hide and hung it on a tree,", |
||||||
|
"Grandpa: and he said 'hey don't do that to me' ", |
||||||
|
"Grandpa: so I took it on home to my mother in law", |
||||||
|
"Grandpa: She threw me outside with the Turkey in the Straw", |
||||||
|
"Grandma: Oooooh Adolf Hitler grabbed a tail, ", |
||||||
|
"Grandma: And he hung right on with tooth and nail, ", |
||||||
|
"Grandma: and he saw what he had and he began to swear, ", |
||||||
|
"Grandma: On the end of the tail was a Russian bear, ", |
||||||
|
"Grandpa: The old bear growled and started in to shake, ", |
||||||
|
"Grandma: Adolf knew he'd made a big mistake.", |
||||||
|
"Grandpa: He tried to hang on and he tried to let go ", |
||||||
|
"Grandma: Now they have a new dance called Hitler in the snow. ", |
||||||
|
"Grandpa: Wow, I didn't know you knew that one. ", |
||||||
|
"Grandma: Word travels fast on the front. Just don't let the officers hear you singing it or they'll whoop your ass faster than you can say vodka. ", |
||||||
|
"Grandpa: Advice to keep close at heart. "], |
||||||
|
|
||||||
|
"Dad Tells a Bad Dad Joke": |
||||||
|
["Dad: Hey guys, what's the key to a great Thanksgiving dinner?", |
||||||
|
"Mom: Of course it is the loving family?", |
||||||
|
"Brother: I bet it is the pillowy mounds of mashed potatoes.", |
||||||
|
"Girlfriend: It is the turkey right?", |
||||||
|
"Dad: That's right, its the turKEY", |
||||||
|
"Dad: turKEY, get it?", |
||||||
|
"Girlfriend: What?", |
||||||
|
"Dad: The KEY to a great thanksgiving dinner is the turKEY.", |
||||||
|
"Girlfriend: Aww, come on Dad. That's terrible.", |
||||||
|
"Grandma: Is this a joke?", |
||||||
|
"Dad: Yes Mom,", |
||||||
|
"Grandma: Well, what do you mean 'key' .", |
||||||
|
"Dad: A 'key', something that is of vital importance.", |
||||||
|
"Grandma: hmmm, ok. I think I get it.", |
||||||
|
"Dad: Ok...."], |
||||||
|
|
||||||
|
"Mom Butter Story": |
||||||
|
["Mom: My favorite color is butter.", |
||||||
|
"Girlfriend: That's cool."], |
||||||
|
|
||||||
|
"Cat Story": |
||||||
|
["Cat: Meow Meow Meow Meow Meow", |
||||||
|
"Dad: I think the cat's hungry!", |
||||||
|
"Cat: Meow", |
||||||
|
"Mom: Look at it, poor thing wants some turkey!", |
||||||
|
"Cat: Meow", |
||||||
|
"Cat: (Translation) If you turn the oven past 1000 degrees, something fun happens!"], |
||||||
|
|
||||||
|
"Cat Story II": |
||||||
|
["Cat: Meow Meow Meow!", |
||||||
|
"Mom: What is it, sweetie?", |
||||||
|
"Cat: Meow Meow Meow!", |
||||||
|
"Cat: (Translation) Why aren't we cooking fish? I want fish for dinner.", |
||||||
|
"Mom: Yes sweetie, that's an oven with a turkey inside! We're going to have a nice dinner.", |
||||||
|
"Cat: Meow", |
||||||
|
"Cat: (Translation) It's like you don't love me anymore.", |
||||||
|
"Mom: It'll be done very soon, I promise! You can have a few bites.", |
||||||
|
"Cat: Meow Meow Meow Meow!", |
||||||
|
"Cat: (Translation) I don't want turkey, I want fish!"], |
||||||
|
|
||||||
|
|
||||||
|
"Mom Talks About Her Bathroom Policy and her Students": |
||||||
|
["Mom: I make sure my students are well hydrated and well rested.", |
||||||
|
"Mom: We have 20 minutes of reading time, 20 minutes of sleeping time, and 20 cumulative daily minutes of bathroom time.", |
||||||
|
"Mom: I bring bottles of water and juice on my own dime to make sure the students are at maximum productivity.", |
||||||
|
"Dad: What if someone needs to use the restroom for 30 minutes?", |
||||||
|
"Mom: It doesn't bug me, but the school has some strict bathroom policies. I've gotten in trouble in the past.", |
||||||
|
"Dad: Oh, You never told me about this. What happened honey?", |
||||||
|
"Mom: I didn't want to bother you with the details. But I guess there's no harm in letting you know.", |
||||||
|
"Mom: For a while I allowed all my students to use the bathroom whenever they wanted. They didn't even have to ask. I wanted the students to feel independent.", |
||||||
|
"Mom: But then the administration told me that all students were required to have a bathroom pass. Too many students were skipping class they feared.", |
||||||
|
"Mom: I never lost a student and all my students knew not to abuse their privileges, but I did as I was told.", |
||||||
|
"Mom: I made sure students signed themselves out, wrote their name, signed it, then took the bathroom pass.", |
||||||
|
"Girlfriend: That seems very efficient. But are the third graders mature enough to get themselves to the bathroom and not goof off?", |
||||||
|
"Mom: Well, every student has their 20 minutes. I don't want to parent them. That's not my job. My job is to teach lessons.", |
||||||
|
"Mom: It seemed to work well. None of my students abused the system.", |
||||||
|
"Mom: But it seemed the administration didn't appreciate the system. They changed the rules once again.", |
||||||
|
"Mom: Now students are only allowed to go to the bathroom once per day. No more than 5 minutes or else I have to go looking for them.", |
||||||
|
"Mom: I told all my students. 'Make sure you use the restroom at recess and before school'. And they did.", |
||||||
|
"Brother: Your students seem very well behaved. I can't even imagine a class of third graders acting as well-mannered as you describe.", |
||||||
|
"Mom: You would be surprised what putting a little trust in a person can do.", |
||||||
|
"Mom: Well, the newest method was working dandy. I wouldn't say it was as good as what we had setup before, but it was fine.", |
||||||
|
"Mom: Less than a week later however, I got another memo.", |
||||||
|
"Mom: 'Students are to be allowed to use the restroom facilities whenever they need.", |
||||||
|
"Dad: They reverted their one-bathroom per child policy?", |
||||||
|
"Mom: I hate to bring this up at the dinner table.", |
||||||
|
"Grandma: Don't be worrying. Tell us the story.", |
||||||
|
"Mom: Sigh, ok. One of the students in the other class, not mine of course, had to use the restroom. But she had already used her one bathroom break.", |
||||||
|
"Mom: So the teacher told her to go back to her seat.", |
||||||
|
"Mom: A while later....", |
||||||
|
"Brother: Ahh geeez, she peed everywhere?", |
||||||
|
"Mom: Greg!", |
||||||
|
"Brother: What? It isn't like this is the first time this has ever happened? I hear about this happening all the time on internet message boards.", |
||||||
|
"Mom: It was certainly a surprise for me!", |
||||||
|
"Dad: I'm sorry to, hehehe, hear that honey.", |
||||||
|
"Mom: This isn't a laughing matter.", |
||||||
|
"Dad: Sorry ma'am."], |
||||||
|
|
||||||
|
"Grandpa tells a story about how a bug crawls in the ear of one of his fellow army buddies during the Korean War": |
||||||
|
["Grandpa: Mmmm mmm, I can't wait to hear the sizzling of that turkey.", |
||||||
|
"Grandma: You never seem to hear when I call you.", |
||||||
|
"Grandpa: That's called selective hearing. My hearing is fine.", |
||||||
|
"Grandpa: Which reminds me of my old friend Jimmy.", |
||||||
|
"Grandma: How is ol' Jimmy?", |
||||||
|
"Grandpa: Deaf in the one ear as usual, but he couldn't be a happier soul. We're going golfing next week.", |
||||||
|
"Mom: I don't believe I've met Jimmy.", |
||||||
|
"Grandpa: He and I go way back. We were GIs together during the Korean War. Then he lost his hearing.", |
||||||
|
"Brother: Was it due to the loudness of the guns? A mortar round? Shrapnel?", |
||||||
|
"Grandpa: I don't know what the media has filled your noggin with, but not all injury in war is glamorous.", |
||||||
|
"Brother: I agree, war is terrible. But, I must say the technology is interesting.", |
||||||
|
"Grandpa: Be glad you don't have to serve and only reap the riches of wartime development.", |
||||||
|
"Grandpa: As for Jimmy, he lost his hearing at camp.", |
||||||
|
"Grandpa: We went to sleep for the night and a beetle bug crawled in his ear.", |
||||||
|
"Grandpa: Tried to fish it out but he ended up crushing it.", |
||||||
|
"Grandpa: Field medics couldn't get all the pieces out, and we were at least two days away from a decent hospital.", |
||||||
|
"Grandpa: The ear got infected and Jimmy lost his hearing soon after.", |
||||||
|
"Grandpa: 'Bug Brain' we used to call him. Great guy.", |
||||||
|
"Girlfriend: I'm sorry to hear that.", |
||||||
|
"Grandpa: Can't undo the past. Those dang bugs were everywhere though.", |
||||||
|
"Mom: Gross, Gross, Gross. ", |
||||||
|
"Grandpa: It isn't that bad. Be grateful I didn't tell you the story where we ate them. Not bad. A little crunchy. Not as good as turkey though.", |
||||||
|
"Mom: !!!"], |
||||||
|
|
||||||
|
"Story about Girlfriend's teacher that makes buzzer noises when you got something wrong": |
||||||
|
["Girlfriend: Greg, here's something that might tinkle your fancy.", |
||||||
|
"Girlfriend: I saw my old professor from a couple years back, Professor Ronfleur. The Humanities teacher. Do you remember him?", |
||||||
|
"Brother: The guy who always wore the purple bow tie? Who could forget him? Did he buzz you?", |
||||||
|
"Girlfriend: Ha-ha, no, but that's why I brought it up. That buzz!", |
||||||
|
"Mom: What buzz?", |
||||||
|
"Girlfriend: I guess we never told you Mom. Remember when we took that humanities class at the local community college during the summer?", |
||||||
|
"Girlfriend: We were trying to get the lower division English requirements out the way so could take classes at college that were actually worth our time.", |
||||||
|
"Girlfriend: This Professor Ronfleur used to make a buzzing sound whenever anybody got something wrong.", |
||||||
|
"Girlfriend: 'In what way does Aristotle disagree with Plato's Allegory of the Cave?' and then...", |
||||||
|
"Girlfriend: BRRZZZZZZZT!", |
||||||
|
"Girlfriend: He would make this super nasally buzzing noise.", |
||||||
|
"Brother: Seriously! Whenever I see the guy, I can just imagine pressing his bow tie and a buzzing noise coming out.", |
||||||
|
"Girlfriend: And he did it ALL. THE. TIME.", |
||||||
|
"Brother: Yeah! Did he say anything to you when he saw you?", |
||||||
|
"Girlfriend: I said hello and introduced myself, but he didn't know me. Just gave me the glazed ham eye look.", |
||||||
|
"Brother: Glazed ham?", |
||||||
|
"Girlfriend: For Thanksgiving.", |
||||||
|
"Brother: He gave you the glazed turkey look.", |
||||||
|
"Girlfriend: Exactly."], |
||||||
|
|
||||||
|
"Brother's Fiancee is on Business Trip": |
||||||
|
["Mom: Greg, where's your fiancée? Why didn't you invite her over for Thanksgiving dinner?", |
||||||
|
"Brother: I did invite her, but she couldn't make it. She is on a business trip and could not get the time off.", |
||||||
|
"Mom: A business trip on Thanksgiving? But Thanksgiving only happens once per year! This is the perfect time to rekindle the spirit of family.", |
||||||
|
"Brother: I know Mom, but Thanksgiving doesn't happen everywhere, and her job in sales demands that she travel abroad to meet with potential clients in person.", |
||||||
|
"Brother: I miss her a lot when she leaves, but whenever she returns home, we make every moment count. We count our blessings every day.", |
||||||
|
"Mom: Amen", |
||||||
|
"Brother: Though, it is too bad that since we're both so busy all the time, our new house remains largely unoccupied throughout the day.", |
||||||
|
"Mom: Awww honey, I'll have to come and visit.", |
||||||
|
"Brother: uh, well yeah, sure Mom. You can come and visit.", |
||||||
|
"Grandpa: What!? I want to come and see your new place too.", |
||||||
|
"Brother: Sure...yeah ok.", |
||||||
|
"Girlfriend: You aren't going to invite me?", |
||||||
|
"Brother: Yes, definitely. Everyone can come and visit. Just... I don't want to stress out my fiancée when she comes home.", |
||||||
|
"Brother: She likes to relax at home.", |
||||||
|
"Mom: Don't worry honey, we won't stress her out. I'll make her my delicious breakfast omelet.", |
||||||
|
"Grandpa: And I'll tell her my war stories.", |
||||||
|
"Brother: Oh, good..."], |
||||||
|
|
||||||
|
"Turkey Fact - Snood":
|
||||||
|
["Turkey: Gobble Gobble. Turkeys have a fleshy bit that comes off their forehead called the snood. Turkey farmers will occasional remove the snood, in a process called 'de-snooding'.", |
||||||
|
"Turkey: Male turkeys like their snood intact to attract a mate, and for dominance. Be kind to your turkey. Do not lose the snood."], |
||||||
|
|
||||||
|
"Turkey Fact - Cat Puns":
|
||||||
|
["Turkey: Gobble Gobble. I suppose it is too late to ask you not to eat me. But is it too late to ask for you to kick that cat of yours?", |
||||||
|
"Cat: Hey Turkey, it has been a long time. I see you're dead.", |
||||||
|
"Turkey: Kasey, how dare you speak to me. First, you steal my plans for world domination and now you gloat at my passing. For shame.", |
||||||
|
"Cat: It isn't my fault you taste so delicious. I'm going to delight in eating your flesh. Maybe if I beg enough they may give me your head on a platter", |
||||||
|
"Turkey: Oooh, don't get me fired up.", |
||||||
|
"Cat: Meow meow meow! The oven is doing that quite nicely.", |
||||||
|
"Turkey: Ga-Gobble!", |
||||||
|
"Cat: Meow Meow", |
||||||
|
"Dad: Aww Kasey, can't you a cute little kitty."], |
||||||
|
|
||||||
|
"Turkey Fact - Wattle": |
||||||
|
["Turkey: Hey, it is time for another turkey fact.", |
||||||
|
"Turkey: Most people will recognize the wattle on a chicken as that piece of red flesh that hangs down from the beak.", |
||||||
|
"Turkey: But did you know turkeys have them too?", |
||||||
|
"Turkey: I personally believe they are much sexier on a turkey than a chicken anyhow. And you can bet a fine wattle will attract the hen's attention.", |
||||||
|
"Turkey: Gobble Gobble"], |
||||||
|
|
||||||
|
"Turkey Fact - Unsuscribe": |
||||||
|
["Turkey: I hope I'm worth it. But hey, now you can listen to a wonderful fact about turkeys.", |
||||||
|
"Turkey: Turkeys are members of the order Galliformes. That means we share relations to other birds like the chicken and pheasant.", |
||||||
|
"Turkey: To unsubscribe from Turkey facts, please gobble like a turkey into the microphone.", |
||||||
|
"Turkey: 'Gobble' in 3", |
||||||
|
"Turkey: 2", |
||||||
|
"Turkey: 1", |
||||||
|
"Turkey: Now Recording...", |
||||||
|
"Turkey: I'm sorry, we didn't recognize your dialect. Please try again soon.", |
||||||
|
"Turkey: You are now automatically renewed for another full year of Turkey Facts", |
||||||
|
"Turkey: Please have a nice day."], |
||||||
|
|
||||||
|
"Turkey Fact - genus": |
||||||
|
["Turkey: My friend, welcome to another fantastic turkey fact!", |
||||||
|
"Turkey: Today we're learning that turkeys are in the genus Meleagris.", |
||||||
|
"Turkey: This is probably useless information for you. Good!", |
||||||
|
"Turkey: Until next time."], |
||||||
|
|
||||||
|
"Turkey Fact - gobble": |
||||||
|
["Turkey: The turkey is often associated with the gobble sound. But that is just sexist.", |
||||||
|
"Turkey: Only male turkeys gobble. Females instead make cooing and clicking noises. Put an end to stereotypes!"], |
||||||
|
|
||||||
|
"Turkey Fact - poult": |
||||||
|
["Turkey: Don't eat me, I have children. Zillions of children.", |
||||||
|
"Turkey: But since we're talking about children, did you know that a young turkey is called a poult?", |
||||||
|
"Turkey: Now you do.", |
||||||
|
"Turkey: By the way, the best way to cook a turkey is to not at all."], |
||||||
|
|
||||||
|
"Turkey Fact - World Dominination": |
||||||
|
["Turkey: Hey Kasey.", |
||||||
|
"Cat: What may I do for you juicy?", |
||||||
|
"Turkey: Don't piss off turkeys or they'll gang up on you.", |
||||||
|
"Turkey: That's because a group of turkeys is called a gang.", |
||||||
|
"Turkey: A turkey group may also be called a rafter.", |
||||||
|
"Turkey: I'm more of a kayaker personally.", |
||||||
|
"Cat: Get meowta here", |
||||||
|
"Turkey: That pun was fowl", |
||||||
|
"Cat: Purrrsonally, not as bad as yours.", |
||||||
|
"Turkey: Gobble Gobble"] |
||||||
|
|
||||||
|
}; |
@ -0,0 +1,935 @@ |
|||||||
|
function ClockUI( stage, gameState ){ |
||||||
|
var that = this; |
||||||
|
|
||||||
|
this.minuteRadius = 30; |
||||||
|
this.hourRadius = 0.7 * this.minuteRadius; |
||||||
|
this.clockX = 246; |
||||||
|
this.clockY = 146; |
||||||
|
|
||||||
|
this.getClockAngles = function( ){ |
||||||
|
var currTime = new Date( gameState.currentTime ); |
||||||
|
|
||||||
|
var hourAngle = 720 * ( currTime.getHours() / 24 ) - 90; |
||||||
|
var minuteAngle = 360 * ( currTime.getMinutes() / 60 ) - 90; |
||||||
|
return [ hourAngle, minuteAngle ]; |
||||||
|
} |
||||||
|
|
||||||
|
var minuteLine = new createjs.Shape(); |
||||||
|
minuteWidth = this.minuteRadius; |
||||||
|
minuteHeight = 1; |
||||||
|
minuteLine.graphics.beginFill('black').drawRect( 0, 0, minuteWidth, minuteHeight ); |
||||||
|
minuteLine.regX = 0; |
||||||
|
minuteLine.regY = minuteHeight / 2; |
||||||
|
minuteLine.x = this.clockX; |
||||||
|
minuteLine.y = this.clockY; |
||||||
|
|
||||||
|
var hourLine = new createjs.Shape(); |
||||||
|
hourWidth = this.hourRadius; |
||||||
|
hourHeight = 1; |
||||||
|
hourLine.graphics.beginFill('black').drawRect( 0, 0, hourWidth, hourHeight ); |
||||||
|
hourLine.regX = 0; |
||||||
|
hourLine.regY = hourHeight / 2; |
||||||
|
hourLine.x = this.clockX; |
||||||
|
hourLine.y = this.clockY; |
||||||
|
|
||||||
|
stage.addChild( minuteLine ); |
||||||
|
stage.addChild( hourLine ); |
||||||
|
return { |
||||||
|
tick: function(){ |
||||||
|
var angles = that.getClockAngles(); |
||||||
|
hourLine.rotation = angles[0]; |
||||||
|
minuteLine.rotation = angles[1]; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
function HelpUI( stage, gameState ){ |
||||||
|
var that = this; |
||||||
|
this.showingHelp = false; |
||||||
|
var helpPages = [ |
||||||
|
new createjs.Bitmap("res/screens/HelpCreditsScreen/HelpP1P2.png"), |
||||||
|
new createjs.Bitmap("res/screens/HelpCreditsScreen/HelpP3P4.png"), |
||||||
|
new createjs.Bitmap("res/screens/HelpCreditsScreen/HelpP5P6.png"), |
||||||
|
new createjs.Bitmap("res/screens/HelpCreditsScreen/HelpP7P8.png") |
||||||
|
]; |
||||||
|
var position = 0; |
||||||
|
var helpImg = helpPages[0]; |
||||||
|
var closeButton = new Button( stage, gameState, 708, 8, 80, 50,null, null, function(){ that.hideHelp(); } ); |
||||||
|
var nextButton = new Button( stage, gameState, 645, 543, 80, 50, null,null, function(){ gameState.pubsub.publish("Play", "Open_Cookbook"); |
||||||
|
if( helpImg ){ |
||||||
|
position++; |
||||||
|
helpImg.visible = false; |
||||||
|
helpImg = helpPages[ position % 4 ]; |
||||||
|
helpImg.visible = true; |
||||||
|
} else{ |
||||||
|
that.hideHelp(); |
||||||
|
} |
||||||
|
}); |
||||||
|
var prevButton = new Button( stage, gameState, 77, 546, 80, 50, null,null, function(){ gameState.pubsub.publish("Play", "Open_Cookbook"); |
||||||
|
if( helpImg ){ |
||||||
|
position--; |
||||||
|
helpImg.visible = false; |
||||||
|
helpImg = helpPages[ Math.abs(position) % 4 ]; |
||||||
|
helpImg.visible = true; |
||||||
|
} else { |
||||||
|
that.hideHelp(); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
this.hideHelp = function(){ |
||||||
|
helpImg.visible=false; |
||||||
|
stage.removeChild( closeButton ); |
||||||
|
stage.removeChild( nextButton ); |
||||||
|
stage.removeChild( prevButton ); |
||||||
|
for( var i in helpPages ){ |
||||||
|
helpPages[i].visible = false; |
||||||
|
stage.removeChild( helpPages[i] ); |
||||||
|
} |
||||||
|
that.showingHelp = false; |
||||||
|
gameState.pubsub.publish("Play", "Close_Cookbook"); |
||||||
|
} |
||||||
|
|
||||||
|
// Show core temperature
|
||||||
|
this.showHelp = function(){ |
||||||
|
if( that.showingHelp ) return; |
||||||
|
gameState.pubsub.publish("Play", "Open_Cookbook"); |
||||||
|
|
||||||
|
for( var i in helpPages ){ |
||||||
|
helpPages[i].visible = false; |
||||||
|
stage.addChild( helpPages[i] ); |
||||||
|
} |
||||||
|
|
||||||
|
helpPages[0].visible = true; |
||||||
|
stage.addChild( that.background ); |
||||||
|
stage.addChild( closeButton ); |
||||||
|
stage.addChild( nextButton ); |
||||||
|
stage.addChild( prevButton ); |
||||||
|
that.showingHelp = true; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
// change temperature, this one's for the UI
|
||||||
|
gameState.pubsub.subscribe( "ShowHelp", this.showHelp ); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
function FinalConfirmationUI(stage, gameState){ |
||||||
|
var that = this; |
||||||
|
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(){ |
||||||
|
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(){ |
||||||
|
stage.removeChild( finalImg ); |
||||||
|
stage.removeChild( yesButton ); |
||||||
|
stage.removeChild( noButton ); |
||||||
|
that.showingConfirm = false; |
||||||
|
}; |
||||||
|
|
||||||
|
// Show core temperature
|
||||||
|
this.showFinalConfirm = function(){ |
||||||
|
if(DEBUG) console.log("Showing final confirm"); |
||||||
|
if( !that.showingConfirm ){ |
||||||
|
that.showingConfirm = true; |
||||||
|
stage.addChild( finalImg ); |
||||||
|
stage.addChild( noButton ); |
||||||
|
stage.addChild( yesButton ); |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
// change temperature, this one's for the UI
|
||||||
|
gameState.pubsub.subscribe( "ShowFinalConfirm", this.showFinalConfirm ); |
||||||
|
} |
||||||
|
|
||||||
|
function DeathUI(stage, gameState){ |
||||||
|
var that = this; |
||||||
|
this.showingConfirm = false; |
||||||
|
|
||||||
|
var finalImg = new createjs.Bitmap("res/screens/KitchenScreen/HouseFireRetry.png"); |
||||||
|
var deathCount = new createjs.Text( UtilityFunctions.randRange(1,6), "24px Arial", "black" ); |
||||||
|
deathCount.x = 695; |
||||||
|
deathCount.y = 260; |
||||||
|
|
||||||
|
var retryButton = new Button( stage, gameState, 578, 520, 200, 50, null, null, function(){ |
||||||
|
document.location.reload(); |
||||||
|
} ); |
||||||
|
|
||||||
|
var explosion = { boom:{ frames:[35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0], next:false } }; |
||||||
|
var data = { |
||||||
|
images: ["res/screens/KitchenScreen/Explosion_AnimationLowRes.png"], |
||||||
|
frames: { width:400, height:300 }, |
||||||
|
animations: explosion |
||||||
|
}; |
||||||
|
|
||||||
|
var spriteSheet = new createjs.SpriteSheet(data); |
||||||
|
var animation = new createjs.Sprite(spriteSheet, "treeAnimations"); |
||||||
|
animation.x = 0; |
||||||
|
animation.y = 0; |
||||||
|
animation.scaleX = animation.scaleY = 2; |
||||||
|
|
||||||
|
// Show core temperature
|
||||||
|
this.showDeath = function(){ |
||||||
|
stage.addChild( finalImg ); |
||||||
|
animation.gotoAndPlay("boom"); |
||||||
|
stage.addChild( deathCount ); |
||||||
|
stage.addChild( animation ); |
||||||
|
stage.addChild( retryButton ); |
||||||
|
}; |
||||||
|
|
||||||
|
// change temperature, this one's for the UI
|
||||||
|
gameState.pubsub.subscribe( "Death", this.showDeath ); |
||||||
|
} |
||||||
|
|
||||||
|
function AlarmUI(stage, gameState){ |
||||||
|
var that = this; |
||||||
|
this.showingConfirm = false; |
||||||
|
|
||||||
|
var oldTime = Date.now(); |
||||||
|
var showColon = true; |
||||||
|
var timerText = new createjs.Text("00:00", "24px Arial", "black" ); |
||||||
|
timerText.x = 372; |
||||||
|
timerText.y = 290; |
||||||
|
|
||||||
|
var clearButton = new Button( stage, gameState, 364, 327, 17, 13, null, null, function(){ |
||||||
|
gameState.alarmTimer = 0; |
||||||
|
gameState.alarmActivated = false; |
||||||
|
that.updateTimer(); |
||||||
|
} ); |
||||||
|
|
||||||
|
var hourButton = new Button( stage, gameState, 386, 327, 24, 13, null, null, function(){ |
||||||
|
gameState.alarmTimer +=3600; |
||||||
|
gameState.alarmActivated = true; |
||||||
|
that.updateTimer(); |
||||||
|
} ); |
||||||
|
var minuteButton = new Button( stage, gameState, 414, 327, 24, 13, null, null, function(){ |
||||||
|
gameState.alarmTimer +=300; |
||||||
|
gameState.alarmActivated = true; |
||||||
|
that.updateTimer(); |
||||||
|
} ); |
||||||
|
|
||||||
|
this.updateTimer = function(){ |
||||||
|
var colon = showColon ? ":" : " "; |
||||||
|
var totalSec = gameState.alarmTimer; |
||||||
|
var hours = parseInt( totalSec / 3600 ) % 24 |
||||||
|
var minutes = parseInt( totalSec / 60 ) % 60; |
||||||
|
var timeText = ("00"+hours).slice(-2) + colon + ("00"+minutes).slice(-2); |
||||||
|
timerText.text = timeText; |
||||||
|
} |
||||||
|
|
||||||
|
this.activateTimer = function(){ |
||||||
|
gameState.alarmActivated = true; |
||||||
|
} |
||||||
|
|
||||||
|
// Show core temperature
|
||||||
|
|
||||||
|
stage.addChild( timerText ); |
||||||
|
stage.addChild( clearButton ); |
||||||
|
stage.addChild( hourButton ); |
||||||
|
stage.addChild( minuteButton ); |
||||||
|
|
||||||
|
|
||||||
|
this.updateTimer(); |
||||||
|
|
||||||
|
return{ |
||||||
|
tick: function(){ |
||||||
|
// IMPORTANT: SECOND TIMER
|
||||||
|
var diff = Date.now() - oldTime; |
||||||
|
if( diff > 1000 ){ |
||||||
|
if( gameState.alarmActivated && gameState.alarmTimer <=0 ){ |
||||||
|
gameState.alarmTimer = 0; |
||||||
|
gameState.pubsub.publish("Play", "BeepBeep") |
||||||
|
} |
||||||
|
|
||||||
|
that.updateTimer(); |
||||||
|
showColon = !showColon; |
||||||
|
|
||||||
|
if( gameState.alarmActivated ) |
||||||
|
gameState.alarmTimer --; |
||||||
|
|
||||||
|
oldTime = Date.now(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
function CookbookUI( stage, gameState ){ |
||||||
|
var that = this; |
||||||
|
this.showingCookbook = false; |
||||||
|
|
||||||
|
var cookbookImg = new createjs.Bitmap("res/screens/KitchenScreen/Cookbook-Open.png"); |
||||||
|
var closeButton = new Button( stage, gameState, 710, 10, 100, 50, null, null, function(){that.hideCookbook();} ); |
||||||
|
var turkeyTypeText = new createjs.Text("", "18px Arial", "black" ); |
||||||
|
turkeyTypeText.x = 535; |
||||||
|
turkeyTypeText.y = 56; |
||||||
|
|
||||||
|
var turkeyWeightText = new createjs.Text("", "18px Arial", "black" ); |
||||||
|
turkeyWeightText.x = 553; |
||||||
|
turkeyWeightText.y = 85; |
||||||
|
|
||||||
|
var logEntries = []; |
||||||
|
this.hideCookbook = function(){ |
||||||
|
|
||||||
|
stage.removeChild( closeButton ); |
||||||
|
stage.removeChild( cookbookImg ); |
||||||
|
stage.removeChild( turkeyTypeText ); |
||||||
|
stage.removeChild(turkeyWeightText); |
||||||
|
for( i in logEntries ){ |
||||||
|
stage.removeChild(logEntries[i]); |
||||||
|
} |
||||||
|
that.showingCookbook = false; |
||||||
|
gameState.pubsub.publish("Play", "Close_Cookbook"); |
||||||
|
} |
||||||
|
|
||||||
|
// Show core temperature
|
||||||
|
this.showCookbook = function(){ |
||||||
|
if( !that.showingCookbook ){ |
||||||
|
stage.addChild( cookbookImg ); |
||||||
|
stage.addChild( closeButton ); |
||||||
|
|
||||||
|
turkeyTypeText.text = gameState.turkeyType; |
||||||
|
turkeyWeightText.text = gameState.turkeyWeight + " lbs"; |
||||||
|
for( i in gameState.peekRecords ){ |
||||||
|
var record = gameState.peekRecords[i]; |
||||||
|
var time = new Date( gameState.peekRecords[i].getTime() ); |
||||||
|
|
||||||
|
var logLine = new createjs.Text( "OFF", "12px Arial", "black" ); |
||||||
|
|
||||||
|
logLine.x = 423; |
||||||
|
logLine.y = 50 * i+ 165; |
||||||
|
logLine.textBaseline = "alphabetic"; |
||||||
|
logLine.text = record.getType() + " " + ("00"+time.getHours()).slice(-2) + ":" + ("00"+time.getMinutes()).slice(-2) + " " + record.getContent(); |
||||||
|
|
||||||
|
logEntries.push(logLine); |
||||||
|
stage.addChild(logLine); |
||||||
|
} |
||||||
|
stage.addChild(turkeyTypeText); |
||||||
|
stage.addChild(turkeyWeightText); |
||||||
|
|
||||||
|
that.showingCookbook = true; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
// change temperature, this one's for the UI
|
||||||
|
gameState.pubsub.subscribe( "ShowCookbook", this.showCookbook ); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
function OvenUI( stage, gameState ){ |
||||||
|
var that = this; |
||||||
|
var OVEN_CLOSED = 0; |
||||||
|
var OVEN_PEEK = 1; |
||||||
|
var OVEN_OPEN = 2; |
||||||
|
|
||||||
|
this.ovenDoor = OVEN_CLOSED; |
||||||
|
var ovenLight = new createjs.Shape(); |
||||||
|
ovenLight.graphics.beginFill( "black" ).drawCircle( 181, 126, 2 ); |
||||||
|
|
||||||
|
var confirmation = new FinalConfirmationUI(stage, gameState ); |
||||||
|
var death = new DeathUI(stage,gameState); |
||||||
|
|
||||||
|
// Oven light control
|
||||||
|
this.changeOvenLight = function( state ){ |
||||||
|
if( state == "On" ){ |
||||||
|
ovenLight.visible = false; |
||||||
|
} else { |
||||||
|
ovenLight.visible = true; |
||||||
|
} |
||||||
|
} |
||||||
|
this.doneSkipTime = true; |
||||||
|
|
||||||
|
// place turkeys in oven
|
||||||
|
for (i in gameState.turkeyStates){ |
||||||
|
gameState.turkeyStates[i].alpha = 0; |
||||||
|
gameState.turkeyStates[i].scaleX = gameState.turkeyStates[i].scaleY =1; |
||||||
|
gameState.turkeyStates[i].x = 75; |
||||||
|
gameState.turkeyStates[i].y = 258; |
||||||
|
} |
||||||
|
|
||||||
|
var temperatureText = new createjs.Text( "OFF", "40px Arial", "#ff7700" ); |
||||||
|
temperatureText.x = 50; |
||||||
|
temperatureText.y = 147; |
||||||
|
temperatureText.textBaseline = "alphabetic"; |
||||||
|
|
||||||
|
var lightPressedImg = new createjs.Bitmap( "res/screens/KitchenScreen/LightButtonDepressed.png" ); |
||||||
|
lightPressedImg.alpha = 0; |
||||||
|
|
||||||
|
var doorClosedLightOff = new createjs.Bitmap( "res/screens/KitchenScreen/DoorClosedLightOff.png" ); |
||||||
|
doorClosedLightOff.alpha = 1; |
||||||
|
|
||||||
|
var doorClosedLightOn = new createjs.Bitmap( "res/screens/KitchenScreen/DoorClosedLightOn.png" ); |
||||||
|
doorClosedLightOn.alpha = 0; |
||||||
|
|
||||||
|
var doorPeekLightOff = new createjs.Bitmap( "res/screens/KitchenScreen/DoorPeekLightOff.png" ); |
||||||
|
doorPeekLightOff.alpha = 0; |
||||||
|
|
||||||
|
var doorPeekLightOn = new createjs.Bitmap( "res/screens/KitchenScreen/DoorPeekLightOn.png" ); |
||||||
|
doorPeekLightOn.alpha = 0; |
||||||
|
|
||||||
|
var doorOpen = new createjs.Bitmap( "res/screens/KitchenScreen/DoorOpen.png" ); |
||||||
|
doorOpen.alpha = 0; |
||||||
|
|
||||||
|
var redState = new createjs.Bitmap( "res/screens/KitchenScreen/OvenTurnRedState.png" ); |
||||||
|
redState.alpha = 0; |
||||||
|
|
||||||
|
var panFront = new createjs.Bitmap( "res/screens/KitchenScreen/PanFront.png" ); |
||||||
|
panFront.alpha = 0; |
||||||
|
|
||||||
|
this.changeTemperature = function( direction ){ |
||||||
|
|
||||||
|
if( gameState.turkeyBought ){ |
||||||
|
if( temperatureText.text == "OFF" && direction == "Up" ) temperatureText.text = "125"; |
||||||
|
if( !( temperatureText.text == "OFF" && direction == "Down" ) ){ |
||||||
|
|
||||||
|
var temp = ( direction == "Up" ? parseInt(temperatureText.text)+25 : parseInt(temperatureText.text)-25); |
||||||
|
|
||||||
|
// Check lower bound for OFF
|
||||||
|
temp = temp < 150 ? temp = "OFF" : temp; |
||||||
|
|
||||||
|
// Check upper bound
|
||||||
|
if( temp > 500 ){ |
||||||
|
redState.alpha = ( temp - 500 )/( 1100 - 500 ); |
||||||
|
} |
||||||
|
|
||||||
|
// if over 1100 F, burn house down
|
||||||
|
if( temp > 1100 ){ |
||||||
|
gameState.pubsub.publish("Death",""); |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
temperatureText.text = temp; |
||||||
|
} |
||||||
|
|
||||||
|
// Tell our model to set the actual temperature
|
||||||
|
gameState.ovenModel.changeTemp( UtilityFunctions.F2C( temperatureText.text == "OFF" ? 125 : parseInt( temperatureText.text ) ) ); |
||||||
|
} |
||||||
|
else{ |
||||||
|
gameState.pubsub.publish("ShowDialog",{seq:"EmptyOven", autoAdvance: true}); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
this.ovenLightToggle = function(){ |
||||||
|
|
||||||
|
// Only work if the user bought an oven light
|
||||||
|
if( gameState.boughtOvenLight ){ |
||||||
|
lightPressedImg.alpha = lightPressedImg.alpha == 0 ? 1 : 0; |
||||||
|
if( that.ovenDoor == OVEN_CLOSED){ |
||||||
|
doorClosedLightOn.alpha = lightPressedImg.alpha == 0 ? 0 : 1; |
||||||
|
doorClosedLightOff.alpha = lightPressedImg.alpha == 0 ? 1 : 0; |
||||||
|
doorOpen.alpha = 0; |
||||||
|
} |
||||||
|
else if( that.ovenDoor == OVEN_PEEK ){ |
||||||
|
doorPeekLightOn.alpha = lightPressedImg.alpha == 0 ? 0 : 1; |
||||||
|
doorPeekLightOff.alpha = lightPressedImg.alpha == 0 ? 1 : 0; |
||||||
|
doorOpen.alpha = 0; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
this.startTurkeyModel = function(){ |
||||||
|
if(DEBUG) console.log("weight is" + gameState.turkeyWeight); |
||||||
|
gameState.ovenModel = new OvenModel( gameState.turkeyWeight, gameState ); |
||||||
|
} |
||||||
|
|
||||||
|
var handleBar = new createjs.Shape(); |
||||||
|
handleBar.graphics.beginFill("#ffffff").drawRect(20, 190, 300, 20); |
||||||
|
handleBar.alpha = 0.01; |
||||||
|
handleBar.addEventListener( "mouseover", function(){ document.body.style.cursor='pointer'; } ); |
||||||
|
handleBar.addEventListener( "mouseout", function(){ document.body.style.cursor='default'; } ); |
||||||
|
handleBar.addEventListener( "pressup", handlePress ); |
||||||
|
|
||||||
|
var evalSkin = { |
||||||
|
"raw": "The turkey looks no different from when I put it in", |
||||||
|
"undercooked": "The skin looks pink", |
||||||
|
"slightly cooked": "The turkey could use a couple more minutes", |
||||||
|
"cooked": "The turkey looks good enough to eat", |
||||||
|
"overcooked": "The turkey looks a bit shriveled", |
||||||
|
"dry": "The turkey looks like cardboard", |
||||||
|
"burnt": "The turkey looks burnt" |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
// Look for a drag event
|
||||||
|
function handlePress(event) { |
||||||
|
if( event.stageY > 300 && that.ovenDoor != OVEN_OPEN ){ |
||||||
|
that.ovenDoor = OVEN_OPEN; |
||||||
|
doorPeekLightOn.alpha = doorClosedLightOn.alpha = 0; |
||||||
|
doorPeekLightOff.alpha = doorClosedLightOff.alpha = 0; |
||||||
|
doorOpen.alpha = 1; |
||||||
|
handleBar.graphics.clear(); |
||||||
|
handleBar.graphics.beginFill("#ffffff").drawRect(5, 450, 400, 60); |
||||||
|
handleBar.alpha = 0.01; |
||||||
|
|
||||||
|
if( gameState.turkeyBought ){ |
||||||
|
var state = gameState.ovenModel.getTurkeyState(); |
||||||
|
gameState.pubsub.publish( "ShowDialog", {seq:"custom", autoAdvance:true, customText:evalSkin[turkeyState["skin"]["cond"][2]] + "." } ); |
||||||
|
gameState.pubsub.publish( "AddRecord", {type:"Open ", text:"The turkey looked " + turkeyState["skin"]["cond"][2]} ); |
||||||
|
//gameState.ovenModel.setRawTemp( (gameState.ovenModel.getRawTemp() - 25) < 150 ? 150 : gameState.ovenModel.getRawTemp() - 25 );
|
||||||
|
gameState.ovenOpened++; |
||||||
|
} |
||||||
|
|
||||||
|
gameState.pubsub.publish( "Play", "Oven_Door_Full_Open" ); |
||||||
|
}else if (that.ovenDoor == OVEN_OPEN ){ |
||||||
|
that.ovenDoor = OVEN_PEEK; |
||||||
|
gameState.pubsub.publish( "Play", "Oven_Door_Full_Close" ); |
||||||
|
handleBar.graphics.clear(); |
||||||
|
handleBar.graphics.beginFill("#ffffff").drawRect(20, 190, 300, 20); |
||||||
|
handleBar.alpha = 0.01; |
||||||
|
ovenPeek(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
handleBar.addEventListener( "click", ovenPeek ); |
||||||
|
|
||||||
|
function ovenPeek(){ |
||||||
|
if( that.ovenDoor == OVEN_CLOSED && that.ovenDoor != OVEN_OPEN ){ |
||||||
|
gameState.pubsub.publish( "Play", "Oven_Door_Peek_Open" ); |
||||||
|
doorPeekLightOn.alpha = lightPressedImg.alpha; |
||||||
|
doorPeekLightOff.alpha = !lightPressedImg.alpha; |
||||||
|
doorClosedLightOn.alpha = 0; |
||||||
|
doorClosedLightOff.alpha = 0; |
||||||
|
doorOpen.alpha = 0; |
||||||
|
that.ovenDoor = OVEN_PEEK; |
||||||
|
|
||||||
|
handleBar.y = 48; |
||||||
|
if( gameState.turkeyBought ){ |
||||||
|
var state = gameState.ovenModel.getTurkeyState(); |
||||||
|
gameState.pubsub.publish( "ShowDialog", {seq:"custom", autoAdvance:true, customText:evalSkin[turkeyState["skin"]["cond"][2]] } ); |
||||||
|
gameState.pubsub.publish( "AddRecord", {type:"Peek ", text:"The turkey looked " +turkeyState["skin"]["cond"][2]} ); |
||||||
|
} |
||||||
|
} |
||||||
|
else if (that.ovenDoor == OVEN_PEEK){ |
||||||
|
doorClosedLightOn.alpha = lightPressedImg.alpha; |
||||||
|
doorClosedLightOff.alpha = !lightPressedImg.alpha; |
||||||
|
doorPeekLightOn.alpha = 0; |
||||||
|
doorPeekLightOff.alpha = 0; |
||||||
|
that.ovenDoor = OVEN_CLOSED; |
||||||
|
gameState.pubsub.publish( "Play", "Oven_Door_Peek_Close" ); |
||||||
|
doorOpen.alpha = 0; |
||||||
|
handleBar.y = 0; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
// Show core temperature
|
||||||
|
this.showTempDialog = function(){ |
||||||
|
if( that.ovenDoor != OVEN_OPEN ){ |
||||||
|
gameState.pubsub.publish("ShowDialog", {seq:"OpenDoor", autoAdvance:true}); |
||||||
|
} |
||||||
|
else{ |
||||||
|
state = gameState.ovenModel.getTurkeyState(); |
||||||
|
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"} ); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
new CookbookUI( stage, gameState ); |
||||||
|
|
||||||
|
// change temperature, this one's for the UI
|
||||||
|
gameState.pubsub.subscribe( "ChangeTemperature", this.changeTemperature ); |
||||||
|
gameState.pubsub.subscribe( "ShowTempDialog", this.showTempDialog ); |
||||||
|
gameState.pubsub.subscribe( "OvenLightToggle", this.ovenLightToggle ); |
||||||
|
gameState.pubsub.subscribe( "OvenLight", this.changeOvenLight ); |
||||||
|
gameState.pubsub.subscribe( "StartTurkeyModel", this.startTurkeyModel ); |
||||||
|
gameState.pubsub.subscribe("DoneSkipTime", function(){ that.doneSkipTime = true; }); |
||||||
|
|
||||||
|
this.secondTick = function(diff){ |
||||||
|
// check if oven door is open
|
||||||
|
gameState.ovenModel.secondTick(); |
||||||
|
gameState.currentTime += diff; |
||||||
|
} |
||||||
|
|
||||||
|
gameState.pubsub.subscribe( "SkipTime", function(){ |
||||||
|
if(DEBUG) console.log("Skipping time"); |
||||||
|
for(var i = 0; i < 1200; i++){ |
||||||
|
that.secondTick( 1000 ); |
||||||
|
} |
||||||
|
if( gameState.alarmActivated ) |
||||||
|
gameState.alarmTimer -= 1200; |
||||||
|
gameState.pubsub.publish("DoneSkipTime",""); |
||||||
|
}); |
||||||
|
|
||||||
|
return { |
||||||
|
tick: function(){ |
||||||
|
// IMPORTANT: SECOND TIMER
|
||||||
|
var diff = Date.now() - gameState.oldTime; |
||||||
|
var dialoguediff = Date.now() - gameState.oldDialogueTime; |
||||||
|
if( diff > 1000 ){ |
||||||
|
that.secondTick( diff ); |
||||||
|
|
||||||
|
if( gameState.turkeyBought ){ |
||||||
|
gameState.turkeyCookCounter++; |
||||||
|
// what's the state of the turkey
|
||||||
|
turkeyState = gameState.ovenModel.getTurkeyState(); |
||||||
|
gameState.turkeyStates[0].alpha = 1; |
||||||
|
if( turkeyState["skin"]["cond"][0] == "Undercooked" ) |
||||||
|
gameState.turkeyStates[1].alpha = turkeyState["skin"]["cond"][1]; |
||||||
|
if( turkeyState["skin"]["cond"][0] == "Cooked" ) |
||||||
|
gameState.turkeyStates[2].alpha = turkeyState["skin"]["cond"][1]; |
||||||
|
if( turkeyState["skin"]["cond"][0] == "Dry" ) |
||||||
|
gameState.turkeyStates[3].alpha = turkeyState["skin"]["cond"][1]; |
||||||
|
if( turkeyState["skin"]["cond"][0] == "Burnt" ) |
||||||
|
gameState.turkeyStates[4].alpha = turkeyState["skin"]["cond"][1]; |
||||||
|
if( turkeyState["skin"]["cond"][0] == "Fire" ) |
||||||
|
gameState.turkeyStates[4].alpha = 1; |
||||||
|
} |
||||||
|
gameState.oldTime = Date.now(); |
||||||
|
} |
||||||
|
if( gameState.turkeyBought && dialoguediff > 5*60*1000 ){ |
||||||
|
gameState.pubsub.publish( "ShowDialog", {seq:"Spouse gets surprise movie tickets", autoAdvance:true, random:true} ); |
||||||
|
gameState.oldDialogueTime = Date.now(); |
||||||
|
} |
||||||
|
}, |
||||||
|
render: function(){ |
||||||
|
stage.addChild( redState ); |
||||||
|
stage.addChild( ovenLight ); |
||||||
|
stage.addChild( temperatureText ); |
||||||
|
|
||||||
|
stage.addChild( lightPressedImg); |
||||||
|
// Turkey goes here
|
||||||
|
// did the player actually buy a turkey? if so, determine its cooked state
|
||||||
|
if( gameState.turkeyBought ){ |
||||||
|
|
||||||
|
// what's the state of the turkey
|
||||||
|
turkeyState = gameState.ovenModel.getTurkeyState(); |
||||||
|
gameState.turkeyStates[0].alpha = 1; |
||||||
|
if( turkeyState["skin"]["cond"] == "Undercooked" ) |
||||||
|
gameState.turkeyStates[1].alpha = turkeyState["skin"]["cond"][1]; |
||||||
|
if( turkeyState["skin"]["cond"] == "Cooked" ) |
||||||
|
gameState.turkeyStates[2].alpha = turkeyState["skin"]["cond"][1]; |
||||||
|
if( turkeyState["skin"]["cond"] == "Dry" ) |
||||||
|
gameState.turkeyStates[3].alpha = turkeyState["skin"]["cond"][1]; |
||||||
|
if( turkeyState["skin"]["cond"] == "Burnt" ) |
||||||
|
gameState.turkeyStates[4].alpha = turkeyState["skin"]["cond"][1]; |
||||||
|
if( turkeyState["skin"]["cond"] == "Fire" ) |
||||||
|
gameState.turkeyStates[4].alpha = 1; |
||||||
|
|
||||||
|
panFront.alpha = 1; |
||||||
|
stage.addChild(gameState.turkeyStates[0]); |
||||||
|
for(i in gameState.turkeyStates){ |
||||||
|
stage.addChild(gameState.turkeyStates[i]); |
||||||
|
} |
||||||
|
stage.addChild(panFront); |
||||||
|
} |
||||||
|
|
||||||
|
// Pan front goes here
|
||||||
|
stage.addChild( panFront ); |
||||||
|
|
||||||
|
//finalize button
|
||||||
|
if( gameState.turkeyBought ){ |
||||||
|
stage.addChild( new Button( stage, gameState, 45, 250, 250, 150, null, null, function(){ |
||||||
|
gameState.pubsub.publish("Play", "Error"); |
||||||
|
gameState.pubsub.publish("ShowFinalConfirm",""); |
||||||
|
} ) ); |
||||||
|
} |
||||||
|
|
||||||
|
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, 95, 163, 41, 17, "ChangeTemperature", "Down" ) ); |
||||||
|
stage.addChild( new Button( stage, gameState, 145, 163, 41, 17, "OvenLightToggle", "" ) ); |
||||||
|
if( gameState.hard == false ) |
||||||
|
stage.addChild( new Button( stage, gameState, 205, 105, 80, 80, null, null, function(){ |
||||||
|
if( that.doneSkipTime ){ |
||||||
|
gameState.pubsub.publish("SkipTime",""); |
||||||
|
that.doneSkipTime = false; |
||||||
|
} |
||||||
|
}) ); |
||||||
|
stage.addChild( handleBar); |
||||||
|
|
||||||
|
return this; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
function WindowUI( stage, gameState ){ |
||||||
|
|
||||||
|
var dayNight = new createjs.Bitmap("res/screens/Window/Test4-217.svg"); |
||||||
|
var mood = new createjs.Bitmap("res/screens/Window/Test4TransparencyFull.svg"); |
||||||
|
|
||||||
|
mood.y=30; |
||||||
|
dayNight.y=30; |
||||||
|
|
||||||
|
var secondCounter = 0; |
||||||
|
mood.x = dayNight.x = -(new Date( gameState.currentTime ).getHours()*682.625); |
||||||
|
|
||||||
|
var ground = new createjs.Bitmap( "res/screens/Window/Ground.png" ); |
||||||
|
var houses = new createjs.Bitmap( "res/screens/Window/Housefar.png" ); |
||||||
|
var streetLight = new createjs.Bitmap( "res/screens/Window/StreetlightGlow.png" ); |
||||||
|
streetLight.alpha = 0; |
||||||
|
|
||||||
|
var treeAnimations = { rustle:[0,17,"rustle"], still:[0,0,"still"] }; |
||||||
|
var data = { |
||||||
|
images: ["res/screens/Window/Tree_Animation.png"], |
||||||
|
frames: { width:386, height:287 }, |
||||||
|
animations: treeAnimations |
||||||
|
}; |
||||||
|
var spriteSheet = new createjs.SpriteSheet(data); |
||||||
|
var animation = new createjs.Sprite(spriteSheet, "treeAnimations"); |
||||||
|
animation.x = 415; |
||||||
|
animation.y = 30; |
||||||
|
|
||||||
|
// Fast forward, move sky
|
||||||
|
gameState.pubsub.subscribe( "SkipTime", function(){ |
||||||
|
var newpos = -(new Date( gameState.currentTime ).getHours()*682.625); |
||||||
|
dayNight.x = mood.x =newpos < -15583 ? 0 : newpos; |
||||||
|
}); |
||||||
|
|
||||||
|
stage.addChild( dayNight ); |
||||||
|
stage.addChild( ground ); |
||||||
|
stage.addChild( houses ); |
||||||
|
stage.addChild( streetLight ); |
||||||
|
stage.addChild( animation ); |
||||||
|
stage.addChild( mood ); |
||||||
|
return { |
||||||
|
|
||||||
|
tick: function(){ |
||||||
|
|
||||||
|
// move the sky
|
||||||
|
secondCounter++; |
||||||
|
if( secondCounter > 60 ){ |
||||||
|
dayNight.x-=11.38; |
||||||
|
mood.x -= 11.38; |
||||||
|
secondCounter = 0; |
||||||
|
} |
||||||
|
|
||||||
|
if( dayNight.x < -15583 ) |
||||||
|
dayNight.x = 0; |
||||||
|
|
||||||
|
// turn on lights
|
||||||
|
if( dayNight.x < 0 && dayNight.x > -4545 ){ |
||||||
|
// turn on random window lights
|
||||||
|
streetLight.alpha = 1; |
||||||
|
} |
||||||
|
else if( dayNight.x < -11687 ){ |
||||||
|
streetLight.alpha = 1; |
||||||
|
} |
||||||
|
else |
||||||
|
streetLight.alpha = 0; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
function MarketItem( gameState, name, x, y, cost, mouseOutImg, mouseOverImg, mouseOutKitchenImg, mouseOverKitchenImg, funnyDescription, weight ){ |
||||||
|
var that = this; |
||||||
|
this.name = name; |
||||||
|
this.bought = false; |
||||||
|
|
||||||
|
var mouseOverKitchen = new createjs.Bitmap( mouseOverKitchenImg ); |
||||||
|
var mouseOutKitchen = new createjs.Bitmap( mouseOutKitchenImg ); |
||||||
|
|
||||||
|
var mouseOver = new createjs.Bitmap( mouseOverImg ); |
||||||
|
var mouseOut = new createjs.Bitmap( mouseOutImg ); |
||||||
|
|
||||||
|
mouseOver.x = mouseOut.x = x; |
||||||
|
mouseOver.y = mouseOut.y = y; |
||||||
|
mouseOut.addEventListener( "mouseover", function(){ |
||||||
|
document.body.style.cursor='pointer'; |
||||||
|
mouseOver.visible = true; |
||||||
|
mouseOut.visible = false; |
||||||
|
gameState.pubsub.publish("ShowPrice", cost ); |
||||||
|
gameState.pubsub.publish("ShowDesc", {title:that.name, desc:funnyDescription, weight:weight} ); |
||||||
|
}); |
||||||
|
mouseOut.addEventListener( "mouseout", function(){ |
||||||
|
document.body.style.cursor='default'; |
||||||
|
mouseOver.visible = false; |
||||||
|
mouseOut.visible = true; |
||||||
|
gameState.pubsub.publish("ClearClipboard", {}); |
||||||
|
} ); |
||||||
|
mouseOver.addEventListener( "mouseover", function(){ |
||||||
|
document.body.style.cursor='pointer'; |
||||||
|
mouseOver.visible = true; |
||||||
|
mouseOut.visible = false; |
||||||
|
gameState.pubsub.publish("ShowPrice", cost ); |
||||||
|
gameState.pubsub.publish("ShowDesc", {title:that.name, desc:funnyDescription, weight:weight} ); |
||||||
|
}); |
||||||
|
mouseOver.addEventListener( "mouseout", function(){ |
||||||
|
document.body.style.cursor='default'; |
||||||
|
mouseOver.visible = false; |
||||||
|
mouseOut.visible = true; |
||||||
|
gameState.pubsub.publish("ClearClipboard", {}); |
||||||
|
} ); |
||||||
|
|
||||||
|
|
||||||
|
mouseOutKitchen.addEventListener( "mouseover", function(){ |
||||||
|
document.body.style.cursor='pointer'; |
||||||
|
mouseOverKitchen.visible = true; |
||||||
|
mouseOutKitchen.visible = false; |
||||||
|
}); |
||||||
|
mouseOutKitchen.addEventListener( "mouseout", function(){ |
||||||
|
document.body.style.cursor='default'; |
||||||
|
mouseOverKitchen.visible = false; |
||||||
|
mouseOverKitchen.visible = true; |
||||||
|
} ); |
||||||
|
mouseOverKitchen.addEventListener( "mouseover", function(){ |
||||||
|
document.body.style.cursor='pointer'; |
||||||
|
mouseOverKitchen.visible = true; |
||||||
|
mouseOutKitchen.visible = false; |
||||||
|
}); |
||||||
|
mouseOverKitchen.addEventListener( "mouseout", function(){ |
||||||
|
document.body.style.cursor='default'; |
||||||
|
mouseOverKitchen.visible = false; |
||||||
|
mouseOutKitchen.visible = true; |
||||||
|
} ); |
||||||
|
|
||||||
|
// We've bought the item, now we click it in the Kitchen
|
||||||
|
mouseOverKitchen.addEventListener("click",function(){ |
||||||
|
if ( that.name.indexOf("Temperature") != -1 ){ |
||||||
|
gameState.pubsub.publish( "ShowTempDialog", "" ); |
||||||
|
} |
||||||
|
|
||||||
|
if ( that.name.indexOf("Cookbook") != -1 ){ |
||||||
|
if(DEBUG) console.log("click, show cookbook"); |
||||||
|
gameState.pubsub.publish("ShowCookbook",""); |
||||||
|
gameState.pubsub.publish("Play", "Open_Cookbook"); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
mouseOver.addEventListener( "click", function(){ |
||||||
|
if(!that.bought && cost <= gameState.wallet ){ |
||||||
|
|
||||||
|
if( that.name.indexOf("Turkey") != -1 && gameState.turkeyBought != true ){ |
||||||
|
gameState.turkeyBought = true; |
||||||
|
gameState.turkeyWeight = weight; |
||||||
|
gameState.turkeyType = that.name; |
||||||
|
gameState.marketItems[ that.name ].delete(); |
||||||
|
that.bought = true; |
||||||
|
|
||||||
|
// record time started
|
||||||
|
gameState.pubsub.publish( "AddRecord", {type:"Note ", text:"Turkey bought and placed in oven"} ); |
||||||
|
|
||||||
|
|
||||||
|
gameState.pubsub.publish("Play", {name:"Buy", volume:0.7} ); |
||||||
|
gameState.pubsub.publish("WalletAmount", gameState.wallet - Math.abs(cost)) |
||||||
|
gameState.pubsub.publish("StartTurkeyModel",""); |
||||||
|
} |
||||||
|
// can we buy this? Only possible if you already bought a turkey
|
||||||
|
else if( that.name.indexOf("Turkey") == -1 && gameState.turkeyBought == true ){ |
||||||
|
|
||||||
|
// if we bought an oven light, enable it!
|
||||||
|
if( that.name.indexOf("Light") != -1 ) gameState.boughtOvenLight = true; |
||||||
|
|
||||||
|
// if we bought a clock, enable it!
|
||||||
|
if( that.name.indexOf("Alarm") != -1 ) gameState.alarmBought = true; |
||||||
|
if( that.name.indexOf("Frills") != -1 ) gameState.frillsModifier = 5; |
||||||
|
|
||||||
|
if( that.name.indexOf("Exquisite") != -1 ){ gameState.stuffingTypeModifier = gameState.stuffingTypeModifier > 1.08 ? gameState.stuffingTypeModifier : 1.08; } |
||||||
|
if( that.name.indexOf("Special") != -1 ){ gameState.stuffingTypeModifier = gameState.stuffingTypeModifier > 1.17 ? gameState.stuffingTypeModifier : 1.17; } |
||||||
|
if( that.name.indexOf("Repurposed") != -1 ){ gameState.stuffingTypeModifier = gameState.stuffingTypeModifier > 1.05 ? gameState.stuffingTypeModifier : 1.05; } |
||||||
|
|
||||||
|
gameState.purchasedItems.push( objReturn ); |
||||||
|
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)); |
||||||
|
} |
||||||
|
// One turkey only
|
||||||
|
else if( that.name.indexOf("Turkey") != -1 && gameState.turkeyBought == true ){ |
||||||
|
gameState.pubsub.publish( "ShowDialog", {seq:"CannotBuyTurkey", autoAdvance:true} ); |
||||||
|
gameState.pubsub.publish( "Play", "Error" ); |
||||||
|
} |
||||||
|
// Buy turkey first
|
||||||
|
else{ |
||||||
|
gameState.pubsub.publish( "ShowDialog", {seq:"BuyTurkeyFirst", autoAdvance:false} ); |
||||||
|
gameState.pubsub.publish( "Play", "Error" ); |
||||||
|
} |
||||||
|
} |
||||||
|
else{ |
||||||
|
gameState.pubsub.publish( "ShowDialog", {seq:"NoMoney", autoAdvance:true} ); |
||||||
|
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]); |
||||||
|
}, |
||||||
|
draw: function( stage, newx, newy ){ |
||||||
|
if( newx && newy ){ |
||||||
|
mouseOut.x = mouseOver.x = newx; |
||||||
|
mouseOut.y = mouseOver.y = newy; |
||||||
|
} |
||||||
|
if(DEBUG) 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; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function ImgButton( stage, gameState, x, y, mouseOutImg, mouseOverImg, eventCmd, arg, sound, altfunc ){ |
||||||
|
var mouseOver = new createjs.Bitmap( mouseOverImg ); |
||||||
|
var mouseOut = new createjs.Bitmap( mouseOutImg ); |
||||||
|
mouseOver.x = mouseOut.x = x; |
||||||
|
mouseOver.y = mouseOut.y = y; |
||||||
|
mouseOut.addEventListener( "mouseover", function(){ document.body.style.cursor='pointer'; mouseOver.visible = true; mouseOut.visible = false; } ); |
||||||
|
mouseOut.addEventListener( "mouseout", function(){ document.body.style.cursor='default'; mouseOver.visible = false; mouseOut.visible = true; } ); |
||||||
|
mouseOver.addEventListener( "mouseover", function(){ document.body.style.cursor='pointer'; mouseOver.visible = true; mouseOut.visible = false; } ); |
||||||
|
mouseOver.addEventListener( "mouseout", function(){ document.body.style.cursor='default'; mouseOver.visible = false; mouseOut.visible = true; } ); |
||||||
|
mouseOver.addEventListener( "click", function(){ |
||||||
|
if( sound ){ |
||||||
|
gameState.pubsub.publish("Play", sound ); |
||||||
|
} |
||||||
|
if( !altfunc){ |
||||||
|
gameState.pubsub.publish( eventCmd, arg ); |
||||||
|
return; |
||||||
|
} |
||||||
|
altfunc(); |
||||||
|
} ); |
||||||
|
mouseOver.visible = false; |
||||||
|
stage.addChild( mouseOut ); |
||||||
|
stage.addChild( mouseOver ); |
||||||
|
|
||||||
|
return { |
||||||
|
tick: function(){} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
function Button( stage, gameState, x_orig, y_orig, x_dest, y_dest, eventCmd, arg, altfunc ){ |
||||||
|
var that = this; |
||||||
|
if(DEBUG) console.log("button clicked with "+ arg); |
||||||
|
|
||||||
|
var button = new createjs.Shape(); |
||||||
|
button.graphics.beginFill("#ffffff").drawRect(x_orig, y_orig, x_dest, y_dest); |
||||||
|
button.alpha = 0.01; |
||||||
|
button.addEventListener( "click", function(){ |
||||||
|
gameState.pubsub.publish( "Play", "Click" ); |
||||||
|
if( !altfunc ){ |
||||||
|
gameState.pubsub.publish( eventCmd, arg ); |
||||||
|
return; |
||||||
|
} |
||||||
|
altfunc(); |
||||||
|
gameState.pubsub.publish( eventCmd, arg ); |
||||||
|
} ); |
||||||
|
button.addEventListener( "mouseover", function(){ document.body.style.cursor='pointer'; } ); |
||||||
|
button.addEventListener( "mouseout", function(){ document.body.style.cursor='default'; } ); |
||||||
|
return button; |
||||||
|
} |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 53 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 29 KiB |
After Width: | Height: | Size: 29 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 54 KiB |
After Width: | Height: | Size: 60 KiB |
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 59 KiB |
After Width: | Height: | Size: 58 KiB |
After Width: | Height: | Size: 62 KiB |
After Width: | Height: | Size: 64 KiB |
After Width: | Height: | Size: 70 KiB |
After Width: | Height: | Size: 55 KiB |
After Width: | Height: | Size: 51 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 104 KiB |
After Width: | Height: | Size: 566 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 473 KiB |
After Width: | Height: | Size: 276 KiB |
After Width: | Height: | Size: 319 KiB |
After Width: | Height: | Size: 324 KiB |
After Width: | Height: | Size: 308 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 333 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 41 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 4.4 MiB |
After Width: | Height: | Size: 166 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 137 KiB |
After Width: | Height: | Size: 370 KiB |
After Width: | Height: | Size: 6.5 KiB |
After Width: | Height: | Size: 51 KiB |
After Width: | Height: | Size: 8.5 KiB |
After Width: | Height: | Size: 41 KiB |
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 35 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 807 KiB |
After Width: | Height: | Size: 61 KiB |
After Width: | Height: | Size: 968 KiB |
After Width: | Height: | Size: 65 KiB |
After Width: | Height: | Size: 973 KiB |
After Width: | Height: | Size: 69 KiB |
After Width: | Height: | Size: 1.1 MiB |