Browse Source

dialogue fixes

Load_Fix
Robert Chen 11 years ago
parent
commit
6074d7665b
  1. 5
      js/dialogue.js
  2. 1
      js/main.js
  3. 2
      js/screens.js
  4. 3
      js/stories.js
  5. 21
      js/ui.js

5
js/dialogue.js

@ -85,6 +85,7 @@ function DialogUI( stage, gameState ){
messages["custom"] = ["Me: " + textSeq.customText ]; messages["custom"] = ["Me: " + textSeq.customText ];
} }
if( textSeq.random ){ if( textSeq.random ){
that.showRandomConvo(); that.showRandomConvo();
return; return;
@ -95,7 +96,7 @@ function DialogUI( stage, gameState ){
that.endFunc = textSeq.endFunc || function(){}; that.endFunc = textSeq.endFunc || function(){};
that.textContent.text=nextDialogue[1]; that.textContent.text=nextDialogue[1].replace(/\[GenderPronoun\]/g, gameState.pronoun ).replace(/\[Player\]/g, gameState.name );
that.currentFace.y = 250; that.currentFace.y = 250;
that.currentFace = peopleImg[nextDialogue[0]] || that.currentFace; that.currentFace = peopleImg[nextDialogue[0]] || that.currentFace;
that.autoAdvance = textSeq.autoAdvance; that.autoAdvance = textSeq.autoAdvance;
@ -166,7 +167,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 ==0 && delayCounter > ( (that.textContent.text.length * MILLIS_PER_CHAR) < 2000 ? 200 : (that.textContent.text.length * MILLIS_PER_CHAR) ) ){ 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(); clickEvent();
} }

1
js/main.js

@ -11,6 +11,7 @@ function GameState(){
this.gameStarted = false; this.gameStarted = false;
this.name = ""; this.name = "";
this.gender = "Male"; this.gender = "Male";
this.pronoun = "he";
this.wallet = 45.00; this.wallet = 45.00;
this.hard = false; this.hard = false;
this.boughtOvenLight = false; this.boughtOvenLight = false;

2
js/screens.js

@ -216,9 +216,11 @@ function DifficultyScreen( stage, gameState ){
if( gender == "Male" ){ if( gender == "Male" ){
that.maleSelection.alpha = 1; that.maleSelection.alpha = 1;
that.femaleSelection.alpha = 0; that.femaleSelection.alpha = 0;
gameState.pronoun = "he";
}else{ }else{
that.maleSelection.alpha = 0; that.maleSelection.alpha = 0;
that.femaleSelection.alpha = 1; that.femaleSelection.alpha = 1;
gameState.pronoun = "she";
} }
}) })
return { return {

3
js/stories.js

@ -1,6 +1,6 @@
var messages = { var messages = {
"Null":["Me: "], "Null":["Me: "],
"KitchenInitial" : ["Me: I need to buy a turkey..."], "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!"], "CannotBuyTurkey" : ["Me: I barely have time for ONE turkey, let alone TWO!"],
"NoMoney" : ["Me: I can't afford this!"], "NoMoney" : ["Me: I can't afford this!"],
"BuyTurkeyFirst" : ["Me: I should buy a turkey first!"], "BuyTurkeyFirst" : ["Me: I should buy a turkey first!"],
@ -661,5 +661,4 @@ var story = {
"Cat: Purrrsonally, not as bad as yours.", "Cat: Purrrsonally, not as bad as yours.",
"Turkey: Gobble Gobble"] "Turkey: Gobble Gobble"]
}; };

21
js/ui.js

@ -405,6 +405,17 @@ function OvenUI( stage, gameState ){
handleBar.addEventListener( "mouseout", function(){ document.body.style.cursor='default'; } ); handleBar.addEventListener( "mouseout", function(){ document.body.style.cursor='default'; } );
handleBar.addEventListener( "pressup", handlePress ); 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 // Look for a drag event
function handlePress(event) { function handlePress(event) {
if( event.stageY > 300 && that.ovenDoor != OVEN_OPEN ){ if( event.stageY > 300 && that.ovenDoor != OVEN_OPEN ){
@ -418,8 +429,8 @@ function OvenUI( stage, gameState ){
if( gameState.turkeyBought ){ if( gameState.turkeyBought ){
var state = gameState.ovenModel.getTurkeyState(); var state = gameState.ovenModel.getTurkeyState();
gameState.pubsub.publish( "ShowDialog", {seq:"custom", autoAdvance:true, customText:"Hmm... Looks " + turkeyState["skin"]["cond"][2] + "." } ); 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.pubsub.publish( "AddRecord", {type:"Open ", text:evalSkin[turkeyState["skin"]["cond"][2]]} );
gameState.ovenModel.setRawTemp( (gameState.ovenModel.getRawTemp() - 25) < 150 ? 150 : gameState.ovenModel.getRawTemp() - 25 ); gameState.ovenModel.setRawTemp( (gameState.ovenModel.getRawTemp() - 25) < 150 ? 150 : gameState.ovenModel.getRawTemp() - 25 );
gameState.ovenOpened++; gameState.ovenOpened++;
} }
@ -450,8 +461,8 @@ function OvenUI( stage, gameState ){
handleBar.y = 48; handleBar.y = 48;
if( gameState.turkeyBought ){ if( gameState.turkeyBought ){
var state = gameState.ovenModel.getTurkeyState(); var state = gameState.ovenModel.getTurkeyState();
gameState.pubsub.publish( "ShowDialog", {seq:"custom", autoAdvance:true, customText:"Looks " + turkeyState["skin"]["cond"][2] } ); 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]} ); gameState.pubsub.publish( "AddRecord", {type:"Peek ", text:"The turkey looked " +turkeyState["skin"]["cond"][2]} );
} }
} }
else if (that.ovenDoor == OVEN_PEEK){ else if (that.ovenDoor == OVEN_PEEK){
@ -504,6 +515,8 @@ function OvenUI( stage, gameState ){
for(var i = 0; i < 1200; i++){ for(var i = 0; i < 1200; i++){
that.secondTick( 1000 ); that.secondTick( 1000 );
} }
if( gameState.alarmActivated )
gameState.alarmTimer -= 1200;
gameState.pubsub.publish("DoneSkipTime",""); gameState.pubsub.publish("DoneSkipTime","");
}); });

Loading…
Cancel
Save