Browse Source

Fixed clock, skip

Load_Fix
Robert Chen 11 years ago
parent
commit
f2c1cdc07b
  1. 4
      js/main.js
  2. 3
      js/screens.js
  3. 3
      js/soundmanager.js
  4. 26
      js/ui.js
  5. BIN
      res/screens/.DS_Store
  6. BIN
      res/sound/.DS_Store
  7. BIN
      res/sound/Kitchen/.DS_Store
  8. BIN
      res/sound/Kitchen/Close_Cookbook.mp3
  9. BIN
      res/sound/Kitchen/Open_Cookbook.mp3

4
js/main.js

@ -119,7 +119,8 @@ function GameState(){ @@ -119,7 +119,8 @@ function GameState(){
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"});
// Market Items
queue.loadFile( {id: "res/screens/MarketScreen/MarketTopShelf.png", src:"res/screens/MarketScreen/MarketTopShelf.png"});
@ -208,6 +209,7 @@ function GameState(){ @@ -208,6 +209,7 @@ function GameState(){
queue.loadFile( {id: "res/screens/Window/Test4-217.png", src:"res/screens/Window/Test4TransparencyFull.png"});
this.screenState = 0;
this.newScreen = "";

3
js/screens.js

@ -268,7 +268,8 @@ function KitchenScreen( stage, gameState ){ @@ -268,7 +268,8 @@ function KitchenScreen( stage, gameState ){
this.background = new createjs.Bitmap( "res/screens/KitchenScreen/KitchenScreen.png" );
stage.addChild( this.background );
console.log(gameState.purchasedItems);
console.log("KitchenScreen")
for(var i in gameState.purchasedItems ){
console.log(gameState.purchasedItems);
gameState.purchasedItems[i].draw( stage );

3
js/soundmanager.js

@ -28,6 +28,9 @@ function SoundManager( gameState ){ @@ -28,6 +28,9 @@ function SoundManager( gameState ){
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/Open_Cookbook.mp3", "Open_Cookbook");
createjs.Sound.registerSound("res/sound/Kitchen/Close_Cookbook.mp3", "Close_Cookbook");
this.backgroundSounds = [];
this.backgroundSoundsQueue = [];

26
js/ui.js

@ -52,13 +52,14 @@ function CookbookUI( stage, gameState ){ @@ -52,13 +52,14 @@ function CookbookUI( stage, gameState ){
var closeButton = new Button( stage, gameState, 710, 10, 100, 50, null, null, function(){that.hideCookbook();} );
var logEntries = [];
this.hideCookbook = function(){
console.log("hide cookbook");
stage.removeChild( closeButton );
stage.removeChild( cookbookImg );
for( i in logEntries ){
stage.removeChild(logEntries[i]);
}
that.showingCookbook = false;
gameState.pubsub.publish("Play", "Close_Cookbook");
}
// Show core temperature
@ -288,15 +289,27 @@ function OvenUI( stage, gameState ){ @@ -288,15 +289,27 @@ function OvenUI( stage, gameState ){
gameState.pubsub.subscribe( "StartTurkeyModel", this.startTurkeyModel );
this.secondTick = function(){
this.secondTick = function(diff){
ovenModel.secondTick();
gameState.currentTime += 1000;
gameState.currentTime += diff;
}
setInterval(this.secondTick, 1000);
gameState.pubsub.subscribe( "SkipTime", function(){
for(var i = 0; i < 1200; i++){
that.secondTick( 1000 );
}
});
return {
tick: function(){},
tick: function(){
var diff = Date.now() - gameState.oldTime;
if( diff > 1000 ){
gameState.oldTime = Date.now();
that.secondTick( diff );
console.log(new Date( gameState.currentTime) );
}
},
render: function(){
stage.addChild( ovenLight );
@ -462,6 +475,7 @@ function MarketItem( gameState, name, x, y, cost, mouseOutImg, mouseOverImg, mou @@ -462,6 +475,7 @@ function MarketItem( gameState, name, x, y, cost, mouseOutImg, mouseOverImg, mou
if ( that.name.indexOf("Cookbook") != -1 ){
console.log("click, show cookbook");
gameState.pubsub.publish("ShowCookbook","");
gameState.pubsub.publish("Play", "Open_Cookbook");
}
});
@ -566,7 +580,7 @@ function ImgButton( stage, gameState, x, y, mouseOutImg, mouseOverImg, eventCmd, @@ -566,7 +580,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 "+ altfunc);
console.log("button clicked with "+ arg);
var button = new createjs.Shape();
button.graphics.beginFill("#ffffff").drawRect(x_orig, y_orig, x_dest, y_dest);

BIN
res/screens/.DS_Store vendored

Binary file not shown.

BIN
res/sound/.DS_Store vendored

Binary file not shown.

BIN
res/sound/Kitchen/.DS_Store vendored

Binary file not shown.

BIN
res/sound/Kitchen/Close_Cookbook.mp3

Binary file not shown.

BIN
res/sound/Kitchen/Open_Cookbook.mp3

Binary file not shown.
Loading…
Cancel
Save