Browse Source

final

Load_Fix
Robert Chen 11 years ago
parent
commit
66dbe13703
  1. 18
      index.html
  2. 14
      js/dialogue.js
  3. 8
      js/main.js
  4. 28
      js/model.js
  5. 6
      js/screens.js
  6. 12
      js/ui.js

18
index.html

@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
</div>
</center>
</body>
<script src="createjs-2013.09.25.min.js"></script>
<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>
@ -22,22 +22,6 @@ @@ -22,22 +22,6 @@
<script src="js/main.js"></script>
<script>
new GameState();
function showXY(e)
{
var mouseX, mouseY;
if(e.offsetX) {
mouseX = e.offsetX;
mouseY = e.offsetY;
}
else if(e.layerX) {
mouseX = e.layerX;
mouseY = e.layerY;
}
console.log("x: " + mouseX + "y :" + mouseY);
}
</script>
<!-- Load all the things! -->
</html>

14
js/dialogue.js

@ -68,7 +68,7 @@ function DialogUI( stage, gameState ){ @@ -68,7 +68,7 @@ function DialogUI( stage, gameState ){
this.endFunc = function(){};
this.showDialog= function( textSeq ){
console.log("showing"+ textSeq);
if(DEBUG) console.log("showing"+ textSeq);
if( !peopleImg["Me"] ){
peopleImg["Me"] = peopleImg[gameState.gender];
}
@ -112,7 +112,7 @@ function DialogUI( stage, gameState ){ @@ -112,7 +112,7 @@ function DialogUI( stage, gameState ){
// check if there is something going on
if( !that.currDialogueSeq.more() ){
console.log("random story");
if(DEBUG) console.log("random story");
this.showDialog( {seq: dialogueList[ randomKey ] || "Dad Tells a bad Joke", autoAdvance:true } );
delete story[ dialogueList[ randomKey ] ];
gameState.dialogueHeard++;
@ -136,7 +136,7 @@ function DialogUI( stage, gameState ){ @@ -136,7 +136,7 @@ function DialogUI( stage, gameState ){
that.dialogMotionQueue.push(DIALOG_SHOWING);
that.textContent.text=nextDialogue[1];
console.log("showing face:" +nextDialogue[0] );
if(DEBUG) console.log("showing face:" +nextDialogue[0] );
// swap out face immediately
that.currentFace.y = 250;
@ -175,13 +175,13 @@ function DialogUI( stage, gameState ){ @@ -175,13 +175,13 @@ function DialogUI( stage, gameState ){
that.dialogBox.y+=that.dialogSpeed;
that.textContent.y += that.dialogSpeed;
that.currentFace.y += that.dialogSpeed;
//console.log( "Receding" + that.dialogBox.y );
//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;
//console.log( "Advancing" + that.dialogBox.y );
//if(DEBUG) console.log( "Advancing" + that.dialogBox.y );
}
// toggle states
@ -190,7 +190,7 @@ function DialogUI( stage, gameState ){ @@ -190,7 +190,7 @@ function DialogUI( stage, gameState ){
that.textContent.y = 735;
that.currentFace.y = 250;
that.dialogState = DIALOG_PAUSING;
//console.log( "Pausing on recede" + that.dialogBox.y );
//if(DEBUG) console.log( "Pausing on recede" + that.dialogBox.y );
}
if( that.dialogBox.y < 0 && that.dialogState == DIALOG_SHOWING ){
@ -198,7 +198,7 @@ function DialogUI( stage, gameState ){ @@ -198,7 +198,7 @@ function DialogUI( stage, gameState ){
that.textContent.y = 480;
that.currentFace.y = 0;
that.dialogState = DIALOG_PAUSING;
//console.log( "Pausing on showing" + that.dialogBox.y );
//if(DEBUG) console.log( "Pausing on showing" + that.dialogBox.y );
}
/* next states if there are any on the queue */

8
js/main.js

@ -1,5 +1,7 @@ @@ -1,5 +1,7 @@
// Robert- Here be dragons
var DEBUG = 1;
function GameState(){
var that = this;
@ -355,7 +357,7 @@ function GameUI( canvasElem, gameState ){ @@ -355,7 +357,7 @@ function GameUI( canvasElem, gameState ){
var textContent = new createjs.Text( "", "20px Arial", "black" );
textContent.x = 750;
textContent.y = 30;
this.stage.addChild( textContent);
//this.stage.addChild( textContent);
var overlay = new createjs.Shape();
overlay.graphics.beginFill("#fffffff").drawRect(0, 0, 800, 600 );
overlay.alpha = 0;
@ -367,13 +369,13 @@ function GameUI( canvasElem, gameState ){ @@ -367,13 +369,13 @@ function GameUI( canvasElem, gameState ){
this.switchScreen = function( screenName ){
gameState.screenState = SCREEN_OUT;
dialogManager.minDialog();
console.log("Switch screen called with" + screenName);
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( textContent );
that.stage.addChild( overlay );
dialogManager.render();
};

28
js/model.js

@ -21,7 +21,7 @@ function TurkeyLayer( name, percentRadius, turkeyModel, ovenModel ){ @@ -21,7 +21,7 @@ function TurkeyLayer( name, percentRadius, turkeyModel, ovenModel ){
ovenModel.globalTime );
that.waterLost = that.waterLost + UtilityFunctions.waterLoss( that.finalTemperature );
that.cookCondition = UtilityFunctions.cookCondition(that.waterLost);
console.log( that.name + ": "+ that.waterLost + " " + that.cookCondition);
if(DEBUG) console.log( that.name + ": "+ that.waterLost + " " + that.cookCondition);
},
resetLayerTemps: function(){
that.initialTemp = that.finalTemperature;
@ -118,12 +118,12 @@ function OvenModel( turkeyWeight, gameState ) { @@ -118,12 +118,12 @@ function OvenModel( turkeyWeight, gameState ) {
};
},
changeTemp: function(setTemp){
console.log("temp changed to " + setTemp);
if(DEBUG) console.log("temp changed to " + setTemp);
that.setTemp = setTemp;
},
// set the tempInfini
setRawTemp: function(newTemp){
console.log("raw temp changed to" + that.tempInfini);
if(DEBUG) console.log("raw temp changed to" + that.tempInfini);
that.tempInfini = newTemp;
},
getRawTemp: function(){
@ -145,9 +145,9 @@ function OvenModel( turkeyWeight, gameState ) { @@ -145,9 +145,9 @@ function OvenModel( turkeyWeight, gameState ) {
// Turn off oven light
gameState.pubsub.publish( "OvenLight", "Off" );
}
console.log("Steady Temp " + that.steadyTemp)
console.log("Steady Timer " + that.steadyTimer)
console.log("Oven Temp " + that.tempInfini )
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();
}
}
@ -174,8 +174,8 @@ UtilityFunctions = { @@ -174,8 +174,8 @@ UtilityFunctions = {
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
//console.log("Simple Radius " + simpleRadius + " Meters")
//console.log("Complex Radius " + complexRadius + " Meters")
//if(DEBUG) console.log("Simple Radius " + simpleRadius + " Meters")
//if(DEBUG) console.log("Complex Radius " + complexRadius + " Meters")
return complexRadius;
},
@ -193,7 +193,7 @@ UtilityFunctions = { @@ -193,7 +193,7 @@ UtilityFunctions = {
}
}
else {
//console.log("No Bracketed Root " + negativeTest)
//if(DEBUG) console.log("No Bracketed Root " + negativeTest)
}
}
return storage;
@ -248,20 +248,20 @@ UtilityFunctions = { @@ -248,20 +248,20 @@ UtilityFunctions = {
var frontCoefficientPortion;
//console.log("Alpha is " + alpha)
//if(DEBUG) console.log("Alpha is " + alpha)
var Fourier = (alpha*t)/Math.pow(rTotal,2)
//console.log("Fourier is " + Fourier)
//if(DEBUG) console.log("Fourier is " + Fourier)
var biotNum = heatConvection * rTotal/thermalConduct
if ( biotNum != this.cachedBiot ) {
console.log("Recalculating Lambda Terms")
if(DEBUG) console.log("Recalculating Lambda Terms")
this.cachedLambda = this.findAllRoots(min,max,max*Math.PI*10,biotNum)
this.cachedBiot = biotNum;
}
//console.log("The Biot Value is " + biotNum)
//if(DEBUG) console.log("The Biot Value is " + biotNum)
for (var i = 0; i<this.cachedLambda.length; i++) {
var lambdaN = this.cachedLambda[i];
@ -273,7 +273,7 @@ UtilityFunctions = { @@ -273,7 +273,7 @@ UtilityFunctions = {
tempAtTimeAndRadius=(sum*(tempInitial-tempInfini))+tempInfini
console.log("The Temperature at radius " + rPosition + " m and time " + t/60/60 + " hours is " + tempAtTimeAndRadius + " C or " + this.C2F(tempAtTimeAndRadius) + " F");
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)
},

6
js/screens.js

@ -249,10 +249,10 @@ function KitchenScreen( stage, gameState ){ @@ -249,10 +249,10 @@ function KitchenScreen( stage, gameState ){
this.uiElems.push( new WindowUI( stage, gameState ) );
this.background = new createjs.Bitmap( "res/screens/KitchenScreen/KitchenScreen.png" );
stage.addChild( this.background );
console.log(gameState.purchasedItems);
console.log("KitchenScreen");
if(DEBUG) console.log(gameState.purchasedItems);
if(DEBUG) console.log("KitchenScreen");
for(var i in gameState.purchasedItems ){
console.log(gameState.purchasedItems);
if(DEBUG) console.log(gameState.purchasedItems);
gameState.purchasedItems[i].draw( stage );
}

12
js/ui.js

@ -135,7 +135,7 @@ function FinalConfirmationUI(stage, gameState){ @@ -135,7 +135,7 @@ function FinalConfirmationUI(stage, gameState){
// Show core temperature
this.showFinalConfirm = function(){
console.log("Showing final confirm");
if(DEBUG) console.log("Showing final confirm");
if( !that.showingConfirm ){
that.showingConfirm = true;
stage.addChild( finalImg );
@ -435,7 +435,7 @@ function OvenUI( stage, gameState ){ @@ -435,7 +435,7 @@ function OvenUI( stage, gameState ){
}
this.startTurkeyModel = function(){
console.log("weight is" + gameState.turkeyWeight);
if(DEBUG) console.log("weight is" + gameState.turkeyWeight);
gameState.ovenModel = new OvenModel( gameState.turkeyWeight, gameState );
}
@ -547,7 +547,7 @@ function OvenUI( stage, gameState ){ @@ -547,7 +547,7 @@ function OvenUI( stage, gameState ){
}
gameState.pubsub.subscribe( "SkipTime", function(){
console.log("Skipping time");
if(DEBUG) console.log("Skipping time");
for(var i = 0; i < 1200; i++){
that.secondTick( 1000 );
}
@ -791,7 +791,7 @@ function MarketItem( gameState, name, x, y, cost, mouseOutImg, mouseOverImg, mou @@ -791,7 +791,7 @@ function MarketItem( gameState, name, x, y, cost, mouseOutImg, mouseOverImg, mou
}
if ( that.name.indexOf("Cookbook") != -1 ){
console.log("click, show cookbook");
if(DEBUG) console.log("click, show cookbook");
gameState.pubsub.publish("ShowCookbook","");
gameState.pubsub.publish("Play", "Open_Cookbook");
}
@ -865,7 +865,7 @@ function MarketItem( gameState, name, x, y, cost, mouseOutImg, mouseOverImg, mou @@ -865,7 +865,7 @@ function MarketItem( gameState, name, x, y, cost, mouseOutImg, mouseOverImg, mou
mouseOut.x = mouseOver.x = newx;
mouseOut.y = mouseOver.y = newy;
}
console.log("NewScreen for item "+that.name +" is " +gameState.newScreen );
if(DEBUG) console.log("NewScreen for item "+that.name +" is " +gameState.newScreen );
if( gameState.newScreen == "KitchenScreen" ){
mouseOutKitchen.visible = true;
stage.addChild( mouseOutKitchen );
@ -915,7 +915,7 @@ function ImgButton( stage, gameState, x, y, mouseOutImg, mouseOverImg, eventCmd, @@ -915,7 +915,7 @@ function ImgButton( stage, gameState, x, y, mouseOutImg, mouseOverImg, eventCmd,
function Button( stage, gameState, x_orig, y_orig, x_dest, y_dest, eventCmd, arg, altfunc ){
var that = this;
console.log("button clicked with "+ arg);
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);

Loading…
Cancel
Save