home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mobiclic 150
/
MOBICLIC150.ISO
/
pc
/
DATA
/
DSS150
/
DSS150_04
/
DSS150_04.swf
/
scripts
/
dss150_04
/
CapsuleAlgo.as
< prev
next >
Wrap
Text File
|
2012-12-19
|
5KB
|
177 lines
package dss150_04
{
import com.milanpresse.engineaddons.facades.GameEngine;
import com.milanpresse.engineaddons.gamesprotos.Actor;
import com.milanpresse.engineaddons.gamesprotos.actors.actorClip.IActorClip;
import com.milanpresse.tools.debug.TestBox;
import dss150.Memo;
public class CapsuleAlgo
{
protected var game:GameEngine;
protected var mainTimeline:IActorClip;
public var moduleConfig:ModuleConfig;
protected var testBox:TestBox;
protected var memo:Memo;
public function CapsuleAlgo(game:GameEngine)
{
super();
this.game = game;
this.memo = game.memo as Memo;
this.memo.savePoint.moduleNum = game.config.moduleNum;
this.memo.save();
if(game.config.callerParameters.fromCodeRub == null)
{
this.memo.clear();
}
this.init();
}
protected function init() : void
{
this.game.framerate = 24;
this.game.levelCZ = this.game.config.layers.content;
this.game.moduleConfig = new ModuleConfig(this.game.config.XmlConfig.Module.Config.Params);
trace(this.game.moduleConfig.toXMLString());
this.testBox = new TestBox(this.game.engine);
this.testBox.buttons = [{
"name":"BTN_ATTENTE",
"label":"ATTENTE"
},{
"name":"BTN_SUCCES",
"label":"SUCCES"
},{
"name":"BTN_FIN",
"label":"FIN"
}];
this.testBox.onClick = function(action:String):void
{
trace("TestBoxClick",action);
switch(action)
{
case "BTN_PAUSE":
game.sleep();
break;
case "BTN_WAKE":
game.wake();
break;
case "BTN_ATTENTE":
game.commentStop();
mainTimeline.gotoAndPlay("ATTENTE",{
"labelLast":"FIN",
"labelLastCallback":gameEnd
});
break;
case "BTN_SUCCES":
if(game.getActor("jeu") != null)
{
game.getActor("jeu").destroy();
}
memo.module.succes = true;
memo.save();
mainTimeline.gotoAndPlay(mainTimeline["LABEL_SUCCES"],{
"labelLast":"FIN",
"labelLastCallback":gameEnd
});
break;
case "BTN_FIN":
gameEnd();
}
};
this.testBox.visible = false;
this.mainTimeline = this.game.addActor({
"code":"A_" + this.game.config.moduleName,
"parent":this.game.config.layers.content
});
this.mainTimeline["LABEL_SUCCES"] = "WAIT_zanimJEU";
this.mainTimeline.onLabelEnter = this.onLabelEnter;
this.mainTimeline.onLabelExit = this.onLabelExit;
}
public function gameEnd() : void
{
this.game.commentStop();
this.memo.module.vu = true;
this.memo.savePoint.moduleNum = 0;
this.memo.save();
this.game.changeModule({"numMod":0});
}
public function start() : void
{
this.game.playMusic({"code":"MU"});
if(this.memo.module.succes)
{
this.mainTimeline.gotoAndPlay(this.mainTimeline["LABEL_SUCCES"],{
"labelLast":"FIN",
"labelLastCallback":this.gameEnd
});
}
else
{
this.mainTimeline.gotoAndPlay(this.mainTimeline.currentLabels[0].name,{
"labelLast":"FIN",
"labelLastCallback":this.gameEnd
});
}
}
public function onLabelEnter(result:Object = null) : void
{
var jeuac:Actor = null;
var jeu:ATTENTE = null;
trace("onLabelEnter",result.label);
if(result.label.search(/^ATTENTE/) != -1)
{
jeuac = this.game.addActor(new Actor(this.game));
jeuac.name = "jeu";
jeu = new ATTENTE(this.game,this.mainTimeline);
jeu.onEvent = function(event:Object = null):void
{
game.noisePlay({"code":"B_SUCCES"});
mainTimeline.gotoAndPlay("_12_JEU_S",{
"labelLast":"FIN",
"labelLastCallback":gameEnd
});
};
jeuac.sleep = function():void
{
jeu.sleep();
};
jeuac.wake = function():void
{
jeu.wake();
};
jeuac.destroy = function():void
{
jeu.destroy();
};
}
}
public function onLabelExit(result:Object = null) : void
{
trace("onLabelExit",result.label);
}
public function sleep() : void
{
}
public function wake() : void
{
}
public function destroy() : void
{
}
}
}