Section 1
//AbstractResponder (com.nickonline.services.business.AbstractResponder)
package com.nickonline.services.business {
public class AbstractResponder implements IResponder {
private var validationEnabled:Boolean;// = true
public static const VERSION:String = "1";
public function allowValidation():Boolean{
return (this.validationEnabled);
}
public function onFault(_arg1:Object):void{
throw (new Error("AbstractResponder: onResult: Provide a concrete class."));
}
public function onStatus(_arg1:Object):void{
throw (new Error("AbstractResponder: onResult: Provide a concrete class."));
}
public function isValid(_arg1:String):Boolean{
return ((VERSION == _arg1));
}
public function onResult(_arg1:Object):void{
throw (new Error("AbstractResponder: onResult: Provide a concrete class."));
}
public function validate(_arg1:String):void{
if (((!(this.allowValidation())) || (this.isValid(_arg1)))){
return;
};
this.invalidate((((("Responder::invalid version: request:[" + AbstractResponder.VERSION) + "] - server:[") + _arg1) + "]"));
}
public function invalidate(_arg1:String):void{
if (!this.allowValidation()){
return;
};
throw (new Error(_arg1));
}
public function enableValidation(_arg1:Boolean):void{
this.validationEnabled = _arg1;
}
}
}//package com.nickonline.services.business
Section 2
//IResponder (com.nickonline.services.business.IResponder)
package com.nickonline.services.business {
public interface IResponder {
function onStatus(_arg1:Object):void;
function allowValidation():Boolean;
function onFault(_arg1:Object):void;
function validate(_arg1:String):void;
function isValid(_arg1:String):Boolean;
function invalidate(_arg1:String):void;
function enableValidation(_arg1:Boolean):void;
function onResult(_arg1:Object):void;
}
}//package com.nickonline.services.business
Section 3
//ProxyResponder (com.nickonline.services.business.ProxyResponder)
package com.nickonline.services.business {
public class ProxyResponder extends AbstractResponder {
private var proxyOnResult:Function;
private var proxyOnFault:Function;
private var proxyOnUpdate:Function;
private var proxyOnStatus:Function;
public function ProxyResponder(_arg1:Function, _arg2:Function, _arg3:Function=null){
this.proxyOnResult = _arg1;
this.proxyOnFault = _arg2;
this.proxyOnStatus = _arg3;
}
override public function onFault(_arg1:Object):void{
if (this.proxyOnFault != null){
this.proxyOnFault(_arg1);
};
}
override public function onResult(_arg1:Object):void{
if (this.proxyOnResult != null){
this.proxyOnResult(_arg1);
};
}
override public function onStatus(_arg1:Object):void{
if (this.proxyOnStatus != null){
this.proxyOnStatus(_arg1);
};
}
override public function invalidate(_arg1:String):void{
if (!this.allowValidation()){
return;
};
trace(("ProxyResponder: invalidate: " + _arg1));
}
}
}//package com.nickonline.services.business
Section 4
//ServiceLocator (com.nickonline.services.business.ServiceLocator)
package com.nickonline.services.business {
import flash.events.*;
import flash.display.*;
import flash.system.*;
import flash.utils.*;
import flash.net.*;
public final class ServiceLocator {
private var pManagerURI:String;
private var doServiceLoaded:Function;
private var managerLoader:Loader;
private var serviceEvents:Object;
private var managerLoaderContext:LoaderContext;
private var serviceManager;
private var pConfigURI:String;
private var pDefaultURI:String;
public static const DEFAULT_MANAGER_URI:String = "/common/flash/services/ServiceManager.swf";
public function ServiceLocator(_arg1:String=null, _arg2:String=null){
this.managerURI = _arg1;
this.configURI = _arg2;
this.serviceEvents = null;
}
private function loaded(_arg1:Event):void{
if (Event.INIT == _arg1.type){
} else {
if (Event.COMPLETE == _arg1.type){
this.serviceManager = _arg1.target.content;
this.serviceManager.defaultURI = this.defaultURI;
this.addEventToManager("EVENT_SERVICES_LOADED");
this.addEventToManager("EVENT_SERVICE_INVALID");
this.addEventToManager("EVENT_SERVICES_NOT_FOUND");
this.serviceManager.loadServices(this.configURI);
} else {
if (this.serviceEvents == null){
return;
};
var _local2 = this.serviceEvents;
_local2["EVENT_SERVICES_NOT_FOUND"](new Event("EVENT_SERVICES_NOT_FOUND"));
};
};
}
public function removeEventListener(_arg1:String, _arg2:Function):void{
if (this.serviceManager == null){
return;
};
this.serviceManager.removeEventListener(_arg1, _arg2);
}
public function addEventListener(_arg1:String, _arg2:Function):void{
if (this.serviceEvents == null){
this.serviceEvents = new Object();
};
this.serviceEvents[_arg1] = _arg2;
}
public function get configURI():String{
return (this.pConfigURI);
}
public function set configURI(_arg1:String):void{
this.pConfigURI = _arg1;
}
public function set defaultURI(_arg1:String):void{
this.pDefaultURI = _arg1;
}
public function load():void{
this.managerLoader = new Loader();
this.managerLoader.contentLoaderInfo.addEventListener(Event.INIT, this.loaded);
this.managerLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, this.loaded);
this.managerLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, this.loaded);
this.managerLoader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.loaded);
this.managerLoaderContext = new LoaderContext(false, new ApplicationDomain(ApplicationDomain.currentDomain));
this.managerLoader.load(new URLRequest((this.defaultURI + this.managerURI)), this.managerLoaderContext);
}
public function get defaultURI():String{
return (((this.pDefaultURI == null)) ? "" : this.pDefaultURI);
}
public function execute(_arg1:String, _arg2:String, _arg3:Object, _arg4):void{
this.serviceManager.execute(_arg1, _arg2, _arg3, _arg4);
}
public function addEventToManager(_arg1:String):void{
if ((((((((this.serviceManager == null)) || ((_arg1 == null)))) || ((this.serviceEvents == null)))) || ((this.serviceEvents[_arg1] == null)))){
return;
};
this.serviceManager.addEventListener(_arg1, this.serviceEvents[_arg1]);
}
public function set managerURI(_arg1:String):void{
this.pManagerURI = _arg1;
}
public function get managerURI():String{
return (((this.pManagerURI == null)) ? DEFAULT_MANAGER_URI : this.pManagerURI);
}
}
}//package com.nickonline.services.business
Section 5
//Background (gameplay.background.Background)
package gameplay.background {
import flash.events.*;
import flash.display.*;
import library.events.*;
import library.interfaces.*;
import gameplay.layout.*;
public class Background implements Idestroyable {
private var mcRef:MovieClip;
public function Background(_arg1:MovieClip):void{
mcRef = _arg1;
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
mcRef.x = Layout.Background.x;
mcRef.y = Layout.Background.y;
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
mcRef = null;
}
}
}//package gameplay.background
Section 6
//CutBoard (gameplay.background.CutBoard)
package gameplay.background {
import flash.events.*;
import flash.display.*;
import library.events.*;
import library.interfaces.*;
import gameplay.layout.*;
public class CutBoard implements Idestroyable {
private var mcRef:MovieClip;
public function CutBoard(_arg1:MovieClip):void{
mcRef = _arg1;
mcRef.x = Layout.CutBoard.x;
mcRef.y = Layout.CutBoard.y;
mcRef.scaleX = (mcRef.scaleY = Layout.CutBoard.scale);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
mcRef = null;
}
}
}//package gameplay.background
Section 7
//Mat (gameplay.background.Mat)
package gameplay.background {
import library.sounds.*;
import flash.events.*;
import flash.display.*;
import library.events.*;
import gameplay.special.*;
import library.basic.*;
import library.interfaces.*;
import gameplay.layout.*;
import gameplay.sushi.*;
import flash.filters.*;
public class Mat extends StateManaged implements Idestroyable {
public static const sSTATE_IDLE:String = "idle";
public static const sSTATE_NONE:String = "none";
public static const sSTATE_ROLLING_01:String = "rolling01";
public static const sSTATE_ROLLING_02:String = "rolling02";
public function Mat(_arg1:MovieClip, _arg2:Boolean=false):void{
super(_arg1);
mcRef.x = Layout.Mat.x;
mcRef.y = Layout.Mat.y;
mcRef.scaleX = (mcRef.scaleY = Layout.Mat.scale);
addState(sSTATE_IDLE, null);
addState(sSTATE_NONE, null);
addState(sSTATE_ROLLING_01, state_rolling_01);
addState(sSTATE_ROLLING_02, state_rolling_02);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, resume, false, 0, true);
if (_arg2){
setState(sSTATE_NONE);
} else {
Main.instance.gameManager.addEventListener(GameEvent.EVENT_CUT, onRoll, false, 0, true);
setState(sSTATE_IDLE);
};
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_PAUSE, pause, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_RESUME, resume, false);
mcRef = null;
}
public function onOver(_arg1:MouseEvent):void{
var _local2:Function;
var _local3:GlowFilter;
_local2 = Main.instance.gameManager.instruction.authorize;
if (((((((!((Main.instance.gameManager.instruction == null))) && ((state == sSTATE_IDLE)))) && (_local2("roll")))) && (!((mcRef.getChildByName("mcState") == null))))){
_local3 = new GlowFilter(0, 1, 2, 2, 8);
mcState.filters = new Array(_local3);
};
}
public function reset():void{
Main.instance.gameManager.addEventListener(GameEvent.EVENT_CUT, onRoll, false, 0, true);
}
public function onClick(_arg1:MouseEvent):void{
if (Main.instance.gameManager.instruction.authorize("roll")){
if (state == sSTATE_IDLE){
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
Main.instance.gameManager.roll();
};
};
onOut(null);
}
public function onOut(_arg1:MouseEvent):void{
if (mcRef.getChildByName("mcState") != null){
mcState.filters = new Array();
};
}
public function state_rolling_02():void{
if ((((currentFrame == 21)) && (Main.instance.gameManager.started))){
Main.instance.gameManager.dispatchEvent(new Event(GameEvent.EVENT_DESTROY_INGREDIENTS));
Main.instance.gameManager.addToPlaceHolder(null, null, Sushi, new mcSushi(), Layout.MatPlaceHolder, Sushi.sSTATE_MAT_IDLE);
};
if (stateComplete){
Main.instance.gameManager.dispatchEvent(new Event(Special.NEXT));
setState(sSTATE_NONE);
};
}
public function state_rolling_01():void{
if (stateComplete){
setState(sSTATE_IDLE);
};
}
public function onRoll(_arg1:Event):void{
if (Main.instance.gameManager.instruction.authorize("roll")){
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_CUT, onRoll, false);
Main.instance.gameManager.roll();
};
}
public function roll(_arg1:Boolean=false):void{
if (_arg1){
setState(sSTATE_ROLLING_02);
} else {
setState(sSTATE_ROLLING_01);
SoundEngine.Play(Main.sSOUND_SFX, SoundList.sSOUND_ROLL_SUSHI, 1, true, false, false);
};
}
}
}//package gameplay.background
Section 8
//Soya (gameplay.background.Soya)
package gameplay.background {
import flash.events.*;
import flash.display.*;
import library.events.*;
import library.interfaces.*;
public class Soya implements Idestroyable {
private var mcRef:MovieClip;
public function Soya(_arg1:MovieClip, _arg2:Object):void{
mcRef = _arg1;
mcRef.x = _arg2.x;
mcRef.y = _arg2.y;
mcRef.scaleX = (mcRef.scaleY = _arg2.scale);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
mcRef = null;
}
}
}//package gameplay.background
Section 9
//Table (gameplay.background.Table)
package gameplay.background {
import flash.events.*;
import flash.display.*;
import library.events.*;
import library.interfaces.*;
import gameplay.layout.*;
public class Table implements Idestroyable {
private var mcRef:MovieClip;
public function Table(_arg1:MovieClip):void{
mcRef = _arg1;
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
mcRef.x = Layout.Table.x;
mcRef.y = Layout.Table.y;
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
mcRef = null;
}
}
}//package gameplay.background
Section 10
//Arrows (gameplay.bubble.Arrows)
package gameplay.bubble {
import flash.events.*;
import flash.display.*;
import library.events.*;
import library.basic.*;
import library.interfaces.*;
public class Arrows extends StateManaged implements Idestroyable {
public static const sSTATE_IDLE:String = "idle";
public static const sSTATE_IN:String = "in";
public static const sSTATE_BOUNCE:String = "bounce";
public function Arrows(_arg1:MovieClip, _arg2:Object):void{
super(_arg1);
mcRef.x = _arg2.x;
mcRef.y = _arg2.y;
mcRef.scaleX = (mcRef.scaleY = _arg2.scale);
addState(sSTATE_BOUNCE, state_bounce);
addState(sSTATE_IDLE, null);
addState(sSTATE_IN, state_in);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, resume, false, 0, true);
setState(sSTATE_IN);
}
public function state_in():void{
if (stateComplete){
setState(sSTATE_IDLE);
};
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_PAUSE, pause, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_RESUME, resume, false);
mcRef = null;
}
public function bounce():void{
setState(sSTATE_BOUNCE);
}
public function state_bounce():void{
if (stateComplete){
setState(sSTATE_IDLE);
};
}
}
}//package gameplay.bubble
Section 11
//Bubble (gameplay.bubble.Bubble)
package gameplay.bubble {
import library.sounds.*;
import flash.events.*;
import flash.display.*;
import library.events.*;
import library.basic.*;
import library.interfaces.*;
public class Bubble extends StateManaged implements Idestroyable {
private var iFrame:int;
private var bHot:Boolean;
private var sSushi:String;
private var sChar:String;
public static const sSTATE_IDLE:String = "idle";
public static const sSTATE_IN:String = "in";
public static const sSTATE_OUT:String = "out";
public function Bubble(_arg1:MovieClip, _arg2:Object, _arg3:String, _arg4:String, _arg5:Boolean):void{
super(_arg1);
sChar = _arg3;
sSushi = _arg4;
bHot = _arg5;
iFrame = Config.Default.BubbleTime;
mcRef.x = _arg2.x;
mcRef.y = _arg2.y;
mcRef.scaleX = (mcRef.scaleY = _arg2.scale);
addState(sSTATE_IN, state_in, state_idle_init);
addState(sSTATE_IDLE, state_idle, state_idle_init);
addState(sSTATE_OUT, state_out, state_idle_init);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, resume, false, 0, true);
setState(sSTATE_IN);
}
public function state_idle():void{
iFrame--;
if (iFrame <= 0){
SoundEngine.Play(Main.sSOUND_SFX, SoundList.sSOUND_BUBBLE_OUT);
setState(sSTATE_OUT);
};
}
private function setSushi():void{
if (((!((mcState.getChildByName("mcSushi") == null))) && (!((mcState.getChildByName("mcSushiHot") == null))))){
MovieClip(mcState.getChildByName("mcSushi")).gotoAndStop(sSushi);
MovieClip(mcState.getChildByName("mcSushiHot")).gotoAndStop(sSushi);
};
}
public function state_in():void{
setChar();
setSushi();
setHot();
if (stateComplete){
setState(sSTATE_IDLE);
};
}
private function setChar():void{
if (mcState.getChildByName("mcBubble") != null){
MovieClip(mcState.getChildByName("mcBubble")).gotoAndStop(sChar);
};
}
private function setHot():void{
if (((((bHot) && (!((mcState.getChildByName("mcSushi") == null))))) && (!((mcState.getChildByName("mcSushiHot") == null))))){
mcState.mcSushi.visible = false;
mcState.mcSushiHot.visible = true;
} else {
if (((((!(bHot)) && (!((mcState.getChildByName("mcSushiHot") == null))))) && (!((mcState.getChildByName("mcSushiHot") == null))))){
mcState.mcSushiHot.visible = false;
mcState.mcSushi.visible = true;
};
};
}
public function state_out():void{
setChar();
setSushi();
setHot();
if (stateComplete){
destroy(null);
};
}
public function destroy(_arg1:Event):void{
trace(("Bubble.destroy > _e : " + _arg1));
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_PAUSE, pause, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_RESUME, resume, false);
if (mcRef != null){
if (mcRef.parent != null){
mcRef.parent.removeChild(mcRef);
};
mcRef = null;
};
}
public function state_idle_init():void{
setChar();
setSushi();
setHot();
}
}
}//package gameplay.bubble
Section 12
//Character01 (gameplay.characters.Character01)
package gameplay.characters {
import library.sounds.*;
import flash.events.*;
import flash.display.*;
import library.events.*;
import gameplay.tutorial.*;
import library.basic.*;
import library.interfaces.*;
import gameplay.layout.*;
import flash.filters.*;
public class Character01 extends StateManaged implements Idestroyable {
public static const sSTATE_IDLE:String = "idle";
public static const sSTATE_UNHAPPY:String = "unhappy";
public static const sSTATE_HAPPY:String = "happy";
public function Character01(_arg1:MovieClip):void{
super(_arg1);
mcRef.x = Layout.Carly.x;
mcRef.y = Layout.Carly.y;
mcRef.scaleX = (mcRef.scaleY = Layout.Carly.scale);
addState(sSTATE_HAPPY, state_happy);
addState(sSTATE_IDLE, null);
addState(sSTATE_UNHAPPY, state_unhappy);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, resume, false, 0, true);
Main.instance.gameManager.addEventListener("char01_good", reaction, false, 0, true);
Main.instance.gameManager.addEventListener("char01_bad", reaction, false, 0, true);
mcRef.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
if (!Main.instance.gameManager.tutorial){
mcRef.addEventListener(MouseEvent.MOUSE_OVER, onOver, false, 0, true);
mcRef.addEventListener(MouseEvent.MOUSE_OUT, onOut, false, 0, true);
};
setState(sSTATE_IDLE);
}
public function reaction(_arg1:Event):void{
switch (_arg1.type){
case "char01_good":
Main.instance.gameManager.dispatchEvent(new TutEvent(TutEvent.sEVENT_CLICK, mcRef));
Main.instance.gameManager.bGood = true;
SoundEngine.Play(Main.sSOUND_SFX, SoundList.sSOUND_HAPPY);
setState(sSTATE_HAPPY);
break;
case "char01_bad":
Main.instance.gameManager.dispatchEvent(new TutEvent(TutEvent.sEVENT_CLICK, mcRef));
Main.instance.gameManager.bGood = false;
SoundEngine.Play(Main.sSOUND_SFX, SoundList.sSOUND_UNHAPPY);
setState(sSTATE_UNHAPPY);
break;
};
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
mcRef.removeEventListener(MouseEvent.MOUSE_OVER, onOver, false);
mcRef.removeEventListener(MouseEvent.MOUSE_OUT, onOut, false);
mcRef = null;
}
public function onOver(_arg1:MouseEvent):void{
var _local2:Function;
var _local3:GlowFilter;
_local2 = Main.instance.gameManager.instruction.authorize;
if (((((_local2("serve")) && (!((mcRef.getChildByName("mcState") == null))))) && (!(Main.instance.gameManager.tutorial)))){
_local3 = new GlowFilter(0, 1, 2, 2, 8);
mcState.filters = new Array(_local3);
};
}
public function onClick(_arg1:MouseEvent):void{
if (((Main.instance.gameManager.instruction.authorize("serve")) && (!((_arg1 == null))))){
Main.instance.gameManager.dispatchEvent(new Event("char01"));
onOut(null);
};
}
override public function resume(_arg1:Event=null):void{
super.resume(_arg1);
resumeEyes();
}
public function onOut(_arg1:MouseEvent):void{
if (((!((mcRef.getChildByName("mcState") == null))) && (!(Main.instance.gameManager.tutorial)))){
mcState.filters = new Array();
};
}
public function state_happy():void{
if (stateComplete){
setState(sSTATE_IDLE);
};
}
override public function pause(_arg1:Event=null):void{
super.pause(_arg1);
pauseEyes();
}
private function pauseEyes():void{
if (mcState.getChildByName("mcHead") != null){
if (mcState.mcHead.getChildByName("mcRightEye") != null){
mcState.mcHead.mcRightEye.stop();
mcState.mcHead.mcLeftEye.stop();
};
};
}
public function state_unhappy():void{
if (stateComplete){
setState(sSTATE_IDLE);
};
}
private function resumeEyes():void{
if (mcState.getChildByName("mcHead") != null){
if (mcState.mcHead.getChildByName("mcRightEye") != null){
mcState.mcHead.mcRightEye.play();
mcState.mcHead.mcLeftEye.play();
};
};
}
}
}//package gameplay.characters
Section 13
//Character02 (gameplay.characters.Character02)
package gameplay.characters {
import library.sounds.*;
import flash.events.*;
import flash.display.*;
import library.events.*;
import gameplay.tutorial.*;
import library.basic.*;
import library.interfaces.*;
import gameplay.layout.*;
import flash.filters.*;
public class Character02 extends StateManaged implements Idestroyable {
public static const sSTATE_IDLE:String = "idle";
public static const sSTATE_UNHAPPY:String = "unhappy";
public static const sSTATE_HAPPY:String = "happy";
public function Character02(_arg1:MovieClip):void{
super(_arg1);
mcRef.x = Layout.Sam.x;
mcRef.y = Layout.Sam.y;
mcRef.scaleX = (mcRef.scaleY = Layout.Sam.scale);
addState(sSTATE_HAPPY, state_happy);
addState(sSTATE_IDLE, null);
addState(sSTATE_UNHAPPY, state_unhappy);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, resume, false, 0, true);
Main.instance.gameManager.addEventListener("char02_good", reaction, false, 0, true);
Main.instance.gameManager.addEventListener("char02_bad", reaction, false, 0, true);
mcRef.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
if (!Main.instance.gameManager.tutorial){
mcRef.addEventListener(MouseEvent.MOUSE_OVER, onOver, false, 0, true);
mcRef.addEventListener(MouseEvent.MOUSE_OUT, onOut, false, 0, true);
};
setState(sSTATE_IDLE);
}
public function reaction(_arg1:Event):void{
switch (_arg1.type){
case "char02_good":
Main.instance.gameManager.dispatchEvent(new TutEvent(TutEvent.sEVENT_CLICK, mcRef));
Main.instance.gameManager.bGood = true;
SoundEngine.Play(Main.sSOUND_SFX, SoundList.sSOUND_HAPPY);
setState(sSTATE_HAPPY);
break;
case "char02_bad":
Main.instance.gameManager.dispatchEvent(new TutEvent(TutEvent.sEVENT_CLICK, mcRef));
Main.instance.gameManager.bGood = false;
SoundEngine.Play(Main.sSOUND_SFX, SoundList.sSOUND_UNHAPPY);
setState(sSTATE_UNHAPPY);
break;
};
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
mcRef.removeEventListener(MouseEvent.MOUSE_OVER, onOver, false);
mcRef.removeEventListener(MouseEvent.MOUSE_OUT, onOut, false);
mcRef = null;
}
public function onOver(_arg1:MouseEvent):void{
var _local2:Function;
var _local3:GlowFilter;
_local2 = Main.instance.gameManager.instruction.authorize;
if (((((_local2("serve")) && (!((mcRef.getChildByName("mcState") == null))))) && (!(Main.instance.gameManager.tutorial)))){
_local3 = new GlowFilter(0, 1, 2, 2, 8);
mcState.filters = new Array(_local3);
};
}
public function onClick(_arg1:MouseEvent):void{
if (((Main.instance.gameManager.instruction.authorize("serve")) && (!((_arg1 == null))))){
Main.instance.gameManager.dispatchEvent(new Event("char02"));
onOut(null);
};
}
override public function resume(_arg1:Event=null):void{
super.resume(_arg1);
resumeEyes();
}
public function onOut(_arg1:MouseEvent):void{
if (((!((mcRef.getChildByName("mcState") == null))) && (!(Main.instance.gameManager.tutorial)))){
mcState.filters = new Array();
};
}
public function state_happy():void{
if (stateComplete){
setState(sSTATE_IDLE);
};
}
override public function pause(_arg1:Event=null):void{
super.pause(_arg1);
pauseEyes();
}
private function pauseEyes():void{
if (mcState.getChildByName("mcHead") != null){
if (mcState.mcHead.getChildByName("mcRightEye") != null){
mcState.mcHead.mcRightEye.stop();
mcState.mcHead.mcLeftEye.stop();
};
};
}
public function state_unhappy():void{
if (stateComplete){
setState(sSTATE_IDLE);
};
}
private function resumeEyes():void{
if (mcState.getChildByName("mcHead") != null){
if (mcState.mcHead.getChildByName("mcRightEye") != null){
mcState.mcHead.mcRightEye.play();
mcState.mcHead.mcLeftEye.play();
};
};
}
}
}//package gameplay.characters
Section 14
//Character03 (gameplay.characters.Character03)
package gameplay.characters {
import library.sounds.*;
import flash.events.*;
import flash.display.*;
import library.events.*;
import gameplay.tutorial.*;
import library.basic.*;
import library.interfaces.*;
import gameplay.layout.*;
import flash.filters.*;
public class Character03 extends StateManaged implements Idestroyable {
public static const sSTATE_IDLE:String = "idle";
public static const sSTATE_UNHAPPY:String = "unhappy";
public static const sSTATE_HAPPY:String = "happy";
public function Character03(_arg1:MovieClip):void{
super(_arg1);
mcRef.x = Layout.Freddie.x;
mcRef.y = Layout.Freddie.y;
mcRef.scaleX = (mcRef.scaleY = Layout.Freddie.scale);
addState(sSTATE_HAPPY, state_happy);
addState(sSTATE_IDLE, null);
addState(sSTATE_UNHAPPY, state_unhappy);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, resume, false, 0, true);
Main.instance.gameManager.addEventListener("char03_good", reaction, false, 0, true);
Main.instance.gameManager.addEventListener("char03_bad", reaction, false, 0, true);
mcRef.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
if (!Main.instance.gameManager.tutorial){
mcRef.addEventListener(MouseEvent.MOUSE_OVER, onOver, false, 0, true);
mcRef.addEventListener(MouseEvent.MOUSE_OUT, onOut, false, 0, true);
};
setState(sSTATE_IDLE);
}
public function reaction(_arg1:Event):void{
switch (_arg1.type){
case "char03_good":
Main.instance.gameManager.dispatchEvent(new TutEvent(TutEvent.sEVENT_CLICK, mcRef));
Main.instance.gameManager.bGood = true;
SoundEngine.Play(Main.sSOUND_SFX, SoundList.sSOUND_HAPPY);
setState(sSTATE_HAPPY);
break;
case "char03_bad":
Main.instance.gameManager.dispatchEvent(new TutEvent(TutEvent.sEVENT_CLICK, mcRef));
Main.instance.gameManager.bGood = false;
SoundEngine.Play(Main.sSOUND_SFX, SoundList.sSOUND_UNHAPPY);
setState(sSTATE_UNHAPPY);
break;
};
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
mcRef.removeEventListener(MouseEvent.MOUSE_OVER, onOver, false);
mcRef.removeEventListener(MouseEvent.MOUSE_OUT, onOut, false);
mcRef = null;
}
public function onOver(_arg1:MouseEvent):void{
var _local2:Function;
var _local3:GlowFilter;
_local2 = Main.instance.gameManager.instruction.authorize;
if (((((_local2("serve")) && (!((mcRef.getChildByName("mcState") == null))))) && (!(Main.instance.gameManager.tutorial)))){
_local3 = new GlowFilter(0, 1, 2, 2, 8);
mcState.filters = new Array(_local3);
};
}
public function onClick(_arg1:MouseEvent):void{
if (((Main.instance.gameManager.instruction.authorize("serve")) && (!((_arg1 == null))))){
Main.instance.gameManager.dispatchEvent(new Event("char03"));
onOut(null);
};
}
override public function resume(_arg1:Event=null):void{
super.resume(_arg1);
resumeEyes();
}
public function onOut(_arg1:MouseEvent):void{
if (((!((mcRef.getChildByName("mcState") == null))) && (!(Main.instance.gameManager.tutorial)))){
mcState.filters = new Array();
};
}
public function state_happy():void{
if (stateComplete){
setState(sSTATE_IDLE);
};
}
override public function pause(_arg1:Event=null):void{
super.pause(_arg1);
pauseEyes();
}
private function pauseEyes():void{
if (mcState.getChildByName("mcHead") != null){
if (mcState.mcHead.getChildByName("mcRightEye") != null){
mcState.mcHead.mcRightEye.stop();
mcState.mcHead.mcLeftEye.stop();
};
};
}
public function state_unhappy():void{
if (stateComplete){
setState(sSTATE_IDLE);
};
}
private function resumeEyes():void{
if (mcState.getChildByName("mcHead") != null){
if (mcState.mcHead.getChildByName("mcRightEye") != null){
mcState.mcHead.mcRightEye.play();
mcState.mcHead.mcLeftEye.play();
};
};
}
}
}//package gameplay.characters
Section 15
//Feedback (gameplay.feedbacks.Feedback)
package gameplay.feedbacks {
import library.sounds.*;
import flash.events.*;
import flash.display.*;
import library.events.*;
import gameplay.*;
import gameplay.hud.*;
import library.basic.*;
import library.interfaces.*;
public class Feedback extends StateManaged implements Idestroyable {
public static const sSTATE_POSITIVE:String = "positive";
public static const sSTATE_NEGATIVE:String = "negative";
public function Feedback(_arg1:MovieClip, _arg2:Object, _arg3:String):void{
super(_arg1);
mcRef.x = _arg2.x;
mcRef.y = _arg2.y;
mcRef.scaleX = (mcRef.scaleY = _arg2.scale);
addState(sSTATE_NEGATIVE, state_idle);
addState(sSTATE_POSITIVE, state_idle);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, resume, false, 0, true);
if (Main.instance.gameManager.ai != null){
if (_arg3 == sSTATE_POSITIVE){
Life.instance.addLife(Config.Scoring.Feedback.Positive.Time);
ScoreManagement.instance.addScore((Config.Scoring.Feedback.Positive.Score / 35));
SoundEngine.Play(Main.sSOUND_SFX, SoundList.sSOUND_POSITIVE, 1, true, false, true);
} else {
if (_arg3 == sSTATE_NEGATIVE){
Life.instance.remLife(Config.Scoring.Feedback.Negative.Time);
ScoreManagement.instance.addScore((Config.Scoring.Feedback.Negative.Score / 35));
};
};
};
setState(_arg3);
}
public function state_idle():void{
if (stateComplete){
destroy(null);
};
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_PAUSE, pause, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_RESUME, resume, false);
mcRef.parent.removeChild(mcRef);
mcRef = null;
}
}
}//package gameplay.feedbacks
Section 16
//ClickSequence (gameplay.games.ClickSequence)
package gameplay.games {
import library.sounds.*;
import flash.events.*;
import library.events.*;
import library.interfaces.*;
import gameplay.layout.*;
public class ClickSequence implements Idestroyable {
private var aSequence:Array;
private var nThreshold:Number;
public function ClickSequence(_arg1:Array, _arg2:Number):void{
_arg1.sort(suffle);
aSequence = configureSequence(_arg1);
nThreshold = _arg2;
lightUpNext(-1);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
}
public function get threshold():Number{
return (nThreshold);
}
private function checkComplete():void{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:Number;
_local1 = 0;
_local2 = 0;
_local3 = 0;
while (_local3 < aSequence.length) {
if (aSequence[_local3].clicked){
_local1++;
};
if (aSequence[_local3].success){
_local2++;
};
_local3++;
};
if (_local1 == aSequence.length){
_local4 = (_local2 / aSequence.length);
if (Math.min(nThreshold, 1) <= _local4){
throwPositive(_local4);
} else {
throwNegative(_local4);
};
SoundEngine.Play(Main.sSOUND_SFX, SoundList.sSOUND_MINIGAME_END, 1, true, false, true);
};
}
public function onClick(_arg1:MouseEvent):void{
var _local2:int;
_local2 = 0;
while (_local2 < aSequence.length) {
if ((((aSequence[_local2].item.mcRef.x == _arg1.target.parent.parent.x)) && (!(aSequence[_local2].clicked)))){
if (aSequence[_local2].lightup){
aSequence[_local2].success = true;
aSequence[_local2].lightup = false;
SoundEngine.Play(Main.sSOUND_SFX, SoundList.sSOUND_DOT_CLICK);
aSequence[_local2].item.mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
aSequence[_local2].item.check();
aSequence[_local2].clicked = true;
lightUpNext(_local2);
};
break;
};
_local2++;
};
checkComplete();
}
private function suffle(_arg1, _arg2):int{
var _local3:int;
_local3 = (Math.round((Math.random() * 2)) - 1);
return (_local3);
}
private function lightUpNext(_arg1:int):void{
_arg1++;
if (_arg1 < aSequence.length){
if (aSequence[_arg1].clicked){
lightUpNext(_arg1);
} else {
aSequence[_arg1].lightup = true;
aSequence[_arg1].item.lightUp();
};
};
}
private function configureSequence(_arg1:Array):Array{
var _local2:Array;
var _local3:Object;
var _local4:int;
_local2 = new Array();
_local4 = 0;
while (_local4 < _arg1.length) {
_local3 = _arg1[_local4];
_local3.item = new Dot(_arg1[_local4].mc, _arg1[_local4].layout);
_local3.lightup = false;
_local3.success = false;
_local3.clicked = false;
_local3.item.mcRef.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
_local2.push(_local3);
_local4++;
};
return (_local2);
}
public function destroy(_arg1:Event):void{
var _local2:int;
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
_local2 = 0;
while (_local2 < aSequence.length) {
aSequence[_local2].mc.removeEventListener(MouseEvent.CLICK, onClick, false);
aSequence[_local2].item.deleteIt();
_local2++;
};
}
private function throwNegative(_arg1:Number):void{
Main.instance.gameManager.dispatchEvent(new SequenceEvent(SequenceEvent.NEGATIVE, Layout.BoardPlaceHolder, _arg1));
destroy(null);
}
private function throwPositive(_arg1:Number):void{
Main.instance.gameManager.dispatchEvent(new SequenceEvent(SequenceEvent.POSITIVE, Layout.BoardPlaceHolder, _arg1));
destroy(null);
}
}
}//package gameplay.games
Section 17
//Dot (gameplay.games.Dot)
package gameplay.games {
import library.sounds.*;
import flash.events.*;
import flash.display.*;
import library.events.*;
import library.basic.*;
import library.interfaces.*;
public class Dot extends StateManaged implements Idestroyable {
private var mcHit:Sprite;
private var bChecked:Boolean;
private var bDelete:Boolean;
public static const sSTATE_LIGHT_OUT:String = "light_out";
public static const sSTATE_LIGHT_UP:String = "light_in";
public static const sSTATE_IN:String = "in";
public static const sSTATE_CHECK_IDLE:String = "check_idle";
public static const sSTATE_OUT:String = "out";
public static const sSTATE_IDLE:String = "idle";
public static const sSTATE_CHECK_OUT:String = "check_out";
public static const sSTATE_CHECK_IN:String = "check_in";
public static const sSTATE_LIGHT_IDLE:String = "light_idle";
public function Dot(_arg1:MovieClip, _arg2:Object):void{
super(_arg1);
bDelete = false;
bChecked = false;
mcRef.x = _arg2.x;
mcRef.y = _arg2.y;
mcHit = new Sprite();
mcHit.graphics.beginFill(0, 0);
mcHit.graphics.drawCircle(0, 0, 12);
mcHit.graphics.endFill();
addState(sSTATE_CHECK_IDLE, state_check_idle);
addState(sSTATE_CHECK_IN, state_check_in);
addState(sSTATE_CHECK_OUT, state_check_out);
addState(sSTATE_LIGHT_IDLE, state_light_idle, setButtons);
addState(sSTATE_LIGHT_OUT, state_light_out);
addState(sSTATE_LIGHT_UP, state_light_up);
addState(sSTATE_IDLE, state_idle, setButtons);
addState(sSTATE_IN, state_in);
addState(sSTATE_OUT, state_out);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, resume, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
setState(sSTATE_IN);
}
public function state_idle():void{
if (bDelete){
setState(sSTATE_OUT);
};
}
public function setButtons():void{
mcState.addChild(mcHit);
}
public function check():void{
bChecked = true;
if (state == sSTATE_LIGHT_IDLE){
setState(sSTATE_LIGHT_OUT);
} else {
if (state == sSTATE_IDLE){
setState(sSTATE_OUT);
};
};
}
public function state_light_idle():void{
if (bDelete){
setState(sSTATE_LIGHT_OUT);
};
}
public function state_in():void{
if (stateComplete){
setState(sSTATE_IDLE);
};
}
public function lightUp():void{
SoundEngine.Play(Main.sSOUND_SFX, SoundList.sSOUND_DOT_LIGHT);
setState(sSTATE_LIGHT_UP);
}
public function state_check_idle():void{
if (bDelete){
setState(sSTATE_CHECK_OUT);
};
}
public function state_out():void{
if (stateComplete){
if (bDelete){
destroy(null);
} else {
setState(sSTATE_CHECK_IN);
};
};
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_PAUSE, pause, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_RESUME, resume, false);
if (mcRef != null){
mcRef.parent.removeChild(mcRef);
mcRef = null;
};
}
public function state_check_out():void{
if (stateComplete){
if (bDelete){
destroy(null);
} else {
setState(sSTATE_IN);
};
};
}
public function state_check_in():void{
if (stateComplete){
setState(sSTATE_CHECK_IDLE);
};
}
public function state_light_out():void{
if (stateComplete){
if (bDelete){
destroy(null);
} else {
if (bChecked){
setState(sSTATE_CHECK_IN);
} else {
setState(sSTATE_IN);
};
};
};
}
public function deleteIt():void{
bDelete = true;
}
public function state_light_up():void{
if (stateComplete){
setState(sSTATE_LIGHT_IDLE);
};
}
}
}//package gameplay.games
Section 18
//DrawSequence (gameplay.games.DrawSequence)
package gameplay.games {
import library.sounds.*;
import flash.events.*;
import flash.display.*;
import library.events.*;
import library.utils.*;
import library.basic.*;
import library.interfaces.*;
import gameplay.layout.*;
public class DrawSequence extends StateManaged implements Idestroyable {
private var aSequence:Array;
private var nDrawn:Number;
private var nThreshold:Number;
private var aPlayer:Array;
private var nLength:Number;
private var oMouse:Object;
public static const sSTATE_IDLE:String = "idle";
public static const sSTATE_IN:String = "in";
public static const sSTATE_OUT:String = "out";
public function DrawSequence(_arg1:String, _arg2:MovieClip, _arg3:Number):void{
super(_arg2);
nThreshold = _arg3;
aPlayer = new Array();
aSequence = new Array();
setPosition(_arg1);
configureDots();
nLength = getLength();
addState(sSTATE_IDLE, null, state_idle_init);
addState(sSTATE_IN, state_in);
addState(sSTATE_OUT, state_out);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, resume, false, 0, true);
setState(sSTATE_IN);
}
public function onDraw(_arg1:MouseEvent):void{
nDrawn = (nDrawn + MoreMath.getDistance(oMouse, {x:mcRef.mouseX, y:mcRef.mouseY}));
oMouse = {x:mcRef.mouseX, y:mcRef.mouseY};
checkCloseDot();
}
public function startDraw(_arg1:MouseEvent):void{
if (((((!((_arg1.target == Main.instance.gameManager.hud.mcRef.btnMenu))) && (!(Main.instance.gameManager.bPause)))) && ((((Main.instance.gameManager.oKanji == null)) || (!((_arg1.target == Main.instance.gameManager.oKanji.mcRef))))))){
oMouse = {x:mcRef.mouseX, y:mcRef.mouseY};
nDrawn = 0;
Main.instance.removeEventListener(MouseEvent.MOUSE_DOWN, startDraw, false);
Main.instance.addEventListener(MouseEvent.MOUSE_MOVE, onDraw, false, 0, true);
Main.instance.addEventListener(MouseEvent.MOUSE_UP, stopDraw, false, 0, true);
};
}
private function throwNegative(_arg1:Number):void{
Main.instance.gameManager.dispatchEvent(new SequenceEvent(SequenceEvent.NEGATIVE, Layout.MatPlaceHolder, _arg1));
}
private function checkDraw():void{
var _local1:Number;
_local1 = ((nDrawn)<=nLength) ? (nDrawn / nLength) : (nLength / nDrawn);
if ((((aPlayer.length == aSequence.length)) && ((Math.min(nThreshold, 1) <= _local1)))){
throwPositive(_local1);
} else {
throwNegative(_local1);
};
SoundEngine.Play(Main.sSOUND_SFX, SoundList.sSOUND_MINIGAME_END, 1, true, false, false);
setState(sSTATE_OUT);
}
private function configureDots():void{
var _local1:int;
_local1 = 1;
while (mcRef.getChildByName(("mcDot0" + _local1)) != null) {
aSequence.push(mcRef.getChildByName(("mcDot0" + _local1)));
mcRef.getChildByName(("mcDot0" + _local1)).alpha = 0;
_local1++;
};
}
public function state_in():void{
if (stateComplete){
setState(sSTATE_IDLE);
};
}
private function checkCloseDot():void{
if ((((aSequence.length > aPlayer.length)) && ((MoreMath.getDistance({x:aSequence[aPlayer.length].x, y:aSequence[aPlayer.length].y}, oMouse) <= (aSequence[aPlayer.length].width / 2))))){
aPlayer.push(aSequence[aPlayer.length]);
};
if ((((aPlayer.length == aSequence.length)) && ((nDrawn >= nLength)))){
stopDraw(null);
};
}
public function state_out():void{
if (stateComplete){
destroy(null);
};
}
public function stopDraw(_arg1:MouseEvent):void{
Main.instance.removeEventListener(MouseEvent.MOUSE_UP, stopDraw, false);
Main.instance.removeEventListener(MouseEvent.MOUSE_MOVE, onDraw, false);
checkDraw();
}
public function destroy(_arg1:Event):void{
Main.instance.removeEventListener(MouseEvent.MOUSE_DOWN, startDraw, false);
Main.instance.removeEventListener(MouseEvent.MOUSE_MOVE, onDraw, false);
Main.instance.removeEventListener(MouseEvent.MOUSE_UP, stopDraw, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_PAUSE, pause, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_RESUME, resume, false);
if (mcRef != null){
mcRef.parent.removeChild(mcRef);
mcRef = null;
};
}
private function setPosition(_arg1:String):void{
var _local2:Number;
var _local3:Number;
switch (_arg1){
case "roll":
_local2 = Layout.RollGame.x;
_local3 = Layout.RollGame.y;
break;
case "spread":
_local2 = Layout.SpreadGame.x;
_local3 = Layout.SpreadGame.y;
break;
case "pour":
_local2 = Layout.PourGame.x;
_local3 = Layout.PourGame.y;
break;
};
mcRef.x = _local2;
mcRef.y = _local3;
}
public function state_idle_init():void{
Main.instance.addEventListener(MouseEvent.MOUSE_DOWN, startDraw, false, 0, true);
}
private function getLength():Number{
var _local1:Number;
var _local2:int;
_local1 = 0;
_local2 = 1;
while (_local2 < aSequence.length) {
_local1 = (_local1 + MoreMath.getDistance({x:aSequence[(_local2 - 1)].x, y:aSequence[(_local2 - 1)].y}, {x:aSequence[_local2].x, y:aSequence[_local2].y}));
_local2++;
};
return (_local1);
}
private function throwPositive(_arg1:Number):void{
Main.instance.gameManager.dispatchEvent(new SequenceEvent(SequenceEvent.POSITIVE, Layout.MatPlaceHolder, _arg1));
}
}
}//package gameplay.games
Section 19
//GoPopup (gameplay.hud.GoPopup)
package gameplay.hud {
import flash.events.*;
import flash.display.*;
import library.events.*;
import library.basic.*;
import library.interfaces.*;
public class GoPopup extends StateManaged implements Idestroyable {
public static const sSTATE_IDLE:String = "idle";
public static const sSTATE_SHOW:String = "show";
public function GoPopup(_arg1:MovieClip):void{
super(_arg1);
addState(sSTATE_IDLE, state_idle);
addState(sSTATE_SHOW, state_show);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, resume, false, 0, true);
setState(sSTATE_IDLE);
}
public function state_idle():void{
}
public function show():void{
setState(sSTATE_SHOW);
}
public function state_show():void{
if (stateComplete){
setState(sSTATE_IDLE);
};
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_PAUSE, pause, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_RESUME, resume, false);
mcRef = null;
}
}
}//package gameplay.hud
Section 20
//Hud (gameplay.hud.Hud)
package gameplay.hud {
import library.sounds.*;
import flash.events.*;
import flash.display.*;
import gameplay.*;
import library.interfaces.*;
public class Hud implements Idestroyable {
private var oScore:ScoreManagement;
private var oLife:Life;
private var oGoPopup:GoPopup;
private var oTime:Time;
public var mcRef:MovieClip;
public function Hud(_arg1:MovieClip):void{
mcRef = _arg1;
oLife = new Life(mcRef, mcRef.mcLife);
oTime = new Time(mcRef.mcTime);
oGoPopup = new GoPopup(mcRef.mcGoPopup);
oScore = new ScoreManagement(mcRef.mcScore);
oTime.addTime(60);
mcRef.btnMenu.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
mcRef.btnMenu.addEventListener(MouseEvent.ROLL_OVER, onRollOver, false, 0, true);
}
public function showGo():void{
oGoPopup.show();
}
public function onClick(_arg1:MouseEvent):void{
switch (_arg1.target){
case mcRef.btnMenu:
Main.instance.addPopup(Main.sPOPUP_MENU);
Main.instance.pauseGame();
break;
};
SoundEngine.Play(Main.sSOUND_UI, SoundList.sSOUND_CLICK, 1, true, false, true);
}
public function onRollOver(_arg1:MouseEvent):void{
switch (_arg1.target){
default:
SoundEngine.Play(Main.sSOUND_UI, SoundList.sSOUND_ROLLOVER, 1, true, false, true);
break;
};
}
public function destroy(_arg1:Event):void{
mcRef.btnMenu.removeEventListener(MouseEvent.CLICK, onClick, false);
mcRef.btnMenu.removeEventListener(MouseEvent.ROLL_OVER, onRollOver, false);
mcRef = null;
}
}
}//package gameplay.hud
Section 21
//Life (gameplay.hud.Life)
package gameplay.hud {
import flash.events.*;
import flash.display.*;
import library.events.*;
import library.utils.*;
import gameplay.*;
import library.interfaces.*;
import library.easing.*;
import flash.filters.*;
public class Life implements Idestroyable {
private var bToScore:Boolean;
private var oLifeAdd:LifePlusLess;
private var nTime:int;
private var bBonus:Boolean;
private var mcParent:MovieClip;
private var mcRef:MovieClip;
private var nFrame:int;
private var oLifeRemove:LifePlusLess;
private static var oInstance:Life;
public function Life(_arg1:MovieClip, _arg2:MovieClip):void{
var _local3:DropShadowFilter;
super();
mcRef = _arg2;
mcParent = _arg1;
bToScore = false;
oInstance = this;
_local3 = new DropShadowFilter(1, 89.9993809572637, 0, 1, 4, 4, 0.6484375, 1, false, false, false);
mcRef.filters = new Array(_local3);
oLifeAdd = new LifePlusLess(mcParent.mcTimeAdd, "+");
oLifeRemove = new LifePlusLess(mcParent.mcTimeRemove, "-");
Animate.to(mcRef, 35, {delay:35, scaleX:1});
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
}
public function update(_arg1:Event):void{
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
mcRef = null;
oLifeAdd = null;
oLifeRemove = null;
}
public function sendLifeToScore():void{
var _local1:Number;
var _local2:Number;
Animate.killTweensOf(mcRef);
bToScore = true;
_local1 = ((Math.round((Config.Scoring.Recipe.Score * mcRef.scaleX)) + (bBonus) ? Config.Scoring.Bonus.Score : 0) / 35);
_local2 = (Math.round(((nFrame * mcRef.scaleX) / 35)) + (bBonus) ? Config.Scoring.Bonus.Time : 0);
_local2 = ((_local2 < Config.Scoring.Recipe.Time)) ? Config.Scoring.Recipe.Time : _local2;
bBonus = false;
if (!Main.instance.gameManager.bGood){
_local2 = (_local2 / 2);
_local1 = (_local1 / 2);
};
ScoreManagement.instance.addScore(_local1);
Time.instance.addTime(_local2);
}
public function bonus():void{
bBonus = true;
}
public function setLifeSpan(_arg1:int):void{
if (_arg1 < 25){
_arg1 = 25;
};
nTime = (_arg1 * 35);
nFrame = nTime;
bToScore = false;
Animate.killTweensOf(mcRef);
Animate.to(mcRef, 10, {delay:0, scaleX:1, onComplete:Animate.to, onCompleteScope:Animate, onCompleteParams:[mcRef, nTime, {delay:5, scaleX:0, onComplete:endLife, onCompleteScope:this, onCompleteParams:null, ease:Linear.easeNone}]});
}
public function remLife(_arg1:int):void{
oLifeRemove.showPoints(_arg1);
nFrame = (nTime * mcRef.scaleX);
nFrame = (nFrame - (_arg1 * 35));
nFrame = ((nFrame < 0)) ? 0 : nFrame;
bToScore = false;
Animate.killTweensOf(mcRef);
Animate.to(mcRef, 10, {scaleX:Math.min(1, (nFrame / nTime)), onComplete:Animate.to, onCompleteScope:Animate, onCompleteParams:[mcRef, nFrame, {scaleX:0, onComplete:endLife, onCompleteScope:this, onCompleteParams:null, ease:Linear.easeNone}]});
}
public function endLife():void{
Main.instance.gameManager.instruction.failed();
}
public function addLife(_arg1:int):void{
oLifeAdd.showPoints(_arg1);
nFrame = (nTime * mcRef.scaleX);
nFrame = (nFrame + (_arg1 * 35));
bToScore = false;
Animate.killTweensOf(mcRef);
Animate.to(mcRef, 10, {scaleX:Math.min(1, (nFrame / nTime)), onComplete:Animate.to, onCompleteScope:Animate, onCompleteParams:[mcRef, nFrame, {scaleX:0, onComplete:endLife, onCompleteScope:this, onCompleteParams:null, ease:Linear.easeNone}]});
}
public static function get instance():Life{
return (oInstance);
}
}
}//package gameplay.hud
Section 22
//LifePlusLess (gameplay.hud.LifePlusLess)
package gameplay.hud {
import flash.events.*;
import flash.display.*;
import library.events.*;
import library.basic.*;
import library.interfaces.*;
public class LifePlusLess extends StateManaged implements Idestroyable {
private var sSign:String;
private var nPoints:Number;
public static const sSTATE_IDLE:String = "idle";
public static const sSTATE_SHOW:String = "show";
public function LifePlusLess(_arg1:MovieClip, _arg2:String):void{
super(_arg1);
nPoints = 0;
sSign = _arg2;
addState(sSTATE_IDLE, state_idle);
addState(sSTATE_SHOW, state_show, initPoints);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, resume, false, 0, true);
setState(sSTATE_IDLE);
}
public function showPoints(_arg1:Number):void{
nPoints = _arg1;
setState(sSTATE_SHOW);
}
public function state_idle():void{
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_PAUSE, pause, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_RESUME, resume, false);
mcRef = null;
}
private function initPoints():void{
mcState.mcText.txtPointsFront.text = (sSign + nPoints);
mcState.mcText.txtPoints.text = (sSign + nPoints);
}
public function state_show():void{
if (stateComplete){
setState(sSTATE_IDLE);
};
}
}
}//package gameplay.hud
Section 23
//Time (gameplay.hud.Time)
package gameplay.hud {
import flash.events.*;
import flash.display.*;
import library.events.*;
import library.utils.*;
import library.interfaces.*;
import library.easing.*;
import flash.text.*;
public class Time implements Idestroyable {
private var txtTime:TextField;
private var iTime:int;
public var mcRef:MovieClip;
private static var oInstance:Time;
public function Time(_arg1:MovieClip):void{
mcRef = _arg1;
txtTime = mcRef.txtTime;
oInstance = this;
iTime = 0;
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
}
public function remTime(_arg1:int):void{
Animate.to(mcRef, 35, {onUpdate:toTime, onUpdateScope:this, onUpdateParams:[-(_arg1)], ease:Linear.easeNone});
}
public function toTime(_arg1:int):void{
iTime = (iTime + _arg1);
if (iTime < 0){
iTime = 0;
};
}
public function update(_arg1:Event):void{
if (!Main.instance.gameManager.tutorial){
if (iTime > 0){
iTime--;
} else {
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.dispatchEvent(new GameEvent(GameEvent.EVENT_LOSE, false, false));
};
};
displayTime();
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
txtTime = null;
mcRef = null;
}
public function addTime(_arg1:Number):void{
_arg1 = Math.round(_arg1);
Animate.to(mcRef, 35, {onUpdate:toTime, onUpdateScope:this, onUpdateParams:[_arg1], ease:Linear.easeNone});
}
private function displayTime():void{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:String;
var _local5:String;
_local1 = Math.floor((iTime / 35));
_local2 = Math.floor((_local1 / 60));
_local3 = (_local1 - (_local2 * 60));
_local4 = _local2.toString();
_local5 = _local3.toString();
if (_local2 < 10){
_local4 = ("0" + _local4);
};
if (_local3 < 10){
_local5 = ("0" + _local5);
};
txtTime.text = ((_local4 + ":") + _local5);
}
public static function get instance():Time{
return (oInstance);
}
}
}//package gameplay.hud
Section 24
//Algae (gameplay.ingredients.basics.Algae)
package gameplay.ingredients.basics {
import flash.events.*;
import flash.display.*;
import library.events.*;
import gameplay.tutorial.*;
import gameplay.special.*;
import library.basic.*;
import library.interfaces.*;
import gameplay.layout.*;
import flash.filters.*;
public class Algae extends StateManaged implements Idestroyable {
private var sType:String;
private var iSlot:int;
private var bPlaced:Boolean;
public static const sSTATE_PLATE_DEL:String = "plate_del";
public static const sSTATE_PLATE_OUT:String = "plate_out";
public static const sSTATE_OPEN_DEL:String = "open_del";
public static const sSTATE_OPEN_IDLE:String = "open_idle";
public static const sSTATE_OPENED:String = "opened";
public static const sSTATE_PLATE_IN:String = "plate_in";
public static const sSTATE_OPENED_DEL:String = "opened_del";
public static const sSTATE_OPEN_IN:String = "open_in";
public static const sSTATE_OPEN_OUT:String = "open_out";
public static const sSTATE_PLATE_IDLE:String = "plate_idle";
public function Algae(_arg1:MovieClip, _arg2:Object, _arg3:String=null, _arg4:Boolean=false):void{
super(_arg1);
iSlot = _arg2.slot;
sType = "algae";
bPlaced = false;
mcRef.x = _arg2.x;
mcRef.y = _arg2.y;
mcRef.scaleX = (mcRef.scaleY = _arg2.scale);
addState(sSTATE_OPEN_IDLE, null, state_open_idle_init);
addState(sSTATE_OPEN_IN, state_open_in);
addState(sSTATE_OPEN_OUT, state_open_out);
addState(sSTATE_OPENED, null, state_opened_init);
addState(sSTATE_PLATE_DEL, state_plate_del);
addState(sSTATE_PLATE_IDLE, null);
addState(sSTATE_PLATE_IN, state_plate_in);
addState(sSTATE_PLATE_OUT, state_plate_out);
addState(sSTATE_OPEN_DEL, state_plate_del);
addState(sSTATE_OPENED_DEL, state_plate_del);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, resume, false, 0, true);
mcRef.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
mcRef.addEventListener(MouseEvent.MOUSE_OVER, onOver, false, 0, true);
mcRef.addEventListener(MouseEvent.MOUSE_OUT, onOut, false, 0, true);
if (_arg3 != null){
setState(_arg3);
mcRef.mouseChildren = false;
mcRef.mouseEnabled = false;
} else {
setState(sSTATE_PLATE_IN);
};
}
public function get type():String{
return (sType);
}
public function spread(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_CUT, spread, false);
setState(sSTATE_OPEN_OUT);
}
public function get placed():Boolean{
return (bPlaced);
}
public function onClick(_arg1:MouseEvent):void{
if (((Main.instance.gameManager.instruction.authorize(sType)) && ((((((_arg1 == null)) && (Main.instance.gameManager.special.active))) || (((!((_arg1 == null))) && (!(Main.instance.gameManager.special.active)))))))){
if ((((state == sSTATE_PLATE_IDLE)) && ((Main.instance.gameManager.selectedIngredient == null)))){
Main.instance.gameManager.selectedIngredient = this;
Main.instance.gameManager.started = true;
Main.instance.gameManager.dispatchEvent(new TutEvent(TutEvent.sEVENT_CLICK, mcRef));
Main.instance.gameManager.dispatchEvent(new Event(Special.WORKING));
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
setState(sSTATE_PLATE_OUT);
};
};
onOut(null);
}
public function state_open_in():void{
if (stateComplete){
setState(sSTATE_OPEN_IDLE);
};
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_CUT, spread, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY_INGREDIENTS, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_PAUSE, pause, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_RESUME, resume, false);
if (mcRef != null){
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
mcRef.removeEventListener(MouseEvent.MOUSE_OVER, onOver, false);
mcRef.removeEventListener(MouseEvent.MOUSE_OUT, onOut, false);
if (((!((mcRef == null))) && (!((mcRef.parent.getChildByName(mcRef.name) == null))))){
mcRef.parent.removeChild(mcRef);
mcRef = null;
};
};
}
public function onOver(_arg1:MouseEvent):void{
var _local2:Function;
var _local3:GlowFilter;
_local2 = Main.instance.gameManager.instruction.authorize;
if (((((((_local2(sType)) && (!((mcRef.getChildByName("mcState") == null))))) && (!(Main.instance.gameManager.tutorial)))) && (!(Main.instance.gameManager.special.active)))){
_local3 = new GlowFilter(0, 1, 4, 4, 10);
mcState.filters = new Array(_local3);
};
}
public function state_open_idle_init():void{
Main.instance.gameManager.addEventListener(GameEvent.EVENT_CUT, spread, false, 0, true);
if (Main.instance.gameManager.special.active){
Main.instance.gameManager.dispatchEvent(new SequenceEvent(SequenceEvent.POSITIVE, Layout.MatPlaceHolder, 1));
} else {
Main.instance.gameManager.startMiniGame(toString());
};
}
public function state_plate_in():void{
if (stateComplete){
setState(sSTATE_PLATE_IDLE);
};
}
public function state_open_out():void{
if (stateComplete){
setState(sSTATE_OPENED);
};
}
public function toString():String{
return ("Algae");
}
public function onOut(_arg1:MouseEvent):void{
if (((((!((mcRef.getChildByName("mcState") == null))) && (!(Main.instance.gameManager.tutorial)))) && (!(Main.instance.gameManager.special.active)))){
mcState.filters = new Array();
};
}
public function state_plate_out():void{
if (stateComplete){
Main.instance.gameManager.addPlate(iSlot);
Main.instance.gameManager.addToPlaceHolder(this, sSTATE_OPEN_IN, Algae, new mcAlgae(), Layout.MatPlaceHolder, sSTATE_OPEN_IN);
destroy(null);
};
}
public function state_opened_init():void{
Main.instance.gameManager.dispatchEvent(new IngredientEvent(IngredientEvent.EVENT_DONE, sType));
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY_INGREDIENTS, destroy, false, 0, true);
Main.instance.gameManager.dispatchEvent(new Event(Special.NEXT));
Main.instance.gameManager.clearCurrent();
}
public function state_plate_del():void{
if (stateComplete){
destroy(null);
};
}
public function deleteIt():void{
if (mcRef != null){
switch (state){
case sSTATE_OPEN_IDLE:
case sSTATE_OPEN_IN:
case sSTATE_OPEN_OUT:
setState(sSTATE_OPEN_DEL);
break;
case sSTATE_OPENED:
setState(sSTATE_OPENED_DEL);
break;
case sSTATE_PLATE_IDLE:
case sSTATE_PLATE_IN:
case sSTATE_PLATE_OUT:
setState(sSTATE_PLATE_DEL);
break;
};
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
} else {
destroy(null);
};
}
}
}//package gameplay.ingredients.basics
Section 25
//Rice (gameplay.ingredients.basics.Rice)
package gameplay.ingredients.basics {
import flash.events.*;
import flash.display.*;
import library.events.*;
import gameplay.tutorial.*;
import gameplay.special.*;
import library.basic.*;
import library.interfaces.*;
import gameplay.layout.*;
import flash.filters.*;
public class Rice extends StateManaged implements Idestroyable {
private var sType:String;
private var iSlot:int;
private var bPlaced:Boolean;
public static const sSTATE_PLATE_DEL:String = "plate_del";
public static const sSTATE_SPREAD_OUT:String = "spread_out";
public static const sSTATE_PLATE_OUT:String = "plate_out";
public static const sSTATE_PLATE_IDLE:String = "plate_idle";
public static const sSTATE_SPREAD_DEL:String = "spread_del";
public static const sSTATE_SPREADED_DEL:String = "spreaded_del";
public static const sSTATE_PLATE_IN:String = "plate_in";
public static const sSTATE_SPREAD_IN:String = "spread_in";
public static const sSTATE_SPREADED:String = "spreaded";
public static const sSTATE_SPREAD_IDLE:String = "spread_idle";
public function Rice(_arg1:MovieClip, _arg2:Object, _arg3:String=null, _arg4:Boolean=false):void{
super(_arg1);
iSlot = _arg2.slot;
sType = "rice";
bPlaced = false;
mcRef.x = _arg2.x;
mcRef.y = _arg2.y;
mcRef.scaleX = (mcRef.scaleY = _arg2.scale);
addState(sSTATE_PLATE_DEL, state_plate_del);
addState(sSTATE_PLATE_IDLE, null);
addState(sSTATE_PLATE_IN, state_plate_in);
addState(sSTATE_PLATE_OUT, state_plate_out);
addState(sSTATE_SPREAD_IDLE, null, state_spread_idle_init);
addState(sSTATE_SPREAD_IN, state_spread_in);
addState(sSTATE_SPREAD_OUT, state_spread_out);
addState(sSTATE_SPREADED, null, state_spreaded_init);
addState(sSTATE_SPREAD_DEL, state_del);
addState(sSTATE_SPREADED_DEL, state_del);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, resume, false, 0, true);
mcRef.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
mcRef.addEventListener(MouseEvent.MOUSE_OVER, onOver, false, 0, true);
mcRef.addEventListener(MouseEvent.MOUSE_OUT, onOut, false, 0, true);
if (_arg3 != null){
setState(_arg3);
mcRef.mouseChildren = false;
mcRef.mouseEnabled = false;
} else {
setState(sSTATE_PLATE_IN);
};
}
public function get type():String{
return (sType);
}
public function spread(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_CUT, spread, false);
setState(sSTATE_SPREAD_OUT);
}
public function state_spread_in():void{
if (stateComplete){
setState(sSTATE_SPREAD_IDLE);
};
}
public function get placed():Boolean{
return (bPlaced);
}
public function deleteIt():void{
if (mcRef != null){
switch (state){
case sSTATE_SPREAD_IDLE:
case sSTATE_SPREAD_IN:
case sSTATE_SPREAD_OUT:
setState(sSTATE_SPREAD_DEL);
break;
case sSTATE_SPREADED:
setState(sSTATE_SPREADED_DEL);
break;
case sSTATE_PLATE_IDLE:
case sSTATE_PLATE_IN:
case sSTATE_PLATE_OUT:
setState(sSTATE_PLATE_DEL);
break;
};
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
} else {
destroy(null);
};
}
public function state_spread_out():void{
if (stateComplete){
setState(sSTATE_SPREADED);
};
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY_INGREDIENTS, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_PAUSE, pause, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_RESUME, resume, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_CUT, spread, false);
if (mcRef != null){
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
mcRef.removeEventListener(MouseEvent.MOUSE_OVER, onOver, false);
mcRef.removeEventListener(MouseEvent.MOUSE_OUT, onOut, false);
if (((!((mcRef == null))) && (!((mcRef.parent.getChildByName(mcRef.name) == null))))){
mcRef.parent.removeChild(mcRef);
mcRef = null;
};
};
}
public function onOver(_arg1:MouseEvent):void{
var _local2:Function;
var _local3:GlowFilter;
_local2 = Main.instance.gameManager.instruction.authorize;
if (((((((_local2(sType)) && (!((mcRef.getChildByName("mcState") == null))))) && (!(Main.instance.gameManager.tutorial)))) && (!(Main.instance.gameManager.special.active)))){
_local3 = new GlowFilter(0, 1, 2, 2, 8);
mcState.filters = new Array(_local3);
};
}
public function state_plate_in():void{
if (stateComplete){
setState(sSTATE_PLATE_IDLE);
};
}
public function state_del():void{
if (stateComplete){
destroy(null);
};
}
public function onOut(_arg1:MouseEvent):void{
if (((((!((mcRef.getChildByName("mcState") == null))) && (!(Main.instance.gameManager.tutorial)))) && (!(Main.instance.gameManager.special.active)))){
mcState.filters = new Array();
};
}
public function onClick(_arg1:MouseEvent):void{
if (((Main.instance.gameManager.instruction.authorize(sType)) && (((((!((_arg1 == null))) && (!(Main.instance.gameManager.special.active)))) || ((((_arg1 == null)) && (Main.instance.gameManager.special.active))))))){
if ((((state == sSTATE_PLATE_IDLE)) && ((Main.instance.gameManager.selectedIngredient == null)))){
Main.instance.gameManager.selectedIngredient = this;
Main.instance.gameManager.started = true;
Main.instance.gameManager.dispatchEvent(new TutEvent(TutEvent.sEVENT_CLICK, mcRef));
Main.instance.gameManager.dispatchEvent(new Event(Special.WORKING));
setState(sSTATE_PLATE_OUT);
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
};
};
onOut(null);
}
public function toString():String{
return ("Rice");
}
public function state_spreaded_init():void{
Main.instance.gameManager.dispatchEvent(new IngredientEvent(IngredientEvent.EVENT_DONE, sType));
Main.instance.gameManager.dispatchEvent(new Event(Special.NEXT));
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY_INGREDIENTS, destroy, false, 0, true);
Main.instance.gameManager.clearCurrent();
}
public function state_plate_out():void{
if (stateComplete){
Main.instance.gameManager.addPlate(iSlot);
Main.instance.gameManager.addToPlaceHolder(this, sSTATE_SPREAD_IN, Rice, new mcRice(), Layout.MatPlaceHolder, sSTATE_SPREAD_IN);
destroy(null);
};
}
public function state_plate_del():void{
if (stateComplete){
destroy(null);
};
}
public function state_spread_idle_init():void{
Main.instance.gameManager.addEventListener(GameEvent.EVENT_CUT, spread, false, 0, true);
if (Main.instance.gameManager.special.active){
Main.instance.gameManager.dispatchEvent(new SequenceEvent(SequenceEvent.POSITIVE, Layout.MatPlaceHolder, 1));
} else {
Main.instance.gameManager.startMiniGame(toString());
};
}
}
}//package gameplay.ingredients.basics
Section 26
//Chicken (gameplay.ingredients.fillings.Chicken)
package gameplay.ingredients.fillings {
import library.sounds.*;
import flash.events.*;
import flash.display.*;
import library.events.*;
import gameplay.tutorial.*;
import gameplay.special.*;
import library.basic.*;
import library.interfaces.*;
import gameplay.layout.*;
import flash.filters.*;
public class Chicken extends StateManaged implements Idestroyable {
private var iSlot:int;
private var bPlaced:Boolean;
private var bPrepared:Boolean;
private var sType:String;
public static const sSTATE_CUTTED_OUT:String = "cutted_out";
public static const sSTATE_PLATE_OUT:String = "plate_out";
public static const sSTATE_CUTTED_DEL:String = "cutted_del";
public static const sSTATE_PLATE_CUT_IN:String = "plate_cut_in";
public static const sSTATE_PLATE_IN:String = "plate_in";
public static const sSTATE_PLATE_DEL:String = "plate_del";
public static const sSTATE_CUT_IDLE:String = "cut_idle";
public static const sSTATE_SUSHI_IN:String = "sushi_in";
public static const sSTATE_SUSHI_IDLE:String = "sushi_idle";
public static const sSTATE_CUTTED_IDLE:String = "cutted_idle";
public static const sSTATE_CUT_IN:String = "cut_in";
public static const sSTATE_PLATE_CUT_OUT:String = "plate_cut_out";
public static const sSTATE_CUT_DEL:String = "cut_del";
public static const sSTATE_CUT_OUT:String = "cut_out";
public static const sSTATE_CUTTED_IN:String = "cutted_in";
public static const sSTATE_PLATE_CUT_DEL:String = "plate_cut_del";
public static const sSTATE_NONE:String = "none";
public static const sSTATE_PLATE_CUT_IDLE:String = "plate_cut_idle";
public static const sSTATE_SUSHI_DEL:String = "sushi_del";
public static const sSTATE_PLATE_IDLE:String = "plate_idle";
public function Chicken(_arg1:MovieClip, _arg2:Object, _arg3:String=null, _arg4:Boolean=false):void{
super(_arg1);
iSlot = _arg2.slot;
sType = "filling";
bPlaced = false;
bPrepared = false;
mcRef.x = _arg2.x;
mcRef.y = _arg2.y;
mcRef.scaleX = (mcRef.scaleY = _arg2.scale);
addState(sSTATE_CUT_IDLE, null, state_cut_idle_init);
addState(sSTATE_CUT_IN, state_cut_in);
addState(sSTATE_CUT_OUT, state_cut_out);
addState(sSTATE_CUTTED_IDLE, null, state_cutted_idle_init);
addState(sSTATE_CUTTED_IN, state_cutted_in);
addState(sSTATE_CUTTED_OUT, state_cutted_out);
addState(sSTATE_NONE, null);
addState(sSTATE_PLATE_CUT_DEL, state_plate_cut_del);
addState(sSTATE_PLATE_CUT_IDLE, null, state_plate_cut_idle);
addState(sSTATE_PLATE_CUT_IN, state_plate_cut_in);
addState(sSTATE_PLATE_CUT_OUT, state_plate_cut_out);
addState(sSTATE_PLATE_DEL, state_plate_del);
addState(sSTATE_PLATE_IDLE, null);
addState(sSTATE_PLATE_IN, state_plate_in);
addState(sSTATE_PLATE_OUT, state_plate_out);
addState(sSTATE_SUSHI_IDLE, null, state_sushi_idle_init);
addState(sSTATE_SUSHI_IN, state_sushi_in);
addState(sSTATE_CUT_DEL, state_del);
addState(sSTATE_CUTTED_DEL, state_del);
addState(sSTATE_SUSHI_DEL, state_del);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, resume, false, 0, true);
if (_arg3 != null){
setState(_arg3);
} else {
setState(sSTATE_PLATE_IN);
};
if (state == sSTATE_CUT_IN){
Main.instance.gameManager.addEventListener(GameEvent.EVENT_CUT, cut, false, 0, true);
} else {
if ((((state == sSTATE_PLATE_IN)) || ((state == sSTATE_PLATE_CUT_IN)))){
mcRef.addEventListener(MouseEvent.MOUSE_OVER, onOver, false, 0, true);
mcRef.addEventListener(MouseEvent.MOUSE_OUT, onOut, false, 0, true);
mcRef.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
};
};
if ((((state == sSTATE_CUTTED_IN)) || ((state == sSTATE_SUSHI_IN)))){
mcRef.mouseChildren = false;
mcRef.mouseEnabled = false;
};
}
public function state_sushi_idle_init():void{
Main.instance.gameManager.dispatchEvent(new IngredientEvent(IngredientEvent.EVENT_DONE, sType, true));
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY_INGREDIENTS, destroy, false, 0, true);
Main.instance.gameManager.dispatchEvent(new Event(Special.NEXT));
Main.instance.gameManager.clearCurrent();
}
public function state_plate_cut_out():void{
var _local1:Object;
if (stateComplete){
_local1 = Layout.MatPlaceHolder;
_local1.slot = iSlot;
Main.instance.gameManager.addPlate(iSlot);
Main.instance.gameManager.addToPlaceHolder(this, sSTATE_SUSHI_IN, Chicken, new mcChicken(), _local1, sSTATE_SUSHI_IN);
destroy(null);
};
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY_INGREDIENTS, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_PAUSE, pause, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_RESUME, resume, false);
if (mcRef != null){
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
mcRef.removeEventListener(MouseEvent.MOUSE_OVER, onOver, false);
mcRef.removeEventListener(MouseEvent.MOUSE_OUT, onOut, false);
if (((!((mcRef == null))) && (!((mcRef.parent.getChildByName(mcRef.name) == null))))){
mcRef.parent.removeChild(mcRef);
mcRef = null;
};
};
}
public function state_cutted_out():void{
if (stateComplete){
Main.instance.gameManager.returnToIngredient(new mcChicken(), Chicken, iSlot);
destroy(null);
};
}
public function state_cut_out():void{
if (stateComplete){
setState(sSTATE_CUTTED_IN);
};
}
public function state_plate_cut_idle():void{
bPrepared = true;
Main.instance.gameManager.dispatchEvent(new Event(Special.NEXT));
}
public function state_cut_in():void{
if (stateComplete){
setState(sSTATE_CUT_IDLE);
};
}
public function state_plate_del():void{
if (stateComplete){
destroy(null);
};
}
public function deleteIt():void{
if (mcRef != null){
switch (state){
case sSTATE_CUT_IN:
case sSTATE_CUT_IDLE:
case sSTATE_CUT_OUT:
setState(sSTATE_CUT_DEL);
break;
case sSTATE_CUTTED_IN:
case sSTATE_CUTTED_IDLE:
case sSTATE_CUTTED_OUT:
setState(sSTATE_CUTTED_DEL);
break;
case sSTATE_PLATE_IN:
case sSTATE_PLATE_IDLE:
case sSTATE_PLATE_OUT:
setState(sSTATE_PLATE_DEL);
break;
case sSTATE_PLATE_CUT_IN:
case sSTATE_PLATE_CUT_IDLE:
case sSTATE_PLATE_CUT_OUT:
setState(sSTATE_PLATE_CUT_DEL);
break;
case sSTATE_SUSHI_IN:
case sSTATE_SUSHI_IDLE:
setState(sSTATE_SUSHI_DEL);
break;
};
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
} else {
destroy(null);
};
}
public function state_plate_cut_del():void{
if (stateComplete){
destroy(null);
};
}
public function get placed():Boolean{
return (bPlaced);
}
public function get type():String{
return (sType);
}
public function cut(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_CUT, cut, false);
SoundEngine.Play(Main.sSOUND_SFX, SoundList.sSOUND_KNIFE_CUT_MEAT);
setState(sSTATE_CUT_OUT);
}
public function get prepared():Boolean{
return (bPrepared);
}
public function state_cut_idle_init():void{
if (Main.instance.gameManager.special.active){
Main.instance.gameManager.dispatchEvent(new SequenceEvent(SequenceEvent.POSITIVE, Layout.BoardPlaceHolder, 1));
} else {
Main.instance.gameManager.startMiniGame(toString());
};
}
public function onOver(_arg1:MouseEvent):void{
var _local2:Function;
var _local3:GlowFilter;
_local2 = Main.instance.gameManager.instruction.authorize;
if (((((((_local2(sType, ((state == sSTATE_PLATE_CUT_IDLE)) ? true : false)) && (!((mcRef.getChildByName("mcState") == null))))) && (!(Main.instance.gameManager.tutorial)))) && (!(Main.instance.gameManager.special.active)))){
_local3 = new GlowFilter(0, 1, 2, 2, 8);
mcState.filters = new Array(_local3);
};
}
public function state_cutted_idle_init():void{
setState(sSTATE_CUTTED_OUT);
Main.instance.gameManager.dispatchEvent(new IngredientEvent(IngredientEvent.EVENT_DONE, sType));
}
public function state_del():void{
if (stateComplete){
destroy(null);
};
}
public function state_sushi_in():void{
if (stateComplete){
setState(sSTATE_SUSHI_IDLE);
};
}
public function state_plate_in():void{
if (stateComplete){
setState(sSTATE_PLATE_IDLE);
};
}
public function state_cutted_in():void{
if (stateComplete){
setState(sSTATE_CUTTED_IDLE);
};
}
public function onClick(_arg1:MouseEvent):void{
if ((((((((state == sSTATE_PLATE_IDLE)) && ((Main.instance.gameManager.selectedIngredient == null)))) && (Main.instance.gameManager.instruction.authorize(sType)))) && (((((!((_arg1 == null))) && (!(Main.instance.gameManager.special.active)))) || ((((_arg1 == null)) && (Main.instance.gameManager.special.active))))))){
Main.instance.gameManager.selectedIngredient = this;
Main.instance.gameManager.started = true;
setState(sSTATE_PLATE_OUT);
Main.instance.gameManager.dispatchEvent(new TutEvent(TutEvent.sEVENT_CLICK, mcRef));
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
Main.instance.gameManager.dispatchEvent(new Event(Special.WORKING));
Main.instance.gameManager.dispatchEvent(new Event(GameEvent.EVENT_ON_CUTBOARD));
} else {
if ((((((((state == sSTATE_PLATE_CUT_IDLE)) && ((Main.instance.gameManager.selectedIngredient == null)))) && (Main.instance.gameManager.instruction.authorize(sType, true)))) && (((((!((_arg1 == null))) && (!(Main.instance.gameManager.special.active)))) || ((((_arg1 == null)) && (Main.instance.gameManager.special.active))))))){
Main.instance.gameManager.selectedIngredient = this;
Main.instance.gameManager.started = true;
setState(sSTATE_PLATE_CUT_OUT);
Main.instance.gameManager.dispatchEvent(new TutEvent(TutEvent.sEVENT_CLICK, mcRef));
Main.instance.gameManager.dispatchEvent(new Event(Special.WORKING));
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
};
};
onOut(null);
}
public function toString():String{
return ("Chicken");
}
public function onOut(_arg1:MouseEvent):void{
if (((((!((mcRef.getChildByName("mcState") == null))) && (!(Main.instance.gameManager.tutorial)))) && (!(Main.instance.gameManager.special.active)))){
mcState.filters = new Array();
};
}
public function state_plate_out():void{
var _local1:Object;
if (stateComplete){
_local1 = Layout.BoardPlaceHolder;
_local1.slot = iSlot;
Main.instance.gameManager.addPlate(iSlot);
Main.instance.gameManager.addToPlaceHolder(this, sSTATE_PLATE_CUT_IN, Chicken, new mcChicken(), _local1, sSTATE_CUT_IN);
destroy(null);
};
}
public function state_plate_cut_in():void{
if (stateComplete){
setState(sSTATE_PLATE_CUT_IDLE);
};
}
}
}//package gameplay.ingredients.fillings
Section 27
//Egg (gameplay.ingredients.fillings.Egg)
package gameplay.ingredients.fillings {
import library.sounds.*;
import flash.events.*;
import flash.display.*;
import library.events.*;
import gameplay.tutorial.*;
import gameplay.special.*;
import library.basic.*;
import library.interfaces.*;
import gameplay.layout.*;
import flash.filters.*;
public class Egg extends StateManaged implements Idestroyable {
private var iSlot:int;
private var bPlaced:Boolean;
private var bPrepared:Boolean;
private var sType:String;
public static const sSTATE_CUTTED_OUT:String = "cutted_out";
public static const sSTATE_PLATE_OUT:String = "plate_out";
public static const sSTATE_CUTTED_DEL:String = "cutted_del";
public static const sSTATE_PLATE_CUT_IN:String = "plate_cut_in";
public static const sSTATE_PLATE_IN:String = "plate_in";
public static const sSTATE_PLATE_DEL:String = "plate_del";
public static const sSTATE_CUT_IDLE:String = "cut_idle";
public static const sSTATE_SUSHI_IN:String = "sushi_in";
public static const sSTATE_SUSHI_IDLE:String = "sushi_idle";
public static const sSTATE_CUTTED_IDLE:String = "cutted_idle";
public static const sSTATE_CUT_IN:String = "cut_in";
public static const sSTATE_PLATE_CUT_OUT:String = "plate_cut_out";
public static const sSTATE_CUT_DEL:String = "cut_del";
public static const sSTATE_CUT_OUT:String = "cut_out";
public static const sSTATE_CUTTED_IN:String = "cutted_in";
public static const sSTATE_PLATE_CUT_DEL:String = "plate_cut_del";
public static const sSTATE_NONE:String = "none";
public static const sSTATE_PLATE_CUT_IDLE:String = "plate_cut_idle";
public static const sSTATE_SUSHI_DEL:String = "sushi_del";
public static const sSTATE_PLATE_IDLE:String = "plate_idle";
public function Egg(_arg1:MovieClip, _arg2:Object, _arg3:String=null, _arg4:Boolean=false):void{
super(_arg1);
iSlot = _arg2.slot;
sType = "filling";
bPlaced = false;
bPrepared = false;
mcRef.x = _arg2.x;
mcRef.y = _arg2.y;
mcRef.scaleX = (mcRef.scaleY = _arg2.scale);
addState(sSTATE_CUT_IDLE, null, state_cut_idle_init);
addState(sSTATE_CUT_IN, state_cut_in);
addState(sSTATE_CUT_OUT, state_cut_out);
addState(sSTATE_CUTTED_IDLE, null, state_cutted_idle_init);
addState(sSTATE_CUTTED_IN, state_cutted_in);
addState(sSTATE_CUTTED_OUT, state_cutted_out);
addState(sSTATE_NONE, null);
addState(sSTATE_PLATE_CUT_DEL, state_plate_cut_del);
addState(sSTATE_PLATE_CUT_IDLE, null, state_plate_cut_idle);
addState(sSTATE_PLATE_CUT_IN, state_plate_cut_in);
addState(sSTATE_PLATE_CUT_OUT, state_plate_cut_out);
addState(sSTATE_PLATE_DEL, state_plate_del);
addState(sSTATE_PLATE_IDLE, null);
addState(sSTATE_PLATE_IN, state_plate_in);
addState(sSTATE_PLATE_OUT, state_plate_out);
addState(sSTATE_SUSHI_IDLE, null, state_sushi_idle_init);
addState(sSTATE_SUSHI_IN, state_sushi_in);
addState(sSTATE_CUT_DEL, state_del);
addState(sSTATE_CUTTED_DEL, state_del);
addState(sSTATE_SUSHI_DEL, state_del);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, resume, false, 0, true);
if (_arg3 != null){
setState(_arg3);
} else {
setState(sSTATE_PLATE_IN);
};
if (state == sSTATE_CUT_IN){
Main.instance.gameManager.addEventListener(GameEvent.EVENT_CUT, cut, false, 0, true);
} else {
if ((((state == sSTATE_PLATE_IN)) || ((state == sSTATE_PLATE_CUT_IN)))){
mcRef.addEventListener(MouseEvent.MOUSE_OVER, onOver, false, 0, true);
mcRef.addEventListener(MouseEvent.MOUSE_OUT, onOut, false, 0, true);
mcRef.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
};
};
if ((((state == sSTATE_CUTTED_IN)) || ((state == sSTATE_SUSHI_IN)))){
mcRef.mouseChildren = false;
mcRef.mouseEnabled = false;
};
}
public function state_sushi_idle_init():void{
Main.instance.gameManager.dispatchEvent(new IngredientEvent(IngredientEvent.EVENT_DONE, sType, true));
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY_INGREDIENTS, destroy, false, 0, true);
Main.instance.gameManager.dispatchEvent(new Event(Special.NEXT));
Main.instance.gameManager.clearCurrent();
}
public function state_plate_cut_out():void{
var _local1:Object;
if (stateComplete){
_local1 = Layout.MatPlaceHolder;
_local1.slot = iSlot;
Main.instance.gameManager.addPlate(iSlot);
Main.instance.gameManager.addToPlaceHolder(this, sSTATE_SUSHI_IN, Egg, new mcEgg(), _local1, sSTATE_SUSHI_IN);
destroy(null);
};
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY_INGREDIENTS, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_PAUSE, pause, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_RESUME, resume, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_CUT, cut, false);
if (mcRef != null){
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
mcRef.removeEventListener(MouseEvent.MOUSE_OVER, onOver, false);
mcRef.removeEventListener(MouseEvent.MOUSE_OUT, onOut, false);
if (((!((mcRef == null))) && (!((mcRef.parent.getChildByName(mcRef.name) == null))))){
mcRef.parent.removeChild(mcRef);
mcRef = null;
};
};
}
public function state_cutted_out():void{
if (stateComplete){
Main.instance.gameManager.returnToIngredient(new mcEgg(), Egg, iSlot);
destroy(null);
};
}
public function state_cut_out():void{
if (stateComplete){
setState(sSTATE_CUTTED_IN);
};
}
public function state_plate_cut_idle():void{
bPrepared = true;
Main.instance.gameManager.dispatchEvent(new Event(Special.NEXT));
}
public function state_cut_in():void{
if (stateComplete){
setState(sSTATE_CUT_IDLE);
};
}
public function state_plate_del():void{
if (stateComplete){
destroy(null);
};
}
public function deleteIt():void{
if (mcRef != null){
switch (state){
case sSTATE_CUT_IN:
case sSTATE_CUT_IDLE:
case sSTATE_CUT_OUT:
setState(sSTATE_CUT_DEL);
break;
case sSTATE_CUTTED_IN:
case sSTATE_CUTTED_IDLE:
case sSTATE_CUTTED_OUT:
setState(sSTATE_CUTTED_DEL);
break;
case sSTATE_PLATE_IN:
case sSTATE_PLATE_IDLE:
case sSTATE_PLATE_OUT:
setState(sSTATE_PLATE_DEL);
break;
case sSTATE_PLATE_CUT_IN:
case sSTATE_PLATE_CUT_IDLE:
case sSTATE_PLATE_CUT_OUT:
setState(sSTATE_PLATE_CUT_DEL);
break;
case sSTATE_SUSHI_IN:
case sSTATE_SUSHI_IDLE:
setState(sSTATE_SUSHI_DEL);
break;
};
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
} else {
destroy(null);
};
}
public function state_plate_cut_del():void{
if (stateComplete){
destroy(null);
};
}
public function get placed():Boolean{
return (bPlaced);
}
public function get type():String{
return (sType);
}
public function cut(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_CUT, cut, false);
SoundEngine.Play(Main.sSOUND_SFX, SoundList.sSOUND_KNIFE_CUT_MEAT);
setState(sSTATE_CUT_OUT);
}
public function get prepared():Boolean{
return (bPrepared);
}
public function state_cut_idle_init():void{
if (Main.instance.gameManager.special.active){
Main.instance.gameManager.dispatchEvent(new SequenceEvent(SequenceEvent.POSITIVE, Layout.BoardPlaceHolder, 1));
} else {
Main.instance.gameManager.startMiniGame(toString());
};
}
public function onOver(_arg1:MouseEvent):void{
var _local2:Function;
var _local3:GlowFilter;
_local2 = Main.instance.gameManager.instruction.authorize;
if (((((((_local2(sType, ((state == sSTATE_PLATE_CUT_IDLE)) ? true : false)) && (!((mcRef.getChildByName("mcState") == null))))) && (!(Main.instance.gameManager.tutorial)))) && (!(Main.instance.gameManager.special.active)))){
_local3 = new GlowFilter(0, 1, 2, 2, 8);
mcState.filters = new Array(_local3);
};
}
public function state_cutted_idle_init():void{
setState(sSTATE_CUTTED_OUT);
Main.instance.gameManager.dispatchEvent(new IngredientEvent(IngredientEvent.EVENT_DONE, sType));
}
public function state_del():void{
if (stateComplete){
destroy(null);
};
}
public function state_sushi_in():void{
if (stateComplete){
setState(sSTATE_SUSHI_IDLE);
};
}
public function state_plate_in():void{
if (stateComplete){
setState(sSTATE_PLATE_IDLE);
};
}
public function state_cutted_in():void{
if (stateComplete){
setState(sSTATE_CUTTED_IDLE);
};
}
public function onClick(_arg1:MouseEvent):void{
if ((((((((state == sSTATE_PLATE_IDLE)) && ((Main.instance.gameManager.selectedIngredient == null)))) && (Main.instance.gameManager.instruction.authorize(sType)))) && (((((!((_arg1 == null))) && (!(Main.instance.gameManager.special.active)))) || ((((_arg1 == null)) && (Main.instance.gameManager.special.active))))))){
Main.instance.gameManager.selectedIngredient = this;
Main.instance.gameManager.started = true;
setState(sSTATE_PLATE_OUT);
Main.instance.gameManager.dispatchEvent(new TutEvent(TutEvent.sEVENT_CLICK, mcRef));
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
Main.instance.gameManager.dispatchEvent(new Event(Special.WORKING));
Main.instance.gameManager.dispatchEvent(new Event(GameEvent.EVENT_ON_CUTBOARD));
} else {
if ((((((((state == sSTATE_PLATE_CUT_IDLE)) && ((Main.instance.gameManager.selectedIngredient == null)))) && (Main.instance.gameManager.instruction.authorize(sType, true)))) && (((((!((_arg1 == null))) && (!(Main.instance.gameManager.special.active)))) || ((((_arg1 == null)) && (Main.instance.gameManager.special.active))))))){
Main.instance.gameManager.selectedIngredient = this;
Main.instance.gameManager.started = true;
setState(sSTATE_PLATE_CUT_OUT);
Main.instance.gameManager.dispatchEvent(new TutEvent(TutEvent.sEVENT_CLICK, mcRef));
Main.instance.gameManager.dispatchEvent(new Event(Special.WORKING));
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
};
};
onOut(null);
}
public function toString():String{
return ("Egg");
}
public function onOut(_arg1:MouseEvent):void{
if (((((!((mcRef.getChildByName("mcState") == null))) && (!(Main.instance.gameManager.tutorial)))) && (!(Main.instance.gameManager.special.active)))){
mcState.filters = new Array();
};
}
public function state_plate_out():void{
var _local1:Object;
if (stateComplete){
_local1 = Layout.BoardPlaceHolder;
_local1.slot = iSlot;
Main.instance.gameManager.addPlate(iSlot);
Main.instance.gameManager.addToPlaceHolder(this, sSTATE_PLATE_CUT_IN, Egg, new mcEgg(), _local1, sSTATE_CUT_IN);
destroy(null);
};
}
public function state_plate_cut_in():void{
if (stateComplete){
setState(sSTATE_PLATE_CUT_IDLE);
};
}
}
}//package gameplay.ingredients.fillings
Section 28
//Salmon (gameplay.ingredients.fillings.Salmon)
package gameplay.ingredients.fillings {
import library.sounds.*;
import flash.events.*;
import flash.display.*;
import library.events.*;
import gameplay.tutorial.*;
import gameplay.special.*;
import library.basic.*;
import library.interfaces.*;
import gameplay.layout.*;
import flash.filters.*;
public class Salmon extends StateManaged implements Idestroyable {
private var iSlot:int;
private var bPlaced:Boolean;
private var bPrepared:Boolean;
private var sType:String;
public static const sSTATE_CUTTED_OUT:String = "cutted_out";
public static const sSTATE_PLATE_OUT:String = "plate_out";
public static const sSTATE_CUTTED_DEL:String = "cutted_del";
public static const sSTATE_PLATE_CUT_IN:String = "plate_cut_in";
public static const sSTATE_PLATE_IN:String = "plate_in";
public static const sSTATE_PLATE_DEL:String = "plate_del";
public static const sSTATE_CUT_IDLE:String = "cut_idle";
public static const sSTATE_SUSHI_IN:String = "sushi_in";
public static const sSTATE_SUSHI_IDLE:String = "sushi_idle";
public static const sSTATE_CUTTED_IDLE:String = "cutted_idle";
public static const sSTATE_CUT_IN:String = "cut_in";
public static const sSTATE_PLATE_CUT_OUT:String = "plate_cut_out";
public static const sSTATE_CUT_DEL:String = "cut_del";
public static const sSTATE_CUT_OUT:String = "cut_out";
public static const sSTATE_CUTTED_IN:String = "cutted_in";
public static const sSTATE_PLATE_CUT_DEL:String = "plate_cut_del";
public static const sSTATE_NONE:String = "none";
public static const sSTATE_PLATE_CUT_IDLE:String = "plate_cut_idle";
public static const sSTATE_SUSHI_DEL:String = "sushi_del";
public static const sSTATE_PLATE_IDLE:String = "plate_idle";
public function Salmon(_arg1:MovieClip, _arg2:Object, _arg3:String=null, _arg4:Boolean=false):void{
super(_arg1);
iSlot = _arg2.slot;
sType = "filling";
bPlaced = false;
bPrepared = false;
mcRef.x = _arg2.x;
mcRef.y = _arg2.y;
mcRef.scaleX = (mcRef.scaleY = _arg2.scale);
addState(sSTATE_CUT_IDLE, null, state_cut_idle_init);
addState(sSTATE_CUT_IN, state_cut_in);
addState(sSTATE_CUT_OUT, state_cut_out);
addState(sSTATE_CUTTED_IDLE, null, state_cutted_idle_init);
addState(sSTATE_CUTTED_IN, state_cutted_in);
addState(sSTATE_CUTTED_OUT, state_cutted_out);
addState(sSTATE_NONE, null);
addState(sSTATE_PLATE_CUT_DEL, state_plate_cut_del);
addState(sSTATE_PLATE_CUT_IDLE, null, state_plate_cut_idle);
addState(sSTATE_PLATE_CUT_IN, state_plate_cut_in);
addState(sSTATE_PLATE_CUT_OUT, state_plate_cut_out);
addState(sSTATE_PLATE_DEL, state_plate_del);
addState(sSTATE_PLATE_IDLE, null);
addState(sSTATE_PLATE_IN, state_plate_in);
addState(sSTATE_PLATE_OUT, state_plate_out);
addState(sSTATE_SUSHI_IDLE, null, state_sushi_idle_init);
addState(sSTATE_SUSHI_IN, state_sushi_in);
addState(sSTATE_CUT_DEL, state_del);
addState(sSTATE_CUTTED_DEL, state_del);
addState(sSTATE_SUSHI_DEL, state_del);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, resume, false, 0, true);
if (_arg3 != null){
setState(_arg3);
} else {
setState(sSTATE_PLATE_IN);
};
if (state == sSTATE_CUT_IN){
Main.instance.gameManager.addEventListener(GameEvent.EVENT_CUT, cut, false, 0, true);
} else {
if ((((state == sSTATE_PLATE_IN)) || ((state == sSTATE_PLATE_CUT_IN)))){
mcRef.addEventListener(MouseEvent.MOUSE_OVER, onOver, false, 0, true);
mcRef.addEventListener(MouseEvent.MOUSE_OUT, onOut, false, 0, true);
mcRef.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
};
};
if ((((state == sSTATE_CUTTED_IN)) || ((state == sSTATE_SUSHI_IN)))){
mcRef.mouseChildren = false;
mcRef.mouseEnabled = false;
};
}
public function state_sushi_idle_init():void{
Main.instance.gameManager.dispatchEvent(new IngredientEvent(IngredientEvent.EVENT_DONE, sType, true));
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY_INGREDIENTS, destroy, false, 0, true);
Main.instance.gameManager.dispatchEvent(new Event(Special.NEXT));
Main.instance.gameManager.clearCurrent();
}
public function state_plate_cut_out():void{
var _local1:Object;
if (stateComplete){
_local1 = Layout.MatPlaceHolder;
_local1.slot = iSlot;
Main.instance.gameManager.addPlate(iSlot);
Main.instance.gameManager.addToPlaceHolder(this, sSTATE_SUSHI_IN, Salmon, new mcSalmon(), _local1, sSTATE_SUSHI_IN);
destroy(null);
};
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY_INGREDIENTS, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_PAUSE, pause, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_RESUME, resume, false);
if (mcRef != null){
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
mcRef.removeEventListener(MouseEvent.MOUSE_OVER, onOver, false);
mcRef.removeEventListener(MouseEvent.MOUSE_OUT, onOut, false);
if (((!((mcRef == null))) && (!((mcRef.parent.getChildByName(mcRef.name) == null))))){
mcRef.parent.removeChild(mcRef);
mcRef = null;
};
};
}
public function state_cutted_out():void{
if (stateComplete){
Main.instance.gameManager.returnToIngredient(new mcSalmon(), Salmon, iSlot);
destroy(null);
};
}
public function state_cut_out():void{
if (stateComplete){
setState(sSTATE_CUTTED_IN);
};
}
public function state_plate_cut_idle():void{
bPrepared = true;
Main.instance.gameManager.dispatchEvent(new Event(Special.NEXT));
}
public function state_cut_in():void{
if (stateComplete){
setState(sSTATE_CUT_IDLE);
};
}
public function state_plate_del():void{
if (stateComplete){
destroy(null);
};
}
public function deleteIt():void{
if (mcRef != null){
switch (state){
case sSTATE_CUT_IN:
case sSTATE_CUT_IDLE:
case sSTATE_CUT_OUT:
setState(sSTATE_CUT_DEL);
break;
case sSTATE_CUTTED_IN:
case sSTATE_CUTTED_IDLE:
case sSTATE_CUTTED_OUT:
setState(sSTATE_CUTTED_DEL);
break;
case sSTATE_PLATE_IN:
case sSTATE_PLATE_IDLE:
case sSTATE_PLATE_OUT:
setState(sSTATE_PLATE_DEL);
break;
case sSTATE_PLATE_CUT_IN:
case sSTATE_PLATE_CUT_IDLE:
case sSTATE_PLATE_CUT_OUT:
setState(sSTATE_PLATE_CUT_DEL);
break;
case sSTATE_SUSHI_IN:
case sSTATE_SUSHI_IDLE:
setState(sSTATE_SUSHI_DEL);
break;
};
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
} else {
destroy(null);
};
}
public function state_plate_cut_del():void{
if (stateComplete){
destroy(null);
};
}
public function get placed():Boolean{
return (bPlaced);
}
public function get type():String{
return (sType);
}
public function cut(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_CUT, cut, false);
SoundEngine.Play(Main.sSOUND_SFX, SoundList.sSOUND_KNIFE_CUT_MEAT);
setState(sSTATE_CUT_OUT);
}
public function get prepared():Boolean{
return (bPrepared);
}
public function state_cut_idle_init():void{
if (Main.instance.gameManager.special.active){
Main.instance.gameManager.dispatchEvent(new SequenceEvent(SequenceEvent.POSITIVE, Layout.BoardPlaceHolder, 1));
} else {
Main.instance.gameManager.startMiniGame(toString());
};
}
public function onOver(_arg1:MouseEvent):void{
var _local2:Function;
var _local3:GlowFilter;
_local2 = Main.instance.gameManager.instruction.authorize;
if (((((((_local2(sType, ((state == sSTATE_PLATE_CUT_IDLE)) ? true : false)) && (!((mcRef.getChildByName("mcState") == null))))) && (!(Main.instance.gameManager.tutorial)))) && (!(Main.instance.gameManager.special.active)))){
_local3 = new GlowFilter(0, 1, 2, 2, 8);
mcState.filters = new Array(_local3);
};
}
public function state_cutted_idle_init():void{
setState(sSTATE_CUTTED_OUT);
Main.instance.gameManager.dispatchEvent(new IngredientEvent(IngredientEvent.EVENT_DONE, sType));
}
public function state_del():void{
if (stateComplete){
destroy(null);
};
}
public function state_sushi_in():void{
if (stateComplete){
setState(sSTATE_SUSHI_IDLE);
};
}
public function state_plate_in():void{
if (stateComplete){
setState(sSTATE_PLATE_IDLE);
};
}
public function state_cutted_in():void{
if (stateComplete){
setState(sSTATE_CUTTED_IDLE);
};
}
public function onClick(_arg1:MouseEvent):void{
if ((((((((state == sSTATE_PLATE_IDLE)) && ((Main.instance.gameManager.selectedIngredient == null)))) && (Main.instance.gameManager.instruction.authorize(sType)))) && (((((!((_arg1 == null))) && (!(Main.instance.gameManager.special.active)))) || ((((_arg1 == null)) && (Main.instance.gameManager.special.active))))))){
Main.instance.gameManager.selectedIngredient = this;
Main.instance.gameManager.started = true;
setState(sSTATE_PLATE_OUT);
Main.instance.gameManager.dispatchEvent(new TutEvent(TutEvent.sEVENT_CLICK, mcRef));
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
Main.instance.gameManager.dispatchEvent(new Event(Special.WORKING));
Main.instance.gameManager.dispatchEvent(new Event(GameEvent.EVENT_ON_CUTBOARD));
} else {
if ((((((((state == sSTATE_PLATE_CUT_IDLE)) && ((Main.instance.gameManager.selectedIngredient == null)))) && (Main.instance.gameManager.instruction.authorize(sType, true)))) && (((((!((_arg1 == null))) && (!(Main.instance.gameManager.special.active)))) || ((((_arg1 == null)) && (Main.instance.gameManager.special.active))))))){
Main.instance.gameManager.selectedIngredient = this;
Main.instance.gameManager.started = true;
setState(sSTATE_PLATE_CUT_OUT);
Main.instance.gameManager.dispatchEvent(new TutEvent(TutEvent.sEVENT_CLICK, mcRef));
Main.instance.gameManager.dispatchEvent(new Event(Special.WORKING));
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
};
};
onOut(null);
}
public function toString():String{
return ("Salmon");
}
public function onOut(_arg1:MouseEvent):void{
if (((((!((mcRef.getChildByName("mcState") == null))) && (!(Main.instance.gameManager.tutorial)))) && (!(Main.instance.gameManager.special.active)))){
mcState.filters = new Array();
};
}
public function state_plate_out():void{
var _local1:Object;
if (stateComplete){
_local1 = Layout.BoardPlaceHolder;
_local1.slot = iSlot;
Main.instance.gameManager.addPlate(iSlot);
Main.instance.gameManager.addToPlaceHolder(this, sSTATE_PLATE_CUT_IN, Salmon, new mcSalmon(), _local1, sSTATE_CUT_IN);
destroy(null);
};
}
public function state_plate_cut_in():void{
if (stateComplete){
setState(sSTATE_PLATE_CUT_IDLE);
};
}
}
}//package gameplay.ingredients.fillings
Section 29
//Shrimp (gameplay.ingredients.fillings.Shrimp)
package gameplay.ingredients.fillings {
import library.sounds.*;
import flash.events.*;
import flash.display.*;
import library.events.*;
import gameplay.tutorial.*;
import gameplay.special.*;
import library.basic.*;
import library.interfaces.*;
import gameplay.layout.*;
import flash.filters.*;
public class Shrimp extends StateManaged implements Idestroyable {
private var iSlot:int;
private var bPlaced:Boolean;
private var bPrepared:Boolean;
private var sType:String;
public static const sSTATE_CUTTED_OUT:String = "cutted_out";
public static const sSTATE_PLATE_OUT:String = "plate_out";
public static const sSTATE_CUTTED_DEL:String = "cutted_del";
public static const sSTATE_PLATE_CUT_IN:String = "plate_cut_in";
public static const sSTATE_PLATE_IN:String = "plate_in";
public static const sSTATE_PLATE_DEL:String = "plate_del";
public static const sSTATE_CUT_IDLE:String = "cut_idle";
public static const sSTATE_SUSHI_IN:String = "sushi_in";
public static const sSTATE_SUSHI_IDLE:String = "sushi_idle";
public static const sSTATE_CUTTED_IDLE:String = "cutted_idle";
public static const sSTATE_CUT_IN:String = "cut_in";
public static const sSTATE_PLATE_CUT_OUT:String = "plate_cut_out";
public static const sSTATE_CUT_DEL:String = "cut_del";
public static const sSTATE_CUT_OUT:String = "cut_out";
public static const sSTATE_CUTTED_IN:String = "cutted_in";
public static const sSTATE_PLATE_CUT_DEL:String = "plate_cut_del";
public static const sSTATE_NONE:String = "none";
public static const sSTATE_PLATE_CUT_IDLE:String = "plate_cut_idle";
public static const sSTATE_SUSHI_DEL:String = "sushi_del";
public static const sSTATE_PLATE_IDLE:String = "plate_idle";
public function Shrimp(_arg1:MovieClip, _arg2:Object, _arg3:String=null, _arg4:Boolean=false):void{
super(_arg1);
iSlot = _arg2.slot;
sType = "filling";
bPlaced = false;
bPrepared = false;
mcRef.x = _arg2.x;
mcRef.y = _arg2.y;
mcRef.scaleX = (mcRef.scaleY = _arg2.scale);
addState(sSTATE_CUT_IDLE, null, state_cut_idle_init);
addState(sSTATE_CUT_IN, state_cut_in);
addState(sSTATE_CUT_OUT, state_cut_out);
addState(sSTATE_CUTTED_IDLE, null, state_cutted_idle_init);
addState(sSTATE_CUTTED_IN, state_cutted_in);
addState(sSTATE_CUTTED_OUT, state_cutted_out);
addState(sSTATE_NONE, null);
addState(sSTATE_PLATE_CUT_DEL, state_plate_cut_del);
addState(sSTATE_PLATE_CUT_IDLE, null, state_plate_cut_idle);
addState(sSTATE_PLATE_CUT_IN, state_plate_cut_in);
addState(sSTATE_PLATE_CUT_OUT, state_plate_cut_out);
addState(sSTATE_PLATE_DEL, state_plate_del);
addState(sSTATE_PLATE_IDLE, null);
addState(sSTATE_PLATE_IN, state_plate_in);
addState(sSTATE_PLATE_OUT, state_plate_out);
addState(sSTATE_SUSHI_IDLE, null, state_sushi_idle_init);
addState(sSTATE_SUSHI_IN, state_sushi_in);
addState(sSTATE_CUT_DEL, state_del);
addState(sSTATE_CUTTED_DEL, state_del);
addState(sSTATE_SUSHI_DEL, state_del);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, resume, false, 0, true);
if (_arg3 != null){
setState(_arg3);
} else {
setState(sSTATE_PLATE_IN);
};
if (state == sSTATE_CUT_IN){
Main.instance.gameManager.addEventListener(GameEvent.EVENT_CUT, cut, false, 0, true);
} else {
if ((((state == sSTATE_PLATE_IN)) || ((state == sSTATE_PLATE_CUT_IN)))){
mcRef.addEventListener(MouseEvent.MOUSE_OVER, onOver, false, 0, true);
mcRef.addEventListener(MouseEvent.MOUSE_OUT, onOut, false, 0, true);
mcRef.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
};
};
if ((((state == sSTATE_CUTTED_IN)) || ((state == sSTATE_SUSHI_IN)))){
mcRef.mouseChildren = false;
mcRef.mouseEnabled = false;
};
}
public function state_sushi_idle_init():void{
Main.instance.gameManager.dispatchEvent(new IngredientEvent(IngredientEvent.EVENT_DONE, sType, true));
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY_INGREDIENTS, destroy, false, 0, true);
Main.instance.gameManager.dispatchEvent(new Event(Special.NEXT));
Main.instance.gameManager.clearCurrent();
}
public function state_plate_cut_out():void{
var _local1:Object;
if (stateComplete){
_local1 = Layout.MatPlaceHolder;
_local1.slot = iSlot;
Main.instance.gameManager.addPlate(iSlot);
Main.instance.gameManager.addToPlaceHolder(this, sSTATE_SUSHI_IN, Shrimp, new mcShrimp(), _local1, sSTATE_SUSHI_IN);
destroy(null);
};
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY_INGREDIENTS, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_PAUSE, pause, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_RESUME, resume, false);
if (mcRef != null){
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
mcRef.removeEventListener(MouseEvent.MOUSE_OVER, onOver, false);
mcRef.removeEventListener(MouseEvent.MOUSE_OUT, onOut, false);
if (((!((mcRef == null))) && (!((mcRef.parent.getChildByName(mcRef.name) == null))))){
mcRef.parent.removeChild(mcRef);
mcRef = null;
};
};
}
public function state_cutted_out():void{
if (stateComplete){
Main.instance.gameManager.returnToIngredient(new mcShrimp(), Shrimp, iSlot);
destroy(null);
};
}
public function state_cut_out():void{
if (stateComplete){
setState(sSTATE_CUTTED_IN);
};
}
public function state_plate_cut_idle():void{
bPrepared = true;
Main.instance.gameManager.dispatchEvent(new Event(Special.NEXT));
}
public function state_cut_in():void{
if (stateComplete){
setState(sSTATE_CUT_IDLE);
};
}
public function state_plate_del():void{
if (stateComplete){
destroy(null);
};
}
public function deleteIt():void{
if (mcRef != null){
switch (state){
case sSTATE_CUT_IN:
case sSTATE_CUT_IDLE:
case sSTATE_CUT_OUT:
setState(sSTATE_CUT_DEL);
break;
case sSTATE_CUTTED_IN:
case sSTATE_CUTTED_IDLE:
case sSTATE_CUTTED_OUT:
setState(sSTATE_CUTTED_DEL);
break;
case sSTATE_PLATE_IN:
case sSTATE_PLATE_IDLE:
case sSTATE_PLATE_OUT:
setState(sSTATE_PLATE_DEL);
break;
case sSTATE_PLATE_CUT_IN:
case sSTATE_PLATE_CUT_IDLE:
case sSTATE_PLATE_CUT_OUT:
setState(sSTATE_PLATE_CUT_DEL);
break;
case sSTATE_SUSHI_IN:
case sSTATE_SUSHI_IDLE:
setState(sSTATE_SUSHI_DEL);
break;
};
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
} else {
destroy(null);
};
}
public function state_plate_cut_del():void{
if (stateComplete){
destroy(null);
};
}
public function get placed():Boolean{
return (bPlaced);
}
public function get type():String{
return (sType);
}
public function cut(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_CUT, cut, false);
SoundEngine.Play(Main.sSOUND_SFX, SoundList.sSOUND_KNIFE_CUT_MEAT);
setState(sSTATE_CUT_OUT);
}
public function get prepared():Boolean{
return (bPrepared);
}
public function state_cut_idle_init():void{
if (Main.instance.gameManager.special.active){
Main.instance.gameManager.dispatchEvent(new SequenceEvent(SequenceEvent.POSITIVE, Layout.BoardPlaceHolder, 1));
} else {
Main.instance.gameManager.startMiniGame(toString());
};
}
public function onOver(_arg1:MouseEvent):void{
var _local2:Function;
var _local3:GlowFilter;
_local2 = Main.instance.gameManager.instruction.authorize;
if (((((((_local2(sType, ((state == sSTATE_PLATE_CUT_IDLE)) ? true : false)) && (!((mcRef.getChildByName("mcState") == null))))) && (!(Main.instance.gameManager.tutorial)))) && (!(Main.instance.gameManager.special.active)))){
_local3 = new GlowFilter(0, 1, 2, 2, 8);
mcState.filters = new Array(_local3);
};
}
public function state_cutted_idle_init():void{
setState(sSTATE_CUTTED_OUT);
Main.instance.gameManager.dispatchEvent(new IngredientEvent(IngredientEvent.EVENT_DONE, sType));
}
public function state_del():void{
if (stateComplete){
destroy(null);
};
}
public function state_sushi_in():void{
if (stateComplete){
setState(sSTATE_SUSHI_IDLE);
};
}
public function state_plate_in():void{
if (stateComplete){
setState(sSTATE_PLATE_IDLE);
};
}
public function state_cutted_in():void{
if (stateComplete){
setState(sSTATE_CUTTED_IDLE);
};
}
public function onClick(_arg1:MouseEvent):void{
if ((((((((state == sSTATE_PLATE_IDLE)) && ((Main.instance.gameManager.selectedIngredient == null)))) && (Main.instance.gameManager.instruction.authorize(sType)))) && (((((!((_arg1 == null))) && (!(Main.instance.gameManager.special.active)))) || ((((_arg1 == null)) && (Main.instance.gameManager.special.active))))))){
Main.instance.gameManager.selectedIngredient = this;
Main.instance.gameManager.started = true;
setState(sSTATE_PLATE_OUT);
Main.instance.gameManager.dispatchEvent(new TutEvent(TutEvent.sEVENT_CLICK, mcRef));
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
Main.instance.gameManager.dispatchEvent(new Event(Special.WORKING));
Main.instance.gameManager.dispatchEvent(new Event(GameEvent.EVENT_ON_CUTBOARD));
} else {
if ((((((((state == sSTATE_PLATE_CUT_IDLE)) && ((Main.instance.gameManager.selectedIngredient == null)))) && (Main.instance.gameManager.instruction.authorize(sType, true)))) && (((((!((_arg1 == null))) && (!(Main.instance.gameManager.special.active)))) || ((((_arg1 == null)) && (Main.instance.gameManager.special.active))))))){
Main.instance.gameManager.selectedIngredient = this;
Main.instance.gameManager.started = true;
setState(sSTATE_PLATE_CUT_OUT);
Main.instance.gameManager.dispatchEvent(new TutEvent(TutEvent.sEVENT_CLICK, mcRef));
Main.instance.gameManager.dispatchEvent(new Event(Special.WORKING));
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
};
};
onOut(null);
}
public function toString():String{
return ("Shrimp");
}
public function onOut(_arg1:MouseEvent):void{
if (((((!((mcRef.getChildByName("mcState") == null))) && (!(Main.instance.gameManager.tutorial)))) && (!(Main.instance.gameManager.special.active)))){
mcState.filters = new Array();
};
}
public function state_plate_out():void{
var _local1:Object;
if (stateComplete){
_local1 = Layout.BoardPlaceHolder;
_local1.slot = iSlot;
Main.instance.gameManager.addPlate(iSlot);
Main.instance.gameManager.addToPlaceHolder(this, sSTATE_PLATE_CUT_IN, Shrimp, new mcShrimp(), _local1, sSTATE_CUT_IN);
destroy(null);
};
}
public function state_plate_cut_in():void{
if (stateComplete){
setState(sSTATE_PLATE_CUT_IDLE);
};
}
}
}//package gameplay.ingredients.fillings
Section 30
//Tuna (gameplay.ingredients.fillings.Tuna)
package gameplay.ingredients.fillings {
import library.sounds.*;
import flash.events.*;
import flash.display.*;
import library.events.*;
import gameplay.tutorial.*;
import gameplay.special.*;
import library.basic.*;
import library.interfaces.*;
import gameplay.layout.*;
import flash.filters.*;
public class Tuna extends StateManaged implements Idestroyable {
private var iSlot:int;
private var bPlaced:Boolean;
private var bPrepared:Boolean;
private var sType:String;
public static const sSTATE_CUTTED_OUT:String = "cutted_out";
public static const sSTATE_PLATE_OUT:String = "plate_out";
public static const sSTATE_CUTTED_DEL:String = "cutted_del";
public static const sSTATE_PLATE_CUT_IN:String = "plate_cut_in";
public static const sSTATE_PLATE_IN:String = "plate_in";
public static const sSTATE_PLATE_DEL:String = "plate_del";
public static const sSTATE_CUT_IDLE:String = "cut_idle";
public static const sSTATE_SUSHI_IN:String = "sushi_in";
public static const sSTATE_SUSHI_IDLE:String = "sushi_idle";
public static const sSTATE_CUTTED_IDLE:String = "cutted_idle";
public static const sSTATE_CUT_IN:String = "cut_in";
public static const sSTATE_PLATE_CUT_OUT:String = "plate_cut_out";
public static const sSTATE_CUT_DEL:String = "cut_del";
public static const sSTATE_CUT_OUT:String = "cut_out";
public static const sSTATE_CUTTED_IN:String = "cutted_in";
public static const sSTATE_PLATE_CUT_DEL:String = "plate_cut_del";
public static const sSTATE_NONE:String = "none";
public static const sSTATE_PLATE_CUT_IDLE:String = "plate_cut_idle";
public static const sSTATE_SUSHI_DEL:String = "sushi_del";
public static const sSTATE_PLATE_IDLE:String = "plate_idle";
public function Tuna(_arg1:MovieClip, _arg2:Object, _arg3:String=null, _arg4:Boolean=false):void{
super(_arg1);
iSlot = _arg2.slot;
sType = "filling";
bPlaced = false;
bPrepared = false;
mcRef.x = _arg2.x;
mcRef.y = _arg2.y;
mcRef.scaleX = (mcRef.scaleY = _arg2.scale);
addState(sSTATE_CUT_IDLE, null, state_cut_idle_init);
addState(sSTATE_CUT_IN, state_cut_in);
addState(sSTATE_CUT_OUT, state_cut_out);
addState(sSTATE_CUTTED_IDLE, null, state_cutted_idle_init);
addState(sSTATE_CUTTED_IN, state_cutted_in);
addState(sSTATE_CUTTED_OUT, state_cutted_out);
addState(sSTATE_NONE, null);
addState(sSTATE_PLATE_CUT_DEL, state_plate_cut_del);
addState(sSTATE_PLATE_CUT_IDLE, null, state_plate_cut_idle);
addState(sSTATE_PLATE_CUT_IN, state_plate_cut_in);
addState(sSTATE_PLATE_CUT_OUT, state_plate_cut_out);
addState(sSTATE_PLATE_DEL, state_plate_del);
addState(sSTATE_PLATE_IDLE, null);
addState(sSTATE_PLATE_IN, state_plate_in);
addState(sSTATE_PLATE_OUT, state_plate_out);
addState(sSTATE_SUSHI_IDLE, null, state_sushi_idle_init);
addState(sSTATE_SUSHI_IN, state_sushi_in);
addState(sSTATE_CUT_DEL, state_del);
addState(sSTATE_CUTTED_DEL, state_del);
addState(sSTATE_SUSHI_DEL, state_del);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, resume, false, 0, true);
if (_arg3 != null){
setState(_arg3);
} else {
setState(sSTATE_PLATE_IN);
};
if (state == sSTATE_CUT_IN){
Main.instance.gameManager.addEventListener(GameEvent.EVENT_CUT, cut, false, 0, true);
} else {
if ((((state == sSTATE_PLATE_IN)) || ((state == sSTATE_PLATE_CUT_IN)))){
mcRef.addEventListener(MouseEvent.MOUSE_OVER, onOver, false, 0, true);
mcRef.addEventListener(MouseEvent.MOUSE_OUT, onOut, false, 0, true);
mcRef.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
};
};
if ((((state == sSTATE_CUTTED_IN)) || ((state == sSTATE_SUSHI_IN)))){
mcRef.mouseChildren = false;
mcRef.mouseEnabled = false;
};
}
public function state_sushi_idle_init():void{
Main.instance.gameManager.dispatchEvent(new IngredientEvent(IngredientEvent.EVENT_DONE, sType, true));
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY_INGREDIENTS, destroy, false, 0, true);
Main.instance.gameManager.dispatchEvent(new Event(Special.NEXT));
Main.instance.gameManager.clearCurrent();
}
public function state_plate_cut_out():void{
var _local1:Object;
if (stateComplete){
_local1 = Layout.MatPlaceHolder;
_local1.slot = iSlot;
Main.instance.gameManager.addPlate(iSlot);
Main.instance.gameManager.addToPlaceHolder(this, sSTATE_SUSHI_IN, Tuna, new mcTuna(), _local1, sSTATE_SUSHI_IN);
destroy(null);
};
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY_INGREDIENTS, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_PAUSE, pause, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_RESUME, resume, false);
if (mcRef != null){
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
mcRef.removeEventListener(MouseEvent.MOUSE_OVER, onOver, false);
mcRef.removeEventListener(MouseEvent.MOUSE_OUT, onOut, false);
if (((!((mcRef == null))) && (!((mcRef.parent.getChildByName(mcRef.name) == null))))){
mcRef.parent.removeChild(mcRef);
mcRef = null;
};
};
}
public function state_cutted_out():void{
if (stateComplete){
Main.instance.gameManager.returnToIngredient(new mcTuna(), Tuna, iSlot);
destroy(null);
};
}
public function state_cut_out():void{
if (stateComplete){
setState(sSTATE_CUTTED_IN);
};
}
public function state_plate_cut_idle():void{
bPrepared = true;
Main.instance.gameManager.dispatchEvent(new Event(Special.NEXT));
}
public function state_cut_in():void{
if (stateComplete){
setState(sSTATE_CUT_IDLE);
};
}
public function state_plate_del():void{
if (stateComplete){
destroy(null);
};
}
public function deleteIt():void{
if (mcRef != null){
switch (state){
case sSTATE_CUT_IN:
case sSTATE_CUT_IDLE:
case sSTATE_CUT_OUT:
setState(sSTATE_CUT_DEL);
break;
case sSTATE_CUTTED_IN:
case sSTATE_CUTTED_IDLE:
case sSTATE_CUTTED_OUT:
setState(sSTATE_CUTTED_DEL);
break;
case sSTATE_PLATE_IN:
case sSTATE_PLATE_IDLE:
case sSTATE_PLATE_OUT:
setState(sSTATE_PLATE_DEL);
break;
case sSTATE_PLATE_CUT_IN:
case sSTATE_PLATE_CUT_IDLE:
case sSTATE_PLATE_CUT_OUT:
setState(sSTATE_PLATE_CUT_DEL);
break;
case sSTATE_SUSHI_IN:
case sSTATE_SUSHI_IDLE:
setState(sSTATE_SUSHI_DEL);
break;
};
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
} else {
destroy(null);
};
}
public function state_plate_cut_del():void{
if (stateComplete){
destroy(null);
};
}
public function get placed():Boolean{
return (bPlaced);
}
public function get type():String{
return (sType);
}
public function cut(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_CUT, cut, false);
SoundEngine.Play(Main.sSOUND_SFX, SoundList.sSOUND_KNIFE_CUT_MEAT);
setState(sSTATE_CUT_OUT);
}
public function get prepared():Boolean{
return (bPrepared);
}
public function state_cut_idle_init():void{
if (Main.instance.gameManager.special.active){
Main.instance.gameManager.dispatchEvent(new SequenceEvent(SequenceEvent.POSITIVE, Layout.BoardPlaceHolder, 1));
} else {
Main.instance.gameManager.startMiniGame(toString());
};
}
public function onOver(_arg1:MouseEvent):void{
var _local2:Function;
var _local3:GlowFilter;
_local2 = Main.instance.gameManager.instruction.authorize;
if (((((((_local2(sType, ((state == sSTATE_PLATE_CUT_IDLE)) ? true : false)) && (!((mcRef.getChildByName("mcState") == null))))) && (!(Main.instance.gameManager.tutorial)))) && (!(Main.instance.gameManager.special.active)))){
_local3 = new GlowFilter(0, 1, 2, 2, 8);
mcState.filters = new Array(_local3);
};
}
public function state_cutted_idle_init():void{
setState(sSTATE_CUTTED_OUT);
Main.instance.gameManager.dispatchEvent(new IngredientEvent(IngredientEvent.EVENT_DONE, sType));
}
public function state_del():void{
if (stateComplete){
destroy(null);
};
}
public function state_sushi_in():void{
if (stateComplete){
setState(sSTATE_SUSHI_IDLE);
};
}
public function state_plate_in():void{
if (stateComplete){
setState(sSTATE_PLATE_IDLE);
};
}
public function state_cutted_in():void{
if (stateComplete){
setState(sSTATE_CUTTED_IDLE);
};
}
public function onClick(_arg1:MouseEvent):void{
if ((((((((state == sSTATE_PLATE_IDLE)) && ((Main.instance.gameManager.selectedIngredient == null)))) && (Main.instance.gameManager.instruction.authorize(sType)))) && (((((!((_arg1 == null))) && (!(Main.instance.gameManager.special.active)))) || ((((_arg1 == null)) && (Main.instance.gameManager.special.active))))))){
Main.instance.gameManager.selectedIngredient = this;
Main.instance.gameManager.started = true;
setState(sSTATE_PLATE_OUT);
Main.instance.gameManager.dispatchEvent(new TutEvent(TutEvent.sEVENT_CLICK, mcRef));
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
Main.instance.gameManager.dispatchEvent(new Event(Special.WORKING));
Main.instance.gameManager.dispatchEvent(new Event(GameEvent.EVENT_ON_CUTBOARD));
} else {
if ((((((((state == sSTATE_PLATE_CUT_IDLE)) && ((Main.instance.gameManager.selectedIngredient == null)))) && (Main.instance.gameManager.instruction.authorize(sType, true)))) && (((((!((_arg1 == null))) && (!(Main.instance.gameManager.special.active)))) || ((((_arg1 == null)) && (Main.instance.gameManager.special.active))))))){
Main.instance.gameManager.selectedIngredient = this;
Main.instance.gameManager.started = true;
setState(sSTATE_PLATE_CUT_OUT);
Main.instance.gameManager.dispatchEvent(new TutEvent(TutEvent.sEVENT_CLICK, mcRef));
Main.instance.gameManager.dispatchEvent(new Event(Special.WORKING));
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
};
};
onOut(null);
}
public function toString():String{
return ("Tuna");
}
public function onOut(_arg1:MouseEvent):void{
if (((((!((mcRef.getChildByName("mcState") == null))) && (!(Main.instance.gameManager.tutorial)))) && (!(Main.instance.gameManager.special.active)))){
mcState.filters = new Array();
};
}
public function state_plate_out():void{
var _local1:Object;
if (stateComplete){
_local1 = Layout.BoardPlaceHolder;
_local1.slot = iSlot;
Main.instance.gameManager.addPlate(iSlot);
Main.instance.gameManager.addToPlaceHolder(this, sSTATE_PLATE_CUT_IN, Tuna, new mcTuna(), _local1, sSTATE_CUT_IN);
destroy(null);
};
}
public function state_plate_cut_in():void{
if (stateComplete){
setState(sSTATE_PLATE_CUT_IDLE);
};
}
}
}//package gameplay.ingredients.fillings
Section 31
//Cheese (gameplay.ingredients.sauces.Cheese)
package gameplay.ingredients.sauces {
import library.sounds.*;
import flash.events.*;
import flash.display.*;
import library.events.*;
import gameplay.tutorial.*;
import gameplay.special.*;
import library.basic.*;
import library.interfaces.*;
import gameplay.layout.*;
import flash.filters.*;
public class Cheese extends StateManaged implements Idestroyable {
private var sType:String;
private var bPoured:Boolean;
public static const sSTATE_IN:String = "in";
public static const sSTATE_POUR_IN:String = "pour_in";
public static const sSTATE_POURED_DEL:String = "poured_del";
public static const sSTATE_POUR_DEL:String = "pour_del";
public static const sSTATE_DEL:String = "del";
public static const sSTATE_OUT:String = "out";
public static const sSTATE_IDLE:String = "idle";
public static const sSTATE_POUR_IDLE:String = "pour_idle";
public static const sSTATE_NONE:String = "none";
public static const sSTATE_POUR_OUT:String = "pour_out";
public static const sSTATE_POURED:String = "poured";
public function Cheese(_arg1:MovieClip, _arg2:Object, _arg3:String=null, _arg4:Boolean=false, _arg5:Boolean=false):void{
super(_arg1);
sType = "sauce";
bPoured = _arg5;
mcRef.x = _arg2.x;
mcRef.y = _arg2.y;
mcRef.scaleX = (mcRef.scaleY = _arg2.scale);
addState(sSTATE_IDLE, null);
addState(sSTATE_IN, state_in);
addState(sSTATE_OUT, state_out);
addState(sSTATE_POUR_IDLE, null, state_pour_idle_init);
addState(sSTATE_POUR_IN, state_pour_in);
addState(sSTATE_POUR_OUT, state_pour_out);
addState(sSTATE_POURED, null, state_poured_init);
addState(sSTATE_NONE, null);
addState(sSTATE_DEL, state_del);
addState(sSTATE_POUR_DEL, state_del);
addState(sSTATE_POURED_DEL, state_del);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, resume, false, 0, true);
mcRef.addEventListener(MouseEvent.MOUSE_OVER, onOver, false, 0, true);
mcRef.addEventListener(MouseEvent.MOUSE_OUT, onOut, false, 0, true);
mcRef.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
if (_arg3 != null){
setState(_arg3);
mcRef.mouseChildren = false;
mcRef.mouseEnabled = false;
} else {
setState(sSTATE_IN);
};
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY_INGREDIENTS, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_CUT, pour, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_PAUSE, pause, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_RESUME, resume, false);
if (mcRef != null){
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
mcRef.removeEventListener(MouseEvent.MOUSE_OVER, onOver, false);
mcRef.removeEventListener(MouseEvent.MOUSE_OUT, onOut, false);
if (((!((mcRef == null))) && (!((mcRef.parent.getChildByName(mcRef.name) == null))))){
mcRef.parent.removeChild(mcRef);
mcRef = null;
};
};
}
public function deleteIt():void{
if (mcRef != null){
switch (state){
case sSTATE_IN:
case sSTATE_IDLE:
case sSTATE_OUT:
setState(sSTATE_DEL);
break;
case sSTATE_POUR_IN:
case sSTATE_POUR_IDLE:
case sSTATE_POUR_OUT:
setState(sSTATE_POUR_DEL);
break;
case sSTATE_POURED:
setState(sSTATE_POURED_DEL);
break;
};
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
} else {
destroy(null);
};
}
public function state_in():void{
if (stateComplete){
setState(sSTATE_IDLE);
};
}
public function set poured(_arg1:Boolean):void{
bPoured = _arg1;
}
public function state_pour_out():void{
if (stateComplete){
setState(sSTATE_POURED);
Main.instance.gameManager.returnToIngredient();
};
}
public function state_out():void{
if (stateComplete){
setState(sSTATE_NONE);
Main.instance.gameManager.addToPlaceHolder(this, sSTATE_IN, Cheese, new mcCheese(), Layout.MatPlaceHolder, sSTATE_POUR_IN);
};
}
public function onOver(_arg1:MouseEvent):void{
var _local2:Function;
var _local3:GlowFilter;
_local2 = Main.instance.gameManager.instruction.authorize;
if (((((((_local2(sType)) && (!((mcRef.getChildByName("mcState") == null))))) && (!(Main.instance.gameManager.tutorial)))) && (!(Main.instance.gameManager.special.active)))){
_local3 = new GlowFilter(0, 1, 2, 2, 8);
mcState.filters = new Array(_local3);
};
}
public function pour(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_CUT, pour, false);
SoundEngine.Play(Main.sSOUND_SFX, SoundList.sSOUND_POUR_CHEESE);
setState(sSTATE_POUR_OUT);
}
public function state_del():void{
if (stateComplete){
destroy(null);
};
}
public function state_pour_idle_init():void{
Main.instance.gameManager.addEventListener(GameEvent.EVENT_CUT, pour, false, 0, true);
if (Main.instance.gameManager.special.active){
Main.instance.gameManager.dispatchEvent(new SequenceEvent(SequenceEvent.POSITIVE, Layout.MatPlaceHolder, 1));
} else {
Main.instance.gameManager.startMiniGame(toString());
};
}
public function state_pour_in():void{
if (stateComplete){
setState(sSTATE_POUR_IDLE);
};
}
public function onClick(_arg1:MouseEvent):void{
if (((Main.instance.gameManager.instruction.authorize(sType)) && (((((!((_arg1 == null))) && (!(Main.instance.gameManager.special.active)))) || ((((_arg1 == null)) && (Main.instance.gameManager.special.active))))))){
if ((((state == sSTATE_IDLE)) && ((Main.instance.gameManager.selectedIngredient == null)))){
Main.instance.gameManager.selectedIngredient = this;
Main.instance.gameManager.started = true;
Main.instance.gameManager.dispatchEvent(new TutEvent(TutEvent.sEVENT_CLICK, mcRef));
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
setState(sSTATE_OUT);
Main.instance.gameManager.dispatchEvent(new Event(Special.WORKING));
};
};
onOut(null);
}
public function toString():String{
return ("Cheese");
}
public function onOut(_arg1:MouseEvent):void{
if (((((!((mcRef.getChildByName("mcState") == null))) && (!(Main.instance.gameManager.tutorial)))) && (!(Main.instance.gameManager.special.active)))){
mcState.filters = new Array();
};
}
public function state_poured_init():void{
Main.instance.gameManager.dispatchEvent(new IngredientEvent(IngredientEvent.EVENT_DONE, sType));
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY_INGREDIENTS, destroy, false, 0, true);
Main.instance.gameManager.dispatchEvent(new Event(Special.NEXT));
}
public function get poured():Boolean{
return (bPoured);
}
public function get type():String{
return (sType);
}
}
}//package gameplay.ingredients.sauces
Section 32
//Mayonnaise (gameplay.ingredients.sauces.Mayonnaise)
package gameplay.ingredients.sauces {
import library.sounds.*;
import flash.events.*;
import flash.display.*;
import library.events.*;
import gameplay.tutorial.*;
import gameplay.special.*;
import library.basic.*;
import library.interfaces.*;
import gameplay.layout.*;
import flash.filters.*;
public class Mayonnaise extends StateManaged implements Idestroyable {
private var sType:String;
private var bPoured:Boolean;
public static const sSTATE_IN:String = "in";
public static const sSTATE_POUR_IN:String = "pour_in";
public static const sSTATE_POURED_DEL:String = "poured_del";
public static const sSTATE_POUR_DEL:String = "pour_del";
public static const sSTATE_DEL:String = "del";
public static const sSTATE_OUT:String = "out";
public static const sSTATE_IDLE:String = "idle";
public static const sSTATE_POUR_IDLE:String = "pour_idle";
public static const sSTATE_NONE:String = "none";
public static const sSTATE_POUR_OUT:String = "pour_out";
public static const sSTATE_POURED:String = "poured";
public function Mayonnaise(_arg1:MovieClip, _arg2:Object, _arg3:String=null, _arg4:Boolean=false, _arg5:Boolean=false):void{
super(_arg1);
sType = "sauce";
bPoured = _arg5;
mcRef.x = _arg2.x;
mcRef.y = _arg2.y;
mcRef.scaleX = (mcRef.scaleY = _arg2.scale);
addState(sSTATE_IDLE, null);
addState(sSTATE_IN, state_in);
addState(sSTATE_OUT, state_out);
addState(sSTATE_POUR_IDLE, null, state_pour_idle_init);
addState(sSTATE_POUR_IN, state_pour_in);
addState(sSTATE_POUR_OUT, state_pour_out);
addState(sSTATE_POURED, null, state_poured_init);
addState(sSTATE_NONE, null);
addState(sSTATE_DEL, state_del);
addState(sSTATE_POUR_DEL, state_del);
addState(sSTATE_POURED_DEL, state_del);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, resume, false, 0, true);
mcRef.addEventListener(MouseEvent.MOUSE_OVER, onOver, false, 0, true);
mcRef.addEventListener(MouseEvent.MOUSE_OUT, onOut, false, 0, true);
mcRef.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
if (_arg3 != null){
setState(_arg3);
mcRef.mouseChildren = false;
mcRef.mouseEnabled = false;
} else {
setState(sSTATE_IN);
};
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY_INGREDIENTS, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_CUT, pour, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_PAUSE, pause, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_RESUME, resume, false);
if (mcRef != null){
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
mcRef.removeEventListener(MouseEvent.MOUSE_OVER, onOver, false);
mcRef.removeEventListener(MouseEvent.MOUSE_OUT, onOut, false);
if (((!((mcRef == null))) && (!((mcRef.parent.getChildByName(mcRef.name) == null))))){
mcRef.parent.removeChild(mcRef);
mcRef = null;
};
};
}
public function deleteIt():void{
if (mcRef != null){
switch (state){
case sSTATE_IN:
case sSTATE_IDLE:
case sSTATE_OUT:
setState(sSTATE_DEL);
break;
case sSTATE_POUR_IN:
case sSTATE_POUR_IDLE:
case sSTATE_POUR_OUT:
setState(sSTATE_POUR_DEL);
break;
case sSTATE_POURED:
setState(sSTATE_POURED_DEL);
break;
};
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
};
}
public function state_in():void{
if (stateComplete){
setState(sSTATE_IDLE);
};
}
public function set poured(_arg1:Boolean):void{
bPoured = _arg1;
}
public function state_pour_out():void{
if (stateComplete){
setState(sSTATE_POURED);
Main.instance.gameManager.returnToIngredient();
};
}
public function state_out():void{
if (stateComplete){
setState(sSTATE_NONE);
Main.instance.gameManager.addToPlaceHolder(this, sSTATE_IN, Mayonnaise, new mcMayonnaise(), Layout.MatPlaceHolder, sSTATE_POUR_IN);
};
}
public function onOver(_arg1:MouseEvent):void{
var _local2:Function;
var _local3:GlowFilter;
_local2 = Main.instance.gameManager.instruction.authorize;
if (((((((_local2(sType)) && (!((mcRef.getChildByName("mcState") == null))))) && (!(Main.instance.gameManager.tutorial)))) && (!(Main.instance.gameManager.special.active)))){
_local3 = new GlowFilter(0, 1, 2, 2, 8);
mcState.filters = new Array(_local3);
};
}
public function pour(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_CUT, pour, false);
SoundEngine.Play(Main.sSOUND_SFX, SoundList.sSOUND_POUR_MAYONNAISE);
setState(sSTATE_POUR_OUT);
}
public function state_del():void{
if (stateComplete){
destroy(null);
};
}
public function state_pour_idle_init():void{
Main.instance.gameManager.addEventListener(GameEvent.EVENT_CUT, pour, false, 0, true);
if (Main.instance.gameManager.special.active){
Main.instance.gameManager.dispatchEvent(new SequenceEvent(SequenceEvent.POSITIVE, Layout.MatPlaceHolder, 1));
} else {
Main.instance.gameManager.startMiniGame(toString());
};
}
public function state_pour_in():void{
if (stateComplete){
setState(sSTATE_POUR_IDLE);
};
}
public function onClick(_arg1:MouseEvent):void{
if (((Main.instance.gameManager.instruction.authorize(sType)) && (((((!((_arg1 == null))) && (!(Main.instance.gameManager.special.active)))) || ((((_arg1 == null)) && (Main.instance.gameManager.special.active))))))){
if ((((state == sSTATE_IDLE)) && ((Main.instance.gameManager.selectedIngredient == null)))){
Main.instance.gameManager.selectedIngredient = this;
Main.instance.gameManager.started = true;
Main.instance.gameManager.dispatchEvent(new TutEvent(TutEvent.sEVENT_CLICK, mcRef));
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
setState(sSTATE_OUT);
Main.instance.gameManager.dispatchEvent(new Event(Special.WORKING));
};
};
onOut(null);
}
public function toString():String{
return ("Mayonnaise");
}
public function onOut(_arg1:MouseEvent):void{
if (((((!((mcRef.getChildByName("mcState") == null))) && (!(Main.instance.gameManager.tutorial)))) && (!(Main.instance.gameManager.special.active)))){
mcState.filters = new Array();
};
}
public function state_poured_init():void{
Main.instance.gameManager.dispatchEvent(new IngredientEvent(IngredientEvent.EVENT_DONE, sType));
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY_INGREDIENTS, destroy, false, 0, true);
Main.instance.gameManager.dispatchEvent(new Event(Special.NEXT));
}
public function get poured():Boolean{
return (bPoured);
}
public function get type():String{
return (sType);
}
}
}//package gameplay.ingredients.sauces
Section 33
//Teriyaki (gameplay.ingredients.sauces.Teriyaki)
package gameplay.ingredients.sauces {
import library.sounds.*;
import flash.events.*;
import flash.display.*;
import library.events.*;
import gameplay.tutorial.*;
import gameplay.special.*;
import library.basic.*;
import library.interfaces.*;
import gameplay.layout.*;
import flash.filters.*;
public class Teriyaki extends StateManaged implements Idestroyable {
private var sType:String;
private var bPoured:Boolean;
public static const sSTATE_IN:String = "in";
public static const sSTATE_POUR_IN:String = "pour_in";
public static const sSTATE_POURED_DEL:String = "poured_del";
public static const sSTATE_POUR_DEL:String = "pour_del";
public static const sSTATE_DEL:String = "del";
public static const sSTATE_OUT:String = "out";
public static const sSTATE_IDLE:String = "idle";
public static const sSTATE_POUR_IDLE:String = "pour_idle";
public static const sSTATE_NONE:String = "none";
public static const sSTATE_POUR_OUT:String = "pour_out";
public static const sSTATE_POURED:String = "poured";
public function Teriyaki(_arg1:MovieClip, _arg2:Object, _arg3:String=null, _arg4:Boolean=false, _arg5:Boolean=false):void{
super(_arg1);
sType = "sauce";
bPoured = _arg5;
mcRef.x = _arg2.x;
mcRef.y = _arg2.y;
mcRef.scaleX = (mcRef.scaleY = _arg2.scale);
addState(sSTATE_IDLE, null);
addState(sSTATE_IN, state_in);
addState(sSTATE_OUT, state_out);
addState(sSTATE_POUR_IDLE, null, state_pour_idle_init);
addState(sSTATE_POUR_IN, state_pour_in);
addState(sSTATE_POUR_OUT, state_pour_out);
addState(sSTATE_POURED, null, state_poured_init);
addState(sSTATE_NONE, null);
addState(sSTATE_DEL, state_del);
addState(sSTATE_POUR_DEL, state_del);
addState(sSTATE_POURED_DEL, state_del);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, resume, false, 0, true);
mcRef.addEventListener(MouseEvent.MOUSE_OVER, onOver, false, 0, true);
mcRef.addEventListener(MouseEvent.MOUSE_OUT, onOut, false, 0, true);
mcRef.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
if (_arg3 != null){
setState(_arg3);
mcRef.mouseChildren = false;
mcRef.mouseEnabled = false;
} else {
setState(sSTATE_IN);
};
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY_INGREDIENTS, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_PAUSE, pause, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_RESUME, resume, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_CUT, pour, false);
if (mcRef != null){
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
mcRef.removeEventListener(MouseEvent.MOUSE_OVER, onOver, false);
mcRef.removeEventListener(MouseEvent.MOUSE_OUT, onOut, false);
if (((!((mcRef == null))) && (!((mcRef.parent.getChildByName(mcRef.name) == null))))){
mcRef.parent.removeChild(mcRef);
mcRef = null;
};
};
}
public function deleteIt():void{
if (mcRef != null){
switch (state){
case sSTATE_IN:
case sSTATE_IDLE:
case sSTATE_OUT:
setState(sSTATE_DEL);
break;
case sSTATE_POUR_IN:
case sSTATE_POUR_IDLE:
case sSTATE_POUR_OUT:
setState(sSTATE_POUR_DEL);
break;
case sSTATE_POURED:
setState(sSTATE_POURED_DEL);
break;
};
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
} else {
destroy(null);
};
}
public function state_in():void{
if (stateComplete){
setState(sSTATE_IDLE);
};
}
public function set poured(_arg1:Boolean):void{
bPoured = _arg1;
}
public function state_pour_out():void{
if (stateComplete){
setState(sSTATE_POURED);
Main.instance.gameManager.returnToIngredient();
};
}
public function state_out():void{
if (stateComplete){
setState(sSTATE_NONE);
Main.instance.gameManager.addToPlaceHolder(this, sSTATE_IN, Teriyaki, new mcTeriyaki(), Layout.MatPlaceHolder, sSTATE_POUR_IN);
};
}
public function onOver(_arg1:MouseEvent):void{
var _local2:Function;
var _local3:GlowFilter;
_local2 = Main.instance.gameManager.instruction.authorize;
if (((((((_local2(sType)) && (!((mcRef.getChildByName("mcState") == null))))) && (!(Main.instance.gameManager.tutorial)))) && (!(Main.instance.gameManager.special.active)))){
_local3 = new GlowFilter(0, 1, 2, 2, 8);
mcState.filters = new Array(_local3);
};
}
public function pour(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_CUT, pour, false);
SoundEngine.Play(Main.sSOUND_SFX, SoundList.sSOUND_POUR_TERIYAKI);
setState(sSTATE_POUR_OUT);
}
public function state_del():void{
if (stateComplete){
destroy(null);
};
}
public function state_pour_idle_init():void{
Main.instance.gameManager.addEventListener(GameEvent.EVENT_CUT, pour, false, 0, true);
if (Main.instance.gameManager.special.active){
Main.instance.gameManager.dispatchEvent(new SequenceEvent(SequenceEvent.POSITIVE, Layout.MatPlaceHolder, 1));
} else {
Main.instance.gameManager.startMiniGame(toString());
};
}
public function state_pour_in():void{
if (stateComplete){
setState(sSTATE_POUR_IDLE);
};
}
public function onClick(_arg1:MouseEvent):void{
if (((Main.instance.gameManager.instruction.authorize(sType)) && (((((!((_arg1 == null))) && (!(Main.instance.gameManager.special.active)))) || ((((_arg1 == null)) && (Main.instance.gameManager.special.active))))))){
if ((((state == sSTATE_IDLE)) && ((Main.instance.gameManager.selectedIngredient == null)))){
Main.instance.gameManager.selectedIngredient = this;
Main.instance.gameManager.started = true;
Main.instance.gameManager.dispatchEvent(new TutEvent(TutEvent.sEVENT_CLICK, mcRef));
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
setState(sSTATE_OUT);
Main.instance.gameManager.dispatchEvent(new Event(Special.WORKING));
};
};
onOut(null);
}
public function toString():String{
return ("Teriyaki");
}
public function onOut(_arg1:MouseEvent):void{
if (((((!((mcRef.getChildByName("mcState") == null))) && (!(Main.instance.gameManager.tutorial)))) && (!(Main.instance.gameManager.special.active)))){
mcState.filters = new Array();
};
}
public function state_poured_init():void{
Main.instance.gameManager.dispatchEvent(new IngredientEvent(IngredientEvent.EVENT_DONE, sType));
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY_INGREDIENTS, destroy, false, 0, true);
Main.instance.gameManager.dispatchEvent(new Event(Special.NEXT));
}
public function get poured():Boolean{
return (bPoured);
}
public function get type():String{
return (sType);
}
}
}//package gameplay.ingredients.sauces
Section 34
//Cucumber (gameplay.ingredients.veggies.Cucumber)
package gameplay.ingredients.veggies {
import library.sounds.*;
import flash.events.*;
import flash.display.*;
import library.events.*;
import gameplay.tutorial.*;
import gameplay.special.*;
import library.basic.*;
import library.interfaces.*;
import gameplay.layout.*;
import flash.filters.*;
public class Cucumber extends StateManaged implements Idestroyable {
private var iSlot:int;
private var bPlaced:Boolean;
private var bPrepared:Boolean;
private var sType:String;
public static const sSTATE_CUTTED_OUT:String = "cutted_out";
public static const sSTATE_PLATE_OUT:String = "plate_out";
public static const sSTATE_CUTTED_DEL:String = "cutted_del";
public static const sSTATE_PLATE_CUT_IN:String = "plate_cut_in";
public static const sSTATE_PLATE_IN:String = "plate_in";
public static const sSTATE_PLATE_DEL:String = "plate_del";
public static const sSTATE_CUT_IDLE:String = "cut_idle";
public static const sSTATE_SUSHI_IN:String = "sushi_in";
public static const sSTATE_SUSHI_IDLE:String = "sushi_idle";
public static const sSTATE_CUTTED_IDLE:String = "cutted_idle";
public static const sSTATE_CUT_IN:String = "cut_in";
public static const sSTATE_PLATE_CUT_OUT:String = "plate_cut_out";
public static const sSTATE_CUT_DEL:String = "cut_del";
public static const sSTATE_CUT_OUT:String = "cut_out";
public static const sSTATE_CUTTED_IN:String = "cutted_in";
public static const sSTATE_PLATE_CUT_DEL:String = "plate_cut_del";
public static const sSTATE_NONE:String = "none";
public static const sSTATE_PLATE_CUT_IDLE:String = "plate_cut_idle";
public static const sSTATE_SUSHI_DEL:String = "sushi_del";
public static const sSTATE_PLATE_IDLE:String = "plate_idle";
public function Cucumber(_arg1:MovieClip, _arg2:Object, _arg3:String=null, _arg4:Boolean=false):void{
super(_arg1);
iSlot = _arg2.slot;
sType = "veggies";
bPlaced = false;
bPrepared = false;
mcRef.x = _arg2.x;
mcRef.y = _arg2.y;
mcRef.scaleX = (mcRef.scaleY = _arg2.scale);
addState(sSTATE_CUT_IDLE, null, state_cut_idle_init);
addState(sSTATE_CUT_IN, state_cut_in);
addState(sSTATE_CUT_OUT, state_cut_out);
addState(sSTATE_CUTTED_IDLE, null, state_cutted_idle_init);
addState(sSTATE_CUTTED_IN, state_cutted_in);
addState(sSTATE_CUTTED_OUT, state_cutted_out);
addState(sSTATE_PLATE_CUT_DEL, state_plate_cut_del);
addState(sSTATE_PLATE_CUT_IDLE, null, state_plate_cut_idle);
addState(sSTATE_PLATE_CUT_IN, state_plate_cut_in);
addState(sSTATE_PLATE_CUT_OUT, state_plate_cut_out);
addState(sSTATE_PLATE_DEL, state_plate_del);
addState(sSTATE_PLATE_IDLE, null);
addState(sSTATE_PLATE_IN, state_plate_in);
addState(sSTATE_PLATE_OUT, state_plate_out);
addState(sSTATE_SUSHI_IDLE, null, state_sushi_idle_init);
addState(sSTATE_SUSHI_IN, state_sushi_in);
addState(sSTATE_NONE, null);
addState(sSTATE_CUT_DEL, state_del);
addState(sSTATE_CUTTED_DEL, state_del);
addState(sSTATE_SUSHI_DEL, state_del);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, resume, false, 0, true);
if (_arg3 != null){
setState(_arg3);
} else {
setState(sSTATE_PLATE_IN);
};
if (state == sSTATE_CUT_IN){
Main.instance.gameManager.addEventListener(GameEvent.EVENT_CUT, cut, false, 0, true);
} else {
if ((((state == sSTATE_PLATE_IN)) || ((state == sSTATE_PLATE_CUT_IN)))){
mcRef.addEventListener(MouseEvent.MOUSE_OVER, onOver, false, 0, true);
mcRef.addEventListener(MouseEvent.MOUSE_OUT, onOut, false, 0, true);
mcRef.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
};
};
if ((((state == sSTATE_CUTTED_IN)) || ((state == sSTATE_SUSHI_IN)))){
mcRef.mouseChildren = false;
mcRef.mouseEnabled = false;
};
}
public function state_sushi_idle_init():void{
Main.instance.gameManager.dispatchEvent(new IngredientEvent(IngredientEvent.EVENT_DONE, sType, true));
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY_INGREDIENTS, destroy, false, 0, true);
Main.instance.gameManager.dispatchEvent(new Event(Special.NEXT));
Main.instance.gameManager.clearCurrent();
}
public function state_plate_cut_out():void{
var _local1:Object;
if (stateComplete){
_local1 = Layout.MatPlaceHolder;
_local1.slot = iSlot;
Main.instance.gameManager.addPlate(iSlot);
Main.instance.gameManager.addToPlaceHolder(this, sSTATE_SUSHI_IN, Cucumber, new mcCucumber(), _local1, sSTATE_SUSHI_IN);
destroy(null);
};
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY_INGREDIENTS, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_PAUSE, pause, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_RESUME, resume, false);
if (((!((mcRef == null))) && (!((mcRef.parent.getChildByName(mcRef.name) == null))))){
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
mcRef.removeEventListener(MouseEvent.MOUSE_OVER, onOver, false);
mcRef.removeEventListener(MouseEvent.MOUSE_OUT, onOut, false);
mcRef.parent.removeChild(mcRef);
mcRef = null;
};
}
public function state_cutted_out():void{
if (stateComplete){
Main.instance.gameManager.returnToIngredient(new mcCucumber(), Cucumber, iSlot);
destroy(null);
};
}
public function state_cut_out():void{
if (stateComplete){
setState(sSTATE_CUTTED_IN);
};
}
public function state_plate_cut_idle():void{
bPrepared = true;
Main.instance.gameManager.dispatchEvent(new Event(Special.NEXT));
}
public function state_cut_in():void{
if (stateComplete){
setState(sSTATE_CUT_IDLE);
};
}
public function state_plate_del():void{
if (stateComplete){
destroy(null);
};
}
public function deleteIt():void{
if (mcRef != null){
switch (state){
case sSTATE_CUT_IN:
case sSTATE_CUT_IDLE:
case sSTATE_CUT_OUT:
setState(sSTATE_CUT_DEL);
break;
case sSTATE_CUTTED_IN:
case sSTATE_CUTTED_IDLE:
case sSTATE_CUTTED_OUT:
setState(sSTATE_CUTTED_DEL);
break;
case sSTATE_PLATE_IN:
case sSTATE_PLATE_IDLE:
case sSTATE_PLATE_OUT:
setState(sSTATE_PLATE_DEL);
break;
case sSTATE_PLATE_CUT_IN:
case sSTATE_PLATE_CUT_IDLE:
case sSTATE_PLATE_CUT_OUT:
setState(sSTATE_PLATE_CUT_DEL);
break;
case sSTATE_SUSHI_IN:
case sSTATE_SUSHI_IDLE:
setState(sSTATE_SUSHI_DEL);
break;
};
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
} else {
destroy(null);
};
}
public function state_plate_cut_del():void{
if (stateComplete){
destroy(null);
};
}
public function get placed():Boolean{
return (bPlaced);
}
public function get type():String{
return (sType);
}
public function cut(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_CUT, cut, false);
SoundEngine.Play(Main.sSOUND_SFX, SoundList.sSOUND_KNIFE_CUT_VEGGIES);
setState(sSTATE_CUT_OUT);
}
public function get prepared():Boolean{
return (bPrepared);
}
public function state_cut_idle_init():void{
if (Main.instance.gameManager.special.active){
Main.instance.gameManager.dispatchEvent(new SequenceEvent(SequenceEvent.POSITIVE, Layout.BoardPlaceHolder, 1));
} else {
Main.instance.gameManager.startMiniGame(toString());
};
}
public function onOver(_arg1:MouseEvent):void{
var _local2:Function;
var _local3:GlowFilter;
_local2 = Main.instance.gameManager.instruction.authorize;
if (((((((_local2(sType, ((state == sSTATE_PLATE_CUT_IDLE)) ? true : false)) && (!((mcRef.getChildByName("mcState") == null))))) && (!(Main.instance.gameManager.tutorial)))) && (!(Main.instance.gameManager.special.active)))){
_local3 = new GlowFilter(0, 1, 2, 2, 8);
mcState.filters = new Array(_local3);
};
}
public function state_cutted_idle_init():void{
setState(sSTATE_CUTTED_OUT);
Main.instance.gameManager.dispatchEvent(new IngredientEvent(IngredientEvent.EVENT_DONE, sType));
}
public function state_del():void{
if (stateComplete){
destroy(null);
};
}
public function state_sushi_in():void{
if (stateComplete){
setState(sSTATE_SUSHI_IDLE);
};
}
public function state_plate_in():void{
if (stateComplete){
setState(sSTATE_PLATE_IDLE);
};
}
public function state_cutted_in():void{
if (stateComplete){
setState(sSTATE_CUTTED_IDLE);
};
}
public function onClick(_arg1:MouseEvent):void{
trace(("Cucumber.onClick > _e : " + _arg1));
if ((((((((state == sSTATE_PLATE_IDLE)) && ((Main.instance.gameManager.selectedIngredient == null)))) && (Main.instance.gameManager.instruction.authorize(sType, false, this)))) && (((((!((_arg1 == null))) && (!(Main.instance.gameManager.special.active)))) || ((((_arg1 == null)) && (Main.instance.gameManager.special.active))))))){
Main.instance.gameManager.selectedIngredient = this;
Main.instance.gameManager.started = true;
setState(sSTATE_PLATE_OUT);
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
Main.instance.gameManager.dispatchEvent(new TutEvent(TutEvent.sEVENT_CLICK, mcRef));
Main.instance.gameManager.dispatchEvent(new Event(Special.WORKING));
Main.instance.gameManager.dispatchEvent(new Event(GameEvent.EVENT_ON_CUTBOARD));
} else {
if ((((((((state == sSTATE_PLATE_CUT_IDLE)) && ((Main.instance.gameManager.selectedIngredient == null)))) && (Main.instance.gameManager.instruction.authorize(sType, true, this)))) && (((((!((_arg1 == null))) && (!(Main.instance.gameManager.special.active)))) || ((((_arg1 == null)) && (Main.instance.gameManager.special.active))))))){
Main.instance.gameManager.selectedIngredient = this;
Main.instance.gameManager.started = true;
setState(sSTATE_PLATE_CUT_OUT);
Main.instance.gameManager.dispatchEvent(new TutEvent(TutEvent.sEVENT_CLICK, mcRef));
Main.instance.gameManager.dispatchEvent(new Event(Special.WORKING));
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
};
};
onOut(null);
}
public function toString():String{
return ("Cucumber");
}
public function onOut(_arg1:MouseEvent):void{
if (((((!((mcRef.getChildByName("mcState") == null))) && (!(Main.instance.gameManager.tutorial)))) && (!(Main.instance.gameManager.special.active)))){
mcState.filters = new Array();
};
}
public function state_plate_out():void{
var _local1:Object;
if (stateComplete){
_local1 = Layout.BoardPlaceHolder;
_local1.slot = iSlot;
Main.instance.gameManager.addPlate(iSlot);
Main.instance.gameManager.addToPlaceHolder(this, sSTATE_PLATE_CUT_IN, Cucumber, new mcCucumber(), _local1, sSTATE_CUT_IN);
destroy(null);
};
}
public function state_plate_cut_in():void{
if (stateComplete){
setState(sSTATE_PLATE_CUT_IDLE);
};
}
}
}//package gameplay.ingredients.veggies
Section 35
//Daikon (gameplay.ingredients.veggies.Daikon)
package gameplay.ingredients.veggies {
import library.sounds.*;
import flash.events.*;
import flash.display.*;
import library.events.*;
import gameplay.tutorial.*;
import gameplay.special.*;
import library.basic.*;
import library.interfaces.*;
import gameplay.layout.*;
import flash.filters.*;
public class Daikon extends StateManaged implements Idestroyable {
private var iSlot:int;
private var bPlaced:Boolean;
private var bPrepared:Boolean;
private var sType:String;
public static const sSTATE_CUTTED_OUT:String = "cutted_out";
public static const sSTATE_PLATE_OUT:String = "plate_out";
public static const sSTATE_CUTTED_DEL:String = "cutted_del";
public static const sSTATE_PLATE_CUT_IN:String = "plate_cut_in";
public static const sSTATE_PLATE_IN:String = "plate_in";
public static const sSTATE_PLATE_DEL:String = "plate_del";
public static const sSTATE_CUT_IDLE:String = "cut_idle";
public static const sSTATE_SUSHI_IN:String = "sushi_in";
public static const sSTATE_SUSHI_IDLE:String = "sushi_idle";
public static const sSTATE_CUTTED_IDLE:String = "cutted_idle";
public static const sSTATE_CUT_IN:String = "cut_in";
public static const sSTATE_PLATE_CUT_OUT:String = "plate_cut_out";
public static const sSTATE_CUT_DEL:String = "cut_del";
public static const sSTATE_CUT_OUT:String = "cut_out";
public static const sSTATE_CUTTED_IN:String = "cutted_in";
public static const sSTATE_PLATE_CUT_DEL:String = "plate_cut_del";
public static const sSTATE_NONE:String = "none";
public static const sSTATE_PLATE_CUT_IDLE:String = "plate_cut_idle";
public static const sSTATE_SUSHI_DEL:String = "sushi_del";
public static const sSTATE_PLATE_IDLE:String = "plate_idle";
public function Daikon(_arg1:MovieClip, _arg2:Object, _arg3:String=null, _arg4:Boolean=false):void{
super(_arg1);
iSlot = _arg2.slot;
sType = "veggies";
bPlaced = false;
bPrepared = false;
mcRef.x = _arg2.x;
mcRef.y = _arg2.y;
mcRef.scaleX = (mcRef.scaleY = _arg2.scale);
addState(sSTATE_CUT_IDLE, null, state_cut_idle_init);
addState(sSTATE_CUT_IN, state_cut_in);
addState(sSTATE_CUT_OUT, state_cut_out);
addState(sSTATE_CUTTED_IDLE, null, state_cutted_idle_init);
addState(sSTATE_CUTTED_IN, state_cutted_in);
addState(sSTATE_CUTTED_OUT, state_cutted_out);
addState(sSTATE_PLATE_CUT_DEL, state_plate_cut_del);
addState(sSTATE_PLATE_CUT_IDLE, null, state_plate_cut_idle);
addState(sSTATE_PLATE_CUT_IN, state_plate_cut_in);
addState(sSTATE_PLATE_CUT_OUT, state_plate_cut_out);
addState(sSTATE_PLATE_DEL, state_plate_del);
addState(sSTATE_PLATE_IDLE, null);
addState(sSTATE_PLATE_IN, state_plate_in);
addState(sSTATE_PLATE_OUT, state_plate_out);
addState(sSTATE_SUSHI_IDLE, null, state_sushi_idle_init);
addState(sSTATE_SUSHI_IN, state_sushi_in);
addState(sSTATE_NONE, null);
addState(sSTATE_CUT_DEL, state_del);
addState(sSTATE_CUTTED_DEL, state_del);
addState(sSTATE_SUSHI_DEL, state_del);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, resume, false, 0, true);
if (_arg3 != null){
setState(_arg3);
} else {
setState(sSTATE_PLATE_IN);
};
if (state == sSTATE_CUT_IN){
Main.instance.gameManager.addEventListener(GameEvent.EVENT_CUT, cut, false, 0, true);
} else {
if ((((state == sSTATE_PLATE_IN)) || ((state == sSTATE_PLATE_CUT_IN)))){
mcRef.addEventListener(MouseEvent.MOUSE_OVER, onOver, false, 0, true);
mcRef.addEventListener(MouseEvent.MOUSE_OUT, onOut, false, 0, true);
mcRef.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
};
};
if ((((state == sSTATE_CUTTED_IN)) || ((state == sSTATE_SUSHI_IN)))){
mcRef.mouseChildren = false;
mcRef.mouseEnabled = false;
};
}
public function state_sushi_idle_init():void{
Main.instance.gameManager.dispatchEvent(new IngredientEvent(IngredientEvent.EVENT_DONE, sType, true));
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY_INGREDIENTS, destroy, false, 0, true);
Main.instance.gameManager.dispatchEvent(new Event(Special.NEXT));
Main.instance.gameManager.clearCurrent();
}
public function state_plate_cut_out():void{
var _local1:Object;
if (stateComplete){
_local1 = Layout.MatPlaceHolder;
_local1.slot = iSlot;
Main.instance.gameManager.addPlate(iSlot);
Main.instance.gameManager.addToPlaceHolder(this, sSTATE_SUSHI_IN, Daikon, new mcDaikon(), _local1, sSTATE_SUSHI_IN);
destroy(null);
};
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY_INGREDIENTS, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_PAUSE, pause, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_RESUME, resume, false);
if (mcRef != null){
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
mcRef.removeEventListener(MouseEvent.MOUSE_OVER, onOver, false);
mcRef.removeEventListener(MouseEvent.MOUSE_OUT, onOut, false);
if (((!((mcRef == null))) && (!((mcRef.parent.getChildByName(mcRef.name) == null))))){
mcRef.parent.removeChild(mcRef);
mcRef = null;
};
};
}
public function state_cutted_out():void{
if (stateComplete){
Main.instance.gameManager.returnToIngredient(new mcDaikon(), Daikon, iSlot);
destroy(null);
};
}
public function state_cut_out():void{
if (stateComplete){
setState(sSTATE_CUTTED_IN);
};
}
public function state_plate_cut_idle():void{
bPrepared = true;
Main.instance.gameManager.dispatchEvent(new Event(Special.NEXT));
}
public function state_cut_in():void{
if (stateComplete){
setState(sSTATE_CUT_IDLE);
};
}
public function state_plate_del():void{
if (stateComplete){
destroy(null);
};
}
public function deleteIt():void{
if (mcRef != null){
switch (state){
case sSTATE_CUT_IN:
case sSTATE_CUT_IDLE:
case sSTATE_CUT_OUT:
setState(sSTATE_CUT_DEL);
break;
case sSTATE_CUTTED_IN:
case sSTATE_CUTTED_IDLE:
case sSTATE_CUTTED_OUT:
setState(sSTATE_CUTTED_DEL);
break;
case sSTATE_PLATE_IN:
case sSTATE_PLATE_IDLE:
case sSTATE_PLATE_OUT:
setState(sSTATE_PLATE_DEL);
break;
case sSTATE_PLATE_CUT_IN:
case sSTATE_PLATE_CUT_IDLE:
case sSTATE_PLATE_CUT_OUT:
setState(sSTATE_PLATE_CUT_DEL);
break;
case sSTATE_SUSHI_IN:
case sSTATE_SUSHI_IDLE:
setState(sSTATE_SUSHI_DEL);
break;
};
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
} else {
destroy(null);
};
}
public function state_plate_cut_del():void{
if (stateComplete){
destroy(null);
};
}
public function get placed():Boolean{
return (bPlaced);
}
public function get type():String{
return (sType);
}
public function cut(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_CUT, cut, false);
SoundEngine.Play(Main.sSOUND_SFX, SoundList.sSOUND_KNIFE_CUT_VEGGIES);
setState(sSTATE_CUT_OUT);
}
public function get prepared():Boolean{
return (bPrepared);
}
public function state_cut_idle_init():void{
if (Main.instance.gameManager.special.active){
Main.instance.gameManager.dispatchEvent(new SequenceEvent(SequenceEvent.POSITIVE, Layout.BoardPlaceHolder, 1));
} else {
Main.instance.gameManager.startMiniGame(toString());
};
}
public function onOver(_arg1:MouseEvent):void{
var _local2:Function;
var _local3:GlowFilter;
_local2 = Main.instance.gameManager.instruction.authorize;
if (((((((_local2(sType, ((state == sSTATE_PLATE_CUT_IDLE)) ? true : false)) && (!((mcRef.getChildByName("mcState") == null))))) && (!(Main.instance.gameManager.tutorial)))) && (!(Main.instance.gameManager.special.active)))){
_local3 = new GlowFilter(0, 1, 2, 2, 8);
mcState.filters = new Array(_local3);
};
}
public function state_cutted_idle_init():void{
setState(sSTATE_CUTTED_OUT);
Main.instance.gameManager.dispatchEvent(new IngredientEvent(IngredientEvent.EVENT_DONE, sType));
}
public function state_del():void{
if (stateComplete){
destroy(null);
};
}
public function state_sushi_in():void{
if (stateComplete){
setState(sSTATE_SUSHI_IDLE);
};
}
public function state_plate_in():void{
if (stateComplete){
setState(sSTATE_PLATE_IDLE);
};
}
public function state_cutted_in():void{
if (stateComplete){
setState(sSTATE_CUTTED_IDLE);
};
}
public function onClick(_arg1:MouseEvent):void{
trace(("Daikon.onClick > _e : " + _arg1));
if ((((((((state == sSTATE_PLATE_IDLE)) && ((Main.instance.gameManager.selectedIngredient == null)))) && (Main.instance.gameManager.instruction.authorize(sType, false, this)))) && (((((!((_arg1 == null))) && (!(Main.instance.gameManager.special.active)))) || ((((_arg1 == null)) && (Main.instance.gameManager.special.active))))))){
Main.instance.gameManager.selectedIngredient = this;
Main.instance.gameManager.started = true;
setState(sSTATE_PLATE_OUT);
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
Main.instance.gameManager.dispatchEvent(new TutEvent(TutEvent.sEVENT_CLICK, mcRef));
Main.instance.gameManager.dispatchEvent(new Event(Special.WORKING));
Main.instance.gameManager.dispatchEvent(new Event(GameEvent.EVENT_ON_CUTBOARD));
} else {
if ((((((((state == sSTATE_PLATE_CUT_IDLE)) && ((Main.instance.gameManager.selectedIngredient == null)))) && (Main.instance.gameManager.instruction.authorize(sType, true, this)))) && (((((!((_arg1 == null))) && (!(Main.instance.gameManager.special.active)))) || ((((_arg1 == null)) && (Main.instance.gameManager.special.active))))))){
Main.instance.gameManager.selectedIngredient = this;
Main.instance.gameManager.started = true;
setState(sSTATE_PLATE_CUT_OUT);
Main.instance.gameManager.dispatchEvent(new TutEvent(TutEvent.sEVENT_CLICK, mcRef));
Main.instance.gameManager.dispatchEvent(new Event(Special.WORKING));
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
};
};
onOut(null);
}
public function toString():String{
return ("Daikon");
}
public function onOut(_arg1:MouseEvent):void{
if (((((!((mcRef.getChildByName("mcState") == null))) && (!(Main.instance.gameManager.tutorial)))) && (!(Main.instance.gameManager.special.active)))){
mcState.filters = new Array();
};
}
public function state_plate_out():void{
var _local1:Object;
if (stateComplete){
_local1 = Layout.BoardPlaceHolder;
_local1.slot = iSlot;
Main.instance.gameManager.addPlate(iSlot);
Main.instance.gameManager.addToPlaceHolder(this, sSTATE_PLATE_CUT_IN, Daikon, new mcDaikon(), _local1, sSTATE_CUT_IN);
destroy(null);
};
}
public function state_plate_cut_in():void{
if (stateComplete){
setState(sSTATE_PLATE_CUT_IDLE);
};
}
}
}//package gameplay.ingredients.veggies
Section 36
//Onion (gameplay.ingredients.veggies.Onion)
package gameplay.ingredients.veggies {
import library.sounds.*;
import flash.events.*;
import flash.display.*;
import library.events.*;
import gameplay.tutorial.*;
import gameplay.special.*;
import library.basic.*;
import library.interfaces.*;
import gameplay.layout.*;
import flash.filters.*;
public class Onion extends StateManaged implements Idestroyable {
private var iSlot:int;
private var bPlaced:Boolean;
private var bPrepared:Boolean;
private var sType:String;
public static const sSTATE_CUTTED_OUT:String = "cutted_out";
public static const sSTATE_PLATE_OUT:String = "plate_out";
public static const sSTATE_CUTTED_DEL:String = "cutted_del";
public static const sSTATE_PLATE_CUT_IN:String = "plate_cut_in";
public static const sSTATE_PLATE_IN:String = "plate_in";
public static const sSTATE_PLATE_DEL:String = "plate_del";
public static const sSTATE_CUT_IDLE:String = "cut_idle";
public static const sSTATE_SUSHI_IN:String = "sushi_in";
public static const sSTATE_SUSHI_IDLE:String = "sushi_idle";
public static const sSTATE_CUTTED_IDLE:String = "cutted_idle";
public static const sSTATE_CUT_IN:String = "cut_in";
public static const sSTATE_PLATE_CUT_OUT:String = "plate_cut_out";
public static const sSTATE_CUT_DEL:String = "cut_del";
public static const sSTATE_CUT_OUT:String = "cut_out";
public static const sSTATE_CUTTED_IN:String = "cutted_in";
public static const sSTATE_PLATE_CUT_DEL:String = "plate_cut_del";
public static const sSTATE_NONE:String = "none";
public static const sSTATE_PLATE_CUT_IDLE:String = "plate_cut_idle";
public static const sSTATE_SUSHI_DEL:String = "sushi_del";
public static const sSTATE_PLATE_IDLE:String = "plate_idle";
public function Onion(_arg1:MovieClip, _arg2:Object, _arg3:String=null, _arg4:Boolean=false):void{
super(_arg1);
iSlot = _arg2.slot;
sType = "veggies";
bPlaced = false;
bPrepared = false;
mcRef.x = _arg2.x;
mcRef.y = _arg2.y;
mcRef.scaleX = (mcRef.scaleY = _arg2.scale);
addState(sSTATE_CUT_IDLE, null, state_cut_idle_init);
addState(sSTATE_CUT_IN, state_cut_in);
addState(sSTATE_CUT_OUT, state_cut_out);
addState(sSTATE_CUTTED_IDLE, null, state_cutted_idle_init);
addState(sSTATE_CUTTED_IN, state_cutted_in);
addState(sSTATE_CUTTED_OUT, state_cutted_out);
addState(sSTATE_NONE, null);
addState(sSTATE_PLATE_CUT_DEL, state_plate_cut_del);
addState(sSTATE_PLATE_CUT_IDLE, null, state_plate_cut_idle);
addState(sSTATE_PLATE_CUT_IN, state_plate_cut_in);
addState(sSTATE_PLATE_CUT_OUT, state_plate_cut_out);
addState(sSTATE_PLATE_DEL, state_plate_del);
addState(sSTATE_PLATE_IDLE, null);
addState(sSTATE_PLATE_IN, state_plate_in);
addState(sSTATE_PLATE_OUT, state_plate_out);
addState(sSTATE_SUSHI_IDLE, null, state_sushi_idle_init);
addState(sSTATE_SUSHI_IN, state_sushi_in);
addState(sSTATE_CUT_DEL, state_del);
addState(sSTATE_CUTTED_DEL, state_del);
addState(sSTATE_SUSHI_DEL, state_del);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, resume, false, 0, true);
if (_arg3 != null){
setState(_arg3);
} else {
setState(sSTATE_PLATE_IN);
};
if (state == sSTATE_CUT_IN){
Main.instance.gameManager.addEventListener(GameEvent.EVENT_CUT, cut, false, 0, true);
} else {
if ((((state == sSTATE_PLATE_IN)) || ((state == sSTATE_PLATE_CUT_IN)))){
mcRef.addEventListener(MouseEvent.MOUSE_OVER, onOver, false, 0, true);
mcRef.addEventListener(MouseEvent.MOUSE_OUT, onOut, false, 0, true);
mcRef.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
};
};
if ((((state == sSTATE_CUTTED_IN)) || ((state == sSTATE_SUSHI_IN)))){
mcRef.mouseChildren = false;
mcRef.mouseEnabled = false;
};
}
public function state_sushi_idle_init():void{
Main.instance.gameManager.dispatchEvent(new IngredientEvent(IngredientEvent.EVENT_DONE, sType, true));
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY_INGREDIENTS, destroy, false, 0, true);
Main.instance.gameManager.dispatchEvent(new Event(Special.NEXT));
Main.instance.gameManager.clearCurrent();
}
public function state_plate_cut_out():void{
var _local1:Object;
if (stateComplete){
_local1 = Layout.MatPlaceHolder;
_local1.slot = iSlot;
Main.instance.gameManager.addPlate(iSlot);
Main.instance.gameManager.addToPlaceHolder(this, sSTATE_SUSHI_IN, Onion, new mcOnion(), _local1, sSTATE_SUSHI_IN);
destroy(null);
};
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY_INGREDIENTS, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_PAUSE, pause, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_RESUME, resume, false);
if (mcRef != null){
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
mcRef.removeEventListener(MouseEvent.MOUSE_OVER, onOver, false);
mcRef.removeEventListener(MouseEvent.MOUSE_OUT, onOut, false);
if (((!((mcRef == null))) && (!((mcRef.parent.getChildByName(mcRef.name) == null))))){
mcRef.parent.removeChild(mcRef);
mcRef = null;
};
};
}
public function state_cutted_out():void{
if (stateComplete){
Main.instance.gameManager.returnToIngredient(new mcOnion(), Onion, iSlot);
destroy(null);
};
}
public function state_cut_out():void{
if (stateComplete){
setState(sSTATE_CUTTED_IN);
};
}
public function state_plate_cut_idle():void{
bPrepared = true;
Main.instance.gameManager.dispatchEvent(new Event(Special.NEXT));
}
public function state_cut_in():void{
if (stateComplete){
setState(sSTATE_CUT_IDLE);
};
}
public function state_plate_del():void{
if (stateComplete){
destroy(null);
};
}
public function deleteIt():void{
if (mcRef != null){
switch (state){
case sSTATE_CUT_IN:
case sSTATE_CUT_IDLE:
case sSTATE_CUT_OUT:
setState(sSTATE_CUT_DEL);
break;
case sSTATE_CUTTED_IN:
case sSTATE_CUTTED_IDLE:
case sSTATE_CUTTED_OUT:
setState(sSTATE_CUTTED_DEL);
break;
case sSTATE_PLATE_IN:
case sSTATE_PLATE_IDLE:
case sSTATE_PLATE_OUT:
setState(sSTATE_PLATE_DEL);
break;
case sSTATE_PLATE_CUT_IN:
case sSTATE_PLATE_CUT_IDLE:
case sSTATE_PLATE_CUT_OUT:
setState(sSTATE_PLATE_CUT_DEL);
break;
case sSTATE_SUSHI_IN:
case sSTATE_SUSHI_IDLE:
setState(sSTATE_SUSHI_DEL);
break;
};
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
} else {
destroy(null);
};
}
public function state_plate_cut_del():void{
if (stateComplete){
destroy(null);
};
}
public function get placed():Boolean{
return (bPlaced);
}
public function get type():String{
return (sType);
}
public function cut(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_CUT, cut, false);
SoundEngine.Play(Main.sSOUND_SFX, SoundList.sSOUND_KNIFE_CUT_VEGGIES);
setState(sSTATE_CUT_OUT);
}
public function get prepared():Boolean{
return (bPrepared);
}
public function state_cut_idle_init():void{
if (Main.instance.gameManager.special.active){
Main.instance.gameManager.dispatchEvent(new SequenceEvent(SequenceEvent.POSITIVE, Layout.BoardPlaceHolder, 1));
} else {
Main.instance.gameManager.startMiniGame(toString());
};
}
public function onOver(_arg1:MouseEvent):void{
var _local2:Function;
var _local3:GlowFilter;
_local2 = Main.instance.gameManager.instruction.authorize;
if (((((((_local2(sType, ((state == sSTATE_PLATE_CUT_IDLE)) ? true : false)) && (!((mcRef.getChildByName("mcState") == null))))) && (!(Main.instance.gameManager.tutorial)))) && (!(Main.instance.gameManager.special.active)))){
_local3 = new GlowFilter(0, 1, 2, 2, 8);
mcState.filters = new Array(_local3);
};
}
public function state_cutted_idle_init():void{
setState(sSTATE_CUTTED_OUT);
Main.instance.gameManager.dispatchEvent(new IngredientEvent(IngredientEvent.EVENT_DONE, sType));
}
public function state_del():void{
if (stateComplete){
destroy(null);
};
}
public function state_sushi_in():void{
if (stateComplete){
setState(sSTATE_SUSHI_IDLE);
};
}
public function state_plate_in():void{
if (stateComplete){
setState(sSTATE_PLATE_IDLE);
};
}
public function state_cutted_in():void{
if (stateComplete){
setState(sSTATE_CUTTED_IDLE);
};
}
public function onClick(_arg1:MouseEvent):void{
trace(("Onion.onClick > _e : " + _arg1));
if ((((((((state == sSTATE_PLATE_IDLE)) && ((Main.instance.gameManager.selectedIngredient == null)))) && (Main.instance.gameManager.instruction.authorize(sType, false, this)))) && (((((!((_arg1 == null))) && (!(Main.instance.gameManager.special.active)))) || ((((_arg1 == null)) && (Main.instance.gameManager.special.active))))))){
Main.instance.gameManager.selectedIngredient = this;
Main.instance.gameManager.started = true;
setState(sSTATE_PLATE_OUT);
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
Main.instance.gameManager.dispatchEvent(new TutEvent(TutEvent.sEVENT_CLICK, mcRef));
Main.instance.gameManager.dispatchEvent(new Event(Special.WORKING));
Main.instance.gameManager.dispatchEvent(new Event(GameEvent.EVENT_ON_CUTBOARD));
} else {
if ((((((((state == sSTATE_PLATE_CUT_IDLE)) && ((Main.instance.gameManager.selectedIngredient == null)))) && (Main.instance.gameManager.instruction.authorize(sType, true, this)))) && (((((!((_arg1 == null))) && (!(Main.instance.gameManager.special.active)))) || ((((_arg1 == null)) && (Main.instance.gameManager.special.active))))))){
Main.instance.gameManager.selectedIngredient = this;
Main.instance.gameManager.started = true;
setState(sSTATE_PLATE_CUT_OUT);
Main.instance.gameManager.dispatchEvent(new TutEvent(TutEvent.sEVENT_CLICK, mcRef));
Main.instance.gameManager.dispatchEvent(new Event(Special.WORKING));
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
};
};
onOut(null);
}
public function toString():String{
return ("Onion");
}
public function onOut(_arg1:MouseEvent):void{
if (((((!((mcRef.getChildByName("mcState") == null))) && (!(Main.instance.gameManager.tutorial)))) && (!(Main.instance.gameManager.special.active)))){
mcState.filters = new Array();
};
}
public function state_plate_out():void{
var _local1:Object;
if (stateComplete){
_local1 = Layout.BoardPlaceHolder;
_local1.slot = iSlot;
Main.instance.gameManager.addPlate(iSlot);
Main.instance.gameManager.addToPlaceHolder(this, sSTATE_PLATE_CUT_IN, Onion, new mcOnion(), _local1, sSTATE_CUT_IN);
destroy(null);
};
}
public function state_plate_cut_in():void{
if (stateComplete){
setState(sSTATE_PLATE_CUT_IDLE);
};
}
}
}//package gameplay.ingredients.veggies
Section 37
//Plate (gameplay.ingredients.Plate)
package gameplay.ingredients {
import flash.events.*;
import flash.display.*;
import library.events.*;
import library.basic.*;
import library.interfaces.*;
public class Plate extends StateManaged implements Idestroyable {
public static const sSTATE_PLATE_DEL:String = "plate_del";
public static const sSTATE_IDLE:String = "idle";
public static const sSTATE_IN:String = "in";
public function Plate(_arg1:MovieClip, _arg2:Object, _arg3:String="idle"):void{
super(_arg1);
mcRef.x = _arg2.x;
mcRef.y = _arg2.y;
mcRef.scaleX = (mcRef.scaleY = _arg2.scale);
addState(sSTATE_IDLE, null);
addState(sSTATE_IN, state_in);
addState(sSTATE_PLATE_DEL, state_plate_del);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, resume, false, 0, true);
setState(_arg3);
}
public function state_in():void{
if (stateComplete){
setState(sSTATE_IDLE);
};
}
public function state_plate_del():void{
if (stateComplete){
destroy(null);
};
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_PAUSE, pause, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_RESUME, resume, false);
if (mcRef != null){
mcRef.parent.removeChild(mcRef);
mcRef = null;
};
}
public function deleteIt():void{
if (mcRef != null){
setState(sSTATE_PLATE_DEL);
} else {
destroy(null);
};
}
public function get type():String{
return ("plate");
}
}
}//package gameplay.ingredients
Section 38
//Instruct (gameplay.instruct.Instruct)
package gameplay.instruct {
import flash.events.*;
import flash.display.*;
import gameplay.panel.*;
import library.events.*;
import library.utils.*;
import gameplay.*;
import gameplay.hud.*;
import library.interfaces.*;
import gameplay.layout.*;
import gameplay.ingredients.fillings.*;
import gameplay.ingredients.basics.*;
import gameplay.ingredients.veggies.*;
import gameplay.ingredients.sauces.*;
public class Instruct implements Idestroyable {
private var iFillingsPre:int;
private var sWait:String;
private var iRoll:int;
private var iCut:int;
private var iDisplay:int;
private var aDisplay:Array;
private var iVeggiesPre:int;
private var iServe:int;
private var aInstruct:Array;
private var iFillingsPla:int;
private var iAlgae:int;
private var sTodo:String;
private var iRice:int;
private var iPour:int;
private var iVeggiesPla:int;
private var iIndex:int;
private var fWait:Function;
private var bRoll:Boolean;
public function Instruct():void{
fWait = null;
sTodo = null;
aInstruct = new Array();
iDisplay = 0;
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
}
public function done(_arg1:String, _arg2:Boolean=false):void{
switch (_arg1){
case "algae":
iAlgae--;
break;
case "rice":
iRice--;
break;
case "filling":
if (_arg2){
iFillingsPla--;
} else {
iFillingsPre--;
};
break;
case "veggies":
if (_arg2){
iVeggiesPla--;
} else {
iVeggiesPre--;
};
break;
case "sauce":
iPour--;
break;
case "roll":
iRoll--;
break;
case "cut":
iCut--;
break;
case "serve":
iServe--;
break;
};
checkForRoll();
}
protected function filling_prepared():Boolean{
return ((iFillingsPre <= 0));
}
private function stop():void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
}
protected function poured():Boolean{
return ((iPour <= 0));
}
protected function cutted():Boolean{
return ((iCut <= 0));
}
protected function filling_placed():Boolean{
return ((iFillingsPla <= 0));
}
public function next_instruct(_arg1:Event):void{
this[aInstruct[iIndex].func].apply(this, aInstruct[iIndex].param);
}
public function onDone(_arg1:IngredientEvent):void{
done(_arg1.ingredient, _arg1.place);
}
public function setInstructions(_arg1:String):void{
var _sSushi = _arg1;
Main.instance.gameManager.started = false;
iAlgae = 1;
iRice = 1;
iCut = 1;
iFillingsPre = 1;
iFillingsPla = 1;
iRoll = 1;
iCut = 1;
iServe = 1;
switch (_sSushi){
case "sushi01":
Main.instance.gameManager.setIngredients(false, {item:Algae, mc:mcAlgae}, {item:Rice, mc:mcRice}, {item:Egg, mc:mcEgg}, {item:Cucumber, mc:mcCucumber}, {item:Onion, mc:mcOnion});
Main.instance.gameManager.setSauces({item:Teriyaki, mc:mcTeriyaki});
iPour = 1;
iVeggiesPre = 2;
iVeggiesPla = 2;
break;
case "sushi02":
Main.instance.gameManager.setIngredients(false, {item:Algae, mc:mcAlgae}, {item:Rice, mc:mcRice}, {item:Tuna, mc:mcTuna}, {item:Daikon, mc:mcDaikon}, {item:Cucumber, mc:mcCucumber}, {item:Onion, mc:mcOnion});
Main.instance.gameManager.setSauces();
iPour = 0;
iVeggiesPre = 3;
iVeggiesPla = 3;
break;
case "sushi03":
Main.instance.gameManager.setIngredients(false, {item:Algae, mc:mcAlgae}, {item:Rice, mc:mcRice}, {item:Salmon, mc:mcSalmon}, {item:Cucumber, mc:mcCucumber}, {item:Onion, mc:mcOnion});
Main.instance.gameManager.setSauces({item:Cheese, mc:mcCheese});
iPour = 1;
iVeggiesPre = 2;
iVeggiesPla = 2;
break;
case "sushi04":
Main.instance.gameManager.setIngredients(false, {item:Algae, mc:mcAlgae}, {item:Rice, mc:mcRice}, {item:Chicken, mc:mcChicken}, {item:Cucumber, mc:mcCucumber}, {item:Onion, mc:mcOnion});
Main.instance.gameManager.setSauces();
iPour = 0;
iVeggiesPre = 2;
iVeggiesPla = 2;
break;
case "sushi05":
Main.instance.gameManager.setIngredients(false, {item:Algae, mc:mcAlgae}, {item:Rice, mc:mcRice}, {item:Shrimp, mc:mcShrimp}, {item:Daikon, mc:mcDaikon}, {item:Cucumber, mc:mcCucumber}, {item:Onion, mc:mcOnion});
Main.instance.gameManager.setSauces();
iPour = 0;
iVeggiesPre = 3;
iVeggiesPla = 3;
break;
};
bRoll = false;
iIndex = -1;
Main.instance.gameManager.selectedIngredient = null;
aInstruct = new Array();
aDisplay = Main.instance.gameManager.display;
iDisplay = aDisplay.length;
Main.instance.gameManager.mat.reset();
InstructList.list.forEach(function (_arg1){
aInstruct.push(_arg1);
}, this);
Life.instance.setLifeSpan(Math.floor((Config.Starting.Patience - (Config.Difficulty.TimeToDoSushi * Main.instance.gameManager.ai.level))));
start();
}
private function clearInstructs():void{
Life.instance.sendLifeToScore();
Main.instance.gameManager.dispatchEvent(new Event(GameEvent.EVENT_COMPLETE));
}
public function addInstruction(_arg1:String, _arg2, _arg3:MovieClip):void{
switch (_arg1){
case "sauce":
iPour++;
Main.instance.gameManager.addSauce(_arg2, _arg3);
break;
case "filling":
iFillingsPla++;
iFillingsPre++;
Main.instance.gameManager.addIngredient(_arg2, _arg3);
break;
case "veggie":
iVeggiesPla++;
iVeggiesPre++;
Main.instance.gameManager.addIngredient(_arg2, _arg3);
break;
};
}
protected function veggies_placed():Boolean{
return ((iVeggiesPla <= 0));
}
protected function served():Boolean{
return ((iServe <= 0));
}
public function failed():void{
var _local1:int;
Main.instance.gameManager.dispatchEvent(new Event(GameEvent.EVENT_COMPLETE));
Main.instance.gameManager.clearCurrent();
Main.instance.gameManager.clearClickDrawSequence();
Main.instance.gameManager.clearKnife();
Main.instance.gameManager.setIngredients(true);
Main.instance.gameManager.setSauces();
Main.instance.gameManager.clearPlaceHolder();
Main.instance.gameManager.selectedIngredient = null;
_local1 = 0;
while (_local1 < aDisplay.length) {
if (aDisplay[_local1].mcRef != null){
aDisplay[_local1].goToOut();
};
_local1++;
};
destroy(null);
}
private function checkForRoll():void{
if (!bRoll){
if (authorize("roll")){
bRoll = true;
if (Main.instance.gameManager.special.active){
Main.instance.gameManager.dispatchEvent(new SequenceEvent(SequenceEvent.POSITIVE, Layout.MatPlaceHolder, 1));
} else {
Main.instance.gameManager.startMiniGame("Roll");
};
};
};
}
protected function algae():Boolean{
return ((iAlgae <= 0));
}
public function get todo():String{
return (sTodo);
}
public function update(_arg1:Event):void{
if (((!((fWait == null))) && ((fWait is Function)))){
if (fWait()){
fWait = null;
if (aInstruct[iIndex] != undefined){
manage();
} else {
clearInstructs();
};
};
} else {
if (aInstruct[iIndex] == undefined){
clearInstructs();
};
};
if (((!(Main.instance.gameManager.started)) && (!(Animate.queuing)))){
checkAllThere();
};
}
public function onIdle(_arg1:Event):void{
var _local2:Number;
var _local3:int;
iIndex++;
_local2 = ((Math.floor(((aDisplay.length - 1) / aInstruct.length)) * aInstruct.length) + iIndex);
_local3 = (iDisplay - (Math.floor(((aDisplay.length - 1) / aInstruct.length)) * aInstruct.length));
_local2 = (_local2 + _local3);
if ((((aDisplay[_local2] == undefined)) && (!((aInstruct[iIndex] == undefined))))){
aDisplay.push(createTextPanel(aInstruct[iIndex].state, false));
};
}
protected function rolled():Boolean{
return ((iRoll <= 0));
}
private function createTextPanel(_arg1:String, _arg2:Boolean=false):TextPanel{
var _local3:DisplayObjectContainer;
var _local4:MovieClip;
_local3 = Main.instance.gameManager.depthManager.getDepthLayer(Game.sDEPTH_BACKGROUND);
_local4 = new mcInstruct();
_local3.addChild(_local4);
return (new TextPanel(_local4, _arg1, true, _arg2));
}
protected function rice():Boolean{
return ((iRice <= 0));
}
public function checkAllThere():void{
}
private function manage():void{
var _local1:Number;
var _local2:int;
_local1 = ((Math.floor(((aDisplay.length - 1) / aInstruct.length)) * aInstruct.length) + iIndex);
_local2 = (iDisplay - (Math.floor(((aDisplay.length - 1) / aInstruct.length)) * aInstruct.length));
_local1 = (_local1 + _local2);
if (iIndex < 0){
iIndex++;
aDisplay.push(createTextPanel(aInstruct[iIndex].state, true));
} else {
if ((((iIndex < aInstruct.length)) && ((iIndex > 1)))){
aDisplay[(_local1 - 2)].goToOut();
aDisplay[(_local1 - 1)].goToWait(2);
aDisplay[_local1].goToIdle();
Main.instance.gameManager.arrow.bounce();
} else {
if (iIndex == 1){
aDisplay[(_local1 - 1)].goToWait(2);
aDisplay[_local1].goToIdle();
Main.instance.gameManager.arrow.bounce();
};
};
};
}
public function authorize(_arg1:String, _arg2:Boolean=false, _arg3=null):Boolean{
var _local4:Boolean;
_local4 = false;
switch (_arg1){
case "filling":
if (((((((((_arg2) && (algae()))) && (rice()))) && ((Main.instance.gameManager.selectedIngredient == null)))) && ((iFillingsPla > 0)))){
_local4 = true;
} else {
if (((((!(_arg2)) && ((Main.instance.gameManager.selectedIngredient == null)))) && ((iFillingsPre > 0)))){
_local4 = true;
};
};
break;
case "veggies":
if (((((((((_arg2) && (algae()))) && (rice()))) && ((Main.instance.gameManager.selectedIngredient == null)))) && ((iVeggiesPla > 0)))){
_local4 = true;
} else {
if (((((!(_arg2)) && ((Main.instance.gameManager.selectedIngredient == null)))) && ((iVeggiesPre > 0)))){
_local4 = true;
};
};
break;
case "algae":
_local4 = true;
break;
case "rice":
if (((((algae()) && ((Main.instance.gameManager.selectedIngredient == null)))) && ((iRice > 0)))){
_local4 = true;
};
break;
case "sauce":
if (((((((algae()) && (rice()))) && ((Main.instance.gameManager.selectedIngredient == null)))) && ((iPour > 0)))){
_local4 = true;
};
break;
case "roll":
if (((((((((((((algae()) && (rice()))) && (filling_placed()))) && (veggies_placed()))) && (poured()))) && (!(rolled())))) && ((iRoll > 0)))){
_local4 = true;
};
break;
case "cut":
if (((rolled()) && ((iCut > 0)))){
_local4 = true;
};
break;
case "serve":
if (((cutted()) && ((iServe > 0)))){
_local4 = true;
};
break;
};
return (_local4);
}
private function start():void{
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener("next_instruct", next_instruct, false, 0, true);
Main.instance.gameManager.addEventListener("on_idle", onIdle, false, 0, true);
Main.instance.gameManager.addEventListener(IngredientEvent.EVENT_DONE, onDone, false, 0, true);
manage();
}
protected function veggies_prepared():Boolean{
return ((iVeggiesPre <= 0));
}
private function wait(_arg1:String):void{
sWait = _arg1;
switch (_arg1){
case "filling_prepared":
fWait = filling_prepared;
break;
case "veggies_prepared":
fWait = veggies_prepared;
break;
case "algae":
fWait = algae;
break;
case "rice":
fWait = rice;
break;
case "filling_placed":
fWait = filling_placed;
break;
case "veggies_placed":
fWait = veggies_placed;
break;
case "poured":
fWait = poured;
break;
case "rolled":
fWait = rolled;
break;
case "cutted":
fWait = cutted;
break;
case "served":
fWait = served;
break;
};
sTodo = _arg1;
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
Main.instance.gameManager.removeEventListener("on_idle", onIdle, false);
Main.instance.gameManager.removeEventListener("next_instruct", next_instruct, false);
Main.instance.gameManager.removeEventListener(IngredientEvent.EVENT_DONE, onDone, false);
}
}
}//package gameplay.instruct
Section 39
//InstructList (gameplay.instruct.InstructList)
package gameplay.instruct {
public class InstructList {
public static var list:Array = [{state:"prepare_filling", func:"wait", param:["filling_prepared"]}, {state:"prepare_veggies", func:"wait", param:["veggies_prepared"]}, {state:"place_algae", func:"wait", param:["algae"]}, {state:"place_rice", func:"wait", param:["rice"]}, {state:"place_filling", func:"wait", param:["filling_placed"]}, {state:"place_veggies", func:"wait", param:["veggies_placed"]}, {state:"pour_sauce", func:"wait", param:["poured"]}, {state:"roll_sushi", func:"wait", param:["rolled"]}, {state:"cut_sushi", func:"wait", param:["cutted"]}, {state:"serve", func:"wait", param:["served"]}];
}
}//package gameplay.instruct
Section 40
//Layout (gameplay.layout.Layout)
package gameplay.layout {
public class Layout {
public static var KnifeShadow:Object = {x:512.3, y:317.6, scale:1};
public static var Char03PlaceHolder:Object = {x:213.9, y:219, scale:0.5};
public static var Knife:Object = {x:512.3, y:317.6, scale:1};
public static var PourGame:Object = {x:307.9, y:322.3, scale:1};
public static var SamSushi:Object = {x:172.5, y:265.8, scale:0.75};
public static var Freddie:Object = {x:173.8, y:197.4, scale:0.45};
public static var chickenSequence:Array = [{x:465.9, y:302.8}, {x:487.4, y:334.8}, {x:494.9, y:307.8}, {x:522, y:305.2}];
public static var FreddieSoya:Object = {x:224.6, y:214.8, scale:0.5};
public static var Skip:Object = {x:494.6, y:171.8, scale:1};
public static var Algae:Object = {x:301.9, y:322.3, scale:1};
public static var Char01PlaceHolder:Object = {x:121, y:335, scale:1};
public static var SpreadGame:Object = {x:305.1, y:318.7, scale:1};
public static var Special:Object = {x:300, y:200, scale:1};
public static var Bubble:Object = {x:113.3, y:97.4, scale:0.675};
public static var Table:Object = {x:0, y:0, scale:1};
public static var RollGame:Object = {x:302.9, y:161.2, scale:1};
public static var Ingredients:Object = {slot1:{x:282.4, y:256.7, scale:0.75}, slot2:{x:360.9, y:255.2, scale:0.75}, slot3:{x:439.9, y:255.2, scale:0.75}, slot4:{x:518, y:254.8, scale:0.75}, slot5:{x:299.5, y:224.3, scale:0.6}, slot6:{x:369.5, y:224.3, scale:0.6}, slot7:{x:434.5, y:224.3, scale:0.6}, slot8:{x:500.9, y:224.3, scale:0.6}, sauce1:{x:579.9, y:236.3, scale:0.6}, sauce2:{x:560.9, y:225.1, scale:0.6}, sauce3:{x:541.5, y:215.1, scale:0.6}};
public static var MatPlaceHolder:Object = {x:305.4, y:323, scale:1};
public static var Sam:Object = {x:128.3, y:227.8, scale:0.6};
public static var Mat:Object = {x:301.9, y:316.6, scale:1};
public static var Carly:Object = {x:50.4, y:282.6, scale:0.75};
public static var onionSequence:Array = [{x:471.3, y:324.1}, {x:500, y:323.1}, {x:530.5, y:323.1}];
public static var SamSoya:Object = {x:187.2, y:259.1, scale:0.75};
public static var CarlySoya:Object = {x:135.8, y:327.8, scale:1};
public static var Background:Object = {x:0, y:0, scale:1};
public static var salmonSequence:Array = [{x:477.3, y:315.1}, {x:503, y:333.1}, {x:514.5, y:309.1}, {x:534, y:325.8}];
public static var shrimpSequence:Array = [{x:478.1, y:318.6}, {x:500, y:330.9}, {x:512.5, y:311.3}, {x:527, y:325.8}];
public static var CarlySushi:Object = {x:118, y:333.1, scale:1};
public static var tunaSequence:Array = [{x:472.1, y:319.9}, {x:498.9, y:334.4}, {x:513.5, y:312.9}, {x:541.5, y:323.1}];
public static var cucumberSequence:Array = [{x:467.3, y:323.8}, {x:499.9, y:318.1}, {x:533, y:323.8}];
public static var Instruct:Object = {x:381.8, y:93.5, scale:1};
public static var daikonSequence:Array = [{x:467.3, y:323.4}, {x:502, y:323.9}, {x:535.5, y:323.4}];
public static var CutBoard:Object = {x:505.8, y:323.6, scale:1};
public static var Arrow:Object = {x:289.1, y:113.3, scale:1};
public static var BoardPlaceHolder:Object = {x:496.1, y:319, scale:1};
public static var sushiSequence:Array = [{x:447.1, y:329.2}, {x:476, y:314.7}, {x:508.4, y:329.2}, {x:539.5, y:318.1}, {x:571, y:329.2}];
public static var eggSequence:Array = [{x:481.3, y:322.4}, {x:0x0202, y:329.7}, {x:539.5, y:313.6}];
public static var Kanji:Object = {x:362.9, y:190, scale:1};
public static var Rice:Object = {x:303.6, y:321.4, scale:1};
public static var Char02PlaceHolder:Object = {x:174.9, y:267, scale:0.75};
public static var FreddieSushi:Object = {x:210.9, y:218.8, scale:0.5};
public static var Tutorial:Object = {x:379.9, y:95, scale:1};
}
}//package gameplay.layout
Section 41
//Cursor (gameplay.mouse.Cursor)
package gameplay.mouse {
import flash.events.*;
import flash.display.*;
import library.events.*;
import library.utils.*;
import library.basic.*;
import library.interfaces.*;
import flash.ui.*;
public class Cursor extends StateManaged implements Idestroyable {
public static const sSTATE_CLICK:String = "click";
public static const sSTATE_OVER:String = "over";
public static const sSTATE_CANT:String = "cant";
public static const sSTATE_NORMAL:String = "normal";
private static var mcRef:MovieClip;
private static var oInstance:Cursor;
private static var bPlaying:Boolean;
private static var aQueue:Array;
public function Cursor(_arg1:MovieClip):void{
super(_arg1);
oInstance = this;
bPlaying = false;
Cursor.mcRef = mcRef;
mcRef.parent.mouseEnabled = false;
mcRef.parent.mouseChildren = false;
addState(sSTATE_CANT, null);
addState(sSTATE_CLICK, state_click);
addState(sSTATE_NORMAL, null);
addState(sSTATE_OVER, null);
Mouse.hide();
Main.instance.addEventListener(MouseEvent.MOUSE_MOVE, move, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, hide, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, show, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
setState(sSTATE_NORMAL);
Cursor.queue({func:"to", args:[540, 20]}, {func:"click", args:[Main.instance.gameManager.hud.mcRef.btnMenu]});
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_PAUSE, hide, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_RESUME, show, false);
Main.instance.removeEventListener(MouseEvent.MOUSE_MOVE, move, false);
Mouse.show();
mcRef = null;
}
private function hide(_arg1:Event):void{
Mouse.show();
}
private function show(_arg1:Event):void{
Mouse.hide();
}
private function state_click():void{
if (stateComplete){
setState(sSTATE_NORMAL);
if (aQueue.length == 0){
complete();
};
};
}
private function move(_arg1:MouseEvent=null):void{
if (!bPlaying){
mcRef.x = _arg1.stageX;
mcRef.y = _arg1.stageY;
};
}
private function complete(_arg1:Event=null):void{
var _local2:Object;
if (aQueue.length == 0){
toMouse();
} else {
_local2 = aQueue.shift();
Cursor[_local2.func].apply(Cursor, _local2.args);
};
}
public static function click(_arg1=null):void{
oInstance.setState(sSTATE_CLICK);
if (_arg1 != null){
_arg1.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
};
}
public static function queue(... _args):void{
var _local2:int;
var _local3:Object;
aQueue = [];
bPlaying = true;
_local2 = 0;
while (_local2 < _args.length) {
aQueue.push(_args[_local2]);
_local2++;
};
_local3 = aQueue.shift();
Cursor[_local3.func].apply(Cursor, _local3.args);
}
public static function over(_arg1=null):void{
oInstance.setState(sSTATE_OVER);
if (_arg1 != null){
_arg1.dispatchEvent(new MouseEvent(MouseEvent.MOUSE_OVER));
};
}
public static function get instance():Cursor{
return (oInstance);
}
public static function get isPlaying():Boolean{
return (Cursor.bPlaying);
}
public static function toMouse(_arg1:int=5):void{
Animate.to(mcRef, _arg1, {x:Main.instance.stage.mouseX, y:Main.instance.stage.mouseY, onComplete:Cursor.activate, onCompleteScope:Cursor});
}
public static function activate():void{
bPlaying = false;
}
public static function to(_arg1:Number, _arg2:Number, _arg3:int=10):void{
Animate.to(mcRef, _arg3, {delay:100, x:_arg1, y:_arg2, onComplete:Cursor.instance.complete, onCompleteScope:Cursor.instance});
}
}
}//package gameplay.mouse
Section 42
//TextPanel (gameplay.panel.TextPanel)
package gameplay.panel {
import flash.events.*;
import flash.display.*;
import library.events.*;
import library.basic.*;
import library.interfaces.*;
import gameplay.layout.*;
public class TextPanel extends StateManaged implements Idestroyable {
private var sText:String;
private var sGoTo:String;
public static const sSTATE_INSTRUCT_WAIT2:String = "wait2";
public static const sSTATE_TUTORIAL_IDLE:String = "idle";
public static const sSTATE_TUTORIAL_IN:String = "in";
public static const sSTATE_TUTORIAL_OUT:String = "out";
public static const sSTATE_INSTRUCT_OUT:String = "out";
public static const sSTATE_INSTRUCT_TO_IDLE:String = "to_idle";
public static const sSTATE_INSTRUCT_TO_WAIT:String = "to_wait";
public static const sSTATE_INSTRUCT_IDLE:String = "idle";
public static const sSTATE_INSTRUCT_WAIT:String = "wait";
public static const sSTATE_INSTRUCT_TO_WAIT2:String = "to_wait2";
public function TextPanel(_arg1:MovieClip, _arg2:String, _arg3:Boolean=false, _arg4:Boolean=false):void{
var _local5:Object;
super(_arg1);
sText = _arg2;
if (_arg4){
sGoTo = sSTATE_INSTRUCT_IDLE;
};
if (_arg3){
_local5 = Layout.Instruct;
} else {
_local5 = Layout.Tutorial;
};
mcRef.x = _local5.x;
mcRef.y = _local5.y;
mcRef.scaleX = (mcRef.scaleY = _local5.scale);
if (_arg3){
addState(sSTATE_INSTRUCT_TO_WAIT, state_instruct_to_wait, setText);
addState(sSTATE_INSTRUCT_WAIT, state_instruct_wait, setText);
addState(sSTATE_INSTRUCT_TO_IDLE, state_instruct_to_idle, setText);
addState(sSTATE_INSTRUCT_IDLE, state_instruct_idle, state_instruct_idle_init);
addState(sSTATE_INSTRUCT_TO_WAIT2, state_instruct_to_wait2, setText);
addState(sSTATE_INSTRUCT_WAIT2, state_instruct_wait2, setText);
addState(sSTATE_INSTRUCT_OUT, state_instruct_out, setText);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_COMPLETE, deleteThis, false, 0, true);
} else {
addState(sSTATE_TUTORIAL_IN, state_tutorial_in, setText);
addState(sSTATE_TUTORIAL_IDLE, null, setText);
addState(sSTATE_TUTORIAL_OUT, state_tutorial_out, setText);
};
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, resume, false, 0, true);
if (_arg3){
setState(sSTATE_INSTRUCT_TO_WAIT);
} else {
setState(sSTATE_TUTORIAL_IN);
};
}
public function state_instruct_idle_init():void{
if (sGoTo != sSTATE_INSTRUCT_OUT){
Main.instance.gameManager.dispatchEvent(new Event("next_instruct"));
Main.instance.gameManager.dispatchEvent(new Event("on_idle"));
};
setText();
}
public function state_instruct_wait2():void{
setText();
if (sGoTo != null){
if (sGoTo != sSTATE_INSTRUCT_WAIT2){
setState(sSTATE_INSTRUCT_OUT);
} else {
sGoTo = null;
};
};
}
public function state_instruct_to_idle():void{
setText();
if (stateComplete){
setState(sSTATE_INSTRUCT_IDLE);
};
}
public function state_instruct_idle():void{
setText();
if (sGoTo != null){
if (sGoTo != sSTATE_INSTRUCT_IDLE){
setState(sSTATE_INSTRUCT_TO_WAIT2);
} else {
sGoTo = null;
};
};
}
public function state_instruct_to_wait2():void{
setText();
if (stateComplete){
setState(sSTATE_INSTRUCT_WAIT2);
};
}
public function goToOut():void{
sGoTo = sSTATE_INSTRUCT_OUT;
}
public function goToWait(_arg1:int):void{
if (_arg1 == 2){
sGoTo = sSTATE_INSTRUCT_WAIT2;
} else {
sGoTo = sSTATE_INSTRUCT_WAIT;
};
}
public function state_instruct_to_wait():void{
setText();
if (stateComplete){
setState(sSTATE_INSTRUCT_WAIT);
};
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_COMPLETE, deleteThis, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_PAUSE, pause, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_RESUME, resume, false);
mcRef.parent.removeChild(mcRef);
mcRef = null;
}
public function deleteThis(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_COMPLETE, deleteThis, false);
goToOut();
}
private function setText():void{
if (mcRef.getChildByName("mcState") != null){
if (mcState.getChildByName("mcText") != null){
mcState.mcText.gotoAndStop(sText);
};
};
}
public function state_instruct_out():void{
setText();
if (stateComplete){
destroy(null);
};
}
public function state_tutorial_in():void{
setText();
if (stateComplete){
setState(sSTATE_TUTORIAL_IDLE);
};
}
public function state_instruct_wait():void{
setText();
if (sGoTo != null){
if (sGoTo != sSTATE_INSTRUCT_WAIT){
setState(sSTATE_INSTRUCT_TO_IDLE);
} else {
sGoTo = null;
};
};
}
public function state_tutorial_out():void{
setText();
if (stateComplete){
destroy(null);
};
}
public function goToIdle():void{
sGoTo = sSTATE_INSTRUCT_IDLE;
}
}
}//package gameplay.panel
Section 43
//Kanji (gameplay.powerups.Kanji)
package gameplay.powerups {
import library.sounds.*;
import flash.events.*;
import flash.display.*;
import library.events.*;
import gameplay.hud.*;
import library.basic.*;
import library.interfaces.*;
public class Kanji extends StateManaged implements Idestroyable {
private var iTime:int;
public static const sSTATE_GRABBED:String = "grabbed";
public static const sSTATE_IDLE:String = "idle";
public static const sSTATE_IN:String = "in";
public static const sSTATE_OUT:String = "out";
public function Kanji(_arg1:MovieClip, _arg2:Object, _arg3:int):void{
super(_arg1);
iTime = (_arg3 * 35);
mcRef.x = _arg2.x;
mcRef.y = _arg2.y;
mcRef.scaleX = (mcRef.scaleY = _arg2.scale);
addState(sSTATE_GRABBED, state_grabbed);
addState(sSTATE_IDLE, state_idle, active_click);
addState(sSTATE_IN, state_in);
addState(sSTATE_OUT, state_out);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
SoundEngine.Play(Main.sSOUND_SFX, SoundList.sSOUND_POWERUP_IN);
setState(sSTATE_IN);
}
public function state_idle():void{
iTime--;
if (iTime <= 0){
SoundEngine.Play(Main.sSOUND_SFX, SoundList.sSOUND_POWERUP_OUT);
setState(sSTATE_OUT);
};
}
public function state_grabbed():void{
if (stateComplete){
destroy(null);
};
}
public function deactive_click():void{
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
mcRef.mouseChildren = false;
mcRef.mouseEnabled = false;
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
if (mcRef != null){
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
mcRef.parent.removeChild(mcRef);
mcRef = null;
};
Main.instance.gameManager.oKanji = null;
}
public function state_in():void{
if (stateComplete){
setState(sSTATE_IDLE);
};
}
public function active_click():void{
mcRef.mouseChildren = false;
mcRef.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
}
public function state_out():void{
if (stateComplete){
destroy(null);
};
}
public function onClick(_arg1:MouseEvent):void{
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
Time.instance.addTime(Config.Special.Time);
SoundEngine.Play(Main.sSOUND_SFX, SoundList.sSOUND_POWERUP_GRABBED);
setState(sSTATE_GRABBED);
}
}
}//package gameplay.powerups
Section 44
//Special (gameplay.special.Special)
package gameplay.special {
import library.sounds.*;
import flash.events.*;
import flash.display.*;
import library.events.*;
import gameplay.*;
import library.interfaces.*;
import gameplay.layout.*;
import gameplay.sushi.*;
public class Special implements Idestroyable {
private var bActive:Boolean;
private var aList:Array;
private var bWorking:Boolean;
private var oSpecialAnim:SpecialStar;
private var iWait:int;
public static const WORKING:String = "special_working";
public static const NEXT:String = "special_next";
public static const COMPLETE:String = "special_complete";
public static const FINISHED:String = "special_finished";
public function Special():void{
iWait = Config.Special.WaitWord;
bActive = false;
bWorking = false;
aList = new Array();
Main.instance.gameManager.addEventListener(COMPLETE, onComplete, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
Main.instance.gameManager.addEventListener(NEXT, onNext, false, 0, true);
Main.instance.gameManager.addEventListener(WORKING, onWorking, false, 0, true);
}
public function get active():Boolean{
return (bActive);
}
public function update(_arg1:Event):void{
var _local2:*;
if (!bWorking){
_local2 = getItem(Main.instance.gameManager.instruction.todo);
trace(("_oItem : " + _local2));
if (_local2 != null){
_local2.onClick(null);
};
};
}
public function canUseThis(_arg1):Boolean{
var _local2:Boolean;
var _local3:DisplayObjectContainer;
var _local4:Class;
var _local5:Class;
var _local6:*;
_local2 = true;
_local3 = Main.instance.gameManager.depthManager.getDepthLayer(Game.sDEPTH_PLACE_HOLDER);
_local5 = (Object(_arg1.mcRef).constructor as Class);
trace(("_fCompare : " + _local5));
for (_local6 in _local3) {
_local4 = (Object(_local3[_local6]).constructor as Class);
trace(("_fClass : " + _local4));
if ((_local4 is _local5)){
_local2 = false;
break;
};
};
return (_local2);
}
private function getItem(_arg1:String){
var _local2:*;
var _local3:int;
trace(("Special.getItem > _sType : " + _arg1));
_local2 = null;
aList = Main.instance.gameManager.getIngredientsList();
switch (_arg1){
case "filling_prepared":
case "filling_placed":
_local3 = 0;
while (_local3 < aList.length) {
if (((((((!((aList[_local3] == undefined))) && (!((aList[_local3] == null))))) && ((aList[_local3].type == "filling")))) && (Main.instance.gameManager.instruction.authorize("filling", aList[_local3].prepared)))){
_local2 = aList[_local3];
break;
};
_local3++;
};
break;
case "veggies_prepared":
case "veggies_placed":
trace("vegginhs");
_local3 = 0;
while (_local3 < aList.length) {
trace(((("blows here: " + aList[_local3].type) + " | ") + aList[_local3].mcRef));
if (((((((!((aList[_local3] == undefined))) && (!((aList[_local3] == null))))) && ((aList[_local3].type == "veggies")))) && (Main.instance.gameManager.instruction.authorize("veggies", aList[_local3].prepared)))){
_local2 = aList[_local3];
break;
};
_local3++;
};
break;
case "algae":
_local3 = 0;
while (_local3 < aList.length) {
if (((((!((aList[_local3] == undefined))) && (!((aList[_local3] == null))))) && ((aList[_local3].type == "algae")))){
_local2 = aList[_local3];
break;
};
_local3++;
};
break;
case "rice":
_local3 = 0;
while (_local3 < aList.length) {
if (((((!((aList[_local3] == undefined))) && (!((aList[_local3] == null))))) && ((aList[_local3].type == "rice")))){
_local2 = aList[_local3];
break;
};
_local3++;
};
break;
case "poured":
_local3 = 0;
while (_local3 < aList.length) {
if (((((((((!((aList[_local3] == undefined))) && (!((aList[_local3] == null))))) && ((aList[_local3].type == "sauce")))) && (!(aList[_local3].poured)))) && (canUseThis(aList[_local3])))){
_local2 = aList[_local3];
break;
};
_local3++;
};
break;
case "cutted":
_local3 = 0;
while (_local3 < aList.length) {
if ((aList[_local3] is Sushi)){
_local2 = aList[_local3];
break;
};
_local3++;
};
break;
case "served":
trace(("aList : " + aList));
_local3 = 0;
while (_local3 < aList.length) {
if ((aList[_local3] is Sushi)){
trace(("aList[i] : " + aList[_local3].state));
aList[_local3].onCharSelect(new Event(Main.instance.gameManager.character));
bWorking = true;
break;
};
_local3++;
};
break;
};
return (_local2);
}
public function onWorking(_arg1:Event):void{
bWorking = true;
}
public function playAnim():void{
var _local1:DisplayObjectContainer;
var _local2:MovieClip;
_local1 = Main.instance.gameManager.depthManager.getDepthLayer(Game.sDEPTH_HUD);
_local2 = new mcSpecial();
_local1.addChild(_local2);
oSpecialAnim = new SpecialStar(_local2, Layout.Special);
}
public function set wait(_arg1:int):void{
iWait = _arg1;
}
public function onFinished(_arg1:Event):void{
iWait = Config.Special.WaitWord;
bActive = false;
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(FINISHED, onFinished, false);
Main.instance.gameManager.addEventListener(COMPLETE, onComplete, false, 0, true);
}
public function onNext(_arg1:Event):void{
trace(("Special.onNext > _e : " + _arg1));
bWorking = false;
}
public function get wait():int{
return (iWait);
}
public function onComplete(_arg1:Event):void{
if ((((iWait <= 0)) && (!(active)))){
bActive = true;
bWorking = false;
aList = Main.instance.gameManager.getIngredientsList();
SoundEngine.Play(Main.sSOUND_SFX, SoundList.sSOUND_SPECIAL, 1, true, false, true);
Main.instance.gameManager.removeEventListener(COMPLETE, onComplete, false);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(FINISHED, onFinished, false, 0, true);
playAnim();
};
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(COMPLETE, onComplete, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(NEXT, onNext, false);
Main.instance.gameManager.removeEventListener(FINISHED, onFinished, false);
}
}
}//package gameplay.special
Section 45
//SpecialKey (gameplay.special.SpecialKey)
package gameplay.special {
import flash.events.*;
import library.events.*;
import library.utils.*;
import library.interfaces.*;
public class SpecialKey implements Idestroyable {
private var sCurrentStr:String;
private var iDefault:int;
private var iDelay:int;
private var sStr:String;
public function SpecialKey(_arg1:String, _arg2:int=50):void{
sStr = _arg1;
iDefault = _arg2;
sCurrentStr = "";
iDelay = 0;
Main.instance.stage.addEventListener(KeyboardEvent.KEY_DOWN, onKey, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
}
public function onKey(_arg1:KeyboardEvent):void{
sCurrentStr = (sCurrentStr + String.fromCharCode(_arg1.charCode));
iDelay = iDefault;
}
public function update(_arg1:Event):void{
if (iDelay > 0){
iDelay--;
if (iDelay <= 0){
sCurrentStr = "";
};
if ((((((sStr == sCurrentStr)) && (!(Main.instance.gameManager.started)))) && (!(Animate.queuing)))){
sCurrentStr = "";
Main.instance.gameManager.dispatchEvent(new Event(Special.COMPLETE));
};
};
}
public function destroy(_arg1:Event):void{
Main.instance.stage.removeEventListener(KeyboardEvent.KEY_DOWN, onKey, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
}
}
}//package gameplay.special
Section 46
//SpecialStar (gameplay.special.SpecialStar)
package gameplay.special {
import flash.events.*;
import flash.display.*;
import library.events.*;
import library.basic.*;
import library.interfaces.*;
public class SpecialStar extends StateManaged implements Idestroyable {
public static const sSTATE_PLAY:String = "Play";
public function SpecialStar(_arg1:MovieClip, _arg2:Object):void{
super(_arg1);
mcRef.x = _arg2.x;
mcRef.y = _arg2.y;
mcRef.scaleX = (mcRef.scaleY = _arg2.scale);
addState(sSTATE_PLAY, state_play);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
setState(sSTATE_PLAY);
}
public function state_play():void{
if (stateComplete){
destroy(null);
};
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
mcRef.parent.removeChild(mcRef);
mcRef = null;
}
}
}//package gameplay.special
Section 47
//Sushi (gameplay.sushi.Sushi)
package gameplay.sushi {
import flash.events.*;
import flash.display.*;
import library.events.*;
import gameplay.tutorial.*;
import gameplay.special.*;
import library.basic.*;
import library.interfaces.*;
import gameplay.layout.*;
import flash.filters.*;
public class Sushi extends StateManaged implements Idestroyable {
private var sTempType:String;
private var sType:String;
private var sSushi:String;
private var oCharLayout:Object;
public static const sSTATE_CUTTED_OUT:String = "cutted_out";
public static const sSTATE_PLATE_OUT:String = "plate_out";
public static const sSTATE_CUTTED_DEL:String = "cutted_del";
public static const sSTATE_ROLLED_IN:String = "rolled_in";
public static const sSTATE_ROLLED_OUT:String = "rolled_out";
public static const sSTATE_PLATE_IN:String = "plate_in";
public static const sSTATE_ROLLED_DEL:String = "rolled_del";
public static const sSTATE_MAT_OUT:String = "mat_out";
public static const sSTATE_PLATE_DEL:String = "plate_del";
public static const sSTATE_MAT_DEL:String = "mat_del";
public static const sSTATE_MAT_CUTTED_DEL:String = "mat_cutted_del";
public static const sSTATE_MAT_CUTTED_OUT:String = "mat_cutted_out";
public static const sSTATE_CUTTED_IDLE:String = "cutted_idle";
public static const sSTATE_MAT_CUTTED_IDLE:String = "mat_cutted_idle";
public static const sSTATE_CUTTED_IN:String = "cutted_in";
public static const sSTATE_MAT_CUTTED_IN:String = "mat_cutted_in";
public static const sSTATE_MAT_IDLE:String = "mat_idle";
public static const sSTATE_ROLLED_IDLE:String = "rolled_idle";
public static const sSTATE_PLATE_IDLE:String = "plate_idle";
public function Sushi(_arg1:MovieClip, _arg2:Object, _arg3:String="rolled_in", _arg4:Boolean=false):void{
super(_arg1);
sType = "sushi";
sSushi = Main.instance.gameManager.getSushi();
sTempType = "roll";
mcRef.x = _arg2.x;
mcRef.y = _arg2.y;
mcRef.scaleX = (mcRef.scaleY = _arg2.scale);
addState(sSTATE_CUTTED_IDLE, null, state_cutted_idle_init);
addState(sSTATE_CUTTED_IN, state_cutted_in, state_cutted_idle_init);
addState(sSTATE_CUTTED_OUT, state_cutted_out, state_cutted_idle_init);
addState(sSTATE_PLATE_IDLE, null, state_plate_idle_init);
addState(sSTATE_PLATE_IN, state_plate_in, state_plate_idle_init);
addState(sSTATE_PLATE_OUT, state_plate_out, state_plate_idle_init);
addState(sSTATE_ROLLED_IDLE, null, state_rolled_idle_init);
addState(sSTATE_ROLLED_IN, state_rolled_in);
addState(sSTATE_ROLLED_OUT, state_rolled_out);
addState(sSTATE_MAT_IDLE, null, state_mat_idle_init);
addState(sSTATE_MAT_OUT, state_mat_out);
addState(sSTATE_MAT_CUTTED_IDLE, null, state_mat_cutted_idle_init);
addState(sSTATE_MAT_CUTTED_IN, state_mat_cutted_in, state_mat_cutted_idle_init);
addState(sSTATE_MAT_CUTTED_OUT, state_mat_cutted_out, state_mat_cutted_idle_init);
addState(sSTATE_CUTTED_DEL, state_del);
addState(sSTATE_MAT_CUTTED_DEL, state_del);
addState(sSTATE_MAT_DEL, state_del);
addState(sSTATE_PLATE_DEL, state_del);
addState(sSTATE_ROLLED_DEL, state_del);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, resume, false, 0, true);
mcRef.addEventListener(MouseEvent.MOUSE_OVER, onOver, false, 0, true);
mcRef.addEventListener(MouseEvent.MOUSE_OUT, onOut, false, 0, true);
setState(_arg3);
if (state == sSTATE_MAT_IDLE){
mcRef.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
} else {
if (state == sSTATE_ROLLED_IN){
Main.instance.gameManager.addEventListener(GameEvent.EVENT_CUT, cut, false, 0, true);
};
};
}
public function state_plate_idle_init():void{
setSushi();
Main.instance.gameManager.dispatchEvent(new IngredientEvent(IngredientEvent.EVENT_DONE, "serve"));
setState(sSTATE_PLATE_OUT);
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_PAUSE, pause, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_RESUME, resume, false);
if (mcRef != null){
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
mcRef.removeEventListener(MouseEvent.MOUSE_OVER, onOver, false);
mcRef.removeEventListener(MouseEvent.MOUSE_OUT, onOut, false);
mcRef.parent.removeChild(mcRef);
mcRef = null;
};
}
public function state_cutted_out():void{
setSushi();
if (stateComplete){
Main.instance.gameManager.addToPlaceHolder(this, sSTATE_MAT_CUTTED_IN, Sushi, new mcSushi(), Layout.MatPlaceHolder, sSTATE_MAT_CUTTED_IN);
destroy(null);
};
}
public function onCharSelect(_arg1:Event):void{
trace(("Sushi.onCharSelect > _e : " + _arg1));
switch (_arg1.type){
case "char01":
oCharLayout = Layout.Char01PlaceHolder;
break;
case "char02":
oCharLayout = Layout.Char02PlaceHolder;
break;
case "char03":
oCharLayout = Layout.Char03PlaceHolder;
break;
};
if (!Main.instance.gameManager.tutorial){
Main.instance.gameManager.special.wait--;
};
Main.instance.gameManager.charAction(_arg1.type);
setState(sSTATE_MAT_CUTTED_OUT);
Main.instance.gameManager.dispatchEvent(new Event(Special.FINISHED));
}
public function deleteIt():void{
if (mcRef != null){
switch (state){
case sSTATE_ROLLED_IN:
case sSTATE_ROLLED_IDLE:
case sSTATE_ROLLED_OUT:
setState(sSTATE_ROLLED_DEL);
break;
case sSTATE_MAT_IDLE:
case sSTATE_MAT_OUT:
setState(sSTATE_MAT_DEL);
break;
case sSTATE_MAT_CUTTED_IN:
case sSTATE_MAT_CUTTED_IDLE:
case sSTATE_MAT_CUTTED_OUT:
setState(sSTATE_MAT_CUTTED_DEL);
break;
case sSTATE_CUTTED_IN:
case sSTATE_CUTTED_IDLE:
case sSTATE_CUTTED_OUT:
setState(sSTATE_CUTTED_DEL);
break;
case sSTATE_PLATE_IN:
case sSTATE_PLATE_IDLE:
case sSTATE_PLATE_OUT:
setState(sSTATE_PLATE_DEL);
break;
};
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
} else {
destroy(null);
};
}
public function state_rolled_in():void{
if (stateComplete){
setState(sSTATE_ROLLED_IDLE);
};
}
public function cut(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_CUT, cut, false);
setState(sSTATE_ROLLED_OUT);
}
public function state_mat_cutted_in():void{
setSushi();
if (stateComplete){
setState(sSTATE_MAT_CUTTED_IDLE);
};
}
public function state_mat_out():void{
if (stateComplete){
Main.instance.gameManager.addToPlaceHolder(this, sSTATE_ROLLED_IN, Sushi, new mcSushi(), Layout.BoardPlaceHolder, sSTATE_ROLLED_IN);
destroy(null);
};
}
public function state_mat_idle_init():void{
Main.instance.gameManager.dispatchEvent(new IngredientEvent(IngredientEvent.EVENT_DONE, "roll"));
Main.instance.gameManager.dispatchEvent(new Event(Special.NEXT));
sTempType = "cut";
}
private function setSushi():void{
var _local1:int;
if (((!((mcRef == null))) && (!((mcState == null))))){
_local1 = 1;
while (_local1 <= 6) {
if (mcState.getChildByName(("mcSushi0" + _local1)) != null){
MovieClip(mcState.getChildByName(("mcSushi0" + _local1))).gotoAndStop(sSushi);
};
_local1++;
};
};
}
public function onOver(_arg1:MouseEvent):void{
var _local2:Function;
var _local3:GlowFilter;
_local2 = Main.instance.gameManager.instruction.authorize;
if ((((((((((state == sSTATE_MAT_IDLE)) && (_local2("cut")))) && (!((mcRef.getChildByName("mcState") == null))))) && (!(Main.instance.gameManager.tutorial)))) && (!(Main.instance.gameManager.special.active)))){
_local3 = new GlowFilter(0, 1, 2, 2, 8);
mcState.filters = new Array(_local3);
};
}
public function state_mat_cutted_out():void{
setSushi();
if (stateComplete){
Main.instance.gameManager.addToPlaceHolder(this, sSTATE_PLATE_IN, Sushi, new mcSushi(), oCharLayout, sSTATE_PLATE_IN);
destroy(null);
};
}
public function state_rolled_out():void{
if (stateComplete){
setState(sSTATE_CUTTED_IN);
};
}
public function state_mat_cutted_idle_init():void{
Main.instance.gameManager.dispatchEvent(new IngredientEvent(IngredientEvent.EVENT_DONE, "cut"));
Main.instance.gameManager.dispatchEvent(new Event(Special.NEXT));
sTempType = "serve";
setSushi();
Main.instance.gameManager.addEventListener("char01", onCharSelect, false, 0, true);
Main.instance.gameManager.addEventListener("char02", onCharSelect, false, 0, true);
Main.instance.gameManager.addEventListener("char03", onCharSelect, false, 0, true);
}
public function state_cutted_idle_init():void{
setSushi();
setState(sSTATE_CUTTED_OUT);
}
public function state_del():void{
setSushi();
if (stateComplete){
destroy(null);
};
}
public function state_plate_in():void{
setSushi();
if (stateComplete){
setState(sSTATE_PLATE_IDLE);
};
}
public function state_cutted_in():void{
setSushi();
if (stateComplete){
setState(sSTATE_CUTTED_IDLE);
};
}
public function state_rolled_idle_init():void{
if (Main.instance.gameManager.special.active){
Main.instance.gameManager.dispatchEvent(new SequenceEvent(SequenceEvent.POSITIVE, Layout.BoardPlaceHolder, 1));
} else {
Main.instance.gameManager.startMiniGame(toString());
};
}
public function get type():String{
return (sType);
}
public function onClick(_arg1:MouseEvent):void{
if (((Main.instance.gameManager.instruction.authorize(sTempType)) && (((((!((_arg1 == null))) && (!(Main.instance.gameManager.special.active)))) || ((((_arg1 == null)) && (Main.instance.gameManager.special.active))))))){
if (state == sSTATE_MAT_IDLE){
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
Main.instance.gameManager.dispatchEvent(new TutEvent(TutEvent.sEVENT_CLICK, mcRef));
Main.instance.gameManager.dispatchEvent(new Event(Special.WORKING));
Main.instance.gameManager.dispatchEvent(new Event(GameEvent.EVENT_ON_CUTBOARD));
setState(sSTATE_MAT_OUT);
} else {
if ((((state == sSTATE_MAT_CUTTED_IDLE)) && (((((!((_arg1 == null))) && (!(Main.instance.gameManager.special.active)))) || ((((_arg1 == null)) && (Main.instance.gameManager.special.active))))))){
Main.instance.gameManager.dispatchEvent(new TutEvent(TutEvent.sEVENT_CLICK, mcRef));
mcRef.removeEventListener(MouseEvent.CLICK, onClick, false);
setState(sSTATE_MAT_CUTTED_OUT);
Main.instance.gameManager.dispatchEvent(new Event(Special.WORKING));
};
};
};
onOut(null);
}
public function toString():String{
return ("Sushi");
}
public function onOut(_arg1:MouseEvent):void{
if (!Main.instance.gameManager.special.active){
if (((((!((mcRef.getChildByName("mcState") == null))) && (!(Main.instance.gameManager.tutorial)))) && (!(Main.instance.gameManager.special.active)))){
mcState.filters = new Array();
};
};
}
public function state_plate_out():void{
setSushi();
if (stateComplete){
destroy(null);
};
}
}
}//package gameplay.sushi
Section 48
//SushiList (gameplay.sushi.SushiList)
package gameplay.sushi {
public class SushiList {
public static var list:Array = [{difficulty:1, name:"sushi01"}, {difficulty:2, name:"sushi03"}, {difficulty:2, name:"sushi04"}, {difficulty:3, name:"sushi05"}, {difficulty:3, name:"sushi02"}];
}
}//package gameplay.sushi
Section 49
//Knife (gameplay.tools.Knife)
package gameplay.tools {
import library.sounds.*;
import flash.events.*;
import flash.display.*;
import library.events.*;
import library.basic.*;
import library.interfaces.*;
import gameplay.layout.*;
public class Knife extends StateManaged implements Idestroyable {
public static const sSTATE_CUT:String = "cut";
public static const sSTATE_IDLE:String = "idle";
public static const sSTATE_WAIT:String = "wait";
public static const sSTATE_DROP:String = "drop";
public static const sSTATE_TAKE:String = "take";
public function Knife(_arg1:MovieClip):void{
super(_arg1);
mcRef.x = Layout.Knife.x;
mcRef.y = Layout.Knife.y;
mcRef.scaleX = (mcRef.scaleY = Layout.Knife.scale);
addState(sSTATE_IDLE, null, state_config);
addState(sSTATE_DROP, state_drop, state_config);
addState(sSTATE_CUT, state_cut, state_config);
addState(sSTATE_TAKE, state_take, state_config);
addState(sSTATE_WAIT, null, state_config);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_ON_CUTBOARD, cutboard, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_CUT, cut, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, resume, false, 0, true);
setState(sSTATE_IDLE);
mcRef.mouseChildren = false;
mcRef.mouseEnabled = false;
}
public function cut(_arg1:Event):void{
if ((((state == sSTATE_WAIT)) || ((state == sSTATE_TAKE)))){
drop();
};
}
public function clear():void{
if (state == sSTATE_CUT){
setState(sSTATE_DROP);
} else {
if (state != sSTATE_IDLE){
setState(sSTATE_DROP);
};
};
}
public function take():void{
SoundEngine.Play(Main.sSOUND_SFX, SoundList.sSOUND_KNIFE_TAKE, 1, true, false, true);
setState(sSTATE_TAKE);
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_ON_CUTBOARD, cutboard, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_CUT, cut, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_PAUSE, pause, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_RESUME, resume, false);
mcRef = null;
}
public function state_cut():void{
if (stateComplete){
setState(sSTATE_DROP);
};
}
public function state_drop():void{
if (stateComplete){
setState(sSTATE_IDLE);
};
}
public function cutboard(_arg1:Event):void{
take();
}
public function drop():void{
setState(sSTATE_CUT);
}
public function state_take():void{
if (stateComplete){
setState(sSTATE_WAIT);
};
}
public function state_config():void{
mcRef.mouseChildren = false;
mcRef.mouseEnabled = false;
}
}
}//package gameplay.tools
Section 50
//KnifeShadow (gameplay.tools.KnifeShadow)
package gameplay.tools {
import flash.events.*;
import flash.display.*;
import library.events.*;
import library.basic.*;
import library.interfaces.*;
import gameplay.layout.*;
public class KnifeShadow extends StateManaged implements Idestroyable {
public static const sSTATE_IDLE:String = "idle";
public static const sSTATE_WAIT:String = "wait";
public static const sSTATE_DROP:String = "drop";
public static const sSTATE_TAKE:String = "take";
public function KnifeShadow(_arg1:MovieClip):void{
super(_arg1);
mcRef.x = Layout.KnifeShadow.x;
mcRef.y = Layout.KnifeShadow.y;
mcRef.scaleX = (mcRef.scaleY = Layout.KnifeShadow.scale);
addState(sSTATE_IDLE, null);
addState(sSTATE_DROP, state_drop);
addState(sSTATE_TAKE, state_take);
addState(sSTATE_WAIT, null);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_ON_CUTBOARD, cutboard, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_CUT, cut, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, resume, false, 0, true);
setState(sSTATE_IDLE);
}
public function cut(_arg1:Event):void{
drop();
}
public function take():void{
setState(sSTATE_TAKE);
}
public function state_drop():void{
if (stateComplete){
setState(sSTATE_IDLE);
};
}
public function cutboard(_arg1:Event):void{
take();
}
public function drop():void{
setState(sSTATE_DROP);
}
public function state_take():void{
if (stateComplete){
setState(sSTATE_WAIT);
};
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_ON_CUTBOARD, cutboard, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_CUT, cut, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_PAUSE, pause, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_RESUME, resume, false);
mcRef = null;
}
}
}//package gameplay.tools
Section 51
//Skip (gameplay.tutorial.Skip)
package gameplay.tutorial {
import flash.events.*;
import flash.display.*;
import library.events.*;
import library.basic.*;
import library.interfaces.*;
public class Skip extends StateManaged implements Idestroyable {
public static const sSTATE_IDLE:String = "idle";
public static const sSTATE_IN:String = "in";
public static const sSTATE_OUT:String = "out";
public function Skip(_arg1:MovieClip, _arg2:Object):void{
super(_arg1);
mcRef.x = _arg2.x;
mcRef.y = _arg2.y;
mcRef.scaleX = (mcRef.scaleY = _arg2.scale);
addState(sSTATE_IN, state_in);
addState(sSTATE_IDLE, null, state_idle_init, state_idle_end);
addState(sSTATE_OUT, state_out);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
Main.instance.gameManager.addEventListener("DestroySkipButton", onKill, false, 0, true);
setState(sSTATE_IN);
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
mcRef.parent.removeChild(mcRef);
mcRef = null;
}
public function state_in():void{
if (stateComplete){
setState(sSTATE_IDLE);
};
}
public function state_idle_end():void{
SimpleButton(mcState.getChildByName("btnSkip")).removeEventListener(MouseEvent.CLICK, onClick, false);
}
public function state_out():void{
if (stateComplete){
destroy(null);
};
}
public function onKill(_arg1:Event):void{
setState(sSTATE_OUT);
}
public function onClick(_arg1:MouseEvent):void{
setState(sSTATE_OUT);
Main.instance.gameManager.instruction.end();
}
public function state_idle_init():void{
SimpleButton(mcState.getChildByName("btnSkip")).addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
}
}
}//package gameplay.tutorial
Section 52
//TutEvent (gameplay.tutorial.TutEvent)
package gameplay.tutorial {
import flash.events.*;
import flash.display.*;
public class TutEvent extends Event {
private var oMc:MovieClip;
public static const sEVENT_CLICK:String = "TutorialClick";
public function TutEvent(_arg1:String, _arg2:MovieClip):void{
super(_arg1);
oMc = _arg2;
}
override public function toString():String{
return (formatToString("TutEvent", "type", "bubbles", "cancelable", "eventPhase", "mc"));
}
public function get mc():MovieClip{
return (oMc);
}
override public function clone():Event{
return (new TutEvent(type, mc));
}
}
}//package gameplay.tutorial
Section 53
//Tutorial (gameplay.tutorial.Tutorial)
package gameplay.tutorial {
import flash.events.*;
import flash.display.*;
import gameplay.panel.*;
import library.events.*;
import library.utils.*;
import gameplay.*;
import library.interfaces.*;
import gameplay.layout.*;
import flash.filters.*;
import gameplay.ingredients.*;
import gameplay.ingredients.fillings.*;
import gameplay.ingredients.basics.*;
import gameplay.ingredients.veggies.*;
import gameplay.ingredients.sauces.*;
public class Tutorial implements Idestroyable {
private var iFrame:int;
private var iSubIndex:int;
private var bDone:Boolean;
private var aGlow:Array;
private var oSkip:Skip;
private var aGroup:Array;
private var aList:Array;
private var aContainer:Array;
private var aAnims:Array;
private var oGlow:GlowFilter;
private var bDown:Boolean;
private var oLast;
private var aPanels:Array;
private var bClick:Boolean;
private var mcMember:MovieClip;
private var oStep:Object;
private var sSushi:String;
private var iIndex:int;
private var fWait:Function;
private var bRoll:Boolean;
private static var oInstance:Tutorial;
public function Tutorial():void{
var _local1:DepthManager;
super();
oInstance = this;
_local1 = Main.instance.gameManager.depthManager;
aContainer = new Array(_local1.getDepthLayer(Game.sDEPTH_INGREDIENTS), _local1.getDepthLayer(Game.sDEPTH_CHARACTERS), _local1.getDepthLayer(Game.sDEPTH_PLACE_HOLDER), _local1.getDepthLayer(Game.sDEPTH_MAT_LOWER));
aGlow = new Array(new GlowFilter(13382451, 0, 4, 4, 10));
oGlow = new GlowFilter(13382451, 0, 4, 4, 10);
aGroup = new Array();
aList = TutorialList.list;
aPanels = new Array();
iFrame = 0;
iIndex = -1;
iSubIndex = -1;
mcMember = null;
sSushi = null;
bDone = false;
bDown = false;
bClick = false;
bRoll = false;
fWait = null;
oStep = new Object();
aAnims = new Array();
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
Main.instance.gameManager.addEventListener(SequenceEvent.POSITIVE, onAction, false, 0, true);
Main.instance.gameManager.addEventListener(SequenceEvent.NEGATIVE, onAction, false, 0, true);
start();
}
public function stop():void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
}
public function onMouse(_arg1:MouseEvent):void{
Main.instance.removeEventListener(MouseEvent.MOUSE_DOWN, onMouse, false);
bDown = true;
}
private function targets():Boolean{
if (bDone){
bDone = false;
return (!(bDone));
};
return (bDone);
}
private function glow(... _args):void{
var _aRandom:Array;
var _mcTmp:MovieClip;
var i:int;
var args = _args;
_aRandom = new Array();
if ((args[0] is String)){
aGroup = new Array(mcMember);
mcMember.mcState.filters = aGlow;
toRed(mcMember.mcState);
} else {
aGroup = new Array();
i = 0;
while (i < args.length) {
switch (args[i]){
case mcCharacter01:
case mcCharacter02:
case mcCharacter03:
_mcTmp = getMovieClip(args[i]);
if (_mcTmp != null){
_aRandom.push(_mcTmp);
};
break;
default:
_mcTmp = getMovieClip(args[i]);
if (_mcTmp != null){
aGroup.push(_mcTmp);
};
break;
};
i = (i + 1);
};
if (_aRandom.length > 0){
mcMember = getMovieClip(_aRandom[Math.floor(((Math.random() * _aRandom.length) - 1))]);
aGroup.push(mcMember);
};
if (aGroup.length > 0){
aGroup.forEach(function (_arg1){
if (((((!((_arg1 == null))) && (!((_arg1.getChildByName("mcState") == null))))) && (isNot(_arg1.currentLabel, "sushi_in", "sushi_idle", "sushi_del")))){
_arg1.mcState.filters = new Array(oGlow);
toRed(_arg1.mcState);
};
}, this);
};
};
manage();
}
private function pattern():Boolean{
if (bDone){
bDone = false;
return (!(bDone));
};
return (bDone);
}
private function sushi(_arg1:String):void{
sSushi = _arg1;
Main.instance.gameManager.tutorial = true;
Main.instance.gameManager.setIngredients(false, {item:Algae, mc:mcAlgae}, {item:Rice, mc:mcRice}, {item:Tuna, mc:mcTuna}, {item:Daikon, mc:mcDaikon}, {item:Cucumber, mc:mcCucumber}, {item:Onion, mc:mcOnion});
Main.instance.gameManager.setSauces({item:Teriyaki, mc:mcTeriyaki});
manage();
}
private function bubble():void{
var _local1:String;
_local1 = ((mcMember is mcCharacter01)) ? "char01" : ((mcMember is mcCharacter02)) ? "char02" : "char03";
Main.instance.gameManager.displayBubble(_local1, sSushi, false);
manage();
}
public function end():void{
var i:int;
trace("Tutorial.end");
aPanels.forEach(function (_arg1){
if (TextPanel(_arg1).mcRef != null){
TextPanel(_arg1).setState(TextPanel.sSTATE_TUTORIAL_OUT);
};
}, this);
i = 0;
while (i < aAnims.length) {
Animate.removeTween(aAnims[i]);
i = (i + 1);
};
Main.instance.gameManager.dispatchEvent(new Event("DestroySkipButton"));
Main.instance.gameManager.started = false;
Main.instance.gameManager.clearClickDrawSequence();
Main.instance.gameManager.clearKnife();
Main.instance.gameManager.setIngredients(true);
Main.instance.gameManager.setSauces();
Main.instance.gameManager.clearPlaceHolder();
Main.instance.gameManager.clearRequestBubble();
Main.instance.gameManager.startGame();
destroy(null);
}
public function toRed(_arg1:MovieClip):void{
aAnims.push(Animate.to(oGlow, 10, {alpha:1, onUpdate:setGlow, onUpdateScope:this, onUpdateParams:[_arg1], onComplete:toTrans, onCompleteScope:this, onCompleteParams:[_arg1]}));
}
private function unglow(... _args):void{
var _local2:int;
if (mcMember != null){
mcMember.filters = new Array();
Animate.killTweensOf(mcMember);
};
_local2 = 0;
while (_local2 < aGroup.length) {
aGroup[_local2].filters = new Array();
Animate.killTweensOf(aGroup[_local2]);
_local2++;
};
manage();
}
private function click():Boolean{
if (bDown){
bDown = false;
return (!(bDown));
};
return (bDown);
}
private function clicked():Boolean{
if (bClick){
bClick = false;
return (!(bClick));
};
return (bClick);
}
private function choose(... _args):void{
mcMember = getMovieClip(_args[Math.floor((Math.random() * (_args.length - 1)))]);
manage();
}
public function setGlow(_arg1:MovieClip):void{
_arg1.filters = new Array(oGlow);
}
private function createTextPanel(_arg1:String):void{
var _local2:DisplayObjectContainer;
var _local3:MovieClip;
_local2 = Main.instance.gameManager.depthManager.getDepthLayer(Game.sDEPTH_BACKGROUND);
_local3 = new mcTutorial();
_local2.addChild(_local3);
aPanels.push(new TextPanel(_local3, _arg1, false));
}
private function roll():void{
Main.instance.gameManager.startMiniGame("Roll");
bRoll = true;
}
private function isNot(_arg1:String, ... _args):Boolean{
var _local3:Boolean;
var _local4:int;
_local3 = false;
_local4 = 0;
while (_local4 < _args.length) {
if (_arg1 == _args[_local4]){
_local3 = true;
break;
};
_local4++;
};
return (!(_local3));
}
private function time():Boolean{
iFrame--;
return ((iFrame <= 0));
}
public function nothing(_arg1:MouseEvent):void{
}
public function update(_arg1:Event):void{
if (((!((fWait == null))) && ((fWait is Function)))){
if (fWait()){
manage();
};
};
}
public function start():void{
var _local1:DisplayObjectContainer;
var _local2:MovieClip;
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
iIndex = 0;
manage();
_local1 = Main.instance.gameManager.depthManager.getDepthLayer(Game.sDEPTH_BACKGROUND);
_local2 = new mcSkipButton();
_local1.addChild(_local2);
oSkip = new Skip(_local2, Layout.Skip);
}
private function goto(_arg1:int):void{
iIndex = _arg1;
manage();
}
private function manage():void{
if (oStep == aList[iIndex]){
iSubIndex++;
if (iSubIndex >= oStep.funcs.length){
this[oStep.complete].apply(this, oStep.params);
} else {
this[oStep.funcs[iSubIndex].func].apply(this, oStep.funcs[iSubIndex].params);
};
} else {
if (iIndex < aList.length){
iSubIndex = -1;
oStep = aList[iIndex];
if (aPanels.length > 0){
aPanels[(aPanels.length - 1)].setState(TextPanel.sSTATE_TUTORIAL_OUT);
};
createTextPanel(oStep.state);
manage();
};
};
}
private function findMovieClip(_arg1):Boolean{
var _local2:Boolean;
var _local3:RegExp;
var _local4:String;
var _local5:String;
var _local6:int;
_local2 = false;
_local3 = new RegExp("(class)|(object)|s|[|]", "gi");
_local4 = String(_arg1).replace(_local3, "");
_local6 = 0;
while (_local6 < aGroup.length) {
_local5 = String(aGroup[_local6]).replace(_local3, "");
if (_local5.indexOf(_local4) > -1){
_local2 = true;
break;
};
_local6++;
};
return (_local2);
}
public function authorize(_arg1:String, _arg2:Boolean=false, _arg3=null):Boolean{
var _local4:Boolean;
_local4 = false;
switch (_arg1){
case "filling":
_local4 = ((findMovieClip(mcTuna)) && ((Main.instance.gameManager.selectedIngredient == null)));
break;
case "veggies":
_local4 = ((findMovieClip(_arg3)) && ((Main.instance.gameManager.selectedIngredient == null)));
break;
case "algae":
_local4 = ((findMovieClip(mcAlgae)) && ((Main.instance.gameManager.selectedIngredient == null)));
break;
case "rice":
_local4 = ((findMovieClip(mcRice)) && ((Main.instance.gameManager.selectedIngredient == null)));
break;
case "sauce":
_local4 = ((findMovieClip(mcTeriyaki)) && ((Main.instance.gameManager.selectedIngredient == null)));
break;
case "roll":
_local4 = bRoll;
break;
case "cut":
_local4 = findMovieClip(mcSushi);
break;
case "serve":
_local4 = ((findMovieClip(mcMember)) && (!((getMovieClip(mcSushi) == null))));
break;
};
return (_local4);
}
private function getMovieClip(_arg1:Class):MovieClip{
var _local2:Sprite;
var _local3:int;
var _local4:*;
var _local5:int;
_local5 = 0;
while (_local5 < aContainer.length) {
_local2 = aContainer[_local5];
_local3 = 0;
while (_local3 < _local2.numChildren) {
_local4 = _local2.getChildAt(_local3);
if ((_local4 is _arg1)){
return (_local4);
};
_local3++;
};
_local5++;
};
return (null);
}
public function toTrans(_arg1:MovieClip):void{
aAnims.push(Animate.to(oGlow, 10, {alpha:0, onUpdate:setGlow, onUpdateScope:this, onUpdateParams:[_arg1], onComplete:toRed, onCompleteScope:this, onCompleteParams:[_arg1]}));
}
private function next():void{
iIndex++;
manage();
}
private function wait(_arg1):void{
var _action = _arg1;
if ((((((_action is int)) || ((_action is uint)))) || ((_action is Number)))){
iFrame = (_action * 35);
fWait = time;
} else {
if ((_action is String)){
switch (_action){
case "clicked":
Main.instance.gameManager.addEventListener(TutEvent.sEVENT_CLICK, onClick, false, 0, true);
aGroup.forEach(function (_arg1){
}, this);
bClick = false;
fWait = clicked;
break;
case "click":
Main.instance.addEventListener(MouseEvent.MOUSE_DOWN, onMouse, false, 0, true);
fWait = click;
break;
case "targets":
bDone = false;
fWait = targets;
break;
case "pattern":
bDone = false;
fWait = pattern;
break;
};
};
};
}
private function previous():void{
iIndex--;
manage();
}
public function onClick(_arg1:TutEvent):void{
var _e = _arg1;
if (oLast != _e.mc.name){
oLast = _e.mc.name;
aGroup.forEach(function (_arg1){
}, this);
bClick = true;
};
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
}
public function onAction(_arg1:SequenceEvent):void{
bDone = true;
}
public static function get instance():Tutorial{
return (oInstance);
}
}
}//package gameplay.tutorial
Section 54
//TutorialList (gameplay.tutorial.TutorialList)
package gameplay.tutorial {
public class TutorialList {
public static var list:Array = [{state:"tuto_01", funcs:[{func:"choose", params:[mcCharacter01, mcCharacter02, mcCharacter03]}, {func:"wait", params:[6.8]}], complete:"next", params:[]}, {state:"tuto_02", funcs:[{func:"sushi", params:["sushi02"]}, {func:"bubble", params:[]}, {func:"wait", params:[1.5]}, {func:"glow", params:[mcTuna]}, {func:"wait", params:["clicked"]}, {func:"unglow", params:[]}], complete:"next", params:[]}, {state:"tuto_03", funcs:[{func:"wait", params:["targets"]}], complete:"next", params:[]}, {state:"tuto_04", funcs:[{func:"glow", params:[mcCucumber]}, {func:"wait", params:["clicked"]}, {func:"unglow", params:[]}, {func:"wait", params:["targets"]}], complete:"next", params:[]}, {state:"tuto_05", funcs:[{func:"wait", params:[1.5]}], complete:"next", params:[]}, {state:"tuto_06", funcs:[{func:"glow", params:[mcDaikon]}, {func:"wait", params:["clicked"]}, {func:"unglow", params:[]}, {func:"wait", params:["targets"]}], complete:"next", params:[]}, {state:"tuto_07", funcs:[{func:"glow", params:[mcOnion]}, {func:"wait", params:["clicked"]}, {func:"unglow", params:[]}, {func:"wait", params:["targets"]}], complete:"next", params:[]}, {state:"tuto_08", funcs:[{func:"glow", params:[mcAlgae]}, {func:"wait", params:["clicked"]}, {func:"unglow", params:[]}, {func:"wait", params:["click"]}], complete:"next", params:[]}, {state:"tuto_09", funcs:[{func:"wait", params:["pattern"]}], complete:"next", params:[]}, {state:"tuto_10", funcs:[{func:"glow", params:[mcRice]}, {func:"wait", params:["clicked"]}, {func:"unglow", params:[]}], complete:"next", params:[]}, {state:"tuto_11", funcs:[{func:"wait", params:["pattern"]}], complete:"next", params:[]}, {state:"tuto_12", funcs:[{func:"glow", params:[mcTuna, mcCucumber, mcDaikon, mcOnion]}, {func:"wait", params:["clicked"]}, {func:"unglow", params:[]}, {func:"glow", params:[mcTuna, mcCucumber, mcDaikon, mcOnion]}, {func:"wait", params:["clicked"]}, {func:"unglow", params:[]}, {func:"glow", params:[mcTuna, mcCucumber, mcDaikon, mcOnion]}, {func:"wait", params:["clicked"]}, {func:"unglow", params:[]}, {func:"glow", params:[mcTuna, mcCucumber, mcDaikon, mcOnion]}, {func:"wait", params:["clicked"]}, {func:"unglow", params:[]}], complete:"next", params:[]}, {state:"tuto_13", funcs:[{func:"glow", params:[mcTeriyaki]}, {func:"wait", params:["clicked"]}, {func:"unglow", params:[]}], complete:"next", params:[]}, {state:"tuto_14", funcs:[{func:"wait", params:["pattern"]}], complete:"next", params:[]}, {state:"tuto_15", funcs:[{func:"wait", params:[1]}, {func:"roll", params:[]}, {func:"wait", params:["pattern"]}], complete:"next", params:[]}, {state:"tuto_16", funcs:[{func:"wait", params:[1]}, {func:"glow", params:[mcSushi]}, {func:"wait", params:["clicked"]}, {func:"unglow", params:[]}, {func:"wait", params:["targets"]}], complete:"next", params:[]}, {state:"tuto_17", funcs:[{func:"glow", params:["member"]}, {func:"wait", params:["clicked"]}], complete:"next", params:[]}, {state:"tuto_18", funcs:[{func:"wait", params:[10]}], complete:"next", params:[]}, {state:"tuto_19", funcs:[{func:"wait", params:[8]}], complete:"end", params:[]}];
}
}//package gameplay.tutorial
Section 55
//AI (gameplay.AI)
package gameplay {
import flash.events.*;
import library.events.*;
import library.interfaces.*;
import gameplay.sushi.*;
import gameplay.ingredients.sauces.*;
public class AI implements Idestroyable {
private var bIsWorking:Boolean;
private var iDelay:int;
private var iLevel:int;
private var nThreshold:Number;
public function AI():void{
bIsWorking = false;
iLevel = 1;
iDelay = 35;
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
}
public function get level():int{
return (iLevel);
}
public function get threshold():Number{
return (nThreshold);
}
private function selectSushi():void{
var _local1:int;
var _local2:Array;
var _local3:int;
var _local4:String;
var _local5:Array;
var _local6:Boolean;
bIsWorking = true;
nThreshold = Math.min(0.2, (iLevel * 0.015));
trace(("nThreshold : " + nThreshold));
_local1 = Math.min(Math.max(1, Math.floor((iLevel * Config.Difficulty.RecipeIncrease))), 3);
trace(("_iDifficulty : " + _local1));
_local2 = new Array();
_local3 = 0;
while (_local3 < SushiList.list.length) {
if (SushiList.list[_local3].difficulty <= _local1){
_local2.push(SushiList.list[_local3]);
};
_local3++;
};
_local4 = _local2[Math.floor((Math.random() * _local2.length))].name;
trace(("_sSushi : " + _local4));
_local5 = new Array("char01", "char02", "char03");
_local6 = (Math.random() < Config.Probability.HotSauce);
Main.instance.gameManager.setSushi(_local4);
Main.instance.gameManager.instruction.setInstructions(_local4);
Main.instance.gameManager.displayBubble(_local5[Math.floor((Math.random() * _local5.length))], _local4, _local6);
if (_local6){
Main.instance.gameManager.instruction.addInstruction("sauce", Mayonnaise, new mcMayonnaise());
};
Main.instance.gameManager.addEventListener(GameEvent.EVENT_COMPLETE, complete, false, 0, true);
}
private function update(_arg1:Event):void{
if (((!(bIsWorking)) && ((iDelay <= 0)))){
selectSushi();
} else {
if (iDelay > 0){
iDelay--;
};
};
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_COMPLETE, complete, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
}
private function complete(_arg1:Event):void{
bIsWorking = false;
iLevel++;
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_COMPLETE, complete, false);
}
public function get isWorking():Boolean{
return (bIsWorking);
}
}
}//package gameplay
Section 56
//Game (gameplay.Game)
package gameplay {
import library.sounds.*;
import flash.events.*;
import flash.display.*;
import library.events.*;
import gameplay.tutorial.*;
import gameplay.mouse.*;
import library.utils.*;
import gameplay.hud.*;
import gameplay.background.*;
import gameplay.bubble.*;
import gameplay.special.*;
import library.interfaces.*;
import gameplay.layout.*;
import gameplay.instruct.*;
import gameplay.sushi.*;
import gameplay.tools.*;
import gameplay.powerups.*;
import gameplay.characters.*;
import gameplay.feedbacks.*;
import gameplay.games.*;
import gameplay.ingredients.*;
import gameplay.ingredients.fillings.*;
import gameplay.ingredients.basics.*;
import gameplay.ingredients.veggies.*;
import gameplay.ingredients.sauces.*;
public class Game extends EventDispatcher implements Idestroyable {
private var oCharacter03:Character03;
private var oHud:Hud;
private var nTotalBubbles:Number;
private var oFeedback:Feedback;
private var oMatLower:Mat;
private var oSauce2;
private var oSauce3;
private var mcRef:MovieClip;
private var oSauce1;
private var aDisplay:Array;
private var sCharSelected:String;
private var aDeleting:Array;
private var oChar02Soya:Soya;
private var oKnifeShadow:KnifeShadow;
public var sInAnim:String;
public var bGood:Boolean;
private var oSpecial:Special;
private var oCutBoard:CutBoard;
private var sSushi:String;
private var aPlaceHolder:Array;
private var oKnife:Knife;
private var oMiniGame;
private var oDepthManager:DepthManager;
private var oTable:Table;
private var iTestFrame:int;
private var oCursor:Cursor;
private var oChar01Soya:Soya;
private var oChar03Soya:Soya;
private var oMatUpper:Mat;
private var oSpecialKey:SpecialKey;
public var bPause:Boolean;
private var bStarted:Boolean;
private var oSlot1;
private var oSlot2;
private var oSlot3;
private var oSlot4;
private var oSlot5;
private var oInstruct:Instruct;
private var oSlot7;
private var oSlot8;
public var selectedIngredient;
private var oAI:AI;
private var oSlot6;
private var oArrow:Arrows;
private var oBubble:Bubble;
private var bTutorial:Boolean;
public var oKanji:Kanji;
private var oTutorial:Tutorial;
private var oCharacter01:Character01;
private var oCharacter02:Character02;
private var oBackground:Background;
public static const sDEPTH_CURSOR:String = "cursor";
public static const sDEPTH_HUD:String = "hud";
public static const sDEPTH_KNIFE_SHADOW:String = "shadow";
public static const sDEPTH_MAT_LOWER:String = "matlower";
public static const sDEPTH_PLACE_HOLDER:String = "placeholder";
public static const sDEPTH_MAT_UPPER:String = "matupper";
public static const sDEPTH_INGREDIENTS:String = "ingredients";
public static const sDEPTH_KNIFE:String = "knife";
public static const sDEPTH_BOARD:String = "board";
public static const sDEPTH_CHARACTERS:String = "characters";
public static const sDEPTH_BACKGROUND:String = "background";
public static const sDEPTH_TABLE:String = "table";
public function Game(_arg1:MovieClip){
mcRef = _arg1;
oDepthManager = new DepthManager();
oDepthManager.addDepthLayer(sDEPTH_BACKGROUND, mcRef);
oDepthManager.addDepthLayer(sDEPTH_CHARACTERS, mcRef);
oDepthManager.addDepthLayer(sDEPTH_TABLE, mcRef);
oDepthManager.addDepthLayer(sDEPTH_KNIFE_SHADOW, mcRef);
oDepthManager.addDepthLayer(sDEPTH_INGREDIENTS, mcRef);
oDepthManager.addDepthLayer(sDEPTH_MAT_LOWER, mcRef);
oDepthManager.addDepthLayer(sDEPTH_PLACE_HOLDER, mcRef);
oDepthManager.addDepthLayer(sDEPTH_MAT_UPPER, mcRef);
oDepthManager.addDepthLayer(sDEPTH_KNIFE, mcRef);
oDepthManager.addDepthLayer(sDEPTH_BOARD, mcRef);
oDepthManager.addDepthLayer(sDEPTH_HUD, mcRef);
oDepthManager.addDepthLayer(sDEPTH_CURSOR, mcRef);
aDeleting = new Array();
aDisplay = new Array();
bTutorial = true;
iTestFrame = 300;
Main.instance.stage.focus = Main.instance.stage;
Main.instance.addEventListener(MainEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.addEventListener(MainEvent.EVENT_DESTROY, destroy, false, 0, true);
Main.instance.addEventListener(MainEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.addEventListener(MainEvent.EVENT_RESUME, resume, false, 0, true);
addEventListener(SequenceEvent.POSITIVE, positive, false, 0, true);
addEventListener(SequenceEvent.NEGATIVE, negative, false, 0, true);
addEventListener(GameEvent.EVENT_LOSE, lose, false, 0, true);
nTotalBubbles = 0;
}
public function clearClickDrawSequence():void{
if (oMiniGame != null){
oMiniGame.destroy(null);
oMiniGame = null;
};
}
private function addInstruct():void{
oInstruct = new Instruct();
}
private function pause(_arg1:Event):void{
bPause = true;
dispatchEvent(new GameEvent(GameEvent.EVENT_PAUSE, false, false));
Main.instance.removeEventListener(MainEvent.EVENT_UPDATE, update, false);
}
public function clearPlaceHolder():void{
var _local1:int;
_local1 = (aPlaceHolder.length - 1);
while (_local1 > -1) {
aDeleting.push(aPlaceHolder[_local1]);
aDeleting[(aDeleting.length - 1)].deleteIt();
aPlaceHolder.splice(_local1, 1);
_local1--;
};
}
public function destroy(_arg1:Event):void{
dispatchEvent(new GameEvent(GameEvent.EVENT_DESTROY, false, false));
Main.instance.removeEventListener(MainEvent.EVENT_UPDATE, update, false);
Main.instance.removeEventListener(MainEvent.EVENT_DESTROY, destroy, false);
Main.instance.removeEventListener(GameEvent.EVENT_LOSE, lose, false);
oDepthManager.destroy(null);
oDepthManager = null;
oTable = null;
oBackground = null;
oCursor = null;
oCharacter01 = null;
oCharacter02 = null;
oCharacter03 = null;
oHud = null;
mcRef = null;
}
public function returnToIngredient(_arg1:MovieClip=null, _arg2=null, _arg3:int=0):void{
var _local4:DisplayObjectContainer;
var _local5:Object;
if (_arg3 > 0){
_local4 = oDepthManager.getDepthLayer(sDEPTH_INGREDIENTS);
_local5 = Layout.Ingredients[("slot" + _arg3)];
_local5.slot = _arg3;
_local4.addChild(_arg1);
this[("oSlot" + _arg3)].destroy(null);
this[("oSlot" + _arg3)] = new _arg2(_arg1, _local5, sInAnim);
} else {
selectedIngredient.poured = true;
selectedIngredient.setState(sInAnim);
};
selectedIngredient = null;
sInAnim = null;
}
public function setSauces(... _args):void{
var i:int;
var args = _args;
i = 0;
while (i < 3) {
try {
if (this[("oSauce" + (i + 1))] != null){
aDeleting.push(this[("oSauce" + (i + 1))]);
aDeleting[(aDeleting.length - 1)].deleteIt();
this[("oSauce" + (i + 1))] = null;
};
} catch(e:Error) {
};
i = (i + 1);
};
if (!Animate.queuing){
Animate.queue(false, {func:Animate.to, target:mcRef, duration:1, vars:{delay:8}});
};
i = 0;
while (i < args.length) {
Animate.add({func:Animate.to, target:mcRef, duration:8, vars:{onStart:addSauce, onStartScope:this, onStartParams:[args[i].item, new args[i].mc()]}});
i = (i + 1);
};
}
private function addCharacters():void{
var _local1:DisplayObjectContainer;
var _local2:MovieClip;
var _local3:MovieClip;
var _local4:MovieClip;
_local1 = oDepthManager.getDepthLayer(sDEPTH_CHARACTERS);
_local2 = new mcCharacter01();
_local3 = new mcCharacter02();
_local4 = new mcCharacter03();
_local1.addChild(_local4);
_local1.addChild(_local3);
_local1.addChild(_local2);
oCharacter01 = new Character01(_local2);
oCharacter02 = new Character02(_local3);
oCharacter03 = new Character03(_local4);
}
public function lose(_arg1:Event):void{
SoundEngine.Play(Main.sSOUND_SFX, SoundList.sSOUND_END_GAME, 1, true, false, true);
Main.instance.nScore = ScoreManagement.instance.score;
Main.instance.transitTo(Main.sSTATE_LOSE);
}
public function set started(_arg1:Boolean):void{
bStarted = _arg1;
}
private function addUpperMat():void{
var _local1:DisplayObjectContainer;
var _local2:MovieClip;
_local1 = oDepthManager.getDepthLayer(sDEPTH_MAT_UPPER);
_local2 = new mcSushiMat();
_local1.addChild(_local2);
oMatUpper = new Mat(_local2, true);
}
private function addTutorial():void{
oTutorial = new Tutorial();
}
public function charAction(_arg1:String):void{
if (sCharSelected == _arg1){
dispatchEvent(new Event((_arg1 + "_good")));
} else {
dispatchEvent(new Event((_arg1 + "_bad")));
};
}
private function resume(_arg1:Event):void{
bPause = false;
dispatchEvent(new GameEvent(GameEvent.EVENT_RESUME, false, false));
Main.instance.addEventListener(MainEvent.EVENT_UPDATE, update, false, 0, true);
}
public function get ai():AI{
return (oAI);
}
public function negative(_arg1:SequenceEvent):void{
createFeedback(_arg1.position, Feedback.sSTATE_NEGATIVE);
dispatchEvent(new Event(GameEvent.EVENT_CUT));
}
public function setIngredients(_arg1:Boolean, ... _args):void{
var i:int;
var _bClear = _arg1;
var args = _args;
trace(((("Game.setIngredients > _bClear : " + _bClear) + ", ... args : ") + args));
i = 0;
while (i < 9) {
try {
if (this[("oSlot" + (i + 1))] != null){
aDeleting.push(this[("oSlot" + (i + 1))]);
aDeleting[(aDeleting.length - 1)].deleteIt();
this[("oSlot" + (i + 1))] = null;
};
} catch(e:Error) {
};
i = (i + 1);
};
if (_bClear){
Animate.stopAll();
} else {
i = 0;
while (i < args.length) {
trace(((("args[" + i) + "].item : ") + args[i].item));
trace(((("args[" + i) + "].mc : ") + args[i].mc));
addIngredient(args[i].item, new args[i].mc());
i = (i + 1);
};
trace("-------------- END SetIngredients ---------------");
};
}
public function get character():String{
return (sCharSelected);
}
public function get arrow():Arrows{
return (oArrow);
}
private function addCursor():void{
var _local1:DisplayObjectContainer;
var _local2:MovieClip;
_local1 = oDepthManager.getDepthLayer(sDEPTH_CURSOR);
_local2 = new mcCursor();
_local1.addChild(_local2);
oCursor = new Cursor(_local2);
}
public function getSushi():String{
return (sSushi);
}
public function get tutorial():Boolean{
return (bTutorial);
}
private function addLowerMat():void{
var _local1:DisplayObjectContainer;
var _local2:MovieClip;
_local1 = oDepthManager.getDepthLayer(sDEPTH_MAT_LOWER);
_local2 = new mcSushiMat();
_local1.addChild(_local2);
oMatLower = new Mat(_local2);
}
public function clearKnife():void{
if (oKnife != null){
oKnife.clear();
};
}
public function startMiniGame(_arg1:String):void{
var _local2:DisplayObjectContainer;
var _local3:MovieClip;
_local2 = oDepthManager.getDepthLayer(sDEPTH_HUD);
switch (_arg1){
case "Algae":
case "Rice":
_local3 = new mcSpreadIndicator();
_local2.addChild(_local3);
oMiniGame = new DrawSequence("spread", _local3, getThreshold());
break;
case "Cucumber":
case "Daikon":
case "Onion":
case "Chicken":
case "Egg":
case "Salmon":
case "Shrimp":
case "Tuna":
case "Sushi":
oMiniGame = new ClickSequence(defineDots(_arg1), getThreshold());
break;
case "Cheese":
case "Mayonnaise":
case "Teriyaki":
_local3 = new mcPourIndicator();
_local2.addChild(_local3);
oMiniGame = new DrawSequence("pour", _local3, getThreshold());
break;
case "Roll":
_local3 = new mcRollIndicator();
_local2.addChild(_local3);
oMiniGame = new DrawSequence("roll", _local3, getThreshold());
break;
};
SoundEngine.Play(Main.sSOUND_SFX, SoundList.sSOUND_MINIGAME_START, 1, true, false, true);
}
private function addSoyas():void{
var _local1:DisplayObjectContainer;
var _local2:MovieClip;
var _local3:MovieClip;
var _local4:MovieClip;
_local1 = oDepthManager.getDepthLayer(sDEPTH_TABLE);
_local2 = new mcSoya();
_local3 = new mcSoya();
_local4 = new mcSoya();
_local1.addChild(_local2);
_local1.addChild(_local3);
_local1.addChild(_local4);
oChar01Soya = new Soya(_local2, Layout.CarlySoya);
oChar02Soya = new Soya(_local3, Layout.SamSoya);
oChar03Soya = new Soya(_local4, Layout.FreddieSoya);
}
public function initObject():void{
aPlaceHolder = new Array();
oSpecial = new Special();
addHUD();
addBackground();
addCharacters();
addTable();
addCutBoard();
addLowerMat();
addUpperMat();
addKnifeShadow();
addKnife();
addSoyas();
addTutorial();
}
public function get depthManager():DepthManager{
return (oDepthManager);
}
public function startGame():void{
oTutorial = null;
bTutorial = false;
oHud.showGo();
addInstruct();
addArrow();
activeAI();
oSpecialKey = new SpecialKey(Config.Special.Word);
}
public function clearCurrent():void{
selectedIngredient = null;
sInAnim = null;
Animate.killGarbage(null);
}
public function roll():void{
oMatLower.roll();
oMatUpper.roll(true);
}
public function addIngredient(_arg1, _arg2:MovieClip):void{
var _local3:int;
var _local4:DisplayObjectContainer;
var _local5:Object;
trace(((("Game.addIngredient > _fClass : " + _arg1) + ", _mcIngredient : ") + _arg2));
if (((!((_arg1 == null))) && (!((_arg2 == null))))){
_local3 = 1;
while (_local3 <= 8) {
if (this[("oSlot" + _local3)] == null){
_local4 = oDepthManager.getDepthLayer(sDEPTH_INGREDIENTS);
_local4.addChild(_arg2);
_local5 = Layout.Ingredients[("slot" + _local3)];
_local5.slot = _local3;
this[("oSlot" + _local3)] = new _arg1(_arg2, _local5, null, bTutorial);
break;
};
_local3++;
};
};
}
public function addSauce(_arg1, _arg2:MovieClip):void{
var _local3:int;
var _local4:DisplayObjectContainer;
if (((!((_arg1 == null))) && (!((_arg2 == null))))){
_local3 = 1;
while (_local3 <= 3) {
if (this[("oSauce" + _local3)] == null){
_local4 = oDepthManager.getDepthLayer(sDEPTH_INGREDIENTS);
_local4.addChild(_arg2);
this[("oSauce" + _local3)] = new _arg1(_arg2, Layout.Ingredients[("sauce" + _local3)], null, bTutorial);
break;
};
_local3++;
};
};
}
public function get mat():Mat{
return (oMatLower);
}
public function getIngredientsList():Array{
var _local1:Array;
var _local2:int;
var _local3:int;
var _local4:int;
_local1 = new Array();
_local2 = 1;
while (_local2 < 9) {
_local1.push(this[("oSlot" + _local2)]);
_local2++;
};
_local3 = 1;
while (_local3 < 4) {
_local1.push(this[("oSauce" + _local3)]);
_local3++;
};
_local4 = 0;
while (_local4 < aPlaceHolder.length) {
if ((((aPlaceHolder[_local4] is Sushi)) && (!((aPlaceHolder[_local4].mcRef == null))))){
_local1.push(aPlaceHolder[_local4]);
};
_local4++;
};
return (_local1);
}
private function addKnife():void{
var _local1:DisplayObjectContainer;
var _local2:MovieClip;
_local1 = oDepthManager.getDepthLayer(sDEPTH_KNIFE);
_local2 = new mcKnife();
_local1.addChild(_local2);
oKnife = new Knife(_local2);
}
public function set display(_arg1:Array):void{
aDisplay = _arg1;
}
public function get instruction(){
return (((oInstruct)!=null) ? oInstruct : oTutorial);
}
private function addCutBoard():void{
var _local1:DisplayObjectContainer;
var _local2:MovieClip;
_local1 = oDepthManager.getDepthLayer(sDEPTH_TABLE);
_local2 = new mcCutBoard();
_local1.addChild(_local2);
oCutBoard = new CutBoard(_local2);
}
public function get started():Boolean{
return (bStarted);
}
public function createFeedback(_arg1:Object, _arg2:String):void{
var _local3:DisplayObjectContainer;
var _local4:MovieClip;
_local3 = oDepthManager.getDepthLayer(sDEPTH_HUD);
_local4 = new mcFeedback();
_local3.addChild(_local4);
oFeedback = new Feedback(_local4, _arg1, _arg2);
}
private function addTable():void{
var _local1:DisplayObjectContainer;
var _local2:MovieClip;
_local1 = oDepthManager.getDepthLayer(sDEPTH_TABLE);
_local2 = new mcTable();
_local1.addChild(_local2);
oTable = new Table(_local2);
}
private function addBackground():void{
var _local1:DisplayObjectContainer;
var _local2:MovieClip;
_local1 = oDepthManager.getDepthLayer(sDEPTH_BACKGROUND);
_local2 = new mcBackground();
_local1.addChild(_local2);
oBackground = new Background(_local2);
}
private function addHUD():void{
var _local1:DisplayObjectContainer;
var _local2:MovieClip;
_local1 = oDepthManager.getDepthLayer(sDEPTH_HUD);
_local2 = new mcHUD();
_local1.addChild(_local2);
oHud = new Hud(_local2);
}
public function get special():Special{
return (oSpecial);
}
private function getThreshold():Number{
if (ai != null){
return (ai.threshold);
};
return (Config.Tutorial.Threshold);
}
public function activeAI():void{
oAI = new AI();
}
public function get display():Array{
return (aDisplay);
}
public function set tutorial(_arg1:Boolean):void{
bTutorial = _arg1;
}
private function defineDots(_arg1:String):Array{
var _local2:Array;
var _local3:Array;
var _local4:DisplayObjectContainer;
var _local5:MovieClip;
var _local6:Object;
var _local7:int;
_local2 = new Array();
switch (_arg1){
case "Cucumber":
_local2 = Layout.cucumberSequence;
break;
case "Daikon":
_local2 = Layout.daikonSequence;
break;
case "Onion":
_local2 = Layout.onionSequence;
break;
case "Chicken":
_local2 = Layout.chickenSequence;
break;
case "Egg":
_local2 = Layout.eggSequence;
break;
case "Salmon":
_local2 = Layout.salmonSequence;
break;
case "Shrimp":
_local2 = Layout.shrimpSequence;
break;
case "Tuna":
_local2 = Layout.tunaSequence;
break;
case "Sushi":
_local2 = Layout.sushiSequence;
break;
};
_local3 = new Array();
_local4 = oDepthManager.getDepthLayer(sDEPTH_HUD);
_local7 = 0;
while (_local7 < _local2.length) {
_local5 = new mcDotIndicator();
_local4.addChild(_local5);
_local6 = {mc:_local5, layout:_local2[_local7]};
_local3.push(_local6);
_local7++;
};
return (_local3);
}
private function addKnifeShadow():void{
var _local1:DisplayObjectContainer;
var _local2:MovieClip;
_local1 = oDepthManager.getDepthLayer(sDEPTH_KNIFE_SHADOW);
_local2 = new mcKnifeShadow();
_local1.addChild(_local2);
oKnifeShadow = new KnifeShadow(_local2);
}
public function setSushi(_arg1:String):void{
sSushi = _arg1;
}
public function clearRequestBubble():void{
if (oBubble != null){
oBubble.destroy(null);
};
}
private function update(_arg1:Event):void{
var _local2:Number;
var _local3:DisplayObjectContainer;
var _local4:MovieClip;
dispatchEvent(new GameEvent(GameEvent.EVENT_UPDATE, false, false));
if (((!(bTutorial)) && ((oKanji == null)))){
iTestFrame--;
if (iTestFrame <= 0){
iTestFrame = Config.Probability.TestFrameKanji;
_local2 = Math.random();
if (_local2 < Config.Probability.PowerUpKanji){
_local3 = oDepthManager.getDepthLayer(sDEPTH_HUD);
_local4 = new mcPowerup();
_local3.addChild(_local4);
oKanji = new Kanji(_local4, Layout.Kanji, Config.Probability.DisplayTime);
iTestFrame = (iTestFrame * 5);
};
};
};
}
public function displayBubble(_arg1:String, _arg2:String, _arg3:Boolean):void{
var _local4:DisplayObjectContainer;
var _local5:MovieClip;
sCharSelected = _arg1;
_local4 = oDepthManager.getDepthLayer(sDEPTH_BACKGROUND);
_local5 = new mcRequest();
_local4.addChild(_local5);
oBubble = new Bubble(_local5, Layout.Bubble, _arg1, _arg2, _arg3);
}
private function addArrow():void{
var _local1:DisplayObjectContainer;
var _local2:MovieClip;
_local1 = oDepthManager.getDepthLayer(sDEPTH_BACKGROUND);
_local2 = new mcArrow();
_local1.addChild(_local2);
oArrow = new Arrows(_local2, Layout.Arrow);
}
public function addPlate(_arg1:int):void{
var _local2:DisplayObjectContainer;
var _local3:MovieClip;
_local2 = oDepthManager.getDepthLayer(sDEPTH_INGREDIENTS);
_local3 = new mcPlate();
_local2.addChild(_local3);
this[("oSlot" + _arg1)] = new Plate(_local3, Layout.Ingredients[("slot" + _arg1)]);
}
public function addToPlaceHolder(_arg1, _arg2:String, _arg3, _arg4:MovieClip, _arg5:Object, _arg6:String=null):void{
var _local7:DisplayObjectContainer;
selectedIngredient = _arg1;
sInAnim = _arg2;
_local7 = oDepthManager.getDepthLayer(sDEPTH_MAT_LOWER);
_local7.addChild(_arg4);
aPlaceHolder.push(new _arg3(_arg4, _arg5, _arg6, bTutorial));
}
public function positive(_arg1:SequenceEvent):void{
createFeedback(_arg1.position, Feedback.sSTATE_POSITIVE);
dispatchEvent(new Event(GameEvent.EVENT_CUT));
}
public function get hud():Hud{
return (oHud);
}
}
}//package gameplay
Section 57
//ScoreManagement (gameplay.ScoreManagement)
package gameplay {
import flash.events.*;
import flash.display.*;
import library.events.*;
import library.utils.*;
import library.interfaces.*;
import library.easing.*;
import flash.text.*;
public class ScoreManagement implements Idestroyable {
private var txtScore:TextField;
private var nScore:Number;
public var mcRef:MovieClip;
private static var oInstance:ScoreManagement;
public function ScoreManagement(_arg1:MovieClip):void{
mcRef = _arg1;
txtScore = mcRef.txtScore;
oInstance = this;
nScore = 0;
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
}
public function update(_arg1:Event):void{
displayScore();
}
private function displayScore():void{
var _local1:String;
_local1 = Math.floor(nScore).toString();
while (_local1.length < 9) {
_local1 = ("0" + _local1);
};
txtScore.text = _local1;
}
public function addScore(_arg1:Number):void{
Animate.to(mcRef, 35, {onUpdate:toScore, onUpdateScope:this, onUpdateParams:[_arg1], ease:Linear.easeNone});
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
txtScore = null;
mcRef = null;
}
public function toScore(_arg1:Number):void{
nScore = (nScore + _arg1);
if (nScore < 0){
nScore = 0;
};
}
public function get score():Number{
return (nScore);
}
public static function get instance():ScoreManagement{
return (oInstance);
}
}
}//package gameplay
Section 58
//Popup (library.basic.Popup)
package library.basic {
import flash.events.*;
import flash.display.*;
public class Popup extends StateManaged {
public static const sSTATE_IDLE:String = "idle";
public static const sSTATE_APPEAR:String = "appear";
public static const sSTATE_DISAPPEAR:String = "disappear";
public function Popup(_arg1:MovieClip){
super(_arg1);
}
protected function state_idle():void{
}
protected function state_appear():void{
if (stateComplete){
setState(sSTATE_IDLE);
};
}
protected function setButton(_arg1:DisplayObject, _arg2:Function, _arg3:Function, _arg4:Boolean=false):void{
if (_arg4 == false){
_arg1.addEventListener(MouseEvent.CLICK, _arg2, false, 0, true);
_arg1.addEventListener(MouseEvent.ROLL_OVER, _arg3, false, 0, true);
} else {
_arg1.stage.focus = null;
_arg1.removeEventListener(MouseEvent.CLICK, _arg2, false);
_arg1.removeEventListener(MouseEvent.ROLL_OVER, _arg3, false);
};
}
protected function state_disappear():void{
if (stateComplete){
Main.instance.removePopup(this);
};
}
public function close():void{
if (state == sSTATE_IDLE){
setState(sSTATE_DISAPPEAR);
};
}
}
}//package library.basic
Section 59
//Screen (library.basic.Screen)
package library.basic {
import flash.events.*;
import flash.display.*;
import library.interfaces.*;
public class Screen extends StateManaged implements Idestroyable {
public function Screen(_arg1:MovieClip){
super(_arg1);
}
protected function initButton():void{
}
protected function setButton(_arg1:DisplayObject, _arg2:Function, _arg3:Function, _arg4:Boolean=false):void{
if (_arg4 == false){
_arg1.addEventListener(MouseEvent.CLICK, _arg2, false, 0, true);
_arg1.addEventListener(MouseEvent.ROLL_OVER, _arg3, false, 0, true);
} else {
_arg1.removeEventListener(MouseEvent.CLICK, _arg2, false);
_arg1.removeEventListener(MouseEvent.ROLL_OVER, _arg3, false);
};
}
public function destroy(_arg1:Event):void{
}
}
}//package library.basic
Section 60
//StateManaged (library.basic.StateManaged)
package library.basic {
import flash.events.*;
import flash.display.*;
public class StateManaged {
private var oStateFunction:Object;
private var sState:String;
private var bPaused:Boolean;
private var mcAsset:MovieClip;
public function StateManaged(_arg1:MovieClip){
mcAsset = _arg1;
bPaused = false;
oStateFunction = new Object();
}
public function set mcRef(_arg1:MovieClip):void{
mcAsset = _arg1;
}
public function update(_arg1:Event):void{
if (oStateFunction[state] != null){
if (oStateFunction[state].state != null){
oStateFunction[state].state();
};
};
}
public function get state():String{
return (sState);
}
public function setState(_arg1:String):void{
var _local2:MovieClip;
if (state != _arg1){
if (((!((state == null))) && (!((oStateFunction[state].unload == null))))){
oStateFunction[state].unload();
};
sState = _arg1;
if (mcRef != null){
mcRef.gotoAndStop(sState);
};
if (oStateFunction[state].load != null){
if (((!((mcRef == null))) && ((mcRef.getChildByName("mcState") == null)))){
mcRef.addEventListener(Event.ADDED, onAdded);
} else {
oStateFunction[sState].load();
if (mcRef.getChildByName("mcState") != null){
_local2 = (mcRef.getChildByName("mcState") as MovieClip);
_local2.gotoAndPlay(1);
};
};
};
};
}
public function get mcState():MovieClip{
return ((mcRef.getChildByName("mcState") as MovieClip));
}
public function set paused(_arg1:Boolean):void{
bPaused = _arg1;
}
public function get mcRef():MovieClip{
return (mcAsset);
}
protected function onAdded(_arg1:Event):void{
if (oStateFunction[sState].load != null){
if (_arg1.target == mcRef.getChildByName("mcState")){
mcRef.removeEventListener(Event.ADDED, onAdded);
oStateFunction[sState].load();
};
};
}
public function get stateComplete():Boolean{
var _local1:Boolean;
_local1 = false;
if (mcRef.mcState != null){
if (mcRef.mcState.currentFrame >= mcRef.mcState.totalFrames){
_local1 = true;
};
};
return (_local1);
}
public function resume(_arg1:Event=null):void{
bPaused = false;
if (mcRef.getChildByName("mcState") != null){
mcState.play();
};
}
public function get paused():Boolean{
return (bPaused);
}
public function get currentFrame():int{
return (((mcState)!=null) ? mcState.currentFrame : 0);
}
public function pause(_arg1:Event=null):void{
bPaused = true;
if (mcRef.getChildByName("mcState") != null){
mcState.stop();
};
}
public function addState(_arg1:String, _arg2:Function, _arg3:Function=null, _arg4:Function=null):void{
oStateFunction[_arg1] = {load:_arg3, state:_arg2, unload:_arg4};
}
}
}//package library.basic
Section 61
//Linear (library.easing.Linear)
package library.easing {
public class Linear {
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeNone(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
}
}//package library.easing
Section 62
//GameEvent (library.events.GameEvent)
package library.events {
import flash.events.*;
public class GameEvent extends Event {
public static const EVENT_ON_MAT:String = "on_mat";
public static const EVENT_UPDATE:String = "update";
public static const EVENT_PAUSE:String = "pause";
public static const EVENT_RESUME:String = "resume";
public static const EVENT_DESTROY:String = "destroy";
public static const EVENT_DESTROY_INGREDIENTS:String = "destroy_ingredients";
public static const EVENT_LOSE:String = "lose";
public static const EVENT_CUT:String = "cut";
public static const EVENT_COMPLETE:String = "sushi_complete";
public static const EVENT_ON_CUTBOARD:String = "on_cutboard";
public function GameEvent(_arg1:String, _arg2:Boolean, _arg3:Boolean){
super(_arg1, _arg2, _arg3);
}
override public function toString():String{
return (formatToString("GameEvent", "type", "bubbles", "cancelable", "eventPhase"));
}
override public function clone():Event{
return (new GameEvent(type, bubbles, cancelable));
}
}
}//package library.events
Section 63
//IngredientEvent (library.events.IngredientEvent)
package library.events {
import flash.events.*;
public class IngredientEvent extends Event {
private var bPlace:Boolean;
private var sIngredient:String;
public static const EVENT_DONE:String = "done";
public function IngredientEvent(_arg1:String, _arg2:String, _arg3:Boolean=false):void{
super(_arg1, false, false);
sIngredient = _arg2;
bPlace = _arg3;
}
override public function toString():String{
return (formatToString("IngredientEvent", "type", "bubbles", "cancelable", "ingredient", "place", "eventPhase"));
}
public function get place():Boolean{
return (bPlace);
}
public function get ingredient():String{
return (sIngredient);
}
override public function clone():Event{
return (new IngredientEvent(type, ingredient, place));
}
}
}//package library.events
Section 64
//MainEvent (library.events.MainEvent)
package library.events {
import flash.events.*;
public class MainEvent extends Event {
public static const EVENT_PAUSE:String = "pause";
public static const EVENT_DESTROY:String = "destroy";
public static const EVENT_RESUME:String = "resume";
public static const EVENT_UPDATE:String = "update";
public function MainEvent(_arg1:String, _arg2:Boolean, _arg3:Boolean){
super(_arg1, _arg2, _arg3);
}
override public function toString():String{
return (formatToString("MainEvent", "type", "bubbles", "cancelable", "eventPhase"));
}
override public function clone():Event{
return (new MainEvent(type, bubbles, cancelable));
}
}
}//package library.events
Section 65
//SequenceEvent (library.events.SequenceEvent)
package library.events {
import flash.events.*;
public class SequenceEvent extends Event {
private var nRate:Number;
private var oPosition:Object;
public static const ADD_ITEM:String = "seq_add_item";
public static const NEGATIVE:String = "seq_negative";
public static const POSITIVE:String = "seq_positive";
public function SequenceEvent(_arg1:String, _arg2:Object, _arg3:Number=NaN):void{
super(_arg1, false, false);
nRate = _arg3;
oPosition = _arg2;
}
public function get rate():Number{
return (nRate);
}
public function get position():Object{
return (oPosition);
}
override public function toString():String{
return (formatToString("SequenceEvent", "type", "position", "rate", "bubbles", "cancelable", "eventPhase"));
}
override public function clone():Event{
return (new SequenceEvent(type, position, rate));
}
}
}//package library.events
Section 66
//Idestroyable (library.interfaces.Idestroyable)
package library.interfaces {
import flash.events.*;
public interface Idestroyable {
function destroy(_arg1:Event):void;
}
}//package library.interfaces
Section 67
//SoundEngine (library.sounds.SoundEngine)
package library.sounds {
import flash.events.*;
import flash.media.*;
import library.events.*;
import flash.utils.*;
public class SoundEngine {
private static var aSounds:Array;
private static var bInitialized:Boolean;
private static var aCategories:Array;
private static var bMuted:Boolean;
private static var nMaster:Number;
private static function manageCategory(_arg1:String):void{
var _local2:Boolean;
var _local3:int;
if (!bInitialized){
initialize();
};
_local2 = false;
_local3 = 0;
while (_local3 < aCategories.length) {
if (aCategories[_local3].name == _arg1){
_local2 = true;
break;
};
_local3++;
};
if (!_local2){
addcategory(_arg1);
};
}
private static function update(_arg1:Event):void{
var _local2:int;
_local2 = 0;
while (_local2 < aSounds.length) {
aSounds[_local2].update();
_local2++;
};
}
public static function getSoundItem(_arg1:String):SoundItem{
var _local2:SoundItem;
var _local3:int;
if (!bInitialized){
initialize();
};
_local2 = null;
_local3 = 0;
while (_local3 < aSounds.length) {
if (aSounds[_local3].linkage == _arg1){
_local2 = aSounds[_local3];
break;
};
_local3++;
};
return (_local2);
}
public static function Resume(_arg1:String=null):void{
var _local2:int;
if (!bInitialized){
initialize();
};
_local2 = 0;
while (_local2 < aCategories.length) {
if ((((aCategories[_local2].name == _arg1)) || ((_arg1 == null)))){
aCategories[_local2].paused = false;
};
_local2++;
};
}
public static function getVolume(_arg1:String=null):Number{
var _local2:Number;
var _local3:int;
if (!bInitialized){
initialize();
};
if (_arg1 != null){
_local3 = 0;
while (_local3 < aCategories.length) {
_local2 = aCategories[_local3].volume;
_local3++;
};
} else {
_local2 = nMaster;
};
return (_local2);
}
public static function Unmute(_arg1:String=null):void{
var _local2:int;
if (!bInitialized){
initialize();
};
if (_arg1 == null){
bMuted = false;
} else {
_local2 = 0;
while (_local2 < aCategories.length) {
if (aCategories[_local2].name == _arg1){
aCategories[_local2].muted = false;
};
_local2++;
};
};
}
public static function Play(_arg1:String, _arg2:String, _arg3:Number=1, _arg4:Boolean=true, _arg5=false, _arg6:Boolean=false, _arg7:Function=null):SoundItem{
var _local8:SoundItem;
var _local9:Boolean;
var _local10:Class;
var _local11:Sound;
var _local12:Object;
if (_arg2.indexOf(",") > -1){
return (Random(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7));
};
if (!bInitialized){
initialize();
};
_local9 = false;
_local10 = (getDefinitionByName(_arg2) as Class);
_local11 = new (_local10);
if (_arg6){
_local12 = isPlaying(_arg1, _arg2);
_local9 = !(_local12.playing);
if (!_local9){
_local8 = _local12.sound;
};
} else {
_local9 = true;
};
if (_local9){
manageCategory(_arg1);
if (getCategory(_arg1).single){
Stop(_arg1, null, true);
};
_local8 = new SoundItem(_arg1, _local11, _arg2, _arg3, _arg4, _arg5, _arg7);
aSounds.push(_local8);
};
return (_local8);
}
public static function Pause(_arg1:String=null):void{
var _local2:int;
if (!bInitialized){
initialize();
};
_local2 = 0;
while (_local2 < aCategories.length) {
if ((((aCategories[_local2].name == _arg1)) || ((_arg1 == null)))){
aCategories[_local2].paused = true;
};
_local2++;
};
}
private static function initialize():void{
if (!bInitialized){
bInitialized = true;
bMuted = false;
aSounds = new Array();
aCategories = new Array();
nMaster = 1;
Main.instance.addEventListener(MainEvent.EVENT_UPDATE, update, false, 0, true);
};
}
public static function setVolume(_arg1:Number, _arg2:String=null):void{
var _local3:int;
if (!bInitialized){
initialize();
};
if (_arg2 == null){
nMaster = _arg1;
} else {
_local3 = 0;
while (_local3 < aCategories.length) {
if (aCategories[_local3].name == _arg2){
aCategories[_local3].volume = _arg1;
};
_local3++;
};
};
}
public static function addcategory(_arg1:String, _arg2:Number=1, _arg3:Boolean=false):void{
var _local4:Object;
if (!bInitialized){
initialize();
};
_local4 = new Object();
_local4.name = _arg1;
_local4.volume = _arg2;
_local4.muted = false;
_local4.paused = false;
_local4.single = _arg3;
aCategories.push(_local4);
}
public static function isMuted(_arg1:String=null):Boolean{
var _local2:Boolean;
var _local3:int;
if (!bInitialized){
initialize();
};
if (_arg1 != null){
_local3 = 0;
while (_local3 < aCategories.length) {
if (aCategories[_local3].name == _arg1){
_local2 = aCategories[_local3].muted;
};
_local3++;
};
} else {
_local2 = bMuted;
};
return (_local2);
}
public static function Random(_arg1:String, _arg2:String, _arg3:Number=1, _arg4:Boolean=true, _arg5=false, _arg6:Boolean=false, _arg7:Function=null):SoundItem{
var _local8:SoundItem;
var _local9:Boolean;
var _local10:Array;
var _local11:String;
var _local12:Class;
var _local13:Sound;
var _local14:Object;
if (!bInitialized){
initialize();
};
_local9 = false;
_local10 = _arg2.split(",");
_local11 = _local10[Math.floor((Math.random() * _local10.length))];
_local12 = (getDefinitionByName(_local11) as Class);
_local13 = new (_local12);
if (_arg6){
_local14 = isPlaying(_arg1, _arg2);
_local9 = !(_local14.playing);
if (!_local9){
_local8 = _local14.sound;
};
} else {
_local9 = true;
};
if (_local9){
manageCategory(_arg1);
if (getCategory(_arg1).single){
Stop(_arg1, null, true);
};
_local8 = new SoundItem(_arg1, _local13, _arg2, _arg3, _arg4, _arg5, _arg7);
aSounds.push(_local8);
};
return (_local8);
}
public static function cleanUpSound(_arg1:SoundItem):void{
var _local2:int;
if (!bInitialized){
initialize();
};
_local2 = 0;
while (_local2 < aSounds.length) {
if (aSounds[_local2] == _arg1){
delete aSounds[_local2];
aSounds.splice(_local2, 1);
};
_local2++;
};
}
public static function Stop(_arg1:String, _arg2:String=null, _arg3:Boolean=false):void{
var _local4:int;
if (!bInitialized){
initialize();
};
_local4 = 0;
while (_local4 < aSounds.length) {
if ((((aSounds[_local4].category == _arg1)) && ((((aSounds[_local4].linkage == _arg2)) || ((_arg2 == null)))))){
if (_arg3){
aSounds[_local4].fadeTo(0, true);
} else {
aSounds[_local4].stop();
cleanUpSound(aSounds[_local4]);
};
};
_local4++;
};
}
public static function isPlaying(_arg1:String, _arg2:String):Object{
var _local3:Object;
var _local4:int;
if (!bInitialized){
initialize();
};
_local3 = new Object();
_local3.playing = false;
_local3.sound = false;
_local4 = 0;
while (_local4 < aSounds.length) {
if ((((aSounds[_local4].linkage == _arg2)) && ((aSounds[_local4].category == _arg1)))){
_local3.playing = aSounds[_local4].playing;
_local3.sound = aSounds[_local4];
};
_local4++;
};
return (_local3);
}
public static function getCategory(_arg1:String):Object{
var _local2:int;
var _local3:int;
_local2 = -1;
_local3 = 0;
while (_local3 < aCategories.length) {
if (aCategories[_local3].name == _arg1){
_local2 = _local3;
};
_local3++;
};
if (_local2 == -1){
manageCategory(_arg1);
_local2 = (aCategories.length - 1);
};
return (aCategories[_local2]);
}
public static function isPaused(_arg1:String):Boolean{
var _local2:Boolean;
var _local3:int;
if (!bInitialized){
initialize();
};
_local3 = 0;
while (_local3 < aCategories.length) {
if (aCategories[_local3].name == _arg1){
_local2 = aCategories[_local3].paused;
};
_local3++;
};
return (_local2);
}
public static function Mute(_arg1:String=null):void{
var _local2:int;
if (!bInitialized){
initialize();
};
if (_arg1 == null){
bMuted = true;
} else {
_local2 = 0;
while (_local2 < aCategories.length) {
if (aCategories[_local2].name == _arg1){
aCategories[_local2].muted = true;
};
_local2++;
};
};
}
public static function getComputedVolume(_arg1:String, _arg2:Number):Number{
return (((_arg2 * getVolume(_arg1)) * nMaster));
}
}
}//package library.sounds
Section 68
//SoundItem (library.sounds.SoundItem)
package library.sounds {
import flash.events.*;
import flash.media.*;
public class SoundItem {
private var bStop:Boolean;
private var nFadeRate:Number;
private var sCategory:String;
private var oChannel:SoundChannel;
private var bPanning:Boolean;
private var nTargetVolume:Number;
private var sName:String;
private var bLoop:Boolean;
private var bMuted:Boolean;
private var iFadeAtEnd:int;
private var nVolume:Number;
private var bPaused:Boolean;
private var iLoop:int;
private var iPosition:int;
private var bFading:Boolean;
private var oTransform:SoundTransform;
private var fOnComplete:Function;
private var nTmpVolume:Number;
private var bFadingAtEnd:Boolean;
private var bFadeAtEnd:Boolean;
private var nPan:Number;
private var nPanRate:Number;
private var oSound:Sound;
private var bPlaying:Boolean;
private var nTargetPan:Number;
public function SoundItem(_arg1:String, _arg2:Sound, _arg3:String, _arg4:Number=1, _arg5:Boolean=true, _arg6=false, _arg7:Function=null):void{
sCategory = _arg1;
sName = _arg3;
fOnComplete = _arg7;
nVolume = _arg4;
oTransform = new SoundTransform(nVolume);
updateSound();
bFading = false;
bPanning = false;
bFadingAtEnd = false;
bStop = false;
bMuted = false;
bPaused = false;
bLoop = false;
iLoop = 0;
nPan = 0;
nFadeRate = 0.08;
iFadeAtEnd = 800;
if ((_arg6 is Boolean)){
iLoop = (_arg6) ? 65536 : 0;
} else {
if ((_arg6 is int)){
iLoop = _arg6;
};
};
oSound = _arg2;
if (_arg5){
play();
};
}
public function stop(_arg1:Boolean=false):void{
if (oChannel != null){
bPlaying = false;
oChannel.stop();
if (_arg1){
SoundEngine.cleanUpSound(this);
};
};
}
public function setFadeRate(_arg1:Number):void{
nFadeRate = _arg1;
}
public function get category():String{
return (sCategory);
}
public function fadeTo(_arg1:Number, _arg2:Boolean=false):void{
nTargetVolume = _arg1;
bFading = true;
bStop = _arg2;
}
public function setVolume(_arg1:Number):void{
nVolume = _arg1;
oTransform.volume = nVolume;
}
public function mute():void{
nTmpVolume = oTransform.volume;
nVolume = 0;
oTransform.volume = nVolume;
bMuted = true;
}
public function get playing():Boolean{
return (bPlaying);
}
private function Panning():void{
if (nPan < nTargetPan){
if ((nPan + nPanRate) >= nTargetPan){
nPan = nTargetPan;
} else {
nPan = (nPan + nPanRate);
};
} else {
if (nPan > nTargetPan){
if ((nPan - nPanRate) <= nTargetPan){
nPan = nTargetPan;
} else {
nPan = (nPan - nPanRate);
};
} else {
nPan = nTargetPan;
bPanning = false;
};
};
oTransform.pan = nPan;
}
private function onComplete(_arg1:Event):void{
stop(true);
if (fOnComplete != null){
fOnComplete();
};
}
public function unmute():void{
nVolume = nTmpVolume;
oTransform.volume = nVolume;
bMuted = false;
}
public function update():void{
if (bFading){
Fading();
};
if (bPanning){
Panning();
};
if (bFadeAtEnd){
FadeAtEnd();
};
updateSound();
}
private function updateSound():void{
var _local1:SoundTransform;
if (((SoundEngine.isMuted(sCategory)) && (!(bMuted)))){
mute();
} else {
if (((!(SoundEngine.isMuted(sCategory))) && (bMuted))){
unmute();
};
};
if (((SoundEngine.isPaused(sCategory)) && (!(bPaused)))){
pause();
} else {
if (((!(SoundEngine.isPaused(sCategory))) && (bPaused))){
resume();
};
};
if (oChannel != null){
_local1 = new SoundTransform(SoundEngine.getComputedVolume(sCategory, nVolume), nPan);
oChannel.soundTransform = _local1;
};
}
public function setFadeAtEnd(_arg1:Boolean):void{
bFadeAtEnd = _arg1;
}
public function get linkage():String{
return (sName);
}
private function Fading():void{
if (nVolume < nTargetVolume){
if ((nTargetVolume + nFadeRate) >= nTargetVolume){
nVolume = nTargetVolume;
} else {
nVolume = (nVolume + nFadeRate);
};
} else {
if (nVolume > nTargetVolume){
if ((nVolume - nFadeRate) <= nTargetVolume){
nVolume = nTargetVolume;
} else {
nVolume = (nVolume - nFadeRate);
};
} else {
nVolume = nTargetVolume;
bFading = false;
if (bStop){
stop(true);
};
};
};
if (((bFadingAtEnd) && ((nVolume == 0)))){
bFadingAtEnd = false;
bFading = false;
stop();
nVolume = 1;
};
oTransform.volume = nVolume;
}
public function setPan(_arg1:Number):void{
nPan = _arg1;
oTransform.pan = nPan;
}
public function setPanRate(_arg1:Number):void{
nPanRate = _arg1;
}
public function resume():void{
play(iPosition);
bPaused = false;
}
public function play(_arg1:int=0):void{
if (((!(bPlaying)) && (!((oSound == null))))){
bPlaying = true;
oChannel = oSound.play(_arg1, iLoop);
oChannel.soundTransform = oTransform;
oChannel.addEventListener(Event.SOUND_COMPLETE, onComplete);
};
}
private function FadeAtEnd():void{
if (oChannel != null){
if ((oSound.length - oChannel.position) <= iFadeAtEnd){
bFadingAtEnd = true;
fadeTo(0);
};
};
}
public function panTo(_arg1:Number):void{
nTargetPan = _arg1;
bPanning = true;
}
public function pause():void{
if (oChannel != null){
bPlaying = false;
bPaused = true;
iPosition = oChannel.position;
oChannel.stop();
};
}
}
}//package library.sounds
Section 69
//Animate (library.utils.Animate)
package library.utils {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.geom.*;
import library.events.*;
import library.interfaces.*;
import flash.utils.*;
public class Animate implements Idestroyable {
private var iCurTime:int;
private var bClassInited:Boolean;
private var iTime:int;
protected var bActive:Boolean;
private var iDelay:int;
private var iDuration:int;
protected var bHasSubTweens:Boolean;
private var oTarget:Object;
private var aTweens:Array;
protected var aSubTweens:Array;
protected var bInited:Boolean;
private var oVars:Object;
public static const DEFAULT_EASE:Function = Animate.easeOut;
public static const EASE_OUT:Function = Animate.easeOut;
private static var bListening:Boolean;
private static var bQueue:Boolean = false;
private static var oTimer:Timer = new Timer(2000);
private static var bLoop:Boolean = false;
private static var aQueue:Array;
protected static var oAll:Dictionary = new Dictionary();
public function Animate(_arg1:Object, _arg2:int, _arg3:Object):void{
var _local4:String;
super();
trace(("Animate.Animate constructor > " + _arg1));
for (_local4 in _arg3) {
trace(((("key : " + _local4) + ", value : ") + _arg3[_local4]));
};
if (_arg1 == null){
return;
};
if (((((!((_arg3.overwrite == false))) && (!((_arg1 == null))))) || ((oAll[_arg1] == undefined)))){
delete oAll[_arg1];
oAll[_arg1] = new Dictionary();
};
oAll[_arg1][this] = this;
oVars = _arg3;
iDelay = ((_arg3.delay) || (0));
iDuration = ((_arg2) || (0.001));
oTarget = _arg1;
if (!(oVars.ease is Function)){
oVars.ease = DEFAULT_EASE;
};
if (oVars.easeParams != null){
oVars.proxiedEase = oVars.ease;
oVars.ease = easeProxy;
};
if (!isNaN(Number(oVars.autoAlpha))){
oVars.alpha = Number(oVars.autoAlpha);
};
aTweens = [];
aSubTweens = [];
bHasSubTweens = false;
bInited = false;
bActive = (((_arg2 == 0)) && ((iDelay == 0)));
if (!bClassInited){
iCurTime = 0;
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, executeAll, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
bClassInited = true;
};
iTime = iCurTime;
if ((((((oVars.runBackwards == true)) && (!((oVars.renderOnStart == true))))) || (bActive))){
initTweenVals();
if (bActive){
render((iCurTime + 1));
} else {
render(iCurTime);
};
};
if (((!(bListening)) && (!(bActive)))){
oTimer.addEventListener("timer", killGarbage);
oTimer.start();
bListening = true;
};
}
public function get delay():int{
return (iDelay);
}
public function get active():Boolean{
iCurTime++;
if (bActive){
return (true);
};
if (iCurTime > iDelay){
iCurTime = (iCurTime - iDelay);
bActive = true;
if (!bInited){
initTweenVals();
} else {
if (typeof(oVars.autoAlpha) == "number"){
oTarget.visible = true;
};
};
if (oVars.onStart != null){
trace(("threre | " + oVars.onStartScope));
oVars.onStart.apply(oVars.onStartScope, oVars.onStartParams);
};
if (iDuration == 0.001){
};
return (true);
//unresolved jump
};
return (false);
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, executeAll, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
oAll = new Dictionary();
}
protected function addSubTween(_arg1:Function, _arg2:Object, _arg3:Object, _arg4:Object=null):void{
var _local5:Object;
var _local6:String;
_local5 = {proxy:_arg1, target:_arg2, info:_arg4};
aSubTweens.push(_local5);
for (_local6 in _arg3) {
if (typeof(_arg3[_local6]) == "number"){
};
};
}
public function initTweenVals(_arg1:Boolean=false, _arg2:String=""):void{
var _local3:Boolean;
var _local4:String;
var _local5:int;
var _local6:Array;
var _local7:ColorTransform;
var _local8:ColorTransform;
var _local9:Object;
_local3 = (oTarget is DisplayObject);
if ((oTarget is Array)){
_local6 = ((oVars.endArray) || ([]));
_local5 = 0;
while (_local5 < _local6.length) {
if (((!((oTarget[_local5] == _local6[_local5]))) && (!((oTarget[_local5] == undefined))))){
aTweens.push({o:oTarget, p:_local5.toString(), s:oTarget[_local5], c:(_local6[_local5] - oTarget[_local5])});
};
_local5++;
};
} else {
for (_local4 in oVars) {
if (((isOneOf(_local4, "ease,delay,overwrite,onComplete,onCompleteParams,onCompleteScope,runBackwards,onUpdate,onUpdateParams,onUpdateScope,autoAlpha,onStart,onStartParams,onStartScope,renderOnStart,proxiedEase,easeParams")) || (((_arg1) && (!((_arg2.indexOf(((" " + _local4) + " ")) == -1))))))){
} else {
if ((((_local4 == "tint")) && (_local3))){
_local7 = oTarget.transform.colorTransform;
_local8 = new ColorTransform();
if (oVars.alpha != undefined){
_local8.alphaMultiplier = oVars.alpha;
delete oVars.alpha;
_local5 = (aTweens.length - 1);
while (_local5 > -1) {
if (aTweens[_local5].p == "alpha"){
aTweens.splice(_local5, 1);
break;
};
_local5--;
};
} else {
_local8.alphaMultiplier = oTarget.alpha;
};
if (((((!((oVars[_local4] == null))) && (!((oVars[_local4] == ""))))) || ((oVars[_local4] == 0)))){
_local8.color = oVars[_local4];
};
addSubTween(tintProxy, {progress:0}, {progress:1}, {target:oTarget, color:_local7, endColor:_local8});
} else {
if ((((_local4 == "frame")) && (_local3))){
addSubTween(frameProxy, {frame:oTarget.currentFrame}, {frame:oVars[_local4]}, {target:oTarget});
} else {
if ((((_local4 == "volume")) && (((_local3) || ((oTarget is SoundChannel)))))){
addSubTween(volumeProxy, oTarget.soundTransform, {volume:oVars[_local4]}, {target:oTarget});
} else {
if (typeof(oVars[_local4]) == "number"){
aTweens.push({o:oTarget, p:_local4, s:oTarget[_local4], c:(oVars[_local4] - oTarget[_local4])});
} else {
aTweens.push({o:oTarget, p:_local4, s:oTarget[_local4], c:Number(oVars[_local4])});
};
};
};
};
};
};
};
if (oVars.runBackwards == true){
_local5 = (aTweens.length - 1);
while (_local5 > -1) {
_local9 = aTweens[_local5];
aTweens[_local5].s = (_local9.s + _local9.c);
_local9.c = (_local9.c * -1);
_local5--;
};
};
if (typeof(oVars.autoAlpha) == "number"){
oTarget.visible = !((((oVars.runBackwards == true)) && ((oTarget.alpha == 0))));
};
bInited = true;
}
public function get target():Object{
return (oTarget);
}
public function isOneOf(_arg1:String, _arg2):Boolean{
var _local3:Array;
if ((_arg2 is Array)){
_local3 = _arg2;
} else {
if ((_arg2 is String)){
_local3 = _arg2.split(",");
};
};
if (_local3.indexOf(_arg1) > -1){
return (true);
};
return (false);
}
public function get duration():int{
return (iDuration);
}
public function set delay(_arg1:int):void{
iDelay = _arg1;
}
public function set vars(_arg1:Object):void{
oVars = _arg1;
}
public function get vars():Object{
return (oVars);
}
public function set target(_arg1:Object):void{
oTarget = _arg1;
}
public function get time():int{
return (iCurTime);
}
public function render(_arg1:int):void{
var _local2:Number;
var _local3:Object;
var _local4:int;
if (_arg1 >= iDuration){
_arg1 = iDuration;
_local2 = 1;
} else {
_local2 = oVars.ease(_arg1, 0, 1, iDuration);
};
_local4 = (aTweens.length - 1);
while (_local4 > -1) {
_local3 = aTweens[_local4];
_local3.o[_local3.p] = (_local3.s + (_local2 * _local3.c));
_local4--;
};
if (bHasSubTweens){
_local4 = (aSubTweens.length - 1);
while (_local4 > -1) {
aSubTweens[_local4].proxy(aSubTweens[_local4]);
_local4--;
};
};
if (oVars.onUpdate != null){
oVars.onUpdate.apply(oVars.onUpdateScope, oVars.onUpdateParams);
};
if (_arg1 == iDuration){
complete(true);
};
}
public function set duration(_arg1:int):void{
iDuration = _arg1;
}
protected function easeProxy(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (oVars.proxiedEase.apply(null, arguments.concat(oVars.easeParams)));
}
public function set tweens(_arg1:Array):void{
aTweens = _arg1;
}
public function get tweens():Array{
return (aTweens);
}
public function complete(_arg1:Boolean=false):void{
var _local2:Object;
var _local3:String;
trace(("Animate.complete > _bSkip : " + _arg1));
if (!_arg1){
if (!bInited){
initTweenVals();
};
iTime = 0;
render(iCurTime);
return;
};
if ((((typeof(oVars.autoAlpha) == "number")) && ((oTarget.alpha == 0)))){
oTarget.visible = false;
};
if (oVars.onComplete != null){
oVars.onComplete.apply(oVars.onCompleteScope, oVars.onCompleteParams);
};
removeTween(this);
if (((bQueue) && ((aQueue.length > 0)))){
trace(("***** SHIFT **** bLoop: " + bLoop));
_local2 = aQueue.shift();
for (_local3 in _local2.vars) {
trace(((("key : " + _local3) + ", value : ") + _local2.vars[_local3]));
};
if (bLoop){
aQueue.push(_local2);
};
trace("*** CALL TO ANIMATE.TO FUNCTION : ***");
trace(((_local2.func + " +=== ") + _local2.target));
_local2.func(_local2.target, _local2.duration, _local2.vars);
trace("*** END CALL TO ANIMATE.TO FUNCTION : ***");
} else {
trace("======== queue false ==========");
bQueue = false;
};
}
public static function frameProxy(_arg1:Object):void{
_arg1.info.target.gotoAndStop(Math.round(_arg1.target.frame));
}
public static function tintProxy(_arg1:Object):void{
var _local2:Number;
var _local3:Number;
var _local4:Object;
var _local5:Object;
_local2 = _arg1.target.progress;
_local3 = (1 - _local2);
_local4 = _arg1.info.color;
_local5 = _arg1.info.endColor;
_arg1.info.target.transform.colorTransform = new ColorTransform(((_local4.redMultiplier * _local3) + (_local5.redMultiplier * _local2)), ((_local4.greenMultiplier * _local3) + (_local5.greenMultiplier * _local2)), ((_local4.blueMultiplier * _local3) + (_local5.blueMultiplier * _local2)), ((_local4.alphaMultiplier * _local3) + (_local5.alphaMultiplier * _local2)), ((_local4.redOffset * _local3) + (_local5.redOffset * _local2)), ((_local4.greenOffset * _local3) + (_local5.greenOffset * _local2)), ((_local4.blueOffset * _local3) + (_local5.blueOffset * _local2)), ((_local4.alphaOffset * _local3) + (_local5.alphaOffset * _local2)));
}
public static function removeTween(_arg1:Object=null):void{
if (((!((_arg1 == null))) && (!((oAll[_arg1.target] == undefined))))){
delete oAll[_arg1.target][_arg1];
};
}
public static function get queuing():Boolean{
return (bQueue);
}
public static function queue(_arg1:Boolean, ... _args):void{
var _local3:uint;
var _local4:Object;
bLoop = _arg1;
aQueue = new Array();
_local3 = 0;
while (_local3 < _args.length) {
aQueue.push(_args[_local3]);
_local3++;
};
_local4 = aQueue.shift();
if (bLoop){
aQueue.push(_local4);
};
_local4.func(_local4.target, _local4.duration, _local4.vars);
bQueue = true;
}
public static function add(... _args):void{
var _local2:uint;
_local2 = 0;
while (_local2 < _args.length) {
aQueue.push(_args[_local2]);
_local2++;
};
}
public static function delayedCall(_arg1:int, _arg2:Function, _arg3:Array=null, _arg4=null):Animate{
return (new Animate(_arg2, 0, {delay:_arg1, onComplete:_arg2, onCompleteParams:_arg3, onCompleteScope:_arg4, overwrite:false}));
}
public static function from(_arg1:Object, _arg2:int, _arg3:Object):Animate{
_arg3.runBackwards = true;
return (new Animate(_arg1, _arg2, _arg3));
}
private static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
return ((((-(_arg3) * _arg1) * (_arg1 - 2)) + _arg2));
}
public static function executeAll(_arg1:Event=null):void{
var _local2:Dictionary;
var _local3:Object;
var _local4:Object;
if (bListening){
_local2 = oAll;
for each (_local3 in _local2) {
for (_local4 in _local3) {
if (((!((_local3[_local4] == undefined))) && (_local3[_local4].active))){
_local3[_local4].render(_local3[_local4].time);
};
};
};
};
}
public static function volumeProxy(_arg1:Object):void{
_arg1.info.target.soundTransform = _arg1.target;
}
public static function killTweensOf(_arg1:Object=null, _arg2:Boolean=false):void{
var _local3:Object;
var _local4:*;
if (((!((_arg1 == null))) && (!((oAll[_arg1] == undefined))))){
if (_arg2){
_local3 = oAll[_arg1];
for (_local4 in _local3) {
_local3[_local4].complete(false);
};
};
delete oAll[_arg1];
};
}
public static function killGarbage(_arg1:Event):void{
var _local2:int;
var _local3:Boolean;
var _local4:Object;
var _local5:Object;
_local2 = 0;
for (_local4 in oAll) {
_local3 = false;
for (_local5 in oAll[_local4]) {
_local3 = true;
break;
};
if (!_local3){
delete oAll[_local4];
} else {
_local2++;
};
};
if (_local2 == 0){
bListening = false;
};
}
public static function to(_arg1:Object, _arg2:int, _arg3:Object):Animate{
if (_arg1 == null){
Animate.killTweensOf(_arg1);
return (null);
};
return (new Animate(_arg1, _arg2, _arg3));
}
public static function stopAll():void{
trace("*********** Animate.stopAll ***********");
killTweensOf(null, true);
if (aQueue != null){
aQueue.splice(0);
};
bQueue = false;
killGarbage(null);
trace(("killGarbage : " + killGarbage));
}
}
}//package library.utils
Section 70
//DepthManager (library.utils.DepthManager)
package library.utils {
import flash.events.*;
import flash.display.*;
import library.interfaces.*;
public class DepthManager implements Idestroyable {
private var oLayers:Object;
public function DepthManager(){
oLayers = new Object();
}
public function getDepthLayer(_arg1:String):DisplayObjectContainer{
return (oLayers[_arg1]);
}
public function addDepthLayer(_arg1:String, _arg2:DisplayObjectContainer):void{
var _local3:Sprite;
if (oLayers[_arg1] == null){
_local3 = new Sprite();
oLayers[_arg1] = _local3;
_arg2.addChild(_local3);
};
}
public function destroy(_arg1:Event):void{
var _local2:String;
for (_local2 in oLayers) {
oLayers[_local2].parent.removeChild(oLayers[_local2]);
};
oLayers = null;
}
}
}//package library.utils
Section 71
//MoreMath (library.utils.MoreMath)
package library.utils {
import flash.geom.*;
public class MoreMath {
public static function getTurnAngle(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
_local3 = (_arg2 - _arg1);
if (Math.abs(_local3) > 180){
if (_arg2 > _arg1){
_local3 = (_local3 - 360);
} else {
_local3 = (360 - Math.abs(_local3));
};
};
return (_local3);
}
public static function adjustAngle(_arg1:Number):Number{
if (_arg1 >= 360){
_arg1 = (_arg1 - 360);
} else {
if (_arg1 < 0){
_arg1 = (_arg1 + 360);
};
};
return (_arg1);
}
public static function getDistance(_arg1:Object, _arg2:Object):Number{
if ((((((((_arg1.x == null)) || ((_arg1.y == null)))) || ((_arg2.x == null)))) || ((_arg2.y == null)))){
return (Number.NaN);
};
return (Math.sqrt((((_arg2.x - _arg1.x) * (_arg2.x - _arg1.x)) + ((_arg2.y - _arg1.y) * (_arg2.y - _arg1.y)))));
}
public static function getRadianFromDegree(_arg1:Number):Number{
var _local2:Number;
_local2 = (_arg1 * (Math.PI / 180));
return (_local2);
}
public static function getAngle(_arg1:Point, _arg2:Point):Number{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local3 = (_arg2.x - _arg1.x);
_local4 = (_arg2.y - _arg1.y);
_local5 = Math.atan2(_local4, _local3);
_local6 = getDegreeFromRadius(_local5);
return (_local6);
}
public static function getDegreeFromRadius(_arg1:Number):Number{
var _local2:Number;
_local2 = ((_arg1 / Math.PI) * 180);
return (_local2);
}
}
}//package library.utils
Section 72
//Transition (library.utils.Transition)
package library.utils {
import library.sounds.*;
import flash.events.*;
import flash.display.*;
import library.events.*;
import library.basic.*;
public class Transition extends StateManaged implements IEventDispatcher {
private var oEventDisp:EventDispatcher;
public static const sEVENT_COMPLETE:String = "complete";
private static const sSTATE_DISAPPEAR:String = "disappear";
private static const sSTATE_APPEAR:String = "appear";
public static const sEVENT_FULL_SCREEN:String = "full";
public function Transition(_arg1:MovieClip){
super(_arg1);
oEventDisp = new EventDispatcher(this);
addState(sSTATE_APPEAR, state_appear, loadState);
addState(sSTATE_DISAPPEAR, state_disappear, loadState);
setState(sSTATE_APPEAR);
SoundEngine.Play(Main.sSOUND_UI, SoundList.sSOUND_TRANSITION, 1, true, false, true);
Main.instance.addEventListener(MainEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.addEventListener(MainEvent.EVENT_DESTROY, destroy, false, 0, true);
}
public function dispatchEvent(_arg1:Event):Boolean{
return (oEventDisp.dispatchEvent(_arg1));
}
private function state_appear():void{
if (stateComplete){
dispatchEvent(new Event(sEVENT_FULL_SCREEN, false));
setState(sSTATE_DISAPPEAR);
};
}
public function willTrigger(_arg1:String):Boolean{
return (oEventDisp.willTrigger(_arg1));
}
public function removeEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false):void{
oEventDisp.removeEventListener(_arg1, _arg2, _arg3);
}
private function loadState():void{
if (mcRef.mcBlocker != null){
mcRef.mcBlocker.useHandCursor = false;
};
switch (state){
case sSTATE_APPEAR:
break;
case sSTATE_DISAPPEAR:
break;
};
}
public function hasEventListener(_arg1:String):Boolean{
return (oEventDisp.hasEventListener(_arg1));
}
public function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=false):void{
oEventDisp.addEventListener(_arg1, _arg2, _arg3, _arg4);
}
private function state_disappear():void{
if (stateComplete){
dispatchEvent(new Event(sEVENT_COMPLETE, false));
};
}
public function destroy(_arg1:Event):void{
if (mcRef != null){
mcRef.parent.removeChild(mcRef);
};
Main.instance.removeEventListener(MainEvent.EVENT_UPDATE, update, false);
Main.instance.removeEventListener(MainEvent.EVENT_DESTROY, destroy, false);
mcRef = null;
}
}
}//package library.utils
Section 73
//Anim_Carly_Head01_168 (main_fla.Anim_Carly_Head01_168)
package main_fla {
import flash.display.*;
public dynamic class Anim_Carly_Head01_168 extends MovieClip {
public var mcRightEye:MovieClip;
public var mcLeftEye:MovieClip;
}
}//package main_fla
Section 74
//Anim_Carly_Idle01_164 (main_fla.Anim_Carly_Idle01_164)
package main_fla {
import flash.display.*;
public dynamic class Anim_Carly_Idle01_164 extends MovieClip {
public var mcHead:MovieClip;
}
}//package main_fla
Section 75
//Anim_Freddie_Head01_123 (main_fla.Anim_Freddie_Head01_123)
package main_fla {
import flash.display.*;
public dynamic class Anim_Freddie_Head01_123 extends MovieClip {
public var mcRightEye:MovieClip;
public var mcLeftEye:MovieClip;
}
}//package main_fla
Section 76
//Anim_Freddie_Idle01_120 (main_fla.Anim_Freddie_Idle01_120)
package main_fla {
import flash.display.*;
public dynamic class Anim_Freddie_Idle01_120 extends MovieClip {
public var mcHead:MovieClip;
}
}//package main_fla
Section 77
//Anim_Request01_Idle01_496 (main_fla.Anim_Request01_Idle01_496)
package main_fla {
import flash.display.*;
public dynamic class Anim_Request01_Idle01_496 extends MovieClip {
public var mcSushi:MovieClip;
public var mcSushiHot:MovieClip;
public var mcBubble:MovieClip;
}
}//package main_fla
Section 78
//Anim_Request01_In01_487 (main_fla.Anim_Request01_In01_487)
package main_fla {
import flash.display.*;
public dynamic class Anim_Request01_In01_487 extends MovieClip {
public var mcSushi:MovieClip;
public var mcSushiHot:MovieClip;
public var mcBubble:MovieClip;
}
}//package main_fla
Section 79
//Anim_Request01_Out01_497 (main_fla.Anim_Request01_Out01_497)
package main_fla {
import flash.display.*;
public dynamic class Anim_Request01_Out01_497 extends MovieClip {
public var mcSushi:MovieClip;
public var mcSushiHot:MovieClip;
public var mcBubble:MovieClip;
}
}//package main_fla
Section 80
//Anim_Sam_Happy01_157 (main_fla.Anim_Sam_Happy01_157)
package main_fla {
import flash.display.*;
public dynamic class Anim_Sam_Happy01_157 extends MovieClip {
public var mcRightEye:MovieClip;
public var mcLeftEye:MovieClip;
}
}//package main_fla
Section 81
//Anim_Sam_Head01_145 (main_fla.Anim_Sam_Head01_145)
package main_fla {
import flash.display.*;
public dynamic class Anim_Sam_Head01_145 extends MovieClip {
public var mcRightEye:MovieClip;
public var mcLeftEye:MovieClip;
}
}//package main_fla
Section 82
//Anim_Sam_Idle01_141 (main_fla.Anim_Sam_Idle01_141)
package main_fla {
import flash.display.*;
public dynamic class Anim_Sam_Idle01_141 extends MovieClip {
public var mcHead:MovieClip;
}
}//package main_fla
Section 83
//Anim_Sam_Unhappy01_160 (main_fla.Anim_Sam_Unhappy01_160)
package main_fla {
import flash.display.*;
public dynamic class Anim_Sam_Unhappy01_160 extends MovieClip {
public var mcRightEye:MovieClip;
public var mcLeftEye:MovieClip;
}
}//package main_fla
Section 84
//Anim_Sushi01_Idle02_403 (main_fla.Anim_Sushi01_Idle02_403)
package main_fla {
import flash.display.*;
public dynamic class Anim_Sushi01_Idle02_403 extends MovieClip {
public var mcSushi02:MovieClip;
public var mcSushi01:MovieClip;
public var mcSushi03:MovieClip;
public var mcSushi05:MovieClip;
public var mcSushi04:MovieClip;
}
}//package main_fla
Section 85
//Anim_Sushi01_Idle03_408 (main_fla.Anim_Sushi01_Idle03_408)
package main_fla {
import flash.display.*;
public dynamic class Anim_Sushi01_Idle03_408 extends MovieClip {
public var mcSushi02:MovieClip;
public var mcSushi06:MovieClip;
public var mcSushi01:MovieClip;
public var mcSushi03:MovieClip;
public var mcSushi05:MovieClip;
public var mcSushi04:MovieClip;
}
}//package main_fla
Section 86
//Anim_Sushi01_In02_395 (main_fla.Anim_Sushi01_In02_395)
package main_fla {
import flash.display.*;
public dynamic class Anim_Sushi01_In02_395 extends MovieClip {
public var mcSushi02:MovieClip;
public var mcSushi01:MovieClip;
public var mcSushi03:MovieClip;
public var mcSushi05:MovieClip;
public var mcSushi04:MovieClip;
}
}//package main_fla
Section 87
//Anim_Sushi01_In03_405 (main_fla.Anim_Sushi01_In03_405)
package main_fla {
import flash.display.*;
public dynamic class Anim_Sushi01_In03_405 extends MovieClip {
public var mcSushi02:MovieClip;
public var mcSushi06:MovieClip;
public var mcSushi01:MovieClip;
public var mcSushi03:MovieClip;
public var mcSushi05:MovieClip;
public var mcSushi04:MovieClip;
}
}//package main_fla
Section 88
//Anim_Sushi01_Out02_404 (main_fla.Anim_Sushi01_Out02_404)
package main_fla {
import flash.display.*;
public dynamic class Anim_Sushi01_Out02_404 extends MovieClip {
public var mcSushi02:MovieClip;
public var mcSushi01:MovieClip;
public var mcSushi03:MovieClip;
public var mcSushi05:MovieClip;
public var mcSushi04:MovieClip;
}
}//package main_fla
Section 89
//Anim_Sushi01_Out03_409 (main_fla.Anim_Sushi01_Out03_409)
package main_fla {
import flash.display.*;
public dynamic class Anim_Sushi01_Out03_409 extends MovieClip {
public var mcSushi02:MovieClip;
public var mcSushi06:MovieClip;
public var mcSushi01:MovieClip;
public var mcSushi03:MovieClip;
public var mcSushi05:MovieClip;
public var mcSushi04:MovieClip;
}
}//package main_fla
Section 90
//Anim_TaskBar_Idle01_213 (main_fla.Anim_TaskBar_Idle01_213)
package main_fla {
import flash.display.*;
public dynamic class Anim_TaskBar_Idle01_213 extends MovieClip {
public var mcText:MovieClip;
}
}//package main_fla
Section 91
//Anim_TaskBar_Idle02_220 (main_fla.Anim_TaskBar_Idle02_220)
package main_fla {
import flash.display.*;
public dynamic class Anim_TaskBar_Idle02_220 extends MovieClip {
public var mcText:MovieClip;
}
}//package main_fla
Section 92
//Anim_TaskBar_In01_211 (main_fla.Anim_TaskBar_In01_211)
package main_fla {
import flash.display.*;
public dynamic class Anim_TaskBar_In01_211 extends MovieClip {
public var mcText:MovieClip;
}
}//package main_fla
Section 93
//Anim_TaskBar_Out01_214 (main_fla.Anim_TaskBar_Out01_214)
package main_fla {
import flash.display.*;
public dynamic class Anim_TaskBar_Out01_214 extends MovieClip {
public var mcText:MovieClip;
}
}//package main_fla
Section 94
//Anim_TaskBar_Out02_223 (main_fla.Anim_TaskBar_Out02_223)
package main_fla {
import flash.display.*;
public dynamic class Anim_TaskBar_Out02_223 extends MovieClip {
public var mcText:MovieClip;
}
}//package main_fla
Section 95
//Anim_TaskBar_To_Idle02_219 (main_fla.Anim_TaskBar_To_Idle02_219)
package main_fla {
import flash.display.*;
public dynamic class Anim_TaskBar_To_Idle02_219 extends MovieClip {
public var mcText:MovieClip;
}
}//package main_fla
Section 96
//Anim_TaskBar_To_Wait02_216 (main_fla.Anim_TaskBar_To_Wait02_216)
package main_fla {
import flash.display.*;
public dynamic class Anim_TaskBar_To_Wait02_216 extends MovieClip {
public var mcText:MovieClip;
}
}//package main_fla
Section 97
//Anim_TaskBar_To_Wait202_221 (main_fla.Anim_TaskBar_To_Wait202_221)
package main_fla {
import flash.display.*;
public dynamic class Anim_TaskBar_To_Wait202_221 extends MovieClip {
public var mcText:MovieClip;
}
}//package main_fla
Section 98
//Anim_TaskBar_Wait02_218 (main_fla.Anim_TaskBar_Wait02_218)
package main_fla {
import flash.display.*;
public dynamic class Anim_TaskBar_Wait02_218 extends MovieClip {
public var mcText:MovieClip;
}
}//package main_fla
Section 99
//Anim_TaskBar_Wait202_222 (main_fla.Anim_TaskBar_Wait202_222)
package main_fla {
import flash.display.*;
public dynamic class Anim_TaskBar_Wait202_222 extends MovieClip {
public var mcText:MovieClip;
}
}//package main_fla
Section 100
//Anim_Time_Gain_01_38 (main_fla.Anim_Time_Gain_01_38)
package main_fla {
import flash.display.*;
public dynamic class Anim_Time_Gain_01_38 extends MovieClip {
public var mcText:MovieClip;
}
}//package main_fla
Section 101
//Anim_Time_Gain_DynTxt_01_40 (main_fla.Anim_Time_Gain_DynTxt_01_40)
package main_fla {
import flash.display.*;
import flash.text.*;
public dynamic class Anim_Time_Gain_DynTxt_01_40 extends MovieClip {
public var txtPointsFront:TextField;
public var txtPoints:TextField;
}
}//package main_fla
Section 102
//Anim_Time_Lose_01_45 (main_fla.Anim_Time_Lose_01_45)
package main_fla {
import flash.display.*;
import flash.text.*;
public dynamic class Anim_Time_Lose_01_45 extends MovieClip {
public var txtPointsFront:TextField;
public var txtPoints:TextField;
}
}//package main_fla
Section 103
//Anim_Time_Lose01_43 (main_fla.Anim_Time_Lose01_43)
package main_fla {
import flash.display.*;
public dynamic class Anim_Time_Lose01_43 extends MovieClip {
public var mcText:MovieClip;
}
}//package main_fla
Section 104
//mcButtonHelp_106 (main_fla.mcButtonHelp_106)
package main_fla {
import flash.display.*;
public dynamic class mcButtonHelp_106 extends MovieClip {
public var btnPlay:SimpleButton;
}
}//package main_fla
Section 105
//mcGoPopup_46 (main_fla.mcGoPopup_46)
package main_fla {
import flash.display.*;
public dynamic class mcGoPopup_46 extends MovieClip {
public var mcState:MovieClip;
}
}//package main_fla
Section 106
//mcPopupHelpIdle_110 (main_fla.mcPopupHelpIdle_110)
package main_fla {
import flash.display.*;
public dynamic class mcPopupHelpIdle_110 extends MovieClip {
public var mcPopup:MovieClip;
}
}//package main_fla
Section 107
//mcPopupHelpIn_99 (main_fla.mcPopupHelpIn_99)
package main_fla {
import flash.display.*;
public dynamic class mcPopupHelpIn_99 extends MovieClip {
public var mcPopup:MovieClip;
}
}//package main_fla
Section 108
//mcPopupHelpInside_104 (main_fla.mcPopupHelpInside_104)
package main_fla {
import flash.display.*;
public dynamic class mcPopupHelpInside_104 extends MovieClip {
public var btnBack:SimpleButton;
public var mcButton:MovieClip;
public var btnResume:SimpleButton;
public var btnPlay:SimpleButton;
}
}//package main_fla
Section 109
//mcPopupHelpOut_111 (main_fla.mcPopupHelpOut_111)
package main_fla {
import flash.display.*;
public dynamic class mcPopupHelpOut_111 extends MovieClip {
public var mcPopup:MovieClip;
}
}//package main_fla
Section 110
//mcPopupMenuIdle_87 (main_fla.mcPopupMenuIdle_87)
package main_fla {
import flash.display.*;
public dynamic class mcPopupMenuIdle_87 extends MovieClip {
public var mcPopup:MovieClip;
}
}//package main_fla
Section 111
//mcPopupMenuIn_79 (main_fla.mcPopupMenuIn_79)
package main_fla {
import flash.display.*;
public dynamic class mcPopupMenuIn_79 extends MovieClip {
public var btnSoundOff:SimpleButton;
public var btnSoundOn:SimpleButton;
public var btnMusicOff:SimpleButton;
public var btnResume:SimpleButton;
public var btnHelp:SimpleButton;
public var btnQuit:SimpleButton;
public var btnMusicOn:SimpleButton;
}
}//package main_fla
Section 112
//mcPopupMenuInside_88 (main_fla.mcPopupMenuInside_88)
package main_fla {
import flash.display.*;
public dynamic class mcPopupMenuInside_88 extends MovieClip {
public var btnSoundOff:SimpleButton;
public var btnSoundOn:SimpleButton;
public var btnMusicOff:SimpleButton;
public var btnResume:SimpleButton;
public var btnHelp:SimpleButton;
public var btnQuit:SimpleButton;
public var btnMusicOn:SimpleButton;
}
}//package main_fla
Section 113
//mcPopupMenuOut_89 (main_fla.mcPopupMenuOut_89)
package main_fla {
import flash.display.*;
public dynamic class mcPopupMenuOut_89 extends MovieClip {
public var btnSoundOff:SimpleButton;
public var btnSoundOn:SimpleButton;
public var btnMusicOff:SimpleButton;
public var btnResume:SimpleButton;
public var btnHelp:SimpleButton;
public var btnQuit:SimpleButton;
public var btnMusicOn:SimpleButton;
}
}//package main_fla
Section 114
//mcPopupQuitIdle_95 (main_fla.mcPopupQuitIdle_95)
package main_fla {
import flash.display.*;
public dynamic class mcPopupQuitIdle_95 extends MovieClip {
public var mcPopup:MovieClip;
}
}//package main_fla
Section 115
//mcPopupQuitIn_91 (main_fla.mcPopupQuitIn_91)
package main_fla {
import flash.display.*;
public dynamic class mcPopupQuitIn_91 extends MovieClip {
public var btnYes:SimpleButton;
public var btnNo:SimpleButton;
}
}//package main_fla
Section 116
//mcPopupQuitInside_96 (main_fla.mcPopupQuitInside_96)
package main_fla {
import flash.display.*;
public dynamic class mcPopupQuitInside_96 extends MovieClip {
public var btnYes:SimpleButton;
public var btnNo:SimpleButton;
}
}//package main_fla
Section 117
//mcPopupQuitOut_97 (main_fla.mcPopupQuitOut_97)
package main_fla {
import flash.display.*;
public dynamic class mcPopupQuitOut_97 extends MovieClip {
public var btnYes:SimpleButton;
public var btnNo:SimpleButton;
}
}//package main_fla
Section 118
//mcScore_52 (main_fla.mcScore_52)
package main_fla {
import flash.display.*;
import flash.text.*;
public dynamic class mcScore_52 extends MovieClip {
public var txtScore:TextField;
}
}//package main_fla
Section 119
//mcSkipButton_Anim_Idle_3 (main_fla.mcSkipButton_Anim_Idle_3)
package main_fla {
import flash.display.*;
public dynamic class mcSkipButton_Anim_Idle_3 extends MovieClip {
public var btnSkip:SimpleButton;
}
}//package main_fla
Section 120
//mcTimeAdd_36 (main_fla.mcTimeAdd_36)
package main_fla {
import flash.display.*;
public dynamic class mcTimeAdd_36 extends MovieClip {
public var mcState:MovieClip;
public function mcTimeAdd_36(){
addFrameScript(9, frame10);
}
function frame10(){
trace("In state SHOW");
}
}
}//package main_fla
Section 121
//mcTimecopy_53 (main_fla.mcTimecopy_53)
package main_fla {
import flash.display.*;
import flash.text.*;
public dynamic class mcTimecopy_53 extends MovieClip {
public var txtTime:TextField;
}
}//package main_fla
Section 122
//mcTimeRemove_41 (main_fla.mcTimeRemove_41)
package main_fla {
import flash.display.*;
public dynamic class mcTimeRemove_41 extends MovieClip {
public var mcState:MovieClip;
}
}//package main_fla
Section 123
//PopupBlocker (popups.PopupBlocker)
package popups {
import flash.events.*;
import flash.display.*;
import library.events.*;
import library.basic.*;
import library.interfaces.*;
public class PopupBlocker extends Popup implements Idestroyable {
public function PopupBlocker(_arg1:MovieClip){
super(_arg1);
addState(sSTATE_APPEAR, null, loadState);
addState(sSTATE_IDLE, null, loadState);
addState(sSTATE_DISAPPEAR, null, loadState);
Main.instance.addEventListener(MainEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.addEventListener(MainEvent.EVENT_DESTROY, destroy, false, 0, true);
setState(sSTATE_IDLE);
}
private function loadState():void{
if (mcRef.mcBlocker != null){
mcRef.mcBlocker.useHandCursor = false;
};
switch (state){
case sSTATE_APPEAR:
break;
case sSTATE_IDLE:
break;
case sSTATE_DISAPPEAR:
break;
};
}
public function destroy(_arg1:Event):void{
if (mcRef != null){
mcRef.parent.removeChild(mcRef);
};
Main.instance.removeEventListener(MainEvent.EVENT_UPDATE, update, false);
Main.instance.removeEventListener(MainEvent.EVENT_DESTROY, destroy, false);
mcRef = null;
}
}
}//package popups
Section 124
//PopupHelp (popups.PopupHelp)
package popups {
import library.sounds.*;
import flash.events.*;
import flash.display.*;
import library.events.*;
import library.basic.*;
import library.interfaces.*;
public class PopupHelp extends Popup implements Idestroyable {
private var btnBACK:SimpleButton;
private var btnPLAY:SimpleButton;
private var bSet:Boolean;
public function PopupHelp(_arg1:MovieClip){
super(_arg1);
addState(sSTATE_APPEAR, state_appear, loadState, unloadState);
addState(sSTATE_IDLE, null, loadState, unloadState);
addState(sSTATE_DISAPPEAR, state_disappear, loadState, unloadState);
Main.instance.addEventListener(MainEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.addEventListener(MainEvent.EVENT_DESTROY, destroy, false, 0, true);
setState(sSTATE_APPEAR);
}
override protected function state_appear():void{
if (!bSet){
setPlayButton();
};
super.state_appear();
}
private function setPlayButton():void{
if ((((Main.instance.state == Main.sSTATE_TITLE)) && (!((mcState.getChildByName("mcPopup") == null))))){
mcState.mcPopup.btnResume.visible = false;
bSet = true;
} else {
if (((!((Main.instance.state == Main.sSTATE_TITLE))) && (!((mcState.getChildByName("mcPopup") == null))))){
mcState.mcPopup.btnPlay.visible = false;
bSet = true;
};
};
if (((!((mcState.getChildByName("mcPopup") == null))) && ((mcState.mcPopup.getChildByName("btnPlay") == null)))){
mcState.addEventListener(Event.ADDED, onAddedButton);
} else {
if (mcState.getChildByName("mcPopup") != null){
if (Main.instance.state == Main.sSTATE_TITLE){
btnPLAY = mcState.mcPopup.btnPlay;
} else {
btnPLAY = mcState.mcPopup.btnResume;
};
setButton(btnPLAY, onClick, onRollOver);
};
};
}
private function loadState():void{
if (mcRef.mcBlocker != null){
mcRef.mcBlocker.useHandCursor = false;
};
trace(("Help state: " + state));
switch (state){
case sSTATE_APPEAR:
SoundEngine.Play(Main.sSOUND_UI, SoundList.sSOUND_TRANSITION, 1, true, false, true);
bSet = false;
setPlayButton();
break;
case sSTATE_IDLE:
bSet = false;
setPlayButton();
btnBACK = mcState.mcPopup.btnBack;
setButton(btnBACK, onClick, onRollOver);
break;
case sSTATE_DISAPPEAR:
SoundEngine.Play(Main.sSOUND_UI, SoundList.sSOUND_TRANSITION, 1, true, false, true);
bSet = false;
setPlayButton();
break;
};
}
public function destroy(_arg1:Event):void{
setButton(btnBACK, onClick, onRollOver, true);
setButton(btnPLAY, onClick, onRollOver, true);
if (mcRef != null){
mcRef.parent.removeChild(mcRef);
};
Main.instance.removeEventListener(MainEvent.EVENT_UPDATE, update, false);
Main.instance.removeEventListener(MainEvent.EVENT_DESTROY, destroy, false);
btnBACK = null;
btnPLAY = null;
mcRef = null;
}
private function unloadState():void{
switch (state){
case sSTATE_APPEAR:
case sSTATE_IDLE:
case sSTATE_DISAPPEAR:
break;
};
}
private function onAddedButton(_arg1:Event):void{
if (_arg1.target == mcState.mcPopup.mcButton.getChildByName("btnPlay")){
btnPLAY = mcState.mcPopup.mcButton.getChildByName("btnPlay");
setButton(btnPLAY, onClick, onRollOver);
mcState.removeEventListener(Event.ADDED, onAddedButton);
};
}
public function onClick(_arg1:MouseEvent):void{
switch (_arg1.target){
case btnBACK:
close();
break;
case btnPLAY:
if (Main.instance.state == Main.sSTATE_TITLE){
Main.instance.transitTo(Main.sSTATE_GAME);
} else {
Main.instance.resumeGame();
Main.instance.removePopup(Main.instance.popupMenu);
Main.instance.popupHelp.close();
};
break;
};
SoundEngine.Play(Main.sSOUND_UI, SoundList.sSOUND_CLICK, 1, true, false, true);
}
override protected function state_disappear():void{
if (!bSet){
setPlayButton();
};
super.state_disappear();
}
public function onRollOver(_arg1:MouseEvent):void{
switch (_arg1.target){
default:
SoundEngine.Play(Main.sSOUND_UI, SoundList.sSOUND_ROLLOVER, 1, true, false, true);
break;
};
}
}
}//package popups
Section 125
//PopupMenu (popups.PopupMenu)
package popups {
import library.sounds.*;
import flash.events.*;
import flash.display.*;
import library.events.*;
import library.basic.*;
import library.interfaces.*;
public class PopupMenu extends Popup implements Idestroyable {
private var btnSOUND_ON:SimpleButton;
private var btnRESUME:SimpleButton;
private var btnSOUND_OFF:SimpleButton;
private var btnHELP:SimpleButton;
private var btnQUIT:SimpleButton;
private var btnMUSIC_OFF:SimpleButton;
private var btnMUSIC_ON:SimpleButton;
public function PopupMenu(_arg1:MovieClip){
super(_arg1);
addState(sSTATE_APPEAR, state_appear, loadState);
addState(sSTATE_IDLE, null, loadState);
addState(sSTATE_DISAPPEAR, state_disappear, loadState);
Main.instance.addEventListener(MainEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.addEventListener(MainEvent.EVENT_DESTROY, destroy, false, 0, true);
setState(sSTATE_APPEAR);
}
public function destroy(_arg1:Event):void{
setButton(btnRESUME, onClick, onRollOver, true);
setButton(btnHELP, onClick, onRollOver, true);
setButton(btnQUIT, onClick, onRollOver, true);
setButton(btnSOUND_OFF, onClick, onRollOver, true);
setButton(btnSOUND_ON, onClick, onRollOver, true);
setButton(btnMUSIC_OFF, onClick, onRollOver, true);
setButton(btnMUSIC_ON, onClick, onRollOver, true);
if (mcRef != null){
mcRef.parent.removeChild(mcRef);
};
Main.instance.removeEventListener(MainEvent.EVENT_UPDATE, update, false);
Main.instance.removeEventListener(MainEvent.EVENT_DESTROY, destroy, false);
btnRESUME = null;
btnHELP = null;
btnQUIT = null;
btnSOUND_OFF = null;
btnSOUND_ON = null;
btnMUSIC_OFF = null;
btnMUSIC_ON = null;
mcRef = null;
}
private function loadState():void{
if (mcRef.mcBlocker != null){
mcRef.mcBlocker.useHandCursor = false;
};
switch (state){
case sSTATE_APPEAR:
btnRESUME = mcState.btnResume;
btnHELP = mcState.btnHelp;
btnQUIT = mcState.btnQuit;
btnSOUND_OFF = mcState.btnSoundOff;
btnSOUND_ON = mcState.btnSoundOn;
btnMUSIC_OFF = mcState.btnMusicOff;
btnMUSIC_ON = mcState.btnMusicOn;
updateSoundButtons();
break;
case sSTATE_IDLE:
btnRESUME = mcState.mcPopup.btnResume;
btnHELP = mcState.mcPopup.btnHelp;
btnQUIT = mcState.mcPopup.btnQuit;
btnSOUND_OFF = mcState.mcPopup.btnSoundOff;
btnSOUND_ON = mcState.mcPopup.btnSoundOn;
btnMUSIC_OFF = mcState.mcPopup.btnMusicOff;
btnMUSIC_ON = mcState.mcPopup.btnMusicOn;
setButton(btnRESUME, onClick, onRollOver);
setButton(btnHELP, onClick, onRollOver);
setButton(btnQUIT, onClick, onRollOver);
setButton(btnSOUND_OFF, onClick, onRollOver);
setButton(btnSOUND_ON, onClick, onRollOver);
setButton(btnMUSIC_OFF, onClick, onRollOver);
setButton(btnMUSIC_ON, onClick, onRollOver);
updateSoundButtons();
break;
case sSTATE_DISAPPEAR:
btnRESUME = mcState.btnResume;
btnHELP = mcState.btnHelp;
btnQUIT = mcState.btnQuit;
btnSOUND_OFF = mcState.btnSoundOff;
btnSOUND_ON = mcState.btnSoundOn;
btnMUSIC_OFF = mcState.btnMusicOff;
btnMUSIC_ON = mcState.btnMusicOn;
updateSoundButtons();
break;
};
}
public function updateSoundButtons():void{
if (SoundEngine.isMuted(Main.sSOUND_MUSIC)){
btnMUSIC_ON.visible = false;
btnMUSIC_OFF.visible = true;
} else {
btnMUSIC_ON.visible = true;
btnMUSIC_OFF.visible = false;
};
if (((SoundEngine.isMuted(Main.sSOUND_UI)) || (SoundEngine.isMuted(Main.sSOUND_SFX)))){
btnSOUND_ON.visible = false;
btnSOUND_OFF.visible = true;
} else {
btnSOUND_ON.visible = true;
btnSOUND_OFF.visible = false;
};
}
public function onClick(_arg1:MouseEvent):void{
switch (_arg1.target){
case btnRESUME:
close();
Main.instance.resumeGame();
break;
case btnHELP:
Main.instance.addPopup(Main.sPOPUP_HELP);
break;
case btnQUIT:
Main.instance.addPopup(Main.sPOPUP_QUIT);
break;
case btnSOUND_OFF:
SoundEngine.Unmute(Main.sSOUND_SFX);
SoundEngine.Unmute(Main.sSOUND_UI);
updateSoundButtons();
break;
case btnSOUND_ON:
SoundEngine.Mute(Main.sSOUND_SFX);
SoundEngine.Mute(Main.sSOUND_UI);
updateSoundButtons();
break;
case btnMUSIC_OFF:
SoundEngine.Unmute(Main.sSOUND_MUSIC);
updateSoundButtons();
break;
case btnMUSIC_ON:
SoundEngine.Mute(Main.sSOUND_MUSIC);
updateSoundButtons();
break;
};
SoundEngine.Play(Main.sSOUND_UI, SoundList.sSOUND_CLICK, 1, true, false, true);
}
public function onRollOver(_arg1:MouseEvent):void{
switch (_arg1.target){
default:
SoundEngine.Play(Main.sSOUND_UI, SoundList.sSOUND_ROLLOVER, 1, true, false, true);
break;
};
}
}
}//package popups
Section 126
//PopupQuit (popups.PopupQuit)
package popups {
import library.sounds.*;
import flash.events.*;
import flash.display.*;
import library.events.*;
import gameplay.*;
import library.basic.*;
import library.interfaces.*;
public class PopupQuit extends Popup implements Idestroyable {
private var btnNO:SimpleButton;
private var btnYES:SimpleButton;
public function PopupQuit(_arg1:MovieClip){
super(_arg1);
addState(sSTATE_APPEAR, state_appear, loadState);
addState(sSTATE_IDLE, null, loadState);
addState(sSTATE_DISAPPEAR, state_disappear, loadState);
Main.instance.addEventListener(MainEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.addEventListener(MainEvent.EVENT_DESTROY, destroy, false, 0, true);
setState(sSTATE_APPEAR);
}
private function loadState():void{
if (mcRef.mcBlocker != null){
mcRef.mcBlocker.useHandCursor = false;
};
switch (state){
case sSTATE_APPEAR:
break;
case sSTATE_IDLE:
btnYES = mcState.mcPopup.btnYes;
btnNO = mcState.mcPopup.btnNo;
setButton(btnYES, onClick, onRollOver);
setButton(btnNO, onClick, onRollOver);
break;
case sSTATE_DISAPPEAR:
break;
};
}
public function destroy(_arg1:Event):void{
setButton(btnYES, onClick, onRollOver, true);
setButton(btnNO, onClick, onRollOver, true);
if (mcRef != null){
mcRef.parent.removeChild(mcRef);
};
Main.instance.removeEventListener(MainEvent.EVENT_UPDATE, update, false);
Main.instance.removeEventListener(MainEvent.EVENT_DESTROY, destroy, false);
btnYES = null;
btnNO = null;
mcRef = null;
}
public function onClick(_arg1:MouseEvent):void{
switch (_arg1.target){
case btnYES:
Main.instance.nScore = ScoreManagement.instance.score;
Main.instance.transitTo(Main.sSTATE_LOSE);
break;
case btnNO:
close();
break;
};
SoundEngine.Play(Main.sSOUND_UI, SoundList.sSOUND_CLICK, 1, true, false, true);
}
public function onRollOver(_arg1:MouseEvent):void{
switch (_arg1.target){
default:
SoundEngine.Play(Main.sSOUND_UI, SoundList.sSOUND_ROLLOVER, 1, true, false, true);
break;
};
}
}
}//package popups
Section 127
//Recipes (recipes.Recipes)
package recipes {
import library.sounds.*;
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import library.events.*;
import library.basic.*;
import library.interfaces.*;
import flash.printing.*;
public class Recipes extends StateManaged implements Idestroyable {
private var aStates:Array;
private var iFrame:int;
private var iIndex:int;
public static const sSTATE_CHICKEN:String = "chicken";
public static const sSTATE_EGG:String = "egg";
public static const sSTATE_MAYONNAISE:String = "mayonnaise";
public static const sSTATE_SALMON:String = "salmon";
public static const sSTATE_SHRIMP:String = "shrimp";
public static const sSTATE_TUNA:String = "tuna";
public static const sSTATE_TIPS:String = "tips";
public static const sSTATE_TOOLS:String = "tools";
public static const sSTATE_WARNING:String = "warning";
public function Recipes(_arg1:MovieClip):void{
super(_arg1);
iIndex = 0;
iFrame = 595;
mcRef.x = 27.3;
mcRef.y = 53.5;
aStates = new Array(sSTATE_WARNING, sSTATE_TOOLS, sSTATE_TIPS, sSTATE_EGG, sSTATE_TUNA, sSTATE_SALMON, sSTATE_CHICKEN, sSTATE_SHRIMP, sSTATE_MAYONNAISE);
addState(sSTATE_WARNING, state_warning, initButtons);
addState(sSTATE_TOOLS, null, initButtons);
addState(sSTATE_TIPS, null, initButtons);
addState(sSTATE_EGG, null, initButtons);
addState(sSTATE_TUNA, null, initButtons);
addState(sSTATE_SALMON, null, initButtons);
addState(sSTATE_CHICKEN, null, initButtons);
addState(sSTATE_SHRIMP, null, initButtons);
addState(sSTATE_MAYONNAISE, null, initButtons);
Main.instance.addEventListener(MainEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.addEventListener(MainEvent.EVENT_DESTROY, destroy, false, 0, true);
setButton(mcRef.btnNext, onClick, onRollOver);
setButton(mcRef.btnPrevious1, onClick, onRollOver);
setButton(mcRef.btnPrevious2, onClick, onRollOver);
setButton(mcRef.btnPrint, onClick, onRollOver);
setButton(mcRef.btnReturn, onClick, onRollOver);
setButton(mcRef.btnSkip, onClick, onRollOver);
setState(aStates[iIndex]);
}
private function hide(... _args):void{
var _local2:int;
_local2 = 0;
while (_local2 < _args.length) {
_args[_local2].visible = false;
_local2++;
};
}
public function showPrevPage():void{
iIndex--;
setState(aStates[iIndex]);
}
public function initButtons():void{
switch (state){
case sSTATE_WARNING:
hide(mcRef.btnNext, mcRef.btnPrevious1, mcRef.btnPrevious2, mcRef.btnPrint, mcRef.btnReturn);
show(mcRef.btnSkip);
break;
case sSTATE_TOOLS:
show(mcRef.btnNext, mcRef.btnPrint, mcRef.btnReturn);
hide(mcRef.btnPrevious1, mcRef.btnPrevious2, mcRef.btnSkip);
break;
case sSTATE_TIPS:
case sSTATE_EGG:
case sSTATE_TUNA:
case sSTATE_SALMON:
case sSTATE_CHICKEN:
case sSTATE_SHRIMP:
show(mcRef.btnNext, mcRef.btnPrint, mcRef.btnPrevious1, mcRef.btnReturn);
hide(mcRef.btnPrevious2, mcRef.btnSkip);
break;
case sSTATE_MAYONNAISE:
show(mcRef.btnPrevious2, mcRef.btnPrint, mcRef.btnReturn);
hide(mcRef.btnPrevious1, mcRef.btnNext, mcRef.btnSkip);
break;
};
}
public function printPage():void{
var _local1:PrintJob;
var _local2:PrintJobOptions;
_local1 = new PrintJob();
_local2 = new PrintJobOptions(true);
if (_local1.start()){
_local1.addPage(mcRef.mcState, new Rectangle((((mcState.width / 2) + 27.3) * -1), (((mcState.height / 2) + 53.5) * -1), (mcState.width + 27.3), (mcState.height + 53.5)), _local2);
_local1.send();
};
}
public function destroy(_arg1:Event):void{
setButton(mcRef.btnNext, onClick, onRollOver, true);
setButton(mcRef.btnPrevious1, onClick, onRollOver, true);
setButton(mcRef.btnPrevious2, onClick, onRollOver, true);
setButton(mcRef.btnPrint, onClick, onRollOver, true);
setButton(mcRef.btnReturn, onClick, onRollOver, true);
setButton(mcRef.btnSkip, onClick, onRollOver, true);
Main.instance.removeEventListener(MainEvent.EVENT_UPDATE, update, false);
Main.instance.removeEventListener(MainEvent.EVENT_DESTROY, destroy, false);
mcRef = null;
}
public function state_warning():void{
iFrame--;
if (iFrame <= 0){
showNextPage();
};
}
public function onRollOver(_arg1:MouseEvent):void{
switch (_arg1.target){
default:
SoundEngine.Play(Main.sSOUND_UI, SoundList.sSOUND_ROLLOVER, 1, true, false, true);
break;
};
}
public function onClick(_arg1:MouseEvent):void{
switch (_arg1.target){
case mcRef.btnNext:
case mcRef.btnSkip:
showNextPage();
break;
case mcRef.btnPrevious1:
case mcRef.btnPrevious2:
showPrevPage();
break;
case mcRef.btnPrint:
printPage();
break;
case mcRef.btnReturn:
Main.instance.transitTo(Main.sSTATE_TITLE);
break;
};
SoundEngine.Play(Main.sSOUND_UI, SoundList.sSOUND_CLICK, 1, true, false, true);
}
private function setButton(_arg1:DisplayObject, _arg2:Function, _arg3:Function=null, _arg4:Boolean=false):void{
if (_arg4){
_arg1.removeEventListener(MouseEvent.CLICK, _arg2, false);
_arg1.removeEventListener(MouseEvent.ROLL_OVER, _arg3, false);
} else {
_arg1.addEventListener(MouseEvent.CLICK, _arg2, false, 0, true);
_arg1.addEventListener(MouseEvent.ROLL_OVER, _arg3, false, 0, true);
};
}
private function show(... _args):void{
var _local2:int;
_local2 = 0;
while (_local2 < _args.length) {
_args[_local2].visible = true;
_local2++;
};
}
public function showNextPage():void{
iIndex++;
setState(aStates[iIndex]);
}
}
}//package recipes
Section 128
//HSScreen (screens.HSScreen)
package screens {
import library.sounds.*;
import flash.events.*;
import flash.display.*;
import library.events.*;
import library.basic.*;
import library.interfaces.*;
import flash.text.*;
public class HSScreen extends Screen implements Idestroyable {
private var bScrollD:Boolean;
private var bScrollU:Boolean;
public function HSScreen(_arg1:MovieClip){
super(_arg1);
initButton();
TextField(mcRef.getChildByName("txtScore")).text = Math.floor(Main.instance.nScore).toString();
bScrollD = false;
bScrollU = false;
TextField(mcRef.txtStatus).text = "The High Scores list is updating!";
TextField(mcRef.txtPositions).text = "";
TextField(mcRef.txtUsernames).text = "";
TextField(mcRef.txtScores).text = "";
Main.instance.nickServices.addEventListener(NickServices.sEVENT_SCORES_RECEIVED, updateScores, false, 0, true);
Main.instance.nickServices.addEventListener(NickServices.sEVENT_ERROR, updateError, false, 0, true);
Main.instance.nickServices.addEventListener(NickServices.sEVENT_USER_LOGGED_OUT, forceLogIn, false, 0, true);
Main.instance.nickServices.addEventListener(NickServices.sEVENT_USER_STATUS_RECEIVED, resubmit, false, 0, true);
Main.instance.nickServices.addEventListener(NickServices.sEVENT_SCORE_SUBMISSION_COMPLETED, reloadScores, false, 0, true);
Main.instance.addEventListener(MainEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.nickServices.requestScores(Config.Default.GameID);
}
override public function update(_arg1:Event):void{
if (bScrollD){
TextField(mcRef.txtPositions).scrollV++;
TextField(mcRef.txtUsernames).scrollV++;
TextField(mcRef.txtScores).scrollV++;
} else {
if (bScrollU){
TextField(mcRef.txtPositions).scrollV--;
TextField(mcRef.txtUsernames).scrollV--;
TextField(mcRef.txtScores).scrollV--;
};
};
}
public function updateScores(_arg1:Event):void{
var _local2:TextField;
var _local3:TextField;
var _local4:TextField;
var _local5:TextField;
var _local6:Array;
var _local7:int;
_local2 = TextField(mcRef.txtStatus);
_local3 = TextField(mcRef.txtPositions);
_local4 = TextField(mcRef.txtUsernames);
_local5 = TextField(mcRef.txtScores);
_local6 = Main.instance.nickServices.highScores;
_local2.text = "";
_local3.text = "";
_local4.text = "";
_local5.text = "";
_local7 = 0;
while (_local7 < _local6.length) {
_local3.appendText(String(_local6[_local7].nRank));
_local4.appendText(String(_local6[_local7].sNickName));
_local5.appendText(String(_local6[_local7].nScore));
if (_local7 < (_local6.length - 1)){
_local3.appendText("\n");
_local4.appendText("\n");
_local5.appendText("\n");
};
_local7++;
};
if (_local6.length == 0){
_local2.text = "There is no High Score for the moment.";
};
}
public function resubmit(_arg1:Event):void{
Main.instance.nickServices.submitScore(Config.Default.GameID, Math.floor(Main.instance.nScore));
}
public function onScroll(_arg1:MouseEvent):void{
switch (_arg1.target){
case mcRef.btnUp:
if (_arg1.type == MouseEvent.MOUSE_DOWN){
bScrollU = true;
bScrollD = false;
} else {
bScrollU = false;
};
break;
case mcRef.btnDown:
if (_arg1.type == MouseEvent.MOUSE_DOWN){
bScrollD = true;
bScrollU = false;
} else {
bScrollD = false;
};
break;
};
}
public function reloadScores(_arg1:Event):void{
TextField(mcRef.txtStatus).text = "The High Scores list is updating!";
TextField(mcRef.txtPositions).text = "";
TextField(mcRef.txtUsernames).text = "";
TextField(mcRef.txtScores).text = "";
Main.instance.nickServices.requestScores(Config.Default.GameID);
}
public function forceLogIn(_arg1:Event):void{
var _local2:DisplayObjectContainer;
_local2 = Main.instance.depthManager.getDepthLayer(Main.sDEPTH_LOGINUI);
Main.instance.nickServices.requestLoginUI(true, _local2);
}
override protected function initButton():void{
setButton(mcRef.btnPlayAgain, onClick, onRollOver);
setButton(mcRef.btnSubmitHS, onClick, onRollOver);
SimpleButton(mcRef.btnUp).addEventListener(MouseEvent.MOUSE_DOWN, onScroll, false, 0, true);
SimpleButton(mcRef.btnUp).addEventListener(MouseEvent.MOUSE_UP, onScroll, false, 0, true);
SimpleButton(mcRef.btnUp).addEventListener(MouseEvent.MOUSE_OVER, onRollOver, false, 0, true);
SimpleButton(mcRef.btnUp).addEventListener(MouseEvent.MOUSE_OUT, onScroll, false, 0, true);
SimpleButton(mcRef.btnDown).addEventListener(MouseEvent.MOUSE_DOWN, onScroll, false, 0, true);
SimpleButton(mcRef.btnDown).addEventListener(MouseEvent.MOUSE_UP, onScroll, false, 0, true);
SimpleButton(mcRef.btnDown).addEventListener(MouseEvent.MOUSE_OVER, onRollOver, false, 0, true);
SimpleButton(mcRef.btnDown).addEventListener(MouseEvent.MOUSE_OUT, onScroll, false, 0, true);
if (Main.instance.bSubmit){
mcRef.btnSubmitHS.visible = false;
};
}
public function onClick(_arg1:MouseEvent):void{
switch (_arg1.target){
case mcRef.btnPlayAgain:
Main.instance.transitTo(Main.sSTATE_TITLE);
break;
case mcRef.btnSubmitHS:
trace(Main.instance.nickServices.ready);
Main.instance.nickServices.submitScore(Config.Default.GameID, Math.floor(Main.instance.nScore));
break;
};
SoundEngine.Play(Main.sSOUND_UI, SoundList.sSOUND_CLICK, 1, true, false, true);
}
public function onRollOver(_arg1:MouseEvent):void{
switch (_arg1.target){
default:
SoundEngine.Play(Main.sSOUND_UI, SoundList.sSOUND_ROLLOVER, 1, true, false, true);
break;
};
}
override public function destroy(_arg1:Event):void{
SimpleButton(mcRef.btnUp).removeEventListener(MouseEvent.MOUSE_DOWN, onScroll, false);
SimpleButton(mcRef.btnUp).removeEventListener(MouseEvent.MOUSE_UP, onScroll, false);
SimpleButton(mcRef.btnUp).removeEventListener(MouseEvent.MOUSE_OVER, onRollOver, false);
SimpleButton(mcRef.btnUp).removeEventListener(MouseEvent.MOUSE_OUT, onScroll, false);
SimpleButton(mcRef.btnDown).removeEventListener(MouseEvent.MOUSE_DOWN, onScroll, false);
SimpleButton(mcRef.btnDown).removeEventListener(MouseEvent.MOUSE_UP, onScroll, false);
SimpleButton(mcRef.btnDown).removeEventListener(MouseEvent.MOUSE_OVER, onRollOver, false);
SimpleButton(mcRef.btnDown).removeEventListener(MouseEvent.MOUSE_OUT, onScroll, false);
setButton(mcRef.btnPlayAgain, onClick, onRollOver, true);
setButton(mcRef.btnSubmitHS, onClick, onRollOver, true);
setButton(mcRef.btnUp, onClick, onRollOver, true);
setButton(mcRef.btnDown, onClick, onRollOver, true);
Main.instance.nickServices.removeEventListener(NickServices.sEVENT_ERROR, updateError, false);
Main.instance.nickServices.removeEventListener(NickServices.sEVENT_SCORES_RECEIVED, updateScores, false);
mcRef = null;
}
public function updateError(_arg1:Event):void{
TextField(mcRef.txtStatus).text = "Oops! The High Scores list is not available right now!";
}
}
}//package screens
Section 129
//HSTitleScreen (screens.HSTitleScreen)
package screens {
import library.sounds.*;
import flash.events.*;
import flash.display.*;
import library.events.*;
import library.basic.*;
import library.interfaces.*;
import flash.text.*;
public class HSTitleScreen extends Screen implements Idestroyable {
private var bScrollD:Boolean;
private var bScrollU:Boolean;
public function HSTitleScreen(_arg1:MovieClip){
super(_arg1);
initButton();
bScrollD = false;
bScrollU = false;
TextField(mcRef.txtStatus).text = "The High Scores list is updating!";
TextField(mcRef.txtPositions).text = "";
TextField(mcRef.txtUsernames).text = "";
TextField(mcRef.txtScores).text = "";
Main.instance.nickServices.addEventListener(NickServices.sEVENT_SCORES_RECEIVED, updateScores, false, 0, true);
Main.instance.nickServices.addEventListener(NickServices.sEVENT_ERROR, updateError, false, 0, true);
Main.instance.addEventListener(MainEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.nickServices.requestScores(Config.Default.GameID);
}
override public function update(_arg1:Event):void{
if (bScrollD){
TextField(mcRef.txtPositions).scrollV++;
TextField(mcRef.txtUsernames).scrollV++;
TextField(mcRef.txtScores).scrollV++;
} else {
if (bScrollU){
TextField(mcRef.txtPositions).scrollV--;
TextField(mcRef.txtUsernames).scrollV--;
TextField(mcRef.txtScores).scrollV--;
};
};
}
public function updateScores(_arg1:Event):void{
var _local2:TextField;
var _local3:TextField;
var _local4:TextField;
var _local5:TextField;
var _local6:Array;
var _local7:int;
trace(("HSTitleScreen.updateScores > _e : " + _arg1));
_local2 = TextField(mcRef.txtStatus);
_local3 = TextField(mcRef.txtPositions);
_local4 = TextField(mcRef.txtUsernames);
_local5 = TextField(mcRef.txtScores);
_local6 = Main.instance.nickServices.highScores;
trace(("_aHighscores : " + _local6));
_local2.text = "";
_local3.text = "";
_local4.text = "";
_local5.text = "";
_local7 = 0;
while (_local7 < _local6.length) {
_local3.appendText(String(_local6[_local7].nRank));
_local4.appendText(String(_local6[_local7].sNickName));
_local5.appendText(String(_local6[_local7].nScore));
if (_local7 < (_local6.length - 1)){
_local3.appendText("\n");
_local4.appendText("\n");
_local5.appendText("\n");
};
_local7++;
};
if (_local6.length == 0){
_local2.text = "There is no High Score for the moment.";
};
}
public function onScroll(_arg1:MouseEvent):void{
switch (_arg1.target){
case mcRef.btnUp:
if (_arg1.type == MouseEvent.MOUSE_DOWN){
bScrollU = true;
bScrollD = false;
} else {
bScrollU = false;
};
break;
case mcRef.btnDown:
if (_arg1.type == MouseEvent.MOUSE_DOWN){
bScrollD = true;
bScrollU = false;
} else {
bScrollD = false;
};
break;
};
}
override protected function initButton():void{
setButton(mcRef.btnBack, onClick, onRollOver);
SimpleButton(mcRef.btnUp).addEventListener(MouseEvent.MOUSE_DOWN, onScroll, false, 0, true);
SimpleButton(mcRef.btnUp).addEventListener(MouseEvent.MOUSE_UP, onScroll, false, 0, true);
SimpleButton(mcRef.btnUp).addEventListener(MouseEvent.MOUSE_OVER, onRollOver, false, 0, true);
SimpleButton(mcRef.btnUp).addEventListener(MouseEvent.MOUSE_OUT, onScroll, false, 0, true);
SimpleButton(mcRef.btnDown).addEventListener(MouseEvent.MOUSE_DOWN, onScroll, false, 0, true);
SimpleButton(mcRef.btnDown).addEventListener(MouseEvent.MOUSE_UP, onScroll, false, 0, true);
SimpleButton(mcRef.btnDown).addEventListener(MouseEvent.MOUSE_OVER, onRollOver, false, 0, true);
SimpleButton(mcRef.btnDown).addEventListener(MouseEvent.MOUSE_OUT, onScroll, false, 0, true);
}
public function onClick(_arg1:MouseEvent):void{
switch (_arg1.target){
case mcRef.btnBack:
Main.instance.transitTo(Main.sSTATE_TITLE);
break;
};
SoundEngine.Play(Main.sSOUND_UI, SoundList.sSOUND_CLICK, 1, true, false, true);
}
public function onRollOver(_arg1:MouseEvent):void{
switch (_arg1.target){
default:
SoundEngine.Play(Main.sSOUND_UI, SoundList.sSOUND_ROLLOVER, 1, true, false, true);
break;
};
}
override public function destroy(_arg1:Event):void{
setButton(mcRef.btnBack, onClick, onRollOver, true);
SimpleButton(mcRef.btnUp).removeEventListener(MouseEvent.MOUSE_DOWN, onScroll, false);
SimpleButton(mcRef.btnUp).removeEventListener(MouseEvent.MOUSE_UP, onScroll, false);
SimpleButton(mcRef.btnUp).removeEventListener(MouseEvent.MOUSE_OVER, onRollOver, false);
SimpleButton(mcRef.btnUp).removeEventListener(MouseEvent.MOUSE_OUT, onScroll, false);
SimpleButton(mcRef.btnDown).removeEventListener(MouseEvent.MOUSE_DOWN, onScroll, false);
SimpleButton(mcRef.btnDown).removeEventListener(MouseEvent.MOUSE_UP, onScroll, false);
SimpleButton(mcRef.btnDown).removeEventListener(MouseEvent.MOUSE_OVER, onRollOver, false);
SimpleButton(mcRef.btnDown).removeEventListener(MouseEvent.MOUSE_OUT, onScroll, false);
Main.instance.nickServices.removeEventListener(NickServices.sEVENT_ERROR, updateError, false);
Main.instance.nickServices.removeEventListener(NickServices.sEVENT_SCORES_RECEIVED, updateScores, false);
mcRef = null;
}
public function updateError(_arg1:Event):void{
trace(("HSTitleScreen.updateError > _e : " + _arg1));
TextField(mcRef.txtStatus).text = "Oops! The High Scores list is not available right now!";
}
}
}//package screens
Section 130
//LoseScreen (screens.LoseScreen)
package screens {
import library.sounds.*;
import flash.events.*;
import flash.display.*;
import library.basic.*;
import flash.text.*;
public class LoseScreen extends Screen {
public function LoseScreen(_arg1:MovieClip){
super(_arg1);
initButton();
TextField(mcRef.getChildByName("txtScore")).text = Math.floor(Main.instance.nScore).toString();
Main.instance.nickServices.addEventListener(NickServices.sEVENT_USER_LOGGED_OUT, forceLogIn, false, 0, true);
Main.instance.nickServices.addEventListener(NickServices.sEVENT_USER_STATUS_RECEIVED, resubmit, false, 0, true);
Main.instance.nickServices.addEventListener(NickServices.sEVENT_SCORE_SUBMISSION_COMPLETED, toHS, false, 0, true);
}
public function toHS(_arg1:Event):void{
Main.instance.bSubmit = true;
Main.instance.transitTo(Main.sSTATE_HS);
}
public function resubmit(_arg1:Event):void{
Main.instance.nickServices.submitScore(Config.Default.GameID, Math.floor(Main.instance.nScore));
}
public function displayHS(_arg1:Event):void{
mcRef.btnViewHS.visible = true;
mcRef.btnSubmitHS.visible = true;
}
public function forceLogIn(_arg1:Event):void{
var _local2:DisplayObjectContainer;
_local2 = Main.instance.depthManager.getDepthLayer(Main.sDEPTH_LOGINUI);
Main.instance.nickServices.requestLoginUI(true, _local2);
}
public function showBtn(_arg1:SimpleButton):void{
_arg1.visible = true;
}
override protected function initButton():void{
setButton(mcRef.btnPlayAgain, onClick, onRollOver);
setButton(mcRef.btnSubmitHS, onClick, onRollOver);
setButton(mcRef.btnViewHS, onClick, onRollOver);
if (!Main.instance.nickServices.ready){
mcRef.btnViewHS.visible = false;
mcRef.btnSubmitHS.visible = false;
Main.instance.nickServices.addEventListener(NickServices.sEVENT_SERVICES_READY, displayHS, false, 0, true);
};
}
public function onClick(_arg1:MouseEvent):void{
switch (_arg1.target){
case mcRef.btnPlayAgain:
Main.instance.transitTo(Main.sSTATE_TITLE);
break;
case mcRef.btnSubmitHS:
Main.instance.nickServices.submitScore(Config.Default.GameID, Math.floor(Main.instance.nScore));
Main.instance.transitTo(Main.sSTATE_HS);
break;
case mcRef.btnViewHS:
Main.instance.transitTo(Main.sSTATE_HS);
break;
};
SoundEngine.Play(Main.sSOUND_UI, SoundList.sSOUND_CLICK, 1, true, false, true);
}
public function onRollOver(_arg1:MouseEvent):void{
switch (_arg1.target){
default:
SoundEngine.Play(Main.sSOUND_UI, SoundList.sSOUND_ROLLOVER, 1, true, false, true);
break;
};
}
override public function destroy(_arg1:Event):void{
setButton(mcRef.btnPlayAgain, onClick, onRollOver, true);
setButton(mcRef.btnSubmitHS, onClick, onRollOver, true);
setButton(mcRef.btnViewHS, onClick, onRollOver, true);
Main.instance.nickServices.removeEventListener(NickServices.sEVENT_SERVICES_READY, displayHS, false);
Main.instance.nickServices.removeEventListener(NickServices.sEVENT_USER_LOGGED_OUT, forceLogIn, false);
Main.instance.nickServices.removeEventListener(NickServices.sEVENT_USER_STATUS_RECEIVED, resubmit, false);
Main.instance.nickServices.removeEventListener(NickServices.sEVENT_SCORE_SUBMISSION_COMPLETED, toHS, false);
mcRef = null;
}
}
}//package screens
Section 131
//RecipeScreen (screens.RecipeScreen)
package screens {
import flash.events.*;
import flash.display.*;
import library.basic.*;
import library.interfaces.*;
import recipes.*;
public class RecipeScreen extends Screen implements Idestroyable {
private var oRecipes:Recipes;
public function RecipeScreen(_arg1:MovieClip):void{
var _local2:MovieClip;
super(_arg1);
_local2 = new mcRecipes();
mcRef.addChild(_local2);
oRecipes = new Recipes(_local2);
}
override public function destroy(_arg1:Event):void{
mcRef = null;
}
}
}//package screens
Section 132
//TitleScreen (screens.TitleScreen)
package screens {
import library.sounds.*;
import flash.events.*;
import flash.display.*;
import library.basic.*;
import library.interfaces.*;
public class TitleScreen extends Screen implements Idestroyable {
public function TitleScreen(_arg1:MovieClip){
super(_arg1);
initButton();
}
public function displayHS(_arg1:Event):void{
mcRef.btnViewHS.visible = true;
}
override protected function initButton():void{
setButton(mcRef.btnPlay, onClick, onRollOver);
setButton(mcRef.btnHelp, onClick, onRollOver);
setButton(mcRef.btnViewHS, onClick, onRollOver);
setButton(mcRef.btnRecipes, onClick, onRollOver);
if (!Main.instance.nickServices.ready){
mcRef.btnViewHS.visible = false;
Main.instance.nickServices.addEventListener(NickServices.sEVENT_SERVICES_READY, displayHS, false, 0, true);
};
}
public function onClick(_arg1:MouseEvent):void{
switch (_arg1.target){
case mcRef.btnPlay:
Main.instance.transitTo(Main.sSTATE_GAME);
break;
case mcRef.btnHelp:
Main.instance.addPopup(Main.sPOPUP_HELP);
break;
case mcRef.btnViewHS:
Main.instance.transitTo(Main.sSTATE_HS_TITLE);
break;
case mcRef.btnRecipes:
Main.instance.transitTo(Main.sSTATE_RECIPE);
break;
};
SoundEngine.Play(Main.sSOUND_UI, SoundList.sSOUND_CLICK, 1, true, false, true);
}
public function onRollOver(_arg1:MouseEvent):void{
switch (_arg1.target){
default:
SoundEngine.Play(Main.sSOUND_UI, SoundList.sSOUND_ROLLOVER, 1, true, false, true);
break;
};
}
override public function destroy(_arg1:Event):void{
setButton(mcRef.btnPlay, onClick, onRollOver, true);
setButton(mcRef.btnHelp, onClick, onRollOver, true);
setButton(mcRef.btnViewHS, onClick, onRollOver, true);
setButton(mcRef.btnRecipes, onClick, onRollOver, true);
Main.instance.nickServices.removeEventListener(NickServices.sEVENT_SERVICES_READY, displayHS, false);
mcRef = null;
}
}
}//package screens
Section 133
//Config (Config)
package {
public class Config {
public static var Starting:Object = {Patience:30, Time:60};
public static var Default:Object = {BubbleTime:70, GameID:"ic_ihearthsb"};
public static var Scoring:Object = {Recipe:{Time:25, Score:1000}, PowerUp:{Kanji:250, Special:300}, Missed:-150, Bonus:{Time:20, Score:500}, Feedback:{Positive:{Score:100, Time:3}, Negative:{Score:-50, Time:3}}};
public static var Probability:Object = {HotSauce:0.1, PowerUpKanji:0.02, TestFrameKanji:35, DisplayTime:1.5};
public static var Special:Object = {Word:"icarly", WaitWord:3, Time:30};
public static var Difficulty:Object = {RecipeIncrease:0.5, TimeToDoSushi:1.1, ThresholdClick:0.2, ThresholdDraw:0.001, ThresholdBase:0.001};
public static var Tutorial:Object = {Threshold:0.05};
}
}//package
Section 134
//Main (Main)
package {
import library.sounds.*;
import flash.events.*;
import flash.display.*;
import library.events.*;
import library.utils.*;
import gameplay.*;
import library.basic.*;
import popups.*;
import screens.*;
public class Main extends MovieClip {
private var oGame:Game;
private var oNickServices:NickServices;
public var bSubmit:Boolean;
private var sStateTransit:String;
private var oTransition:Transition;
private var oPopupHelp:PopupHelp;
private var oPopupQuit:PopupQuit;
private var oPopupMenu:PopupMenu;
private var oDepthManager:DepthManager;
private var oScreen:Screen;
private var oPopupBlocker:PopupBlocker;
public var nScore:Number;
private var sState:String;
public static var sPOPUP_INSTRUCT:String = "instruct";
public static var sSOUND_SFX:String = "sfx";
public static var sSTATE_HS_TITLE:String = "highScoreTitle";
public static var sSTATE_LOADED:String = "loaded";
public static var sPOPUP_HELP:String = "help";
public static var sSTATE_RECIPE:String = "recipe";
public static var nSOUND_UI:Number = 1;
public static var sSTATE_HS:String = "highScore";
public static var sPOPUP_BLOCKER:String = "blocker";
public static var sSTATE_LOSE:String = "lose";
public static var sSTATE_TITLE:String = "title";
public static var sDEPTH_POPUP:String = "popup";
public static var nSOUND_MUSIC:Number = 0.7;
public static var sDEPTH_TRANSITION:String = "transition";
public static var sPOPUP_MENU:String = "menu";
public static var nSOUND_SFX:Number = 1;
public static var sSOUND_MUSIC:String = "music";
public static var sPOPUP_QUIT:String = "quit";
public static var sSOUND_UI:String = "ui";
public static var sSTATE_GAME:String = "game";
public static var sDEPTH_LOGINUI:String = "loginui";
public static var sDEPTH_SCREEN:String = "screen";
private static var oInstance:Main;
public function Main(){
oInstance = this;
bSubmit = false;
oNickServices = new NickServices();
nScore = 0;
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage, false, 0, true);
addEventListener(Event.ENTER_FRAME, update, false, 0, true);
addEventListener(Event.UNLOAD, unload, false, 0, true);
}
private function unload(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, update, false);
removeEventListener(Event.UNLOAD, unload, false);
dispatchEvent(new MainEvent(MainEvent.EVENT_DESTROY, false, false));
oDepthManager.destroy(null);
oDepthManager = null;
oPopupMenu = null;
oPopupHelp = null;
oPopupQuit = null;
oPopupBlocker = null;
oTransition = null;
oScreen = null;
oGame = null;
}
public function get popupHelp():PopupHelp{
return (oPopupHelp);
}
public function pauseGame():void{
dispatchEvent(new MainEvent(MainEvent.EVENT_PAUSE, false, false));
}
public function get popupQuit():PopupQuit{
return (oPopupQuit);
}
public function get popupMenu():PopupMenu{
return (oPopupMenu);
}
private function onTransitionFull(_arg1:Event):void{
setState(sStateTransit);
oTransition.removeEventListener(Transition.sEVENT_FULL_SCREEN, onTransitionFull, false);
}
public function get gameManager():Game{
return (oGame);
}
private function loadState():void{
var _local1:MovieClip;
trace("===============================");
trace(("LOAD MAIN STATE: " + state));
switch (state){
case sSTATE_LOADED:
addScreen();
transitTo(sSTATE_TITLE);
break;
case sSTATE_TITLE:
bSubmit = false;
SoundEngine.Play(sSOUND_MUSIC, SoundList.sMUSIC_PACKAGING, 1, true, true, true);
_local1 = addScreen();
oScreen = new TitleScreen(_local1);
break;
case sSTATE_GAME:
SoundEngine.Play(sSOUND_MUSIC, SoundList.sMUSIC_IN_GAME, 1, true, true, true);
_local1 = addScreen();
oGame = new Game(_local1);
oGame.initObject();
break;
case sSTATE_LOSE:
SoundEngine.Play(sSOUND_MUSIC, SoundList.sMUSIC_PACKAGING, 1, true, true, true);
_local1 = addScreen();
oScreen = new LoseScreen(_local1);
break;
case sSTATE_HS_TITLE:
SoundEngine.Play(sSOUND_MUSIC, SoundList.sMUSIC_PACKAGING, 1, true, true, true);
_local1 = addScreen();
oScreen = new HSTitleScreen(_local1);
break;
case sSTATE_HS:
SoundEngine.Play(sSOUND_MUSIC, SoundList.sMUSIC_PACKAGING, 1, true, true, true);
_local1 = addScreen();
oScreen = new HSScreen(_local1);
break;
case sSTATE_RECIPE:
SoundEngine.Play(sSOUND_MUSIC, SoundList.sMUSIC_PACKAGING, 1, true, true, true);
_local1 = addScreen();
oScreen = new RecipeScreen(_local1);
};
}
public function get depthManager():DepthManager{
return (oDepthManager);
}
public function setState(_arg1:String):void{
if (_arg1 != state){
if (state != null){
unloadState();
};
sState = _arg1;
loadState();
};
}
public function get transition():Transition{
return (oTransition);
}
public function get state():String{
return (sState);
}
private function addScreen():MovieClip{
var _local1:DisplayObjectContainer;
var _local2:MovieClip;
_local1 = oDepthManager.getDepthLayer(sDEPTH_SCREEN);
if (oScreen != null){
if (oScreen.mcRef != null){
_local1.removeChild(oScreen.mcRef);
};
oScreen.destroy(null);
oScreen = null;
};
switch (sState){
case sSTATE_LOADED:
_local2 = new mcScreenLoaded();
break;
case sSTATE_TITLE:
_local2 = new mcScreenTitle();
break;
case sSTATE_GAME:
_local2 = new mcScreenGame();
break;
case sSTATE_LOSE:
_local2 = new mcScreenLose();
break;
case sSTATE_HS_TITLE:
_local2 = new mcScreenHSTitle();
break;
case sSTATE_HS:
_local2 = new mcScreenHS();
break;
case sSTATE_RECIPE:
_local2 = new mcScreenRecipes();
break;
};
_local1.addChild(_local2);
return (_local2);
}
private function onAddedToStage(_arg1:Event):void{
oDepthManager = new DepthManager();
oDepthManager.addDepthLayer(sDEPTH_SCREEN, this);
oDepthManager.addDepthLayer(sDEPTH_POPUP, this);
oDepthManager.addDepthLayer(sDEPTH_TRANSITION, this);
oDepthManager.addDepthLayer(sDEPTH_LOGINUI, this);
SoundEngine.addcategory(sSOUND_MUSIC, nSOUND_MUSIC, true);
SoundEngine.addcategory(sSOUND_SFX, nSOUND_SFX);
SoundEngine.addcategory(sSOUND_UI, nSOUND_UI);
setState(sSTATE_LOADED);
removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage, false);
}
public function addPopup(_arg1:String):void{
var _local2:MovieClip;
var _local3:DisplayObjectContainer;
trace(("Main.addPopup > _sID : " + _arg1));
_local3 = oDepthManager.getDepthLayer(sDEPTH_POPUP);
trace(("_dpLayer: " + _local3));
switch (_arg1){
case sPOPUP_MENU:
_local2 = new mcPopupMenu();
trace(("_mcPopup: " + _local2));
oPopupMenu = new PopupMenu(_local2);
break;
case sPOPUP_HELP:
_local2 = new mcPopupHelp();
oPopupHelp = new PopupHelp(_local2);
break;
case sPOPUP_QUIT:
_local2 = new mcPopupQuit();
oPopupQuit = new PopupQuit(_local2);
break;
case sPOPUP_BLOCKER:
_local2 = new mcPopupBlocker();
oPopupBlocker = new PopupBlocker(_local2);
break;
};
_local3.addChild(_local2);
}
public function removePopup(_arg1:Popup):void{
if (_arg1 != null){
switch (_arg1){
case oPopupMenu:
trace("Remove popup: Menu");
if (oPopupMenu != null){
oPopupMenu.destroy(null);
};
oPopupMenu = null;
break;
case oPopupHelp:
trace("Remove popup: Help");
if (oPopupHelp != null){
oPopupHelp.destroy(null);
};
oPopupHelp = null;
break;
case oPopupQuit:
trace("Remove popup: Quit");
if (oPopupQuit != null){
oPopupQuit.destroy(null);
};
oPopupQuit = null;
break;
case oPopupBlocker:
if (oPopupBlocker != null){
oPopupBlocker.destroy(null);
};
oPopupBlocker = null;
break;
};
};
}
private function update(_arg1:Event):void{
dispatchEvent(new MainEvent(MainEvent.EVENT_UPDATE, false, false));
}
public function resumeGame():void{
dispatchEvent(new MainEvent(MainEvent.EVENT_RESUME, false, false));
}
public function transitTo(_arg1:String):void{
var _local2:DisplayObjectContainer;
var _local3:MovieClip;
if (oTransition == null){
_local2 = oDepthManager.getDepthLayer(sDEPTH_TRANSITION);
_local3 = new mcTransition();
_local2.addChild(_local3);
sStateTransit = _arg1;
oTransition = new Transition(_local3);
oTransition.addEventListener(Transition.sEVENT_FULL_SCREEN, onTransitionFull, false, 0, true);
oTransition.addEventListener(Transition.sEVENT_COMPLETE, onTransitionComplete, false, 0, true);
};
}
private function unloadState():void{
switch (state){
case sSTATE_LOADED:
break;
case sSTATE_TITLE:
break;
case sSTATE_GAME:
oGame.destroy(null);
oGame = null;
break;
case sSTATE_LOSE:
break;
case sSTATE_HS_TITLE:
break;
case sSTATE_HS:
break;
};
removePopup(oPopupMenu);
removePopup(oPopupHelp);
removePopup(oPopupQuit);
removePopup(oPopupBlocker);
trace(("UNLOAD MAIN STATE: " + state));
}
public function get popupBlocker():PopupBlocker{
return (oPopupBlocker);
}
public function get nickServices():NickServices{
return (oNickServices);
}
private function onTransitionComplete(_arg1:Event):void{
oTransition.destroy(null);
oTransition.removeEventListener(Transition.sEVENT_COMPLETE, onTransitionComplete, false);
oTransition = null;
}
public static function get instance():Main{
return (oInstance);
}
}
}//package
Section 135
//mcAlgae (mcAlgae)
package {
import flash.display.*;
public dynamic class mcAlgae extends MovieClip {
public var mcState:MovieClip;
}
}//package
Section 136
//mcArrow (mcArrow)
package {
import flash.display.*;
public dynamic class mcArrow extends MovieClip {
public var mcState:MovieClip;
}
}//package
Section 137
//mcBackground (mcBackground)
package {
import flash.display.*;
public dynamic class mcBackground extends MovieClip {
}
}//package
Section 138
//mcCharacter01 (mcCharacter01)
package {
import flash.display.*;
public dynamic class mcCharacter01 extends MovieClip {
public var mcState:MovieClip;
}
}//package
Section 139
//mcCharacter02 (mcCharacter02)
package {
import flash.display.*;
public dynamic class mcCharacter02 extends MovieClip {
public var mcState:MovieClip;
}
}//package
Section 140
//mcCharacter03 (mcCharacter03)
package {
import flash.display.*;
public dynamic class mcCharacter03 extends MovieClip {
public var mcState:MovieClip;
}
}//package
Section 141
//mcCheese (mcCheese)
package {
import flash.display.*;
public dynamic class mcCheese extends MovieClip {
public var mcState:MovieClip;
}
}//package
Section 142
//mcChicken (mcChicken)
package {
import flash.display.*;
public dynamic class mcChicken extends MovieClip {
public var mcState:MovieClip;
}
}//package
Section 143
//mcCucumber (mcCucumber)
package {
import flash.display.*;
public dynamic class mcCucumber extends MovieClip {
public var mcState:MovieClip;
}
}//package
Section 144
//mcCursor (mcCursor)
package {
import flash.display.*;
public dynamic class mcCursor extends MovieClip {
public var mcState:MovieClip;
}
}//package
Section 145
//mcCutBoard (mcCutBoard)
package {
import flash.display.*;
public dynamic class mcCutBoard extends MovieClip {
}
}//package
Section 146
//mcDaikon (mcDaikon)
package {
import flash.display.*;
public dynamic class mcDaikon extends MovieClip {
public var mcState:MovieClip;
}
}//package
Section 147
//mcDotIndicator (mcDotIndicator)
package {
import flash.display.*;
public dynamic class mcDotIndicator extends MovieClip {
public var mcState:MovieClip;
}
}//package
Section 148
//mcEgg (mcEgg)
package {
import flash.display.*;
public dynamic class mcEgg extends MovieClip {
public var mcState:MovieClip;
}
}//package
Section 149
//mcFeedback (mcFeedback)
package {
import flash.display.*;
public dynamic class mcFeedback extends MovieClip {
public var mcState:MovieClip;
}
}//package
Section 150
//mcHidden (mcHidden)
package {
import flash.display.*;
public dynamic class mcHidden extends MovieClip {
}
}//package
Section 151
//mcHUD (mcHUD)
package {
import flash.display.*;
public dynamic class mcHUD extends MovieClip {
public var mcTimeAdd:MovieClip;
public var mcGoPopup:MovieClip;
public var mcTime:MovieClip;
public var mcLife:MovieClip;
public var mcScore:MovieClip;
public var btnMenu:SimpleButton;
public var mcTimeRemove:MovieClip;
}
}//package
Section 152
//mcInstruct (mcInstruct)
package {
import flash.display.*;
public dynamic class mcInstruct extends MovieClip {
public var mcState:MovieClip;
}
}//package
Section 153
//mcKnife (mcKnife)
package {
import flash.display.*;
public dynamic class mcKnife extends MovieClip {
public var mcState:MovieClip;
}
}//package
Section 154
//mcKnifeShadow (mcKnifeShadow)
package {
import flash.display.*;
public dynamic class mcKnifeShadow extends MovieClip {
public var mcState:MovieClip;
}
}//package
Section 155
//mcMayonnaise (mcMayonnaise)
package {
import flash.display.*;
public dynamic class mcMayonnaise extends MovieClip {
public var mcState:MovieClip;
}
}//package
Section 156
//mcOnion (mcOnion)
package {
import flash.display.*;
public dynamic class mcOnion extends MovieClip {
public var mcState:MovieClip;
}
}//package
Section 157
//mcPlate (mcPlate)
package {
import flash.display.*;
public dynamic class mcPlate extends MovieClip {
public var mcState:MovieClip;
}
}//package
Section 158
//mcPlayer (mcPlayer)
package {
import flash.display.*;
public dynamic class mcPlayer extends MovieClip {
public var mcState:MovieClip;
}
}//package
Section 159
//mcPopupBlocker (mcPopupBlocker)
package {
import flash.display.*;
public dynamic class mcPopupBlocker extends MovieClip {
public var mcBlocker:SimpleButton;
}
}//package
Section 160
//mcPopupHelp (mcPopupHelp)
package {
import flash.display.*;
public dynamic class mcPopupHelp extends MovieClip {
public var mcBlocker:SimpleButton;
public var mcState:MovieClip;
}
}//package
Section 161
//mcPopupMenu (mcPopupMenu)
package {
import flash.display.*;
public dynamic class mcPopupMenu extends MovieClip {
public var mcBlocker:SimpleButton;
public var mcState:MovieClip;
}
}//package
Section 162
//mcPopupQuit (mcPopupQuit)
package {
import flash.display.*;
public dynamic class mcPopupQuit extends MovieClip {
public var mcBlocker:SimpleButton;
public var mcState:MovieClip;
}
}//package
Section 163
//mcPourIndicator (mcPourIndicator)
package {
import flash.display.*;
public dynamic class mcPourIndicator extends MovieClip {
public var mcDot04:MovieClip;
public var mcDot07:MovieClip;
public var mcDot01:MovieClip;
public var mcDot02:MovieClip;
public var mcDot03:MovieClip;
public var mcDot05:MovieClip;
public var mcDot06:MovieClip;
public var mcState:MovieClip;
}
}//package
Section 164
//mcPowerup (mcPowerup)
package {
import flash.display.*;
public dynamic class mcPowerup extends MovieClip {
public var mcState:MovieClip;
}
}//package
Section 165
//mcRecipes (mcRecipes)
package {
import flash.display.*;
public dynamic class mcRecipes extends MovieClip {
public var btnPrevious1:SimpleButton;
public var btnPrevious2:SimpleButton;
public var mcBG:MovieClip;
public var btnNext:SimpleButton;
public var btnSkip:SimpleButton;
public var btnReturn:SimpleButton;
public var btnPrint:SimpleButton;
public var mcState:MovieClip;
}
}//package
Section 166
//mcRequest (mcRequest)
package {
import flash.display.*;
public dynamic class mcRequest extends MovieClip {
public var mcState:MovieClip;
}
}//package
Section 167
//mcRice (mcRice)
package {
import flash.display.*;
public dynamic class mcRice extends MovieClip {
public var mcState:MovieClip;
}
}//package
Section 168
//mcRollIndicator (mcRollIndicator)
package {
import flash.display.*;
public dynamic class mcRollIndicator extends MovieClip {
public var mcDot01:MovieClip;
public var mcDot02:MovieClip;
public var mcState:MovieClip;
}
}//package
Section 169
//mcSalmon (mcSalmon)
package {
import flash.display.*;
public dynamic class mcSalmon extends MovieClip {
public var mcState:MovieClip;
}
}//package
Section 170
//mcScreenGame (mcScreenGame)
package {
import flash.display.*;
public dynamic class mcScreenGame extends MovieClip {
}
}//package
Section 171
//mcScreenHS (mcScreenHS)
package {
import flash.display.*;
import flash.text.*;
public dynamic class mcScreenHS extends MovieClip {
public var txtScore:TextField;
public var btnUp:SimpleButton;
public var btnDown:SimpleButton;
public var btnPlayAgain:SimpleButton;
public var txtStatus:TextField;
public var btnSubmitHS:SimpleButton;
public var txtScores:TextField;
public var txtUsernames:TextField;
public var txtPositions:TextField;
}
}//package
Section 172
//mcScreenHSTitle (mcScreenHSTitle)
package {
import flash.display.*;
import flash.text.*;
public dynamic class mcScreenHSTitle extends MovieClip {
public var btnUp:SimpleButton;
public var btnDown:SimpleButton;
public var btnBack:SimpleButton;
public var txtStatus:TextField;
public var txtScores:TextField;
public var txtUsernames:TextField;
public var txtPositions:TextField;
}
}//package
Section 173
//mcScreenLoaded (mcScreenLoaded)
package {
import flash.display.*;
import flash.text.*;
public dynamic class mcScreenLoaded extends MovieClip {
public var txtPercent:TextField;
}
}//package
Section 174
//mcScreenLose (mcScreenLose)
package {
import flash.display.*;
import flash.text.*;
public dynamic class mcScreenLose extends MovieClip {
public var txtScore:TextField;
public var btnViewHS:SimpleButton;
public var btnPlayAgain:SimpleButton;
public var btnSubmitHS:SimpleButton;
}
}//package
Section 175
//mcScreenRecipes (mcScreenRecipes)
package {
import flash.display.*;
public dynamic class mcScreenRecipes extends MovieClip {
}
}//package
Section 176
//mcScreenTitle (mcScreenTitle)
package {
import flash.display.*;
public dynamic class mcScreenTitle extends MovieClip {
public var btnViewHS:SimpleButton;
public var btnRecipes:SimpleButton;
public var btnPlay:SimpleButton;
public var btnHelp:SimpleButton;
}
}//package
Section 177
//mcShrimp (mcShrimp)
package {
import flash.display.*;
public dynamic class mcShrimp extends MovieClip {
public var mcState:MovieClip;
}
}//package
Section 178
//mcSkipButton (mcSkipButton)
package {
import flash.display.*;
public dynamic class mcSkipButton extends MovieClip {
public var mcState:MovieClip;
}
}//package
Section 179
//mcSoya (mcSoya)
package {
import flash.display.*;
public dynamic class mcSoya extends MovieClip {
}
}//package
Section 180
//mcSpecial (mcSpecial)
package {
import flash.display.*;
public dynamic class mcSpecial extends MovieClip {
public var mcState:MovieClip;
}
}//package
Section 181
//mcSpreadIndicator (mcSpreadIndicator)
package {
import flash.display.*;
public dynamic class mcSpreadIndicator extends MovieClip {
public var mcDot04:MovieClip;
public var mcDot01:MovieClip;
public var mcDot02:MovieClip;
public var mcDot03:MovieClip;
public var mcDot05:MovieClip;
public var mcState:MovieClip;
}
}//package
Section 182
//mcSushi (mcSushi)
package {
import flash.display.*;
public dynamic class mcSushi extends MovieClip {
public var mcState:MovieClip;
}
}//package
Section 183
//mcSushiMat (mcSushiMat)
package {
import flash.display.*;
public dynamic class mcSushiMat extends MovieClip {
public var mcState:MovieClip;
}
}//package
Section 184
//mcTable (mcTable)
package {
import flash.display.*;
public dynamic class mcTable extends MovieClip {
}
}//package
Section 185
//mcTeriyaki (mcTeriyaki)
package {
import flash.display.*;
public dynamic class mcTeriyaki extends MovieClip {
public var mcState:MovieClip;
}
}//package
Section 186
//mcTransition (mcTransition)
package {
import flash.display.*;
public dynamic class mcTransition extends MovieClip {
public var mcBlocker:SimpleButton;
public var mcState:MovieClip;
}
}//package
Section 187
//mcTuna (mcTuna)
package {
import flash.display.*;
public dynamic class mcTuna extends MovieClip {
public var mcState:MovieClip;
}
}//package
Section 188
//mcTutorial (mcTutorial)
package {
import flash.display.*;
public dynamic class mcTutorial extends MovieClip {
public var mcState:MovieClip;
}
}//package
Section 189
//NickServices (NickServices)
package {
import flash.events.*;
import flash.display.*;
import com.nickonline.services.business.*;
import flash.system.*;
import flash.net.*;
public class NickServices extends EventDispatcher {
private var uNickPoints:uint;
private var bLogged:Boolean;
private var mcLoginUIContainer:DisplayObjectContainer;
private var oAuthenticationResponder:ProxyResponder;
private var oNickPointsResponder:ProxyResponder;
private var bAutoShowLoginUI:Boolean;
private var sNickName:String;
private var aHighScores:Array;
private var mcLoginUI:Sprite;
private var sSubmitScoreGameID:String;
private var mcLoginUIBackground:Sprite;
private var bReady:Boolean;
private var bSubmitScoreUserValidation:Boolean;
private var sBaseURL:String;
private var uSubmitScoreScore:uint;
private var oServiceLocator:ServiceLocator;
private var oHighScoresResponder:ProxyResponder;
public static const sLOCAL_BASE_URL:String = "www.nick-q.mtvi.com";
public static const sEVENT_USER_LOGGED_OUT:String = "userLoggedOut";
public static const sEVENT_ERROR:String = "error";
public static const nLOGIN_UI_BACKGROUND_ALPHA:Number = 0.8;
public static const nLOGIN_UI_BACKGROUND_COLOR:Number = 0;
public static const sEVENT_LOGIN_UI_RECEIVED:String = "loginReceived";
public static const sSERVICE_MANAGER_CONFIG_URL:String = "/common/flash/services/data/services.xml";
public static const sEVENT_SCORES_RECEIVED:String = "scoresReceived";
public static const sEVENT_NICK_POINTS_AWARDING_COMPLETED:String = "nickPointsAwardingCompleted";
public static const sSERVICE_MANAGER_URL:String = "/common/flash/services/ServiceManager.swf";
public static const sEVENT_USER_STATUS_RECEIVED:String = "userStatusReceived";
public static const sEVENT_SERVICES_READY:String = "servicesReady";
public static const sEVENT_SCORE_SUBMISSION_COMPLETED:String = "scoreSubmissionCompleted";
public function NickServices(){
init();
}
public function requestUserStatus():void{
if (bReady){
oServiceLocator.execute("Authentication", "checkLogin", null, oAuthenticationResponder);
};
}
public function requestScores(_arg1:String):void{
if (bReady){
oServiceLocator.execute("HighScores", "doLoadHighScores", new Array(_arg1), oHighScoresResponder);
};
}
private function loginFadeIn():void{
mcLoginUIBackground = new Sprite();
mcLoginUIBackground.graphics.beginFill(nLOGIN_UI_BACKGROUND_COLOR);
mcLoginUIBackground.graphics.drawRect(0, 0, mcLoginUIContainer.stage.stageWidth, mcLoginUIContainer.stage.stageHeight);
mcLoginUIBackground.alpha = 0;
mcLoginUIBackground.addEventListener(Event.ENTER_FRAME, onFadeInEnterFrame);
mcLoginUIContainer.addChild(mcLoginUIBackground);
}
private function init():void{
if (new LocalConnection().domain == "localhost"){
sBaseURL = ("http://" + sLOCAL_BASE_URL);
Security.allowDomain(sLOCAL_BASE_URL);
} else {
sBaseURL = "";
};
oServiceLocator = new ServiceLocator(sSERVICE_MANAGER_URL, sSERVICE_MANAGER_CONFIG_URL);
oServiceLocator.defaultURI = sBaseURL;
oServiceLocator.addEventListener("EVENT_SERVICES_LOADED", onServiceReady);
oServiceLocator.addEventListener("EVENT_SERVICE_INVALID", onServiceInvalid);
oServiceLocator.addEventListener("EVENT_SERVICES_NOT_FOUND", onServiceNotFound);
try {
oServiceLocator.load();
} catch(_e:SecurityError) {
};
}
private function loginFadeOut():void{
mcLoginUIBackground.addEventListener(Event.ENTER_FRAME, onFadeOutEnterFrame);
}
private function onFadeInEnterFrame(_arg1:Event):void{
mcLoginUIBackground.alpha = (mcLoginUIBackground.alpha + 0.1);
if (mcLoginUIBackground.alpha >= nLOGIN_UI_BACKGROUND_ALPHA){
mcLoginUIBackground.removeEventListener(Event.ENTER_FRAME, onFadeInEnterFrame);
};
}
public function get nickName():String{
return (sNickName);
}
private function saveUserInfos(_arg1:Object):void{
sNickName = _arg1.nickName;
uNickPoints = _arg1.points;
}
private function onAuthenticationError(_arg1:Event):void{
dispatchError(("Authentication service error: " + _arg1.type));
}
private function onNickPointsError(_arg1:Event):void{
dispatchError(("Nick Points service error: " + _arg1.type));
}
public function get nickPoints():uint{
return (uNickPoints);
}
public function requestLoginUI(_arg1:Boolean=false, _arg2:DisplayObjectContainer=null):void{
if (bReady){
if (_arg1){
if (_arg2 == null){
trace("You must pass a valid DisplayObjectContainer container to use the auto-show feature");
} else {
bAutoShowLoginUI = true;
mcLoginUIContainer = _arg2;
loginFadeIn();
};
};
oServiceLocator.execute("Authentication", "getLogin", null, oAuthenticationResponder);
};
}
private function onFadeOutEnterFrame(_arg1:Event):void{
mcLoginUIBackground.alpha = (mcLoginUIBackground.alpha - 0.1);
if (mcLoginUIBackground.alpha <= 0){
mcLoginUIBackground.removeEventListener(Event.ENTER_FRAME, onFadeOutEnterFrame);
mcLoginUIContainer.removeChild(mcLoginUIBackground);
mcLoginUIBackground = null;
dispatchEvent(new Event(sEVENT_USER_STATUS_RECEIVED));
};
}
public function get ready():Boolean{
return (bReady);
}
private function onAuthenticationResult(_arg1:Object):void{
switch (_arg1.type){
case "LOGIN_CHECK_LOGGED_IN":
bLogged = true;
saveUserInfos(_arg1.data);
if (bSubmitScoreUserValidation){
bSubmitScoreUserValidation = false;
oServiceLocator.execute("HighScores", "doSubmitHighScore", new Array(sSubmitScoreGameID, uSubmitScoreScore, sNickName), oHighScoresResponder);
} else {
dispatchEvent(new Event(sEVENT_USER_STATUS_RECEIVED));
};
break;
case "LOGIN_CHECK_LOGGED_OUT":
bLogged = false;
saveUserInfos(new Object());
if (bSubmitScoreUserValidation){
bSubmitScoreUserValidation = false;
dispatchEvent(new Event(sEVENT_USER_LOGGED_OUT));
} else {
dispatchEvent(new Event(sEVENT_USER_STATUS_RECEIVED));
};
break;
case "LOGIN_UI_LOADED":
mcLoginUI = _arg1.data;
if (bAutoShowLoginUI){
mcLoginUI.x = ((mcLoginUIContainer.stage.stageWidth - mcLoginUI.width) / 2);
mcLoginUI.y = ((mcLoginUIContainer.stage.stageHeight - mcLoginUI.height) / 2);
mcLoginUIContainer.addChild(mcLoginUI);
};
dispatchEvent(new Event(sEVENT_LOGIN_UI_RECEIVED));
break;
case "LOGIN_COMPLETE":
bLogged = true;
saveUserInfos(_arg1.data);
if (bAutoShowLoginUI){
bAutoShowLoginUI = false;
mcLoginUIContainer.removeChild(mcLoginUI);
mcLoginUI = null;
loginFadeOut();
} else {
dispatchEvent(new Event(sEVENT_USER_STATUS_RECEIVED));
};
break;
};
}
private function dispatchError(_arg1:String):void{
dispatchEvent(new ErrorEvent(sEVENT_ERROR, false, false, _arg1));
}
public function get logged():Boolean{
return (bLogged);
}
public function get loginUI():Sprite{
return (mcLoginUI);
}
private function onHighScoresError(_arg1:Event):void{
dispatchError(("HighScores service error: " + _arg1.type));
}
private function onServiceInvalid(_arg1:Event):void{
dispatchError("Services invalid.");
}
private function onHighScoresResult(_arg1:Object):void{
var _local2:Object;
switch (_arg1.type){
case "SUBMIT_SCORES_SUCCESS":
dispatchEvent(new Event(sEVENT_SCORE_SUBMISSION_COMPLETED));
break;
case "LOAD_SCORES_SUCCESS":
aHighScores = [];
for each (_local2 in _arg1.data.scores) {
aHighScores.push({nRank:_local2.rank, sNickName:_local2.name, nScore:_local2.score});
};
dispatchEvent(new Event(sEVENT_SCORES_RECEIVED));
break;
};
}
private function onNickPointsResult(_arg1:Object):void{
dispatchEvent(new Event(sEVENT_NICK_POINTS_AWARDING_COMPLETED));
}
private function onServiceNotFound(_arg1:Event):void{
dispatchError("Services not found.");
}
public function submitScore(_arg1:String, _arg2:uint):void{
if (bReady){
requestUserStatus();
bSubmitScoreUserValidation = true;
sSubmitScoreGameID = _arg1;
uSubmitScoreScore = _arg2;
};
}
public function awardNickPoints(_arg1:String, _arg2:String):void{
if (bReady){
oServiceLocator.execute("NickPointsCampaign", "awardNickPoints", new Array(_arg1, _arg2), oHighScoresResponder);
};
}
public function get highScores():Array{
return (aHighScores);
}
public function destroy():void{
mcLoginUI = null;
mcLoginUIContainer = null;
mcLoginUIBackground = null;
}
private function onServiceReady(_arg1:Event):void{
bReady = true;
oAuthenticationResponder = new ProxyResponder(onAuthenticationResult, onAuthenticationError);
oHighScoresResponder = new ProxyResponder(onHighScoresResult, onHighScoresError);
oNickPointsResponder = new ProxyResponder(onNickPointsResult, onNickPointsError);
dispatchEvent(new Event(sEVENT_SERVICES_READY));
}
}
}//package
Section 190
//sndBubble_In (sndBubble_In)
package {
import flash.media.*;
public dynamic class sndBubble_In extends Sound {
}
}//package
Section 191
//sndBubble_Out (sndBubble_Out)
package {
import flash.media.*;
public dynamic class sndBubble_Out extends Sound {
}
}//package
Section 192
//sndButton_Click01 (sndButton_Click01)
package {
import flash.media.*;
public dynamic class sndButton_Click01 extends Sound {
}
}//package
Section 193
//sndButton_Click02 (sndButton_Click02)
package {
import flash.media.*;
public dynamic class sndButton_Click02 extends Sound {
}
}//package
Section 194
//sndButton_Rollover01 (sndButton_Rollover01)
package {
import flash.media.*;
public dynamic class sndButton_Rollover01 extends Sound {
}
}//package
Section 195
//sndButton_Rollover02 (sndButton_Rollover02)
package {
import flash.media.*;
public dynamic class sndButton_Rollover02 extends Sound {
}
}//package
Section 196
//sndDot_Click (sndDot_Click)
package {
import flash.media.*;
public dynamic class sndDot_Click extends Sound {
}
}//package
Section 197
//sndDot_Light (sndDot_Light)
package {
import flash.media.*;
public dynamic class sndDot_Light extends Sound {
}
}//package
Section 198
//sndEnd_Game (sndEnd_Game)
package {
import flash.media.*;
public dynamic class sndEnd_Game extends Sound {
}
}//package
Section 199
//sndHappy (sndHappy)
package {
import flash.media.*;
public dynamic class sndHappy extends Sound {
}
}//package
Section 200
//sndItem_In01 (sndItem_In01)
package {
import flash.media.*;
public dynamic class sndItem_In01 extends Sound {
}
}//package
Section 201
//sndItem_In02 (sndItem_In02)
package {
import flash.media.*;
public dynamic class sndItem_In02 extends Sound {
}
}//package
Section 202
//sndItem_In03 (sndItem_In03)
package {
import flash.media.*;
public dynamic class sndItem_In03 extends Sound {
}
}//package
Section 203
//sndItem_In04 (sndItem_In04)
package {
import flash.media.*;
public dynamic class sndItem_In04 extends Sound {
}
}//package
Section 204
//sndItem_In05 (sndItem_In05)
package {
import flash.media.*;
public dynamic class sndItem_In05 extends Sound {
}
}//package
Section 205
//sndItem_Out01 (sndItem_Out01)
package {
import flash.media.*;
public dynamic class sndItem_Out01 extends Sound {
}
}//package
Section 206
//sndItem_Out02 (sndItem_Out02)
package {
import flash.media.*;
public dynamic class sndItem_Out02 extends Sound {
}
}//package
Section 207
//sndKnife_Cut_Meat (sndKnife_Cut_Meat)
package {
import flash.media.*;
public dynamic class sndKnife_Cut_Meat extends Sound {
}
}//package
Section 208
//sndKnife_Cut_Veggies (sndKnife_Cut_Veggies)
package {
import flash.media.*;
public dynamic class sndKnife_Cut_Veggies extends Sound {
}
}//package
Section 209
//sndKnife_Take (sndKnife_Take)
package {
import flash.media.*;
public dynamic class sndKnife_Take extends Sound {
}
}//package
Section 210
//sndMinigame_End (sndMinigame_End)
package {
import flash.media.*;
public dynamic class sndMinigame_End extends Sound {
}
}//package
Section 211
//sndMinigame_Start (sndMinigame_Start)
package {
import flash.media.*;
public dynamic class sndMinigame_Start extends Sound {
}
}//package
Section 212
//sndMusic_In_Game (sndMusic_In_Game)
package {
import flash.media.*;
public dynamic class sndMusic_In_Game extends Sound {
}
}//package
Section 213
//sndMusic_Packaging (sndMusic_Packaging)
package {
import flash.media.*;
public dynamic class sndMusic_Packaging extends Sound {
}
}//package
Section 214
//sndPositive (sndPositive)
package {
import flash.media.*;
public dynamic class sndPositive extends Sound {
}
}//package
Section 215
//sndPour_Cheese (sndPour_Cheese)
package {
import flash.media.*;
public dynamic class sndPour_Cheese extends Sound {
}
}//package
Section 216
//sndPour_Mayonnaise (sndPour_Mayonnaise)
package {
import flash.media.*;
public dynamic class sndPour_Mayonnaise extends Sound {
}
}//package
Section 217
//sndPour_Teriyaki (sndPour_Teriyaki)
package {
import flash.media.*;
public dynamic class sndPour_Teriyaki extends Sound {
}
}//package
Section 218
//sndPowerup_Grabbed (sndPowerup_Grabbed)
package {
import flash.media.*;
public dynamic class sndPowerup_Grabbed extends Sound {
}
}//package
Section 219
//sndPowerup_In (sndPowerup_In)
package {
import flash.media.*;
public dynamic class sndPowerup_In extends Sound {
}
}//package
Section 220
//sndPowerup_Out (sndPowerup_Out)
package {
import flash.media.*;
public dynamic class sndPowerup_Out extends Sound {
}
}//package
Section 221
//sndRoll_Sushi01 (sndRoll_Sushi01)
package {
import flash.media.*;
public dynamic class sndRoll_Sushi01 extends Sound {
}
}//package
Section 222
//sndRoll_Sushi02 (sndRoll_Sushi02)
package {
import flash.media.*;
public dynamic class sndRoll_Sushi02 extends Sound {
}
}//package
Section 223
//sndRoll_Sushi03 (sndRoll_Sushi03)
package {
import flash.media.*;
public dynamic class sndRoll_Sushi03 extends Sound {
}
}//package
Section 224
//sndSpecial (sndSpecial)
package {
import flash.media.*;
public dynamic class sndSpecial extends Sound {
}
}//package
Section 225
//sndTransition (sndTransition)
package {
import flash.media.*;
public dynamic class sndTransition extends Sound {
}
}//package
Section 226
//sndUnhappy (sndUnhappy)
package {
import flash.media.*;
public dynamic class sndUnhappy extends Sound {
}
}//package
Section 227
//SoundList (SoundList)
package {
public class SoundList {
public static const sSOUND_ITEM_OUT:String = "sndItem_Out01,sndItem_Out2";
public static const sSOUND_KNIFE_CUT_MEAT:String = "sndKnife_Cut_Meat";
public static const sSOUND_KNIFE_CUT_VEGGIES:String = "sndKnife_Cut_Veggies";
public static const sSOUND_BUBBLE_IN:String = "sndBubble_In";
public static const sSOUND_MINIGAME_START:String = "sndMinigame_Start";
public static const sSOUND_HAPPY:String = "sndHappy";
public static const sSOUND_TRANSITION:String = "sndTransition";
public static const sSOUND_POUR_TERIYAKI:String = "sndPour_Teriyaki";
public static const sSOUND_DOT_CLICK:String = "sndDot_Click";
public static const sSOUND_POWERUP_GRABBED:String = "sndPowerup_Grabbed";
public static const sSOUND_SPECIAL:String = "sndSpecial";
public static const sSOUND_POUR_CHEESE:String = "sndPour_Cheese";
public static const sSOUND_DOT_LIGHT:String = "sndDot_Light";
public static const sSOUND_BUBBLE_OUT:String = "sndBubble_Out";
public static const sSOUND_KNIFE_TAKE:String = "sndKnife_Take";
public static const sSOUND_CLICK:String = "sndButton_Click01,sndButton_Click02";
public static const sSOUND_POWERUP_IN:String = "sndPowerup_In";
public static const sSOUND_MINIGAME_END:String = "sndMinigame_End";
public static const sSOUND_POUR_MAYONNAISE:String = "sndPour_Mayonnaise";
public static const sSOUND_POWERUP_OUT:String = "sndPowerup_Out";
public static const sSOUND_ROLLOVER:String = "sndButton_Rollover01,sndButton_Rollover02";
public static const sMUSIC_PACKAGING:String = "sndMusic_Packaging";
public static const sSOUND_UNHAPPY:String = "sndUnhappy";
public static const sSOUND_ITEM_IN:String = "sndItem_In01,sndItem_In02,sndItem_In03,sndItem_In04,sndItem_In05";
public static const sSOUND_ROLL_SUSHI:String = "sndRoll_Sushi01,sndRoll_Sushi02,sndRoll_Sushi03";
public static const sSOUND_END_GAME:String = "sndEnd_Game";
public static const sSOUND_POSITIVE:String = "sndPositive";
public static const sMUSIC_IN_GAME:String = "sndMusic_In_Game";
}
}//package