Browse Source

dialogue, stories fixes

Load_Fix
Robert Chen 11 years ago
parent
commit
54612d3435
  1. 13
      js/dialogue.js
  2. 2
      js/main.js
  3. 6
      js/screens.js
  4. 14
      js/stories.js
  5. 42
      js/ui.js
  6. BIN
      res/screens/HelpCreditsScreen/.DS_Store
  7. BIN
      res/screens/HelpCreditsScreen/Credits.png
  8. BIN
      res/screens/KitchenScreen/FinalConfirmation.png

13
js/dialogue.js

@ -1,6 +1,6 @@
function DialogueSequence( sequence ){ function DialogueSequence( sequence ){
var targetStory = story[sequence] ? story[sequence].slice(0) : messages[sequence].slice(0); var targetStory = story[sequence] ? story[sequence].slice(0) : ( messages[sequence] ? messages[sequence].slice(0) : [] );
return { return {
next: function(){ next: function(){
@ -83,6 +83,7 @@ function DialogUI( stage, gameState ){
if( textSeq.random ){ if( textSeq.random ){
that.showRandomConvo(); that.showRandomConvo();
return;
} }
that.currDialogueSeq = new DialogueSequence( textSeq.seq ); that.currDialogueSeq = new DialogueSequence( textSeq.seq );
@ -96,11 +97,17 @@ function DialogUI( stage, gameState ){
} }
this.showRandomConvo = function(){ this.showRandomConvo = function(){
// No more stories, thanks for playing
if( dialogueList.length == 0 ) return;
dialogueList = Object.keys(story); dialogueList = Object.keys(story);
var randomKey = UtilityFunctions.randRange(0, dialogueList.length);
// check if there is something going on // check if there is something going on
if( !that.currDialogueSeq.more() ){ if( !that.currDialogueSeq.more() ){
this.showDialog( story[ dialogueList[ UtilityFunctions.randRange(0, dialogueList.length) ] ] || story["Dad Tells a bad Joke"] ); console.log("random story");
this.showDialog( {seq: dialogueList[ randomKey ] || "Dad Tells a bad Joke", autoAdvance:true } );
delete story[ dialogueList[ randomKey ] ];
} }
} }
@ -149,7 +156,7 @@ function DialogUI( stage, gameState ){
tick: function(){ tick: function(){
delayCounter = new Date().getTime() - oldTime; delayCounter = new Date().getTime() - oldTime;
if( that.autoAdvance == true && that.dialogBox.y ==435 && delayCounter > ( that.textContent.text.length * MILLIS_PER_CHAR ) ){ if( that.autoAdvance == true && that.dialogBox.y ==0 && delayCounter > ( that.textContent.text.length * MILLIS_PER_CHAR ) ){
clickEvent(); clickEvent();
} }

2
js/main.js

@ -56,6 +56,7 @@ function GameState(){
queue.loadFile( {id: "res/screens/DifficultyScreen/Difficulty-Selection.png", src:"res/screens/DifficultyScreen/Difficulty-Selection.png"} ); 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/ButtonMale.png", src:"res/screens/DifficultyScreen/ButtonMale.png"} );
queue.loadFile( {id: "res/screens/DifficultyScreen/ButtonFemale.png", src:"res/screens/DifficultyScreen/ButtonFemale.png"} ); queue.loadFile( {id: "res/screens/DifficultyScreen/ButtonFemale.png", src:"res/screens/DifficultyScreen/ButtonFemale.png"} );
// Load image assets // Load image assets
queue.loadFile( {id: "TurkeySpriteFile", src:"res/screens/MainScreen/TurkeySprite.png"} ); queue.loadFile( {id: "TurkeySpriteFile", src:"res/screens/MainScreen/TurkeySprite.png"} );
queue.loadFile( {id: "MainBackgroundFile", src:"res/screens/MainScreen/Main-Screen.png"} ); queue.loadFile( {id: "MainBackgroundFile", src:"res/screens/MainScreen/Main-Screen.png"} );
@ -87,6 +88,7 @@ function GameState(){
// Kitchen Items // Kitchen Items
queue.loadFile( {id: "res/screens/KitchenScreen/KitchenScreen.png", src:"res/screens/KitchenScreen/KitchenScreen.png"}); 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/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/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/TurkeyState3Small.svg", src:"res/screens/KitchenScreen/TurkeyState3Small.svg"});

6
js/screens.js

@ -246,7 +246,7 @@ function KitchenScreen( stage, gameState ){
this.uiElems = []; this.uiElems = [];
this.uiElems.push( new WindowUI( stage, gameState ) ); this.uiElems.push( new WindowUI( stage, gameState ) );
new FinalConfirmationUI(stage, gameState );
this.background = new createjs.Bitmap( "res/screens/KitchenScreen/KitchenScreen.png" ); this.background = new createjs.Bitmap( "res/screens/KitchenScreen/KitchenScreen.png" );
stage.addChild( this.background ); stage.addChild( this.background );
console.log(gameState.purchasedItems); console.log(gameState.purchasedItems);
@ -268,8 +268,8 @@ function KitchenScreen( stage, gameState ){
} ); } );
// If player did not buy a turkey, tell them // If player did not buy a turkey, tell them
if( gameState.turkeyBought ){ if( !gameState.turkeyBought ){
gameState.pubsub.publish( "ShowDialog", {seq:"Spouse gets surprise movie tickets", autoAdvance:true} ); gameState.pubsub.publish( "ShowDialog", {seq:"KitchenInitial", autoAdvance:true} );
} }
return { return {

14
js/stories.js

@ -45,12 +45,12 @@ var story = {
"Dad: Mooom!"], "Dad: Mooom!"],
"Creeper Worker": "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", ["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.", "Dad: Hey that reminds me of this guy at work.",
"Brother: I'm trying to tell a story here Dad.", "Brother: I'm trying to tell a story here Dad.",
"Mom: Let Greg finish.", "Mom: Let Greg finish.",
"Dad: Ok, finish your story.", "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.", "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: 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.", "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?", "Grandma: What is a screensaver?",
@ -88,7 +88,7 @@ var story = {
"Brother: I look down and there are primer drops all over 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?", "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: 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", "Brother: Or so I thought...",
"Mom: What happened next Greggy?", "Mom: What happened next Greggy?",
"Brother: Mom, don't call me '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: 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.",
@ -168,7 +168,7 @@ var story = {
"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.", "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?", "Mom: So did you go in?",
"Brother: And wait in that long line? I don't even wear makeup!", "Brother: And wait in that long line? I don't even wear makeup!",
"Mom: Yeah, but what about your fiancée'? Why not get her something nice?", "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: 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.", "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.", "Grandpa: Back in my day, I would have gotten in that line and wooed all the women.",
@ -361,7 +361,7 @@ var story = {
"Grandparents sings a Patriotist song": "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?", ["Grandpa: Since dinner is taking a while, it seems like a good time for a song don't you think?",
"Dad: Dad, please no", "Dad: Dad, please no...",
"Grandpa: Ooooh, I saw Mussolini sitting on a log", "Grandpa: Ooooh, I saw Mussolini sitting on a log",
"Grandpa: All puffed up like a great big frog", "Grandpa: All puffed up like a great big frog",
"Grandpa: Sneaked up close and stuck him with a wire", "Grandpa: Sneaked up close and stuck him with a wire",
@ -379,7 +379,7 @@ var story = {
"Grandpa: He tried to hang on and he tried to let go ", "Grandpa: He tried to hang on and he tried to let go ",
"Grandma: Now they have a new dance called Hitler in the snow. ", "Grandma: Now they have a new dance called Hitler in the snow. ",
"Grandpa: Wow, I didn't know you knew that one. ", "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 водка. ", "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. "], "Grandpa: Advice to keep close at heart. "],
"Dad Tells a bad Joke": "Dad Tells a bad Joke":
@ -397,7 +397,7 @@ var story = {
"Grandma: Well, what do you mean 'key' .", "Grandma: Well, what do you mean 'key' .",
"Dad: A 'key', something that is of vital importance.", "Dad: A 'key', something that is of vital importance.",
"Grandma: hmmm, ok. I think I get it.", "Grandma: hmmm, ok. I think I get it.",
"Dad: Ok."], "Dad: Ok...."],
"Mom Story": "Mom Story":
["Mom: My favorite color is butter.", ["Mom: My favorite color is butter.",

42
js/ui.js

@ -115,6 +115,36 @@ function HelpUI( stage, gameState ){
gameState.pubsub.subscribe( "ShowHelp", this.showHelp ); 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(){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( !that.showingConfirm ){
stage.addChild( finalImg );
stage.addChild( noButton );
stage.addChild( yesButton );
that.showingConfirm = true;
}
};
// change temperature, this one's for the UI
gameState.pubsub.subscribe( "ShowFinalConfirm", this.showFinalConfirm );
}
function CookbookUI( stage, gameState ){ function CookbookUI( stage, gameState ){
var that = this; var that = this;
this.showingCookbook = false; this.showingCookbook = false;
@ -193,12 +223,22 @@ function OvenUI( stage, gameState ){
new createjs.Bitmap( "res/screens/KitchenScreen/TurkeyState4Small.svg" ), new createjs.Bitmap( "res/screens/KitchenScreen/TurkeyState4Small.svg" ),
new createjs.Bitmap( "res/screens/KitchenScreen/TurkeyState5Small.svg" ) new createjs.Bitmap( "res/screens/KitchenScreen/TurkeyState5Small.svg" )
]; ];
// place turkeys in oven // place turkeys in oven
for (i in turkeyStates){ for (i in turkeyStates){
turkeyStates[i].alpha = 0; turkeyStates[i].alpha = 0;
turkeyStates[i].scaleX = turkeyStates[i].scaleY =1; turkeyStates[i].scaleX = turkeyStates[i].scaleY =1;
turkeyStates[i].x = 75; turkeyStates[i].x = 75;
turkeyStates[i].y = 258; turkeyStates[i].y = 258;
turkeyStates[i].addEventListener( "mouseover", function(){
document.body.style.cursor='pointer';
});
turkeyStates[i].addEventListener( "mouseout", function(){
document.body.style.cursor='default';
});
turkeyStates[i].addEventListener( "click", function(){
gameState.pubsub.publish("ShowFinalConfirm","");
});
} }
var temperatureText = new createjs.Text( "OFF", "40px Arial", "#ff7700" ); var temperatureText = new createjs.Text( "OFF", "40px Arial", "#ff7700" );
@ -416,7 +456,7 @@ function OvenUI( stage, gameState ){
} }
gameState.oldTime = Date.now(); gameState.oldTime = Date.now();
} }
if( gameState.turkeyBought && dialoguediff > 60*1000 ){ if( gameState.turkeyBought && dialoguediff > 10*1000 ){
gameState.pubsub.publish( "ShowDialog", {seq:"Spouse gets surprise movie tickets", autoAdvance:true, random:true} ); gameState.pubsub.publish( "ShowDialog", {seq:"Spouse gets surprise movie tickets", autoAdvance:true, random:true} );
gameState.oldDialogueTime = Date.now(); gameState.oldDialogueTime = Date.now();
} }

BIN
res/screens/HelpCreditsScreen/.DS_Store vendored

Binary file not shown.

BIN
res/screens/HelpCreditsScreen/Credits.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 410 KiB

After

Width:  |  Height:  |  Size: 473 KiB

BIN
res/screens/KitchenScreen/FinalConfirmation.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

Loading…
Cancel
Save