|  |  | @ -1,40 +1,89 @@ | 
			
		
	
		
		
			
				
					
					|  |  |  | function GameState(){ |  |  |  | function GameState(){ | 
			
		
	
		
		
			
				
					
					|  |  |  | 	var that = this; |  |  |  | 	var that = this; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	var SCREEN_OUT = 1; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 	var SCREEN_IN  = 2; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 	var SCREEN_STABLE = 0; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 	var screenAlpha = 1; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 	this.pubsub = {}; |  |  |  | 	this.pubsub = {}; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	BindPubSub( this.pubsub ); |  |  |  | 	BindPubSub( this.pubsub ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 	this.currentTime = new Date().getTime(); |  |  |  | 	this.currentTime = new Date().getTime(); | 
			
		
	
		
		
			
				
					
					|  |  |  | 	this.oldTime = new Date().getTime(); |  |  |  | 	this.oldTime = new Date().getTime(); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	this.mainUI = new GameUI( "demoCanvas", this ); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     createjs.Ticker.addEventListener( "tick", gameLoop ); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     // Load all our resources:
 |  |  |  |     // Load all our resources:
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     var queue = new createjs.LoadQueue(true); |  |  |  |     var queue = new createjs.LoadQueue(true); | 
			
		
	
		
		
			
				
					
					|  |  |  |     queue.installPlugin(createjs.Sound); |  |  |  |     queue.installPlugin(createjs.Sound); | 
			
		
	
		
		
			
				
					
					|  |  |  |     //queue.addEventListener("fileload", handleFileComplete);
 |  |  |  |     //queue.addEventListener("fileload", handleFileComplete);
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     queue.loadFile( {id: "sound", src:"res/sound/turkey_in_the_straw.mp3"} ); |  |  |  |     queue.loadFile( {id: "TitleMusicFile", src:"res/sound/turkey_in_the_straw.mp3"} ); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     queue.loadFile( {id: "MarketBackgroundSoundFile", src:"res/sound/supermarket.mp3"} ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     queue.loadFile( {id: "MarketBackgroundSoundFile", src:"res/items/FrillsBox.png"} ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     this.screenState = 0; |  |  |  |     this.screenState = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     this.newScreen = ""; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     // Game State flags
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     this.turkeyBought = false; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	this.marketItems = { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		"FrillsBox" : new MarketItem( this, "FrillsBox", 133,92, 100, "res/items/FrillsBox.png", "res/items/FrillsBoxGlow.png" ), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	    "TuTempProberkey" : new MarketItem( this, "TuTempProberkey", 200, 57, 100, "res/items/TempProbe.png", "res/items/TempProbeGlow.png" ), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	    "OvenLightBox" : new MarketItem( this, "OvenLightBox", 131,222, 100, "res/items/OvenLightBox.png", "res/items/OvenLightBoxGlow.png" ), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	    "Alarm" : new MarketItem( this, "Alarm", 173,248, 100, "res/items/Alarm.png", "res/items/AlarmGlow.png" ), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		"Cookbook" : new MarketItem( this, "Cookbook", 283,203, 100, "res/items/Cookbook1.png", "res/items/Cookbook1Glow.png" ), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	    "StuffingRepurposed" : new MarketItem( this, "StuffingRepurposed",  510,197, 100, "res/items/StuffingRepurposed.png", "res/items/StuffingRepurposedGlow.png" ), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	    "StuffingExquisite" : new MarketItem( this, "StuffingExquisite", 458,210, 100, "res/items/StuffingExquisite.png", "res/items/StuffingExquisiteGlow.png" ), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	    "StuffingSpecial" : new MarketItem( this, "StuffingSpecial", 390,220, 100, "res/items/StuffingSpecial.png", "res/items/StuffingSpecialGlow.png" ), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	    "Turkey1" : new MarketItem( this, "Turkey1", 170,350, 100, "res/items/Turkey5.png", "res/items/Turkey5Glow.png" ), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	    "Turkey2": new MarketItem( this, "Turkey2", 540,320, 100, "res/items/Turkey4.png", "res/items/Turkey4Glow.png" ), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	    "Turkey3" : new MarketItem( this, "Turkey3", 265,415, 100, "res/items/Turkey3.png", "res/items/Turkey3Glow.png" ), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	    "Turkey4": new MarketItem( this, "Turkey4", 474,357, 100, "res/items/Turkey2.png", "res/items/Turkey2Glow.png" ), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		"Turkey5": new MarketItem( this, "Turkey5", 368,426, 100, "res/items/Turkey1.png", "res/items/Turkey1Glow.png" ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	}; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	this.purchasedItems = []; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	// did we already show the player the kitchen intro?
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	this.kitchenIntro = false; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	this.mainUI = new GameUI( "demoCanvas", this ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     createjs.Ticker.addEventListener( "tick", gameLoop ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	function gameLoop(){ |  |  |  | 	function gameLoop(){ | 
			
		
	
		
		
			
				
					
					|  |  |  | 		that.mainUI.draw(); |  |  |  | 		that.mainUI.draw(); | 
			
		
	
		
		
			
				
					
					|  |  |  | 	} |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	return { |  |  |  | 	return { | 
			
		
	
		
		
			
				
					
					|  |  |  | 		"main": this |  |  |  | 	//	"main": this
 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 	} |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | /* | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	createjs.Sound.registerSound("res/sound/supermarket.mp3", "TitleMusic"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	var backgroundSound = createjs.Sound.createInstance("TitleMusic");  // play using id.  Could also use full sourcepath or event.src.
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	var backgroundSounds = createjs.Sound.createInstance("TitleMusic"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	backgroundSound.setPosition(0); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	backgroundSound.volume = 1; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	setTimeout(function(){ backgroundSounds.play();},2000); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	backgroundSound.play(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	// loop-de-loop
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |  	backgroundSound.addEventListener("complete", playAgain); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |  	backgroundSound.addEventListener("complete", playAgainMe); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |  	function playAgain(event) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |  		backgroundSound.setPosition(0); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      	backgroundSound.play(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      	
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |  	} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |  	function playAgainMe(event){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |  		setTimeout(function(){ backgroundSounds.play();},1000); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |  	} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | */ | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | function GameUI( canvasElem, gameState ){ |  |  |  | function GameUI( canvasElem, gameState ){ | 
			
		
	
		
		
			
				
					
					|  |  |  | 	var that = this; |  |  |  | 	var that = this; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	var SCREEN_OUT = 1; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	var SCREEN_IN  = 2; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	var SCREEN_STABLE = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	this.stage = new createjs.Stage( canvasElem ); |  |  |  | 	this.stage = new createjs.Stage( canvasElem ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 	this.stage.enableMouseOver(20); |  |  |  | 	this.stage.enableMouseOver(20); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -55,27 +104,60 @@ function GameUI( canvasElem, gameState ){ | 
			
		
	
		
		
			
				
					
					|  |  |  | 		"CreditsScreen"		 : CreditsScreen |  |  |  | 		"CreditsScreen"		 : CreditsScreen | 
			
		
	
		
		
			
				
					
					|  |  |  | 	} |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	this.activeScreenObj = new KitchenScreen( this.stage, gameState ); |  |  |  | 	this.activeScreenObj = new MarketScreen( this.stage, gameState ); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 	var textContent = new createjs.Text( "", "16px Arial", "#00000000" ); |  |  |  | 	var textContent = new createjs.Text( "", "20px Arial", "#00000000" ); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 	textContent.x = 750; |  |  |  | 	textContent.x = 750; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	textContent.y = 30; |  |  |  | 	textContent.y = 30; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	that.stage.addChild( textContent); |  |  |  | 	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); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	this.switchScreen = function( screenName ){ |  |  |  | 	var soundManager = new SoundManager( gameState ); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		//gameState.screenState = SCREEN_OUT;
 |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	// delay for fade in and fade-out
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	this.switchScreen = function( screenName ){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		gameState.screenState = SCREEN_OUT; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		gameState.pubsub.publish( "FadeOut", "" ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		console.log("Switch screen called with" + screenName); |  |  |  | 		console.log("Switch screen called with" + screenName); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		gameState.newScreen = screenName; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	}; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	this.actuallySwitchScreen = function( screenName ){ | 
			
		
	
		
		
			
				
					
					|  |  |  | 		that.stage.removeAllChildren(); |  |  |  | 		that.stage.removeAllChildren(); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		that.activeScreenObj = new that.screens[ screenName ]( that.stage, gameState ); |  |  |  | 		that.activeScreenObj = new that.screens[ screenName ]( that.stage, gameState ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		//var rect = new createjs.Rectangle(0, 0, 100, 100);
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 		that.stage.addChild( textContent ); |  |  |  | 		that.stage.addChild( textContent ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 	} |  |  |  | 		that.stage.addChild( overlay ); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 	}; | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	gameState.pubsub.subscribe( "SwitchScreen", this.switchScreen ); |  |  |  | 	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 { |  |  |  | 	return { | 
			
		
	
		
		
			
				
					
					|  |  |  | 		draw : function(){ |  |  |  | 		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(); |  |  |  | 			that.activeScreenObj.blit(); | 
			
		
	
		
		
			
				
					
					|  |  |  | 			textContent.text = createjs.Ticker.getMeasuredFPS().toFixed(1); |  |  |  | 			textContent.text = createjs.Ticker.getMeasuredFPS().toFixed(1); | 
			
		
	
		
		
			
				
					
					|  |  |  | 			that.stage.update(); |  |  |  | 			that.stage.update(); | 
			
		
	
	
		
		
			
				
					|  |  | @ -89,34 +171,33 @@ function DialogUI( stage ){ | 
			
		
	
		
		
			
				
					
					|  |  |  | 	var DIALOG_RECEDING = 0; |  |  |  | 	var DIALOG_RECEDING = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	var DIALOG_SHOWING = 1; |  |  |  | 	var DIALOG_SHOWING = 1; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	var DIALOG_PAUSING = 2; |  |  |  | 	var DIALOG_PAUSING = 2; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	var MILLIS_PER_CHAR = 50; |  |  |  | 	var MILLIS_PER_CHAR = 100; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	this.dialogSpeed = 30; |  |  |  | 	this.dialogSpeed = 30; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	this.dialogState = DIALOG_PAUSING; |  |  |  | 	this.dialogState = DIALOG_PAUSING; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	this.dialogMotionQueue = [DIALOG_RECEDING,DIALOG_SHOWING,DIALOG_PAUSING]; |  |  |  | 	this.dialogMotionQueue = [DIALOG_SHOWING]; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 	this.currDialogueSeq = new DialogueSequence(); |  |  |  | 	this.currDialogueSeq = new DialogueSequence(); | 
			
		
	
		
		
			
				
					
					|  |  |  | 	dialogQueue = []; |  |  |  | 	dialogQueue = []; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 	this.dialogBox = new createjs.Bitmap("res/DialogueBox.png"); |  |  |  | 	this.dialogBox = new createjs.Bitmap("res/DialogueBox.png"); | 
			
		
	
		
		
			
				
					
					|  |  |  | 	this.dialogBox.x = 10; |  |  |  | 	this.dialogBox.x = 10; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	this.dialogBox.y = 435; |  |  |  | 	this.dialogBox.y = 675; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	this.textContent = new createjs.Text( "Hey there kids!", "16px Arial", "#00000000" ); |  |  |  | 	this.textContent = new createjs.Text( "Hey there kids!", "24px Arial", "#00000000" ); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 	this.textContent.x = 195; |  |  |  | 	this.textContent.x = 205; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 	this.textContent.y = 475; |  |  |  | 	this.textContent.y = 705; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 	this.textContent.lineWidth = 600; |  |  |  | 	this.textContent.lineWidth = 565; | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 	this.textContent.lineHeight = 30; |  |  |  | 	this.textContent.lineHeight = 30; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	this.textContent.textBaseline = "alphabetic"; |  |  |  | 	this.textContent.textBaseline = "alphabetic"; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	this.dialogBox.addEventListener( "mouseover", function(){ document.body.style.cursor='pointer'; } ); |  |  |  | 	this.dialogBox.addEventListener( "mouseover", function(){ document.body.style.cursor='pointer'; } ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  	this.dialogBox.addEventListener( "mouseout", function(){ document.body.style.cursor='default'; } ); |  |  |  |  	this.dialogBox.addEventListener( "mouseout", function(){ document.body.style.cursor='default'; } ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  	this.dialogBox.addEventListener( "click",  function(){ clickEvent(); }); |  |  |  |  	this.dialogBox.addEventListener( "click",  function(){ setTimeout( clickEvent, 100); }); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	this.textContent.addEventListener( "mouseover", function(){ document.body.style.cursor='pointer'; } ); |  |  |  | 	this.textContent.addEventListener( "mouseover", function(){ document.body.style.cursor='pointer'; } ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  	this.textContent.addEventListener( "mouseout", function(){ document.body.style.cursor='default'; } ); |  |  |  |  	this.textContent.addEventListener( "mouseout", function(){ document.body.style.cursor='default'; } ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  	this.textContent.addEventListener( "click", function(){ clickEvent(); }); |  |  |  |  	this.textContent.addEventListener( "click", function(){ setTimeout( clickEvent, 100); }); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  	// negate double setTimeout if clicked
 |  |  |  |  	// negate double setTimeout if clicked
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -126,7 +207,7 @@ function DialogUI( stage ){ | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  		// if there is more dialogue text, then keep going, otherwise, recede
 |  |  |  |  		// if there is more dialogue text, then keep going, otherwise, recede
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  		if( that.currDialogueSeq.more() ){ |  |  |  |  		if( that.currDialogueSeq.more() ){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  			that.dialogMotionQueue.push(DIALOG_SHOWING); |  |  |  |  			setTimeout( function(){ that.dialogMotionQueue.push(DIALOG_SHOWING) }, 1000); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  			that.textContent.text=that.currDialogueSeq.next(); |  |  |  |  			that.textContent.text=that.currDialogueSeq.next(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  			delayCounter = 0; |  |  |  |  			delayCounter = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |  			oldTime = new Date().getTime() |  |  |  |  			oldTime = new Date().getTime() | 
			
		
	
	
		
		
			
				
					|  |  | @ -166,7 +247,7 @@ function DialogUI( stage ){ | 
			
		
	
		
		
			
				
					
					|  |  |  |     		} |  |  |  |     		} | 
			
		
	
		
		
			
				
					
					|  |  |  |     		if( that.dialogBox.y < 435 && that.dialogState == DIALOG_SHOWING ){ |  |  |  |     		if( that.dialogBox.y < 435 && that.dialogState == DIALOG_SHOWING ){ | 
			
		
	
		
		
			
				
					
					|  |  |  |     			that.dialogBox.y = 435; |  |  |  |     			that.dialogBox.y = 435; | 
			
		
	
		
		
			
				
					
					|  |  |  |     			that.textContent.y = 465; |  |  |  |     			that.textContent.y = 480; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     			that.dialogState = DIALOG_PAUSING; |  |  |  |     			that.dialogState = DIALOG_PAUSING; | 
			
		
	
		
		
			
				
					
					|  |  |  |     			console.log( "Pausing on showing" + that.dialogBox.y ); |  |  |  |     			console.log( "Pausing on showing" + that.dialogBox.y ); | 
			
		
	
		
		
			
				
					
					|  |  |  |     		} |  |  |  |     		} | 
			
		
	
	
		
		
			
				
					|  |  | 
 |