Section 1
//Debug (com.midasplayer.debug.Debug)
package com.midasplayer.debug {
public class Debug {
private static var s_assertHandler:IAssertHandler = null;
public static function setAssertHandler(_arg1:IAssertHandler):void{
s_assertHandler = _arg1;
}
public static function assert(_arg1:Boolean, _arg2:String):void{
var condition = _arg1;
var message = _arg2;
if (condition){
return;
};
if (s_assertHandler != null){
s_assertHandler.assert(message);
return;
};
try {
throw (new Error("StackTrace"));
} catch(e:Error) {
trace(((("Assertion failed: " + message) + "\n") + e.getStackTrace()));
};
}
}
}//package com.midasplayer.debug
Section 2
//IAssertHandler (com.midasplayer.debug.IAssertHandler)
package com.midasplayer.debug {
public interface IAssertHandler {
function assert(_arg1:String):void;
}
}//package com.midasplayer.debug
Section 3
//DebugGameComm (com.midasplayer.game.comm.DebugGameComm)
package com.midasplayer.game.comm {
import com.midasplayer.game.framework.*;
import com.midasplayer.messaging.*;
import flash.utils.*;
import com.midasplayer.util.*;
public class DebugGameComm implements IGameComm {
private var traceExternalCalls:Boolean;
private var currentState:int;// = 0
private var showDelayUI:Function;// = null
private var requestHandlers:Dictionary;
private var ignoreResponses:Boolean;// = false
private var endedTime:Number;
private var bufferedResponses:Array;
private var hideDelayUI:Function;// = null
private var requestHandler:IRequestHandler;
private var gameData:String;
private var showingDelayUI:Boolean;// = false
private var nextResponse:int;// = 0
private var handlerModelType:Class;
private var playDataEntries:Array;
private var requestTimeouts:Array;
private var requestCounter:int;// = 0
private var handlerModel:Object;
private static const STATE_NOT_STARTED:uint = 0;
private static const STATE_ENDED:uint = 2;
private static const TIMEOUT_SECOND:int = 1500;
private static const STATE_STARTED:uint = 1;
private static const TIMEOUT_FIRST:int = 1500;
private static const STATE_QUIT:uint = 3;
private static const TIMEOUT_FINAL:int = 19000;
public function DebugGameComm(_arg1:String, _arg2:Class=null, _arg3:IRequestHandler=null, _arg4:Boolean=true){
playDataEntries = new Array();
super();
this.gameData = _arg1;
this.handlerModelType = _arg2;
this.requestHandler = _arg3;
this.traceExternalCalls = _arg4;
}
private function onFinalRequestTimeout():void{
if (showingDelayUI){
hideDelayUI();
showingDelayUI = false;
};
ignoreResponses = true;
quit();
}
private function onRequestResponse():void{
var _local3:int;
var _local4:Message;
var _local6:ByteArray;
var _local7:Object;
var _local2:String = arguments[0];
if (((("pusher" == _local2)) || (ignoreResponses))){
return;
};
if (showingDelayUI){
hideDelayUI();
showingDelayUI = false;
};
if ("c" == _local2.charAt(0)){
Assert.halt("String request not yet supported");
} else {
_local6 = Base64.decodeToByteArray(_local2.substring(1));
_local3 = _local6.readShort();
_local4 = new Message(_local6);
handlerModel = new handlerModelType(_local6);
if (MsgTypes.illegalRequest == _local4.type){
Assert.halt("Received illegal request as request response");
ignoreResponses = true;
quit();
};
};
Assert.assert(!(isNaN(_local3)), "Request id could not be parsed from answer string");
clearTimeout(requestTimeouts[_local3]);
var _local5:Function = requestHandlers[_local3];
Assert.assert(!((null == _local5)), ("No request answer handler is defined for request with id " + _local3));
requestHandlers[_local3] = null;
if (_local3 != nextResponse){
bufferedResponses[((_local3 - nextResponse) - 1)] = {handler:_local5, message:_local4};
} else {
_local5(_local4);
nextResponse++;
while ((_local7 = bufferedResponses.shift())) {
_local7.handler(_local7.message);
nextResponse++;
};
};
}
public function getGameData():String{
return (gameData);
}
public function addPlayData(_arg1:Object):void{
var _local2:String;
Assert.assert(!((null == _arg1)), "Play data argument must not be null");
Assert.assert((((_arg1 is String)) || ((_arg1 is ByteArray))), "Play data argument must be of type string or byte array");
if (STATE_STARTED != currentState){
startGame();
};
if ((_arg1 is String)){
if (traceExternalCalls){
trace("playData", ("c" + _arg1));
};
_local2 = ("c" + String(_arg1));
} else {
if (traceExternalCalls){
trace("playData", ("b" + printBinary(_arg1)));
};
_local2 = ("b" + Base64.encodeByteArray(ByteArray(_arg1)));
};
playDataEntries.push(_local2);
}
private function onFirstRequestTimeout():void{
var _local2:int = arguments[0];
requestTimeouts[_local2] = setTimeout(onSecondRequestTimeout, TIMEOUT_SECOND, _local2);
if (traceExternalCalls){
trace("pusher");
};
setTimeout(onRequestResponse, 100, requestHandler.getRequestResponse("pusher"));
}
public function setRequestDelayUI(_arg1:Function, _arg2:Function):void{
showDelayUI = _arg1;
hideDelayUI = _arg2;
}
private function quit():void{
if (traceExternalCalls){
trace("gameQuit");
};
}
private function onSecondRequestTimeout():void{
if (null != showDelayUI){
showDelayUI();
showingDelayUI = true;
};
var _local2:int = arguments[0];
requestTimeouts[_local2] = setTimeout(onFinalRequestTimeout, TIMEOUT_FINAL);
if (traceExternalCalls){
trace("pusher");
};
setTimeout(onRequestResponse, 100, requestHandler.getRequestResponse("pusher"));
}
public function quitGame():void{
Assert.assert((currentState == STATE_ENDED), "Trying to quit the game before it has been ended.");
if (STATE_QUIT == currentState){
return;
};
switch (currentState){
case STATE_NOT_STARTED:
startGame();
case STATE_STARTED:
endGame(0);
};
var _local1:Number = (2000 - (new Date().getTime() - endedTime));
if (0 < _local1){
setTimeout(quit, _local1);
} else {
quit();
};
currentState = STATE_QUIT;
}
public function endGame(_arg1:uint):void{
Assert.assert((currentState == STATE_STARTED), "Trying to end a game that is not in the started state.");
if (STATE_STARTED != currentState){
return;
};
if (traceExternalCalls){
trace("gameEnd", _arg1);
};
endedTime = new Date().getTime();
currentState = STATE_ENDED;
}
public function sendRequest(_arg1:Object, _arg2:Function):void{
var _local4:String;
var _local5:ByteArray;
Assert.assert(!((null == requestHandler)), "Request handler must not be null");
Assert.assert(!((null == _arg2)), "Handler argument must not be null");
Assert.assert((((_arg1 is String)) || ((_arg1 is ByteArray))), "Request argument must be of type string or byte array");
var _local3:int = requestCounter++;
if (0 == _local3){
requestHandler.createGameState();
requestHandlers = new Dictionary();
bufferedResponses = new Array();
requestTimeouts = new Array();
handlerModel = new handlerModelType();
};
requestHandlers[_local3] = _arg2;
if ((_arg1 is String)){
Assert.halt("String request not yet supported");
} else {
_local5 = new ByteArray();
_local5.writeShort(_local3);
_local5.writeBytes(ByteArray(_arg1));
_local5.writeBytes(handlerModel.toByteArray());
_local4 = ("b" + Base64.encodeByteArray(_local5));
if (traceExternalCalls){
trace("request", ("b" + _local3), printBinary(ByteArray(_arg1)));
};
};
requestTimeouts[_local3] = setTimeout(onFirstRequestTimeout, TIMEOUT_FIRST, _local3);
setTimeout(onRequestResponse, 200, requestHandler.getRequestResponse(_local4));
}
public function startGame():void{
Assert.assert((currentState == STATE_NOT_STARTED), "Trying to start the game when it's already started.");
if (STATE_NOT_STARTED != currentState){
return;
};
if (traceExternalCalls){
trace("gameStart");
};
currentState = STATE_STARTED;
}
}
}//package com.midasplayer.game.comm
Section 4
//GameComm (com.midasplayer.game.comm.GameComm)
package com.midasplayer.game.comm {
import com.midasplayer.messaging.*;
import flash.utils.*;
import com.midasplayer.util.*;
import flash.external.*;
import flash.system.*;
public class GameComm implements IGameComm {
private var showingDelayUI:Boolean;// = false
private var nextResponse:int;// = 0
private var requestHandlers:Dictionary;
private var handlerModelType:Class;
private var currentState:int;// = 0
private var ignoreResponses:Boolean;// = false
private var requestTimeouts:Array;
private var endedTime:Number;
private var showDelayUI:Function;// = null
private var requestCounter:int;// = 0
private var bufferedResponses:Array;
private var hideDelayUI:Function;// = null
private var handlerModel:Object;
private static const STATE_NOT_STARTED:uint = 0;
private static const STATE_ENDED:uint = 2;
private static const TIMEOUT_SECOND:int = 1500;
private static const STATE_STARTED:uint = 1;
private static const TIMEOUT_FIRST:int = 1500;
private static const STATE_QUIT:uint = 3;
private static const TIMEOUT_FINAL:int = 19000;
public function GameComm(_arg1:Class=null){
this.handlerModelType = _arg1;
}
private function onFirstRequestTimeout():void{
var _local2:int = arguments[0];
requestTimeouts[_local2] = setTimeout(onSecondRequestTimeout, TIMEOUT_SECOND, _local2);
fscommand("request", "pusher");
}
public function quitGame():void{
Assert.assert((currentState == STATE_ENDED), "Trying to quit the game before it has been ended.");
if (STATE_QUIT == currentState){
return;
};
switch (currentState){
case STATE_NOT_STARTED:
startGame();
case STATE_STARTED:
endGame(0);
};
var _local1:Number = (2000 - (new Date().getTime() - endedTime));
if (0 < _local1){
setTimeout(quit, _local1);
} else {
quit();
};
currentState = STATE_QUIT;
}
public function addPlayData(_arg1:Object):void{
var _local2:String;
Assert.assert(!((null == _arg1)), "Play data argument must not be null");
Assert.assert((((_arg1 is String)) || ((_arg1 is ByteArray))), "Play data argument must be of type string or byte array");
if (STATE_STARTED != currentState){
startGame();
};
if ((_arg1 is String)){
_local2 = ("c" + String(_arg1));
} else {
_local2 = ("b" + Base64.encodeByteArray(ByteArray(_arg1)));
};
ExternalInterface.call("playData", _local2);
}
private function onFinalRequestTimeout():void{
if (showingDelayUI){
hideDelayUI();
showingDelayUI = false;
};
ignoreResponses = true;
quit();
}
public function setRequestDelayUI(_arg1:Function, _arg2:Function):void{
showDelayUI = _arg1;
hideDelayUI = _arg2;
}
private function quit():void{
fscommand("gameQuit", "");
}
private function onRequestResponse(_arg1:String):void{
var _local2:int;
var _local3:Message;
var _local5:ByteArray;
var _local6:Object;
if (((("pusher" == _arg1)) || (ignoreResponses))){
return;
};
if (showingDelayUI){
hideDelayUI();
showingDelayUI = false;
};
if ("c" == _arg1.charAt(0)){
Assert.halt("String request not yet supported");
} else {
_local5 = Base64.decodeToByteArray(_arg1.substring(1));
_local2 = _local5.readShort();
_local3 = new Message(_local5);
handlerModel = new handlerModelType(_local5);
if (MsgTypes.illegalRequest == _local3.type){
Assert.halt("Received illegal request as request response");
ignoreResponses = true;
quit();
};
};
Assert.assert(!(isNaN(_local2)), "Request id could not be parsed from answer string");
clearTimeout(requestTimeouts[_local2]);
var _local4:Function = requestHandlers[_local2];
Assert.assert(!((null == _local4)), ("No request answer handler is defined for request with id " + _local2));
requestHandlers[_local2] = null;
if (_local2 != nextResponse){
bufferedResponses[((_local2 - nextResponse) - 1)] = {handler:_local4, message:_local3};
} else {
_local4(_local3);
nextResponse++;
while ((_local6 = bufferedResponses.shift())) {
_local6.handler(_local6.message);
nextResponse++;
};
};
}
private function onSecondRequestTimeout():void{
if (null != showDelayUI){
showDelayUI();
showingDelayUI = true;
};
var _local2:int = arguments[0];
requestTimeouts[_local2] = setTimeout(onFinalRequestTimeout, TIMEOUT_FINAL);
fscommand("request", "pusher");
}
public function sendRequest(_arg1:Object, _arg2:Function):void{
var _local4:String;
var _local5:ByteArray;
Assert.assert(!((null == _arg2)), "Handler argument must not be null");
Assert.assert((((_arg1 is String)) || ((_arg1 is ByteArray))), "Request argument must be of type string or byte array");
var _local3:int = requestCounter++;
if (0 == _local3){
requestHandlers = new Dictionary();
bufferedResponses = new Array();
requestTimeouts = new Array();
handlerModel = new handlerModelType();
ExternalInterface.addCallback("onProxyResponse", onRequestResponse);
};
requestHandlers[_local3] = _arg2;
if ((_arg1 is String)){
Assert.halt("String request not yet supported");
} else {
_local5 = new ByteArray();
_local5.writeShort(_local3);
_local5.writeBytes(ByteArray(_arg1));
_local5.writeBytes(handlerModel.toByteArray());
_local4 = ("b" + Base64.encodeByteArray(_local5));
};
requestTimeouts[_local3] = setTimeout(onFirstRequestTimeout, TIMEOUT_FIRST, _local3);
fscommand("request", _local4);
}
public function getGameData():String{
var _local1:Object = ExternalInterface.call("getGameData");
if (_local1 == null){
throw (new Error("The getGameData external interface call returned null."));
};
if (_local1.success == false){
throw (new Error("The getGameData returned object is not success."));
};
if (_local1.message == null){
throw (new Error("The GameData returned object has a null message."));
};
return (_local1.message);
}
public function startGame():void{
Assert.assert((currentState == STATE_NOT_STARTED), "Trying to start the game when it's already started.");
if (STATE_NOT_STARTED != currentState){
return;
};
fscommand("gameStart", "");
currentState = STATE_STARTED;
}
public function endGame(_arg1:uint):void{
Assert.assert((currentState == STATE_STARTED), "Trying to end a game that is not in the started state.");
if (STATE_STARTED != currentState){
return;
};
fscommand("gameEnd", _arg1.toString());
endedTime = new Date().getTime();
currentState = STATE_ENDED;
}
}
}//package com.midasplayer.game.comm
Section 5
//GameDataParser (com.midasplayer.game.comm.GameDataParser)
package com.midasplayer.game.comm {
import com.midasplayer.debug.*;
public class GameDataParser {
private var _seed:int;// = 0
private var _textElements:XMLList;
private var _gameData:XML;
public function GameDataParser(_arg1:String){
Debug.assert(!((_arg1 == null)), "Could not parse the game data, the xml parameter is null.");
_gameData = new XML(_arg1);
Debug.assert((_gameData.length() == 1), "The game data XML should only have 1 root child.");
_seed = parseInt(_gameData.attribute("randomseed"));
Debug.assert(!((_seed == 0)), "The game data randomseed attribute is 0, this may result in complete randomness.");
_textElements = _gameData.child("text");
}
public function getText(_arg1:String):String{
var texts:XMLList;
var id = _arg1;
texts = _textElements.(@id == id);
Debug.assert((texts.length() == 1), (("Could not find the text element (or found more than 1) with attribute id '" + id) + "' in the game data."));
return (texts.text());
}
public function getElementTextAsInt(_arg1:String):int{
var _local2:XMLList;
_local2 = _getOneElement(_arg1);
var _local3:Number = parseInt(_local2.text());
Debug.assert(!(isNaN(_local3)), ((("Could not parse a game data property as int '" + _arg1) + "' value: ") + _local2.text()));
return (int(_local3));
}
private function _getOneElement(_arg1:String):XMLList{
var _local2:XMLList = _gameData.child(_arg1);
Debug.assert((_local2.length() == 1), (("Could not find the element (or found more than 1) with the name '" + _arg1) + "' in the game data."));
return (_local2);
}
public function getElementTextAsNumber(_arg1:String):Number{
var _local2:XMLList;
_local2 = _getOneElement(_arg1);
var _local3:Number = parseFloat(_local2.text());
Debug.assert(!(isNaN(_local3)), ((("Could not parse a game data property as float '" + _arg1) + "' value: ") + _local2.text()));
return (_local3);
}
public function getElementTextAsBool(_arg1:String):Boolean{
var _local2:String = getElementTextAsString(_arg1).toLowerCase();
Debug.assert((((((((_local2 == "0")) || ((_local2 == "1")))) || ((_local2 == "false")))) || ((_local2 == "true"))), ((("Could not parse a boolean, the value should be 'true', 'false', '0' or '1'. Element: " + _arg1) + ", value: ") + _local2));
return ((((_local2 == "true")) || ((_local2 == "1"))));
}
public function get randomSeed():int{
return (_seed);
}
public function getElementTextAsString(_arg1:String):String{
return (_getOneElement(_arg1).text());
}
}
}//package com.midasplayer.game.comm
Section 6
//IGameComm (com.midasplayer.game.comm.IGameComm)
package com.midasplayer.game.comm {
public interface IGameComm {
function quitGame():void;
function getGameData():String;
function startGame():void;
function sendRequest(_arg1:Object, _arg2:Function):void;
function setRequestDelayUI(_arg1:Function, _arg2:Function):void;
function endGame(_arg1:uint):void;
function addPlayData(_arg1:Object):void;
}
}//package com.midasplayer.game.comm
Section 7
//Animation (com.midasplayer.game.framework.Animation)
package com.midasplayer.game.framework {
import flash.display.*;
import com.midasplayer.util.*;
public class Animation extends Tween {
private var duration:Number;
private var from:Number;
private var frameRate:Number;
private var startTime:Number;
private var clip:MovieClip;
private var lastTime:Number;
private var timestep:Number;
private var to:Number;
private var frame:int;// = -1
private var args:Object;
public function Animation(_arg1:MovieClip, _arg2:Object, _arg3:Object, _arg4:Number, _arg5:Object=null){
Assert.assert(!((null == _arg1)), "Clip argument must not be null");
Assert.assert(!((null == _arg2)), "From argument must not be null");
Assert.assert(!((null == _arg3)), "To argument must not be null");
Assert.assert((((_arg2 is Number)) || ((_arg2 is String))), "From argument must be of type Number of String");
Assert.assert((((_arg3 is Number)) || ((_arg3 is String))), "To argument must be of type Number of String");
if ((_arg2 is String)){
_arg2 = getLabelFrame(String(_arg2), _arg1);
};
if ((_arg3 is String)){
_arg3 = getLabelFrame(String(_arg3), _arg1);
};
this.clip = _arg1;
this.from = Number(_arg2);
this.to = Number(_arg3);
this.startTime = _arg4;
this.args = (_arg5) ? _arg5 : new Object();
frameRate = (this.args.frameRate) ? this.args.frameRate : 24;
duration = (Math.abs((this.to - this.from)) / frameRate);
lastTime = _arg4;
timestep = (1 / frameRate);
}
public function get currentFrame():Number{
return (clip.currentFrame);
}
override public function update(_arg1:Number):void{
if ((((_arg1 < startTime)) || (finished))){
return;
};
if (-1 == frame){
safeCall(args.onStart, args.onStartArgs);
frame = from;
};
safeCall(args.onUpdate, args.onUpdateArgs);
if (_arg1 > (startTime + duration)){
clip.gotoAndStop(to);
safeCall(args.onComplete, args.onCompleteArgs);
setFinished();
return;
};
if (from <= to){
while ((_arg1 - lastTime) > timestep) {
frame++;
lastTime = (lastTime + timestep);
};
} else {
while ((_arg1 - lastTime) > timestep) {
frame--;
lastTime = (lastTime + timestep);
};
};
clip.gotoAndStop(frame);
}
}
}//package com.midasplayer.game.framework
Section 8
//BaseConfig (com.midasplayer.game.framework.BaseConfig)
package com.midasplayer.game.framework {
import com.midasplayer.game.comm.*;
import com.midasplayer.math.*;
import com.midasplayer.util.*;
import com.midasplayer.text.*;
public class BaseConfig {
public var firstGame:Boolean;
public var timer:ITimer;
public var sound:Boolean;
public var debug:Boolean;
public var openGame:Boolean;
public var music:Boolean;
public var displayStrings:Function;
public var local:Boolean;
public var gameComm:IGameComm;
public var logComm:Boolean;
public var timeLimit:int;
public var randSeed:int;
public var gameRand:MtRandom;
public function BaseConfig(_arg1:Function, _arg2:Function, _arg3:Function, _arg4:Object){
debug = _arg4["debug"];
local = _arg4["local"];
logComm = _arg4["logComm"];
gameComm = createGameComm(local, _arg2, _arg1, _arg3);
var _local5:GameDataParser = new GameDataParser(gameComm.getGameData());
displayStrings = createDisplayStrings();
if (!(timer = _arg4["timer"])){
timer = new SystemTimer();
};
randSeed = _local5.randomSeed;
gameRand = new MtRandom(randSeed);
openGame = _local5.getElementTextAsBool("opengame");
timeLimit = _local5.getElementTextAsInt("timelimit");
firstGame = _local5.getElementTextAsBool("firstgame");
sound = _local5.getElementTextAsBool("sound");
music = _local5.getElementTextAsBool("music");
}
private function createGameComm(_arg1:Boolean, _arg2:Function, _arg3:Function, _arg4:Function):IGameComm{
Assert.assert(!((null == _arg2)), "Handler model function must not be null");
if (_arg1){
Assert.assert(!((null == _arg3)), "Local game data function must not be null");
Assert.assert(!((null == _arg4)), "Local request handler function must not be null");
return (new DebugGameComm(_arg3(), _arg2(), _arg4(), logComm));
};
return (new GameComm(_arg2()));
}
private function createDisplayStrings():Function{
Assert.assert(!((null == gameComm)), "gameComm must not be null");
var _local1:XMLList = new XML(gameComm.getGameData()).child("text");
var _local2:Object = new Object();
var _local3:int;
while (_local3 < _local1.length()) {
_local2[_local1[_local3].@id] = _local1[_local3];
_local3++;
};
I18n.init(_local2);
return (I18n.getString);
}
}
}//package com.midasplayer.game.framework
Section 9
//Controller (com.midasplayer.game.framework.Controller)
package com.midasplayer.game.framework {
import de.polygonal.ds.*;
import com.midasplayer.messaging.*;
import com.midasplayer.util.*;
public class Controller extends TaskManager {
private var requestResponseQueue:Queue;
private var config:BaseConfig;
private var inputQueue:Queue;
private var outputQueue:Queue;
public function Controller(_arg1:BaseConfig, _arg2:Queue, _arg3:Queue){
requestResponseQueue = new LinkedQueue();
super();
this.config = _arg1;
this.inputQueue = _arg2;
this.outputQueue = _arg3;
}
protected function pushRequest(_arg1:Message):void{
_arg1.tick = currentTick;
config.gameComm.sendRequest(_arg1.toBinaryPlayData(), requestResponseQueue.enqueue);
}
protected function popInput():Message{
var _local1:Message;
if (inputQueue.isEmpty()){
return (null);
};
Assert.assert((inputQueue.peek() is Message), "Enqueued input must be of type Message");
_local1 = Message(inputQueue.dequeue());
_local1.tick = currentTick;
if (_local1.type != MsgTypes.quitGame){
config.gameComm.addPlayData(_local1.toBinaryPlayData());
};
return (_local1);
}
protected function pushOutput(_arg1:Message):void{
_arg1.tick = currentTick;
outputQueue.enqueue(_arg1);
}
protected function popRequestResponse():Message{
var _local1:Message;
if (requestResponseQueue.isEmpty()){
return (null);
};
Assert.assert((requestResponseQueue.peek() is Message), "Enqueued input must be of type Message");
_local1 = Message(requestResponseQueue.dequeue());
_local1.tick = currentTick;
config.gameComm.addPlayData(_local1.toBinaryPlayData());
return (_local1);
}
}
}//package com.midasplayer.game.framework
Section 10
//FadeOutTween (com.midasplayer.game.framework.FadeOutTween)
package com.midasplayer.game.framework {
import com.midasplayer.util.*;
public class FadeOutTween extends Tween {
private var clips:Array;
private var startTime:Number;
private var first:Boolean;// = true
private var duration:Number;
private var args:Object;
public function FadeOutTween(_arg1:Array, _arg2:Number, _arg3:Number, _arg4:Object=null){
this.clips = _arg1;
this.startTime = _arg2;
this.duration = _arg3;
this.args = (_arg4) ? _arg4 : new Object();
}
override public function update(_arg1:Number):void{
var _local2:Object;
if ((((_arg1 < startTime)) || (finished))){
return;
};
if (first){
safeCall(args.onStart, args.onStartArgs);
first = false;
};
safeCall(args.onUpdate, args.onUpdateArgs);
if (_arg1 > (startTime + duration)){
for each (_local2 in clips) {
_local2.alpha = 0;
};
safeCall(args.onComplete, args.onCompleteArgs);
setFinished();
return;
};
var _local3:Number = (1 - ((_arg1 - startTime) / duration));
for each (_local2 in clips) {
_local2.alpha = _local3;
};
}
}
}//package com.midasplayer.game.framework
Section 11
//FadePulseTween (com.midasplayer.game.framework.FadePulseTween)
package com.midasplayer.game.framework {
import flash.display.*;
import com.midasplayer.util.*;
public class FadePulseTween extends Tween {
private var speed:Number;
private var frameRate:Number;
private var startTime:Number;
private var first:Boolean;// = true
private var target:DisplayObject;
private var duration:Number;
private var lowScale:Number;
private var highScale:Number;
private var args:Object;
public function FadePulseTween(_arg1:DisplayObject, _arg2:Number, _arg3:Number, _arg4:Object=null){
this.target = _arg1;
this.startTime = _arg2;
this.duration = _arg3;
this.args = (_arg4) ? _arg4 : new Object();
lowScale = (_arg4.lowScale) ? _arg4.lowScale : 0;
highScale = (_arg4.highScale) ? _arg4.highScale : 0;
speed = (_arg4.speed) ? _arg4.speed : 1;
}
override public function update(_arg1:Number):void{
if ((((_arg1 < startTime)) || (finished))){
return;
};
if (first){
safeCall(args.onStart, args.onStartArgs);
first = false;
};
safeCall(args.onUpdate, args.onUpdateArgs);
if (_arg1 > (startTime + duration)){
target.alpha = 0;
safeCall(args.onComplete, args.onCompleteArgs);
setFinished();
return;
};
if ((_arg1 - startTime) < (0.5 / speed)){
target.alpha = ((_arg1 - startTime) / (0.5 / speed));
} else {
if ((duration - (_arg1 - startTime)) < (0.5 / speed)){
target.alpha = ((duration - (_arg1 - startTime)) / (0.5 / speed));
} else {
target.alpha = 1;
};
};
target.scaleX = (lowScale + (((highScale - lowScale) * 0.5) * (1 + Math.sin((speed * (_arg1 - startTime))))));
target.scaleY = (lowScale + (((highScale - lowScale) * 0.5) * (1 + Math.sin((speed * (_arg1 - startTime))))));
}
}
}//package com.midasplayer.game.framework
Section 12
//IRequestHandler (com.midasplayer.game.framework.IRequestHandler)
package com.midasplayer.game.framework {
public interface IRequestHandler {
function recreateGameState(_arg1:String):void;
function getRequestResponse(_arg1:String):String;
function createGameState():void;
}
}//package com.midasplayer.game.framework
Section 13
//ITimer (com.midasplayer.game.framework.ITimer)
package com.midasplayer.game.framework {
public interface ITimer {
function getTime():Number;
}
}//package com.midasplayer.game.framework
Section 14
//SystemTimer (com.midasplayer.game.framework.SystemTimer)
package com.midasplayer.game.framework {
import flash.utils.*;
public class SystemTimer implements ITimer {
public function getTime():Number{
return ((getTimer() / 1000));
}
}
}//package com.midasplayer.game.framework
Section 15
//Task (com.midasplayer.game.framework.Task)
package com.midasplayer.game.framework {
public class Task {
public var handler:Function;
public var onTick:Number;
private var args:Array;
public function Task(_arg1:Number, _arg2:Function, _arg3:Array){
this.onTick = _arg1;
this.handler = _arg2;
this.args = _arg3;
}
public function execute():void{
handler.apply(null, args);
}
}
}//package com.midasplayer.game.framework
Section 16
//TaskManager (com.midasplayer.game.framework.TaskManager)
package com.midasplayer.game.framework {
import de.polygonal.ds.*;
import com.midasplayer.util.*;
public class TaskManager {
public var currentTick:Number;// = 0
private var tasks:Vector;
public function TaskManager(){
tasks = new Vector();
super();
}
protected function executeTasks():void{
var _local1:int;
while (_local1 < tasks.size()) {
Log.debugIf((currentTick > tasks.get(_local1).onTick), (("Tick " + tasks.get(_local1).onTick) + " on which task should execute has passed."));
if (currentTick >= tasks.get(_local1).onTick){
tasks.removeAt(_local1).execute();
} else {
_local1++;
};
};
}
protected function clearTasks():void{
tasks.clear();
}
protected function addTask(_arg1:Number, _arg2:Function, ... _args):void{
var _local5:int;
var _local4:Task = new Task(_arg1, _arg2, _args);
if (_arg1 <= currentTick){
_local4.execute();
} else {
if (!tasks.size()){
tasks.pushBack(_local4);
} else {
if (_local4.onTick >= tasks.get((tasks.size() - 1)).onTick){
tasks.pushBack(_local4);
} else {
_local5 = (tasks.size() - 1);
while (_local5 >= 0) {
if (_local5 > 0){
if (_local4.onTick >= tasks.get((_local5 - 1)).onTick){
tasks.insertAt(_local5, _local4);
break;
};
} else {
tasks.insertAt(0, _local4);
};
_local5--;
};
};
};
};
}
protected function numTasks():int{
return (tasks.size());
}
protected function removeTask(_arg1:Function):Task{
var _local2:int;
while (_local2 < tasks.size()) {
if (_arg1 == tasks.get(_local2).handler){
return ((tasks.removeAt(_local2) as Task));
};
_local2++;
};
return (null);
}
}
}//package com.midasplayer.game.framework
Section 17
//TextTween (com.midasplayer.game.framework.TextTween)
package com.midasplayer.game.framework {
import flash.text.*;
import com.midasplayer.util.*;
public class TextTween extends Tween {
private var strings:Array;
private var lastTime:Number;
private var field:TextField;
private var frame:int;// = -1
private var startTime:Number;
private var duration:Number;
private var timestep:Number;
private var args:Object;
public function TextTween(_arg1:TextField, _arg2:Number, _arg3:Number, _arg4:Array, _arg5:Object=null){
this.field = _arg1;
this.startTime = _arg2;
this.duration = _arg3;
this.strings = _arg4;
this.args = (_arg5) ? _arg5 : new Object();
lastTime = _arg2;
timestep = (_arg3 / _arg4.length);
}
override public function update(_arg1:Number):void{
if ((((_arg1 < startTime)) || (finished))){
return;
};
if (-1 == frame){
safeCall(args.onStart, args.onStartArgs);
frame = 0;
};
safeCall(args.onUpdate, args.onUpdateArgs);
if (_arg1 > (startTime + duration)){
safeCall(args.onComplete, args.onCompleteArgs);
field.text = strings[(strings.length - 1)];
setFinished();
return;
};
while ((_arg1 - lastTime) > timestep) {
frame++;
lastTime = (lastTime + timestep);
};
field.text = strings[Math.min((strings.length - 1), frame)];
}
}
}//package com.midasplayer.game.framework
Section 18
//Ticker (com.midasplayer.game.framework.Ticker)
package com.midasplayer.game.framework {
import com.midasplayer.util.*;
public class Ticker {
private var updateModel:Function;
private var unprocessedTime:Number;// = 0
private var lastTime:Number;// = 0
private var startTime:Number;// = -1
private var updateStage:Function;
private var _maxTickTime:Number;
private var _timeStep:Number;
private var tick:Number;// = 0
public function Ticker(_arg1:Function, _arg2:Function, _arg3:Number, _arg4:Number=0.5){
Assert.assert(!((null == _arg1)), "Model update function must not be null");
Assert.assert(!((null == _arg2)), "Stage update function must not be null");
Assert.assert((0 < _arg3), "Time step must be greater than zero");
Assert.assert((0 < _arg4), "Max tick time must be greater than zero");
this.updateModel = _arg1;
this.updateStage = _arg2;
this._timeStep = _arg3;
this._maxTickTime = _arg4;
}
public function get currentTime():Number{
return (lastTime);
}
public function get maxTickTime():Number{
return (_maxTickTime);
}
public function advanceTime(_arg1:ITimer):void{
var _local4:Number;
var _local2:Number = _arg1.getTime();
Assert.assert((_local2 >= lastTime), "New time must be greater or equal to the current time");
if (0 > startTime){
startTime = _local2;
lastTime = startTime;
updateModel(++tick);
updateStage(tick);
return;
};
var _local3:Number = (_local2 - lastTime);
unprocessedTime = (unprocessedTime + _local3);
if (unprocessedTime >= _timeStep){
_local4 = (_maxTickTime + _local2);
do {
updateModel(++tick);
unprocessedTime = (unprocessedTime - _timeStep);
} while ((((unprocessedTime >= _timeStep)) && ((_arg1.getTime() < _local4))));
};
updateStage((tick + ((unprocessedTime % _timeStep) / _timeStep)));
lastTime = _local2;
}
public function set maxTickTime(_arg1:Number):void{
Assert.assert((0 < maxTickTime), "Max tick time must be greater than zero");
_maxTickTime = _arg1;
}
public function get timeStep():Number{
return (_timeStep);
}
public function get currentTick():Number{
return (tick);
}
}
}//package com.midasplayer.game.framework
Section 19
//Tween (com.midasplayer.game.framework.Tween)
package com.midasplayer.game.framework {
public class Tween {
private var finished_:Boolean;// = false
public function get finished():Boolean{
return (finished_);
}
protected function setFinished():void{
finished_ = true;
}
public function update(_arg1:Number):void{
setFinished();
}
}
}//package com.midasplayer.game.framework
Section 20
//ClientModel (com.midasplayer.games.leredita.ClientModel)
package com.midasplayer.games.leredita {
public class ClientModel {
public var countdownDelay:int;// = 2147483647
public var finalWordGuesses:int;// = 0
public var activeWordPair:int;// = 0
public var activeQuestion:int;// = 0
public var questions:Array;
public var wordPairs:Array;
public var score:int;// = 0
public var finalWordTimeBonus:int;// = 0
public var timelimitHandler:Function;
public var countdownRemaining:int;// = 2147483647
public function ClientModel(){
var _local1:int;
questions = new Array();
wordPairs = new Array();
super();
_local1 = 0;
while (_local1 < 8) {
questions.push({value:0, givenAnswer:-1, timeBonus:0});
_local1++;
};
_local1 = 0;
while (_local1 < 5) {
wordPairs.push({givenAnswer:-1, timeBonus:0});
_local1++;
};
}
}
}//package com.midasplayer.games.leredita
Section 21
//Config (com.midasplayer.games.leredita.Config)
package com.midasplayer.games.leredita {
import com.midasplayer.game.framework.*;
import com.midasplayer.math.*;
import com.midasplayer.sound.*;
public class Config extends BaseConfig {
public var showWordPairVol:Number;// = 0.85
public var timelimitHitVol:Number;// = 0.9
public var openGameQuestionLimit:int;// = 4
public var responsibleGamingLink:String;// = "http://it.king.com/servlet/SelectServlet?partner=rai&target=/support/responsible_gaming_IT.jsp"
public var maxTickTime:Number;// = 0.5
public var answersDeltaDelay:Number;// = 0.2
public var isRai:Boolean;// = true
public var finalWordCountdownDelay:int;// = 12
public var openGameEndCountdownLength:Number;// = 5
public var categoryCountdownLength:int;// = 100
public var resultCountdownLength:Number;// = 8
public var tickRate:Number;// = 10
public var soundManager:SoundManager;
public var instructionsCountdownLength:Number;// = 16
public var showAnswersDelay:Number;// = 0.8
public var initialFinalWordCountdownDelay:int;// = 11
public var questionCountdownLength:int;// = 150
public var duelloMelodyVol:Number;// = 0.8
public var timeStep:Number;
public var wordWrongVol:Number;// = 0.77
public var finalWordCountdownLength:int;// = 200
public var showQuestionDelay:Number;// = 0.4
public var wordCorrectVol:Number;// = 0.85
public var scoreBrickTime:Number;// = 6.2
public var soundVol:Number;// = 0.68
public var introMelodyVol:Number;// = 1
public var goldBarVol:Number;// = 0.8
public var musicManager:SoundManager;
public var kingLink:String;// = "http://it.king.com/servlet/SelectServlet?partner=rai&channel=rai_standalone_game"
public var ghigliottinaVol:Number;// = 0.9
public var answerWrongVol:Number;// = 0.75
private var gameDataSeed:int;
public var showQuestionVol:Number;// = 0.9
public var wordPairCountdownLength:int;// = 50
public var initialCategoryCountdownDelay:int;// = 26
public var questionCountdownDelay:int;// = 34
public var selfcontaining:Boolean;// = false
public var questionOutDelay:Number;// = 0.8
public var scoreUpdateVol:Number;// = 0.8
public var tilesIntroDelay:Number;// = 0
private var gameDataOpenGame:int;
public var answerCorrectVol:Number;// = 0.6
public var categoryCountdownDelay:int;// = 55
public var musicVol:Number;// = 0.68
public var wordPairCountdownDelay:int;// = 8
private static const openGameWordPairs3:Array = [[{words:["scientifico", "storico"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {words:["comune", "comunale"], correctAnswer:0, givenAnswer:-1, timeBonus:0}, {words:["tenere", "appartenere"], correctAnswer:0, givenAnswer:-1, timeBonus:0}, {words:["speranza", "dubbio"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {words:["sindacato", "sindacale"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {correctAnswer:"minimo"}], [{words:["sopra", "sotto"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {words:["aprire", "aprile"], correctAnswer:0, givenAnswer:-1, timeBonus:0}, {words:["film", "cartone"], correctAnswer:0, givenAnswer:-1, timeBonus:0}, {words:["volante", "polizia"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {words:["commessa", "commissione"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {correctAnswer:"inchiesta"}], [{words:["lotta", "lotteria"], correctAnswer:0, givenAnswer:-1, timeBonus:0}, {words:["angeli", "demoni"], correctAnswer:0, givenAnswer:-1, timeBonus:0}, {words:["costume", "maschera"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {words:["adamo", "eva"], correctAnswer:0, givenAnswer:-1, timeBonus:0}, {words:["gettone", "gettare"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {correctAnswer:"FANGO"}]];
private static const a:Array = [{category:"MUSICA", value:0, question:"Quale opera di Giuseppe Verdi è ispirata al romanzo \"La signora delle camelie\"?", answers:["Rigoletto", "Il Trovatore", "La Traviata", "Aida"], correctAnswer:2, givenAnswer:-1, timeBonus:0}, {category:"SCIENZA", value:0, question:"Che cosa funziona grazie a onde elettromagnetiche?", answers:["Telefono fisso", "Lavastoviglie", "Forno a microonde", "Lettore DVD"], correctAnswer:2, givenAnswer:-1, timeBonus:0}, {category:"ITALIANO", value:0, question:"Quale di queste preposizioni semplici non può trasformarsi in preposizione articolata?", answers:["In", "Su", "A", "Tra"], correctAnswer:3, givenAnswer:-1, timeBonus:0}, {category:"CASA E CUCINA", value:0, question:"Nelle pasticcerie siciliane, quale dolciume si può acquistare a \"mattùneddi\"?", answers:["Il torrone", "La cassata", "Il cannolo", "La granita"], correctAnswer:0, givenAnswer:-1, timeBonus:0}, {category:"SPORT", value:0, question:"Durante le gare, indossano un gonnellino paraspruzzi gli atleti che praticano quale sport?", answers:["Windsurf", "Bob", "Motocross", "Canoa"], correctAnswer:3, givenAnswer:-1, timeBonus:0}, {category:"GEOGRAFIA", value:0, question:"Utilizzando lo stesso aereo, si impiega meno tempo per andare da Milano a...?", answers:["Copenaghen", "Parigi", "Varsavia", "Madrid"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {category:"ARTE E LETTERATURA", value:0, question:"Chi di loro, secondo la leggenda, fu fedele servitore del re inglese Riccardo Cuor di Leone?", answers:["Robin Hood", "Il paladino Orlando", "Macbeth", "Lancillotto"], correctAnswer:0, givenAnswer:-1, timeBonus:0}, {category:"CURIOSITA' VARIE", value:0, question:"Non si commetteva il reato di oltraggio a pubblico ufficiale insultando un...?", answers:["Professore di latino", "Medico d'ospedale", "Vigile urbano", "Parroco"], correctAnswer:3, givenAnswer:-1, timeBonus:0}, {category:"SPETTACOLO", value:0, question:"Quale di queste trasmissioni televisive va in onda da più tempo?", answers:["Blob", "Linea Verde", "Domenica In", "Quark"], correctAnswer:2, givenAnswer:-1, timeBonus:0}, {category:"FUMETTI", value:0, question:"Quale supereroe esordì in Italia nel 1939 con il nome di \"Ciclone, l'uomo d'acciaio\"?", answers:["Uomo Ragno", "Flash Gordon", "Capitan America", "Superman"], correctAnswer:3, givenAnswer:-1, timeBonus:0}, {category:"COSTUME E VARIE", value:0, question:"Chi inaugurò in Italia la tradizione dell'albero di Natale allestendone uno a Palazzo del Quirinale?", answers:["Lucrezia Borgia", "Paolina Borghese", "Margherita di Savoia", "Caterina de' Medici"], correctAnswer:2, givenAnswer:-1, timeBonus:0}, {category:"STORIA", value:0, question:"Quale dei Premi Nobel fu istituito dalla Banca di Svezia solo nel 1968, più di 60 anni dopo gli altri?", answers:["Letteratura", "Economia", "Chimica", "Pace"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {category:"NATALE", value:0, question:"Con quale simbolo, sulle pareti dei luoghi di culto, i primi cristiani rappresentavano Gesù?", answers:["Calice", "Ramoscello d'ulivo", "Pesce", "Occhio"], correctAnswer:2, givenAnswer:-1, timeBonus:0}, {category:"STORIA", value:0, question:"Chi di loro partecipò alla seduta del Parlamento in cui fu proclamata la nascita del Regno d'Italia?", answers:["Giacomo Puccini", "Gioacchino Rossini", "Niccolò Paganini", "Giuseppe Verdi"], correctAnswer:3, givenAnswer:-1, timeBonus:0}, {category:"MITOLOGIA", value:0, question:"Erano figlie di Ares, dio della guerra, le...", answers:["Ninfe", "Amazzoni", "Muse", "Sirene"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {category:"ANIMALI", value:0, question:"In quale nazione scorrazzano liberamente scimmie e coccodrilli, considerati \"animali sacri\"?", answers:["Argentina", "India", "Australia", "Corea del Sud"], correctAnswer:1, givenAnswer:-1, timeBonus:0}];
private static const c:Array = [{category:"CURIOSITA' VARIE", value:0, question:"Nell'America del 1600, cosa veniva accostato alla luce di una candela per stabilirne il costo?", answers:["Scarpa di cuoio", "Lettera da spedire", "Stoffa di seta", "Pentola di rame"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {category:"ARTE E LETTERATURA", value:0, question:"Quale di questi romanzi inizia con le parole \"C'era una volta\"?", answers:["Pinocchio", "Peter Pan", "Alice nel paese...", "Il libro della giungla"], correctAnswer:0, givenAnswer:-1, timeBonus:0}, {category:"ITALIANO", value:0, question:"\"Tornare con le pive nel sacco\" significa \"non aver concluso nulla\"; ma cosa sono le pive?", answers:["Biscotti alle mandorle", "Foglie di tabacco", "Strumenti a fiato", "Candele di cera"], correctAnswer:2, givenAnswer:-1, timeBonus:0}, {category:"STORIA", value:0, question:"Il primo sommergibile della storia fu costruito in Inghilterra nel '600. Che materiali furono usati?", answers:["Legno e cuoio", "Vetro e ferro", "Porcellana e rame", "Gomma e stagno"], correctAnswer:0, givenAnswer:-1, timeBonus:0}];
private static const openGameWordPairs6:Array = [[{words:["scientifico", "storico"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {words:["comune", "comunale"], correctAnswer:0, givenAnswer:-1, timeBonus:0}, {words:["tenere", "appartenere"], correctAnswer:0, givenAnswer:-1, timeBonus:0}, {words:["speranza", "dubbio"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {words:["sindacato", "sindacale"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {correctAnswer:"minimo"}], [{words:["lotta", "lotteria"], correctAnswer:0, givenAnswer:-1, timeBonus:0}, {words:["angeli", "demoni"], correctAnswer:0, givenAnswer:-1, timeBonus:0}, {words:["costume", "maschera"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {words:["adamo", "eva"], correctAnswer:0, givenAnswer:-1, timeBonus:0}, {words:["gettone", "gettare"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {correctAnswer:"FANGO"}], [{words:["angelo", "diavolo"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {words:["patto", "matto"], correctAnswer:0, givenAnswer:-1, timeBonus:0}, {words:["stipendio", "soldi"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {words:["venti", "tempesta"], correctAnswer:0, givenAnswer:-1, timeBonus:0}, {words:["gatta", "gatti"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {correctAnswer:"quattro"}], [{words:["Buona", "buon"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {words:["governo", "stato"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {words:["BORGO", "frazione"], correctAnswer:0, givenAnswer:-1, timeBonus:0}, {words:["m. BRANDO", "J. DEAN"], correctAnswer:0, givenAnswer:-1, timeBonus:0}, {words:["ASSEMBLEA", "SCIOPERO"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {correctAnswer:"selvaggio"}], [{words:["sopra", "sotto"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {words:["aprire", "aprile"], correctAnswer:0, givenAnswer:-1, timeBonus:0}, {words:["film", "cartone"], correctAnswer:0, givenAnswer:-1, timeBonus:0}, {words:["volante", "polizia"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {words:["commessa", "commissione"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {correctAnswer:"inchiesta"}], [{words:["PARTIRE", "VIAGGIARE"], correctAnswer:0, givenAnswer:-1, timeBonus:0}, {words:["LEGGERO", "leggenda"], correctAnswer:0, givenAnswer:-1, timeBonus:0}, {words:["proprieta'", "proprio"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {words:["mari", "pari"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {words:["REGOLA", "regolamento"], correctAnswer:0, givenAnswer:-1, timeBonus:0}, {correctAnswer:"VANTAGGIO"}]];
private static const d:Array = [{category:"ATTUALITA' E CRONACA ROSA", value:0, question:"In caso di vincita al Lotto, quale importo massimo si può riscuotere direttamente in ricevitoria?", answers:["1.600 euro", "2.300 euro", "3.000 euro", "3.700 euro"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {category:"FUMETTI", value:0, question:"Quali di questi personaggi dei cartoni si incontrarono in un episodio?", answers:["Candy Candy - Bia", "Lupin III - Lady Oscar", "Heidi - Remi", "Scooby Doo - Ape Maia"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {category:"CASA E CUCINA", value:0, question:"Per evitare le sbornie e stimolare l'eros, Plinio il Vecchio consigliava una bevanda a base di...?", answers:["Latte e pepe", "Sidro e cannella", "Acqua e zafferano", "Birra e rosmarino"], correctAnswer:2, givenAnswer:-1, timeBonus:0}, {category:"STORIA", value:0, question:"Chi di loro fu condannato per eresia e incarcerato nei Piombi di Venezia?", answers:["Giordano Bruno", "Martin Lutero", "Girolamo Savonarola", "Galileo Galilei"], correctAnswer:0, givenAnswer:-1, timeBonus:0}];
private static const b:Array = [{category:"STORIA", value:0, question:"Nel 1888 a Londra ci fu il primo grande sciopero organizzato da donne: chi \"incrociò le braccia...\"?", answers:["Le tessitrici", "Le prostitute", "Le maestre", "Le fiammiferaie"], correctAnswer:3, givenAnswer:-1, timeBonus:0}, {category:"ANIMALI", value:0, question:"Quali di questi animali, nel periodo degli amori, lottano per la femmina prendendosi a calci?", answers:["I cervi", "I conigli", "Gli struzzi", "I topi"], correctAnswer:2, givenAnswer:-1, timeBonus:0}, {category:"CURIOSITA' VARIE", value:0, question:"Chi furono i primi a parlare il cosiddetto \"latino maccheronico\", un latino storpiato e grossolano?", answers:["Contadini dei feudi", "Mozzi delle navi", "Cavalieri delle corti", "Cuochi dei conventi"], correctAnswer:3, givenAnswer:-1, timeBonus:0}, {category:"SCIENZA", value:0, question:"Quale di questi metalli è più pesante?", answers:["Alluminio", "Rame", "Argento", "Ferro"], correctAnswer:2, givenAnswer:-1, timeBonus:0}, {category:"NATALE", value:0, question:"Quando il Vangelo descrive la nascita di Gesù non parla di...?", answers:["Pastori", "Mangiatoia", "Bue e asinello", "Re Magi"], correctAnswer:2, givenAnswer:-1, timeBonus:0}, {category:"SPORT", value:0, question:"Durante la festa al Quirinale per i campioni Azzurri Napolitano ha fatto una carezza sul petto a...", answers:["Gigi Buffon", "Marco Materazzi", "Luca Toni", "Gennaro Gattuso"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {category:"ARTE E LETTERATURA", value:0, question:"Quale famoso personaggio \"fu concepito\" durante la luna di miele del suo autore?", answers:["Harry Potter", "Peter Pan", "James Bond", "Montalbano"], correctAnswer:2, givenAnswer:-1, timeBonus:0}, {category:"SPETTACOLO", value:0, question:"Quale personaggio pubblico fu il primo a indossare un paio di blue jeans, nell'Italia fine anni '50?", answers:["Lucio Battisti", "Pier Paolo Pasolini", "Gianni Agnelli", "Renzo Arbore"], correctAnswer:2, givenAnswer:-1, timeBonus:0}];
public function Config(_arg1:Object){
timeStep = (1 / tickRate);
soundManager = new SoundManager();
musicManager = new SoundManager();
gameDataSeed = (1 + (Math.random() * 99999999));
gameDataOpenGame = (isRai) ? 0 : 1;
selfcontaining = _arg1["selfcontaining"];
super(getLocalGameData, getHandlerModel, getLocalRequestHandler, _arg1);
}
private function getLocalGameData():String{
var _local1 = (((("REGISTRANDOTI VERRAI REINDIRIZZATO SU <a href=\"" + kingLink) + "\">WWW.KING.COM</a>, IL SITO DI SKILL GAMES PIU’ FAMOSO IN ITALIA E NEL MONDO. RAI E KING.COM PROMUOVONO IL <a href=\"") + responsibleGamingLink) + "\">GIOCO RESPONSABILE</a>: DIVERTITI IN PIENA SICUREZZA E SENZA ECCESSI!");
var _local2:XML = new XML((((((("<gamedata randomseed=\"" + ??esc_xattr
) + "\">\r\n\t\t\t\r\n\t\t\t\t") + (("<opengame>" + ??esc_xelem
) + "</opengame>")) + "\r\n\t\t\t\t<timelimit>0</timelimit>\r\n\t\t\t\t\r\n\t\t\t\t<firstgame>0</firstgame>\r\n\t\t\t\t<sound>1</sound>\r\n\t\t\t\t<music>1</music>\r\n\t\t\t\t\r\n\t\t\t\t<text id=\"network_delay\">Connessione al server</text>\r\n\t\t\t\t\r\n\t\t\t\t<text id=\"inst_header\">Gioca a L'eredità!</text>\r\n\t\t\t\t<text id=\"inst_instructions\">Rispondi alle domande e guadagna denaro durante Il Duello. Batti il computer per accedere a La Ghigliottina dove potrai scegliere una delle due parole che ti verranno offerte. Se sceglierai la parola sbagliata il tuo denaro verrà dimezzato. Dopo aver scelto cinque parole dovrai indovinare la parola che le collega tutte quante.</text>\r\n\t\t\t\t<text id=\"inst_countdown\">Il gioco inizia tra {0} secondi</text>\r\n\t\t\t\t\r\n\t\t\t\t<text id=\"game_player_label\">Giocatore</text>\r\n\t\t\t\t<text id=\"game_opponent_label\">Avversario</text>\r\n\t\t\t\t<text id=\"game_duello_win\">Congratulazioni! Ti sei qualificato per \"La Ghigliottina\"!</text>\r\n\t\t\t\t<text id=\"game_duello_loss\">Il tuo punteggio è più basso di quello del tuo avversario, non ti sei qualificato per La Ghigliottina</text>\r\n\t\t\t\t<text id=\"game_finalword_instructions\">Immetti la parola che secondo te collega queste cinque parole insieme e premi Enter per inviarla. Hai tre possibilità per indovinare la parola giusta.</text>\r\n\t\t\t\t<text id=\"game_finalword_last_wrong\">Hai fatto tre errori e non hai più tentativi a disposizione</text>\r\n\t\t\t\t<text id=\"game_finalword_correct\">Congratulazioni! Hai indovinato la parola giusta!</text>\r\n\t\t\t\t\r\n\t\t\t\t<text id=\"rslt_win\">Risultati gioco</text>\r\n\t\t\t\t<text id=\"rslt_loss\">Risultati gioco</text>\r\n\t\t\t\t<text id=\"rslt_score\">Punteggio</text>\r\n\t\t\t\t<text id=\"rslt_timebonus\">Bonus tempo</text>\r\n\t\t\t\t<text id=\"rslt_totalscore\">Punteggio Totale</text>\r\n\t\t\t\t<text id=\"rslt_countdown\">Il gioco termina tra {0} secondi</text>\r\n\t\t\t\t\r\n\t\t\t\t<text id=\"register_header\">Game Over</text>\r\n\t\t\t\t<text id=\"register_desc\">Registrati per giocare alla versione completa!</text>\r\n\t\t\t\t\r\n\t\t\t\t<text id=\"register_extern_head0\">Registrati subito per continuare a giocare</text>\r\n\t\t\t\t<text id=\"register_extern_head1\">e vincere fantastici premi in denaro!</text>\r\n\t\t\t\t<text id=\"register_extern_signup\">REGISTRATI</text>\r\n\t\t\t\t<text id=\"register_extern_playnow\">Gioca ancora</text>\r\n\t\t\t\t") + (("<text id=\"register_extern_legal\">" + ??esc_xelem
) + "</text>")) + "\r\n\t\t\t\t\r\n\t\t\t</gamedata>"));
return (_local2.toString());
}
private function getOpenGameQuestions():Array{
var _local3:Array;
var _local4:int;
var _local5:int;
var _local6:Object;
var _local1:MtRandom = new MtRandom(gameDataSeed);
var _local2:Array = new Array();
_local3 = getRandoms(_local1, 4, a.length);
for each (_local4 in _local3) {
_local2.push(a[_local4]);
};
_local3 = getRandoms(_local1, 2, b.length);
for each (_local4 in _local3) {
_local2.push(b[_local4]);
};
_local2.push(c[_local1.nextInt(c.length)]);
_local2.push(d[_local1.nextInt(d.length)]);
_local2[0].value = 10000;
_local2[1].value = 20000;
_local2[2].value = 20000;
_local2[3].value = 20000;
_local2[4].value = 30000;
_local2[5].value = 30000;
_local2[6].value = 40000;
_local2[7].value = 50000;
_local4 = 0;
while (_local4 < 8) {
_local5 = _local1.nextInt(8);
if (_local4 != _local5){
_local6 = _local2[_local4];
_local2[_local4] = _local2[_local5];
_local2[_local5] = _local6;
};
_local4++;
};
return (_local2);
}
private function getOpenGameWordPairs():Array{
var _local1:MtRandom = new MtRandom(gameDataSeed);
return (openGameWordPairs3[_local1.nextInt(openGameWordPairs3.length)]);
}
private function getWordPairs():Array{
return ([{words:["PARTIRE", "VIAGGIARE"], correctAnswer:0, givenAnswer:-1, timeBonus:0}, {words:["LEGGERO", "leggenda"], correctAnswer:0, givenAnswer:-1, timeBonus:0}, {words:["proprieta'", "proprio"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {words:["mari", "pari"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {words:["REGOLA", "regolamento"], correctAnswer:0, givenAnswer:-1, timeBonus:0}, {correctAnswer:"VANTAGGIO"}]);
}
private function getLocalRequestHandler():Object{
if (selfcontaining){
return (new RequestHandler(getOpenGameQuestions, getOpenGameWordPairs, !((gameDataOpenGame == 0))));
};
return (new RequestHandler(getQuestions, getWordPairs, !((gameDataOpenGame == 0))));
}
private function getQuestions():Array{
return ([{category:"CURIOSITA'", value:30000, question:"Secondo un mito australiano, il primo \"boomerang\" era una costola che fu donata all'uomo dal dio-serpente...", answers:["Tommi-Tommi", "Bobbi-Bobbi", "Patti-Patti", "Willi-Willi"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {category:"SPETTACOLO", value:20000, question:"Chi di loro, da chierichetto, prese un ceffone dal prete perché \"dava spettacolo\" durante la messa?", answers:["Franco Franchi", "Ugo Tognazzi", "Alberto Sordi", "Marcello Mastroianni"], correctAnswer:2, givenAnswer:-1, timeBonus:0}, {category:"STORIA", value:40000, question:"Per tutto l''800, cosa era tradizione tenere nei giardini della Casa Bianca, residenza del Presidente degli Stati Uniti?", answers:["Spaventapasseri", "Piante di tabacco", "Mucca al pascolo", "Tiro a segno"], correctAnswer:2, givenAnswer:-1, timeBonus:0}, {category:"GEOGRAFIA", value:50000, question:"Nel 1709, per la prima e unica volta, si poté attraversare il lago di Garda...", answers:["Volandoci sopra", "Su un ponte", "A cavallo", "Navigando sott'acqua"], correctAnswer:2, givenAnswer:-1, timeBonus:0}, {category:"ITALIANO", value:10000, question:"Parlando di consonanti doppie, quale di queste parole non è scritta in modo corretto?", answers:["Collutorio", "Ietatore", "Acchito", "Ozio"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {category:"SCIENZA", value:30000, question:"L'\"erba spaccapietre\" è un rimedio naturale che aiuta a combattere quale disturbo della salute?", answers:["Artrosi cervicale", "Carie dentaria", "Calcoli renali", "Herpes labiale"], correctAnswer:2, givenAnswer:-1, timeBonus:0}, {category:"ANIMALI", value:20000, question:"Circa 60 milioni di anni fa viveva sulla Terra il \"Titanoboa Cerrejonensis\". Di che animale si trattava?", answers:["Rana a due teste", "Serpente di una tonnellata", "Aquila vegetariana", "Orso senza denti"], correctAnswer:1, givenAnswer:-1, timeBonus:0}, {category:"CURIOSITA'", value:20000, question:"Cosa si può fare con un paio di \"ciaspole\" ai piedi?", answers:["Camminare sulla neve", "Nuotare più velocemente", "Ballare sulle punte", "Non sporcare i pavimenti"], correctAnswer:0, givenAnswer:-1, timeBonus:0}]);
}
private function getRandoms(_arg1:MtRandom, _arg2:int, _arg3:int):Array{
var _local5:int;
var _local4:Array = new Array();
while (_arg2 > _local4.length) {
_local5 = _arg1.nextInt(_arg3);
if (-1 == _local4.indexOf(_local5)){
_local4.push(_local5);
};
};
return (_local4);
}
private function getHandlerModel():Class{
return (ProxyModel);
}
}
}//package com.midasplayer.games.leredita
Section 22
//DuelloView (com.midasplayer.games.leredita.DuelloView)
package com.midasplayer.games.leredita {
import flash.events.*;
import com.midasplayer.game.framework.*;
import de.polygonal.ds.*;
import com.midasplayer.messaging.*;
import flash.display.*;
import com.midasplayer.sound.*;
import flash.text.*;
import com.midasplayer.util.*;
import sfx.*;
public class DuelloView extends TaskManager {
private var started:Boolean;// = false
private var tiles:Array;
private var selectedTileIndex:int;
private var outputQueue:Queue;
private var answersOriginalYPos:Array;
private var model:ViewModel;
private var dispatcher:MsgDispatcher;
private var countdown:Boolean;// = false
private var countdownStart:Number;
private var config:Config;
private var userInput:Queue;
public var quitClicked:Boolean;// = false
private var countdownLast:Number;
private var inputQueue:Queue;
private var melody:ManagedSound;
public var finished:Boolean;// = false
private var answers:Array;
private var duello:MovieClip;
private var introMelody:ManagedSound;
private var countdownLength:Number;
public function DuelloView(_arg1:Config, _arg2:Queue, _arg3:Queue, _arg4:ViewModel){
var i:int;
var tile:MovieClip;
var answer:MovieClip;
var config = _arg1;
var inputQueue = _arg2;
var outputQueue = _arg3;
var model = _arg4;
dispatcher = new MsgDispatcher();
userInput = new LinkedQueue();
super();
this.config = config;
this.inputQueue = inputQueue;
this.outputQueue = outputQueue;
this.model = model;
duello = model.mainGraphics.duello;
tiles = [duello.tile0, duello.tile1, duello.tile2, duello.tile3, duello.tile4, duello.tile5, duello.tile6, duello.tile7];
answers = [duello.answer0, duello.answer1, duello.answer2, duello.answer3];
answersOriginalYPos = [answers[0].clip.field.y, answers[1].clip.field.y, answers[2].clip.field.y, answers[3].clip.field.y];
i = 0;
while (i < 8) {
tile = MovieClip(tiles[i]);
tile.mouseChildren = true;
tile.hitSprite.mouseEnabled = true;
tile.hitSprite.addEventListener(MouseEvent.MOUSE_OVER, function (_arg1:MouseEvent):void{
userInput.enqueue({state:ViewModel.STATE_QUESTION_SELECTION, handler:onQuestionMouseOver, args:[_arg1]});
});
tile.hitSprite.addEventListener(MouseEvent.MOUSE_OUT, function (_arg1:MouseEvent):void{
userInput.enqueue({state:ViewModel.STATE_QUESTION_SELECTION, handler:onQuestionMouseOut, args:[_arg1]});
});
tile.hitSprite.addEventListener(MouseEvent.CLICK, function (_arg1:MouseEvent):void{
userInput.enqueue({state:ViewModel.STATE_QUESTION_SELECTION, handler:onQuestionSelected, args:[new Message(MsgTypes.questionSelected, {index:getTileIndex(_arg1.target)})]});
});
i = (i + 1);
};
i = 0;
while (i < 4) {
answer = MovieClip(answers[i]);
answer.addEventListener(MouseEvent.MOUSE_OVER, function (_arg1:MouseEvent):void{
userInput.enqueue({state:ViewModel.STATE_ANSWER_SELECTION, handler:onAnswerMouseOver, args:[_arg1]});
});
answer.addEventListener(MouseEvent.MOUSE_OUT, function (_arg1:MouseEvent):void{
userInput.enqueue({state:ViewModel.STATE_ANSWER_SELECTION, handler:onAnswerMouseOut, args:[_arg1]});
});
answer.addEventListener(MouseEvent.CLICK, function (_arg1:MouseEvent):void{
userInput.enqueue({state:ViewModel.STATE_ANSWER_SELECTION, handler:onAnswerSelected, args:[_arg1]});
});
i = (i + 1);
};
model.mainGraphics.quitButton.addEventListener(MouseEvent.MOUSE_OVER, onQuitOver);
model.mainGraphics.quitButton.addEventListener(MouseEvent.MOUSE_OUT, onQuitOut);
model.mainGraphics.quitButton.addEventListener(MouseEvent.CLICK, onQuitClick);
dispatcher.addMsgListener(MsgTypes.categories, onCategories);
dispatcher.addMsgListener(MsgTypes.countdownUpdate, onCountdownUpdate);
dispatcher.addMsgListener(MsgTypes.timelimitHit, onTimelimitHit);
dispatcher.addMsgListener(MsgTypes.timeBonus, onTimeBonus);
dispatcher.addMsgListener(MsgTypes.questionSelected, onQuestionSelected);
dispatcher.addMsgListener(MsgTypes.question, onQuestion);
dispatcher.addMsgListener(MsgTypes.questionAnswerResponse, onQuestionAnswerResponse);
}
private function enableQuestionSelection():void{
duello.mouseChildren = true;
model.state = ViewModel.STATE_QUESTION_SELECTION;
var _local1:int;
while (_local1 < 8) {
if (-1 == model.answeredQuestions.indexOf(_local1)){
tiles[_local1].hitSprite.visible = true;
};
_local1++;
};
}
private function onQuestionMouseOut(_arg1:MouseEvent):void{
var _local2:int = getTileIndex(_arg1.target);
tiles[_local2].gotoAndStop("selectable");
}
private function animateOutQuestion():void{
var _local1:Number = currentTick;
model.activeAnimations.push(new Animation(duello.question, "out_begin", "out_end", _local1, {frameRate:(24 / config.tickRate)}));
model.activeAnimations.push(new Animation(duello.questionValue, "out_begin", "out_end", _local1, {frameRate:(24 / config.tickRate)}));
var _local2:int;
while (_local2 < 4) {
model.activeAnimations.push(new Animation(answers[_local2], (model.answerStates[_local2] + "_out_begin"), (model.answerStates[_local2] + "_out_end"), _local1, {frameRate:(24 / config.tickRate), onComplete:((_local2 == 3)) ? animateContractTile : null, onCompleteArgs:((_local2 == 3)) ? [tiles[model.selectedQuestion]] : null}));
_local2++;
};
model.mainGraphics.clock.text = "00:00";
model.mainGraphics.timeBar.gotoAndStop("end");
}
private function getTileIndex(_arg1:Object):int{
var _local2:int;
while (_local2 < 8) {
if ((((_arg1 == tiles[_local2])) || ((_arg1.parent == tiles[_local2])))){
return (_local2);
};
_local2++;
};
return (0);
}
private function startCountDown():void{
countdownStart = currentTick;
countdownLength = (config.instructionsCountdownLength * config.tickRate);
countdownLast = countdownLength;
countdown = true;
duello.stage.addEventListener(MouseEvent.CLICK, onStageClick);
}
private function animateRaiseTile(_arg1:MovieClip, _arg2:Function=null, _arg3:Array=null):void{
model.activeAnimations.push(new Animation(_arg1, "slide_back_end", "slide_back_begin", currentTick, {frameRate:(24 / config.tickRate), onComplete:_arg2, onCompleteArgs:_arg3}));
}
private function onCountdownUpdate(_arg1:Message):void{
if ((((model.state == ViewModel.STATE_QUESTION_SELECTION)) || ((model.state == ViewModel.STATE_ANSWER_SELECTION)))){
setClock(_arg1.remaining);
};
}
private function animateGoldBar():void{
var field:TextField;
var begin = "begin";
var end = "end";
field = duello.opponentScore.clip.field;
if (model.answeredCorrectly){
begin = "end";
end = "begin";
field = duello.playerScore.clip.field;
};
config.soundManager.getFromClass(goldBar).play(config.goldBarVol);
duello.goldBar.clip.field.text = ((0.001 * model.questionValues[model.selectedQuestion]) + ".000");
model.activeAnimations.push(new Animation(duello.goldBar, begin, end, currentTick, {frameRate:(30 / config.tickRate), onComplete:function ():void{
var _local4:*;
var _local5:*;
config.soundManager.getFromClass(scoreUpdate).play(config.scoreUpdateVol);
var _local1:* = new Array();
var _local2:* = (model.answeredCorrectly) ? model.playerScore : model.opponentScore;
var _local3:* = _local2;
while (_local3 <= (_local2 + model.questionValues[model.selectedQuestion])) {
_local1.push(((0.001 * _local3) + ".000"));
_local3 = (_local3 + 1000);
};
if (model.answeredCorrectly){
model.playerScore = (model.playerScore + model.questionValues[model.selectedQuestion]);
} else {
model.opponentScore = (model.opponentScore + model.questionValues[model.selectedQuestion]);
};
if (((config.openGame) && (((8 - config.openGameQuestionLimit) == model.unansweredQuestions.length)))){
model.activeAnimations.push(new TextTween(field, currentTick, (0.75 * config.tickRate), _local1));
model.mainGraphics.quitButton.mouseEnabled = false;
finished = true;
} else {
if (0 == model.unansweredQuestions.length){
model.activeAnimations.push(new TextTween(field, currentTick, (0.75 * config.tickRate), _local1, {onComplete:showScoreBrick}));
} else {
model.activeAnimations.push(new TextTween(field, currentTick, (0.75 * config.tickRate), _local1));
_local4 = model.unansweredQuestions.pop();
animateRaiseTile(tiles[_local4], enableQuestionSelection);
for each (_local5 in model.unansweredQuestions) {
animateRaiseTile(tiles[_local5]);
};
model.unansweredQuestions.push(_local4);
};
};
}}));
}
private function onAnswerMouseOut(_arg1:MouseEvent):void{
var _local2:int = getAnswerIndex(_arg1.target);
answers[_local2].gotoAndStop("selectable");
}
private function onStageClick(_arg1:MouseEvent):void{
if (MainView.buttonsPressed){
return;
};
duello.stage.removeEventListener(MouseEvent.CLICK, onStageClick);
countdown = false;
animateOutInstructions();
}
private function updateAnimations():void{
var _local1:Tween;
var _local2:Array = new Array();
for each (_local1 in model.activeAnimations) {
_local1.update(currentTick);
if (_local1.finished){
_local2.push(_local1);
};
};
for each (_local1 in _local2) {
model.activeAnimations.splice(model.activeAnimations.indexOf(_local1), 1);
};
}
private function animateLowerTile(_arg1:MovieClip):void{
_arg1.gotoAndStop("slide_back_begin");
model.activeAnimations.push(new Animation(_arg1, "slide_back_begin", "slide_back_end", currentTick, {frameRate:(24 / config.tickRate)}));
}
private function onAnswerMouseOver(_arg1:MouseEvent):void{
var _local2:int = getAnswerIndex(_arg1.target);
answers[_local2].gotoAndStop("mouse_over");
}
private function setCategoryStringInExpanded(_arg1:int, _arg2:String):void{
var _local3:TextField = tiles[_arg1].categoryExpanded.field;
var _local4:String = _arg2.toUpperCase();
_local3.text = _local4;
var _local5:TextFormat = _local3.getTextFormat();
while (218 < _local3.textWidth) {
_local5.size = (Number(_local5.size) - 1);
_local3.setTextFormat(_local5);
_local3.y = (_local3.y + 0.5);
};
_local3.y = Math.round(_local3.y);
}
private function onQuitOut(_arg1:MouseEvent):void{
model.mainGraphics.quitButton.gotoAndStop(1);
}
private function onTimelimitHit(_arg1:Message):void{
var _local2:int;
config.soundManager.getFromClass(timelimitHit).play(config.timelimitHitVol);
model.mainGraphics.clock.text = "00:00";
model.mainGraphics.timeBar.gotoAndStop("end");
if (model.state == ViewModel.STATE_QUESTION_SELECTION){
disableQuestionSelection();
for each (_local2 in model.unansweredQuestions) {
tiles[_local2].gotoAndStop("selectable");
};
} else {
if (model.state == ViewModel.STATE_ANSWER_SELECTION){
disableAnswerSelection();
model.selectedAnswer = -1;
_local2 = 0;
while (_local2 < 4) {
answers[_local2].gotoAndStop("selectable");
_local2++;
};
};
};
}
private function animateTilesFlippingIn():void{
var tile:MovieClip;
var showCategoryFrame:int;
var delay:Number;
model.mainGraphics.clock.visible = true;
model.mainGraphics.timeBar.visible = true;
config.soundManager.getFromClass(tileReveal).play(0.8);
var introVideoBegin:int = getLabelFrame("begin", duello.tilesIntro);
var startTick:int = (currentTick + (config.tilesIntroDelay * config.tickRate));
model.activeAnimations.push(new Animation(duello.tilesIntro, introVideoBegin, "end", startTick, {frameRate:(24 / config.tickRate), onComplete:function ():void{
duello.tilesIntro.visible = false;
duello.playerScore.clip.field.text = "0";
duello.playerScore.opponent.visible = false;
duello.playerScore.player.field.text = config.displayStrings("game_player_label").toUpperCase();
duello.opponentScore.clip.field.text = "0";
duello.opponentScore.player.visible = false;
duello.opponentScore.opponent.field.text = config.displayStrings("game_opponent_label").toUpperCase();
model.activeAnimations.push(new Animation(duello.playerScore, "in_begin", "in_end", currentTick, {frameRate:(24 / config.tickRate)}));
model.activeAnimations.push(new Animation(duello.opponentScore, "in_begin", "in_end", currentTick, {frameRate:(24 / config.tickRate)}));
enableQuestionSelection();
model.mainGraphics.quitButton.visible = true;
model.mainGraphics.quitButton.mouseEnabled = true;
}}));
var i:int;
while (i < 8) {
tile = MovieClip(tiles[i]);
showCategoryFrame = (getLabelFrame(("show" + i), duello.tilesIntro) - introVideoBegin);
delay = ((showCategoryFrame / 24) * config.tickRate);
model.activeAnimations.push(new Animation(tile, "tile_intro_begin", "tile_intro_end", (startTick + delay), {frameRate:(24 / config.tickRate), onStart:function (_arg1:MovieClip):void{
_arg1.visible = true;
}, onStartArgs:[tile]}));
i = (i + 1);
};
}
private function animateInInstructions():void{
duello.visible = true;
model.mainGraphics.infoPanel.visible = true;
model.mainGraphics.infoPanel.instructions.visible = true;
model.mainGraphics.infoPanel.header.visible = true;
model.mainGraphics.infoPanel.scoreLabel.visible = false;
model.mainGraphics.infoPanel.timeBonusLabel.visible = false;
model.mainGraphics.infoPanel.totalScoreLabel.visible = false;
model.mainGraphics.infoPanel.score.visible = false;
model.mainGraphics.infoPanel.timeBonus.visible = false;
model.mainGraphics.infoPanel.totalScore.visible = false;
model.mainGraphics.infoPanel.legalImage.visible = false;
model.mainGraphics.infoPanel.header.field.text = config.displayStrings("inst_header").toUpperCase();
model.mainGraphics.infoPanel.instructions.field.text = config.displayStrings("inst_instructions").toUpperCase();
model.mainGraphics.infoPanel.counter.field.text = config.displayStrings("inst_countdown", config.instructionsCountdownLength).toUpperCase();
model.mainGraphics.infoPanel.visible = true;
model.activeAnimations.push(new Animation(model.mainGraphics.infoPanel, "large_in_begin", "instructions_in_begin", currentTick, {frameRate:(24 / config.tickRate), onStart:function ():void{
config.soundManager.getFromClass(showQuestion).play(config.showQuestionVol);
}, onComplete:function ():void{
model.activeAnimations.push(new Animation(model.mainGraphics.infoPanel, "instructions_in_end", "large_in_end", currentTick, {frameRate:(24 / config.tickRate), onComplete:startCountDown}));
}}));
}
private function showScoreBrick():void{
duello.scoreBrick.visible = true;
if (0 == model.playerScore){
duello.scoreBrick.field.text = "0";
} else {
duello.scoreBrick.field.text = ((0.001 * model.playerScore) + ".000");
};
var result = (110000 < model.playerScore);
if (result){
melody.fadeToAndStop(0, 300);
config.soundManager.getFromClass(duelloVictory).play();
} else {
melody.fadeTo(0.6, 1500);
};
if (!config.openGame){
model.mainGraphics.infoPanel.visible = true;
model.mainGraphics.infoPanel.small_header.visible = true;
model.mainGraphics.infoPanel.header.visible = false;
model.mainGraphics.infoPanel.scoreLabel.visible = false;
model.mainGraphics.infoPanel.timeBonusLabel.visible = false;
model.mainGraphics.infoPanel.totalScoreLabel.visible = false;
model.mainGraphics.infoPanel.score.visible = false;
model.mainGraphics.infoPanel.timeBonus.visible = false;
model.mainGraphics.infoPanel.totalScore.visible = false;
model.mainGraphics.infoPanel.legalImage.visible = false;
model.mainGraphics.infoPanel.small_header.field.text = config.displayStrings((result) ? "game_duello_win" : "game_duello_loss").toUpperCase();
model.activeAnimations.push(new Animation(model.mainGraphics.infoPanel, "small_in_begin", "small_in_end", currentTick, {frameRate:(24 / config.tickRate)}));
};
var brickTime:Number = (config.scoreBrickTime * (result) ? 1 : 0.5);
model.activeAnimations.push(new FadePulseTween(duello.scoreBrick, currentTick, (brickTime * config.tickRate), {lowScale:0.92, highScale:1.02, speed:0.175, onComplete:function ():void{
if (!config.openGame){
model.activeAnimations.push(new Animation(model.mainGraphics.infoPanel, "small_out_begin", "small_out_end", currentTick, {frameRate:(24 / config.tickRate), onComplete:function ():void{
model.mainGraphics.infoPanel.visible = false;
model.mainGraphics.quitButton.mouseEnabled = false;
finished = true;
}}));
} else {
model.mainGraphics.quitButton.mouseEnabled = false;
finished = true;
};
}}));
}
private function onQuestionSelected(_arg1:Message):void{
disableQuestionSelection();
model.selectedQuestion = _arg1.index;
model.state = ViewModel.STATE_QUESTION_SELECTED;
tiles[model.selectedQuestion].gotoAndStop("selected");
outputQueue.enqueue(new Message(MsgTypes.questionRequest, {index:model.selectedQuestion}));
config.soundManager.getFromClass(tileSelect).play();
}
private function onQuestionMouseOver(_arg1:MouseEvent):void{
var _local2:int = getTileIndex(_arg1.target);
tiles[_local2].gotoAndStop("mouse_over");
}
private function handleGameUpdates():void{
while (((!(finished)) && (!(inputQueue.isEmpty())))) {
dispatcher.dispatchMessage(Message(inputQueue.dequeue()));
};
}
private function onIntroClick(_arg1:MouseEvent):void{
if (MainView.buttonsPressed){
return;
};
duello.stage.removeEventListener(MouseEvent.CLICK, onIntroClick);
model.mainGraphics.introVideo.visible = false;
model.mainGraphics.introVideo.alpha = 1;
model.mainGraphics.removeChild(model.mainGraphics.introVideo);
duello.visible = true;
duello.alpha = 1;
introMelody.stop();
model.activeAnimations.pop();
animateInInstructions();
}
private function disableQuestionSelection():void{
duello.mouseChildren = false;
model.state = ViewModel.STATE_NO_INPUT;
var _local1:int;
while (_local1 < 8) {
tiles[_local1].hitSprite.visible = false;
_local1++;
};
}
private function animateIntroVideo():void{
var introVideoEnd:int;
var introVideoFadeBegin:int;
var introVideoFadeLength:int;
introMelody = config.musicManager.getFromClass(intro);
introMelody.play(config.introMelodyVol, 0, function ():void{
melody = config.musicManager.getFromClass(duello);
melody.loop(0);
melody.fadeTo(config.duelloMelodyVol, 1000);
});
model.mainGraphics.introVideo.visible = true;
introVideoEnd = getLabelFrame("end", model.mainGraphics.introVideo);
introVideoFadeBegin = getLabelFrame("fade_begin", model.mainGraphics.introVideo);
introVideoFadeLength = (introVideoEnd - introVideoFadeBegin);
model.activeAnimations.push(new Animation(model.mainGraphics.introVideo, "begin", introVideoEnd, currentTick, {frameRate:(24 / config.tickRate), onUpdate:function ():void{
if (introVideoFadeBegin > model.mainGraphics.introVideo.currentFrame){
return;
};
var _local1:* = ((introVideoEnd - model.mainGraphics.introVideo.currentFrame) / introVideoFadeLength);
model.mainGraphics.introVideo.alpha = _local1;
duello.visible = true;
duello.alpha = (1 - _local1);
}, onComplete:function ():void{
duello.stage.removeEventListener(MouseEvent.CLICK, onIntroClick);
model.mainGraphics.introVideo.visible = false;
model.mainGraphics.introVideo.alpha = 1;
model.mainGraphics.removeChild(model.mainGraphics.introVideo);
duello.alpha = 1;
animateInInstructions();
}}));
duello.stage.addEventListener(MouseEvent.CLICK, onIntroClick);
}
private function setCategoryString(_arg1:int, _arg2:String):void{
var _local8:TextFormat;
var _local9:int;
var _local10:String;
var _local11:int;
var _local12:int;
var _local13:int;
var _local14:int;
var _local3:Array = [0, 1, 1, 2, 2, 3, 3, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9];
var _local4:Array = [1, 2, 3, 4, 5, 6, 6, 7, 8, 9, 10, 12, 13, 14, 15, 16, 18, 19, 20, 21];
var _local5:TextField = tiles[_arg1].category.field;
var _local6:String = _arg2.toUpperCase();
_local5.text = _local6;
var _local7:Number = ((_arg1 < 4)) ? 111 : 117;
if (_local7 < _local5.textWidth){
if (130 < _local5.textWidth){
_local10 = "";
if (-1 != _local6.search(" ")){
_local10 = " ";
} else {
if (-1 != _local6.search("-")){
_local10 = "-";
};
};
if (_local10.length){
_local11 = Math.ceil((0.5 * _local6.length));
_local12 = _local11;
_local13 = _local11;
while ((((0 < _local12)) && ((_local13 < _local6.length)))) {
if (_local10 == _local6.charAt(_local12)){
_local14 = _local12;
break;
};
if (_local10 == _local6.charAt(_local13)){
_local14 = _local13;
break;
};
_local12--;
_local13++;
};
_local6 = ((_local6.substring(0, (_local14 + ((" " == _local10)) ? 0 : 1)) + "\n") + _local6.substring((_local14 + 1)));
_local5.multiline = true;
_local5.text = _local6;
_local5.y = (_local5.y - 16);
};
};
_local8 = _local5.getTextFormat();
_local9 = 0;
while (_local7 < _local5.textWidth) {
_local8.size = (Number(_local8.size) - 1);
_local5.setTextFormat(_local8);
_local9++;
};
if (_local5.multiline){
_local5.y = (_local5.y + _local4[_local9]);
} else {
_local5.y = (_local5.y + _local3[_local9]);
};
};
}
private function animateExpandTile(_arg1:MovieClip, _arg2:Function=null, _arg3:Array=null):void{
var tile = _arg1;
var onComplete = _arg2;
var onCompleteArgs = _arg3;
model.mainGraphics.clock.text = "00:00";
model.mainGraphics.timeBar.gotoAndStop("end");
tile.gotoAndStop("question_flip_begin");
duello.glassWalls.visible = true;
tile.expand.visible = true;
tile.hatch.visible = true;
selectedTileIndex = duello.getChildIndex(tile);
duello.setChildIndex(tile, (duello.numChildren - 1));
var startTick:Number = currentTick;
var startFrame:int = getLabelFrame("question_flip_begin", tile);
model.activeAnimations.push(new Animation(tile, startFrame, "question_flip_end", startTick, {frameRate:(24 / config.tickRate), onComplete:animateInQuestion, onStart:function ():void{
config.soundManager.getFromClass(valueReveal).play(0.7);
}}));
var expandStart:Number = (startTick + (((getLabelFrame("flip_expand_trigger", tile) - startFrame) / 24) * config.tickRate));
model.activeAnimations.push(new Animation(tile.expand, "begin", "end", expandStart, {frameRate:(24 / config.tickRate)}));
var hatchStart:Number = (startTick + (((getLabelFrame("open_hatch_trigger", tile) - startFrame) / 24) * config.tickRate));
model.activeAnimations.push(new Animation(tile.hatch, "begin", "end", hatchStart, {frameRate:(24 / config.tickRate)}));
}
private function getAnswerIndex(_arg1:Object):int{
var _local2:int;
while (_local2 < 4) {
if (_arg1 == answers[_local2]){
return (_local2);
};
_local2++;
};
return (0);
}
private function onAnswerSelected(_arg1:MouseEvent):void{
disableAnswerSelection();
model.selectedAnswer = getAnswerIndex(_arg1.target);
model.activeAnimations.push(new Animation(answers[model.selectedAnswer], "selected_begin", "selected_end", currentTick, {frameRate:(24 / config.tickRate)}));
config.soundManager.getFromClass(answerSelect).play();
outputQueue.enqueue(new Message(MsgTypes.questionAnswer, {index:model.selectedAnswer, timeBonus:0}));
}
private function onTimeBonus(_arg1:Message):void{
var originalX:Number;
var message = _arg1;
model.timeBonus = (model.timeBonus + message.bonus);
model.mainGraphics.timeBonus.visible = true;
originalX = model.mainGraphics.timeBonus.x;
model.mainGraphics.timeBonus.x = (model.mainGraphics.timeBonus.x - 32);
var asString:String = message.bonus.toString();
var bonusClips:Array = [model.mainGraphics.timeBonus.d3, model.mainGraphics.timeBonus.d2, model.mainGraphics.timeBonus.d1, model.mainGraphics.timeBonus.d0];
var args:Object = {frameRate:(24 / config.tickRate), onComplete:function ():void{
model.mainGraphics.timeBonus.visible = false;
model.mainGraphics.timeBonus.x = originalX;
}};
var i:int;
while (i < 4) {
bonusClips[i].clip.field.text = asString.charAt((asString.length - (i + 1)));
if (0 == bonusClips[i].clip.field.text.length){
break;
};
model.mainGraphics.timeBonus.x = (model.mainGraphics.timeBonus.x + 8);
model.activeAnimations.push(new Animation(bonusClips[i], "begin", "end", currentTick, args));
args = {frameRate:(24 / config.tickRate)};
i = (i + 1);
};
}
private function setClock(_arg1:Number):void{
var _local2:Number = Math.round((100 * (_arg1 / config.tickRate)));
var _local3:String = _local2.toString();
while (4 > _local3.length) {
_local3 = ("0" + _local3);
};
model.mainGraphics.clock.text = ((_local3.substring(0, 2) + ":") + _local3.substring(2, 4));
var _local4:Number = 0;
if (model.state == ViewModel.STATE_QUESTION_SELECTION){
_local4 = config.categoryCountdownLength;
} else {
if (model.state == ViewModel.STATE_ANSWER_SELECTION){
_local4 = config.questionCountdownLength;
};
};
var _local5:int = Math.max(1, ((1 - (_arg1 / _local4)) * model.mainGraphics.timeBar.totalFrames));
model.mainGraphics.timeBar.gotoAndStop(_local5);
}
public function update(_arg1:Number):void{
var _local2:Message;
currentTick = _arg1;
if (finished){
return;
};
if (quitClicked){
model.mainGraphics.quitButton.mouseEnabled = false;
duello.mouseChildren = false;
clearTasks();
userInput.clear();
outputQueue.clear();
outputQueue.enqueue(new Message(MsgTypes.quitGame));
_local2 = new Message(MsgTypes.quitGame);
_local2.tick = int(Math.ceil(_arg1));
config.gameComm.addPlayData(_local2.toBinaryPlayData());
while (0 < model.activeAnimations.length) {
model.activeAnimations.pop();
};
model.playerScore = 0;
finished = true;
return;
};
if (!started){
start();
started = true;
};
if (countdown){
updateCountdown();
};
executeTasks();
handleGameUpdates();
handleUserInput();
updateAnimations();
}
private function onQuitOver(_arg1:MouseEvent):void{
model.mainGraphics.quitButton.gotoAndStop(2);
}
private function onQuitClick(_arg1:MouseEvent):void{
quitClicked = true;
}
private function onCategories(_arg1:Message):void{
var _local2:int;
while (_local2 < 8) {
setCategoryString(_local2, _arg1[("names" + _local2)]);
setCategoryStringInExpanded(_local2, _arg1[("names" + _local2)]);
tiles[_local2].value.field.text = ((0.001 * _arg1[("values" + _local2)]) + ".000");
model.questionValues.push(_arg1[("values" + _local2)]);
_local2++;
};
animateTilesFlippingIn();
}
private function animateContractTile(_arg1:MovieClip):void{
var tile = _arg1;
tile.gotoAndStop("question_flip_end");
tile.expand.visible = true;
tile.expand.gotoAndStop("end");
tile.hatch.visible = true;
tile.hatch.gotoAndStop("end");
var startTick:Number = currentTick;
model.activeAnimations.push(new Animation(tile, "question_flip_end", "question_flip_begin", startTick, {frameRate:(24 / config.tickRate), onComplete:function ():void{
duello.setChildIndex(tile, selectedTileIndex);
animateFadeTile(tile);
}}));
model.activeAnimations.push(new Animation(tile.expand, "end", "begin", startTick, {frameRate:(24 / config.tickRate)}));
model.activeAnimations.push(new Animation(tile.hatch, "end", "begin", startTick, {frameRate:(24 / config.tickRate)}));
}
private function start():void{
animateIntroVideo();
}
private function animateFadeTile(_arg1:MovieClip):void{
model.activeAnimations.push(new Animation(_arg1, "deactivate_begin", "deactivate_end", currentTick, {frameRate:(24 / config.tickRate), onComplete:animateGoldBar}));
}
private function onQuestion(_arg1:Message):void{
var _local3:int;
var _local4:TextField;
var _local5:TextFormat;
duello.question.clip.field.text = _arg1.question.toUpperCase();
var _local2:Array = [_arg1.answers0.toUpperCase(), _arg1.answers1.toUpperCase(), _arg1.answers2.toUpperCase(), _arg1.answers3.toUpperCase()];
_local3 = 0;
while (_local3 < 4) {
_local4 = answers[_local3].clip.field;
_local4.text = _local2[_local3];
_local4.y = answersOriginalYPos[_local3];
if (290 < _local4.textWidth){
_local5 = _local4.getTextFormat();
do {
_local5.size = (Number(_local5.size) - 1);
_local4.setTextFormat(_local5);
_local4.y = (_local4.y + 0.5);
} while (290 < _local4.textWidth);
_local4.y = Math.round(_local4.y);
};
_local3++;
};
_local3 = 0;
while (_local3 < 8) {
if (_local3 == model.selectedQuestion){
animateExpandTile(MovieClip(tiles[_local3]));
} else {
if (-1 == model.answeredQuestions.indexOf(_local3)){
animateLowerTile(MovieClip(tiles[_local3]));
};
};
_local3++;
};
}
private function disableAnswerSelection():void{
duello.mouseChildren = false;
model.state = ViewModel.STATE_ANSWER_SELECTED;
var _local1:int;
while (_local1 < 4) {
answers[_local1].mouseEnabled = false;
_local1++;
};
}
private function updateCountdown():void{
var _local1:Number = (countdownLength - (currentTick - countdownStart));
if (0 < _local1){
if (_local1 != countdownLast){
model.mainGraphics.infoPanel.counter.field.text = config.displayStrings("inst_countdown", Math.ceil((_local1 / config.tickRate)).toString()).toUpperCase();
countdownLast = _local1;
};
} else {
model.mainGraphics.infoPanel.counter.field.text = config.displayStrings("inst_countdown", "0").toUpperCase();
duello.stage.removeEventListener(MouseEvent.CLICK, onStageClick);
countdown = false;
animateOutInstructions();
};
}
private function enableAnswerSelection():void{
duello.mouseChildren = true;
model.state = ViewModel.STATE_ANSWER_SELECTION;
var _local1:int;
while (_local1 < 4) {
answers[_local1].mouseEnabled = true;
_local1++;
};
}
private function animateInQuestion():void{
var delay:Number;
var startTick:Number = (currentTick + (config.showQuestionDelay * config.tickRate));
model.activeAnimations.push(new Animation(duello.question, "in_begin", "in_end", startTick, {frameRate:(24 / config.tickRate), onStart:function ():void{
config.soundManager.getFromClass(showQuestion).play(config.showQuestionVol);
}}));
duello.questionValue.clip.field.text = ((0.001 * model.questionValues[model.selectedQuestion]) + ".000 €");
model.activeAnimations.push(new Animation(duello.questionValue, "in_begin", "in_end", startTick, {frameRate:(24 / config.tickRate)}));
var i:int;
while (i < 4) {
answers[i].visible = true;
delay = ((config.showAnswersDelay * config.tickRate) + ((i * config.answersDeltaDelay) * config.tickRate));
model.activeAnimations.push(new Animation(answers[i], "in_begin", "in_end", (startTick + delay), {frameRate:(24 / config.tickRate), onStart:function ():void{
config.soundManager.getFromClass(showQuestion).play(config.showQuestionVol);
}, onComplete:((i == 3)) ? enableAnswerSelection : null}));
i = (i + 1);
};
setClock(config.questionCountdownLength);
model.mainGraphics.timeBar.gotoAndStop("begin");
}
private function onQuestionAnswerResponse(_arg1:Message):void{
var animationLabel:String;
var message = _arg1;
model.answeredQuestions.push(model.selectedQuestion);
model.unansweredQuestions.splice(model.unansweredQuestions.indexOf(model.selectedQuestion), 1);
var result = (model.selectedAnswer == message.correctAnswer);
model.answeredCorrectly = result;
model.answerStates = ["neutral", "neutral", "neutral", "neutral"];
if (-1 == model.selectedAnswer){
animateOutQuestion();
return;
};
model.answerStates[message.correctAnswer] = "correct";
if (result){
config.soundManager.getFromClass(answerCorrect).play(config.answerCorrectVol);
animationLabel = "selected_correct";
} else {
config.soundManager.getFromClass(answerWrong).play(config.answerWrongVol);
model.activeAnimations.push(new Animation(answers[message.correctAnswer], "correct_begin", "correct_end", currentTick, {frameRate:(24 / config.tickRate)}));
animationLabel = "wrong";
model.answerStates[model.selectedAnswer] = "wrong";
};
model.activeAnimations.push(new Animation(answers[model.selectedAnswer], (animationLabel + "_begin"), (animationLabel + "_end"), currentTick, {frameRate:(24 / config.tickRate), onComplete:function ():void{
addTask((currentTick + (config.questionOutDelay * config.tickRate)), animateOutQuestion);
}}));
}
private function handleUserInput():void{
var _local1:Object;
while (!(userInput.isEmpty())) {
_local1 = userInput.dequeue();
if (model.state == _local1.state){
_local1.handler.apply(null, _local1.args);
};
};
}
private function animateOutInstructions():void{
if (introMelody){
introMelody.fadeToAndStop(0, 300);
} else {
melody = config.musicManager.getFromClass(duello);
melody.loop(0);
melody.fadeTo(config.duelloMelodyVol, 1000);
};
model.activeAnimations.push(new Animation(model.mainGraphics.infoPanel, "large_out_begin", "large_out_end", currentTick, {frameRate:(24 / config.tickRate), onComplete:function ():void{
duello.legalLogos.visible = false;
duello.legalText.visible = false;
duello.removeChild(duello.legalLogos);
duello.removeChild(duello.legalText);
model.mainGraphics.infoPanel.visible = false;
outputQueue.enqueue(new Message(MsgTypes.categoriesRequest));
}}));
}
}
}//package com.midasplayer.games.leredita
Section 23
//FinalInputField (com.midasplayer.games.leredita.FinalInputField)
package com.midasplayer.games.leredita {
import flash.events.*;
import de.polygonal.ds.*;
import flash.display.*;
import flash.text.*;
import flash.ui.*;
public class FinalInputField extends Sprite {
private var field:TextField;
private var letters:Array;
private var beginString:String;
private var inputHandler:Function;
private var blinkStart:Number;
private var startingInput:Boolean;
private var changed:Boolean;
private var userInput:Queue;
public function FinalInputField(_arg1:Queue, _arg2:Function, _arg3:int, _arg4:String, _arg5:int){
letters = new Array();
field = new TextField();
super();
this.userInput = _arg1;
this.inputHandler = _arg2;
field.type = TextFieldType.INPUT;
field.maxChars = _arg3;
field.restrict = " \\\\!\"#$%&'()*+,\\-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]_`abcdefghijklmnopqrstuvwxyz~€¢£¥ÀÁÈÉÌÍÒÓÙÚàáèéìíòóùú";
field.mouseEnabled = false;
field.doubleClickEnabled = false;
field.mouseWheelEnabled = false;
field.selectable = false;
field.useRichTextClipboard = false;
field.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
field.addEventListener(Event.CHANGE, onFieldChange);
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
addEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
createLetters(_arg3);
startInput(_arg4, _arg5);
}
private function onKeyDown(_arg1:KeyboardEvent):void{
if (field.type == TextFieldType.DYNAMIC){
return;
};
if ((((_arg1.keyCode == Keyboard.ENTER)) || ((_arg1.keyCode == Keyboard.NUMPAD_ENTER)))){
if (field.length == letters.length){
stopInput();
userInput.enqueue({state:ViewModel.STATE_FINALWORD_ENTER, handler:inputHandler, args:[field.text.toLowerCase()]});
};
};
}
public function startInput(_arg1:String, _arg2:int):void{
beginString = _arg1;
blinkStart = _arg2;
changed = false;
startingInput = true;
field.text = beginString;
field.setSelection(field.text.length, field.text.length);
var _local3:int;
while (_local3 < field.length) {
letters[_local3].line.visible = false;
_local3++;
};
update(blinkStart);
field.type = TextFieldType.INPUT;
}
private function resetFocus(_arg1:FocusEvent):void{
stage.focus = field;
}
private function onRemovedFromStage(_arg1:Event):void{
field.removeEventListener(FocusEvent.FOCUS_OUT, resetFocus);
}
public function update(_arg1:Number):void{
if (field.type == TextFieldType.DYNAMIC){
return;
};
var _local2:int;
while (_local2 < field.length) {
letters[_local2].clip.field.text = field.text.charAt(_local2).toUpperCase();
letters[_local2].visible = true;
_local2++;
};
if (_local2 < letters.length){
if (changed){
blinkStart = _arg1;
changed = false;
};
if (startingInput){
letters[_local2].visible = (5 > (Math.floor((_arg1 - blinkStart)) % 10));
} else {
letters[_local2].visible = (5 < (Math.floor((_arg1 - blinkStart)) % 10));
};
var _temp1 = _local2;
_local2 = (_local2 + 1);
letters[_temp1].clip.field.text = "";
};
while (_local2 < letters.length) {
letters[_local2].clip.field.text = "";
letters[_local2].visible = true;
_local2++;
};
}
private function onAddedToStage(_arg1:Event):void{
field.addEventListener(FocusEvent.FOCUS_OUT, resetFocus);
stage.focus = field;
}
private function onFieldChange(_arg1:Event):void{
if (field.text.length < beginString.length){
field.text = beginString;
field.setSelection(field.text.length, field.text.length);
} else {
changed = true;
startingInput = false;
};
}
public function stopInput():void{
update(blinkStart);
field.type = TextFieldType.DYNAMIC;
}
private function createLetters(_arg1:int):void{
var _local3:InputLetter;
var _local2:int;
while (_local2 < _arg1) {
_local3 = new InputLetter();
_local3.x = (Math.round((0.5 * _local3.width)) + (_local2 * Math.round((1 * _local3.width))));
_local3.y = Math.round((0.5 * _local3.height));
_local3.clip.field.text = "";
letters.push(_local3);
this.addChild(_local3);
_local2++;
};
}
}
}//package com.midasplayer.games.leredita
Section 24
//GhigliottinaView (com.midasplayer.games.leredita.GhigliottinaView)
package com.midasplayer.games.leredita {
import flash.events.*;
import com.midasplayer.game.framework.*;
import de.polygonal.ds.*;
import com.midasplayer.messaging.*;
import flash.display.*;
import com.midasplayer.sound.*;
import flash.text.*;
import com.midasplayer.util.*;
import sfx.*;
import flash.external.*;
import flash.filters.*;
public class GhigliottinaView extends TaskManager {
private var started:Boolean;// = false
private var outputQueue:Queue;
private var defaultRegister:Array;
private var altsOriginalYPos:int;
private var defaultReplay:Array;
private var model:ViewModel;
private var activeInputLetter:int;// = 0
private var dispatcher:MsgDispatcher;
private var countdownStart:Number;
private var words:Array;
private var userInput:Queue;
private var countdown:Boolean;// = false
private var config:Config;
private var hoverReplay:Array;
private var ghigliottina:MovieClip;
private var enqueuedTimeBonus:Message;// = null
private var quitClicked:Boolean;// = false
private var inputQueue:Queue;
private var alts:Array;
private var melody:ManagedSound;
public var finished:Boolean;// = false
private var countdownLast:Number;
private var countdownLength:Number;
private var hoverRegister:Array;
public function GhigliottinaView(_arg1:Config, _arg2:Queue, _arg3:Queue, _arg4:ViewModel, _arg5:Boolean=true){
var alt:MovieClip;
var config = _arg1;
var inputQueue = _arg2;
var outputQueue = _arg3;
var model = _arg4;
var activeInput = _arg5;
dispatcher = new MsgDispatcher();
userInput = new LinkedQueue();
defaultRegister = [1.12, 0, 0, 0, 0, 0, 1.12, 0, 0, 0, 0, 0, 1.12, 0, 0, 0, 0, 0, 1, 0];
hoverRegister = [1.24, 0, 0, 0, 0, 0, 1.24, 0, 0, 0, 0, 0, 1.24, 0, 0, 0, 0, 0, 1, 0];
defaultReplay = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0];
hoverReplay = [0.9, 0, 0, 0, 0, 0, 0.9, 0, 0, 0, 0, 0, 0.9, 0, 0, 0, 0, 0, 1, 0];
super();
this.config = config;
this.inputQueue = inputQueue;
this.outputQueue = outputQueue;
this.model = model;
ghigliottina = model.mainGraphics.ghigliottina;
alts = [ghigliottina.alt0, ghigliottina.alt1];
words = [ghigliottina.word0, ghigliottina.word1, ghigliottina.word2, ghigliottina.word3, ghigliottina.word4];
altsOriginalYPos = alts[0].clip.field.y;
if (activeInput){
ghigliottina.mouseChildren = true;
};
var i:int;
while (i < 2) {
alt = MovieClip(alts[i]);
alt.mouseEnabled = true;
alt.addEventListener(MouseEvent.MOUSE_OVER, function (_arg1:MouseEvent):void{
userInput.enqueue({state:ViewModel.STATE_WORDPAIR_SELECTION, handler:onWordPairMouseOver, args:[_arg1]});
});
alt.addEventListener(MouseEvent.MOUSE_OUT, function (_arg1:MouseEvent):void{
userInput.enqueue({state:ViewModel.STATE_WORDPAIR_SELECTION, handler:onWordPairMouseOut, args:[_arg1]});
});
alt.addEventListener(MouseEvent.CLICK, function (_arg1:MouseEvent):void{
userInput.enqueue({state:ViewModel.STATE_WORDPAIR_SELECTION, handler:onWordPairSelected, args:[_arg1]});
});
i = (i + 1);
};
model.mainGraphics.quitButton.addEventListener(MouseEvent.MOUSE_OVER, onQuitOver);
model.mainGraphics.quitButton.addEventListener(MouseEvent.MOUSE_OUT, onQuitOut);
model.mainGraphics.quitButton.addEventListener(MouseEvent.CLICK, onQuitClick);
dispatcher.addMsgListener(MsgTypes.wordPair, onWordPair);
dispatcher.addMsgListener(MsgTypes.countdownUpdate, onCountdownUpdate);
dispatcher.addMsgListener(MsgTypes.timelimitHit, onTimelimitHit);
dispatcher.addMsgListener(MsgTypes.timeBonus, onTimeBonus);
dispatcher.addMsgListener(MsgTypes.wordPairAnswerResponse, onWordPairAnswerResponse);
dispatcher.addMsgListener(MsgTypes.finalWordLength, onFinalWordLength);
dispatcher.addMsgListener(MsgTypes.finalWordAnswerResponse, onFinalWordAnswerResponse);
}
private function onFinalWordAnswerResponse(_arg1:Message):void{
var colorMatrix:Array;
var asString:String;
var message = _arg1;
if (message.result){
colorMatrix = [0.1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0.1, 0, 0, 0, 0, 0, 1, 0];
} else {
colorMatrix = [1, 0, 0, 0, 0, 0, 0.1, 0, 0, 0, 0, 0, 0.1, 0, 0, 0, 0, 0, 1, 0];
};
model.finalInputField.filters = [new ColorMatrixFilter(colorMatrix)];
model.finalWordGuesses++;
if (!message.result){
if (1 == model.finalWordGuesses){
model.playerScore = int(Math.floor(((2 * model.playerScore) / 3)));
} else {
if (2 == model.finalWordGuesses){
model.playerScore = int(Math.floor((model.playerScore / 2)));
} else {
if (3 == model.finalWordGuesses){
model.playerScore = 0;
};
};
};
};
if (message.result){
ghigliottina.panel.statusField.text = config.displayStrings("game_finalword_correct").toUpperCase();
model.mainGraphics.quitButton.mouseEnabled = false;
melody.fadeToAndStop(0, 300);
config.soundManager.getFromClass(answerCorrect).play((config.answerCorrectVol + 0.1));
addTask((currentTick + (0.45 * config.tickRate)), function ():void{
config.soundManager.getFromClass(ghigliottinaVictory).play();
});
config.gameComm.addPlayData(new Message(MsgTypes.gameData, {sound:!((0 == config.soundManager.volume)), music:!((0 == config.musicManager.volume))}).toBinaryPlayData());
config.gameComm.endGame((model.playerScore + model.timeBonus));
addTask((currentTick + (1.7 * config.tickRate)), onResultsTransition, message.result);
} else {
if (3 > model.finalWordGuesses){
config.soundManager.getFromClass(wordWrong).playAt(config.wordWrongVol, 710);
model.state = ViewModel.STATE_FINALWORD_ENTER;
asString = model.playerScore.toString();
if (3 < asString.length){
asString = ((asString.substr(0, (asString.length - 3)) + ".") + asString.substr((asString.length - 3), 3));
};
ghigliottina.score.clip1.field.text = asString;
model.activeAnimations.push(new Animation(ghigliottina.score, "cutoff_begin", "cutoff_end", currentTick, {frameRate:(24 / config.tickRate), onComplete:function ():void{
addTask((currentTick + 6), function ():void{
ghigliottina.score.clip0.field.text = asString;
ghigliottina.score.gotoAndStop("in_end");
model.finalInputField.startInput(message.firstLetter, currentTick);
model.finalInputField.filters = [];
});
}}));
} else {
ghigliottina.panel.statusField.text = config.displayStrings("game_finalword_last_wrong").toUpperCase();
model.mainGraphics.quitButton.mouseEnabled = false;
config.soundManager.getFromClass(wordWrong).playAt(config.wordWrongVol, 710);
melody.fadeTo(0.46, 1200);
config.gameComm.addPlayData(new Message(MsgTypes.gameData, {sound:!((0 == config.soundManager.volume)), music:!((0 == config.musicManager.volume))}).toBinaryPlayData());
config.gameComm.endGame((model.playerScore + model.timeBonus));
ghigliottina.score.clip1.field.text = "0";
model.activeAnimations.push(new Animation(ghigliottina.score, "cutoff_begin", "cutoff_end", currentTick, {frameRate:(24 / config.tickRate), onComplete:function ():void{
addTask((currentTick + (1.15 * config.tickRate)), onResultsTransition, message.result);
}}));
};
};
}
private function onWordPair(_arg1:Message):void{
var message = _arg1;
setPanelField(alts[0].clip.field, message.words0);
setPanelField(alts[1].clip.field, message.words1);
model.activeAnimations.push(new Animation(ghigliottina.alt0, "in_begin", "in_end", currentTick, {frameRate:(24 / config.tickRate), onStart:function ():void{
config.soundManager.getFromClass(showWord).play(config.showWordPairVol);
}}));
model.activeAnimations.push(new Animation(ghigliottina.alt1, "in_begin", "in_end", (currentTick + (0.35 * config.tickRate)), {frameRate:(24 / config.tickRate), onStart:function ():void{
config.soundManager.getFromClass(showWord).play(config.showWordPairVol);
}, onComplete:enableWordPairSelection}));
}
private function onRegisterClick(_arg1:MouseEvent):void{
model.mainGraphics.infoPanel.signupButton.removeEventListener(MouseEvent.MOUSE_OVER, onRegisterOver);
model.mainGraphics.infoPanel.signupButton.removeEventListener(MouseEvent.MOUSE_OUT, onRegisterOut);
model.mainGraphics.infoPanel.signupButton.removeEventListener(MouseEvent.MOUSE_DOWN, onRegisterDown);
model.mainGraphics.infoPanel.signupButton.removeEventListener(MouseEvent.MOUSE_UP, onRegisterUp);
model.mainGraphics.infoPanel.signupButton.removeEventListener(MouseEvent.CLICK, onRegisterClick);
model.mainGraphics.infoPanel.signupTexts.signup3.removeEventListener(MouseEvent.MOUSE_OVER, onReplayOver);
model.mainGraphics.infoPanel.signupTexts.signup3.removeEventListener(MouseEvent.MOUSE_OUT, onReplayOut);
model.mainGraphics.infoPanel.signupTexts.signup3.removeEventListener(MouseEvent.MOUSE_DOWN, onReplayDown);
model.mainGraphics.infoPanel.signupTexts.signup3.removeEventListener(MouseEvent.MOUSE_UP, onReplayUp);
model.mainGraphics.infoPanel.signupTexts.signup3.removeEventListener(MouseEvent.CLICK, onReplayClick);
ExternalInterface.call("jsHandleFsCmd", "gameSignup");
}
private function onWordPairAnswerResponse(_arg1:Message):void{
var _local2 = (model.selectedWord == _arg1.correctAnswer);
if (!_local2){
model.playerScore = Math.floor((0.5 * model.playerScore));
};
setPanelField(words[model.answeredWordPairs].clip.field, alts[_arg1.correctAnswer].clip.field.text);
model.answeredWordPairs++;
if (-1 == model.selectedWord){
model.selectedWord = ((_arg1.correctAnswer == 1)) ? 0 : 1;
model.state = ViewModel.STATE_WORDPAIR_SELECTED;
config.soundManager.getFromClass(showWord).play(config.showWordPairVol);
model.activeAnimations.push(new Animation(alts[(model.selectedWord) ? 0 : 1], "in_end", "in_begin", currentTick, {frameRate:(24 / config.tickRate), onComplete:animateOutWords, onCompleteArgs:[_local2]}));
} else {
animateOutWords(_local2);
};
}
private function onReplayDown(_arg1:MouseEvent):void{
model.mainGraphics.infoPanel.signupTexts.signup3.filters = [];
}
private function animateOutWords(_arg1:Boolean):void{
var _local2:Number = (model.answeredWordPairs - 2);
var _local3:Object = {frameRate:(24 / config.tickRate), onComplete:animateFall, onCompleteArgs:[_arg1]};
var _local4:int = (model.answeredWordPairs - 2);
while (_local4 >= 0) {
var _temp1 = _local2;
_local2 = (_local2 - 1);
model.activeAnimations.push(new Animation(words[_local4], "in_end", "in_begin", (currentTick + (0.5 * _temp1)), _local3));
_local3 = {frameRate:(24 / config.tickRate)};
_local4--;
};
safeCall(_local3.onComplete, _local3.onCompleteArgs);
}
private function onWordPairMouseOut(_arg1:MouseEvent):void{
var _local2:int = ((_arg1.target == alts[0])) ? 0 : 1;
alts[_local2].gotoAndStop("selectable");
}
private function onReplayUp(_arg1:MouseEvent):void{
model.mainGraphics.infoPanel.signupTexts.signup3.filters = [new ColorMatrixFilter(defaultReplay)];
}
private function startCountDown(_arg1:int):void{
countdownStart = currentTick;
countdownLength = (_arg1 * config.tickRate);
countdownLast = countdownLength;
countdown = true;
ghigliottina.stage.addEventListener(MouseEvent.CLICK, onStageClick);
}
private function onReplayClick(_arg1:MouseEvent):void{
model.mainGraphics.infoPanel.signupButton.removeEventListener(MouseEvent.MOUSE_OVER, onRegisterOver);
model.mainGraphics.infoPanel.signupButton.removeEventListener(MouseEvent.MOUSE_OUT, onRegisterOut);
model.mainGraphics.infoPanel.signupButton.removeEventListener(MouseEvent.MOUSE_DOWN, onRegisterDown);
model.mainGraphics.infoPanel.signupButton.removeEventListener(MouseEvent.MOUSE_UP, onRegisterUp);
model.mainGraphics.infoPanel.signupButton.removeEventListener(MouseEvent.CLICK, onRegisterClick);
model.mainGraphics.infoPanel.signupTexts.signup3.removeEventListener(MouseEvent.MOUSE_OVER, onReplayOver);
model.mainGraphics.infoPanel.signupTexts.signup3.removeEventListener(MouseEvent.MOUSE_OUT, onReplayOut);
model.mainGraphics.infoPanel.signupTexts.signup3.removeEventListener(MouseEvent.MOUSE_DOWN, onReplayDown);
model.mainGraphics.infoPanel.signupTexts.signup3.removeEventListener(MouseEvent.MOUSE_UP, onReplayUp);
model.mainGraphics.infoPanel.signupTexts.signup3.removeEventListener(MouseEvent.CLICK, onReplayClick);
Main.restart = true;
}
private function updateAnimations():void{
var _local1:Tween;
var _local2:Array = new Array();
for each (_local1 in model.activeAnimations) {
_local1.update(currentTick);
if (_local1.finished){
_local2.push(_local1);
};
};
for each (_local1 in _local2) {
model.activeAnimations.splice(model.activeAnimations.indexOf(_local1), 1);
};
}
private function animateInOpenGameEnd():void{
config.soundManager.getFromClass(showQuestion).play();
model.mainGraphics.infoPanel.visible = true;
model.mainGraphics.infoPanel.instructions.visible = true;
model.mainGraphics.infoPanel.header.visible = true;
model.mainGraphics.infoPanel.scoreLabel.visible = false;
model.mainGraphics.infoPanel.timeBonusLabel.visible = false;
model.mainGraphics.infoPanel.totalScoreLabel.visible = false;
model.mainGraphics.infoPanel.score.visible = false;
model.mainGraphics.infoPanel.timeBonus.visible = false;
model.mainGraphics.infoPanel.totalScore.visible = false;
model.mainGraphics.infoPanel.legalImage.visible = false;
model.mainGraphics.infoPanel.header.field.text = config.displayStrings("register_header").toUpperCase();
model.mainGraphics.infoPanel.instructions.field.htmlText = config.displayStrings("register_desc").toUpperCase();
var linkStyle:StyleSheet = new StyleSheet();
linkStyle.setStyle("a:link", {color:"#51D3FF", textDecoration:"none"});
linkStyle.setStyle("a:hover", {color:"#51D3FF", textDecoration:"underline"});
model.mainGraphics.infoPanel.instructions.field.styleSheet = linkStyle;
model.mainGraphics.infoPanel.counter.field.text = config.displayStrings("rslt_countdown", config.openGameEndCountdownLength).toUpperCase();
model.mainGraphics.infoPanel.visible = true;
model.activeAnimations.push(new Animation(model.mainGraphics.infoPanel, "large_in_begin", "instructions_in_begin", currentTick, {frameRate:(24 / config.tickRate), onComplete:function ():void{
model.activeAnimations.push(new Animation(model.mainGraphics.infoPanel, "instructions_in_end", "large_in_end", currentTick, {frameRate:(24 / config.tickRate), onComplete:function ():void{
model.mainGraphics.mouseChildren = true;
model.mainGraphics.infoPanel.mouseChildren = true;
model.mainGraphics.infoPanel.instructions.mouseChildren = true;
model.mainGraphics.infoPanel.instructions.field.mouseEnabled = true;
startCountDown(config.openGameEndCountdownLength);
}}));
}}));
}
private function onReplayOver(_arg1:MouseEvent):void{
model.mainGraphics.infoPanel.signupTexts.signup3.filters = [new ColorMatrixFilter(hoverReplay)];
}
private function onRegisterOver(_arg1:MouseEvent):void{
model.mainGraphics.infoPanel.signupButton.filters = [new ColorMatrixFilter(hoverRegister)];
}
private function exit():void{
finished = true;
}
private function onQuitOut(_arg1:MouseEvent):void{
model.mainGraphics.quitButton.gotoAndStop(1);
}
private function animateOutResults():void{
model.activeAnimations.push(new Animation(model.mainGraphics.infoPanel, "large_out_begin", "large_out_end", currentTick, {frameRate:(24 / config.tickRate), onComplete:function ():void{
model.mainGraphics.infoPanel.visible = false;
if (config.isRai){
animateInSelfcontainedEnd();
} else {
exit();
};
}}));
}
private function onStageClick(_arg1:MouseEvent):void{
if (MainView.buttonsPressed){
return;
};
ghigliottina.stage.removeEventListener(MouseEvent.CLICK, onStageClick);
countdown = false;
animateOutResults();
}
private function onTimelimitHit(_arg1:Message):void{
config.soundManager.getFromClass(timelimitHit).play(config.timelimitHitVol);
model.mainGraphics.clock.text = "00:00";
model.mainGraphics.timeBar.gotoAndStop("end");
if (model.state == ViewModel.STATE_WORDPAIR_SELECTION){
disableWordPairSelection();
alts[0].gotoAndStop("selectable");
alts[1].gotoAndStop("selectable");
} else {
if (model.state == ViewModel.STATE_FINALWORD_ENTER){
model.finalInputField.stopInput();
userInput.clear();
};
};
}
private function enableWordPairSelection():void{
ghigliottina.mouseChildren = true;
model.state = ViewModel.STATE_WORDPAIR_SELECTION;
model.selectedWord = -1;
}
private function onRegisterOut(_arg1:MouseEvent):void{
model.mainGraphics.infoPanel.signupButton.filters = [new ColorMatrixFilter(defaultRegister)];
}
private function handleGameUpdates():void{
while (((!(finished)) && (!(inputQueue.isEmpty())))) {
dispatcher.dispatchMessage(Message(inputQueue.dequeue()));
};
}
private function onWordPairSelected(_arg1:MouseEvent):void{
var event = _arg1;
disableWordPairSelection();
model.selectedWord = ((event.target == alts[0])) ? 0 : 1;
model.state = ViewModel.STATE_WORDPAIR_SELECTED;
model.activeAnimations.push(new Animation(alts[model.selectedWord], "select_begin", "select_end", currentTick, {frameRate:(24 / config.tickRate), onStart:function ():void{
config.soundManager.getFromClass(answerSelect).play(0.9);
}}));
model.activeAnimations.push(new Animation(alts[(model.selectedWord) ? 0 : 1], "in_end", "in_begin", currentTick, {frameRate:(24 / config.tickRate), onStart:function ():void{
config.soundManager.getFromClass(showWord).play(config.showWordPairVol);
}}));
outputQueue.enqueue(new Message(MsgTypes.wordPairAnswer, {index:model.selectedWord, timeBonus:0}));
}
private function animateInSelfcontainedEnd():void{
config.soundManager.getFromClass(showQuestion).play();
model.mainGraphics.infoPanel.visible = true;
model.mainGraphics.infoPanel.signupButton.visible = true;
model.mainGraphics.infoPanel.signupTexts.visible = true;
model.mainGraphics.infoPanel.header.visible = false;
model.mainGraphics.infoPanel.instructions.visible = false;
model.mainGraphics.infoPanel.scoreLabel.visible = false;
model.mainGraphics.infoPanel.timeBonusLabel.visible = false;
model.mainGraphics.infoPanel.totalScoreLabel.visible = false;
model.mainGraphics.infoPanel.score.visible = false;
model.mainGraphics.infoPanel.timeBonus.visible = false;
model.mainGraphics.infoPanel.totalScore.visible = false;
model.mainGraphics.infoPanel.legalImage.visible = true;
var boldFormat:TextFormat = new TextFormat();
boldFormat.bold = true;
var style:StyleSheet = new StyleSheet();
style.setStyle("a:link", {color:"#87DDFF", textDecoration:"underline"});
style.setStyle("a:hover", {color:"#A3E1FF", textDecoration:"underline"});
var underlineItalicFormat:TextFormat = new TextFormat();
underlineItalicFormat.italic = true;
underlineItalicFormat.underline = true;
model.mainGraphics.infoPanel.signupTexts.signup0.defaultTextFormat = boldFormat;
model.mainGraphics.infoPanel.signupTexts.signup0.text = config.displayStrings("register_extern_head0").toUpperCase();
model.mainGraphics.infoPanel.signupTexts.signup1.defaultTextFormat = boldFormat;
model.mainGraphics.infoPanel.signupTexts.signup1.text = config.displayStrings("register_extern_head1").toUpperCase();
model.mainGraphics.infoPanel.signupTexts.signup2.text = config.displayStrings("register_extern_signup").toUpperCase();
model.mainGraphics.infoPanel.signupTexts.signup3.defaultTextFormat = underlineItalicFormat;
model.mainGraphics.infoPanel.signupTexts.signup3.text = config.displayStrings("register_extern_playnow").toUpperCase();
model.mainGraphics.infoPanel.signupTexts.signup4.styleSheet = style;
model.mainGraphics.infoPanel.signupTexts.signup4.htmlText = config.displayStrings("register_extern_legal");
model.mainGraphics.infoPanel.visible = true;
model.activeAnimations.push(new Animation(model.mainGraphics.infoPanel, "large_in_begin", "instructions_in_begin", currentTick, {frameRate:(24 / config.tickRate), onComplete:function ():void{
model.mainGraphics.infoPanel.signupButton.filters = [new ColorMatrixFilter(defaultRegister)];
model.mainGraphics.mouseChildren = true;
model.mainGraphics.infoPanel.mouseChildren = true;
model.mainGraphics.infoPanel.signupButton.mouseEnabled = true;
model.mainGraphics.infoPanel.signupButton.addEventListener(MouseEvent.MOUSE_OVER, onRegisterOver);
model.mainGraphics.infoPanel.signupButton.addEventListener(MouseEvent.MOUSE_OUT, onRegisterOut);
model.mainGraphics.infoPanel.signupButton.addEventListener(MouseEvent.MOUSE_DOWN, onRegisterDown);
model.mainGraphics.infoPanel.signupButton.addEventListener(MouseEvent.MOUSE_UP, onRegisterUp);
model.mainGraphics.infoPanel.signupButton.addEventListener(MouseEvent.CLICK, onRegisterClick);
model.mainGraphics.infoPanel.signupTexts.mouseChildren = true;
model.mainGraphics.infoPanel.signupTexts.signup3.mouseEnabled = true;
model.mainGraphics.infoPanel.signupTexts.signup3.selectable = false;
model.mainGraphics.infoPanel.signupTexts.signup3.addEventListener(MouseEvent.MOUSE_OVER, onReplayOver);
model.mainGraphics.infoPanel.signupTexts.signup3.addEventListener(MouseEvent.MOUSE_OUT, onReplayOut);
model.mainGraphics.infoPanel.signupTexts.signup3.addEventListener(MouseEvent.MOUSE_DOWN, onReplayDown);
model.mainGraphics.infoPanel.signupTexts.signup3.addEventListener(MouseEvent.MOUSE_UP, onReplayUp);
model.mainGraphics.infoPanel.signupTexts.signup3.addEventListener(MouseEvent.CLICK, onReplayClick);
model.mainGraphics.infoPanel.signupTexts.signup4.mouseEnabled = true;
model.mainGraphics.infoPanel.signupTexts.signup4.selectable = false;
}}));
}
private function onFinalWordLength(_arg1:Message):void{
model.finalWordLength = _arg1.length;
var _local2:String = config.displayStrings("game_finalword_instructions").toUpperCase();
if (0 < _arg1.finalWord.length){
_local2 = (_local2 + ((" [" + _arg1.finalWord.toUpperCase()) + "]"));
};
ghigliottina.panel.clip.field.text = _local2;
model.activeAnimations.push(new Animation(ghigliottina.panel, "begin", "end", currentTick, {frameRate:(24 / config.tickRate), onComplete:enableFinalWordInput}));
var _local3:int;
while (_local3 < model.answeredWordPairs) {
model.activeAnimations.push(new Animation(words[_local3], "partial_begin", "partial_end", currentTick, {frameRate:(24 / config.tickRate)}));
_local3++;
};
}
private function animateInResults(_arg1:Boolean):void{
if (((!(_arg1)) && (config.isRai))){
animateInSelfcontainedEnd();
return;
};
config.soundManager.getFromClass(showQuestion).play();
model.mainGraphics.infoPanel.visible = true;
model.mainGraphics.infoPanel.instructions.visible = false;
model.mainGraphics.infoPanel.header.visible = true;
model.mainGraphics.infoPanel.scoreLabel.visible = true;
model.mainGraphics.infoPanel.timeBonusLabel.visible = true;
model.mainGraphics.infoPanel.totalScoreLabel.visible = true;
model.mainGraphics.infoPanel.score.visible = true;
model.mainGraphics.infoPanel.timeBonus.visible = true;
model.mainGraphics.infoPanel.totalScore.visible = true;
model.mainGraphics.infoPanel.legalImage.visible = false;
model.mainGraphics.infoPanel.header.field.text = config.displayStrings((_arg1) ? "rslt_win" : "rslt_loss").toUpperCase();
model.mainGraphics.infoPanel.scoreLabel.field.text = config.displayStrings("rslt_score").toUpperCase();
model.mainGraphics.infoPanel.timeBonusLabel.field.text = config.displayStrings("rslt_timebonus").toUpperCase();
model.mainGraphics.infoPanel.totalScoreLabel.field.text = config.displayStrings("rslt_totalscore").toUpperCase();
model.mainGraphics.infoPanel.score.field.text = model.playerScore;
model.mainGraphics.infoPanel.timeBonus.field.text = model.timeBonus;
model.mainGraphics.infoPanel.totalScore.field.text = (model.playerScore + model.timeBonus);
model.mainGraphics.infoPanel.counter.field.text = config.displayStrings("rslt_countdown", config.resultCountdownLength).toUpperCase();
model.mainGraphics.infoPanel.visible = true;
model.activeAnimations.push(new Animation(model.mainGraphics.infoPanel, "large_in_begin", "large_in_end", currentTick, {frameRate:(30 / config.tickRate), onComplete:startCountDown, onCompleteArgs:[(config.isRai) ? 3 : config.resultCountdownLength]}));
}
private function onQuitOver(_arg1:MouseEvent):void{
model.mainGraphics.quitButton.gotoAndStop(2);
}
private function onTimeBonus(_arg1:Message):void{
if (model.state != ViewModel.STATE_FINALWORD_ENTERED){
enqueuedTimeBonus = _arg1;
} else {
animateTimeBonus(_arg1);
};
}
private function setClock(_arg1:Number):void{
var _local2:Number = Math.round((100 * (_arg1 / config.tickRate)));
var _local3:String = _local2.toString();
while (4 > _local3.length) {
_local3 = ("0" + _local3);
};
model.mainGraphics.clock.text = ((_local3.substring(0, 2) + ":") + _local3.substring(2, 4));
var _local4:Number = 0;
if (model.state == ViewModel.STATE_FINALWORD_ENTER){
_local4 = config.finalWordCountdownLength;
} else {
if (model.state == ViewModel.STATE_WORDPAIR_SELECTION){
_local4 = config.wordPairCountdownLength;
};
};
var _local5:int = Math.max(1, ((1 - (_arg1 / _local4)) * model.mainGraphics.timeBar.totalFrames));
model.mainGraphics.timeBar.gotoAndStop(_local5);
}
private function onReplayOut(_arg1:MouseEvent):void{
model.mainGraphics.infoPanel.signupTexts.signup3.filters = [new ColorMatrixFilter(defaultReplay)];
}
private function onResultsTransition(_arg1:Boolean):void{
var clips:Array;
var result = _arg1;
clips = words.concat();
clips.push(ghigliottina.score);
clips.push(ghigliottina.panel);
clips.push(model.mainGraphics.clock);
clips.push(model.mainGraphics.timeBar);
model.activeAnimations.push(new FadeOutTween(clips, currentTick, (0.6 * config.tickRate), {onComplete:function ():void{
var _local1:*;
for each (_local1 in clips) {
_local1.visible = false;
};
animateInResults(result);
}}));
}
private function onQuitClick(_arg1:MouseEvent):void{
quitClicked = true;
}
private function setPanelField(_arg1:TextField, _arg2:String):void{
var _local3:TextFormat;
_arg1.text = _arg2.toUpperCase();
_arg1.y = altsOriginalYPos;
if (220 < _arg1.textWidth){
_local3 = _arg1.getTextFormat();
do {
_local3.size = (Number(_local3.size) - 1);
_arg1.setTextFormat(_local3);
_arg1.y = (_arg1.y + 0.5);
} while (220 < _arg1.textWidth);
_arg1.y = Math.round(_arg1.y);
};
}
public function update(_arg1:Number):void{
var _local2:Message;
currentTick = _arg1;
if (quitClicked){
model.mainGraphics.quitButton.mouseEnabled = false;
ghigliottina.mouseChildren = false;
clearTasks();
userInput.clear();
outputQueue.clear();
outputQueue.enqueue(new Message(MsgTypes.quitGame));
_local2 = new Message(MsgTypes.quitGame);
_local2.tick = int(Math.ceil(_arg1));
config.gameComm.addPlayData(_local2.toBinaryPlayData());
config.gameComm.addPlayData(new Message(MsgTypes.gameData, {sound:!((0 == config.soundManager.volume)), music:!((0 == config.musicManager.volume))}).toBinaryPlayData());
while (0 < model.activeAnimations.length) {
model.activeAnimations.pop();
};
dispatcher.removeMsgListener(MsgTypes.wordPair, onWordPair);
dispatcher.removeMsgListener(MsgTypes.countdownUpdate, onCountdownUpdate);
dispatcher.removeMsgListener(MsgTypes.timelimitHit, onTimelimitHit);
dispatcher.removeMsgListener(MsgTypes.timeBonus, onTimeBonus);
dispatcher.removeMsgListener(MsgTypes.wordPairAnswerResponse, onWordPairAnswerResponse);
dispatcher.removeMsgListener(MsgTypes.finalWordLength, onFinalWordLength);
dispatcher.removeMsgListener(MsgTypes.finalWordAnswerResponse, onFinalWordAnswerResponse);
model.playerScore = 0;
config.gameComm.endGame((model.playerScore + model.timeBonus));
animateInResults(false);
quitClicked = false;
};
if (!started){
start();
started = true;
};
if (model.finalInputField){
model.finalInputField.update(_arg1);
};
if (countdown){
updateCountdown();
};
executeTasks();
handleGameUpdates();
handleUserInput();
updateAnimations();
}
private function start():void{
if (config.openGame){
config.gameComm.addPlayData(new Message(MsgTypes.gameData, {sound:!((0 == config.soundManager.volume)), music:!((0 == config.musicManager.volume))}).toBinaryPlayData());
config.gameComm.endGame((model.playerScore + model.timeBonus));
if (config.selfcontaining){
animateInSelfcontainedEnd();
} else {
animateInOpenGameEnd();
};
return;
} else {
if (110000 >= model.playerScore){
config.gameComm.addPlayData(new Message(MsgTypes.gameData, {sound:!((0 == config.soundManager.volume)), music:!((0 == config.musicManager.volume))}).toBinaryPlayData());
model.playerScore = 0;
config.gameComm.endGame((model.playerScore + model.timeBonus));
animateInResults(false);
return;
};
};
melody = config.musicManager.getFromClass(ghigliottina);
melody.loop(0);
melody.fadeTo(config.ghigliottinaVol, 200);
model.mainGraphics.duello.visible = false;
model.mainGraphics.ghigliottina.visible = true;
model.mainGraphics.clock.visible = true;
model.mainGraphics.timeBar.visible = true;
ghigliottina.score.clip0.field.text = ((0.001 * model.playerScore) + ".000");
model.activeAnimations.push(new Animation(ghigliottina.score, "in_begin", "in_end", currentTick, {frameRate:(24 / config.tickRate), onComplete:outputQueue.enqueue, onCompleteArgs:[new Message(MsgTypes.wordPairRequest)]}));
model.mainGraphics.quitButton.mouseEnabled = true;
}
private function animateInWords():void{
var _local1:Number = (model.answeredWordPairs - 1);
var _local2:Object = {frameRate:(24 / config.tickRate), onComplete:outputQueue.enqueue};
if (5 != model.answeredWordPairs){
_local2.onCompleteArgs = [new Message(MsgTypes.wordPairRequest)];
} else {
_local2.onCompleteArgs = [new Message(MsgTypes.finalWordLengthRequest)];
};
var _local3:int = (model.answeredWordPairs - 1);
while (_local3 >= 0) {
var _temp1 = _local1;
_local1 = (_local1 - 1);
model.activeAnimations.push(new Animation(words[_local3], "in_begin", "in_end", (currentTick + (0.5 * _temp1)), _local2));
_local2 = {frameRate:(24 / config.tickRate)};
_local3--;
};
}
private function onWordPairMouseOver(_arg1:MouseEvent):void{
var _local2:int = ((_arg1.target == alts[0])) ? 0 : 1;
alts[_local2].gotoAndStop("mouse_over");
}
private function updateCountdown():void{
var _local1:Number = (countdownLength - (currentTick - countdownStart));
if (0 < _local1){
if (_local1 != countdownLast){
model.mainGraphics.infoPanel.counter.field.text = config.displayStrings("rslt_countdown", Math.ceil((_local1 / config.tickRate)).toString()).toUpperCase();
countdownLast = _local1;
};
} else {
model.mainGraphics.infoPanel.counter.field.text = config.displayStrings("rslt_countdown", "0").toUpperCase();
countdown = false;
animateOutResults();
};
}
private function onRegisterDown(_arg1:MouseEvent):void{
model.mainGraphics.infoPanel.signupButton.filters = [];
}
private function onRegisterUp(_arg1:MouseEvent):void{
model.mainGraphics.infoPanel.signupButton.filters = [new ColorMatrixFilter(defaultRegister)];
}
private function enableFinalWordInput():void{
model.state = ViewModel.STATE_FINALWORD_ENTER;
model.finalInputField = new FinalInputField(userInput, onFinalWordSubmit, model.finalWordLength, "", currentTick);
model.finalInputField.x = (Math.round(((0.5 * ghigliottina.panel.back.width) - (0.5 * model.finalInputField.width))) - ghigliottina.panel.back.width);
model.finalInputField.y = 270;
ghigliottina.panel.addChild(model.finalInputField);
}
private function disableWordPairSelection():void{
ghigliottina.mouseChildren = false;
model.state = ViewModel.STATE_WORDPAIR_SELECTION;
}
private function handleUserInput():void{
var _local1:Object;
while (!(userInput.isEmpty())) {
_local1 = userInput.dequeue();
if (model.state == _local1.state){
_local1.handler.apply(null, _local1.args);
};
};
}
private function animateTimeBonus(_arg1:Message):void{
var originalX:Number;
var message = _arg1;
model.timeBonus = (model.timeBonus + message.bonus);
model.mainGraphics.timeBonus.visible = true;
originalX = model.mainGraphics.timeBonus.x;
model.mainGraphics.timeBonus.x = (model.mainGraphics.timeBonus.x - 32);
var asString:String = message.bonus.toString();
var bonusClips:Array = [model.mainGraphics.timeBonus.d3, model.mainGraphics.timeBonus.d2, model.mainGraphics.timeBonus.d1, model.mainGraphics.timeBonus.d0];
var args:Object = {frameRate:(24 / config.tickRate), onComplete:function ():void{
model.mainGraphics.timeBonus.visible = false;
model.mainGraphics.timeBonus.x = originalX;
}};
var i:int;
while (i < 4) {
bonusClips[i].clip.field.text = asString.charAt((asString.length - (i + 1)));
if (0 == bonusClips[i].clip.field.text.length){
break;
};
model.mainGraphics.timeBonus.x = (model.mainGraphics.timeBonus.x + 8);
model.activeAnimations.push(new Animation(bonusClips[i], "begin", "end", currentTick, args));
args = {frameRate:(24 / config.tickRate)};
i = (i + 1);
};
}
private function onFinalWordSubmit(_arg1:String):void{
model.state = ViewModel.STATE_FINALWORD_ENTERED;
outputQueue.enqueue(new Message(MsgTypes.finalWordAnswer, {word:_arg1, timeBonus:0}));
}
private function onCountdownUpdate(_arg1:Message):void{
if ((((model.state == ViewModel.STATE_FINALWORD_ENTER)) || ((model.state == ViewModel.STATE_WORDPAIR_SELECTION)))){
setClock(_arg1.remaining);
};
}
private function animateFall(_arg1:Boolean):void{
var delay:Number;
var asString:String;
var correct = _arg1;
var label:String = (("fall_" + model.selectedWord) + (correct) ? "_correct" : "_wrong");
if (correct){
delay = (0.38 * config.tickRate);
config.soundManager.getFromClass(wordCorrect).play(config.wordCorrectVol);
if (enqueuedTimeBonus){
addTask((currentTick + (0.6 * config.tickRate)), animateTimeBonus, enqueuedTimeBonus);
enqueuedTimeBonus = null;
};
} else {
delay = (0.54 * config.tickRate);
config.soundManager.getFromClass(wordWrong).play(config.wordWrongVol);
};
model.activeAnimations.push(new Animation(alts[model.selectedWord], (label + "_begin"), (label + "_end"), (currentTick + delay), {frameRate:(24 / config.tickRate), onComplete:function ():void{
model.mainGraphics.clock.text = "00:00";
model.mainGraphics.timeBar.gotoAndStop("end");
animateInWords();
}}));
if (!correct){
asString = model.playerScore.toString();
if (3 < asString.length){
asString = ((asString.substr(0, (asString.length - 3)) + ".") + asString.substr((asString.length - 3), 3));
};
ghigliottina.score.clip1.field.text = asString;
delay = (delay + (model.selectedWord) ? 2.6 : 3);
model.activeAnimations.push(new Animation(ghigliottina.score, "cutoff_begin", "cutoff_end", (currentTick + delay), {frameRate:(24 / config.tickRate), onComplete:function ():void{
ghigliottina.score.clip0.field.text = asString;
ghigliottina.score.gotoAndStop("in_end");
}}));
};
}
}
}//package com.midasplayer.games.leredita
Section 25
//Main (com.midasplayer.games.leredita.Main)
package com.midasplayer.games.leredita {
import flash.events.*;
import com.midasplayer.game.framework.*;
import de.polygonal.ds.*;
import flash.display.*;
import com.midasplayer.util.*;
public class Main extends Sprite {
private var config:Config;// = null
private var ticker:Ticker;// = null
public static var restart:Boolean = false;
public function Main(){
if (stage){
init();
} else {
addEventListener(Event.ADDED_TO_STAGE, init);
};
}
private function init(_arg1:Event=null):void{
removeEventListener(Event.ADDED_TO_STAGE, init);
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.showDefaultContextMenu = false;
Assert.pushHandler(assertionHandler);
Log.level = Log.LEVEL_INFO;
setup();
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function assertionHandler(_arg1:String, _arg2:String, _arg3:int, _arg4:String, _arg5:String, _arg6:String):Boolean{
Log.warning(Assert.getAsFormattedString(_arg1, null, 0, _arg4, _arg5, _arg6));
return (true);
}
private function onEnterFrame(_arg1:Event=null):void{
if (restart){
restart = false;
config.soundManager.stopAll();
config.musicManager.stopAll();
while (1 < stage.numChildren) {
stage.removeChildAt(1);
};
setup();
return;
};
ticker.advanceTime(config.timer);
}
private function setup():void{
var _local2:Boolean;
var _local3:Boolean;
var _local1:Boolean;
if (config){
_local1 = true;
_local2 = !((0 == config.soundManager.volume));
_local3 = !((0 == config.musicManager.volume));
};
config = new Config({debug:false, local:true, logComm:false, selfcontaining:true});
if (_local1){
config.sound = _local2;
config.music = _local3;
};
var _local4:Queue = new LinkedQueue();
var _local5:Queue = new LinkedQueue();
var _local6:MainController = new MainController(config, _local4, _local5);
var _local7:MainView = new MainView(config, stage, _local5, _local4);
ticker = new Ticker(_local6.update, _local7.update, config.timeStep, config.maxTickTime);
}
}
}//package com.midasplayer.games.leredita
Section 26
//MainController (com.midasplayer.games.leredita.MainController)
package com.midasplayer.games.leredita {
import com.midasplayer.game.framework.*;
import de.polygonal.ds.*;
import com.midasplayer.messaging.*;
public class MainController extends Controller {
private var config:Config;
private var inputDispatcher:MsgDispatcher;
private var stopUpdates:Boolean;// = false
private var model:ClientModel;
private var requestResponseDispatcher:MsgDispatcher;
public static var lastTick:int;
public function MainController(_arg1:Config, _arg2:Queue, _arg3:Queue){
inputDispatcher = new MsgDispatcher();
requestResponseDispatcher = new MsgDispatcher();
model = new ClientModel();
lastTick = 0;
super(_arg1, _arg2, _arg3);
this.config = _arg1;
inputDispatcher.addMsgListener(MsgTypes.quitGame, onQuitGame);
inputDispatcher.addMsgListener(MsgTypes.categoriesRequest, onCategoriesRequest);
inputDispatcher.addMsgListener(MsgTypes.questionRequest, onQuestionRequest);
inputDispatcher.addMsgListener(MsgTypes.questionAnswer, onQuestionAnswer);
inputDispatcher.addMsgListener(MsgTypes.wordPairRequest, onWordPairRequest);
inputDispatcher.addMsgListener(MsgTypes.wordPairAnswer, onWordPairAnswer);
inputDispatcher.addMsgListener(MsgTypes.finalWordLengthRequest, onFinalWordLengthRequest);
inputDispatcher.addMsgListener(MsgTypes.finalWordAnswer, onFinalWordAnswer);
requestResponseDispatcher.addMsgListener(MsgTypes.categories, onCategories);
requestResponseDispatcher.addMsgListener(MsgTypes.question, onQuestion);
requestResponseDispatcher.addMsgListener(MsgTypes.questionAnswerResponse, onQuestionAnswerResponse);
requestResponseDispatcher.addMsgListener(MsgTypes.wordPair, onWordPair);
requestResponseDispatcher.addMsgListener(MsgTypes.wordPairAnswerResponse, onWordPairAnswerResponse);
requestResponseDispatcher.addMsgListener(MsgTypes.finalWordLength, onFinalWordLength);
requestResponseDispatcher.addMsgListener(MsgTypes.finalWordAnswerResponse, onFinalWordAnswerResponse);
}
private function onFinalWordAnswerResponse(_arg1:Message):void{
model.finalWordGuesses++;
if (!_arg1.result){
if (1 == model.finalWordGuesses){
model.score = int(Math.floor(((2 * model.score) / 3)));
} else {
if (2 == model.finalWordGuesses){
model.score = int(Math.floor((model.score / 2)));
} else {
if (3 == model.finalWordGuesses){
model.score = 0;
};
};
};
};
if (_arg1.result){
pushOutput(new Message(MsgTypes.timeBonus, {bonus:model.finalWordTimeBonus}));
};
pushOutput(_arg1);
if (((_arg1.result) || ((3 == model.finalWordGuesses)))){
pushOutput(new Message(MsgTypes.gameEnd));
} else {
setCountdown(config.finalWordCountdownDelay, config.finalWordCountdownLength, onFinalWordTimelimitHit);
};
}
private function onQuestionAnswer(_arg1:Message):void{
var _local2:Object = model.questions[model.activeQuestion];
_local2.givenAnswer = _arg1.index;
_local2.timeBonus = ((4 == _arg1.index)) ? 0 : Math.max(1, Math.floor((((0.01 * _local2.value) * model.countdownRemaining) / config.questionCountdownLength)));
_arg1.timeBonus = _local2.timeBonus;
clearCountdown();
pushRequest(_arg1);
}
private function onFinalWordTimelimitHit():void{
inputDispatcher.dispatchMessage(new Message(MsgTypes.finalWordAnswer, {word:"", timeBonus:0}));
}
private function onFinalWordLength(_arg1:Message):void{
pushOutput(_arg1);
setCountdown(config.initialFinalWordCountdownDelay, config.finalWordCountdownLength, onFinalWordTimelimitHit);
}
private function onWordPairTimelimitHit():void{
inputDispatcher.dispatchMessage(new Message(MsgTypes.wordPairAnswer, {index:2, timeBonus:0}));
}
private function onCategoryTimelimitHit():void{
clearCountdown();
var _local1:Vector = getRemainingCategories();
var _local2:int = int(_local1.get(config.gameRand.nextInt(_local1.size())));
pushOutput(new Message(MsgTypes.questionSelected, {index:_local2}));
}
private function onWordPair(_arg1:Message):void{
pushOutput(_arg1);
setCountdown(config.wordPairCountdownDelay, config.wordPairCountdownLength, onWordPairTimelimitHit);
}
private function handleRequestResponses():void{
var _local1:Message;
while ((_local1 = popRequestResponse())) {
requestResponseDispatcher.dispatchMessage(_local1);
};
}
private function onWordPairRequest(_arg1:Message):void{
clearCountdown();
pushRequest(_arg1);
}
private function onFinalWordLengthRequest(_arg1:Message):void{
pushRequest(_arg1);
}
private function handleInput():void{
var _local1:Message;
while ((_local1 = popInput())) {
inputDispatcher.dispatchMessage(_local1);
};
}
private function onWordPairAnswerResponse(_arg1:Message):void{
var _local2:Object = model.wordPairs[model.activeWordPair++];
if (_local2.givenAnswer == _arg1.correctAnswer){
pushOutput(new Message(MsgTypes.timeBonus, {bonus:_local2.timeBonus}));
} else {
model.score = Math.floor((0.5 * model.score));
};
pushOutput(_arg1);
}
private function onCategories(_arg1:Message):void{
var _local2:int;
while (_local2 < 8) {
model.questions[_local2].value = _arg1[("values" + _local2)];
_local2++;
};
pushOutput(_arg1);
setCountdown(config.initialCategoryCountdownDelay, config.categoryCountdownLength, onCategoryTimelimitHit);
}
private function onFinalWordAnswer(_arg1:Message):void{
model.finalWordTimeBonus = (("" == _arg1.word)) ? 0 : Math.max(1, Math.floor((((0.01 * model.score) * model.countdownRemaining) / config.finalWordCountdownLength)));
_arg1.timeBonus = model.finalWordTimeBonus;
clearCountdown();
pushRequest(_arg1);
}
private function onQuitGame(_arg1:Message):void{
clearTasks();
clearCountdown();
stopUpdates = true;
}
public function update(_arg1:Number):void{
if (stopUpdates){
return;
};
currentTick = _arg1;
lastTick = _arg1;
executeTasks();
handleRequestResponses();
handleInput();
if (0 >= --model.countdownDelay){
if (0 >= --model.countdownRemaining){
pushOutput(new Message(MsgTypes.timelimitHit));
model.countdownDelay = int.MAX_VALUE;
model.countdownRemaining = int.MAX_VALUE;
model.timelimitHandler();
} else {
pushOutput(new Message(MsgTypes.countdownUpdate, {remaining:model.countdownRemaining}));
};
};
}
private function clearCountdown():void{
setCountdown(int.MAX_VALUE, int.MAX_VALUE, null);
}
private function onQuestion(_arg1:Message):void{
pushOutput(_arg1);
setCountdown(config.questionCountdownDelay, config.questionCountdownLength, onQuestionTimelimitHit);
}
private function onQuestionRequest(_arg1:Message):void{
clearCountdown();
model.activeQuestion = _arg1.index;
pushRequest(_arg1);
}
private function onQuestionAnswerResponse(_arg1:Message):void{
var _local2:Object = model.questions[model.activeQuestion];
if (_local2.givenAnswer == _arg1.correctAnswer){
model.score = (model.score + _local2.value);
pushOutput(new Message(MsgTypes.timeBonus, {bonus:_local2.timeBonus}));
};
pushOutput(_arg1);
if (0 != getRemainingCategories().size()){
setCountdown(config.categoryCountdownDelay, config.categoryCountdownLength, onCategoryTimelimitHit);
} else {
if (110000 >= model.score){
pushOutput(new Message(MsgTypes.gameEnd));
};
};
}
private function setCountdown(_arg1:int, _arg2:int, _arg3:Function):void{
model.countdownDelay = _arg1;
model.countdownRemaining = _arg2;
model.timelimitHandler = _arg3;
}
private function onWordPairAnswer(_arg1:Message):void{
var _local2:Object = model.wordPairs[model.activeWordPair];
_local2.givenAnswer = _arg1.index;
_local2.timeBonus = ((2 == _arg1.index)) ? 0 : Math.max(1, Math.floor((((0.01 * model.score) * model.countdownRemaining) / config.wordPairCountdownLength)));
_arg1.timeBonus = _local2.timeBonus;
clearCountdown();
pushRequest(_arg1);
}
private function onQuestionTimelimitHit():void{
inputDispatcher.dispatchMessage(new Message(MsgTypes.questionAnswer, {index:4, timeBonus:0}));
}
private function onCategoriesRequest(_arg1:Message):void{
pushRequest(_arg1);
}
private function getRemainingCategories():Vector{
var _local1:Vector = new Vector();
var _local2:int;
while (_local2 < 8) {
if (-1 == model.questions[_local2].givenAnswer){
_local1.pushBack(_local2);
};
_local2++;
};
return (_local1);
}
}
}//package com.midasplayer.games.leredita
Section 27
//MainView (com.midasplayer.games.leredita.MainView)
package com.midasplayer.games.leredita {
import flash.events.*;
import de.polygonal.ds.*;
import flash.display.*;
public class MainView {
private var config:Config;
private var ghigliottina:GhigliottinaView;
private var outputQueue:Queue;
private var state:int;// = 0
private var loadingDotsStart:Number;// = -1
private var loadingDots:int;// = 0
private var inputQueue:Queue;
private var model:ViewModel;
private var duelloQuit:Boolean;// = false
private var duello:DuelloView;
private var currentTick:Number;// = 0
private var stage:Stage;
private static const STATE_POSTGAME:int = 2;
private static const STATE_GHIGLIOTTINA:int = 1;
private static const STATE_DUELLO:int = 0;
public static var buttonsPressed:Boolean;
public function MainView(_arg1:Config, _arg2:Stage, _arg3:Queue, _arg4:Queue){
model = new ViewModel();
super();
buttonsPressed = false;
this.config = _arg1;
this.stage = _arg2;
this.inputQueue = _arg3;
this.outputQueue = _arg4;
model.mainGraphics.soundButton.visible = true;
model.mainGraphics.musicButton.visible = true;
model.mainGraphics.mouseChildren = true;
_arg2.addChild(model.mainGraphics);
_arg1.soundManager.setVolume((_arg1.sound) ? _arg1.soundVol : 0);
_arg1.musicManager.setVolume((_arg1.music) ? _arg1.musicVol : 0);
model.mainGraphics.soundButton.crossed.visible = !(_arg1.sound);
model.mainGraphics.musicButton.crossed.visible = !(_arg1.music);
model.mainGraphics.soundButton.addEventListener(MouseEvent.MOUSE_OVER, onSoundOver);
model.mainGraphics.soundButton.addEventListener(MouseEvent.MOUSE_OUT, onSoundOut);
model.mainGraphics.soundButton.addEventListener(MouseEvent.CLICK, onSoundClick);
model.mainGraphics.musicButton.addEventListener(MouseEvent.MOUSE_OVER, onMusicOver);
model.mainGraphics.musicButton.addEventListener(MouseEvent.MOUSE_OUT, onMusicOut);
model.mainGraphics.musicButton.addEventListener(MouseEvent.CLICK, onMusicClick);
model.mainGraphics.soundButton.mouseEnabled = true;
model.mainGraphics.musicButton.mouseEnabled = true;
_arg1.gameComm.setRequestDelayUI(onShowNetworkDelay, onHideNetworkDelay);
}
private function onMusicOver(_arg1:MouseEvent):void{
model.mainGraphics.musicButton.gotoAndStop(2);
}
private function onSoundOut(_arg1:MouseEvent):void{
model.mainGraphics.soundButton.gotoAndStop(1);
}
private function onHideNetworkDelay():void{
loadingDotsStart = -1;
model.mainGraphics.infoPanel.gotoAndStop("small_out_end");
model.mainGraphics.infoPanel.visible = false;
}
private function onShowNetworkDelay():void{
model.mainGraphics.infoPanel.visible = true;
model.mainGraphics.infoPanel.small_header.visible = true;
model.mainGraphics.infoPanel.header.visible = false;
model.mainGraphics.infoPanel.scoreLabel.visible = false;
model.mainGraphics.infoPanel.timeBonusLabel.visible = false;
model.mainGraphics.infoPanel.totalScoreLabel.visible = false;
model.mainGraphics.infoPanel.score.visible = false;
model.mainGraphics.infoPanel.timeBonus.visible = false;
model.mainGraphics.infoPanel.totalScore.visible = false;
model.mainGraphics.infoPanel.legalImage.visible = false;
model.mainGraphics.infoPanel.small_header.field.text = config.displayStrings("network_delay").toUpperCase();
loadingDotsStart = currentTick;
model.mainGraphics.infoPanel.gotoAndStop("small_in_end");
}
public function update(_arg1:Number):void{
var _local2:int;
var _local3:String;
currentTick = _arg1;
if (-1 != loadingDotsStart){
_local2 = (int(((_arg1 - loadingDotsStart) / config.tickRate)) % 4);
if (_local2 != loadingDots){
_local3 = ((_local2 == 0)) ? "" : ((_local2 == 1)) ? "." : ((_local2 == 2)) ? ".." : "...";
model.mainGraphics.infoPanel.small_header.field.text = ((config.displayStrings("network_delay").toUpperCase() + "\n") + _local3);
loadingDots = _local2;
};
};
buttonsPressed = false;
switch (state){
case STATE_DUELLO:
if (!duello){
duello = new DuelloView(config, inputQueue, outputQueue, model);
};
duello.update(_arg1);
if (duello.finished){
duelloQuit = duello.quitClicked;
duello = null;
state = STATE_GHIGLIOTTINA;
};
break;
case STATE_GHIGLIOTTINA:
if (!ghigliottina){
ghigliottina = new GhigliottinaView(config, inputQueue, outputQueue, model, !(duelloQuit));
};
ghigliottina.update(_arg1);
if (ghigliottina.finished){
ghigliottina = null;
state = STATE_POSTGAME;
config.gameComm.quitGame();
};
break;
};
config.soundManager.update();
config.musicManager.update();
}
private function onSoundOver(_arg1:MouseEvent):void{
model.mainGraphics.soundButton.gotoAndStop(2);
}
private function onMusicOut(_arg1:MouseEvent):void{
model.mainGraphics.musicButton.gotoAndStop(1);
}
private function onMusicClick(_arg1:MouseEvent):void{
buttonsPressed = true;
if (config.musicManager.volume){
model.mainGraphics.musicButton.crossed.visible = true;
config.musicManager.setVolume(0);
} else {
model.mainGraphics.musicButton.crossed.visible = false;
config.musicManager.setVolume(config.musicVol);
};
}
private function onSoundClick(_arg1:MouseEvent):void{
buttonsPressed = true;
if (config.soundManager.volume){
model.mainGraphics.soundButton.crossed.visible = true;
config.soundManager.setVolume(0);
} else {
model.mainGraphics.soundButton.crossed.visible = false;
config.soundManager.setVolume(config.soundVol);
};
}
}
}//package com.midasplayer.games.leredita
Section 28
//ProxyModel (com.midasplayer.games.leredita.ProxyModel)
package com.midasplayer.games.leredita {
import flash.utils.*;
public class ProxyModel {
public var finalWordGuesses:int;// = 0
public var finalWordCorrectAnswer:String;
public var activeWordPair:int;// = -1
public var activeQuestion:int;// = -1
public var questions:Array;
public var wordPairs:Array;
public var state:int;// = 0
public var score:int;// = 0
public var timeBonus:int;// = 0
public var finalWordGivenAnswer:String;
public static const STATE_AWAITING_QUESTION_ANSWER:int = 2;
public static const STATE_POST_GAME:int = 7;
public static const STATE_AWAITING_WORDPAIR_ANSWER:int = 4;
public static const STATE_AWAITING_WORDPAIR_REQUEST:int = 3;
public static const STATE_AWAITING_QUESTION_REQUEST:int = 1;
public static const STATE_PRE_GAME:int = 0;
public static const STATE_AWAITING_FINAL_WORD_LENGTH_REQUEST:int = 5;
public static const STATE_AWAITING_FINAL_WORD:int = 6;
public function ProxyModel(_arg1:ByteArray=null){
var _local2:int;
questions = new Array();
wordPairs = new Array();
super();
_local2 = 0;
while (_local2 < 8) {
questions.push({category:null, value:0, question:null, answers:null, correctAnswer:0, givenAnswer:-1, timeBonus:0});
_local2++;
};
_local2 = 0;
while (_local2 < 5) {
wordPairs.push({words:null, correctAnswer:0, givenAnswer:-1, timeBonus:0});
_local2++;
};
if (_arg1){
state = _arg1.readByte();
_local2 = 0;
while (_local2 < 8) {
questions[_local2].givenAnswer = _arg1.readByte();
questions[_local2].timeBonus = _arg1.readShort();
_local2++;
};
_local2 = 0;
while (_local2 < 5) {
wordPairs[_local2].givenAnswer = _arg1.readByte();
wordPairs[_local2].timeBonus = _arg1.readShort();
_local2++;
};
score = _arg1.readInt();
timeBonus = _arg1.readInt();
activeQuestion = _arg1.readByte();
activeWordPair = _arg1.readByte();
finalWordGuesses = _arg1.readByte();
};
}
public function toByteArray():ByteArray{
var _local2:int;
var _local1:ByteArray = new ByteArray();
_local1.writeByte(state);
_local2 = 0;
while (_local2 < 8) {
_local1.writeByte(questions[_local2].givenAnswer);
_local1.writeShort(questions[_local2].timeBonus);
_local2++;
};
_local2 = 0;
while (_local2 < 5) {
_local1.writeByte(wordPairs[_local2].givenAnswer);
_local1.writeShort(wordPairs[_local2].timeBonus);
_local2++;
};
_local1.writeInt(score);
_local1.writeInt(timeBonus);
_local1.writeByte(activeQuestion);
_local1.writeByte(activeWordPair);
_local1.writeByte(finalWordGuesses);
_local1.position = 0;
return (_local1);
}
public function copyStateVariables(_arg1:ProxyModel):void{
var _local2:int;
state = _arg1.state;
_local2 = 0;
while (_local2 < 8) {
questions[_local2].givenAnswer = _arg1.questions[_local2].givenAnswer;
questions[_local2].timeBonus = _arg1.questions[_local2].timeBonus;
_local2++;
};
_local2 = 0;
while (_local2 < 5) {
wordPairs[_local2].givenAnswer = _arg1.wordPairs[_local2].givenAnswer;
wordPairs[_local2].timeBonus = _arg1.wordPairs[_local2].timeBonus;
_local2++;
};
score = _arg1.score;
timeBonus = _arg1.timeBonus;
activeQuestion = _arg1.activeQuestion;
activeWordPair = _arg1.activeWordPair;
finalWordGuesses = _arg1.finalWordGuesses;
}
public function stateEquals(_arg1:ProxyModel):Boolean{
var _local2:int;
if (state != _arg1.state){
return (false);
};
_local2 = 0;
while (_local2 < 8) {
if (questions[_local2].givenAnswer != _arg1.questions[_local2].givenAnswer){
return (false);
};
if (questions[_local2].timeBonus != _arg1.questions[_local2].timeBonus){
return (false);
};
_local2++;
};
_local2 = 0;
while (_local2 < 5) {
if (wordPairs[_local2].givenAnswer != _arg1.wordPairs[_local2].givenAnswer){
return (false);
};
if (wordPairs[_local2].timeBonus != _arg1.wordPairs[_local2].timeBonus){
return (false);
};
_local2++;
};
if (score != _arg1.score){
return (false);
};
if (timeBonus != _arg1.timeBonus){
return (false);
};
if (activeQuestion != _arg1.activeQuestion){
return (false);
};
if (activeWordPair != _arg1.activeWordPair){
return (false);
};
if (finalWordGuesses != _arg1.finalWordGuesses){
return (false);
};
return (true);
}
}
}//package com.midasplayer.games.leredita
Section 29
//RequestHandler (com.midasplayer.games.leredita.RequestHandler)
package com.midasplayer.games.leredita {
import com.midasplayer.game.framework.*;
import com.midasplayer.messaging.*;
import flash.utils.*;
import com.midasplayer.util.*;
public class RequestHandler implements IRequestHandler {
private var getQuestions:Function;
private var openGame:Boolean;
public var model:ProxyModel;
private var illegalRequestMade:Boolean;// = false
private var getWordPairs:Function;
public function RequestHandler(_arg1:Function, _arg2:Function, _arg3:Boolean){
this.getQuestions = _arg1;
this.getWordPairs = _arg2;
this.openGame = _arg3;
}
private function illegalRequest(_arg1:String):Message{
if (!illegalRequestMade){
Log.warning(_arg1);
illegalRequestMade = true;
};
return (new Message(MsgTypes.illegalRequest));
}
private function onQuestionAnswer(_arg1:Message):Message{
if (model.state != ProxyModel.STATE_AWAITING_QUESTION_ANSWER){
return (illegalRequest("Request handler must be in state AWAITING_QUESTION_ANSWER to be able to accept messages of type questionAnswer."));
};
if ((((0 > _arg1.index)) || ((4 < _arg1.index)))){
return (illegalRequest("Answer must be in range [0-4]."));
};
if ((((0 > _arg1.timeBonus)) || (((0.01 * model.questions[model.activeQuestion].value) < _arg1.timeBonus)))){
return (illegalRequest("Time bonus must be in range [0-MaxBonus]"));
};
var _local2:int = model.activeQuestion;
model.questions[_local2].givenAnswer = _arg1.index;
model.questions[_local2].timeBonus = _arg1.timeBonus;
if (model.questions[_local2].givenAnswer == model.questions[_local2].correctAnswer){
model.score = (model.score + model.questions[_local2].value);
model.timeBonus = (model.timeBonus + model.questions[_local2].timeBonus);
};
if (8 != numQuestionsAnswered()){
model.state = ProxyModel.STATE_AWAITING_QUESTION_REQUEST;
} else {
if (openGame){
model.state = ProxyModel.STATE_POST_GAME;
} else {
if (110000 >= model.score){
model.state = ProxyModel.STATE_POST_GAME;
model.score = 0;
} else {
model.state = ProxyModel.STATE_AWAITING_WORDPAIR_REQUEST;
};
};
};
return (new Message(MsgTypes.questionAnswerResponse, {correctAnswer:model.questions[_local2].correctAnswer}));
}
private function onFinalWordLengthRequest(_arg1:Message):Message{
if (model.state != ProxyModel.STATE_AWAITING_FINAL_WORD_LENGTH_REQUEST){
return (illegalRequest("Request handler must be in state AWAITING_FINAL_WORD_LENGTH_REQUEST to be able to accept messages of type finalWordLengthRequest."));
};
model.state = ProxyModel.STATE_AWAITING_FINAL_WORD;
return (new Message(MsgTypes.finalWordLength, {length:model.finalWordCorrectAnswer.length, finalWord:""}));
}
private function onWordPairRequest(_arg1:Message):Message{
if (model.state != ProxyModel.STATE_AWAITING_WORDPAIR_REQUEST){
return (illegalRequest("Request handler must be in state AWAITING_WORDPAIR_REQUEST to be able to accept messages of type wordPairRequest."));
};
if (4 <= model.activeWordPair){
return (illegalRequest("Active word pair must not be 4 or greater."));
};
model.state = ProxyModel.STATE_AWAITING_WORDPAIR_ANSWER;
var _local2:int = ++model.activeWordPair;
return (new Message(MsgTypes.wordPair, {words0:model.wordPairs[_local2].words[0], words1:model.wordPairs[_local2].words[1]}));
}
public function recreateGameState(_arg1:String):void{
loadData();
var _local2:ProxyModel = new ProxyModel(ByteArray(_arg1));
model.copyStateVariables(_local2);
}
private function onWordPairAnswer(_arg1:Message):Message{
if (model.state != ProxyModel.STATE_AWAITING_WORDPAIR_ANSWER){
return (illegalRequest("Request handler must be in state AWAITING_WORDPAIR_ANSWER to be able to accept messages of type wordPairAnswer."));
};
if ((((0 > _arg1.index)) || ((2 < _arg1.index)))){
return (illegalRequest("Answer must be in range [0-2]"));
};
if ((((0 > _arg1.timeBonus)) || (((0.01 * model.score) < _arg1.timeBonus)))){
return (illegalRequest("Time bonus must be in range [0-MaxBonus]"));
};
if (4 != model.activeWordPair){
model.state = ProxyModel.STATE_AWAITING_WORDPAIR_REQUEST;
} else {
model.state = ProxyModel.STATE_AWAITING_FINAL_WORD_LENGTH_REQUEST;
};
var _local2:int = model.activeWordPair;
model.wordPairs[_local2].givenAnswer = _arg1.index;
model.wordPairs[_local2].timeBonus = _arg1.timeBonus;
if (model.wordPairs[_local2].givenAnswer != model.wordPairs[_local2].correctAnswer){
model.score = int(Math.floor((0.5 * model.score)));
} else {
model.timeBonus = (model.timeBonus + model.wordPairs[_local2].timeBonus);
};
return (new Message(MsgTypes.wordPairAnswerResponse, {correctAnswer:model.wordPairs[_local2].correctAnswer}));
}
public function createGameState():void{
model = new ProxyModel();
loadData();
}
private function numQuestionsAnswered():int{
var _local1:int;
var _local2:int;
while (_local2 < 8) {
if (-1 != model.questions[_local2].givenAnswer){
_local1++;
};
_local2++;
};
return (_local1);
}
private function onFinalWordAnswer(_arg1:Message):Message{
if (model.state != ProxyModel.STATE_AWAITING_FINAL_WORD){
return (illegalRequest("Request handler must be in state AWAITING_FINAL_WORD to be able to accept messages of type finalWordAnswer."));
};
if (3 <= model.finalWordGuesses){
return (illegalRequest("Final word guesses must not be 2 or greater."));
};
if ((((0 > _arg1.timeBonus)) || (((0.01 * model.score) < _arg1.timeBonus)))){
return (illegalRequest("Time bonus must be in range [0-MaxBonus]"));
};
model.finalWordGuesses++;
model.finalWordGivenAnswer = _arg1.word;
var _local2 = (model.finalWordCorrectAnswer.toLowerCase() == model.finalWordGivenAnswer.toLowerCase());
if (!_arg1.result){
if (1 == model.finalWordGuesses){
model.score = int(Math.floor(((2 * model.score) / 3)));
} else {
if (2 == model.finalWordGuesses){
model.score = int(Math.floor((model.score / 2)));
} else {
if (3 == model.finalWordGuesses){
model.score = 0;
};
};
};
};
if (_arg1.result){
model.timeBonus = (model.timeBonus + _arg1.timeBonus);
};
var _local3 = "";
if (2 <= model.finalWordGuesses){
_local3 = (_local3 + model.finalWordCorrectAnswer.charAt(0));
};
if (((_local2) || ((3 == model.finalWordGuesses)))){
model.state = ProxyModel.STATE_POST_GAME;
};
return (new Message(MsgTypes.finalWordAnswerResponse, {result:_local2, firstLetter:_local3}));
}
private function onQuestionRequest(_arg1:Message):Message{
if (model.state != ProxyModel.STATE_AWAITING_QUESTION_REQUEST){
return (illegalRequest("Request handler must be in state AWAITING_QUESTION_REQUEST to be able to accept messages of type questionRequest."));
};
if ((((0 > _arg1.index)) || ((7 < _arg1.index)))){
return (illegalRequest("Question must be in range [0-7]."));
};
if (-1 != model.questions[_arg1.index].givenAnswer){
return (illegalRequest("Request handler cannot accept multiple questionRequest messages for the same question."));
};
model.state = ProxyModel.STATE_AWAITING_QUESTION_ANSWER;
model.activeQuestion = _arg1.index;
var _local2:int = model.activeQuestion;
var _local3:Object = new Object();
_local3.question = model.questions[_local2].question;
_local3.answers0 = model.questions[_local2].answers[0];
_local3.answers1 = model.questions[_local2].answers[1];
_local3.answers2 = model.questions[_local2].answers[2];
_local3.answers3 = model.questions[_local2].answers[3];
return (new Message(MsgTypes.question, _local3));
}
private function loadData():void{
var _local1:Array = getQuestions();
var _local2:int;
while (_local2 < 8) {
model.questions[_local2] = {category:_local1[_local2].category, value:_local1[_local2].value, question:_local1[_local2].question, answers:_local1[_local2].answers, correctAnswer:_local1[_local2].correctAnswer, givenAnswer:_local1[_local2].givenAnswer, timeBonus:_local1[_local2].timeBonus};
_local2++;
};
var _local3:Array = getWordPairs();
var _local4:int;
while (_local4 < 5) {
model.wordPairs[_local4] = {words:_local3[_local4].words, correctAnswer:_local3[_local4].correctAnswer, givenAnswer:_local3[_local4].givenAnswer, timeBonus:_local3[_local4].timeBonus};
_local4++;
};
model.finalWordCorrectAnswer = _local3[5].correctAnswer;
}
private function onCategoriesRequest(_arg1:Message):Message{
if (model.state != ProxyModel.STATE_PRE_GAME){
return (illegalRequest("Request handler must be in state PRE_GAME to be able to accept messages of type categoryRequest."));
};
model.state = ProxyModel.STATE_AWAITING_QUESTION_REQUEST;
var _local2:Object = new Object();
var _local3:int;
while (_local3 < 8) {
_local2[("names" + _local3)] = model.questions[_local3].category;
_local2[("values" + _local3)] = model.questions[_local3].value;
_local3++;
};
return (new Message(MsgTypes.categories, _local2));
}
public function getRequestResponse(_arg1:String):String{
var id:int;
var message:Message;
var clientModel:ProxyModel;
var response:Message;
var bytes:ByteArray;
var requestString = _arg1;
if ("pusher" == requestString){
return ("pusher");
};
if (illegalRequestMade){
response = illegalRequest("Request ignored");
} else {
try {
if ("c" == requestString.charAt(0)){
Assert.halt("String request not yet supported");
} else {
bytes = Base64.decodeToByteArray(requestString.substring(1));
id = bytes.readShort();
message = new Message(bytes);
clientModel = new ProxyModel(bytes);
};
if (model == null){
loadData();
model.copyStateVariables(clientModel);
};
if (!model.stateEquals(clientModel)){
response = illegalRequest("Proxy and client state does not match");
} else {
if (message.type == MsgTypes.categoriesRequest){
response = onCategoriesRequest(message);
} else {
if (message.type == MsgTypes.questionRequest){
response = onQuestionRequest(message);
} else {
if (message.type == MsgTypes.questionAnswer){
response = onQuestionAnswer(message);
} else {
if (message.type == MsgTypes.wordPairRequest){
response = onWordPairRequest(message);
} else {
if (message.type == MsgTypes.wordPairAnswer){
response = onWordPairAnswer(message);
} else {
if (message.type == MsgTypes.finalWordLengthRequest){
response = onFinalWordLengthRequest(message);
} else {
if (message.type == MsgTypes.finalWordAnswer){
response = onFinalWordAnswer(message);
} else {
response = illegalRequest("Unrecognized request type");
};
};
};
};
};
};
};
};
} catch(e:Error) {
response = illegalRequest((("Exception (" + e.name) + ") thrown during request handling"));
};
};
var binaryResponse:ByteArray = new ByteArray();
binaryResponse.writeShort(id);
binaryResponse.writeBytes(response.toBinaryPlayData());
binaryResponse.writeBytes(model.toByteArray());
return (("b" + Base64.encodeByteArray(binaryResponse)));
}
}
}//package com.midasplayer.games.leredita
Section 30
//ViewModel (com.midasplayer.games.leredita.ViewModel)
package com.midasplayer.games.leredita {
import flash.display.*;
public class ViewModel {
public var selectedWord:int;
public var state:int;// = 0
public var answeredWordPairs:int;// = 0
public var finalWordGuesses:int;// = 0
public var activeAnimations:Array;
public var timeBonus:int;// = 0
public var answeredCorrectly:Boolean;
public var selectedQuestion:int;
public var finalWordLength:int;
public var answerStates:Array;
public var questionValues:Array;
public var finalInputField:FinalInputField;
public var finalWord:Array;
public var answeredQuestions:Array;
public var playerScore:int;// = 0
public var mainGraphics:MainGraphics;
public var opponentScore:int;// = 0
public var unansweredQuestions:Array;
public var selectedAnswer:int;
public static const STATE_QUESTION_SELECTION:int = 1;
public static const STATE_QUESTION_SELECTED:int = 2;
public static const STATE_WORDPAIR_SELECTED:int = 6;
public static const STATE_FINALWORD_ENTERED:int = 8;
public static const STATE_FINALWORD_ENTER:int = 7;
public static const STATE_ANSWER_SELECTED:int = 4;
public static const STATE_ANSWER_SELECTION:int = 3;
public static const STATE_NO_INPUT:int = 0;
public static const STATE_WORDPAIR_SELECTION:int = 5;
public function ViewModel(){
var _local1:int;
answeredQuestions = new Array();
unansweredQuestions = [0, 1, 2, 3, 4, 5, 6, 7];
questionValues = new Array();
finalWord = new Array();
mainGraphics = new MainGraphics();
activeAnimations = new Array();
super();
stopAnimationOnFullTree(mainGraphics);
disableMouseOnFullTree(mainGraphics);
mainGraphics.introVideo.visible = false;
mainGraphics.clock.visible = false;
mainGraphics.timeBonus.visible = false;
mainGraphics.timeBar.visible = false;
mainGraphics.soundButton.visible = false;
mainGraphics.musicButton.visible = false;
mainGraphics.quitButton.visible = false;
mainGraphics.infoPanel.visible = false;
mainGraphics.ghigliottina.visible = false;
mainGraphics.duello.visible = false;
mainGraphics.duello.glassWalls.visible = false;
mainGraphics.duello.scoreBrick.visible = false;
mainGraphics.duello.floor.visible = false;
mainGraphics.duello.legalText.selectable = false;
mainGraphics.infoPanel.signupButton.visible = false;
mainGraphics.infoPanel.signupTexts.visible = false;
var _local2:MovieClip = MovieClip(mainGraphics.duello);
var _local3:Array = [_local2.tile0, _local2.tile1, _local2.tile2, _local2.tile3, _local2.tile4, _local2.tile5, _local2.tile6, _local2.tile7];
_local1 = 0;
while (_local1 < 8) {
_local3[_local1].visible = false;
_local3[_local1].hitSprite.visible = false;
_local3[_local1].hatch.visible = false;
_local3[_local1].expand.visible = false;
_local1++;
};
var _local4:Array = [_local2.answer0, _local2.answer1, _local2.answer2, _local2.answer3];
_local1 = 0;
while (_local1 < 4) {
_local4[_local1].visible = false;
_local1++;
};
}
private function disableMouseOnFullTree(_arg1:InteractiveObject):void{
var _local2:DisplayObjectContainer;
var _local3:int;
var _local4:Object;
_arg1.mouseEnabled = false;
if ((_arg1 is DisplayObjectContainer)){
_local2 = (_arg1 as DisplayObjectContainer);
_local2.mouseChildren = false;
_local3 = 0;
while (_local3 < _local2.numChildren) {
_local4 = _local2.getChildAt(_local3);
if ((_local4 is InteractiveObject)){
disableMouseOnFullTree((_local4 as InteractiveObject));
};
_local3++;
};
};
}
private function stopAnimationOnFullTree(_arg1:DisplayObjectContainer):void{
var _local3:Object;
if ((_arg1 is MovieClip)){
(_arg1 as MovieClip).stop();
};
var _local2:int;
while (_local2 < _arg1.numChildren) {
_local3 = _arg1.getChildAt(_local2);
if ((_local3 is DisplayObjectContainer)){
stopAnimationOnFullTree((_local3 as DisplayObjectContainer));
};
_local2++;
};
}
}
}//package com.midasplayer.games.leredita
Section 31
//MtRandom (com.midasplayer.math.MtRandom)
package com.midasplayer.math {
import flash.utils.*;
public class MtRandom {
private var mti:uint;
private var mt:Array;
public static var MATRIX_A:uint = 2567483615;
public static var UPPER_MASK:uint = 2147483648;
public static var LOWER_MASK:uint = 2147483647;
public static var M:int = 397;
public static var N:int = 624;
private static var mag01:Array = [uint(0), uint(MATRIX_A)];
public function MtRandom(_arg1:uint=0){
mti = (N + 1);
super();
if (_arg1 == 0){
_arg1 = getTimer();
};
mt = new Array(N);
init_genrand(_arg1);
}
private function genrand_int32():uint{
var _local1:Number;
var _local2:uint;
if (mti >= N){
if (mti == (N + 1)){
init_genrand(5489);
};
_local2 = 0;
while (_local2 < (N - M)) {
_local1 = ((mt[_local2] & UPPER_MASK) | (mt[(_local2 + 1)] & LOWER_MASK));
mt[_local2] = ((mt[(_local2 + M)] ^ (_local1 >>> 1)) ^ mag01[uint((_local1 & 1))]);
_local2++;
};
while (_local2 < (N - 1)) {
_local1 = ((mt[_local2] & UPPER_MASK) | (mt[(_local2 + 1)] & LOWER_MASK));
mt[_local2] = ((mt[(_local2 + (M - N))] ^ (_local1 >>> 1)) ^ mag01[uint((_local1 & 1))]);
_local2++;
};
_local1 = ((mt[(N - 1)] & UPPER_MASK) | (mt[0] & LOWER_MASK));
mt[(N - 1)] = ((mt[(M - 1)] ^ (_local1 >>> 1)) ^ mag01[uint((_local1 & 1))]);
mti = 0;
};
_local1 = mt[mti++];
_local1 = (_local1 ^ (_local1 >>> 11));
_local1 = (_local1 ^ ((_local1 << 7) & 2636928640));
_local1 = (_local1 ^ ((_local1 << 15) & 4022730752));
_local1 = (_local1 ^ (_local1 >>> 18));
return (uint(_local1));
}
private function next(_arg1:uint):uint{
return ((genrand_int32() & ((uint(1) << _arg1) - uint(1))));
}
private function init_genrand(_arg1:uint):void{
var _local2:uint;
var _local3:uint;
mt[0] = uint(_arg1);
mti = 1;
while (mti < N) {
_local2 = (mt[(mti - 1)] ^ (mt[(mti - 1)] >>> 30));
_local3 = uint((_local2 * 1289));
_local3 = uint((_local3 * 1406077));
_local3 = uint((_local3 + mti));
mt[mti] = _local3;
mti++;
};
}
public function nextFloat():Number{
return ((next(24) / 16777216));
}
public function setSeed(_arg1:uint):void{
init_genrand(_arg1);
}
public function nextDouble():Number{
return ((next(24) / 16777216));
}
public function nextInt(_arg1:uint):uint{
return (((genrand_int32() & 2147483647) % _arg1));
}
}
}//package com.midasplayer.math
Section 32
//IMsgDispatcher (com.midasplayer.messaging.IMsgDispatcher)
package com.midasplayer.messaging {
public interface IMsgDispatcher {
function removeMsgListener(_arg1:Object, _arg2:Function):void;
function hasMsgListener(_arg1:Object):Boolean;
function addMsgListener(_arg1:Object, _arg2:Function):void;
function dispatchMessage(_arg1:Message):void;
}
}//package com.midasplayer.messaging
Section 33
//Message (com.midasplayer.messaging.Message)
package com.midasplayer.messaging {
import flash.utils.*;
import com.midasplayer.util.*;
public dynamic class Message {
public var type:Object;
public var tick:int;// = -1
private static const idMap:Dictionary = maps[0];
private static const typeMap:Dictionary = maps[1];
public static const serializationDelimiter:String = " ";
public static const templates:Class = MsgTypes;
private static const maps:Array = createMaps();
public function Message(_arg1:Object, _arg2:Object=null){
var typeData:Object;
var p:String;
var descriptor = _arg1;
var args = _arg2;
super();
if ((descriptor is String)){
initWithPlayData((descriptor as String));
} else {
if ((descriptor is ByteArray)){
initWithBinaryPlayData((descriptor as ByteArray));
} else {
typeData = typeMap[descriptor];
Assert.assert(typeData, ("Descriptor argument if not a string must be one of the templates declared in class " + getQualifiedClassName(templates)));
type = typeData.type;
if (typeData.properties.length){
Assert.assert(args, ("Args argument must not be null for template " + typeData.name));
Assert.assert((function ():int{
var _local2:*;
var _local1:* = 0;
for (_local2 in args) {
_local1++;
};
return (_local1);
}() == function ():int{
var _local2:*;
var _local1:* = 0;
for (_local2 in type) {
_local1++;
};
return (_local1);
}()), ("Args argument must contain the same number of elements as template " + typeData.name));
for each (p in typeData.properties) {
Assert.assert(!((args[p] == undefined)), ((("Args argument must contain data for property " + p) + " declared in the template ") + typeData.name));
Assert.assert((args[p] is type[p]), (("Argument data for property " + p) + " must be of or convertible to the property datatype"));
this[p] = args[p];
};
};
};
};
}
private function initWithBinaryPlayData(_arg1:ByteArray):void{
var _local3:String;
var _local4:int;
var _local5:String;
var _local6:int;
Assert.assert((0 < _arg1.length), "Play data must contain more than zero bytes");
var _local2:Object = idMap[_arg1[_arg1.position]];
Assert.assert(_local2, ("Unrecognized play data type identifier " + _arg1[_arg1.position]));
type = _local2.type;
_arg1.position++;
tick = _arg1.readShort();
for each (_local3 in _local2.properties) {
if (Boolean == type[_local3]){
this[_local3] = _arg1.readBoolean();
} else {
if (int == type[_local3]){
this[_local3] = _arg1.readInt();
} else {
if (Number == type[_local3]){
this[_local3] = _arg1.readDouble();
} else {
if (String == type[_local3]){
_local4 = _arg1.readShort();
_local5 = new String();
_local6 = 0;
while (_local6 < _local4) {
_local5 = (_local5 + String.fromCharCode(_arg1.readShort()));
_local6++;
};
this[_local3] = _local5;
} else {
Assert.halt((((("Property " + _local3) + " in template ") + _local2.name) + " must not be of a type other than Boolean, int, Number or String if it should deserialized from compressed play data"));
};
};
};
};
};
}
public function typeName():String{
var _local1:Object = typeMap[type];
return (_local1.name);
}
public function toPlayData():String{
var _local3:String;
var _local4:String;
var _local1:Object = typeMap[type];
var _local2:String = ((_local1.id + " ") + tick);
for each (_local3 in _local1.properties) {
if (Boolean == _local1.type[_local3]){
_local2 = (_local2 + (serializationDelimiter + (this[_local3]) ? "1" : "0"));
} else {
_local4 = this[_local3].toString();
Assert.assert((-1 == _local4.search(serializationDelimiter)), (((((("Property " + _local3) + " serialized to \"") + _local4) + "\" contains the serialization delimiter pattern \"") + serializationDelimiter) + "\""));
_local2 = (_local2 + (serializationDelimiter + _local4));
};
};
return (_local2);
}
private function initWithPlayData(_arg1:String):void{
var _local5:String;
var _local2:Array = _arg1.split(serializationDelimiter);
Assert.assert((0 < _local2.length), "Play data must contain more than zero elements");
var _local3:Object = idMap[parseInt(_local2[0])];
Assert.assert(_local3, ("Unrecognized play data type identifier " + _local2[0]));
type = _local3.type;
Assert.assert(!(isNaN(_local2[1])), (("Play data \"" + _arg1) + "\" must use a number format parsable with parseInt"));
tick = parseInt(_local2[1]);
var _local4 = 2;
for each (_local5 in _local3.properties) {
if (Boolean == type[_local5]){
this[_local5] = ((!(("0" == _local2[_local4]))) && (!(("false" == _local2[_local4].toLowerCase()))));
} else {
if (int == type[_local5]){
this[_local5] = parseInt(_local2[_local4]);
Assert.assert(!(isNaN(this[_local5])), (("Play data \"" + _arg1) + "\" must use a number format parsable with parseInt"));
} else {
if (Number == type[_local5]){
this[_local5] = parseFloat(_local2[_local4]);
Assert.assert(!(isNaN(this[_local5])), (("Play data \"" + _arg1) + "\" must use a number format parsable with parseFloat"));
} else {
this[_local5] = new type[_local5](_local2[_local4]);
};
};
};
_local4++;
};
}
public function toBinaryPlayData():ByteArray{
var _local3:String;
var _local4:String;
var _local5:int;
var _local1:Object = typeMap[type];
var _local2:ByteArray = new ByteArray();
_local2.writeByte(_local1.id);
_local2.writeShort(tick);
for each (_local3 in _local1.properties) {
if (Boolean == _local1.type[_local3]){
_local2.writeByte((this[_local3]) ? 1 : 0);
} else {
if (int == _local1.type[_local3]){
_local2.writeInt(this[_local3]);
} else {
if (Number == _local1.type[_local3]){
_local2.writeDouble(this[_local3]);
} else {
if (String == _local1.type[_local3]){
_local4 = this[_local3];
_local2.writeShort(_local4.length);
_local5 = 0;
while (_local5 < _local4.length) {
_local2.writeShort(_local4.charCodeAt(_local5));
_local5++;
};
} else {
Assert.halt((((("Property " + _local3) + " in template ") + _local1.name) + " must not be of a type other than Boolean, int, Number or String if it should serialized to compressed play data"));
};
};
};
};
};
_local2.position = 0;
return (_local2);
}
public function toString():String{
var _local3:String;
var _local1:Object = typeMap[type];
var _local2:String = _local1.name;
for each (_local3 in _local1.properties) {
_local2 = (_local2 + (((" " + _local3) + ":") + this[_local3]));
};
return (_local2);
}
public static function typeFromID(_arg1:int):Object{
var _local2:Object = idMap[_arg1];
return ((_local2) ? _local2.type : null);
}
private static function createMaps():Array{
var _local2:XML;
var _local3:Dictionary;
var _local4:Dictionary;
var _local5:int;
var _local6:String;
var _local7:Object;
var _local8:Array;
var _local9:String;
var _local10:Object;
var _local1:Array = new Array();
for each (_local2 in describeType(templates).child("constant")) {
if ("Object" == _local2.attribute("type")){
_local1.push(_local2.attribute("name"));
};
};
Assert.assert((0 < _local1.length), (("Template class " + getQualifiedClassName(templates)) + " contains no public static constants of type Object"));
_local1.sort();
_local3 = new Dictionary();
_local4 = new Dictionary();
_local5 = 0;
for each (_local6 in _local1) {
_local7 = templates[_local6];
_local8 = new Array();
for (_local9 in _local7) {
Assert.assert(!((_local7[_local9] == null)), (("Template property " + _local9) + " must not be null"));
Assert.assert(!((_local7[_local9] == uint)), (("Template property " + _local9) + " must not be of illegal type uint"));
_local8.push(_local9);
};
_local8.sort();
_local10 = {id:_local5, name:_local6, type:_local7, properties:_local8};
_local3[_local5] = _local10;
_local4[_local7] = _local10;
_local5++;
};
return ([_local3, _local4]);
}
public static function idFromType(_arg1:Object):int{
var _local2:Object = typeMap[_arg1];
return ((_local2) ? _local2.id : -1);
}
}
}//package com.midasplayer.messaging
Section 34
//MsgDispatcher (com.midasplayer.messaging.MsgDispatcher)
package com.midasplayer.messaging {
import flash.utils.*;
import com.midasplayer.util.*;
public class MsgDispatcher implements IMsgDispatcher {
private var target:IMsgDispatcher;// = null
private var listeners:Array;
public function MsgDispatcher(_arg1:IMsgDispatcher=null){
listeners = new Array();
super();
if (_arg1){
this.target = _arg1;
};
}
public function removeMsgListener(_arg1:Object, _arg2:Function):void{
var _local5:int;
Assert.assert(!((-1 == Message.idFromType(_arg1))), ("Type argument must be one of the templates declared in class " + getQualifiedClassName(Message.templates)));
if (target){
target.removeMsgListener(_arg1, _arg2);
return;
};
var _local3:int = Message.idFromType(_arg1);
var _local4:Array = listeners[_local3];
if (_local4){
_local5 = _local4.lastIndexOf(_arg2);
if (-1 != _local5){
_local4.splice(_local5, 1);
if (0 == _local4.length){
listeners[_local3] = null;
};
};
};
}
public function hasMsgListener(_arg1:Object):Boolean{
Assert.assert(!((-1 == Message.idFromType(_arg1))), ("Type argument must be one of the templates declared in class " + getQualifiedClassName(Message.templates)));
if (target){
return (target.hasMsgListener(_arg1));
};
return (Boolean(listeners[Message.idFromType(_arg1)]));
}
public function dispatchMessage(_arg1:Message):void{
var _local2:Function;
Assert.assert(!((null == _arg1)), "Message argument must not be null");
if (target){
return (target.dispatchMessage(_arg1));
};
for each (_local2 in listeners[Message.idFromType(_arg1.type)]) {
_local2(_arg1);
};
}
public function addMsgListener(_arg1:Object, _arg2:Function):void{
Assert.assert(!((-1 == Message.idFromType(_arg1))), ("Type argument must be one of the templates declared in class " + getQualifiedClassName(Message.templates)));
if (target){
target.addMsgListener(_arg1, _arg2);
return;
};
var _local3:Array = listeners[Message.idFromType(_arg1)];
if (_local3){
_local3.push(_arg2);
} else {
listeners[Message.idFromType(_arg1)] = new Array(_arg2);
};
}
}
}//package com.midasplayer.messaging
Section 35
//MsgTypes (com.midasplayer.messaging.MsgTypes)
package com.midasplayer.messaging {
public dynamic class MsgTypes {
public static const wordPairAnswerResponse:Object = {correctAnswer:int};
public static const questionAnswer:Object = {index:int, timeBonus:int};
public static const questionRequest:Object = {index:int};
public static const finalWordLengthRequest:Object = {};
public static const categoriesRequest:Object = {};
public static const gameData:Object = {sound:Boolean, music:Boolean};
public static const gameEnd:Object = {};
public static const countdownUpdate:Object = {remaining:int};
public static const categories:Object = {names0:String, names1:String, names2:String, names3:String, names4:String, names5:String, names6:String, names7:String, values0:int, values1:int, values2:int, values3:int, values4:int, values5:int, values6:int, values7:int};
public static const finalWordAnswerResponse:Object = {result:Boolean, firstLetter:String};
public static const questionSelected:Object = {index:int};
public static const questionAnswerResponse:Object = {correctAnswer:int};
public static const quitGame:Object = {};
public static const wordPairAnswer:Object = {index:int, timeBonus:int};
public static const timeBonus:Object = {bonus:int};
public static const wordPairRequest:Object = {};
public static const timelimitHit:Object = {};
public static const question:Object = {question:String, answers0:String, answers1:String, answers2:String, answers3:String};
public static const wordPair:Object = {words0:String, words1:String};
public static const finalWordLength:Object = {length:int, finalWord:String};
public static const illegalRequest:Object = {};
public static const finalWordAnswer:Object = {word:String, timeBonus:int};
}
}//package com.midasplayer.messaging
Section 36
//ManagedSound (com.midasplayer.sound.ManagedSound)
package com.midasplayer.sound {
import flash.media.*;
public class ManagedSound {
public var activeSounds:Array;
private var manager:SoundManager;
private var ClassReference:Class;
public function ManagedSound(_arg1:SoundManager, _arg2:Class){
activeSounds = new Array();
super();
this.manager = _arg1;
this.ClassReference = _arg2;
}
public function stop():void{
var _local1:int;
while (_local1 < activeSounds.length) {
activeSounds[_local1].stop();
_local1++;
};
}
public function play(_arg1:Number=1, _arg2:Number=0, _arg3:Function=null):ManagedSoundChannel{
var _local4:SoundChannel = new ClassReference().play(0, 0, new SoundTransform(_arg1, _arg2));
return (new ManagedSoundChannel(manager, this, _local4, _arg3));
}
public function loop(_arg1:Number=1, _arg2:Number=0, _arg3:Number=999999999):ManagedSoundChannel{
var _local4:SoundChannel = new ClassReference().play(0, _arg3, new SoundTransform(_arg1, _arg2));
return (new ManagedSoundChannel(manager, this, _local4, null));
}
public function playAt(_arg1:Number=1, _arg2:Number=0, _arg3:Number=0, _arg4:Function=null):ManagedSoundChannel{
var _local5:SoundChannel = new ClassReference().play(_arg2, 0, new SoundTransform(_arg1, _arg3));
return (new ManagedSoundChannel(manager, this, _local5, _arg4));
}
public function fadeToAndStop(_arg1:Number, _arg2:Number):void{
var _local3:int;
while (_local3 < activeSounds.length) {
activeSounds[_local3].fadeToAndStop(_arg1, _arg2);
_local3++;
};
}
public function isPlaying():Boolean{
return ((activeSounds.length > 0));
}
public function update():void{
var _local1:int;
while (_local1 < activeSounds.length) {
activeSounds[_local1].update();
_local1++;
};
}
public function fadeTo(_arg1:Number, _arg2:Number):void{
var _local3:int;
while (_local3 < activeSounds.length) {
activeSounds[_local3].fadeTo(_arg1, _arg2);
_local3++;
};
}
public function panTo(_arg1:Number, _arg2:Number):void{
var _local3:int;
while (_local3 < activeSounds.length) {
activeSounds[_local3].panTo(_arg1, _arg2);
_local3++;
};
}
public function setPan(_arg1:Number):void{
var _local2:int;
while (_local2 < activeSounds.length) {
activeSounds[_local2].setPan(_arg1);
_local2++;
};
}
public function setVolume(_arg1:Number):void{
var _local2:int;
while (_local2 < activeSounds.length) {
activeSounds[_local2].setVolume(_arg1);
_local2++;
};
}
}
}//package com.midasplayer.sound
Section 37
//ManagedSoundChannel (com.midasplayer.sound.ManagedSoundChannel)
package com.midasplayer.sound {
import flash.events.*;
import flash.utils.*;
import flash.media.*;
public class ManagedSoundChannel {
private var fadeStartVolume:Number;// = -1
private var channel:SoundChannel;
private var fadeEndVolume:Number;// = -1
private var targetVolume:Number;
private var targetPan:Number;
private var sound:ManagedSound;
private var stopAfterFade:Boolean;// = false
private var panEndTime:Number;// = -1
private var fadeEndTime:Number;// = -1
private var manager:SoundManager;
private var playing:Boolean;// = true
private var panStartTime:Number;// = -1
private var fadeStartTime:Number;// = -1
private var panEndVolume:Number;// = -1
private var onEnd:Function;
private var panStartVolume:Number;// = -1
public function ManagedSoundChannel(_arg1:SoundManager, _arg2:ManagedSound, _arg3:SoundChannel, _arg4:Function){
this.manager = _arg1;
this.sound = _arg2;
this.channel = _arg3;
this.onEnd = _arg4;
_arg2.activeSounds.push(this);
if (_arg3 == null){
soundComplete(null);
return;
};
_arg3.addEventListener(Event.SOUND_COMPLETE, soundComplete);
targetVolume = _arg3.soundTransform.volume;
targetPan = _arg3.soundTransform.pan;
update();
}
public function stop():void{
if (!playing){
return;
};
if (channel == null){
return;
};
channel.stop();
soundComplete(null);
}
public function update():void{
var _local1:Number;
if (!playing){
return;
};
if (fadeStartTime >= 0){
_local1 = ((getTimer() - fadeStartTime) / (fadeEndTime - fadeStartTime));
if (_local1 < 0){
_local1 = 0;
};
if (_local1 > 1){
_local1 = 1;
};
targetVolume = (fadeStartVolume + ((fadeEndVolume - fadeStartVolume) * _local1));
targetVolume = (targetVolume * targetVolume);
if (_local1 == 1){
fadeStartTime = -1;
};
if ((((_local1 == 1)) && (stopAfterFade))){
stop();
};
};
if (panStartTime >= 0){
_local1 = ((getTimer() - panStartTime) / (panEndTime - panStartTime));
if (_local1 < 0){
_local1 = 0;
};
if (_local1 > 1){
_local1 = 1;
};
targetPan = (panStartVolume + ((panEndVolume - panStartVolume) * _local1));
if (_local1 == 1){
panStartTime = -1;
};
};
var _local2:Number = (targetVolume * manager.volume);
var _local3:Number = targetPan;
if (channel == null){
return;
};
if (((!((_local2 == channel.soundTransform.volume))) || (!((_local3 == channel.soundTransform.pan))))){
channel.soundTransform = new SoundTransform(_local2, _local3);
};
}
public function isPlaying():Boolean{
return (playing);
}
public function fadeTo(_arg1:Number, _arg2:Number):void{
if (!playing){
return;
};
fadeStartVolume = Math.sqrt(targetVolume);
fadeEndVolume = Math.sqrt(_arg1);
fadeStartTime = getTimer();
fadeEndTime = (getTimer() + _arg2);
stopAfterFade = false;
}
public function setPan(_arg1:Number):void{
if (!playing){
return;
};
if (channel == null){
return;
};
channel.soundTransform.pan = _arg1;
panStartTime = -1;
update();
}
public function fadeToAndStop(_arg1:Number, _arg2:Number):void{
if (!playing){
return;
};
fadeTo(_arg1, _arg2);
stopAfterFade = true;
}
public function setVolume(_arg1:Number):void{
if (!playing){
return;
};
stopAfterFade = false;
this.targetVolume = _arg1;
fadeStartTime = -1;
update();
}
public function soundComplete(_arg1:Event):void{
if (!playing){
return;
};
sound.activeSounds.splice(sound.activeSounds.indexOf(this), 1);
if (null != onEnd){
onEnd();
};
playing = false;
}
public function panTo(_arg1:Number, _arg2:Number):void{
if (!playing){
return;
};
panStartVolume = targetPan;
panEndVolume = _arg1;
panStartTime = getTimer();
panEndTime = (getTimer() + _arg2);
}
}
}//package com.midasplayer.sound
Section 38
//SoundManager (com.midasplayer.sound.SoundManager)
package com.midasplayer.sound {
import flash.utils.*;
public class SoundManager {
private var fadeStartVolume:Number;// = -1
private var lastTime:Number;// = -1
private var managedSounds:Array;
private var fadeEndTime:Number;// = -1
private var fadeStartTime:Number;// = -1
private var fadeEndVolume:Number;// = -1
public var volume:Number;// = 1
private var managedSoundMap:Object;
public function SoundManager(){
managedSoundMap = new Object();
managedSounds = new Array();
super();
}
public function update():void{
var _local3:Number;
var _local1:Number = getTimer();
if (lastTime < 0){
lastTime = _local1;
};
if (fadeStartTime >= 0){
_local3 = ((getTimer() - fadeStartTime) / (fadeEndTime - fadeStartTime));
if (_local3 < 0){
_local3 = 0;
};
if (_local3 > 1){
_local3 = 1;
};
volume = (fadeStartVolume + ((fadeEndVolume - fadeStartVolume) * _local3));
volume = (volume * volume);
if (_local3 == 1){
fadeStartTime = -1;
};
};
var _local2:int;
while (_local2 < managedSounds.length) {
managedSounds[_local2].update();
_local2++;
};
}
public function stopAll():void{
var _local1:int;
while (_local1 < managedSounds.length) {
managedSounds[_local1].stop();
_local1++;
};
}
public function getFromClass(_arg1:Class):ManagedSound{
var _local2:String = getQualifiedClassName(_arg1);
if (managedSoundMap[_local2] == null){
managedSoundMap[_local2] = new ManagedSound(this, _arg1);
managedSounds.push(managedSoundMap[_local2]);
};
return (managedSoundMap[_local2]);
}
public function get(_arg1:String):ManagedSound{
var _local2:Class;
if (managedSoundMap[_arg1] == null){
_local2 = (getDefinitionByName(_arg1) as Class);
if (_local2 == null){
_local2 = (getDefinitionByName(("sound." + _arg1)) as Class);
};
if (_local2 == null){
_local2 = (getDefinitionByName(("snd." + _arg1)) as Class);
};
if (_local2 == null){
throw (new Error(("Failed to find sound " + _arg1)));
};
managedSoundMap[_arg1] = new ManagedSound(this, _local2);
managedSounds.push(managedSoundMap[_arg1]);
};
return (managedSoundMap[_arg1]);
}
public function fadeTo(_arg1:Number, _arg2:Number):void{
fadeStartVolume = Math.sqrt(volume);
fadeEndVolume = Math.sqrt(_arg1);
fadeStartTime = getTimer();
fadeEndTime = (getTimer() + _arg2);
}
public function setVolume(_arg1:Number):void{
this.volume = _arg1;
fadeStartTime = -1;
}
}
}//package com.midasplayer.sound
Section 39
//I18n (com.midasplayer.text.I18n)
package com.midasplayer.text {
public class I18n {
private static var m_strings:Object;
public static function init(_arg1:Object):void{
var _local2:String;
m_strings = new Object();
for (_local2 in _arg1) {
m_strings[_local2] = _arg1[_local2];
};
}
public static function getString(_arg1:String, ... _args):String{
var _local3:String;
var _local4:int;
var _local5:RegExp;
if (m_strings[_arg1] != undefined){
_local3 = m_strings[_arg1];
if (_args.length > 0){
_local4 = 0;
while (_local4 < _args.length) {
_local5 = new RegExp((("\\{" + _local4) + "\\}"), "gi");
_local3 = _local3.replace(_local5, _args[_local4]);
_local4++;
};
};
return (_local3);
} else {
};
return ((!NULL! + !NULL!));
}
}
}//package com.midasplayer.text
Section 40
//Assert (com.midasplayer.util.Assert)
package com.midasplayer.util {
public class Assert {
public static var enabled:Boolean = true;
private static var handlers:Array = [defaultHandler];
public static function verify(_arg1:Boolean, _arg2:String=null):void{
assert(_arg1, _arg2);
}
public static function getAsFormattedString(_arg1:String, _arg2:String, _arg3:int, _arg4:String, _arg5:String, _arg6:String=null):String{
return ((((((("Assertion failure in " + _arg4) + ".") + _arg5) + (_arg1) ? (": " + _arg1) : "") + (_arg2) ? (((" " + _arg2) + ":") + _arg3) : "") + (_arg6) ? ("\n" + _arg6) : "\n"));
}
public static function assert(_arg1:Boolean, _arg2:String=null):void{
var _local3:String;
var _local4:int;
var _local5:int;
var _local7:int;
var _local10:int;
var _local11:String;
var _local16:String;
if (((!(enabled)) || (_arg1))){
return;
};
_local3 = new Error().getStackTrace();
_local3 = _local3.substring((_local3.indexOf("\n", 6) + 1));
_local4 = 4;
_local5 = _local3.indexOf("/", _local4);
var _local6:int = _local3.indexOf("(", _local4);
_local7 = _local3.indexOf("\n", _local4);
var _local8:int = ((_local5 >= _local7)) ? _local6 : (("$" == _local3.charAt((_local5 - 1)))) ? (_local5 - 1) : _local5;
var _local9:int = ((_local5 >= _local7)) ? _local4 : (_local5 + 1);
_local10 = _local6;
_local11 = _local3.substring((_local3.indexOf("[") + 1), _local3.indexOf("]"));
var _local12:String = _local11.substring(0, _local11.lastIndexOf(":"));
var _local13:int = int(_local11.substring((_local11.lastIndexOf(":") + 1)));
var _local14:String = _local3.substring(_local4, _local8);
var _local15:String = _local3.substring(_local9, _local10);
if (handlers[(handlers.length - 1)](_arg2, _local12, _local13, _local14, _local15, _local3)){
_local16 = getAsFormattedString(_arg2, _local12, _local13, _local14, _local15, null);
throw (new AssertionError(_local16.substr(0, (_local16.length - 1))));
};
}
public static function pushHandler(_arg1:Function):void{
handlers.push(_arg1);
}
public static function halt(_arg1:String=null):void{
if (_arg1){
throw (new Error(_arg1));
};
throw (new Error("Halting execution"));
}
public static function popHandler():void{
Assert.assert((1 < handlers.length), "Trying to pop the default assertion handler.");
if (1 < handlers.length){
handlers.pop();
};
}
private static function defaultHandler(_arg1:String, _arg2:String, _arg3:int, _arg4:String, _arg5:String, _arg6:String):Boolean{
return (true);
}
}
}//package com.midasplayer.util
Section 41
//AssertionError (com.midasplayer.util.AssertionError)
package com.midasplayer.util {
public class AssertionError extends Error {
public function AssertionError(_arg1:String){
super(_arg1);
}
}
}//package com.midasplayer.util
Section 42
//Base64 (com.midasplayer.util.Base64)
package com.midasplayer.util {
import flash.utils.*;
public class Base64 {
private static const BASE64_CHARS:String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
public static function decodeToByteArray(_arg1:String):ByteArray{
var _local6:uint;
var _local7:uint;
var _local2:ByteArray = new ByteArray();
var _local3:Array = new Array(4);
var _local4:Array = new Array(3);
var _local5:uint;
while (_local5 < _arg1.length) {
_local6 = 0;
while ((((_local6 < 4)) && (((_local5 + _local6) < _arg1.length)))) {
_local3[_local6] = BASE64_CHARS.indexOf(_arg1.charAt((_local5 + _local6)));
_local6++;
};
_local4[0] = ((_local3[0] << 2) + ((_local3[1] & 48) >> 4));
_local4[1] = (((_local3[1] & 15) << 4) + ((_local3[2] & 60) >> 2));
_local4[2] = (((_local3[2] & 3) << 6) + _local3[3]);
_local7 = 0;
while (_local7 < _local4.length) {
if (_local3[(_local7 + 1)] == 64){
break;
};
_local2.writeByte(_local4[_local7]);
_local7++;
};
_local5 = (_local5 + 4);
};
_local2.position = 0;
return (_local2);
}
public static function encodeByteArray(_arg1:ByteArray):String{
var _local3:Array;
var _local5:uint;
var _local6:uint;
var _local7:uint;
var _local2 = "";
var _local4:Array = new Array(4);
_arg1.position = 0;
while (_arg1.bytesAvailable > 0) {
_local3 = new Array();
_local5 = 0;
while ((((_local5 < 3)) && ((_arg1.bytesAvailable > 0)))) {
_local3[_local5] = _arg1.readUnsignedByte();
_local5++;
};
_local4[0] = ((_local3[0] & 252) >> 2);
_local4[1] = (((_local3[0] & 3) << 4) | (_local3[1] >> 4));
_local4[2] = (((_local3[1] & 15) << 2) | (_local3[2] >> 6));
_local4[3] = (_local3[2] & 63);
_local6 = _local3.length;
while (_local6 < 3) {
_local4[(_local6 + 1)] = 64;
_local6++;
};
_local7 = 0;
while (_local7 < _local4.length) {
_local2 = (_local2 + BASE64_CHARS.charAt(_local4[_local7]));
_local7++;
};
};
return (_local2);
}
}
}//package com.midasplayer.util
Section 43
//getLabelFrame (com.midasplayer.util.getLabelFrame)
package com.midasplayer.util {
import flash.display.*;
public function getLabelFrame(_arg1:String, _arg2:MovieClip):int{
var _local3:FrameLabel;
for each (_local3 in _arg2.currentLabels) {
if (_arg1 == _local3.name){
return (_local3.frame);
};
};
return (0);
}
}//package com.midasplayer.util
Section 44
//Log (com.midasplayer.util.Log)
package com.midasplayer.util {
public class Log {
public static const LEVEL_ERROR:int = 0;
public static const LEVEL_DEBUG:int = 3;
public static const LEVEL_WARNING:int = 1;
public static const LEVEL_INFO:int = 2;
public static var enabled:Boolean = true;
public static var level:int = 1;
private static var handlers:Array = [defaultHandler];
public static function errorIf(_arg1:Boolean, _arg2:String):void{
if (_arg1){
error(_arg2);
};
}
public static function attachHandler(_arg1:Function):void{
handlers.push(_arg1);
}
public static function error(_arg1:String):void{
var _local3:Function;
var _local2:Boolean;
if (((enabled) && ((LEVEL_ERROR <= level)))){
for each (_local3 in handlers) {
_local2 = ((_local3(LEVEL_ERROR, _arg1)) || (_local2));
};
};
if (_local2){
Assert.halt(("Log handler requested halt to execution - Error: " + _arg1));
};
}
public static function debugIf(_arg1:Boolean, _arg2:String):void{
if (_arg1){
debug(_arg2);
};
}
public static function debug(_arg1:String):void{
var _local3:Function;
var _local2:Boolean;
if (((enabled) && ((LEVEL_DEBUG <= level)))){
for each (_local3 in handlers) {
_local2 = ((_local3(LEVEL_DEBUG, _arg1)) || (_local2));
};
};
if (_local2){
Assert.halt(("Log handler requested halt to execution - Debug: " + _arg1));
};
}
public static function warningIf(_arg1:Boolean, _arg2:String):void{
if (_arg1){
warning(_arg2);
};
}
public static function warning(_arg1:String):void{
var _local3:Function;
var _local2:Boolean;
if (((enabled) && ((LEVEL_WARNING <= level)))){
for each (_local3 in handlers) {
_local2 = ((_local3(LEVEL_WARNING, _arg1)) || (_local2));
};
};
if (_local2){
Assert.halt(("Log handler requested halt to execution - Warning: " + _arg1));
};
}
public static function infoIf(_arg1:Boolean, _arg2:String):void{
if (_arg1){
info(_arg2);
};
}
public static function info(_arg1:String):void{
var _local3:Function;
var _local2:Boolean;
if (((enabled) && ((LEVEL_INFO <= level)))){
for each (_local3 in handlers) {
_local2 = ((_local3(LEVEL_INFO, _arg1)) || (_local2));
};
};
if (_local2){
Assert.halt(("Log handler requested halt to execution - Info: " + _arg1));
};
}
public static function defaultHandler(_arg1:int, _arg2:String):Boolean{
trace((((_arg1 == LEVEL_ERROR)) ? "Error: " : ((_arg1 == LEVEL_WARNING)) ? "Warning: " : ((_arg1 == LEVEL_INFO)) ? "Info: " : "Debug: " + _arg2));
return ((_arg1 == LEVEL_ERROR));
}
public static function detachHandler(_arg1:Function):void{
handlers.splice(handlers.indexOf(_arg1), 1);
}
}
}//package com.midasplayer.util
Section 45
//printBinary (com.midasplayer.util.printBinary)
package com.midasplayer.util {
import flash.utils.*;
public function printBinary(_arg1:Object):String{
var _local3:int;
var _local4:int;
var _local2:String = new String();
if ((_arg1 is ByteArray)){
_local3 = 0;
while (_local3 < _arg1.length) {
_local4 = 128;
while (_local4 > 0) {
_local2 = (_local2 + ((_arg1[_local3] & _local4)) ? "1" : "0");
_local4 = (_local4 >> 1);
};
if (_local3 < (_arg1.length - 1)){
_local2 = (_local2 + " ");
};
_local3++;
};
};
return (_local2);
}
}//package com.midasplayer.util
Section 46
//safeCall (com.midasplayer.util.safeCall)
package com.midasplayer.util {
public function safeCall(_arg1:Function, _arg2:Array=null):void{
if (null != _arg1){
if (_arg2){
_arg1.apply(null, _arg2);
} else {
_arg1();
};
};
}
}//package com.midasplayer.util
Section 47
//NumberFormat (de.polygonal.core.fmt.NumberFormat)
package de.polygonal.core.fmt {
import de.polygonal.core.math.*;
public class NumberFormat {
public function NumberFormat():void{
}
public static function toBin(_arg1:int):String{
var _local2 = (null as String);
var _local3:int;
if (_arg1 == 0){
return ("0");
//unresolved jump
};
if (_arg1 == -1){
return ("11111111111111111111111111111111");
//unresolved jump
};
_local2 = "";
_local3 = _arg1;
while (_local3 > 0) {
_local2 = ((((_local3 & 1))>0) ? "1" : "0" + _local2);
_local3 = (_local3 >> 1);
};
return (_local2);
}
public static function toHex(_arg1:int):String{
var _local2 = (null as String);
var _local3:int;
var _local4:int;
if (_arg1 == 0){
return ("0");
};
if (_arg1 == -1){
return ("FFFFFFFF");
//unresolved jump
};
_local2 = "";
_local3 = _arg1;
for (;_local3 > 0;(_local3 = (_local3 >> 4))) {
_local4 = (_local3 & 15);
//unexpected switch
_local2 = (_local4 + _local2);
continue;
_local2 = ("A" + _local2);
continue;
_local2 = ("B" + _local2);
continue;
_local2 = ("C" + _local2);
continue;
_local2 = ("D" + _local2);
continue;
_local2 = ("E" + _local2);
continue;
_local2 = ("F" + _local2);
};
return (_local2);
}
public static function toOct(_arg1:int):String{
var _local4:int;
var _local2:String = "";
var _local3:int = _arg1;
while (_local3 > 0) {
_local4 = (_local3 & 7);
_local2 = (_local4 + _local2);
_local3 = (_local3 >> 3);
};
return (_local2);
}
public static function toRadix(_arg1:int, _arg2:int):String{
var _local5:int;
var _local3:String = "";
var _local4:int = _arg1;
while (_local4 > 0) {
_local5 = (_local4 % _arg2);
_local3 = (_local5 + _local3);
_local4 = Std._int((_local4 / _arg2));
};
return (_local3);
}
public static function toFixed(_arg1:Number, _arg2:int):String{
var _local3:int;
var _local4 = (null as String);
var _local5:int;
var _local6:int;
var _local7:int;
if (Mathematics.isNaN(_arg1)){
return ("NaN");
//unresolved jump
};
_local3 = Mathematics.exp(10, _arg2);
_local4 = Std.string((Std._int((_arg1 * _local3)) / _local3));
_local5 = _local4.indexOf(".");
if (_local5 != -1){
_local6 = _local4.substr((_local5 + 1)).length;
while (_local6 < _arg2) {
_local6++;
_local7 = _local6;
_local4 = (_local4 + "0");
};
} else {
_local4 = (_local4 + ".");
_local6 = 0;
while (_local6 < _arg2) {
_local6++;
_local7 = _local6;
_local4 = (_local4 + "0");
};
};
return (_local4);
}
public static function toMMSS(_arg1:int):String{
var _local2:int = (_arg1 % 1000);
var _local3:Number = ((_arg1 - _local2) / 1000);
var _local4:Number = (_local3 % 60);
return (((("0" + ((_local3 - _local4) / 60)).substr(-2) + ":") + ("0" + _local4).substr(-2)));
}
public static function groupDigits(_arg1:int, _arg2:String):String{
var _local6 = (null as String);
var _local7:int;
var _local8:int;
var _local3:Number = _arg1;
var _local4:int;
while (_local3 > 1) {
_local3 = (_local3 / 10);
_local4++;
};
_local4 = (_local4 / 3);
var _local5:String = Std.string(_arg1);
if (_local4 == 0){
return (_local5);
//unresolved jump
};
_local6 = "";
_local7 = 0;
_local8 = (_local5.length - 1);
while (_local8 >= 0) {
if (_local7 == 3){
_local8--;
_local6 = ((_local5.charAt(_local8) + _arg2) + _local6);
_local7 = 0;
_local4--;
} else {
_local8--;
_local6 = (_local5.charAt(_local8) + _local6);
};
_local7++;
};
return (_local6);
}
public static function centToEuro(_arg1:int, _arg2:String=",", _arg3:String="."):String{
var _local5 = (null as String);
var _local6:int;
var _local7:int;
var _local8:int;
var _local4:int = Std._int((_arg1 / 100));
if (_local4 == 0){
if (_arg1 < 10){
return (((("0" + _arg2) + "0") + _arg1));
} else {
return ((("0" + _arg2) + _arg1));
};
//unresolved jump
};
_local6 = (_arg1 - (_local4 * 100));
if (_local6 < 10){
_local5 = ((_arg2 + "0") + _local6);
} else {
_local5 = (_arg2 + _local6);
};
if (_local4 >= 1000){
_local7 = _local4;
while (_local7 >= 1000) {
_local7 = Std._int((_local4 / 1000));
_local8 = (_local4 - (_local7 * 1000));
if (_local8 < 10){
_local5 = (((_arg3 + "00") + _local8) + _local5);
} else {
if (_local8 < 100){
_local5 = (((_arg3 + "0") + _local8) + _local5);
} else {
_local5 = ((_arg3 + _local8) + _local5);
};
};
_local4 = _local7;
};
_local5 = (_local7 + _local5);
return (_local5);
} else {
_local5 = (_local4 + _local5);
};
return (_local5);
}
}
}//package de.polygonal.core.fmt
Section 48
//Sprintf (de.polygonal.core.fmt.Sprintf)
package de.polygonal.core.fmt {
import de.polygonal.ds.*;
import flash.*;
import de.polygonal.core.math.*;
import de.polygonal.gl.text.*;
import haxe.*;
public class Sprintf {
public var _bits:Array;
public static var BIT_MINUS:int;
public static var BIT_PLUS:int;
public static var BIT_SPACE:int;
public static var BIT_SHARP:int;
public static var BIT_ZERO:int;
public static var BIT_h:int;
public static var BIT_l:int;
public static var BIT_L:int;
public static var BIT_c:int;
public static var BIT_d:int;
public static var BIT_i:int;
public static var BIT_e:int;
public static var BIT_E:int;
public static var BIT_f:int;
public static var BIT_g:int;
public static var BIT_G:int;
public static var BIT_o:int;
public static var BIT_s:int;
public static var BIT_u:int;
public static var BIT_x:int;
public static var BIT_X:int;
public static var BIT_p:int;
public static var BIT_n:int;
public static var BIT_b:int;
public static var MASK_SPECIFIERS:int;
public static var _instance:Sprintf;
public function Sprintf():void{
var _local3:int;
var _local4:int;
if (Boot.skip_constructor){
return;
};
_bits = [];
var _local1:String = "-+ #0hlLcdieEfgGosuxXpnb";
var _local2:int;
while (_local2 < 0xFF) {
_local2++;
_local3 = _local2;
_bits[_local3] = 0;
};
_local2 = 0;
_local3 = _local1.length;
while (_local2 < _local3) {
_local2++;
_local4 = _local2;
_bits[cca(_local1, _local4)] = (1 << _local4);
};
}
public function cca(_arg1:String, _arg2:int):int{
return (_arg1.charCodeAt(_arg2));
}
public function _rpad(_arg1:String, _arg2:String, _arg3:int):String{
var _local7:int;
var _local4:String = _arg2;
var _local5:int;
var _local6 = (_arg3 - 1);
while (_local5 < _local6) {
_local5++;
_local7 = _local5;
_local4 = (_local4 + _arg2);
};
return ((_arg1 + _local4));
}
public function _padNumber(_arg1:String, _arg2:Number, _arg3:int, _arg4:int):String{
var _local5:int = _arg1.length;
if (_arg4 > 0){
false;
};
if (false){
_arg4 = (_arg4 - _local5);
if (Bits.hasBits(_arg3, 1)){
_arg1 = _rpad(_arg1, " ", _arg4);
} else {
if (_arg2 >= 0){
_arg1 = _lpad(_arg1, (Bits.hasBits(_arg3, 16)) ? "0" : " ", _arg4);
} else {
if (Bits.hasBits(_arg3, 16)){
_arg1 = ("-" + _lpad(_arg1.substr(1), "0", _arg4));
} else {
_arg1 = _lpad(_arg1, " ", _arg4);
};
};
};
};
return (_arg1);
}
public function _lpad(_arg1:String, _arg2:String, _arg3:int):String{
var _local7:int;
var _local4:String = _arg2;
var _local5:int;
var _local6 = (_arg3 - 1);
while (_local5 < _local6) {
_local5++;
_local7 = _local5;
_local4 = (_local4 + _arg2);
};
return ((_local4 + _arg1));
}
public function _format(_arg1:String, _arg2:Array):String{
var _local7:int;
var _local8:int;
var _local9:Boolean;
var _local10:int;
var _local11:int;
var _local12 = (null as String);
var _local13:int;
var _local14:Number;
var _local15:int;
var _local16:int;
var _local17:int;
var _local18:int;
var _local19:Number;
var _local20:int;
var _local21 = (null as String);
var _local22 = (null as String);
var _local23 = (null as String);
var _local3:int;
var _local4:String = "";
var _local5:int;
var _local6:int = _arg1.length;
while (_local5 < _local6) {
_local5++;
_local7 = cca(_arg1, _local5);
if (_local7 == 37){
_local5++;
_local7 = cca(_arg1, _local5);
if (_local7 == 37){
_local4 = (_local4 + "%");
} else {
_local8 = 0;
while (Bits.hasBits(_bits[_local7], 31)) {
_local8 = Bits.setBits(_local8, _bits[_local7]);
_local5++;
_local7 = cca(_arg1, _local5);
};
if (Bits.hasAllBits(_local8, 17)){
Log.trace("warning: `0' flag ignored with '-' flag in printf format", {fileName:"Sprintf.hx", lineNumber:153, className:"de.polygonal.core.fmt.Sprintf", methodName:"_format"});
_local8 = Bits.clrBits(_local8, 16);
};
if (Bits.hasAllBits(_local8, 6)){
Log.trace("warning: ` ' flag ignored with '+' flag in printf format", {fileName:"Sprintf.hx", lineNumber:158, className:"de.polygonal.core.fmt.Sprintf", methodName:"_format"});
_local8 = Bits.clrBits(_local8, 4);
};
_local9 = false;
_local10 = 0;
if (_local7 == 42){
_local9 = true;
_local5++;
_local7 = cca(_arg1, _local5);
} else {
if (ASCII.isDigit(_local7)){
_local10 = (_local7 - 48);
_local5++;
_local7 = cca(_arg1, _local5);
if (ASCII.isDigit(_local7)){
_local10 = ((_local7 - 48) + (_local10 * 10));
_local5++;
_local7 = cca(_arg1, _local5);
if (ASCII.isDigit(_local7)){
while (ASCII.isDigit(_local7)) {
_local5++;
_local7 = cca(_arg1, _local5);
};
};
};
};
};
_local11 = -1;
if (_local7 == 46){
_local5++;
_local7 = cca(_arg1, _local5);
if (_local7 == 42){
_local3++;
_local11 = Std._int(_arg2[_local3]);
_local5++;
_local7 = cca(_arg1, _local5);
} else {
if (ASCII.isDigit(_local7)){
_local11 = (_local7 - 48);
_local5++;
_local7 = cca(_arg1, _local5);
if (ASCII.isDigit(_local7)){
_local11 = ((_local7 - 48) + (_local11 * 10));
_local5++;
_local7 = cca(_arg1, _local5);
if (ASCII.isDigit(_local7)){
while (ASCII.isDigit(_local7)) {
_local5++;
_local7 = cca(_arg1, _local5);
};
};
};
} else {
_local11 = 0;
};
};
};
while (Bits.hasBits(_bits[_local7], 224)) {
_local8 = Bits.setBits(_local8, _bits[_local7]);
_local5++;
_local7 = cca(_arg1, _local5);
};
_local12 = "";
if (_local9){
_local3++;
_local10 = _arg2[_local3];
};
_local13 = _bits[_local7];
if (Bits.hasBits(_local13, 0xFFFF00)){
if (Bits.hasBits(_local13, 0x2000)){
if (_local11 == -1){
_local11 = 6;
};
_local3++;
_local14 = _arg2[_local3];
if (_local11 == 0){
_local12 = Std.string(Mathematics.round(_local14));
if (Bits.hasBits(_local8, 8)){
_local12 = (_local12 + ".");
};
} else {
_local14 = Mathematics.roundTo(_local14, Math.pow(0.1, _local11));
_local12 = NumberFormat.toFixed(_local14, _local11);
};
if (Bits.hasBits(_local8, 2)){
false;
};
if (false){
_local12 = ("+" + _local12);
} else {
if (Bits.hasBits(_local8, 4)){
false;
};
if (false){
_local12 = (" " + _local12);
};
};
_local4 = (_local4 + _padNumber(_local12, _local14, _local8, _local10));
} else {
if (Bits.hasBits(_local13, 131328)){
if (Bits.hasBits(_local8, 2)){
_local8 = Bits.clrBits(_local8, 2);
Log.trace("warning: `+' flag used with `%s' printf format", {fileName:"Sprintf.hx", lineNumber:275, className:"de.polygonal.core.fmt.Sprintf", methodName:"_format"});
};
if (Bits.hasBits(_local8, 4)){
_local8 = Bits.clrBits(_local8, 4);
Log.trace("warning: ` ' flag used with `%s' printf format", {fileName:"Sprintf.hx", lineNumber:280, className:"de.polygonal.core.fmt.Sprintf", methodName:"_format"});
} else {
if (Bits.hasBits(_local8, 16)){
_local8 = Bits.clrBits(_local8, 16);
Log.trace("warning: `0' flag used with `%s' printf format", {fileName:"Sprintf.hx", lineNumber:286, className:"de.polygonal.core.fmt.Sprintf", methodName:"_format"});
} else {
if (Bits.hasBits(_local8, 8)){
_local8 = Bits.clrBits(_local8, 8);
Log.trace("warning: ` #' flag used with `%s' printf format", {fileName:"Sprintf.hx", lineNumber:292, className:"de.polygonal.core.fmt.Sprintf", methodName:"_format"});
};
};
};
if (_local13 == 131072){
_local3++;
_local12 = Std.string(_arg2[_local3]);
if (_local11 > 0){
_local12 = _local12.substr(0, _local11);
};
} else {
_local3++;
_local12 = String.fromCharCode(_arg2[_local3]);
};
_local15 = _local12.length;
if (_local10 > 0){
false;
};
if (false){
_local10 = (_local10 - _local15);
if (Bits.hasBits(_local8, 1)){
_local12 = _rpad(_local12, " ", _local10);
} else {
_local12 = _lpad(_local12, " ", _local10);
};
};
_local4 = (_local4 + _local12);
} else {
if (Bits.hasBits(_local13, 0x9D0600)){
if (_local11 == -1){
_local11 = 1;
};
_local3++;
_local15 = _arg2[_local3];
if (_local11 == 0){
false;
};
if (false){
_local12 = "";
} else {
if (Bits.hasBits(_local13, 32)){
_local15 = (_local15 & 0xFFFF);
} else {
if (Bits.hasBits(_local13, 65536)){
_local12 = NumberFormat.toOct(_local15);
if (Bits.hasBits(_local8, 8)){
_local12 = ("0" + _local12);
};
} else {
if (Bits.hasBits(_local13, 524288)){
_local12 = NumberFormat.toHex(_local15).toLowerCase();
if (Bits.hasBits(_local8, 8)){
false;
};
if (false){
_local12 = ("0x" + _local12);
};
} else {
if (Bits.hasBits(_local13, 0x100000)){
_local12 = NumberFormat.toHex(_local15).toUpperCase();
if (Bits.hasBits(_local8, 8)){
false;
};
if (false){
_local12 = ("0X" + _local12);
};
} else {
if (Bits.hasBits(_local13, 0x800000)){
_local12 = NumberFormat.toBin(_local15);
if (_local11 > 1){
if (_local12.length < _local11){
_local11 = (_local11 - _local12.length);
_local16 = 0;
while (_local16 < _local11) {
_local16++;
_local17 = _local16;
_local12 = ("0" + _local12);
};
};
_local11 = 0;
};
if (Bits.hasBits(_local8, 8)){
_local12 = ("b" + _local12);
};
} else {
_local12 = Std.string(_local15);
};
};
};
};
};
if (_local11 > 1){
false;
};
if (false){
if (_local15 > 0){
_local16 = 0;
_local17 = (_local11 - 1);
while (_local16 < _local17) {
_local16++;
_local18 = _local16;
_local12 = ("0" + _local12);
};
} else {
_local12 = ("0" + -(_local15));
_local16 = 0;
_local17 = (_local11 - 2);
while (_local16 < _local17) {
_local16++;
_local18 = _local16;
_local12 = ("0" + _local12);
};
_local12 = ("-" + _local12);
};
};
};
if (_local15 >= 0){
if (Bits.hasBits(_local8, 2)){
_local12 = ("+" + _local12);
} else {
if (Bits.hasBits(_local8, 4)){
_local12 = (" " + _local12);
};
};
};
_local4 = (_local4 + _padNumber(_local12, _local15, _local8, _local10));
} else {
if (Bits.hasBits(_local13, 0x1800)){
if (_local11 == -1){
_local11 = 6;
};
_local3++;
_local14 = _arg2[_local3];
_local15 = Mathematics.fsign(_local14);
_local14 = Mathematics.fabs(_local14);
_local16 = 0;
if (_local14 > 1){
while (_local14 > 10) {
_local14 = (_local14 / 10);
_local16++;
};
} else {
while (_local14 < 1) {
_local14 = (_local14 * 10);
_local16--;
};
};
_local19 = 0.1;
_local17 = 0;
_local18 = (_local11 - 1);
while (_local17 < _local18) {
_local17++;
_local20 = _local17;
_local19 = (_local19 * 0.1);
};
_local14 = Mathematics.roundTo(_local14, _local19);
_local12 = (_local12 + (((_local15)<0) ? "-" : (Bits.hasBits(_local8, 2)) ? "+" : "" + Std.string(_local14).substr(0, (_local11 + 2))));
_local12 = (_local12 + (Bits.hasBits(_local13, 0x0800)) ? "e" : "E");
_local12 = (_local12 + ((_local16)>0) ? "+" : "-");
if (_local16 < 10){
_local12 = _rpad(_local12, "0", 2);
} else {
if (_local16 < 100){
_local12 = _rpad(_local12, "0", 1);
};
};
_local12 = (_local12 + Std.string(Mathematics.abs(_local16)));
_local4 = (_local4 + _local12);
} else {
if (Bits.hasBits(_local13, 0xC000)){
_local11 = 0;
_local21 = "";
if (Bits.hasBits(_local8, 1)){
_local21 = (_local21 + "-");
};
if (Bits.hasBits(_local8, 2)){
_local21 = (_local21 + "+");
};
if (Bits.hasBits(_local8, 4)){
_local21 = (_local21 + " ");
};
if (Bits.hasBits(_local8, 16)){
_local21 = (_local21 + "0");
};
_local3++;
_local14 = _arg2[_local3];
_local22 = _format((((("%" + _local21) + ".") + _local11) + "f"), [_local14]);
_local23 = _format((((("%" + _local21) + ".") + _local11) + ((_local7)==71) ? "E" : "e"), [_local14]);
if (Bits.hasBits(_local8, 8)){
if (_local22.indexOf(".") != -1){
_local15 = (_local22.length - 1);
while (cca(_local22, _local15) == 48) {
_local15--;
};
_local22 = _local22.substr(0, _local15);
};
};
_local4 = (_local4 + ((_local22.length)<_local23.length) ? _local22 : _local23);
} else {
if (Bits.hasBits(_local13, 0x600000)){
Boot.lastError = new Error();
throw ("warning: specifier 'p' and 'n' are not supported");
};
};
};
};
};
};
} else {
Boot.lastError = new Error();
throw ("malformed format string: no specifier found");
};
};
} else {
_local4 = (_local4 + _arg1.charAt((_local5 - 1)));
};
};
return (_local4);
}
public static function get():Sprintf{
if (Sprintf._instance == null){
Sprintf._instance = new Sprintf();
};
return (Sprintf._instance);
}
public static function free():void{
Sprintf._instance = null;
}
public static function format(_arg1:String, _arg2:Array):String{
return (Sprintf.get()._format(_arg1, _arg2));
}
}
Sprintf.BIT_MINUS = 1;
Sprintf.BIT_PLUS = 2;
Sprintf.BIT_SPACE = 4;
Sprintf.BIT_SHARP = 8;
Sprintf.BIT_ZERO = 16;
Sprintf.BIT_h = 32;
Sprintf.BIT_l = 64;
Sprintf.BIT_L = 128;
Sprintf.BIT_c = 0x0100;
Sprintf.BIT_d = 0x0200;
Sprintf.BIT_i = 0x0400;
Sprintf.BIT_e = 0x0800;
Sprintf.BIT_E = 0x1000;
Sprintf.BIT_f = 0x2000;
Sprintf.BIT_g = 0x4000;
Sprintf.BIT_G = 0x8000;
Sprintf.BIT_o = 65536;
Sprintf.BIT_s = 131072;
Sprintf.BIT_u = 262144;
Sprintf.BIT_x = 524288;
Sprintf.BIT_X = 0x100000;
Sprintf.BIT_p = 0x200000;
Sprintf.BIT_n = 0x400000;
Sprintf.BIT_b = 0x800000;
Sprintf.MASK_SPECIFIERS = 0xFFFF00;
Sprintf._instance = null;
}//package de.polygonal.core.fmt
Section 49
//Mathematics (de.polygonal.core.math.Mathematics)
package de.polygonal.core.math {
import de.polygonal.core.util.*;
public class Mathematics {
public static var INT8_MIN:int;
public static var INT8_MAX:int;
public static var UINT8_MAX:int;
public static var INT16_MIN:int;
public static var INT16_MAX:int;
public static var UINT16_MAX:int;
public static var INT32_MIN:int;
public static var INT32_MAX:int;
public static var UINT32_MAX:int;
public static var NaN:Number;
public static var POSITIVE_INFINITY:Number;
public static var NEGATIVE_INFINITY:Number;
public static var FLOAT_MAX:Number;
public static var FLOAT_MIN:Number;
public static var DOUBLE_MIN:Number;
public static var DOUBLE_MAX:Number;
public static var RAD_DEG:Number;
public static var DEG_RAD:Number;
public static var LN2:Number;
public static var PIHALF:Number;
public static var PI:Number;
public static var PI2:Number;
public static var EPS:Number;
public static var EPS_SQ:Number;
public function Mathematics():void{
}
public static function isNaN(_arg1:Number):Boolean{
return (Math.isNaN(_arg1));
}
public static function min(_arg1:int, _arg2:int):int{
return (((_arg1)<_arg2) ? _arg1 : _arg2);
}
public static function max(_arg1:int, _arg2:int):int{
return (((_arg1)>_arg2) ? _arg1 : _arg2);
}
public static function abs(_arg1:int):int{
return (((_arg1)<0) ? -(_arg1) : _arg1);
}
public static function sign(_arg1:int):int{
return (((_arg1)>0) ? 1 : ((_arg1)<0) ? -1 : 0);
}
public static function clamp(_arg1:int, _arg2:int, _arg3:int):int{
return (((_arg1)<_arg2) ? _arg2 : ((_arg1)>_arg3) ? _arg3 : _arg1);
}
public static function clampSymmetric(_arg1:int, _arg2:int):int{
return (((_arg1)<-(_arg2)) ? -(_arg2) : ((_arg1)>_arg2) ? _arg2 : _arg1);
}
public static function wrap(_arg1:int, _arg2:int, _arg3:int):int{
return (((_arg1)<_arg2) ? (((_arg1 - _arg2) + _arg3) + 1) : ((_arg1)>_arg3) ? (((_arg1 - _arg3) + _arg2) - 1) : _arg1);
}
public static function fmin(_arg1:Number, _arg2:Number):Number{
return (((_arg1)<_arg2) ? _arg1 : _arg2);
}
public static function fmax(_arg1:Number, _arg2:Number):Number{
return (((_arg1)>_arg2) ? _arg1 : _arg2);
}
public static function fabs(_arg1:Number):Number{
return (((_arg1)<0) ? -(_arg1) : _arg1);
}
public static function fsign(_arg1:Number):int{
return (((_arg1)>=0) ? 1 : -1);
}
public static function fclamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{
return (((_arg1)<_arg2) ? _arg2 : ((_arg1)>_arg3) ? _arg3 : _arg1);
}
public static function fclampSymmetric(_arg1:Number, _arg2:Number):Number{
return (((_arg1)<-(_arg2)) ? -(_arg2) : ((_arg1)>_arg2) ? _arg2 : _arg1);
}
public static function fwrap(_arg1:Number, _arg2:Number, _arg3:Number):Number{
return (((_arg1)<_arg2) ? (((_arg1 - _arg2) + _arg3) + 1) : ((_arg1)>_arg3) ? (((_arg1 - _arg3) + _arg2) - 1) : _arg1);
}
public static function equalSign(_arg1:int, _arg2:int):Boolean{
return (((_arg1 ^ _arg2) >= 0));
}
public static function isEven(_arg1:int):Boolean{
return (((_arg1 & 1) == 0));
}
public static function isOdd(_arg1:int):Boolean{
return (((_arg1 & 1) == 1));
}
public static function isPow2(_arg1:int):Boolean{
if (_arg1 > 0){
false;
};
return (false);
}
public static function lerp(_arg1:Number, _arg2:Number, _arg3:Number):Number{
return ((_arg1 + ((_arg2 - _arg1) * _arg3)));
}
public static function slerp(_arg1:Number, _arg2:Number, _arg3:Number):Number{
if (_arg1 > 0){
false;
};
var _local4:Number = (false) ? -(_arg1) : _arg1;
var _local5:Number = (_arg2 - _local4);
var _local6:Number = Math.sin(_local5);
if (_local6 == 0){
return ((_local4 + (_local5 * _arg3)));
} else {
};
return (!NULL!);
}
public static function nextPow2(_arg1:int):int{
var _local2:int = _arg1;
_local2 = (_local2 | (_local2 >> 1));
_local2 = (_local2 | (_local2 >> 2));
_local2 = (_local2 | (_local2 >> 3));
_local2 = (_local2 | (_local2 >> 4));
_local2 = (_local2 | (_local2 >> 5));
return ((_local2 + 1));
}
public static function exp(_arg1:int, _arg2:int):int{
var _local3 = 1;
var _local4:int;
while (true) {
if ((_arg2 & 1) != 0){
_local3 = (_arg1 * _local3);
};
_arg2 = (_arg2 >> 1);
if (_arg2 == 0){
_local4 = _local3;
break;
} else {
_arg1 = (_arg1 * _arg1);
};
};
return (_local4);
}
public static function roundTo(_arg1:Number, _arg2:Number):Number{
return ((Math.round((_arg1 / _arg2)) * _arg2));
}
public static function round(_arg1:Number):int{
return (Std._int(((_arg1)>0) ? (_arg1 + 0.5) : ((_arg1)<0) ? (_arg1 - 0.5) : 0));
}
public static function ceil(_arg1:Number):int{
var _local2:int;
if (_arg1 > 0){
_local2 = Std._int((_arg1 + 0.5));
if (_local2 < _arg1){
return ((_local2 + 1));
} else {
return (_local2);
};
//unresolved jump
};
if (_arg1 < 0){
_local2 = Std._int((_arg1 - 0.5));
if (_local2 < _arg1){
return ((_local2 + 1));
} else {
return (_local2);
};
//unresolved jump
};
return (0);
}
public static function floor(_arg1:Number):int{
var _local2:int;
if (_arg1 > 0){
_local2 = Std._int((_arg1 + 0.5));
if (_local2 < _arg1){
return (_local2);
} else {
return ((_local2 - 1));
};
//unresolved jump
};
if (_arg1 < 0){
_local2 = Std._int((_arg1 - 0.5));
if (_local2 > _arg1){
return ((_local2 - 1));
} else {
return (_local2);
};
//unresolved jump
};
return (0);
}
public static function sqr(_arg1:Number):Number{
return ((_arg1 * _arg1));
}
public static function invSqrt(_arg1:Number):Number{
return ((1 / Math.sqrt(_arg1)));
}
public static function wrapPI(_arg1:Number):Number{
if (_arg1 < -(3.14159265358979)){
return ((_arg1 + 6.28318530717959));
//unresolved jump
};
if (_arg1 > 3.14159265358979){
return ((_arg1 - 6.28318530717959));
//unresolved jump
};
return (_arg1);
}
public static function compareAbsolute(_arg1:Number, _arg2:Number, _arg3:Number):Boolean{
var _local4:Number = (_arg1 - _arg2);
return (((_local4)>0) ? (_local4 < _arg3) : (-(_local4) < _arg3));
}
public static function snap(_arg1:Number, _arg2:Number):Number{
return (Mathematics.floor(((_arg1 + (_arg2 * 0.5)) / _arg2)));
}
public static function inRange(_arg1:Number, _arg2:Number, _arg3:Number):Boolean{
if (_arg1 >= _arg2){
false;
};
return (false);
}
public static function frand():Number{
return (Math.random());
}
public static function irand():int{
return (Std._int((Math.random() * 2147483647)));
}
public static function frandRange(_arg1:Number, _arg2:Number):Number{
return ((_arg1 + ((_arg2 - _arg1) * Math.random())));
}
public static function frandRangeSymmetric(_arg1:Number):Number{
Assert.assert((_arg1 > 0), "range > 0", {fileName:"Mathematics.hx", lineNumber:407, className:"de.polygonal.core.math.Mathematics", methodName:"frandRangeSymmetric"});
return (Mathematics.frandRange(-(_arg1), _arg1));
}
public static function irandRange(_arg1:int, _arg2:int):int{
return (Mathematics.round(((_arg1 - 0.4999) + (((_arg2 + 0.4999) - (_arg1 - 0.4999)) * Mathematics.frand()))));
}
public static function irandRangeSymmetric(_arg1:int):Number{
Assert.assert((_arg1 > 0), "range > 0", {fileName:"Mathematics.hx", lineNumber:423, className:"de.polygonal.core.math.Mathematics", methodName:"irandRangeSymmetric"});
return (Mathematics.irandRange(-(_arg1), _arg1));
}
}
Mathematics.INT8_MIN = -128;
Mathematics.INT8_MAX = 127;
Mathematics.UINT8_MAX = 0xFF;
Mathematics.INT16_MIN = -32768;
Mathematics.INT16_MAX = 32767;
Mathematics.UINT16_MAX = 0xFFFF;
Mathematics.INT32_MIN = -2147483648;
Mathematics.INT32_MAX = 2147483647;
Mathematics.UINT32_MAX = -1;
Mathematics.NaN = (0 / 0);
Mathematics.POSITIVE_INFINITY = (1 / 0);
Mathematics.NEGATIVE_INFINITY = (-1 / 0);
Mathematics.FLOAT_MAX = 3.40282346638528E38;
Mathematics.FLOAT_MIN = -(3.40282346638528E38);
Mathematics.DOUBLE_MIN = 1.79769313486231E308;
Mathematics.DOUBLE_MAX = -(1.79769313486231E308);
Mathematics.RAD_DEG = (180 / 3.14159265358979);
Mathematics.DEG_RAD = (3.14159265358979 / 180);
Mathematics.LN2 = 0.693147180559945;
Mathematics.PIHALF = 1.5707963267949;
Mathematics.PI = 3.14159265358979;
Mathematics.PI2 = 6.28318530717959;
Mathematics.EPS = 1E-6;
Mathematics.EPS_SQ = 1E-12;
}//package de.polygonal.core.math
Section 50
//Assert (de.polygonal.core.util.Assert)
package de.polygonal.core.util {
import flash.*;
public class Assert {
public function Assert():void{
}
public static function assert(_arg1:Boolean, _arg2:String, _arg3:Object=undefined):void{
if (!_arg1){
Boot.lastError = new Error();
throw (new AssertionError(_arg2, _arg3));
};
}
}
}//package de.polygonal.core.util
Section 51
//AssertionError (de.polygonal.core.util.AssertionError)
package de.polygonal.core.util {
import de.polygonal.core.fmt.*;
import flash.*;
public class AssertionError extends Error {
public function AssertionError(_arg1:String=undefined, _arg2:Object=undefined):void{
if (Boot.skip_constructor){
return;
};
super(Sprintf.format("Assertation \"%s\" failed in file %s, line %d, %s::%s", [_arg1, _arg2.fileName, _arg2.lineNumber, _arg2.className, _arg2.methodName]));
}
}
}//package de.polygonal.core.util
Section 52
//LinkedQueueIterator (de.polygonal.ds._LinkedQueue.LinkedQueueIterator)
package de.polygonal.ds._LinkedQueue {
import de.polygonal.ds.*;
import flash.*;
public class LinkedQueueIterator implements Itr {
public var _walker:LinkedQueueNode;
public var _f:LinkedQueue;
public function LinkedQueueIterator(_arg1:LinkedQueue=undefined):void{
if (Boot.skip_constructor){
return;
};
_f = _arg1;
reset();
}
public function reset():void{
_walker = __head(_f);
}
public function next():Object{
var _local1:Object = _walker.val;
_walker = _walker.next;
return (_local1);
}
public function hasNext():Boolean{
return (!((_walker == null)));
}
public function __head(_arg1:Object):LinkedQueueNode{
return (_arg1._head);
}
}
}//package de.polygonal.ds._LinkedQueue
Section 53
//LinkedQueueNode (de.polygonal.ds._LinkedQueue.LinkedQueueNode)
package de.polygonal.ds._LinkedQueue {
import flash.*;
public class LinkedQueueNode {
public var val:Object;
public var next:LinkedQueueNode;
public function LinkedQueueNode(_arg1:Object=undefined):void{
if (Boot.skip_constructor){
return;
};
val = _arg1;
}
public function toString():String{
return (("" + val));
}
}
}//package de.polygonal.ds._LinkedQueue
Section 54
//VectorIterator (de.polygonal.ds._Vector.VectorIterator)
package de.polygonal.ds._Vector {
import de.polygonal.ds.*;
import flash.*;
public class VectorIterator implements Itr {
public var _s:int;
public var _i:int;
public var _f:Vector;
public var _a:Array;
public function VectorIterator(_arg1:Vector=undefined):void{
if (Boot.skip_constructor){
return;
};
_f = _arg1;
reset();
}
public function reset():void{
_a = __a(_f);
_s = __size(_f);
_i = 0;
}
public function next():Object{
var _local1:int = _i;
_i = (_local1 + 1);
return (_a[_local1]);
}
public function hasNext():Boolean{
return ((_i < _s));
}
public function __size(_arg1:Object):int{
return (_arg1._size);
}
public function __a(_arg1:Object):Array{
return (_arg1._a);
}
}
}//package de.polygonal.ds._Vector
Section 55
//Bits (de.polygonal.ds.Bits)
package de.polygonal.ds {
import de.polygonal.core.fmt.*;
import de.polygonal.core.util.*;
public class Bits {
public static var BIT_01:int;
public static var BIT_02:int;
public static var BIT_03:int;
public static var BIT_04:int;
public static var BIT_05:int;
public static var BIT_06:int;
public static var BIT_07:int;
public static var BIT_08:int;
public static var BIT_09:int;
public static var BIT_10:int;
public static var BIT_11:int;
public static var BIT_12:int;
public static var BIT_13:int;
public static var BIT_14:int;
public static var BIT_15:int;
public static var BIT_16:int;
public static var BIT_17:int;
public static var BIT_18:int;
public static var BIT_19:int;
public static var BIT_20:int;
public static var BIT_21:int;
public static var BIT_22:int;
public static var BIT_23:int;
public static var BIT_24:int;
public static var BIT_25:int;
public static var BIT_26:int;
public static var BIT_27:int;
public static var BIT_28:int;
public static var BIT_29:int;
public static var BIT_30:int;
public static var BIT_31:int;
public static var BIT_32:int;
public static var ALL:int;
public function Bits():void{
}
public static function hasBits(_arg1:int, _arg2:int):Boolean{
return (!(((_arg1 & _arg2) == 0)));
}
public static function hasAllBits(_arg1:int, _arg2:int):Boolean{
return (((_arg1 & _arg2) == _arg2));
}
public static function setBits(_arg1:int, _arg2:int):int{
return ((_arg1 | _arg2));
}
public static function clrBits(_arg1:int, _arg2:int):int{
return ((_arg1 & ~(_arg2)));
}
public static function invBits(_arg1:int, _arg2:int):int{
return ((_arg1 ^ _arg2));
}
public static function mask(_arg1:int):int{
if (_arg1 >= 1){
false;
};
Assert.assert(false, "n >= 1 && n <= 32", {fileName:"Bits.hx", lineNumber:106, className:"de.polygonal.ds.Bits", methodName:"mask"});
return (((1 << _arg1) - 1));
}
public static function ones(_arg1:int):int{
_arg1 = (_arg1 - ((_arg1 >> 1) & 1431655765));
_arg1 = (((_arg1 >> 2) & 858993459) + (_arg1 & 858993459));
_arg1 = (((_arg1 >> 4) + _arg1) & 252645135);
_arg1 = (_arg1 + (_arg1 >> 8));
_arg1 = (_arg1 + (_arg1 >> 16));
return ((_arg1 & 63));
}
public static function ntz(_arg1:int):int{
var _local2 = 32;
while (_arg1 != 0) {
_local2--;
_arg1 = (_arg1 + _arg1);
};
return (_local2);
}
public static function nlz(_arg1:int):int{
if (_arg1 < 0){
return (0);
//unresolved jump
};
_arg1 = (_arg1 | (_arg1 >> 1));
_arg1 = (_arg1 | (_arg1 >> 2));
_arg1 = (_arg1 | (_arg1 >> 4));
_arg1 = (_arg1 | (_arg1 >> 8));
_arg1 = (_arg1 | (_arg1 >> 16));
return ((32 - Bits.ones(_arg1)));
}
public static function msb(_arg1:int):int{
_arg1 = (_arg1 | (_arg1 >> 1));
_arg1 = (_arg1 | (_arg1 >> 2));
_arg1 = (_arg1 | (_arg1 >> 4));
_arg1 = (_arg1 | (_arg1 >> 8));
_arg1 = (_arg1 | (_arg1 >> 16));
return ((_arg1 & ~((_arg1 >>> 1))));
}
public static function reverse(_arg1:int):int{
var _local2 = 1431655765;
_arg1 = (((_arg1 >> 1) & _local2) | ((_arg1 & _local2) << 1));
_local2 = 858993459;
_arg1 = (((_arg1 >> 2) & _local2) | ((_arg1 & _local2) << 2));
_local2 = 252645135;
_arg1 = (((_arg1 >> 4) & _local2) | ((_arg1 & _local2) << 4));
_local2 = 0xFF00FF;
_arg1 = (((_arg1 >> 8) & _local2) | ((_arg1 & _local2) << 8));
return (((_arg1 >> 16) | (_arg1 << 16)));
}
public static function hasBitAt(_arg1:int, _arg2:int):Boolean{
if (_arg2 >= 1){
false;
};
Assert.assert(false, Sprintf.format("position out of range (%d)", [_arg2]), {fileName:"Bits.hx", lineNumber:214, className:"de.polygonal.ds.Bits", methodName:"hasBitAt"});
return (!(((_arg1 & (1 << (_arg2 - 1))) == 0)));
}
public static function setBitAt(_arg1:int, _arg2:int):int{
if (_arg2 >= 1){
false;
};
Assert.assert(false, Sprintf.format("position out of range (%d)", [_arg2]), {fileName:"Bits.hx", lineNumber:228, className:"de.polygonal.ds.Bits", methodName:"setBitAt"});
return ((_arg1 | (1 << (_arg2 - 1))));
}
public static function clrBitAt(_arg1:int, _arg2:int):int{
if (_arg2 >= 1){
false;
};
Assert.assert(false, Sprintf.format("position out of range (%d)", [_arg2]), {fileName:"Bits.hx", lineNumber:242, className:"de.polygonal.ds.Bits", methodName:"clrBitAt"});
return ((_arg1 & ~((1 << (_arg2 - 1)))));
}
public static function invBitAt(_arg1:int, _arg2:int):int{
if (_arg2 >= 1){
false;
};
Assert.assert(false, Sprintf.format("position out of range (%d)", [_arg2]), {fileName:"Bits.hx", lineNumber:259, className:"de.polygonal.ds.Bits", methodName:"invBitAt"});
return ((_arg1 ^ (1 << (_arg2 - 1))));
}
public static function setBitsIf(_arg1:int, _arg2:Boolean, _arg3:int):int{
_arg1 = (_arg1 ^ ((-((_arg2) ? 1 : 0) ^ _arg1) & _arg3));
return (_arg1);
}
public static function setBitsRange(_arg1:int, _arg2:int, _arg3:int):int{
var _local6:int;
if (_arg2 < _arg3){
false;
if (_arg2 != _arg3){
false;
if (_arg2 >= 1){
false;
};
};
};
Assert.assert(false, Sprintf.format("invalid range (min: %d, max: %d)", [_arg2, _arg3]), {fileName:"Bits.hx", lineNumber:279, className:"de.polygonal.ds.Bits", methodName:"setBitsRange"});
var _local4:int = _arg2;
var _local5 = (_arg3 + 1);
while (_local4 < _local5) {
_local4++;
_local6 = _local4;
_arg1 = Bits.setBits(_arg1, (1 << (_local6 - 1)));
};
return (_arg1);
}
}
Bits.BIT_01 = 1;
Bits.BIT_02 = 2;
Bits.BIT_03 = 4;
Bits.BIT_04 = 8;
Bits.BIT_05 = 16;
Bits.BIT_06 = 32;
Bits.BIT_07 = 64;
Bits.BIT_08 = 128;
Bits.BIT_09 = 0x0100;
Bits.BIT_10 = 0x0200;
Bits.BIT_11 = 0x0400;
Bits.BIT_12 = 0x0800;
Bits.BIT_13 = 0x1000;
Bits.BIT_14 = 0x2000;
Bits.BIT_15 = 0x4000;
Bits.BIT_16 = 0x8000;
Bits.BIT_17 = 65536;
Bits.BIT_18 = 131072;
Bits.BIT_19 = 262144;
Bits.BIT_20 = 524288;
Bits.BIT_21 = 0x100000;
Bits.BIT_22 = 0x200000;
Bits.BIT_23 = 0x400000;
Bits.BIT_24 = 0x800000;
Bits.BIT_25 = 16777216;
Bits.BIT_26 = 33554432;
Bits.BIT_27 = 67108864;
Bits.BIT_28 = 134217728;
Bits.BIT_29 = 268435456;
Bits.BIT_30 = 536870912;
Bits.BIT_31 = 1073741824;
Bits.BIT_32 = -2147483648;
Bits.ALL = -1;
}//package de.polygonal.ds
Section 56
//Cloneable (de.polygonal.ds.Cloneable)
package de.polygonal.ds {
public interface Cloneable {
function clone():Object;
}
}//package de.polygonal.ds
Section 57
//Collection (de.polygonal.ds.Collection)
package de.polygonal.ds {
public interface Collection {
function toVector(_arg1:Vector=undefined):Vector;
function toArray(_arg1:Array=undefined):Array;
function size():int;
function iterator():Object;
function isEmpty():Boolean;
function contains(_arg1:Object):Boolean;
function clone(_arg1:Boolean, _arg2:Object=undefined):Collection;
function clear():void;
}
}//package de.polygonal.ds
Section 58
//Comparable (de.polygonal.ds.Comparable)
package de.polygonal.ds {
public interface Comparable {
function compare(_arg1:Object):int;
}
}//package de.polygonal.ds
Section 59
//Itr (de.polygonal.ds.Itr)
package de.polygonal.ds {
public interface Itr {
function reset():void;
function next():Object;
function hasNext():Boolean;
}
}//package de.polygonal.ds
Section 60
//LinkedQueue (de.polygonal.ds.LinkedQueue)
package de.polygonal.ds {
import de.polygonal.ds._LinkedQueue.*;
import de.polygonal.core.fmt.*;
import de.polygonal.core.util.*;
import flash.*;
public class LinkedQueue implements Queue {
public var _tail:LinkedQueueNode;
public var _size:int;
public var _maxSize:int;
public var _head:LinkedQueueNode;
public function LinkedQueue(_arg1:int=-1):void{
if (Boot.skip_constructor){
return;
};
_size = 0;
_maxSize = _arg1;
}
public function toVector(_arg1:Vector=undefined):Vector{
var _local2:Vector = new Vector();
var _local3:LinkedQueueNode = _head;
while (_local3 != null) {
_local2.pushBack(_local3.val);
_local3 = _local3.next;
};
return (_local2);
}
public function toString():String{
var _local1:String = Sprintf.format("\n{LinkedQueue size: %d}", [size()]);
if (size() == 0){
return (_local1);
};
_local1 = (_local1 + "\n|<\n");
var _local2:LinkedQueueNode = _head;
var _local3:int;
while (_local2 != null) {
_local3++;
_local1 = (_local1 + Sprintf.format(" %4d -> %s\n", [_local3, Std.string(_local2.val)]));
_local2 = _local2.next;
};
_local1 = (_local1 + ">|");
return (_local1);
}
public function toArray(_arg1:Array=undefined):Array{
Assert.assert(!((_arg1 == null)), "output is null", {fileName:"LinkedQueue.hx", lineNumber:344, className:"de.polygonal.ds.LinkedQueue", methodName:"toArray"});
var _local2:LinkedQueueNode = _head;
while (_local2 != null) {
_arg1.push(_local2.val);
_local2 = _local2.next;
};
return (_arg1);
}
public function size():int{
return (_size);
}
public function shuffle(_arg1:Vector=undefined):void{
var _local3 = (null as Class);
var _local4:int;
var _local5 = (null as LinkedQueueNode);
var _local6:int;
var _local7:int;
var _local8 = (null as Object);
var _local9 = (null as LinkedQueueNode);
var _local10:int;
var _local2:int = _size;
if (_arg1 == null){
_local3 = Math;
while (_local2 > 1) {
_local2--;
_local4 = Std._int((_local3.random() * _local2));
_local5 = _head;
_local6 = 0;
while (_local6 < _local2) {
_local6++;
_local7 = _local6;
_local5 = _local5.next;
};
_local8 = _local5.val;
_local9 = _head;
_local6 = 0;
while (_local6 < _local4) {
_local6++;
_local7 = _local6;
_local9 = _local9.next;
};
_local5.val = _local9.val;
_local9.val = _local8;
};
} else {
Assert.assert(!((_arg1 == null)), "rval is null", {fileName:"LinkedQueue.hx", lineNumber:223, className:"de.polygonal.ds.LinkedQueue", methodName:"shuffle"});
Assert.assert((_arg1.size() >= size()), "insufficient random values", {fileName:"LinkedQueue.hx", lineNumber:224, className:"de.polygonal.ds.LinkedQueue", methodName:"shuffle"});
_local4 = 0;
while (_local2 > 1) {
_local2--;
_local4++;
_local6 = Std._int((_arg1.get(_local4) * _local2));
_local5 = _head;
_local7 = 0;
while (_local7 < _local2) {
_local7++;
_local10 = _local7;
_local5 = _local5.next;
};
_local8 = _local5.val;
_local9 = _head;
_local7 = 0;
while (_local7 < _local6) {
_local7++;
_local10 = _local7;
_local9 = _local9.next;
};
_local5.val = _local9.val;
_local9.val = _local8;
};
};
}
public function peek():Object{
Assert.assert(!((_head == null)), "queue is empty", {fileName:"LinkedQueue.hx", lineNumber:81, className:"de.polygonal.ds.LinkedQueue", methodName:"peek"});
return (_head.val);
}
public function maxSize():int{
return (_maxSize);
}
public function iterator():Object{
return (new LinkedQueueIterator(this));
}
public function isEmpty():Boolean{
return ((_size == 0));
}
public function enqueue(_arg1:Object):void{
var _local3 = (null as LinkedQueueNode);
if (maxSize() != -1){
Assert.assert((size() < maxSize()), Sprintf.format("size equals max size (%d)", [maxSize()]), {fileName:"LinkedQueue.hx", lineNumber:105, className:"de.polygonal.ds.LinkedQueue", methodName:"enqueue"});
};
_size = (_size + 1);
var _local2:LinkedQueueNode = new LinkedQueueNode(_arg1);
if (_head == null){
_local3 = _local2;
_tail = _local3;
_head = _local3;
_head.next = _tail;
} else {
_tail.next = _local2;
_tail = _local2;
};
}
public function dequeue():Object{
Assert.assert(!((_head == null)), "queue is empty", {fileName:"LinkedQueue.hx", lineNumber:130, className:"de.polygonal.ds.LinkedQueue", methodName:"dequeue"});
_size = (_size - 1);
var _local1:LinkedQueueNode = _head;
if (_head == _tail){
_head = null;
_tail = null;
} else {
_head = _head.next;
};
_local1.next = null;
return (_local1.val);
}
public function contains(_arg1:Object):Boolean{
var _local2:LinkedQueueNode = _head;
var _local3:Boolean;
while (_local2 != null) {
if (_local2.val == _arg1){
return (true);
};
_local2 = _local2.next;
};
return (false);
}
public function clone(_arg1:Boolean, _arg2:Object=undefined):Collection{
var _local4 = (null as LinkedQueueNode);
var _local5 = (null as LinkedQueueNode);
var _local6 = (null as Cloneable);
var _local3:LinkedQueue = new LinkedQueue();
if (_size == 0){
return (_local3);
};
if (_arg1){
_local4 = _head;
if (_local4 != null){
_local5 = new LinkedQueueNode(_local4.val);
_local3._tail = _local5;
_local3._head = _local5;
_local3._head.next = _local3._tail;
};
_local4 = _local4.next;
while (_local4 != null) {
_local5 = new LinkedQueueNode(_local4.val);
_local3._tail.next = _local5;
_local3._tail = _local5;
_local4 = _local4.next;
};
} else {
if (_arg2 == null){
_local6 = null;
_local4 = _head;
if (_local4 != null){
Assert.assert(Std.is(_local4.val, Cloneable), Sprintf.format("element is not of type Cloneable (%s)", [_local4.val]), {fileName:"LinkedQueue.hx", lineNumber:412, className:"de.polygonal.ds.LinkedQueue", methodName:"clone"});
_local6 = _local4.val;
_local5 = new LinkedQueueNode(_local6.clone());
_local3._tail = _local5;
_local3._head = _local5;
_local3._head.next = _local3._tail;
};
_local4 = _local4.next;
while (_local4 != null) {
Assert.assert(Std.is(_local4.val, Cloneable), Sprintf.format("element is not of type Cloneable (%s)", [_local4.val]), {fileName:"LinkedQueue.hx", lineNumber:422, className:"de.polygonal.ds.LinkedQueue", methodName:"clone"});
_local6 = _local4.val;
_local5 = new LinkedQueueNode(_local6.clone());
_local3._tail.next = _local5;
_local3._tail = _local5;
_local4 = _local4.next;
};
} else {
_local4 = _head;
if (_local4 != null){
_local5 = new LinkedQueueNode(_arg2(_local4.val));
_local3._tail = _local5;
_local3._head = _local5;
_local3._head.next = _local3._tail;
};
_local4 = _local4.next;
while (_local4 != null) {
_local5 = new LinkedQueueNode(_arg2(_local4.val));
_local3._tail.next = _local5;
_local3._tail = _local5;
_local4 = _local4.next;
};
};
};
_local3._size = _size;
return (_local3);
}
public function clear():void{
var _local2 = (null as LinkedQueueNode);
var _local1:LinkedQueueNode = _head;
while (_local1 != null) {
_local2 = _local1.next;
_local1.next = null;
_local1 = _local1.next;
};
_local2 = null;
_tail = _local2;
_head = _local2;
_size = 0;
}
public function back():Object{
Assert.assert(!((_tail == null)), "queue is empty", {fileName:"LinkedQueue.hx", lineNumber:94, className:"de.polygonal.ds.LinkedQueue", methodName:"back"});
return (_tail.val);
}
public function assign(_arg1, _arg2:Array=undefined, _arg3:int=0):void{
var _local4 = (null as LinkedQueueNode);
var _local5:int;
var _local6:int;
if (_arg3 > 0){
if (maxSize() != -1){
Assert.assert((_arg3 <= maxSize()), Sprintf.format("limit out of range (%d)", [_arg3]), {fileName:"LinkedQueue.hx", lineNumber:164, className:"de.polygonal.ds.LinkedQueue", methodName:"assign"});
};
} else {
_arg3 = size();
};
if (Std.is(_arg1, Class)){
if (_arg2 == null){
_arg2 = [];
};
_local4 = _head;
_local5 = 0;
while (_local5 < _arg3) {
_local5++;
_local6 = _local5;
_local4.val = Type.createInstance(_arg1, _arg2);
_local4 = _local4.next;
};
} else {
_local4 = _head;
_local5 = 0;
while (_local5 < _arg3) {
_local5++;
_local6 = _local5;
_local4.val = _arg1;
_local4 = _local4.next;
};
};
}
}
}//package de.polygonal.ds
Section 61
//Queue (de.polygonal.ds.Queue)
package de.polygonal.ds {
public interface Queue extends Collection {
function peek():Object;
function enqueue(_arg1:Object):void;
function dequeue():Object;
function back():Object;
}
}//package de.polygonal.ds
Section 62
//Vector (de.polygonal.ds.Vector)
package de.polygonal.ds {
import de.polygonal.core.fmt.*;
import de.polygonal.core.util.*;
import flash.*;
import de.polygonal.ds._Vector.*;
public class Vector implements Collection {
public var _size:int;
public var _maxSize:int;
public var _a:Array;
public function Vector(_arg1:int=-1):void{
if (Boot.skip_constructor){
return;
};
_a = [];
_maxSize = _arg1;
_size = 0;
}
public function toVector(_arg1:Vector=undefined):Vector{
var _local4:int;
if (_arg1 == null){
_arg1 = new Vector();
};
var _local2:int;
var _local3:int = _a.length;
while (_local2 < _local3) {
_local2++;
_local4 = _local2;
_arg1.pushBack(__get(_local4));
};
return (_arg1);
}
public function toString():String{
var _local4:int;
var _local1:String = Sprintf.format("\n{Vector, size/max: %d/%d}", [size(), maxSize()]);
if (size() == 0){
return (_local1);
};
_local1 = (_local1 + "\n|<\n");
var _local2:int;
var _local3:int = size();
while (_local2 < _local3) {
_local2++;
_local4 = _local2;
_local1 = (_local1 + Sprintf.format(" %4d -> %s\n", [_local4, Std.string(__get(_local4))]));
};
_local1 = (_local1 + ">|");
return (_local1);
}
public function toArray(_arg1:Array=undefined):Array{
var _local4:int;
if (_arg1 == null){
_arg1 = [];
};
var _local2:int;
var _local3:int = size();
while (_local2 < _local3) {
_local2++;
_local4 = _local2;
_arg1.push(__get(_local4));
};
return (_arg1);
}
public function swp(_arg1:int, _arg2:int):void{
if (_arg1 >= 0){
false;
};
Assert.assert(false, Sprintf.format("i index out of range (%d)", [_arg1]), {fileName:"Vector.hx", lineNumber:134, className:"de.polygonal.ds.Vector", methodName:"swp"});
if (_arg2 >= 0){
false;
};
Assert.assert(false, Sprintf.format("j index out of range (%d)", [_arg2]), {fileName:"Vector.hx", lineNumber:135, className:"de.polygonal.ds.Vector", methodName:"swp"});
Assert.assert(!((_arg1 == _arg2)), Sprintf.format("i index equals j index (%d)", [_arg1]), {fileName:"Vector.hx", lineNumber:136, className:"de.polygonal.ds.Vector", methodName:"swp"});
var _local3:Object = __get(_arg1);
__cpy(_arg1, _arg2);
__set(_arg2, _local3);
}
public function sort(_arg1:Function, _arg2:Boolean=false):void{
if (size() > 1){
if (_arg1 == null){
if (_arg2){
_insertionSortComparable();
} else {
_quickSortComparable(0, size());
};
} else {
if (_arg2){
_insertionSort(_arg1);
} else {
_a.sort(_arg1);
};
};
};
}
public function size():int{
return (_size);
}
public function shuffle(_arg1:Vector=undefined):void{
var _local3 = (null as Class);
var _local4:int;
var _local5 = (null as Object);
var _local6:int;
var _local2:int = size();
if (_arg1 == null){
_local3 = Math;
while (_local2--, _local2 > 1) {
_local4 = Std._int((_local3.random() * _local2));
_local5 = __get(_local2);
__cpy(_local2, _local4);
__set(_local4, _local5);
};
} else {
Assert.assert(!((_arg1 == null)), "rval is null", {fileName:"Vector.hx", lineNumber:684, className:"de.polygonal.ds.Vector", methodName:"shuffle"});
Assert.assert((_arg1.size() >= size()), "insufficient random values", {fileName:"Vector.hx", lineNumber:685, className:"de.polygonal.ds.Vector", methodName:"shuffle"});
_local4 = 0;
while (_local2--, _local2 > 1) {
_local4++;
_local6 = Std._int((_arg1.get(_local4) * _local2));
_local5 = __get(_local2);
__cpy(_local2, _local6);
__set(_local6, _local5);
};
};
}
public function set(_arg1:int, _arg2:Object):void{
Assert.assert((size() > 0), "vector is empty", {fileName:"Vector.hx", lineNumber:120, className:"de.polygonal.ds.Vector", methodName:"set"});
if (_arg1 >= 0){
false;
};
Assert.assert(false, Sprintf.format("i index out of range (%d)", [_arg1]), {fileName:"Vector.hx", lineNumber:121, className:"de.polygonal.ds.Vector", methodName:"set"});
__set(_arg1, _arg2);
}
public function reverse():void{
_a.reverse();
}
public function removeRange(_arg1:int, _arg2:int, _arg3:Vector=undefined):Vector{
var _local4 = (null as Object);
var _local5:int;
var _local6:int;
var _local7 = (null as Object);
var _local8:int;
if (_arg1 >= 0){
false;
};
Assert.assert(false, Sprintf.format("i index out of range (%d)", [_arg1]), {fileName:"Vector.hx", lineNumber:345, className:"de.polygonal.ds.Vector", methodName:"removeRange"});
if (_arg2 > 0){
false;
};
Assert.assert(false, Sprintf.format("invalid num (%d)", [_arg2]), {fileName:"Vector.hx", lineNumber:346, className:"de.polygonal.ds.Vector", methodName:"removeRange"});
if (_arg3 == null){
_local4 = __get(_arg1);
_local5 = size();
_local6 = (_arg1 + _arg2);
while (_local6 < _local5) {
_local6++;
__set((_local6 - _arg2), __get(_local6));
};
} else {
_local4 = __get(_arg1);
_local5 = size();
_local6 = (_arg1 + _arg2);
while (_local6 < _local5) {
_local8 = (_local6 - _arg2);
_local7 = __get(_local8);
_arg3.pushBack(_local7);
_local6++;
__cpy(_local8, _local6);
};
};
_size = (_size - _arg2);
return (_arg3);
}
public function removeAt(_arg1:int):Object{
Assert.assert((size() > 0), "vector is empty", {fileName:"Vector.hx", lineNumber:268, className:"de.polygonal.ds.Vector", methodName:"removeAt"});
if (_arg1 >= 0){
false;
};
Assert.assert(false, Sprintf.format("i index out of range (%d)", [_arg1]), {fileName:"Vector.hx", lineNumber:269, className:"de.polygonal.ds.Vector", methodName:"removeAt"});
var _local2:Object = __get(_arg1);
var _local3 = (size() - 1);
var _local4:int = _arg1;
while (_local4 < _local3) {
_local4++;
__cpy(_local4, _local4);
};
_size = (_size - 1);
return (_local2);
}
public function pushFront(_arg1:Object):void{
if (maxSize() != -1){
Assert.assert((size() < maxSize()), Sprintf.format("size equals max size (%d)", [maxSize()]), {fileName:"Vector.hx", lineNumber:235, className:"de.polygonal.ds.Vector", methodName:"pushFront"});
};
insertAt(0, _arg1);
}
public function pushBack(_arg1:Object):void{
if (maxSize() != -1){
Assert.assert((size() < maxSize()), Sprintf.format("size equals max size (%d)", [maxSize()]), {fileName:"Vector.hx", lineNumber:206, className:"de.polygonal.ds.Vector", methodName:"pushBack"});
};
var _local2:int = _size;
_size = (_local2 + 1);
__set(_local2, _arg1);
}
public function popFront():Object{
Assert.assert((size() > 0), "vector is empty", {fileName:"Vector.hx", lineNumber:220, className:"de.polygonal.ds.Vector", methodName:"popFront"});
return (removeAt(0));
}
public function popBack():Object{
Assert.assert((size() > 0), "vector is empty", {fileName:"Vector.hx", lineNumber:192, className:"de.polygonal.ds.Vector", methodName:"popBack"});
var _local1 = (_size - 1);
_size = _local1;
return (__get(_local1));
}
public function move(_arg1:int, _arg2:int, _arg3:int):void{
var _local4:int;
var _local5:int;
var _local6 = (null as Array);
Assert.assert(!((_arg1 == _arg2)), Sprintf.format("destination equals source (%d)", [_arg2]), {fileName:"Vector.hx", lineNumber:487, className:"de.polygonal.ds.Vector", methodName:"move"});
Assert.assert((_arg3 >= 0), Sprintf.format("num invalid (%d)", [_arg3]), {fileName:"Vector.hx", lineNumber:488, className:"de.polygonal.ds.Vector", methodName:"move"});
if (_arg1 >= 0){
false;
};
Assert.assert(false, Sprintf.format("destination invalid (%d)", [_arg1]), {fileName:"Vector.hx", lineNumber:489, className:"de.polygonal.ds.Vector", methodName:"move"});
if (_arg2 >= 0){
false;
};
Assert.assert(false, Sprintf.format("source invalid (%d)", [_arg2]), {fileName:"Vector.hx", lineNumber:490, className:"de.polygonal.ds.Vector", methodName:"move"});
if ((_arg1 + _arg3) > _arg2){
true;
};
if (true){
_local4 = 0;
while (_local4 < _arg3) {
_local4++;
_local5 = _local4;
__cpy((_arg1 + _local5), (_arg2 + _local5));
};
} else {
_local6 = [];
_local4 = 0;
while (_local4 < _arg3) {
_local4++;
_local5 = _local4;
_local6[_local5] = __get((_arg2 + _local5));
};
_local4 = 0;
while (_local4 < _arg3) {
_local4++;
_local5 = _local4;
__set((_arg1 + _local5), _local6[_local5]);
};
};
}
public function maxSize():int{
return (_maxSize);
}
public function lastIndexOf(_arg1:Object, _arg2:int=-1):int{
if (_arg2 == -1){
_arg2 = (size() - 1);
};
Assert.assert((size() > 0), "vector is empty", {fileName:"Vector.hx", lineNumber:416, className:"de.polygonal.ds.Vector", methodName:"lastIndexOf"});
if (_arg2 >= 0){
false;
};
Assert.assert(false, Sprintf.format("from index out of range (%d)", [_arg2]), {fileName:"Vector.hx", lineNumber:417, className:"de.polygonal.ds.Vector", methodName:"lastIndexOf"});
var _local3 = -1;
var _local4:int = _arg2;
do {
} while (__get(_local4) != _arg1);
return (_local3);
}
public function join(_arg1:String):String{
return (_a.join(_arg1));
}
public function iterator():Object{
return (new VectorIterator(this));
}
public function isEmpty():Boolean{
return ((_a.length == 0));
}
public function insertAt(_arg1:int, _arg2:Object):void{
if (maxSize() != -1){
Assert.assert((size() < maxSize()), Sprintf.format("size equals max size (%d)", [maxSize()]), {fileName:"Vector.hx", lineNumber:250, className:"de.polygonal.ds.Vector", methodName:"insertAt"});
};
if (_arg1 >= 0){
false;
};
Assert.assert(false, Sprintf.format("i index out of range (%d)", [_arg1]), {fileName:"Vector.hx", lineNumber:251, className:"de.polygonal.ds.Vector", methodName:"insertAt"});
var _local3:int = size();
while (_local3 > _arg1) {
_local3--;
__cpy(_local3, _local3);
};
__set(_arg1, _arg2);
_size = (_size + 1);
}
public function indexOf(_arg1:Object, _arg2:int=0):int{
Assert.assert((size() > 0), "vector is empty", {fileName:"Vector.hx", lineNumber:385, className:"de.polygonal.ds.Vector", methodName:"indexOf"});
if (_arg2 >= 0){
false;
};
Assert.assert(false, Sprintf.format("from index out of range (%d)", [_arg2]), {fileName:"Vector.hx", lineNumber:386, className:"de.polygonal.ds.Vector", methodName:"indexOf"});
var _local3 = -1;
var _local4:int = _arg2;
var _local5 = (size() - 1);
do {
} while (__get(_local4) != _arg1);
return (_local3);
}
public function getArray():Array{
return (_a);
}
public function get(_arg1:int):Object{
Assert.assert((size() > 0), "vector is empty", {fileName:"Vector.hx", lineNumber:106, className:"de.polygonal.ds.Vector", methodName:"get"});
if (_arg1 >= 0){
false;
};
Assert.assert(false, Sprintf.format("i index out of range (%d)", [_arg1]), {fileName:"Vector.hx", lineNumber:107, className:"de.polygonal.ds.Vector", methodName:"get"});
return (__get(_arg1));
}
public function front():Object{
Assert.assert((size() > 0), "vector is empty", {fileName:"Vector.hx", lineNumber:166, className:"de.polygonal.ds.Vector", methodName:"front"});
return (__get(0));
}
public function erase(_arg1:Object):Boolean{
var _local4:int;
var _local2:int;
var _local3:int = size();
while (_local2 < _local3) {
_local2++;
_local4 = _local2;
if (__get(_local4) == _arg1){
removeAt(_local4);
return (true);
};
};
return (false);
}
public function cpy(_arg1:int, _arg2:int):void{
if (_arg1 >= 0){
false;
};
Assert.assert(false, Sprintf.format("i index out of range (%d)", [_arg1]), {fileName:"Vector.hx", lineNumber:151, className:"de.polygonal.ds.Vector", methodName:"cpy"});
if (_arg2 >= 0){
false;
};
Assert.assert(false, Sprintf.format("j index out of range (%d)", [_arg2]), {fileName:"Vector.hx", lineNumber:152, className:"de.polygonal.ds.Vector", methodName:"cpy"});
Assert.assert(!((_arg1 == _arg2)), Sprintf.format("i index equals j index (%d)", [_arg1]), {fileName:"Vector.hx", lineNumber:153, className:"de.polygonal.ds.Vector", methodName:"cpy"});
__cpy(_arg1, _arg2);
}
public function contains(_arg1:Object):Boolean{
var _local4:int;
var _local2:int;
var _local3:int = size();
while (_local2 < _local3) {
_local2++;
_local4 = _local2;
if (__get(_local4) == _arg1){
return (true);
};
};
return (false);
}
public function concat(_arg1:Vector, _arg2:Boolean=false):Vector{
var _local3 = (null as Vector);
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
Assert.assert(!((_arg1 == null)), "x is null", {fileName:"Vector.hx", lineNumber:305, className:"de.polygonal.ds.Vector", methodName:"concat"});
if (_arg2){
_local3 = new Vector();
_local3._size = (size() + _arg1.size());
_local4 = 0;
_local5 = size();
while (_local4 < _local5) {
_local4++;
_local6 = _local4;
_local3.set(_local6, __get(_local6));
};
_local4 = size();
_local5 = (size() + _arg1.size());
while (_local4 < _local5) {
_local4++;
_local6 = _local4;
_local3.set(_local6, _arg1.get((_local6 - size())));
};
return (_local3);
//unresolved jump
};
Assert.assert(!((_arg1 == this)), "x equals this", {fileName:"Vector.hx", lineNumber:324, className:"de.polygonal.ds.Vector", methodName:"concat"});
_local4 = _size;
_size = (_size + _arg1.size());
_local5 = 0;
_local6 = _arg1.size();
while (_local5 < _local6) {
_local5++;
_local7 = _local5;
_local4++;
__set(_local4, _arg1.get(_local7));
};
return (this);
}
public function compact():void{
_a.length = _size;
}
public function clone(_arg1:Boolean, _arg2:Object=undefined):Collection{
var _local4:int;
var _local5:int;
var _local6:int;
var _local7 = (null as Cloneable);
var _local3:Vector = new Vector();
_local3._size = _size;
if (_arg1){
_local4 = 0;
_local5 = size();
while (_local4 < _local5) {
_local4++;
_local6 = _local4;
_local3.__set(_local6, __get(_local6));
};
} else {
if (_arg2 == null){
_local7 = null;
_local4 = 0;
_local5 = size();
while (_local4 < _local5) {
_local4++;
_local6 = _local4;
Assert.assert(Std.is(__get(_local6), Cloneable), Sprintf.format("element is not of type Cloneable (%s)", [__get(_local6)]), {fileName:"Vector.hx", lineNumber:645, className:"de.polygonal.ds.Vector", methodName:"clone"});
_local7 = __get(_local6);
_local3.__set(_local6, _local7.clone());
};
} else {
_local4 = 0;
_local5 = size();
while (_local4 < _local5) {
_local4++;
_local6 = _local4;
_local3.__set(_local6, _arg2(__get(_local6)));
};
};
};
return (_local3);
}
public function clear():void{
_size = 0;
}
public function back():Object{
Assert.assert((size() > 0), "vector is empty", {fileName:"Vector.hx", lineNumber:179, className:"de.polygonal.ds.Vector", methodName:"back"});
return (__get((size() - 1)));
}
public function assign(_arg1, _arg2:Array=undefined, _arg3:int=0):void{
var _local4:int;
var _local5:int;
if (_arg3 > 0){
if (maxSize() != -1){
Assert.assert((_arg3 <= maxSize()), Sprintf.format("limit out of range (%d)", [_arg3]), {fileName:"Vector.hx", lineNumber:457, className:"de.polygonal.ds.Vector", methodName:"assign"});
};
} else {
_arg3 = size();
};
_size = _arg3;
if (Std.is(_arg1, Class)){
if (_arg2 == null){
_arg2 = [];
};
_local4 = 0;
while (_local4 < _arg3) {
_local4++;
_local5 = _local4;
__set(_local5, Type.createInstance(_arg1, _arg2));
};
} else {
_local4 = 0;
while (_local4 < _arg3) {
_local4++;
_local5 = _local4;
__set(_local5, _arg1);
};
};
}
public function _quickSortComparable(_arg1:int, _arg2:int):void{
var _local6:int;
var _local7:int;
var _local8:int;
var _local9 = (null as Object);
var _local10 = (null as Object);
var _local11 = (null as Object);
var _local12:int;
var _local13:int;
var _local14 = (null as Object);
var _local3 = ((_arg1 + _arg2) - 1);
var _local4:int = _arg1;
var _local5:int = _local3;
if (_arg2 > 1){
_local6 = _arg1;
_local7 = (_local6 + (_arg2 >> 1));
_local8 = ((_local6 + _arg2) - 1);
_local9 = __get(_local6);
_local10 = __get(_local7);
_local11 = __get(_local8);
Assert.assert(Std.is(_local9, Comparable), Sprintf.format("element is not of type Comparable (%s)", [Std.string(_local9)]), {fileName:"Vector.hx", lineNumber:795, className:"de.polygonal.ds.Vector", methodName:"_quickSortComparable"});
Assert.assert(Std.is(_local10, Comparable), Sprintf.format("element is not of type Comparable (%s)", [Std.string(_local10)]), {fileName:"Vector.hx", lineNumber:796, className:"de.polygonal.ds.Vector", methodName:"_quickSortComparable"});
Assert.assert(Std.is(_local11, Comparable), Sprintf.format("element is not of type Comparable (%s)", [Std.string(_local11)]), {fileName:"Vector.hx", lineNumber:797, className:"de.polygonal.ds.Vector", methodName:"_quickSortComparable"});
_local13 = _local9.compare(_local11);
if (_local13 < 0){
false;
};
if (false){
_local12 = ((_local10.compare(_local11))<0) ? _local7 : _local8;
} else {
if (_local9.compare(_local10) < 0){
false;
};
if (false){
_local12 = ((_local13)<0) ? _local6 : _local8;
} else {
_local12 = ((_local11.compare(_local9))<0) ? _local7 : _local6;
};
};
_local14 = __get(_local12);
__cpy(_local12, _arg1);
while (_local4 < _local5) {
Assert.assert(Std.is(__get(_local4), Comparable), Sprintf.format("element is not of type Comparable (%s)", [Std.string(__get(_local4))]), {fileName:"Vector.hx", lineNumber:818, className:"de.polygonal.ds.Vector", methodName:"_quickSortComparable"});
Assert.assert(Std.is(__get(_local5), Comparable), Sprintf.format("element is not of type Comparable (%s)", [Std.string(__get(_local5))]), {fileName:"Vector.hx", lineNumber:819, className:"de.polygonal.ds.Vector", methodName:"_quickSortComparable"});
Assert.assert(Std.is(_local14, Comparable), Sprintf.format("element is not of type Comparable (%s)", [Std.string(_local14)]), {fileName:"Vector.hx", lineNumber:820, className:"de.polygonal.ds.Vector", methodName:"_quickSortComparable"});
while (if (_local14.compare(__get(_local5)) < 0){
false;
}, false) {
_local5--;
};
if (_local5 != _local4){
__cpy(_local4, _local5);
_local4++;
};
while (if (_local14.compare(__get(_local4)) > 0){
false;
}, false) {
_local4++;
};
if (_local5 != _local4){
__cpy(_local5, _local4);
_local5--;
};
};
__set(_local4, _local14);
_quickSortComparable(_arg1, (_local4 - _arg1));
_quickSortComparable((_local4 + 1), (_local3 - _local4));
};
}
public function _quickSort(_arg1:int, _arg2:int, _arg3:Function):void{
var _local7:int;
var _local8:int;
var _local9:int;
var _local10 = (null as Object);
var _local11 = (null as Object);
var _local12 = (null as Object);
var _local13:int;
var _local14:int;
var _local15 = (null as Object);
var _local4 = ((_arg1 + _arg2) - 1);
var _local5:int = _arg1;
var _local6:int = _local4;
if (_arg2 > 1){
_local7 = _arg1;
_local8 = (_local7 + (_arg2 >> 1));
_local9 = ((_local7 + _arg2) - 1);
_local10 = __get(_local7);
_local11 = __get(_local8);
_local12 = __get(_local9);
_local14 = _arg3(_local10, _local12);
if (_local14 < 0){
false;
};
if (false){
_local13 = ((_arg3(_local11, _local12))<0) ? _local8 : _local9;
} else {
if (_arg3(_local11, _local10) < 0){
false;
};
if (false){
_local13 = ((_local14)<0) ? _local7 : _local9;
} else {
_local13 = ((_arg3(_local12, _local10))<0) ? _local8 : _local7;
};
};
_local15 = __get(_local13);
__cpy(_local13, _arg1);
while (_local5 < _local6) {
while (if (_arg3(_local15, __get(_local6)) < 0){
false;
}, false) {
_local6--;
};
if (_local6 != _local5){
__cpy(_local5, _local6);
_local5++;
};
while (if (_arg3(_local15, __get(_local5)) > 0){
false;
}, false) {
_local5++;
};
if (_local6 != _local5){
__cpy(_local6, _local5);
_local6--;
};
};
__set(_local5, _local15);
_quickSort(_arg1, (_local5 - _arg1), _arg3);
_quickSort((_local5 + 1), (_local4 - _local5), _arg3);
};
}
public function _insertionSortComparable():void{
var _local3:int;
var _local4 = (null as Object);
var _local5:int;
var _local6 = (null as Object);
var _local1 = 1;
var _local2:int = size();
while (_local1 < _local2) {
_local1++;
_local3 = _local1;
_local4 = __get(_local3);
Assert.assert(Std.is(_local4, Comparable), "element is not of type Comparable", {fileName:"Vector.hx", lineNumber:870, className:"de.polygonal.ds.Vector", methodName:"_insertionSortComparable"});
_local5 = _local3;
while (_local5 > 0) {
_local6 = __get((_local5 - 1));
Assert.assert(Std.is(_local6, Comparable), "element is not of type Comparable", {fileName:"Vector.hx", lineNumber:879, className:"de.polygonal.ds.Vector", methodName:"_insertionSortComparable"});
if (_local6.compare(_local4) > 0){
__set(_local5, _local6);
_local5--;
} else {
break;
};
};
__set(_local5, _local4);
};
}
public function _insertionSort(_arg1:Function):void{
var _local4:int;
var _local5 = (null as Object);
var _local6:int;
var _local7 = (null as Object);
var _local2 = 1;
var _local3:int = size();
while (_local2 < _local3) {
_local2++;
_local4 = _local2;
_local5 = __get(_local4);
_local6 = _local4;
while (_local6 > 0) {
_local7 = __get((_local6 - 1));
if (_arg1(_local7, _local5) > 0){
__set(_local6, _local7);
_local6--;
} else {
break;
};
};
__set(_local6, _local5);
};
}
public function __set(_arg1:int, _arg2:Object):void{
_a[_arg1] = _arg2;
}
public function __get(_arg1:int):Object{
return (_a[_arg1]);
}
public function __cpy(_arg1:int, _arg2:int):void{
_a[_arg1] = _a[_arg2];
}
}
}//package de.polygonal.ds
Section 63
//ASCII (de.polygonal.gl.text.ASCII)
package de.polygonal.gl.text {
public class ASCII {
public static var BACKSPACE:int;
public static var TAB:int;
public static var NEWLINE:int;
public static var SPACE:int;
public static var EXCLAM:int;
public static var QUOTEDBL:int;
public static var NUMBERSIGN:int;
public static var DOLLAR:int;
public static var PERCENT:int;
public static var AMPERSAND:int;
public static var QUOTESINGLE:int;
public static var PARENLEFT:int;
public static var PARENRIGHT:int;
public static var ASTERISK:int;
public static var PLUS:int;
public static var COMMA:int;
public static var HYPHEN:int;
public static var PERIOD:int;
public static var SLASH:int;
public static var ZERO:int;
public static var ONE:int;
public static var TWO:int;
public static var THREE:int;
public static var FOUR:int;
public static var FIVE:int;
public static var SIX:int;
public static var SEVEN:int;
public static var EIGHT:int;
public static var NINE:int;
public static var COLON:int;
public static var SEMICOLON:int;
public static var LESS:int;
public static var EQUAL:int;
public static var GREATER:int;
public static var QUESTION:int;
public static var AT:int;
public static var A:int;
public static var B:int;
public static var C:int;
public static var D:int;
public static var E:int;
public static var F:int;
public static var G:int;
public static var H:int;
public static var I:int;
public static var J:int;
public static var K:int;
public static var L:int;
public static var M:int;
public static var N:int;
public static var O:int;
public static var P:int;
public static var Q:int;
public static var R:int;
public static var S:int;
public static var T:int;
public static var U:int;
public static var V:int;
public static var W:int;
public static var X:int;
public static var Y:int;
public static var Z:int;
public static var BRACKETLEFT:int;
public static var BACKSLASH:int;
public static var BRACKETRIGHT:int;
public static var CIRCUM:int;
public static var UNDERSCORE:int;
public static var GRAVE:int;
public static var a:int;
public static var b:int;
public static var c:int;
public static var d:int;
public static var e:int;
public static var f:int;
public static var g:int;
public static var h:int;
public static var i:int;
public static var j:int;
public static var k:int;
public static var l:int;
public static var m:int;
public static var n:int;
public static var o:int;
public static var p:int;
public static var q:int;
public static var r:int;
public static var s:int;
public static var t:int;
public static var u:int;
public static var v:int;
public static var w:int;
public static var x:int;
public static var y:int;
public static var z:int;
public static var BRACELEFT:int;
public static var BAR:int;
public static var BRACERIGTH:int;
public static var TILDE:int;
public function ASCII():void{
}
public static function isASCII(_arg1:int):Boolean{
if (_arg1 >= 0){
false;
};
return (false);
}
public static function isDigit(_arg1:int):Boolean{
if (_arg1 >= 48){
false;
};
return (false);
}
public static function isWhite(_arg1:int):Boolean{
return ((_arg1 <= 32));
}
public static function isPrintable(_arg1:int):Boolean{
if (_arg1 >= 33){
false;
};
return (false);
}
public static function isUpperCaseAlphabetic(_arg1:int):Boolean{
if (_arg1 >= 65){
false;
};
return (false);
}
public static function isLowerCaseAlphabetic(_arg1:int):Boolean{
if (_arg1 >= 97){
false;
};
return (false);
}
public static function isAlphabetic(_arg1:int):Boolean{
if (!ASCII.isUpperCaseAlphabetic(_arg1)){
true;
};
return (true);
}
public static function isAlphaNumeric(_arg1:int):Boolean{
if (!ASCII.isDigit(_arg1)){
true;
if (!ASCII.isUpperCaseAlphabetic(_arg1)){
true;
};
};
return (true);
}
}
ASCII.BACKSPACE = 8;
ASCII.TAB = 9;
ASCII.NEWLINE = 10;
ASCII.SPACE = 32;
ASCII.EXCLAM = 33;
ASCII.QUOTEDBL = 34;
ASCII.NUMBERSIGN = 35;
ASCII.DOLLAR = 36;
ASCII.PERCENT = 37;
ASCII.AMPERSAND = 38;
ASCII.QUOTESINGLE = 39;
ASCII.PARENLEFT = 40;
ASCII.PARENRIGHT = 41;
ASCII.ASTERISK = 42;
ASCII.PLUS = 43;
ASCII.COMMA = 44;
ASCII.HYPHEN = 45;
ASCII.PERIOD = 46;
ASCII.SLASH = 47;
ASCII.ZERO = 48;
ASCII.ONE = 49;
ASCII.TWO = 50;
ASCII.THREE = 51;
ASCII.FOUR = 52;
ASCII.FIVE = 53;
ASCII.SIX = 54;
ASCII.SEVEN = 55;
ASCII.EIGHT = 56;
ASCII.NINE = 57;
ASCII.COLON = 58;
ASCII.SEMICOLON = 59;
ASCII.LESS = 60;
ASCII.EQUAL = 61;
ASCII.GREATER = 62;
ASCII.QUESTION = 63;
ASCII.AT = 64;
ASCII.A = 65;
ASCII.B = 66;
ASCII.C = 67;
ASCII.D = 68;
ASCII.E = 69;
ASCII.F = 70;
ASCII.G = 71;
ASCII.H = 72;
ASCII.I = 73;
ASCII.J = 74;
ASCII.K = 75;
ASCII.L = 76;
ASCII.M = 77;
ASCII.N = 78;
ASCII.O = 79;
ASCII.P = 80;
ASCII.Q = 81;
ASCII.R = 82;
ASCII.S = 83;
ASCII.T = 84;
ASCII.U = 85;
ASCII.V = 86;
ASCII.W = 87;
ASCII.X = 88;
ASCII.Y = 89;
ASCII.Z = 90;
ASCII.BRACKETLEFT = 91;
ASCII.BACKSLASH = 92;
ASCII.BRACKETRIGHT = 93;
ASCII.CIRCUM = 94;
ASCII.UNDERSCORE = 95;
ASCII.GRAVE = 96;
ASCII.a = 97;
ASCII.b = 98;
ASCII.c = 99;
ASCII.d = 100;
ASCII.e = 101;
ASCII.f = 102;
ASCII.g = 103;
ASCII.h = 104;
ASCII.i = 105;
ASCII.j = 106;
ASCII.k = 107;
ASCII.l = 108;
ASCII.m = 109;
ASCII.n = 110;
ASCII.o = 111;
ASCII.p = 112;
ASCII.q = 113;
ASCII.r = 114;
ASCII.s = 115;
ASCII.t = 116;
ASCII.u = 117;
ASCII.v = 118;
ASCII.w = 119;
ASCII.x = 120;
ASCII.y = 121;
ASCII.z = 122;
ASCII.BRACELEFT = 123;
ASCII.BAR = 124;
ASCII.BRACERIGTH = 125;
ASCII.TILDE = 126;
}//package de.polygonal.gl.text
Section 64
//Boot (flash.Boot)
package flash {
import flash.display.*;
import flash.utils.*;
import flash.text.*;
public dynamic class Boot extends MovieClip {
public static var init:Function;
public static var tf:TextField;
public static var lines:Array;
public static var lastError:Error;
public static var skip_constructor:Boolean;
public function Boot(_arg1:MovieClip=undefined):void{
var _local3:* = null;
if (Boot.skip_constructor){
return;
};
super();
_local3 = Array.prototype;
_local3.copy = function (){
return (this.slice());
};
_local3.insert = function (_arg1, _arg2):void{
this.splice(_arg1, 0, _arg2);
};
_local3.remove = function (_arg1):Boolean{
var _local2:int = this.indexOf(_arg1);
if (_local2 == -1){
return (false);
};
this.splice(_local2, 1);
return (true);
};
_local3.iterator = function ():Object{
var cur:int;
var arr = this;
return ({hasNext:function ():Boolean{
return ((cur < arr.length));
}, next:function (){
var _local1:int = cur;
cur = (_local1 + 1);
return (arr[_local1]);
}});
};
_local3.setPropertyIsEnumerable("copy", false);
_local3.setPropertyIsEnumerable("insert", false);
_local3.setPropertyIsEnumerable("remove", false);
_local3.setPropertyIsEnumerable("iterator", false);
var cca:* = String.prototype.charCodeAt;
String.prototype.charCodeAt = function (_arg1){
var _local2:* = cca.call(this, _arg1);
if (isNaN(_local2)){
return (null);
};
return (_local2);
};
Boot.lines = [];
var _local4:MovieClip = ((_arg1)==null) ? this : _arg1;
Lib.current = _local4;
try {
if (_local4.stage != null){
false;
};
if (false){
_local4.stage.align = "TOP_LEFT";
} else {
null;
};
} catch(#InvalidMultinameIndex#) {
_local3 = !NULL!;
};
if (Boot.init != null){
Boot.init();
};
}
public static function enum_to_string(_arg1:Object):String{
if (_arg1.params == null){
return (_arg1.tag);
};
return ((((_arg1.tag + "(") + _arg1.params.join(",")) + ")"));
}
public static function __instanceof(_arg1, _arg2):Boolean{
var _local4:* = null;
try {
if (_arg2 == Dynamic){
return (true);
};
return ((_arg1 is _arg2));
} catch!ERROR! return (false);
}
public static function __clear_trace():void{
if (Boot.tf == null){
return;
};
Lib.current.removeChild(Boot.tf);
Boot.tf = null;
Boot.lines = [];
}
public static function __set_trace_color(_arg1:uint):void{
Boot.getTrace().textColor = _arg1;
}
public static function getTrace():TextField{
var _local2 = (null as TextFormat);
var _local1:MovieClip = Lib.current;
if (Boot.tf == null){
Boot.tf = new TextField();
_local2 = Boot.tf.getTextFormat();
_local2.font = "Consolas";
Boot.tf.defaultTextFormat = _local2;
Boot.tf.selectable = false;
Boot.tf.width = ((_local1.stage)==null) ? 800 : _local1.stage.stageWidth;
Boot.tf.autoSize = TextFieldAutoSize.LEFT;
Boot.tf.mouseEnabled = false;
};
_local1.addChild(Boot.tf);
return (Boot.tf);
}
public static function __trace(_arg1, _arg2:Object):void{
var _local3:TextField = Boot.getTrace();
var _local4:String = ((_arg2)==null) ? "(null)" : ((_arg2.fileName + ":") + _arg2.lineNumber);
Boot.lines = Boot.lines.concat(((_local4 + ": ") + Boot.__string_rec(_arg1, "")).split("\n"));
_local3.text = Boot.lines.join("\n");
var _local5:Stage = Lib.current.stage;
if (_local5 == null){
return;
};
while (if (Boot.lines.length > 1){
false;
}, false) {
Boot.lines.shift();
_local3.text = Boot.lines.join("\n");
};
}
public static function __string_rec(_arg1, _arg2:String):String{
var _local4 = (null as String);
var _local5 = (null as Array);
var _local6 = (null as Array);
var _local7:int;
var _local8:* = null;
var _local9 = (null as String);
var _local10:Boolean;
var _local11:int;
var _local12:int;
var _local13 = (null as String);
var _local3:String = getQualifiedClassName(_arg1);
_local4 = _local3;
if (_local4 == "Object"){
_local7 = 0;
_local6 = [];
_local8 = _arg1;
for (/*?*/in _arg1) {
_local6.push(//unresolved nextvalue or nextname);
};
_local5 = _local6;
_local9 = "{";
_local10 = true;
_local7 = 0;
_local11 = _local5.length;
while (_local7 < _local11) {
_local7++;
_local12 = _local7;
_local13 = _local5[_local12];
if (_local10){
_local10 = false;
} else {
_local9 = (_local9 + ",");
};
_local9 = (_local9 + (((" " + _local13) + " : ") + Boot.__string_rec(_arg1[_local13], _arg2)));
};
if (!_local10){
_local9 = (_local9 + " ");
};
_local9 = (_local9 + "}");
return (_local9);
} else {
if (_local4 == "Array"){
_local9 = "[";
_local10 = true;
_local5 = _arg1;
_local7 = 0;
_local11 = _local5.length;
while (_local7 < _local11) {
_local7++;
_local12 = _local7;
if (_local10){
_local10 = false;
} else {
_local9 = (_local9 + ",");
};
_local9 = (_local9 + Boot.__string_rec(_local5[_local12], _arg2));
};
return ((_local9 + "]"));
} else {
_local4 = typeof(_arg1);
if (_local4 == "function"){
return ("<function>");
//unresolved jump
};
};
};
return (new String(_arg1));
}
public static function __unprotect__(_arg1:String):String{
return (_arg1);
}
}
Boot.skip_constructor = false;
??getglobalscope
.Boot.init = function ():void{
Math.NaN = Number.NaN;
Math.NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY;
Math.POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
Math.isFinite = function (_arg1:Number):Boolean{
return (isFinite(_arg1));
};
Math.isNaN = function (_arg1:Number):Boolean{
return (isNaN(_arg1));
};
null;
};
}//package flash
Section 65
//Lib (flash.Lib)
package flash {
import flash.display.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class Lib {
public static var current:MovieClip;
public function Lib():void{
}
public static function getTimer():int{
return (getTimer());
}
public static function eval(_arg1:String){
var _local6:* = null;
var _local8 = (null as String);
var _local3:Array = _arg1.split(".");
var _local4:Array = [];
var _local5:* = null;
while (_local3.length > 0) {
try {
_local5 = getDefinitionByName(_local3.join("."));
} catch(#InvalidMultinameIndex#) {
if (( as Error)){
Boot.lastError = _local6;
};
_local4.unshift(_local3.pop());
};
if (_local5 != null){
break;
};
};
var _local7:int;
while (_local7 < _local4.length) {
_local8 = _local4[_local7];
_local7++;
if (_local5 == null){
return (null);
};
_local5 = _local5[_local8];
};
return (_local5);
}
public static function getURL(_arg1:URLRequest, _arg2:String=undefined):void{
var _local3:Function = navigateToURL;
if (_arg2 == null){
_local3(_arg1);
} else {
_local3(_arg1, _arg2);
};
}
public static function fscommand(_arg1:String, _arg2:String=undefined):void{
fscommand(_arg1, ((_arg2)==null) ? "" : _arg2);
}
public static function trace(_arg1):void{
trace(_arg1);
}
public static function attach(_arg1:String):MovieClip{
var _local2:* = (getDefinitionByName(_arg1) as Class);
return (new (_local2));
}
public static function as(_arg1, _arg2:Class):Object{
return ((_arg1 as _arg2));
}
}
}//package flash
Section 66
//Log (haxe.Log)
package haxe {
public class Log {
public static var trace:Function;
public static var clear:Function;
public static var setColor:Function;
public function Log():void{
}
}
[OP_NEWCLASS ClassInfo:84 base:Object].trace = function (_arg1, _arg2:Object=undefined):void{
Boot.__trace(_arg1, _arg2);
};
[OP_NEWCLASS ClassInfo:84 base:Object].clear = function ():void{
Boot.__clear_trace();
};
[OP_NEWCLASS ClassInfo:84 base:Object].setColor = function (_arg1:int):void{
Boot.__set_trace_color(_arg1);
};
}//package haxe
Section 67
//answerCorrect (sfx.answerCorrect)
package sfx {
import flash.media.*;
public dynamic class answerCorrect extends Sound {
}
}//package sfx
Section 68
//answerSelect (sfx.answerSelect)
package sfx {
import flash.media.*;
public dynamic class answerSelect extends Sound {
}
}//package sfx
Section 69
//answerWrong (sfx.answerWrong)
package sfx {
import flash.media.*;
public dynamic class answerWrong extends Sound {
}
}//package sfx
Section 70
//duello (sfx.duello)
package sfx {
import flash.media.*;
public dynamic class duello extends Sound {
}
}//package sfx
Section 71
//duelloVictory (sfx.duelloVictory)
package sfx {
import flash.media.*;
public dynamic class duelloVictory extends Sound {
}
}//package sfx
Section 72
//ghigliottina (sfx.ghigliottina)
package sfx {
import flash.media.*;
public dynamic class ghigliottina extends Sound {
}
}//package sfx
Section 73
//ghigliottinaVictory (sfx.ghigliottinaVictory)
package sfx {
import flash.media.*;
public dynamic class ghigliottinaVictory extends Sound {
}
}//package sfx
Section 74
//goldBar (sfx.goldBar)
package sfx {
import flash.media.*;
public dynamic class goldBar extends Sound {
}
}//package sfx
Section 75
//intro (sfx.intro)
package sfx {
import flash.media.*;
public dynamic class intro extends Sound {
}
}//package sfx
Section 76
//scoreUpdate (sfx.scoreUpdate)
package sfx {
import flash.media.*;
public dynamic class scoreUpdate extends Sound {
}
}//package sfx
Section 77
//showQuestion (sfx.showQuestion)
package sfx {
import flash.media.*;
public dynamic class showQuestion extends Sound {
}
}//package sfx
Section 78
//showWord (sfx.showWord)
package sfx {
import flash.media.*;
public dynamic class showWord extends Sound {
}
}//package sfx
Section 79
//tileReveal (sfx.tileReveal)
package sfx {
import flash.media.*;
public dynamic class tileReveal extends Sound {
}
}//package sfx
Section 80
//tileSelect (sfx.tileSelect)
package sfx {
import flash.media.*;
public dynamic class tileSelect extends Sound {
}
}//package sfx
Section 81
//timelimitHit (sfx.timelimitHit)
package sfx {
import flash.media.*;
public dynamic class timelimitHit extends Sound {
}
}//package sfx
Section 82
//valueReveal (sfx.valueReveal)
package sfx {
import flash.media.*;
public dynamic class valueReveal extends Sound {
}
}//package sfx
Section 83
//wordCorrect (sfx.wordCorrect)
package sfx {
import flash.media.*;
public dynamic class wordCorrect extends Sound {
}
}//package sfx
Section 84
//wordWrong (sfx.wordWrong)
package sfx {
import flash.media.*;
public dynamic class wordWrong extends Sound {
}
}//package sfx
Section 85
//Dynamic (Dynamic)
package {
public class Dynamic {
public function Dynamic():void{
}
}
}//package
Section 86
//InputLetter (InputLetter)
package {
import flash.display.*;
public dynamic class InputLetter extends MovieClip {
public var line:MovieClip;
public var clip:MovieClip;
}
}//package
Section 87
//MainGraphics (MainGraphics)
package {
import flash.display.*;
import flash.text.*;
public dynamic class MainGraphics extends MovieClip {
public var quitButton:MovieClip;
public var introVideo:MovieClip;
public var duello:MovieClip;
public var clock:TextField;
public var infoPanel:MovieClip;
public var ghigliottina:MovieClip;
public var timeBar:MovieClip;
public var timeBonus:MovieClip;
public var soundButton:MovieClip;
public var musicButton:MovieClip;
}
}//package
Section 88
//Reflect (Reflect)
package {
public class Reflect {
public function Reflect():void{
}
public static function hasField(_arg1, _arg2:String):Boolean{
return (_arg1.hasOwnProperty(_arg2));
}
public static function field(_arg1, _arg2:String){
return (((_arg1)==null) ? null : _arg1[_arg2]);
}
public static function setField(_arg1, _arg2:String, _arg3):void{
_arg1[_arg2] = _arg3;
}
public static function callMethod(_arg1, _arg2, _arg3:Array){
return (_arg2.apply(_arg1, _arg3));
}
public static function fields(_arg1):Array{
if (_arg1 == null){
return ([]);
};
var _local4:int;
var _local3:Array = [];
var _local5:* = _arg1;
for (/*?*/in _arg1) {
_local3.push(//unresolved nextvalue or nextname);
};
var _local2:Array = _local3;
_local4 = 0;
while (_local4 < _local2.length) {
if (!_arg1.hasOwnProperty(_local2[_local4])){
_local2.splice(_local4, 1);
} else {
_local4++;
};
};
return (_local2);
}
public static function isFunction(_arg1):Boolean{
return ((typeof(_arg1) == "function"));
}
public static function compare(_arg1:Object, _arg2:Object):int{
return (((_arg1)==_arg2) ? 0 : ((_arg1)>_arg2) ? 1 : -1);
}
public static function compareMethods(_arg1, _arg2):Boolean{
if (_arg1 == _arg2){
return (true);
};
if (!!(Reflect.isFunction(_arg1))){
true;
};
if (true){
return (false);
};
return (false);
}
public static function isObject(_arg1):Boolean{
var _local4:* = null;
if (_arg1 == null){
return (false);
};
var _local3:String = typeof(_arg1);
if (_local3 == "object"){
try {
if (_arg1.__enum__ == true){
return (false);
};
} catch(#InvalidMultinameIndex#) {
_local4 = !NULL!;
};
return (true);
};
return ((_local3 == "string"));
}
public static function deleteField(_arg1, _arg2:String):Boolean{
if (_arg1.hasOwnProperty(_arg2) != true){
return (false);
};
delete _arg1[_arg2];
return (true);
}
public static function copy(_arg1:Object):Object{
var _local5 = (null as String);
var _local2:* = {};
var _local3:int;
var _local4:Array = Reflect.fields(_arg1);
while (_local3 < _local4.length) {
_local5 = _local4[_local3];
_local3++;
Reflect.setField(_local2, _local5, Reflect.field(_arg1, _local5));
};
return (_local2);
}
public static function makeVarArgs(_arg1:Function){
var f = _arg1;
return (function (... _args){
return (f(_args));
});
}
}
}//package
Section 89
//Std (Std)
package {
import flash.*;
public class Std {
public function Std():void{
}
public static function is(_arg1, _arg2):Boolean{
return (Boot.__instanceof(_arg1, _arg2));
}
public static function string(_arg1):String{
return (Boot.__string_rec(_arg1, ""));
}
public static function _int(_arg1:Number):int{
return (_arg1);
}
public static function parseInt(_arg1:String):Object{
var _local2:* = parseInt(_arg1);
if (isNaN(_local2)){
return (null);
};
return (_local2);
}
public static function parseFloat(_arg1:String):Number{
return (parseFloat(_arg1));
}
public static function random(_arg1:int):int{
return (Math.floor((Math.random() * _arg1)));
}
}
}//package
Section 90
//Type (Type)
package {
import flash.utils.*;
import flash.*;
public class Type {
public function Type():void{
}
public static function getClass(_arg1:Object):Class{
var _local2:String = getQualifiedClassName(_arg1);
if (_local2 != "null"){
true;
if (_local2 != "Object"){
true;
if (_local2 != "int"){
true;
if (_local2 != "Number"){
true;
};
};
};
};
if (true){
return (null);
};
if (_arg1.hasOwnProperty("prototype")){
return (null);
};
var _local3:* = (getDefinitionByName(_local2) as Class);
if (_local3.__isenum){
return (null);
};
return (_local3);
}
public static function getEnum(_arg1):Class{
var _local2:String = getQualifiedClassName(_arg1);
if (_local2 != "null"){
true;
};
if (true){
return (null);
};
if (_arg1.hasOwnProperty("prototype")){
return (null);
};
var _local3:* = (getDefinitionByName(_local2) as Class);
if (!_local3.__isenum){
return (null);
};
return (_local3);
}
public static function getSuperClass(_arg1:Class):Class{
var _local2:String = getQualifiedSuperclassName(_arg1);
if (_local2 == "Object"){
return (null);
};
return ((getDefinitionByName(_local2) as Class));
}
public static function getClassName(_arg1:Class):String{
if (_arg1 == null){
return (null);
};
var _local2:String = getQualifiedClassName(_arg1);
var _local3:String = _local2;
if (_local3 == "int"){
return ("Int");
} else {
if (_local3 == "Number"){
return ("Float");
} else {
if (_local3 == "Boolean"){
return ("Bool");
//unresolved jump
};
};
};
return (_local2.split("::").join("."));
}
public static function getEnumName(_arg1:Class):String{
return (Type.getClassName(_arg1));
}
public static function resolveClass(_arg1:String):Class{
var _local3 = (null as Class);
var _local4:* = null;
var _local5 = (null as String);
try {
_local3 = (getDefinitionByName(_arg1) as Class);
if (_local3.__isenum){
return (null);
};
return (_local3);
} catch(#InvalidMultinameIndex#) {
_local4 = !NULL!;
_local5 = _arg1;
if (_local5 == "Int"){
return (int);
} else {
if (_local5 == "Float"){
return (Number);
//unresolved jump
};
};
return (null);
};
if (_local3 != null){
true;
};
if (true){
return (null);
};
return (_local3);
}
public static function resolveEnum(_arg1:String):Class{
var _local3:* = null;
var _local4:* = null;
try {
_local3 = getDefinitionByName(_arg1);
if (!_local3.__isenum){
return (null);
};
return (_local3);
} catch(#InvalidMultinameIndex#) {
_local4 = !NULL!;
if (_arg1 == "Bool"){
return (Boolean);
};
return (null);
};
if (_local3 != null){
true;
};
if (true){
return (null);
};
return (_local3);
}
public static function createInstance(_arg1:Class, _arg2:Array):Object{
//unexpected switch
Boot.lastError = new Error();
throw ("Too many arguments");
//unresolved jump
//unresolved jump
//unresolved jump
//unresolved jump
//unresolved jump
//unresolved jump
//unresolved jump
//unresolved jump
//unresolved jump
//unresolved jump
//unresolved jump
//unresolved jump
//unresolved jump
//unresolved jump
//unresolved jump
return (new _arg1(_arg2[0], _arg2[1], _arg2[2], _arg2[3], _arg2[4], _arg2[5], _arg2[6], _arg2[7], _arg2[8], _arg2[9], _arg2[10], _arg2[11], _arg2[12], _arg2[13]));
}
public static function createEmptyInstance(_arg1:Class):Object{
var _local3 = (null as Object);
var _local4:* = null;
try {
Boot.skip_constructor = true;
_local3 = new (_arg1);
Boot.skip_constructor = false;
return (_local3);
} catch(#InvalidMultinameIndex#) {
_local4 = !NULL!;
Boot.skip_constructor = false;
Boot.lastError = new Error();
throw (_local4);
};
return (null);
}
public static function createEnum(_arg1:Class, _arg2:String, _arg3:Array=undefined):Object{
var _local4:Object = Reflect.field(_arg1, _arg2);
if (_local4 == null){
Boot.lastError = new Error();
throw (("No such constructor " + _arg2));
};
if (Reflect.isFunction(_local4)){
if (_arg3 == null){
Boot.lastError = new Error();
throw ((("Constructor " + _arg2) + " need parameters"));
};
return (Reflect.callMethod(_arg1, _local4, _arg3));
};
if (_arg3 != null){
false;
};
if (false){
Boot.lastError = new Error();
throw ((("Constructor " + _arg2) + " does not need parameters"));
};
return (_local4);
}
public static function createEnumIndex(_arg1:Class, _arg2:int, _arg3:Array=undefined):Object{
var _local4:String = Type.getEnumConstructs(_arg1)[_arg2];
if (_local4 == null){
Boot.lastError = new Error();
throw ((_arg2 + " is not a valid enum constructor index"));
};
return (Type.createEnum(_arg1, _local4, _arg3));
}
public static function describe(_arg1, _arg2:Boolean):Array{
var _local8:int;
var _local3:Array = [];
var _local4:XML = describeType(_arg1);
if (_arg2){
_local4 = _local4.factory[0];
};
var _local5:XMLList = _local4.child("method");
var _local6:int;
var _local7:int = _local5.length();
while (_local6 < _local7) {
_local6++;
_local8 = _local6;
_local3.push(Std.string(_local5[_local8].attribute("name")));
};
var _local9:XMLList = _local4.child("variable");
_local6 = 0;
_local7 = _local9.length();
while (_local6 < _local7) {
_local6++;
_local8 = _local6;
_local3.push(Std.string(_local9[_local8].attribute("name")));
};
var _local10:XMLList = _local4.child("accessor");
_local6 = 0;
_local7 = _local10.length();
while (_local6 < _local7) {
_local6++;
_local8 = _local6;
_local3.push(Std.string(_local10[_local8].attribute("name")));
};
return (_local3);
}
public static function getInstanceFields(_arg1:Class):Array{
return (Type.describe(_arg1, true));
}
public static function getClassFields(_arg1:Class):Array{
var _local2:Array = Type.describe(_arg1, false);
_local2.remove("__construct__");
_local2.remove("prototype");
return (_local2);
}
public static function getEnumConstructs(_arg1:Class):Array{
return (_arg1.__constructs__);
}
public static function typeof(_arg1):ValueType{
var _local5:* = null;
var _local6:* = null;
var _local3:String = getQualifiedClassName(_arg1);
var _local4:String = _local3;
if (_local4 == "null"){
return (ValueType.TNull);
} else {
if (_local4 == "void"){
return (ValueType.TNull);
} else {
if (_local4 == "int"){
return (ValueType.TInt);
} else {
if (_local4 == "Number"){
return (ValueType.TFloat);
} else {
if (_local4 == "Boolean"){
return (ValueType.TBool);
} else {
if (_local4 == "Object"){
return (ValueType.TObject);
} else {
_local5 = null;
try {
_local5 = getDefinitionByName(_local3);
if (_arg1.hasOwnProperty("prototype")){
return (ValueType.TObject);
};
if (_local5.__isenum){
return (ValueType.TEnum(_local5));
};
return (ValueType.TClass(_local5));
} catch(#InvalidMultinameIndex#) {
if (( as Error)){
Boot.lastError = _local6;
};
if (_local3 != "builtin.as$0::MethodClosure"){
true;
};
if (true){
return (ValueType.TFunction);
};
return (((_local5)==null) ? ValueType.TFunction : ValueType.TClass(_local5));
};
};
};
};
};
};
};
return (null);
}
public static function enumEq(_arg1:Object, _arg2:Object):Boolean{
var _local4 = (null as Array);
var _local5 = (null as Array);
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:* = null;
if (_arg1 == _arg2){
return (true);
};
try {
if (_arg1.index != _arg2.index){
return (false);
};
_local4 = _arg1.params;
_local5 = _arg2.params;
_local6 = 0;
_local7 = _local4.length;
while (_local6 < _local7) {
_local6++;
_local8 = _local6;
if (!Type.enumEq(_local4[_local8], _local5[_local8])){
return (false);
};
};
} catch(#InvalidMultinameIndex#) {
_local9 = !NULL!;
return (false);
};
return (true);
}
public static function enumConstructor(_arg1):String{
return (_arg1.tag);
}
public static function enumParameters(_arg1):Array{
return (((_arg1.params)==null) ? [] : _arg1.params);
}
public static function enumIndex(_arg1):int{
return (_arg1.index);
}
}
}//package
Section 91
//ValueType (ValueType)
package {
import flash.*;
public final class ValueType {
public const __enum__:Boolean = true;
public var tag:String;
public var index:int;
public var params:Array;
public static const __isenum:Boolean = true;
public static var __constructs__;
public static var TUnknown:ValueType;
public static var TObject:ValueType;
public static var TNull:ValueType;
public static var TInt:ValueType;
public static var TFunction:ValueType;
public static var TFloat:ValueType;
public static var TBool:ValueType;
public function ValueType(_arg1:String, _arg2:int, _arg3):void{
tag = _arg1;
index = _arg2;
params = _arg3;
}
final public function toString():String{
return (Boot.enum_to_string(this));
}
public static function TEnum(_arg1:Class):ValueType{
return (new ValueType("TEnum", 7, [_arg1]));
}
public static function TClass(_arg1:Class):ValueType{
return (new ValueType("TClass", 6, [_arg1]));
}
}
var _local1 = [OP_NEWCLASS ClassInfo:77 base:Object];
??getglobalscope
.ValueType = _local1;
var _slot1 = new ValueType("TBool", 3, null);
var _slot4 = new ValueType("TFloat", 2, null);
var _slot5 = new ValueType("TFunction", 5, null);
var _slot6 = new ValueType("TInt", 1, null);
var _slot7 = new ValueType("TNull", 0, null);
var _slot8 = new ValueType("TObject", 4, null);
var _slot9 = new ValueType("TUnknown", 8, null);
_local1.__constructs__ = ["TNull", "TInt", "TFloat", "TBool", "TObject", "TFunction", "TClass", "TEnum", "TUnknown"];
}//package
Section 92
//Void (Void)
package {
import flash.*;
public final class Void {
public const __enum__:Boolean = true;
public var tag:String;
public var index:int;
public var params:Array;
public static const __isenum:Boolean = true;
public static var __constructs__;
public function Void(_arg1:String, _arg2:int, _arg3):void{
tag = _arg1;
index = _arg2;
params = _arg3;
}
final public function toString():String{
return (Boot.enum_to_string(this));
}
}
var _local1 = [OP_NEWCLASS ClassInfo:32 base:Object];
??getglobalscope
.Void = _local1;
_local1.__constructs__ = [];
}//package