Section 1
//Avatar (com.midasplayer.avatar.Avatar)
package com.midasplayer.avatar {
public interface Avatar {
function getWidth():int;
function setMood(_arg1:String);
function getHeight():int;
function executeCommand(_arg1:String);
}
}//package com.midasplayer.avatar
Section 2
//AvatarLoader (com.midasplayer.avatar.AvatarLoader)
package com.midasplayer.avatar {
import flash.events.*;
import flash.display.*;
import flash.external.*;
import flash.system.*;
import flash.net.*;
public class AvatarLoader {
private var path:String;
private var isMoneyGame:Boolean;
private var loaderId:int;
private var progressCallback:Function;
private var completeCallback:Function;
public function AvatarLoader(_arg1:String=null){
if ((((_arg1 == null)) || ((_arg1.length == 0)))){
path = "AvatarManager.swf";
} else {
path = _arg1;
};
progressCallback = null;
completeCallback = null;
isMoneyGame = false;
var _local2:Object = ExternalInterface.call("isMoneyGame");
if (_local2 != null){
isMoneyGame = (_local2.message == 1);
};
}
public function load(_arg1:Function, _arg2:Function=null){
this.completeCallback = _arg1;
this.progressCallback = _arg2;
if (isMoneyGame){
moneyLoad();
} else {
simpleLoad();
};
}
private function moneyLoad(){
path = "AvatarManager.swf";
ExternalInterface.addCallback("onSwfProgress", onSwfProgress);
var _local1:Object = ExternalInterface.call("preloadSwf", path);
if (_local1 != null){
loaderId = _local1.message;
};
}
public function onSwfProgress(_arg1:int, _arg2:int, _arg3:String){
if (_arg2 < 100){
};
if (_arg2 == 100){
path = _arg3;
simpleLoad();
} else {
if (_arg2 < 0){
};
};
}
private function simpleLoad(){
var _local1:LoaderContext = new LoaderContext();
_local1.applicationDomain = ApplicationDomain.currentDomain;
_local1.securityDomain = (isMoneyGame) ? null : SecurityDomain.currentDomain;
var _local2:URLRequest = new URLRequest(path);
var _local3:Loader = new Loader();
if (((!(isMoneyGame)) && (!((progressCallback == null))))){
_local3.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressCallback);
};
if (completeCallback != null){
_local3.contentLoaderInfo.addEventListener(Event.COMPLETE, completeCallback);
};
_local3.load(_local2, _local1);
}
}
}//package com.midasplayer.avatar
Section 3
//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 4
//IAssertHandler (com.midasplayer.debug.IAssertHandler)
package com.midasplayer.debug {
public interface IAssertHandler {
function assert(_arg1:String):void;
}
}//package com.midasplayer.debug
Section 5
//DebugGameComm (com.midasplayer.gamecomm.DebugGameComm)
package com.midasplayer.gamecomm {
import com.midasplayer.debug.*;
public class DebugGameComm implements IGameComm {
private var _state:int;// = 0
private var _gameData:String;
private var _playDatas:Array;
private static const _Started:int = 1;
private static const _Ended:int = 2;
private static const _Quited:int = 3;
private static const _NotStarted:int = 0;
public function DebugGameComm(_arg1:String){
_playDatas = new Array();
super();
_gameData = _arg1;
}
public function gameQuit():void{
Debug.assert((_state == _Ended), "Trying to quit the game before it has been ended.");
}
public function toString(){
var _local1 = "";
var _local2:* = 0;
while (_local2 < _playDatas.length) {
_local1 = (_local1 + (("<entry><![CDATA[" + _playDatas[_local2]) + "]]></entry>\n"));
_local2++;
};
return (_local1);
}
public function gameStart():void{
Debug.assert((_state == _NotStarted), "Trying to start the game when it's already started.");
_state = _Started;
}
public function get playDatas():Array{
return (_playDatas);
}
public function gameEnd(_arg1:uint):void{
Debug.assert((_state == _Started), "Trying to end a game that is not in the started state.");
_state = _Ended;
}
public function getGameData():String{
return (_gameData);
}
public function addPlayData(_arg1:String):void{
Debug.assert(!((_state == _NotStarted)), "Trying to add playdata before the game has been started.");
trace((("<entry><![CDATA[" + _arg1) + "]]></entry>"));
_playDatas.push(_arg1);
}
}
}//package com.midasplayer.gamecomm
Section 6
//GameComm (com.midasplayer.gamecomm.GameComm)
package com.midasplayer.gamecomm {
import com.midasplayer.debug.*;
import flash.utils.*;
import flash.external.*;
import flash.system.*;
public class GameComm implements IGameComm {
private var _state:int;// = 0
private static const _Quitted:int = 3;
private static const _Started:int = 1;
private static const _Ended:int = 2;
private static const _NotStarted:int = 0;
public function gameQuit():void{
Debug.assert((_state == _Ended), "Quitting the game before it has been ended.");
setTimeout(_quit, 2000);
_state = _Quitted;
}
private function _quit():void{
fscommand("gameQuit", "");
}
public function gameStart():void{
Debug.assert((_state == _NotStarted), "Trying to start the game when it's already started.");
fscommand("gameStart", "");
_state = _Started;
}
public function gameEnd(_arg1:uint):void{
Debug.assert((_state == _Started), "Trying to end a game that is not in the started state.");
fscommand("gameEnd", ("" + _arg1));
_state = _Ended;
}
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 addPlayData(_arg1:String):void{
Debug.assert(!((_state == _NotStarted)), "Trying to add playdata before the game has been started.");
ExternalInterface.call("playData", _arg1);
}
public static function isAvailable():Boolean{
if (ExternalInterface.available){
return (!((ExternalInterface.call("getGameData") == null)));
};
return (false);
}
}
}//package com.midasplayer.gamecomm
Section 7
//GameData (com.midasplayer.gamecomm.GameData)
package com.midasplayer.gamecomm {
import com.midasplayer.debug.*;
public class GameData {
private var _textElements:XMLList;
private var _seed:int;// = 0
private var _gameData:XML;
public function GameData(_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, ... _args):String{
var texts:XMLList;
var os:String;
var i:int;
var r:RegExp;
var id = _arg1;
var args = _args;
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."));
os = texts.text();
if (args.length > 0){
i = 0;
while (i < args.length) {
r = new RegExp((("\\{" + i) + "\\}"), "gi");
os = os.replace(r, args[i]);
i = (i + 1);
};
};
return (os);
}
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 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 getTexts():Object{
var _local1:Object = new Object();
var _local2:* = 0;
while (_local2 < _textElements.length()) {
_local1[_textElements[_local2].@id] = _textElements[_local2];
_local2++;
};
return (_local1);
}
public function get randomSeed():int{
return (_seed);
}
public function getElementTextAsString(_arg1:String):String{
return (_getOneElement(_arg1).text());
}
}
}//package com.midasplayer.gamecomm
Section 8
//IGameComm (com.midasplayer.gamecomm.IGameComm)
package com.midasplayer.gamecomm {
public interface IGameComm {
function gameStart():void;
function gameQuit():void;
function getGameData():String;
function gameEnd(_arg1:uint):void;
function addPlayData(_arg1:String):void;
}
}//package com.midasplayer.gamecomm
Section 9
//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 10
//ActionCardAnim (king.game.uno.anim.ActionCardAnim)
package king.game.uno.anim {
import flash.display.*;
import king.util.*;
public class ActionCardAnim extends Anim {
private var parentClip_:MovieClip;
private var ox;
private var nx:Number;
private var ny:Number;
private var clip_:MovieClip;
private var numTicks_:int;
private var oy;
public function ActionCardAnim(_arg1:MovieClip, _arg2:MovieClip, _arg3:int){
clip_ = _arg1;
parentClip_ = _arg2;
numTicks_ = _arg3;
ox = (nx = (_arg1.x = 800));
oy = (ny = (_arg1.y = 224));
parentClip_.addChild(_arg1);
}
override public function end():void{
parentClip_.removeChild(clip_);
}
override public function tick(_arg1:Number):Boolean{
var _local2:Number = AnimPlayer.tickToPercent(_arg1, 0, numTicks_);
var _local3:* = AnimPlayer.tickToPercent(_local2, 0, 0.3);
var _local4:* = AnimPlayer.tickToPercent(_local2, 0.3, 0.4);
var _local5:* = AnimPlayer.tickToPercent(_local2, 0.7, 0.3);
ox = nx;
if (_local3 < 1){
nx = (240 + ((800 - 240) * AnimPlayer.easeInBack((1 - _local3), 0, 1, 1, 1.1)));
} else {
if (_local4 < 1){
nx = 240;
} else {
nx = (240 - ((200 + 1000) * AnimPlayer.easeOutQuad(_local5, 0, 1, 1)));
};
};
return ((_arg1 == numTicks_));
}
override public function render(_arg1:Number):void{
clip_.x = (ox + ((nx - ox) * _arg1));
}
}
}//package king.game.uno.anim
Section 11
//DealAnim (king.game.uno.anim.DealAnim)
package king.game.uno.anim {
import king.game.uno.view.*;
import king.game.uno.*;
import king.util.*;
public class DealAnim extends Anim {
private var dealerView_:DealerView;
private var rule_:Rule;
private var gameView_:GameView;
private var cardNum_:int;
private var card_:CardView;
private var numCards_:int;
private var delay_:int;
public function DealAnim(_arg1:CardView, _arg2:int, _arg3:Rule, _arg4:DealerView, _arg5:GameView, _arg6:int=0, _arg7:int=1){
card_ = _arg1;
delay_ = _arg2;
rule_ = _arg3;
dealerView_ = _arg4;
gameView_ = _arg5;
cardNum_ = _arg6;
numCards_ = _arg7;
var _local8:Number = -700;
var _local9:Number = 50;
var _local10:Number = -100;
var _local11:Number = -90;
var _local12:Number = 10;
var _local13:Number = 360;
card_.ox = (card_.nx = _local8);
card_.ny = (card_.ny = _local9);
card_.nz = (card_.nz = _local10);
card_.oTilt = (card_.nTilt = _local11);
card_.oPan = (card_.nPan = _local12);
card_.oRoll = (card_.nRoll = _local13);
card_.dealTime = 0;
card_.throwTime = 0;
card_.showTime = 0;
card_.setIsThrowing(false);
card_.resetCoords();
_arg1.mouseOver = false;
_arg1.mouseOverTime = 0;
_arg1.throwTime = 0;
_arg1.forcedDepth = -(card_.getCard().getId());
_arg1.enableForcedDepth = true;
}
override public function render(_arg1:Number):void{
}
override public function end():void{
if (rule_ != null){
rule_.reply();
};
dealerView_.dealAnimDone();
}
override public function tick(_arg1:Number):Boolean{
if (_arg1 < delay_){
return (false);
};
if (_arg1 == delay_){
if (cardNum_ == 0){
gameView_.dealingCards(card_, numCards_);
};
};
if (card_.dealTime < 1){
card_.dealTime = (card_.dealTime + 0.025);
};
if (card_.dealTime >= 1){
return (true);
};
return (false);
}
}
}//package king.game.uno.anim
Section 12
//DealerAnim (king.game.uno.anim.DealerAnim)
package king.game.uno.anim {
import king.game.uno.view.*;
import king.game.uno.*;
import king.util.*;
public class DealerAnim extends Anim {
private var dealerView_:DealerView;
private var showLeftInPileTicks_:int;// = -1
private var gameView_:GameView;
private var dealAnims_:Array;
private var animPlayer_:AnimPlayer;
private var deck_:Deck;// = null
private var dealDelay:int;// = 0
public function DealerAnim(_arg1:GameView, _arg2:DealerView){
gameView_ = _arg1;
dealerView_ = _arg2;
animPlayer_ = gameView_.getAnimPlayer();
dealAnims_ = new Array();
}
public function takeCardsFromTable(_arg1:Rule){
gameView_.clearStackBimap(_arg1.getNum());
animPlayer_.addAnim(new TakeCardsFromTableAnim(gameView_, _arg1));
}
public function setDeck(_arg1:Deck){
deck_ = _arg1;
}
public function showLeftInPile(){
showLeftInPileTicks_ = 10;
}
public function takeCards(_arg1:Player, _arg2:Array, _arg3:Rule){
var _local5:Card;
var _local6:int;
var _local7:CardView;
var _local8:Boolean;
var _local9:Anim;
var _local4:int;
while (_local4 < _arg2.length) {
_local5 = _arg2[_local4];
_local6 = _local5.getId();
_local7 = gameView_.getCardById(_local6);
_local7.enableEvents = false;
_local8 = (_local4 == (_arg2.length - 1));
if (_arg1 != null){
_local9 = new TakeAnim(_local7, dealDelay, (_local8) ? _arg3 : null, dealerView_);
} else {
_local9 = new DealToTableAnim(gameView_, _local7, (_local8) ? _arg3 : null, dealerView_);
};
animPlayer_.addAnim(_local9);
dealAnims_.push(_local9);
dealDelay = (dealDelay + 2);
_local4++;
};
if ((((_arg2.length == 0)) && (!((_arg3 == null))))){
_arg3.reply();
};
dealDelay = (dealDelay + 5);
}
override public function tick(_arg1:Number):Boolean{
if (dealDelay > 0){
dealDelay--;
};
if (showLeftInPileTicks_ > 0){
showLeftInPileTicks_--;
};
if (showLeftInPileTicks_ == 0){
dealerView_.showLeftInPile(true);
showLeftInPileTicks_ = -1;
};
return (false);
}
public function dealCards(_arg1:Player, _arg2:Array, _arg3:Rule){
var _local5:Card;
var _local6:int;
var _local7:CardView;
var _local8:Boolean;
var _local9:Anim;
var _local4:int;
while (_local4 < _arg2.length) {
_local5 = _arg2[_local4];
_local6 = _local5.getId();
_local7 = gameView_.getCardById(_local6);
_local8 = (_local4 == (_arg2.length - 1));
if (_arg1 != null){
_local9 = new DealAnim(_local7, dealDelay, (_local8) ? _arg3 : null, dealerView_, gameView_, _local4, _arg2.length);
} else {
_local9 = new DealToTableAnim(gameView_, _local7, (_local8) ? _arg3 : null, dealerView_);
};
animPlayer_.addAnim(_local9);
dealAnims_.push(_local9);
dealDelay = (dealDelay + 5);
_local4++;
};
dealDelay = (dealDelay + 10);
}
}
}//package king.game.uno.anim
Section 13
//DealToTableAnim (king.game.uno.anim.DealToTableAnim)
package king.game.uno.anim {
import king.game.uno.view.*;
import king.game.uno.*;
import king.util.*;
import king.math.*;
public class DealToTableAnim extends Anim {
private var dealerView_:DealerView;
private var newDepth_:int;
private var gameView_:GameView;
private var animDuration_:Number;
private var card_:CardView;
private var roll1:Number;
private var tilt2;
private var y1;
private var y2;
private var tilt1;
private var roll2:Number;
private var rule_:Rule;
private var dy:Number;
private var hasChangedDepth:Boolean;// = false
private var pan2;
private var z1;
private var z2;
private var x1;
private var x2;
private var pan1;
private var random_:MtRandom;
public function DealToTableAnim(_arg1:GameView, _arg2:CardView, _arg3:Rule, _arg4:DealerView){
gameView_ = _arg1;
card_ = _arg2;
rule_ = _arg3;
dealerView_ = _arg4;
_arg2.visible = true;
card_.showTime = 0;
card_.setIsThrowing(true);
random_ = new MtRandom(gameView_.getGame().getSeed());
var _local5:Number = -700;
var _local6:Number = 50;
var _local7:Number = -100;
var _local8:Number = -90;
var _local9:Number = 10;
var _local10:Number = 360;
_arg2.ox = (_arg2.nx = _local5);
_arg2.oy = (_arg2.ny = _local6);
_arg2.oz = (_arg2.nz = _local7);
_arg2.oTilt = (_arg2.nTilt = _local8);
_arg2.oPan = (_arg2.nPan = _local9);
_arg2.oRoll = (_arg2.nRoll = _local10);
x1 = _local5;
y1 = _local6;
z1 = _local7;
tilt1 = _local8;
pan1 = _local9;
roll1 = _local10;
x2 = ((0 + (random_.nextDouble() * 20)) - 10);
y2 = (0 + (gameView_.getGame().getDiscardPile().size() * 0.1));
z2 = ((20 + (random_.nextDouble() * 20)) - 5);
tilt2 = -90;
pan2 = 180;
roll2 = (((random_.nextDouble() * 60) - 30) - 180);
dy = 20;
animDuration_ = (40 + random_.nextInt(10));
newDepth_ = (10000 - gameView_.getGame().getDiscardPile().size());
}
override public function tick(_arg1:Number):Boolean{
var _local2:Number = AnimPlayer.tickToPercent(_arg1, 0, animDuration_);
var _local3:Number = AnimPlayer.tickToPercent(_arg1, (animDuration_ - 12), 12);
var _local4:Number = AnimPlayer.easeOutQuad(_local2, 0, 1, 1);
var _local5:Number = ((_local4 - 0.5) * 2);
_local5 = (1 - (_local5 * _local5));
card_.throwTime = _local2;
card_.resetCoords();
card_.nx = (x1 + (_local4 * (x2 - x1)));
card_.ny = ((y1 + (_local4 * (y2 - y1))) + (dy * _local5));
card_.nz = (z1 + (_local4 * (z2 - z1)));
card_.nTilt = (tilt1 + (_local4 * (tilt2 - tilt1)));
card_.nPan = (pan1 + (_local3 * (pan2 - pan1)));
card_.nRoll = (roll1 + (_local4 * (roll2 - roll1)));
if (_local2 > 0.6){
hasChangedDepth = true;
card_.forcedDepth = newDepth_;
card_.enableForcedDepth = true;
card_.changed = true;
};
return ((_arg1 == (animDuration_ + 1)));
}
override public function end():void{
gameView_.cardPlayed(null, card_);
dealerView_.dealAnimDone();
if (rule_ != null){
rule_.reply();
};
}
override public function render(_arg1:Number):void{
}
}
}//package king.game.uno.anim
Section 14
//DelayAnim (king.game.uno.anim.DelayAnim)
package king.game.uno.anim {
import king.util.*;
public class DelayAnim extends Anim {
private var callBackFunction_:Function;
private var numTicks_:int;
public function DelayAnim(_arg1:int, _arg2:Function){
numTicks_ = _arg1;
callBackFunction_ = _arg2;
}
override public function end():void{
callBackFunction_.apply();
}
override public function tick(_arg1:Number):Boolean{
return ((_arg1 == numTicks_));
}
}
}//package king.game.uno.anim
Section 15
//HandAnim (king.game.uno.anim.HandAnim)
package king.game.uno.anim {
import king.game.uno.view.*;
import king.game.uno.*;
import king.util.*;
public class HandAnim extends Anim {
protected var numCards_:int;
protected var gameView_:GameView;
public var changeDepth:Boolean;// = false
public var sortByIndex:Boolean;// = false
protected var player_:Player;
public function HandAnim(_arg1:GameView, _arg2:Player){
gameView_ = _arg1;
player_ = _arg2;
numCards_ = 0;
}
public function getRoll(_arg1:CardView, _arg2:Number):Number{
return ((30 - (60 * _arg2)));
}
public function getY(_arg1:CardView, _arg2:Number):Number{
var _local3:Number = (_arg2 - 0.5);
return ((-100 - ((_local3 * _local3) * 400)));
}
public function getPan(_arg1:CardView, _arg2:Number):Number{
return (0);
}
public function getX(_arg1:CardView, _arg2:Number):Number{
return ((-190 + (380 * _arg2)));
}
public function playCard(_arg1:int):void{
}
override public function tick(_arg1:Number):Boolean{
var _local13:Number;
var _local14:Number;
var _local15:*;
var _local16:*;
var _local17:*;
var _local18:*;
var _local19:*;
var _local20:*;
var _local21:*;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:*;
var _local29:*;
var _local30:*;
var _local31:*;
var _local2:Hand = player_.getHand();
var _local3:CardView;
var _local4:CardView;
var _local5:Array = _local2.getCards();
var _local6:int = _local2.size();
var _local7:Number = 0;
var _local8:Number = 0;
var _local9:Number = 1;
var _local10:Number = 0;
var _local11:int;
_local11 = 0;
while (_local11 < _local6) {
_local3 = gameView_.getCardById(_local5[_local11].getId());
if (((_local3.mouseOver) && ((_local3.mouseOverTime < 10)))){
_local3.mouseOverTime = (_local3.mouseOverTime + 2);
if (_local3.mouseOverTime > 10){
_local3.mouseOverTime = 10;
};
} else {
if (((!(_local3.mouseOver)) && ((_local3.mouseOverTime > 0)))){
_local3.mouseOverTime = (_local3.mouseOverTime - 0.8);
if (_local3.mouseOverTime < 0){
_local3.mouseOverTime = 0;
};
};
};
_local11++;
};
var _local12:Number = 0;
_local11 = 0;
while (_local11 < _local6) {
_local3 = gameView_.getCardById(_local5[_local11].getId());
_local10 = (_local12 * _local3.getPercentInHand());
_local8 = (_local8 + _local10);
_local12 = (_local12 - _local10);
_local12 = (_local12 + _local3.getWantedSpace());
_local11++;
};
_local9 = 1;
if (_local8 > 1){
_local9 = (1 / _local8);
};
numCards_ = 0;
_local4 = null;
_local8 = 0;
_local12 = 0;
_local11 = (_local6 - 1);
while (_local11 >= 0) {
_local3 = gameView_.getCardById(_local5[_local11].getId());
_local10 = (_local12 * _local3.getPercentInHand());
_local8 = (_local8 + _local10);
_local12 = (_local12 - _local10);
_local13 = (_local3.getWantedSpace() * _local9);
_local3.dt = _local10;
_local14 = _local3.mouseOverTime;
_local14 = (((0.15 - _local13) * _local14) / 10);
_local13 = (_local13 + _local14);
_local12 = (_local12 + _local13);
_local11--;
};
_local9 = 1;
if (_local8 > 1){
_local9 = (1 / _local8);
};
_local7 = (0.5 - ((_local8 * _local9) * 0.5));
_local11 = 0;
while (_local11 < _local6) {
_local3 = gameView_.getCardById(_local5[_local11].getId());
_local15 = getX(_local3, _local7);
_local16 = getY(_local3, _local7);
_local17 = getZ(_local3, _local7);
_local18 = getTilt(_local3, _local7);
_local19 = getPan(_local3, _local7);
_local20 = getRoll(_local3, _local7);
if (_local3.dealTime <= 1){
_local3.resetCoords();
_local21 = _local3.dealTime;
_local22 = -700;
_local23 = 50;
_local24 = -100;
_local25 = -90;
_local26 = 10;
_local27 = 360;
_local28 = AnimPlayer.easeInOutQuad(_local3.dealTime, 0, 1, 1);
_local3.nx = (_local22 + (_local28 * (_local15 - _local22)));
_local3.ny = (_local23 + (_local28 * (_local16 - _local23)));
_local3.nz = (_local24 + (_local28 * (_local17 - _local24)));
_local3.nTilt = (_local25 + (_local21 * (_local18 - _local25)));
_local3.nPan = (_local26 + (_local21 * (_local19 - _local26)));
_local3.nRoll = (_local27 + ((1 - ((1 - _local21) * (1 - _local21))) * (_local20 - _local27)));
};
if ((((_local3.dealTime >= 1)) && ((_local3.throwTime < 1)))){
numCards_++;
};
if (_local3.isInHand()){
_local3.resetCoords();
_local29 = _local15;
_local30 = (_local16 + 600);
_local31 = Math.sqrt(((_local29 * _local29) + (_local30 * _local30)));
_local16 = (_local16 + (((_local30 / _local31) * 30) * (_local3.mouseOverTime / 10)));
_local15 = (_local15 + (((_local29 / _local31) * 10) * (_local3.mouseOverTime / 10)));
_local3.nx = _local15;
_local3.ny = _local16;
_local3.nz = _local17;
_local3.nTilt = _local18;
_local3.nPan = _local19;
_local3.nRoll = _local20;
};
if (((sortByIndex) && ((_local3.throwTime == 0)))){
_local3.enableForcedDepth = true;
_local3.forcedDepth = _local11;
_local3.changed = true;
};
if (((changeDepth) && ((_local3.throwTime == 0)))){
_local3.enableForcedDepth = true;
_local3.forcedDepth = _local3.z;
_local3.changed = true;
};
_local7 = (_local7 + (_local3.dt * _local9));
_local11++;
};
return (false);
}
public function getZ(_arg1:CardView, _arg2:Number):Number{
return (-80);
}
public function getTilt(_arg1:CardView, _arg2:Number):Number{
return (50);
}
}
}//package king.game.uno.anim
Section 16
//HandAnimBotLeft (king.game.uno.anim.HandAnimBotLeft)
package king.game.uno.anim {
import king.game.uno.view.*;
import king.game.uno.*;
import king.math.*;
public class HandAnimBotLeft extends HandAnim {
private var mouseOverCards:Array;
private var mouseOverTimes:Array;
private var mouseOverClick:Array;
private var random_:MtRandom;
public function HandAnimBotLeft(_arg1:GameView, _arg2:Player){
super(_arg1, _arg2);
sortByIndex = true;
mouseOverCards = new Array();
mouseOverTimes = new Array();
mouseOverClick = new Array();
random_ = new MtRandom((gameView_.getGame().getSeed() + player_.getId()));
}
override public function getX(_arg1:CardView, _arg2:Number):Number{
var _local3:* = (-332 + (155 * _arg2));
var _local4:* = (-350 + (200 * _arg2));
var _local5:* = (_local3 + ((_local4 - _local3) * _arg1.showTime));
return (_local5);
}
override public function getY(_arg1:CardView, _arg2:Number):Number{
var _local3:* = ((-210 - 7) - ((_arg2 - 0.1) * 65));
var _local4:* = -30;
var _local5:* = (_local3 + ((_local4 - _local3) * _arg1.showTime));
return (_local5);
}
override public function getZ(_arg1:CardView, _arg2:Number):Number{
var _local3:Number = ((_arg2 - 0.5) * 2);
var _local4:* = ((500 + (50 * (_local3 * _local3))) + ((_arg2 - 0.3) * 150));
var _local5:* = 400;
var _local6:* = (_local4 + ((_local5 - _local4) * _arg1.showTime));
return (_local6);
}
override public function playCard(_arg1:int):void{
var _local2:Hand = player_.getHand();
var _local3:CardView;
var _local4:Array = _local2.getCards();
var _local5:int = _local2.size();
var _local6:int;
var _local7:* = Math.min(random_.nextInt(4), _local5);
_local6 = 0;
while (_local6 < _local7) {
mouseOverCards.push(gameView_.getCardById(_local4[random_.nextInt(_local5)].getId()));
mouseOverTimes.push((random_.nextInt(7) + 1));
mouseOverClick.push(0);
_local6++;
};
mouseOverCards.push(gameView_.getCardById(_arg1));
mouseOverTimes.push((random_.nextInt(7) + 1));
mouseOverClick.push(1);
}
override public function getPan(_arg1:CardView, _arg2:Number):Number{
var _local3:* = (180 - (110 * (_arg2 - 0.25)));
var _local4:* = 0;
var _local5:* = (_local3 + ((_local4 - _local3) * _arg1.showTime));
return (_local5);
}
override public function getTilt(_arg1:CardView, _arg2:Number):Number{
var _local3:* = (-11 - (5 * (_arg2 - 0.25)));
var _local4:* = 50;
var _local5:* = (_local3 + ((_local4 - _local3) * _arg1.showTime));
return (_local5);
}
override public function getRoll(_arg1:CardView, _arg2:Number):Number{
var _local3:* = (5 + (10 * (_arg2 - 0.3)));
var _local4:* = 0;
var _local5:* = (_local3 + ((_local4 - _local3) * _arg1.showTime));
return (_local5);
}
override public function render(_arg1:Number):void{
super.render(_arg1);
var _local2:* = numCards_;
if (_local2 == 0){
_local2 = "";
};
if (gameView_.getPlayClip().station_left.numcards.text != _local2){
gameView_.getPlayClip().station_left.numcards.text = _local2;
};
}
override public function tick(_arg1:Number):Boolean{
var _local6:Number;
var _local7:Boolean;
var _local2:Hand = player_.getHand();
var _local3:CardView;
var _local4:Array = _local2.getCards();
var _local5:int = _local2.size();
var _local8:int;
if (mouseOverCards.length > 0){
_local3 = mouseOverCards[0];
_local6 = mouseOverTimes[0];
_local7 = (mouseOverClick[0] == 1);
if (_local6 == 0){
_local3.mouseOver = false;
if (_local7){
gameView_.cardClicked(_local3);
};
mouseOverCards.shift();
mouseOverTimes.shift();
mouseOverClick.shift();
} else {
_local6--;
_local3.mouseOver = true;
mouseOverTimes[0] = _local6;
};
};
return (super.tick(_arg1));
}
}
}//package king.game.uno.anim
Section 17
//HandAnimBotRight (king.game.uno.anim.HandAnimBotRight)
package king.game.uno.anim {
import king.game.uno.view.*;
import king.game.uno.*;
import king.math.*;
public class HandAnimBotRight extends HandAnim {
private var mouseOverCards:Array;
private var mouseOverTimes:Array;
private var mouseOverClick:Array;
private var random_:MtRandom;
public function HandAnimBotRight(_arg1:GameView, _arg2:Player){
super(_arg1, _arg2);
sortByIndex = true;
mouseOverCards = new Array();
mouseOverTimes = new Array();
mouseOverClick = new Array();
random_ = new MtRandom((gameView_.getGame().getSeed() + player_.getId()));
}
override public function getX(_arg1:CardView, _arg2:Number):Number{
var _local3:* = (347 - (155 * _arg2));
var _local4:* = (350 - (200 * _arg2));
var _local5:* = (_local3 + ((_local4 - _local3) * _arg1.showTime));
return (_local5);
}
override public function getY(_arg1:CardView, _arg2:Number):Number{
var _local3:* = ((-210 - 10) - ((_arg2 - 0.1) * 69));
var _local4:* = -30;
var _local5:* = (_local3 + ((_local4 - _local3) * _arg1.showTime));
return (_local5);
}
override public function getZ(_arg1:CardView, _arg2:Number):Number{
var _local3:Number = ((_arg2 - 0.5) * 2);
var _local4:* = ((500 + (50 * (_local3 * _local3))) + ((_arg2 - 0.3) * 150));
var _local5:* = 400;
var _local6:* = (_local4 + ((_local5 - _local4) * _arg1.showTime));
return (_local6);
}
override public function playCard(_arg1:int):void{
var _local2:Hand = player_.getHand();
var _local3:CardView;
var _local4:Array = _local2.getCards();
var _local5:int = _local2.size();
var _local6:int;
var _local7:* = Math.min(random_.nextInt(4), _local5);
_local6 = 0;
while (_local6 < _local7) {
mouseOverCards.push(gameView_.getCardById(_local4[random_.nextInt(_local5)].getId()));
mouseOverTimes.push((random_.nextInt(7) + 1));
mouseOverClick.push(0);
_local6++;
};
mouseOverCards.push(gameView_.getCardById(_arg1));
mouseOverTimes.push((random_.nextInt(7) + 1));
mouseOverClick.push(1);
}
override public function getPan(_arg1:CardView, _arg2:Number):Number{
var _local3:* = (180 + (110 * (_arg2 - 0.25)));
var _local4:* = 0;
var _local5:* = (_local3 + ((_local4 - _local3) * _arg1.showTime));
return (_local5);
}
override public function getTilt(_arg1:CardView, _arg2:Number):Number{
var _local3:* = (-11 - (5 * (_arg2 - 0.25)));
var _local4:* = 50;
var _local5:* = (_local3 + ((_local4 - _local3) * _arg1.showTime));
return (_local5);
}
override public function getRoll(_arg1:CardView, _arg2:Number):Number{
var _local3:* = (-5 - (10 * (_arg2 - 0.3)));
var _local4:* = 0;
var _local5:* = (_local3 + ((_local4 - _local3) * _arg1.showTime));
return (_local5);
}
override public function render(_arg1:Number):void{
super.render(_arg1);
var _local2:* = numCards_;
if (_local2 == 0){
_local2 = "";
};
if (gameView_.getPlayClip().station_right.numcards.text != _local2){
gameView_.getPlayClip().station_right.numcards.text = _local2;
};
}
override public function tick(_arg1:Number):Boolean{
var _local3:Number;
var _local4:Boolean;
var _local2:CardView;
if (mouseOverCards.length > 0){
_local2 = mouseOverCards[0];
_local3 = mouseOverTimes[0];
_local4 = (mouseOverClick[0] == 1);
if (_local3 == 0){
_local2.mouseOver = false;
if (_local4){
gameView_.cardClicked(_local2);
};
mouseOverCards.shift();
mouseOverTimes.shift();
mouseOverClick.shift();
} else {
_local3--;
_local2.mouseOver = true;
mouseOverTimes[0] = _local3;
};
};
return (super.tick(_arg1));
}
}
}//package king.game.uno.anim
Section 18
//HandAnimLocal (king.game.uno.anim.HandAnimLocal)
package king.game.uno.anim {
import king.game.uno.view.*;
import king.game.uno.*;
public class HandAnimLocal extends HandAnim {
public function HandAnimLocal(_arg1:GameView, _arg2:Player){
super(_arg1, _arg2);
}
override public function playCard(_arg1:int):void{
gameView_.cardClicked(gameView_.getCardById(_arg1));
}
override public function render(_arg1:Number):void{
super.render(_arg1);
var _local2:* = numCards_;
if (_local2 == 0){
_local2 = "";
};
if (gameView_.getPlayClip().numcards.text != _local2){
gameView_.getPlayClip().numcards.text = _local2;
};
}
}
}//package king.game.uno.anim
Section 19
//HandToTableAnim (king.game.uno.anim.HandToTableAnim)
package king.game.uno.anim {
import king.game.uno.view.*;
import king.game.uno.*;
import king.util.*;
import king.math.*;
public class HandToTableAnim extends Anim {
private var x1;
private var animDuration_:Number;
private var random_:MtRandom;
private var gameView_:GameView;
private var newDepth_:int;
private var card_:CardView;
private var roll1:Number;
private var tilt2;
private var y1;
private var y2;
private var tilt1;
private var roll2:Number;
private var dy:Number;
private var player_:Player;
private var hasChangedDepth:Boolean;// = false
private var pan2;
private var z2;
private var x2;
private var pan1;
private var z1;
public function HandToTableAnim(_arg1:GameView, _arg2:Player, _arg3:CardView){
gameView_ = _arg1;
player_ = _arg2;
card_ = _arg3;
card_.setIsThrowing(true);
random_ = new MtRandom((gameView_.getGame().getSeed() + _arg3.getId()));
x1 = card_.nx;
y1 = card_.ny;
z1 = card_.nz;
tilt1 = _arg3.nTilt;
pan1 = _arg3.nPan;
roll1 = _arg3.nRoll;
x2 = ((0 + (random_.nextDouble() * 20)) - 10);
y2 = (0 + (gameView_.getGame().getDiscardPile().size() * 0.1));
z2 = ((20 + (random_.nextDouble() * 20)) - 5);
if (_arg2.isLocalPlayer()){
x2 = ((0 + (random_.nextDouble() * 50)) - 25);
tilt2 = 90;
pan2 = 0;
roll2 = ((random_.nextDouble() * 60) - 30);
dy = (130 + random_.nextInt(40));
animDuration_ = (16 + random_.nextInt(2));
} else {
tilt2 = -90;
pan2 = 180;
dy = (180 + random_.nextInt(30));
animDuration_ = (18 + random_.nextInt(2));
if (_arg2.getName() == "bot1"){
roll2 = ((90 - 10) - (random_.nextDouble() * 80));
} else {
roll2 = ((-90 + 10) + (random_.nextDouble() * 80));
};
};
newDepth_ = (10000 - gameView_.getGame().getDiscardPile().size());
}
override public function render(_arg1:Number):void{
}
override public function tick(_arg1:Number):Boolean{
var _local2:Number = AnimPlayer.tickToPercent(_arg1, 0, animDuration_);
var _local3:Number = AnimPlayer.easeInOutQuart(_local2, 0, 1, 1);
var _local4:Number = AnimPlayer.easeInQuad(_local2, 0, 1, 1);
var _local5:Number = AnimPlayer.easeInQuart(_local2, 0, 1, 1);
var _local6:Number = AnimPlayer.easeInOutQuint(_local2, 0, 1, 1);
var _local7:Number = ((_local4 - 0.5) * 2);
_local7 = (1 - (_local7 * _local7));
card_.throwTime = _local2;
card_.resetCoords();
card_.nx = (x1 + (_local6 * (x2 - x1)));
card_.ny = ((y1 + (_local3 * (y2 - y1))) + (dy * _local7));
card_.nz = (z1 + (_local3 * (z2 - z1)));
card_.nTilt = (tilt1 + (_local3 * (tilt2 - tilt1)));
card_.nPan = (pan1 + (_local3 * (pan2 - pan1)));
card_.nRoll = (roll1 + (_local5 * (roll2 - roll1)));
if (_local2 > 0.6){
hasChangedDepth = true;
card_.forcedDepth = newDepth_;
card_.enableForcedDepth = true;
card_.changed = true;
};
return ((_arg1 == animDuration_));
}
override public function end():void{
gameView_.cardPlayed(player_, card_);
}
}
}//package king.game.uno.anim
Section 20
//NextPlayerAnim (king.game.uno.anim.NextPlayerAnim)
package king.game.uno.anim {
import king.game.uno.view.*;
import king.game.uno.*;
import flash.display.*;
import king.util.*;
public class NextPlayerAnim extends Anim {
private var numClips_:int;
private var ndy_:Array;
private var gameView_:GameView;
private var oldY_:Array;
private var animTicks_:Number;
private var ody_:Array;
private var clips_:Array;
private var player_:Player;
private var rule_:Rule;
private var maxDy_:Array;
private var t_:Array;
private var animDelay_:Number;
private var playerView_:PlayerView;
public function NextPlayerAnim(_arg1:GameView, _arg2:Rule, _arg3:PlayerView){
var _local8:*;
var _local9:*;
var _local10:int;
super();
player_ = _arg2.getPlayer();
gameView_ = _arg1;
rule_ = _arg2;
playerView_ = _arg3;
var _local4:* = player_.getId();
var _local5:* = _arg2.getNum();
var _local6:* = 0;
if ((_local5 + _local4) == 1){
_local6 = 1;
} else {
if ((_local5 + _local4) == 3){
_local6 = 2;
} else {
if ((_local5 + _local4) == 2){
_local6 = 3;
};
};
};
var _local7:* = (_local4 - _local5);
if (_local7 == -2){
_local7 = 1;
};
if (_local7 == 2){
_local7 = -1;
};
_local8 = gameView_.getPlayClip().getChildByName(("stones" + _local6));
clips_ = new Array();
oldY_ = new Array();
maxDy_ = new Array();
ody_ = new Array();
ndy_ = new Array();
t_ = new Array();
if (_local7 > 0){
_local10 = 0;
while (_local10 < 11) {
_local9 = _local8.getChildByName(("stone" + (_local10 + 1)));
if (_local9 != null){
clips_.push(_local9);
oldY_.push(_local9.y);
maxDy_.push(((0.5 * 2) + 5));
ody_.push(0);
ndy_.push(0);
t_.push(0);
};
_local10++;
};
} else {
if (_local7 < 0){
_local10 = 10;
while (_local10 >= 0) {
_local9 = _local8.getChildByName(("stone" + (_local10 + 1)));
if (_local9 != null){
clips_.push(_local9);
oldY_.push(_local9.y);
maxDy_.push(((0.5 * 2) + 5));
ody_.push(0);
ndy_.push(0);
t_.push(0);
};
_local10--;
};
};
};
numClips_ = clips_.length;
animTicks_ = (8 - (numClips_ * 0.08));
animDelay_ = (2.2 - (numClips_ * 0.03));
}
override public function tick(_arg1:Number):Boolean{
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local2:* = true;
var _local3:* = 0;
while (_local3 < numClips_) {
_local4 = maxDy_[_local3];
_local5 = AnimPlayer.tickToPercent(_arg1, (animDelay_ * _local3), animTicks_);
_local6 = AnimPlayer.tickToPercent(_local5, 0, 0.4);
_local7 = AnimPlayer.tickToPercent(_local5, 0.4, 0.6);
_local8 = (_local4 * (AnimPlayer.easeOutCubic(_local6, 0, 1, 1) - AnimPlayer.easeInOutQuad(_local7, 0, 1, 1)));
ody_[_local3] = ndy_[_local3];
ndy_[_local3] = _local8;
t_[_local3] = _local5;
if ((((((_local5 == 1)) && ((_local3 >= 2)))) && (!((rule_ == null))))){
rule_ = null;
playerView_.turnToActDone();
};
if (_local5 < 1){
_local2 = false;
};
_local3++;
};
return (_local2);
}
override public function end():void{
if (rule_ != null){
playerView_.turnToActDone();
};
}
override public function render(_arg1:Number):void{
var _local3:MovieClip;
var _local4:*;
var _local5:*;
var _local2:* = 0;
while (_local2 < numClips_) {
_local3 = clips_[_local2];
_local4 = t_[_local2];
_local5 = (ody_[_local2] + ((ndy_[_local2] - ody_[_local2]) * _arg1));
_local3.y = (oldY_[_local2] + _local5);
if ((((_local4 > 0)) && ((_local4 < 1)))){
_local3.gotoAndStop(2);
} else {
_local3.gotoAndStop(1);
};
_local2++;
};
}
}
}//package king.game.uno.anim
Section 21
//PlayFramesAnim (king.game.uno.anim.PlayFramesAnim)
package king.game.uno.anim {
import king.game.uno.*;
import flash.display.*;
import king.util.*;
public class PlayFramesAnim extends Anim {
private var stopped_:Boolean;// = false
private var rule_:Rule;// = null
private var doLog_:Boolean;// = false
private var clip_:MovieClip;
private var nt_:Number;
private var ot_:Number;
private var loop_:Boolean;
private var segments_:Segments;
public function PlayFramesAnim(_arg1:MovieClip, _arg2:Segments, _arg3:Boolean=false, _arg4=false){
clip_ = _arg1;
loop_ = _arg3;
segments_ = _arg2;
ot_ = (nt_ = 0);
doLog_ = _arg4;
}
public function stop():void{
stopped_ = true;
}
override public function end():void{
clip_.gotoAndStop(Math.floor(segments_.getPointAt(1)));
if (rule_ != null){
rule_.reply();
};
}
override public function render(_arg1:Number):void{
var _local2:* = (ot_ + ((nt_ - ot_) * _arg1));
var _local3:* = Math.floor(segments_.getPointAt(_local2));
clip_.gotoAndStop(_local3);
}
override public function tick(_arg1:Number):Boolean{
if (loop_){
_arg1 = (_arg1 % segments_.getMaxTime());
};
var _local2:Number = AnimPlayer.tickToPercent(_arg1, 0, segments_.getMaxTime());
ot_ = nt_;
nt_ = _local2;
if (loop_){
if (nt_ < ot_){
ot_ = nt_;
};
return (stopped_);
//unresolved jump
};
return (((stopped_) || ((_arg1 >= segments_.getMaxTime()))));
}
public function addRule(_arg1:Rule):void{
rule_ = _arg1;
}
}
}//package king.game.uno.anim
Section 22
//ScorePopAnim (king.game.uno.anim.ScorePopAnim)
package king.game.uno.anim {
import king.game.uno.view.*;
import flash.display.*;
import king.util.*;
public class ScorePopAnim extends Anim {
private var scorePop_:ScorePop;
private var parentClip_:MovieClip;
private var sy;
private var oy:Number;
private var ny;
public function ScorePopAnim(_arg1:MovieClip, _arg2:ScorePop, _arg3:Number, _arg4:Number){
parentClip_ = _arg1;
scorePop_ = _arg2;
sy = (oy = (ny = (scorePop_.y = _arg4)));
scorePop_.x = _arg3;
parentClip_.addChild(scorePop_);
}
override public function render(_arg1:Number):void{
scorePop_.y = (oy + ((ny - oy) * _arg1));
}
override public function end():void{
parentClip_.removeChild(scorePop_);
}
override public function tick(_arg1:Number):Boolean{
var _local2:Number = AnimPlayer.tickToPercent(_arg1, 0, 70);
var _local3:* = AnimPlayer.easeOutCubic(_local2, 0, 1, 1);
var _local4:* = AnimPlayer.tickToPercent(_arg1, 60, 10);
oy = ny;
ny = (sy - (56 * _local3));
if (_local4 > 0){
scorePop_.alpha = (1 - _local4);
};
return ((_local2 == 1));
}
}
}//package king.game.uno.anim
Section 23
//ShowBubbleAnim (king.game.uno.anim.ShowBubbleAnim)
package king.game.uno.anim {
import king.game.uno.view.*;
import flash.display.*;
import king.util.*;
public class ShowBubbleAnim extends Anim {
private var stopTick_:Number;// = -1
private var stopped_:Boolean;// = false
private var tick_:Number;// = 0
private var parentClip_:MovieClip;
private var nys;
private var oys;
private var oxs;
private var nxs;
private var bubble_:Bubble;
public function ShowBubbleAnim(_arg1:MovieClip, _arg2:Bubble, _arg3:int=-1){
parentClip_ = _arg1;
bubble_ = _arg2;
bubble_.scaleX = 0;
bubble_.scaleY = 0;
oxs = (oys = 0);
nxs = (nys = 0);
parentClip_.addChild(bubble_);
stopTick_ = _arg3;
}
public function isStopped():Boolean{
return (stopped_);
}
public function stop():void{
stopTick_ = tick_;
stopped_ = true;
}
override public function render(_arg1:Number):void{
bubble_.scaleX = (oxs + ((nxs - oxs) * _arg1));
bubble_.scaleY = (oys + ((nys - oys) * _arg1));
}
override public function end():void{
stopped_ = true;
parentClip_.removeChild(bubble_);
}
override public function tick(_arg1:Number):Boolean{
var _local4:*;
tick_ = _arg1;
var _local2:* = AnimPlayer.tickToPercent(_arg1, 0, 15);
_local2 = AnimPlayer.easeOutBack(_local2, 0, 1, 1);
if (stopTick_ != -1){
_local4 = AnimPlayer.tickToPercent(_arg1, stopTick_, 10);
if (_local4 > 0){
stopped_ = true;
_local2 = (1 - AnimPlayer.easeInCubic(_local4, 0, 1, 1));
};
};
oxs = nxs;
oys = nys;
nxs = _local2;
nys = _local2;
var _local3:Boolean;
if (stopTick_ != -1){
_local3 = (tick_ == (stopTick_ + 10));
};
return (_local3);
}
}
}//package king.game.uno.anim
Section 24
//ShowHandAnim (king.game.uno.anim.ShowHandAnim)
package king.game.uno.anim {
import king.game.uno.view.*;
import king.game.uno.*;
import king.util.*;
public class ShowHandAnim extends Anim {
var rule_:Rule;
var gameView_:GameView;
var player_:Player;
public function ShowHandAnim(_arg1:GameView, _arg2:Rule){
gameView_ = _arg1;
rule_ = _arg2;
player_ = rule_.getPlayer();
}
override public function end():void{
rule_.reply();
}
override public function tick(_arg1:Number):Boolean{
var _local5:CardView;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:ScorePop;
var _local2:* = AnimPlayer.tickToPercent(_arg1, 0, 20);
var _local3:Array = player_.getHand().getCards();
var _local4:* = 0;
while (_local4 < _local3.length) {
_local5 = gameView_.getCardById(_local3[_local4].getId());
_local5.showTime = _local2;
_local4++;
};
if (rule_.getNum() != 0){
_local6 = AnimPlayer.tickToPercent(_arg1, 20, 70);
if (_arg1 == 20){
_local7 = 375;
_local8 = 490;
if (player_.getName() == "bot1"){
_local7 = 125;
_local8 = 98;
} else {
if (player_.getName() == "bot2"){
_local7 = 625;
_local8 = 105;
};
};
_local9 = ScorePop(new handscore());
_local9.score.text = ("" + rule_.getNum());
gameView_.getAnimPlayer().addAnim(new ScorePopAnim(gameView_.getPlayClip().signs, _local9, _local7, _local8));
};
return ((_local6 == 1));
};
return ((_local2 == 1));
}
}
}//package king.game.uno.anim
Section 25
//ShowSignAnim (king.game.uno.anim.ShowSignAnim)
package king.game.uno.anim {
import king.game.uno.view.*;
import king.game.uno.*;
import flash.display.*;
import king.util.*;
public class ShowSignAnim extends Anim {
private var sign_:Sign;
private var rule_:Rule;// = null
private var parentClip_:MovieClip;
private var numTicks_:int;
public function ShowSignAnim(_arg1:MovieClip, _arg2:Sign, _arg3:Rule, _arg4:int=-1){
parentClip_ = _arg1;
rule_ = _arg3;
numTicks_ = _arg4;
sign_ = _arg2;
sign_.x = ((parentClip_.stage.stageWidth - sign_.getWidth()) / 2);
sign_.y = (((parentClip_.stage.stageHeight - sign_.getHeight()) / 2) - 4);
sign_.x = Math.round(sign_.x);
sign_.y = Math.round(sign_.y);
parentClip_.addChild(sign_);
}
override public function render(_arg1:Number):void{
sign_.render(_arg1);
}
override public function tick(_arg1:Number):Boolean{
var _local2:Boolean;
sign_.tick(_arg1);
if (numTicks_ != -1){
_local2 = (_arg1 == numTicks_);
};
if (sign_.isStopped()){
_local2 = true;
};
if (((_local2) && (!((rule_ == null))))){
sign_.done();
rule_.reply();
};
return (_local2);
}
override public function end():void{
sign_.end();
parentClip_.removeChild(sign_);
}
}
}//package king.game.uno.anim
Section 26
//TakeAnim (king.game.uno.anim.TakeAnim)
package king.game.uno.anim {
import king.game.uno.view.*;
import king.game.uno.*;
import king.util.*;
public class TakeAnim extends Anim {
private var dealerView_:DealerView;
private var rule_:Rule;
private var numTicks_:Number;
private var card_:CardView;
private var delay_:int;
public function TakeAnim(_arg1:CardView, _arg2:int, _arg3:Rule, _arg4:DealerView){
card_ = _arg1;
delay_ = _arg2;
rule_ = _arg3;
dealerView_ = _arg4;
numTicks_ = 30;
}
override public function render(_arg1:Number):void{
}
override public function end():void{
card_.getHand().removeCardById(card_.getId());
dealerView_.takeAnimDone();
card_.visible = false;
card_.changed = true;
card_.setFade(1);
card_.resetCoords();
var _local1:Number = -700;
var _local2:Number = 50;
var _local3:Number = -100;
var _local4:Number = -90;
var _local5:Number = 10;
var _local6:Number = 360;
card_.ox = (card_.nx = _local1);
card_.oy = (card_.ny = _local2);
card_.oz = (card_.nz = _local3);
card_.oTilt = (card_.nTilt = _local4);
card_.oPan = (card_.nPan = _local5);
card_.oRoll = (card_.nRoll = _local6);
card_.dealTime = 0;
card_.throwTime = 0;
if (rule_ != null){
rule_.reply();
};
}
override public function tick(_arg1:Number):Boolean{
var _local2:* = AnimPlayer.tickToPercent(_arg1, 0, numTicks_);
card_.dealTime = (1 - _local2);
return ((_arg1 >= numTicks_));
}
}
}//package king.game.uno.anim
Section 27
//TakeCardsFromTableAnim (king.game.uno.anim.TakeCardsFromTableAnim)
package king.game.uno.anim {
import king.game.uno.view.*;
import king.game.uno.*;
import flash.display.*;
import flash.geom.*;
import king.util.*;
import flash.filters.*;
public class TakeCardsFromTableAnim extends Anim {
private var tick_:Number;// = 0
private var rule_:Rule;
private var x_:Number;
private var gameView_:GameView;
private var ox;
private var nx:Number;
private var numTicks_:Number;
private var stack_:Bitmap;
public function TakeCardsFromTableAnim(_arg1:GameView, _arg2:Rule){
gameView_ = _arg1;
stack_ = gameView_.getStackBitmapCopy();
rule_ = _arg2;
stack_.visible = true;
ox = (nx = (x_ = stack_.x));
numTicks_ = 18;
}
override public function render(_arg1:Number):void{
var _local2:Number = (ox + ((nx - ox) * _arg1));
stack_.x = _local2;
if (tick_ == numTicks_){
stack_.visible = false;
stack_.x = x_;
};
}
override public function end():void{
stack_.bitmapData.fillRect(new Rectangle(0, 0, stack_.width, stack_.height), 0);
stack_.visible = false;
stack_.x = x_;
stack_.filters.pop();
if (rule_ != null){
rule_.reply();
};
}
override public function tick(_arg1:Number):Boolean{
tick_ = _arg1;
var _local2:Number = AnimPlayer.tickToPercent(_arg1, 0, numTicks_);
stack_.filters = [new BlurFilter((_local2 * 20), 0, 1)];
_local2 = AnimPlayer.easeInCubic(_local2, 0, 1, 1);
ox = nx;
nx = (x_ - (600 * _local2));
return ((_arg1 == numTicks_));
}
}
}//package king.game.uno.anim
Section 28
//Bubble (king.game.uno.view.Bubble)
package king.game.uno.view {
import flash.display.*;
import flash.text.*;
public class Bubble extends MovieClip {
public var card:MovieClip;
public var color:int;
public var txt:TextField;
public function Bubble(){
this.x = 266;
this.y = 74;
txt.text = "";
card.visible = false;
}
public function setColor(_arg1:int){
color = _arg1;
}
public function setCardColor(_arg1:int):void{
if (_arg1 >= 0){
card.gotoAndStop((_arg1 + 1));
card.visible = true;
this.gotoAndStop(1);
} else {
card.visible = false;
};
}
public function setText(_arg1:String):void{
txt.text = _arg1;
if (_arg1.length > 0){
this.gotoAndStop((2 + (color % 2)));
};
}
}
}//package king.game.uno.view
Section 29
//CardView (king.game.uno.view.CardView)
package king.game.uno.view {
import king.game.uno.*;
import sandy.events.*;
import sandy.materials.*;
import flash.events.*;
import flash.display.*;
import sandy.materials.attributes.*;
import sandy.primitive.*;
public class CardView extends Plane3D {
public var mouseOverTime:Number;// = 0
private var gameView_:GameView;
public var nRoll:Number;// = 0
public var oRoll:Number;// = 0
public var dt:Number;// = 0
public var mouseOver:Boolean;// = false
public var id_:int;
public var isThrowing_:Boolean;// = false
public var oPan:Number;// = 0
public var nx;
public var nTilt:Number;// = 0
public var nz:Number;// = 0
public var nPan:Number;// = 0
public var oTilt:Number;// = 0
public var dealTime:Number;// = 0
public var ny;
public var throwTime:Number;// = 0
public var fadeMaterialAttribute_:MaterialAttributes;
private var card_:Card;
public var ox;
public var showTime:Number;// = 0
public var oz:Number;// = 0
private var frontMaterial_:BitmapMaterial;
private var backMaterial_:BitmapMaterial;
public var oy;
public function CardView(_arg1:GameView, _arg2:Card){
gameView_ = _arg1;
card_ = _arg2;
id_ = _arg2.getId();
super(("card" + card_.getId()), 114, 74, 1, 1, Plane3D.XY_ALIGNED, "tri");
this.enableBackFaceCulling = false;
this.useSingleContainer = false;
fadeMaterialAttribute_ = new MaterialAttributes(new LightAttributes(false, 0.5));
var _local3:Bitmap = Library.getCardBitmap(card_.getType(), card_.getColor(), card_.getRank());
var _local4:Bitmap = Library.getCardBackBitmap();
frontMaterial_ = new BitmapMaterial(_local3.bitmapData, fadeMaterialAttribute_, 7);
backMaterial_ = new BitmapMaterial(_local4.bitmapData, null, 7);
frontMaterial_.lightingEnable = false;
backMaterial_.lightingEnable = false;
frontMaterial_.smooth = true;
backMaterial_.smooth = true;
var _local5:Appearance = new Appearance(frontMaterial_, backMaterial_);
this.appearance = _local5;
this.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
this.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
this.addEventListener(MouseEvent.ROLL_OVER, onMouseOver);
this.addEventListener(MouseEvent.ROLL_OUT, onMouseOut);
this.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
this.enableEvents = false;
}
public function onMouseOver(_arg1:Shape3DEvent){
if (isInHand()){
mouseOver = true;
};
}
public function isInHand():Boolean{
if (dealTime < 1){
return (false);
};
if (isThrowing_){
return (false);
};
return (true);
}
public function getCard():Card{
return (card_);
}
public function setIsThrowing(_arg1:Boolean):void{
mouseOver = false;
isThrowing_ = _arg1;
}
public function getId():int{
return (id_);
}
public function isThrowing():Boolean{
return (isThrowing_);
}
public function getPercentInHand():Number{
if (isThrowing()){
return ((1 - throwTime));
};
if (dealTime < 1){
return (dealTime);
};
return (1);
}
public function render(_arg1:Number):void{
this.x = (ox + ((nx - ox) * _arg1));
if (this.visible == false){
this.x = -100000;
};
this.y = (oy + ((ny - oy) * _arg1));
this.z = (oz + ((nz - oz) * _arg1));
this.tilt = (oTilt + ((nTilt - oTilt) * _arg1));
this.pan = (oPan + ((nPan - oPan) * _arg1));
this.roll = (oRoll + ((nRoll - oRoll) * _arg1));
}
public function onMouseDown(_arg1:Shape3DEvent){
if (!isInHand()){
return;
};
getHand().getPlayer().clickCard(card_);
}
public function getWantedSpace():Number{
return ((0.12 * getPercentInHand()));
}
public function getHand():Hand{
return (card_.getHand());
}
public function onMouseOut(_arg1:Shape3DEvent){
mouseOver = false;
}
public function setFade(_arg1:Number){
if (_arg1 == 1){
frontMaterial_.lightingEnable = false;
} else {
frontMaterial_.lightingEnable = true;
};
}
}
}//package king.game.uno.view
Section 30
//ChooseColorSign (king.game.uno.view.ChooseColorSign)
package king.game.uno.view {
import king.game.uno.*;
import flash.events.*;
import flash.display.*;
import flash.text.*;
import king.util.*;
import com.midasplayer.text.*;
public class ChooseColorSign extends Sign {
public var green:MovieClip;
private var clickColor_:int;
private var clickTime_:int;
public var yellow:MovieClip;
public var header:TextField;
private var gameView_:GameView;
public var red:MovieClip;
private var clicked_:Array;
public var green_back:MovieClip;
public var blue_back:MovieClip;
private var ns_:Array;
private var timeOver_:Array;
private var bgClips_:Array;
public var yellow_back:MovieClip;
public var red_back:MovieClip;
public var blue:MovieClip;
private var rule_:Rule;
private var mouseOver_:Array;
private var buttonClips_:Array;
public var txt:TextField;
private var os_:Array;
public function ChooseColorSign(){
var _local1:int;
var _local2:MovieClip;
super(310, 170);
buttonClips_ = new Array(4);
bgClips_ = new Array(4);
timeOver_ = new Array(4);
mouseOver_ = new Array(4);
os_ = new Array(4);
ns_ = new Array(4);
clicked_ = new Array(4);
clickTime_ = -1;
buttonClips_[Card.COLOR_BLUE] = blue;
buttonClips_[Card.COLOR_GREEN] = green;
buttonClips_[Card.COLOR_RED] = red;
buttonClips_[Card.COLOR_YELLOW] = yellow;
bgClips_[Card.COLOR_BLUE] = blue_back;
bgClips_[Card.COLOR_GREEN] = green_back;
bgClips_[Card.COLOR_RED] = red_back;
bgClips_[Card.COLOR_YELLOW] = yellow_back;
_local1 = 0;
while (_local1 < 4) {
_local2 = buttonClips_[_local1];
os_[_local1] = (ns_[_local1] = (_local2.scaleX = (_local2.scaleY = 0.8)));
_local2.alpha = 0.7;
_local2.addEventListener(MouseEvent.ROLL_OVER, overButton);
_local2.addEventListener(MouseEvent.ROLL_OUT, outButton);
_local2.addEventListener(MouseEvent.CLICK, clickButton);
_local2.buttonMode = true;
timeOver_[_local1] = 0;
mouseOver_[_local1] = false;
clicked_[_local1] = false;
_local1++;
};
txt.text = I18n.getString("choose_color");
}
override public function render(_arg1:Number):void{
var _local2:int;
var _local3:MovieClip;
var _local4:Number;
_local2 = 0;
while (_local2 < 4) {
_local3 = buttonClips_[_local2];
_local4 = (os_[_local2] + ((ns_[_local2] - os_[_local2]) * _arg1));
_local3.scaleX = (_local3.scaleY = _local4);
_local3 = bgClips_[_local2];
_local3.width = (_local3.height = (20 + (200 * ((_local4 - 0.8) / 0.2))));
_local2++;
};
}
override public function tick(_arg1:Number):void{
var _local2:int;
var _local3:MovieClip;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
_local2 = 0;
while (_local2 < 4) {
_local3 = buttonClips_[_local2];
if (((((clicked_[_local2]) || (mouseOver_[_local2]))) && ((timeOver_[_local2] < 10)))){
timeOver_[_local2] = (timeOver_[_local2] + 2);
};
if (((((!(clicked_[_local2])) && (!(mouseOver_[_local2])))) && ((timeOver_[_local2] > 0)))){
timeOver_[_local2] = (timeOver_[_local2] - 2);
};
_local4 = (timeOver_[_local2] / 10);
os_[_local2] = ns_[_local2];
ns_[_local2] = (0.8 + (_local4 * 0.1));
_local3.alpha = (0.7 + (_local4 * 0.3));
if (clickTime_ > 0){
_local5 = AnimPlayer.tickToPercent(clickTime_, 0, 15);
_local6 = AnimPlayer.tickToPercent(clickTime_, 0, 4);
_local7 = AnimPlayer.tickToPercent(clickTime_, 4, 11);
if (_local2 == clickColor_){
_local3.alpha = 1;
if (_local6 < 1){
ns_[_local2] = (0.9 - (0.4 * AnimPlayer.easeOutQuad(_local6, 0, 1, 1)));
} else {
ns_[_local2] = (0.5 + (0.5 * AnimPlayer.easeInOutQuad(_local7, 0, 1, 1)));
};
} else {
_local3.alpha = (0.7 - (_local5 * 0.3));
};
};
_local2++;
};
if ((((clickTime_ >= 0)) && ((timeOver_[clickColor_] == 10)))){
clickTime_++;
};
if (clickTime_ == 15){
this.remove();
};
}
public function outButton(_arg1:Event){
var _local2:* = clipToColor(MovieClip(_arg1.target));
mouseOver_[_local2] = false;
}
public function overButton(_arg1:Event){
var _local2:* = clipToColor(MovieClip(_arg1.target));
mouseOver_[_local2] = true;
}
public function clicked(_arg1:int){
clicked_[_arg1] = true;
clickTime_ = 0;
clickColor_ = _arg1;
gameView_.playSoundButton();
}
public function clipToColor(_arg1:MovieClip):int{
if (_arg1 == blue){
return (Card.COLOR_BLUE);
};
if (_arg1 == green){
return (Card.COLOR_GREEN);
};
if (_arg1 == red){
return (Card.COLOR_RED);
};
if (_arg1 == yellow){
return (Card.COLOR_YELLOW);
};
trace("no color found");
return (-1);
}
public function setGameView(_arg1:GameView){
gameView_ = _arg1;
}
public function addRule(_arg1:Rule){
rule_ = _arg1;
}
public function clickButton(_arg1:Event){
var _local2:MovieClip;
var _local3:int;
_local3 = 0;
while (_local3 < 4) {
_local2 = buttonClips_[_local3];
_local2.removeEventListener(MouseEvent.ROLL_OVER, overButton);
_local2.removeEventListener(MouseEvent.ROLL_OUT, outButton);
_local2.removeEventListener(MouseEvent.CLICK, clickButton);
_local2.buttonMode = false;
_local3++;
};
var _local4:* = clipToColor(MovieClip(_arg1.target));
gameView_.getGame().colorChosen(_local4);
}
}
}//package king.game.uno.view
Section 31
//ClockView (king.game.uno.view.ClockView)
package king.game.uno.view {
import flash.display.*;
public class ClockView extends MovieClip implements ClockViewer {
public var bg:MovieClip;
private var gameView_:GameView;
public var arrow:MovieClip;
private var shakeTime_:Number;
private var maskClip:MovieClip;
private var arrowRotation:Number;
private var maxTime_:Number;
private var lastArrowRotation:Number;
private var time_:Number;
private var shakeRotation_:Number;
public function ClockView(){
addFrameScript(0, frame1);
maskClip = new MovieClip();
maskClip.x = arrow.x;
maskClip.y = arrow.y;
this.addChild(maskClip);
bg.mask = maskClip;
arrowRotation = arrow.rotation;
lastArrowRotation = arrowRotation;
shakeTime_ = 0;
shakeRotation_ = 0;
}
public function setTime(_arg1:Number):void{
var _local2:*;
var _local3:*;
time_ = _arg1;
if (_arg1 == (maxTime_ - (30 * 3))){
gameView_.playSoundTimeWarning();
};
if (_arg1 == maxTime_){
if (!gameView_.getGame().hasEndGameBeenPressed()){
gameView_.playSoundBells();
};
};
if (time_ < maxTime_){
_local2 = (arrowRotation + ((time_ / maxTime_) * 360));
if (Math.abs((_local2 - lastArrowRotation)) > 2){
arrow.rotation = _local2;
};
if (Math.abs((arrow.rotation - lastArrowRotation)) > 4){
drawCircle(maskClip, 0, 0, 30, (arrow.rotation - lastArrowRotation), lastArrowRotation, 0, 0, 1, 1);
lastArrowRotation = arrow.rotation;
maskClip.cacheAsBitmap = true;
};
} else {
if (gameView_.getGame().hasEndGameBeenPressed()){
return;
};
shakeTime_++;
if (shakeTime_ < 5){
gotoAndStop(2);
arrow.x = 65;
arrow.y = 58;
arrow.rotation = 0;
} else {
if (shakeTime_ > (30 * 2)){
gotoAndStop(1);
arrow.rotation = (arrowRotation + shakeRotation_);
shakeRotation_ = (shakeRotation_ * 0.85);
arrow.x = 58.5;
arrow.y = 58;
} else {
_local3 = ((shakeTime_ - 5) % 8);
_local3 = (_local3 / 8);
_local3 = (Math.floor((2 * _local3)) + 2);
gotoAndStop(_local3);
if (_local3 == 3){
arrow.x = 51;
arrow.y = 58;
} else {
arrow.x = 64;
arrow.y = 57;
};
arrow.rotation = shakeRotation_;
shakeRotation_ = (shakeRotation_ - (4 + shakeTime_));
};
};
};
}
public function setMaxTime(_arg1:Number):void{
maxTime_ = _arg1;
}
function frame1(){
stop();
mouseEnabled = false;
mouseChildren = false;
}
function drawCircle(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:int, _arg8:int, _arg9:Number, _arg10:Number=1){
var _local11:*;
var _local12:Number;
var _local13:*;
var _local14:Number;
_arg1.graphics.beginFill(_arg8, _arg9);
_arg1.graphics.moveTo(_arg2, _arg3);
_local11 = ((Math.cos((Math.PI * ((_arg6 - 90) / 180))) * _arg4) + _arg2);
_local13 = ((Math.sin((Math.PI * ((_arg6 - 90) / 180))) * _arg4) + _arg3);
_arg1.graphics.lineTo(_local11, _local13);
if (_arg7 == 1){
_arg5 = (0 - _arg5);
_arg6 = (_arg6 - _arg5);
};
var _local15:Number = ((Math.PI / (360 / _arg5)) / _arg10);
var _local16:Number = (_arg4 / Math.cos(_local15));
var _local17:Number = (Math.PI * ((_arg6 - 90) / 180));
var _local18:* = (Math.PI * ((_arg6 - 90) / 180));
var _local19:* = 0;
while (_local19 < _arg10) {
_local18 = (_local17 + _local15);
_local17 = (_local18 + _local15);
_local11 = (_arg2 + (Math.cos(_local18) * _local16));
_local13 = (_arg3 + (Math.sin(_local18) * _local16));
_local12 = (_arg2 + (Math.cos(_local17) * _arg4));
_local14 = (_arg3 + (Math.sin(_local17) * _arg4));
_arg1.graphics.curveTo(_local11, _local13, _local12, _local14);
_local19++;
};
_arg1.graphics.lineTo(_arg2, _arg3);
_arg1.graphics.endFill();
}
public function setGameView(_arg1:GameView):void{
gameView_ = _arg1;
}
}
}//package king.game.uno.view
Section 32
//ClockViewer (king.game.uno.view.ClockViewer)
package king.game.uno.view {
public interface ClockViewer {
function setTime(_arg1:Number):void;
function setMaxTime(_arg1:Number):void;
}
}//package king.game.uno.view
Section 33
//DealerView (king.game.uno.view.DealerView)
package king.game.uno.view {
import king.game.uno.*;
import flash.display.*;
import king.util.*;
import king.game.uno.anim.*;
public class DealerView implements DealerViewer {
private var showLeftInPile_:Boolean;// = false
private var animPlayer_:AnimPlayer;
private var gameView_:GameView;
private var dealerAnim_:DealerAnim;
private var numShuffles_:int;// = 0
private var dealer_:Dealer;
private var numCardsLeft_:int;
public function DealerView(_arg1:Dealer, _arg2:GameView){
dealer_ = _arg1;
gameView_ = _arg2;
animPlayer_ = gameView_.getAnimPlayer();
dealerAnim_ = new DealerAnim(gameView_, this);
animPlayer_.addAnim(dealerAnim_);
var _local3:MovieClip = gameView_.getPlayClip().table;
_local3.numbers0.visible = false;
_local3.numbers1.visible = false;
_local3.numbers2.visible = false;
numCardsLeft_ = dealer_.cardsLeft();
}
public function shuffle(_arg1:Rule):void{
gameView_.playSoundShuffle();
if (numShuffles_ == 1){
dealerAnim_.showLeftInPile();
};
var _local2:Segments = new Segments();
_local2.addSegment(1, 15.99, 15);
_local2.addSegment(15.99, 14, 4);
_local2.addSegment(14, 15.99, 4);
_local2.addSegment(15.99, 14, 4);
_local2.addSegment(14, 15.99, 4);
_local2.addSegment(15.99, 14, 4);
_local2.addSegment(14, 15.99, 4);
_local2.addSegment(15.99, 1, 15);
var _local3:PlayFramesAnim = new PlayFramesAnim(gameView_.getPlayClip().table.shuffle, _local2);
_local3.addRule(_arg1);
animPlayer_.addAnim(_local3);
numShuffles_++;
}
public function showLeftInPile(_arg1:Boolean){
var _local2:MovieClip;
showLeftInPile_ = _arg1;
if (showLeftInPile_){
updateCardsLeftCount();
} else {
_local2 = gameView_.getPlayClip().table;
_local2.numbers0.visible = false;
_local2.numbers1.visible = false;
_local2.numbers2.visible = false;
};
}
public function takeCardsFromTable(_arg1:Rule):void{
dealerAnim_.takeCardsFromTable(_arg1);
numCardsLeft_ = (numCardsLeft_ + gameView_.getGame().getDiscardPile().getCards().length);
numCardsLeft_ = (numCardsLeft_ - _arg1.getNum());
updateCardsLeftCount();
}
public function updateCardsLeftCount():void{
if (!showLeftInPile_){
return;
};
var _local1:MovieClip = gameView_.getPlayClip().table;
if (numCardsLeft_ >= 100){
_local1.numbers0.x = -64;
_local1.numbers1.x = -90;
_local1.numbers2.x = -111;
_local1.numbers0.gotoAndStop(((numCardsLeft_ % 10) + 1));
_local1.numbers1.gotoAndStop((((numCardsLeft_ / 10) % 10) + 1));
_local1.numbers2.gotoAndStop(2);
} else {
_local1.numbers0.x = -72;
_local1.numbers1.x = -98;
_local1.numbers0.gotoAndStop(((numCardsLeft_ % 10) + 1));
_local1.numbers1.gotoAndStop(((Math.floor((numCardsLeft_ / 10)) % 10) + 1));
if ((Math.floor((numCardsLeft_ / 10)) % 10) == 0){
_local1.numbers0.x = -85;
_local1.numbers1.visible = false;
};
};
}
public function takeAnimDone():void{
numCardsLeft_++;
updateCardsLeftCount();
}
public function dealCards(_arg1:Player, _arg2:Array, _arg3:Rule):void{
dealerAnim_.dealCards(_arg1, _arg2, _arg3);
}
public function takeCards(_arg1:Player, _arg2:Array, _arg3:Rule):void{
dealerAnim_.takeCards(_arg1, _arg2, _arg3);
}
public function dealAnimDone():void{
numCardsLeft_--;
updateCardsLeftCount();
}
}
}//package king.game.uno.view
Section 34
//DealerViewer (king.game.uno.view.DealerViewer)
package king.game.uno.view {
import king.game.uno.*;
public interface DealerViewer {
function takeCardsFromTable(_arg1:Rule):void;
function shuffle(_arg1:Rule):void;
function takeCards(_arg1:Player, _arg2:Array, _arg3:Rule):void;
function dealCards(_arg1:Player, _arg2:Array, _arg3:Rule):void;
}
}//package king.game.uno.view
Section 35
//DrawWinnerSign (king.game.uno.view.DrawWinnerSign)
package king.game.uno.view {
import king.game.uno.*;
import flash.events.*;
import flash.display.*;
import flash.text.*;
import com.midasplayer.avatar.*;
import com.midasplayer.text.*;
public class DrawWinnerSign extends Sign {
private var or;
public var bot:MovieClip;
private var gameView_:GameView;
private var nr:Number;
public var txt:TextField;
public var star:MovieClip;
private var avatarClip_:MovieClip;// = null
private var sr;
public function DrawWinnerSign(){
super(300, 150);
sr = (or = (nr = star.rotation));
this.buttonMode = true;
this.mouseChildren = false;
this.addEventListener(MouseEvent.CLICK, onClick);
}
override public function done(){
gameView_.getGame().drawWinnerDone();
}
override public function render(_arg1:Number):void{
star.rotation = (or + ((nr - or) * _arg1));
}
public function onClick(_arg1:Event){
this.removeEventListener(MouseEvent.CLICK, onClick);
remove();
}
public function setPlayer(_arg1:Player, _arg2:Avatar){
var _local3:MovieClip;
var _local4:*;
txt.text = I18n.getString("will_start", _arg1.getViewer().getDisplayName());
if (_arg1.isLocalPlayer()){
bot.visible = false;
if (_arg2 != null){
_arg2.setMood("happy");
_local3 = MovieClip(_arg2);
_local3.x = (bot.x - (_arg2.getWidth() / 2));
_local3.y = (bot.y - (_arg2.getHeight() / 2));
addChild(_local3);
avatarClip_ = _local3;
};
} else {
_local4 = BotPlayer(_arg1);
bot.visible = true;
bot.gotoAndStop((_local4.getBotId() + 1));
};
}
public function setGameView(_arg1:GameView){
gameView_ = _arg1;
}
override public function end(){
super.end();
if (avatarClip_ != null){
removeChild(avatarClip_);
};
}
override public function tick(_arg1:Number):void{
or = nr;
nr = (nr + 0.6);
}
}
}//package king.game.uno.view
Section 36
//GameView (king.game.uno.view.GameView)
package king.game.uno.view {
import king.game.uno.*;
import king.sound.*;
import sandy.core.scenegraph.*;
import sandy.materials.*;
import sandy.core.data.*;
import sandy.core.*;
import flash.events.*;
import flash.display.*;
import sandy.materials.attributes.*;
import flash.geom.*;
import flash.text.*;
import king.util.*;
import king.game.uno.anim.*;
import com.midasplayer.avatar.*;
import king.math.*;
import com.midasplayer.text.*;
import sandy.primitive.*;
import flash.utils.*;
import flash.system.*;
import flash.ui.*;
public class GameView implements GameViewer {
private var avatarLoader_:AvatarLoader;
private var timeOverRule_:Rule;
private var lastDir_:int;// = 1
private var avatar_:Avatar;// = null
private var refreshCard_:CardView;// = null
private var introSign_:IntroSign;
private var avatarLoader2_:AvatarLoader;
private var playClip_:PlayClip;
private var cardInAir_:Boolean;// = false
private var animPlayer_:AnimPlayer;
private var stackBitmapData2_:BitmapData;
private var passRule_:Rule;// = null
private var scene_:Scene3D;
private var rootClip_:Sprite;
private var cards_:Array;
private var stackBitmapData_:BitmapData;
private var registerSign_:RegisterSign;
private var lastCard_:CardView;// = null
private var dealer_:DealerView;
private var clickedCard_:CardView;// = null
private var drawWinnerSign_:DrawWinnerSign;
private var stackBitmap_:Bitmap;
private var soundManager_:SoundManager;
private var tmpArray:Array;
private var stackBitmap2_:Bitmap;
private var unoRule_:Rule;// = null
private var endGame_:Boolean;// = false
private var keepStackBitmapCopy_:Boolean;// = false
private var cardnum_;
private var game_:Game;
private var signAvatar_:Avatar;// = null
private var group_:Group;
private var drawCardRule_:Rule;// = null
private var soundOn_:Boolean;// = true
private var roundWinnerSign_:RoundWinnerSign;
private var camera_:Camera3D;
private var avatarString_:String;
private var colorBubbleAnim_:ShowBubbleAnim;// = null
private var refreshStackBitmap_:Boolean;// = false
private var passSize_:int;// = 24
private var musicOn_:Boolean;// = true
private var random_:MtRandom;
public function GameView(_arg1:Sprite){
tmpArray = new Array();
super();
Security.allowDomain("*");
rootClip_ = _arg1;
playClip_ = new PlayClip();
rootClip_.addChild(playClip_);
animPlayer_ = new AnimPlayer();
soundManager_ = new SoundManager();
}
public function cardPlayed(_arg1:Player, _arg2:CardView){
game_.throwCard(_arg2.getId(), _arg1);
cardInAir_ = false;
refreshStackBitmap_ = true;
refreshCard_ = _arg2;
lastCard_ = _arg2;
keepStackBitmapCopy_ = false;
if (_arg1 != null){
if ((((((_arg2.getCard().getType() == Card.TYPE_DRAW_TWO)) || ((_arg2.getCard().getType() == Card.TYPE_WILD_DRAW_FOUR)))) || ((_arg2.getCard().getType() == Card.TYPE_SKIP)))){
_arg1.getViewer().setMood("happy");
};
};
if (_arg1 != null){
_arg1.cardPlayed(_arg2.getCard());
};
if (colorBubbleAnim_ != null){
colorBubbleAnim_.stop();
colorBubbleAnim_ = null;
};
var _local3:MovieClip;
if (_arg2.getCard().getType() == Card.TYPE_DRAW_TWO){
_local3 = new action_draw2();
_local3.txt.text = I18n.getString("action_draw2");
} else {
if (_arg2.getCard().getType() == Card.TYPE_WILD_DRAW_FOUR){
_local3 = new action_draw4();
_local3.txt.text = I18n.getString("action_draw4");
} else {
if (_arg2.getCard().getType() == Card.TYPE_REVERSE){
_local3 = new action_reverse();
_local3.txt.text = I18n.getString("action_reverse");
playSoundReverse();
} else {
if (_arg2.getCard().getType() == Card.TYPE_SKIP){
_local3 = new action_skip();
_local3.txt.text = I18n.getString("action_skip");
};
};
};
};
if (_local3 != null){
animPlayer_.addAnim(new ActionCardAnim(_local3, getPlayClip().signs, 50));
};
}
public function activatePassButton(_arg1:Rule){
var _local2:MovieClip;
var _local5:Segments;
var _local6:PlayFramesAnim;
passRule_ = _arg1;
_local2 = getPlayClip().pass;
_local2.mouseEnabled = true;
_local2.buttonMode = true;
_local2.mouseChildren = false;
_local2.gotoAndStop(2);
_local2.addEventListener(MouseEvent.ROLL_OVER, passOver);
_local2.addEventListener(MouseEvent.ROLL_OUT, passOut);
_local2.addEventListener(MouseEvent.CLICK, passClick);
var _local3:TextField = getPlayClip().pass.pass_active;
var _local4:TextFormat = _local3.getTextFormat();
_local4 = new TextFormat(_local4.font, passSize_, 0xFFEF00);
_local3.setTextFormat(_local4);
_local5 = new Segments();
_local5.addSegment(1, 9.99, 10);
_local5.addSegment(1, 1, 1);
_local6 = new PlayFramesAnim(getPlayClip().pass_lights.light1, _local5);
animPlayer_.addAnim(_local6);
_local5 = new Segments();
_local5.addSegment(1, 1, 2);
_local5.addSegment(1, 9.99, 10);
_local5.addSegment(1, 1, 1);
_local6 = new PlayFramesAnim(getPlayClip().pass_lights.light2, _local5);
animPlayer_.addAnim(_local6);
}
public function cardClicked(_arg1:CardView):void{
if ((((((clickedCard_ == null)) && ((cardInAir_ == false)))) && ((refreshStackBitmap_ == false)))){
clickedCard_ = _arg1;
inactivateDrawCardButton();
animPlayer_.addAnim(new DelayAnim(14, playSoundThrow));
};
}
public function drawWinnerSignClicked(){
drawWinnerSign_.onClick(null);
}
public function musicOff(){
musicOn_ = false;
soundManager_.get("uno_loop").setVolume(0);
soundManager_.get("music").setVolume(0);
soundManager_.get("outro").setVolume(0);
getPlayClip().btn_music.gotoAndStop(2);
}
public function hasUno(_arg1:Player){
soundManager_.get("uno").play((soundOn_) ? 1 : 0);
}
public function dealingCards(_arg1:CardView, _arg2:int){
if (_arg2 == 7){
animPlayer_.addAnim(new DelayAnim(4, playSoundDeal));
} else {
if (_arg2 == 1){
animPlayer_.addAnim(new DelayAnim(10, playSoundDealOne));
} else {
if (_arg2 == 2){
animPlayer_.addAnim(new DelayAnim(10, playSoundDealOne));
animPlayer_.addAnim(new DelayAnim(15, playSoundDealOne));
} else {
if (_arg2 == 3){
animPlayer_.addAnim(new DelayAnim(10, playSoundDealOne));
animPlayer_.addAnim(new DelayAnim(15, playSoundDealOne));
animPlayer_.addAnim(new DelayAnim(20, playSoundDealOne));
} else {
if (_arg2 == 4){
animPlayer_.addAnim(new DelayAnim(10, playSoundDealOne));
animPlayer_.addAnim(new DelayAnim(15, playSoundDealOne));
animPlayer_.addAnim(new DelayAnim(20, playSoundDealOne));
animPlayer_.addAnim(new DelayAnim(25, playSoundDealOne));
};
};
};
};
};
}
public function init(_arg1:Game):void{
var _local6:CardView;
game_ = _arg1;
random_ = new MtRandom(game_.getSeed());
camera_ = new Camera3D(755, 600);
camera_.z = -400;
camera_.y = 460;
camera_.lookAt(0, 0, 0);
group_ = new Group();
cards_ = new Array();
var _local2:Array = game_.getDeck().getCards();
var _local3:* = 0;
while (_local3 < _local2.length) {
_local6 = new CardView(this, _local2[_local3]);
_local6.forcedDepth = -(_local3);
_local6.enableForcedDepth = true;
_local6.visible = false;
cards_.push(_local6);
group_.addChild(_local6);
_local3++;
};
scene_ = new Scene3D("scene", playClip_.cards, camera_, group_);
stackBitmapData_ = new BitmapData(200, 145, true, 0);
stackBitmap_ = new Bitmap(stackBitmapData_);
stackBitmap_.x = 275;
stackBitmap_.y = 210;
stackBitmapData2_ = new BitmapData(200, 145, true, 0);
stackBitmap2_ = new Bitmap(stackBitmapData2_);
stackBitmap2_.x = 275;
stackBitmap2_.y = 210;
stackBitmap2_.visible = false;
playClip_.stack.addChild(stackBitmap2_);
playClip_.stack.addChild(stackBitmap_);
getPlayClip().table.dir.visible = false;
getPlayClip().table.numbers0.visible = false;
getPlayClip().table.numbers1.visible = false;
getPlayClip().table.numbers2.visible = false;
getPlayClip().station_left.numcards.textColor = 9949650;
getPlayClip().station_right.numcards.textColor = 373931;
getPlayClip().numcards.textColor = 9867928;
getPlayClip().station_left.numcards.visible = false;
getPlayClip().station_right.numcards.visible = false;
getPlayClip().numcards.visible = false;
setTimeout(this.loadAvatars, (1000 * 1));
ClockView(getPlayClip().clock).setGameView(this);
game_.getClock().addViewer(ClockViewer(getPlayClip().clock));
getPlayClip().btn_music.buttonMode = true;
getPlayClip().btn_sound.buttonMode = true;
getPlayClip().btn_endgame.buttonMode = true;
getPlayClip().btn_music.addEventListener(MouseEvent.CLICK, musicOnOffClicked);
getPlayClip().btn_sound.addEventListener(MouseEvent.CLICK, soundOnOffClicked);
getPlayClip().btn_endgame.addEventListener(MouseEvent.CLICK, endGameClicked);
if (game_.getGameData().getElementTextAsInt("music") == 0){
musicOff();
};
if (game_.getGameData().getElementTextAsInt("sound") == 0){
soundOff();
};
getPlayClip().pass.pass_active.text = I18n.getString("pass");
var _local4:TextField = getPlayClip().pass.pass_active;
var _local5:TextFormat = _local4.getTextFormat();
while (_local4.textWidth > 48) {
passSize_--;
_local5 = new TextFormat(_local5.font, passSize_, 0x808080);
_local4.setTextFormat(_local5);
};
soundManager_.get("music").play((musicOn_) ? 0.5 : 0);
}
public function activateUnoButton(_arg1:Rule, _arg2:Boolean=false){
var _local3:MovieClip;
var _local4:Segments;
var _local5:PlayFramesAnim;
unoRule_ = _arg1;
_local3 = getPlayClip().uno;
_local3.gotoAndStop(2);
_local3.mouseEnabled = true;
_local3.buttonMode = true;
_local3.mouseChildren = false;
_local3.addEventListener(MouseEvent.ROLL_OVER, unoOver);
_local3.addEventListener(MouseEvent.ROLL_OUT, unoOut);
if (_arg2){
_local3.addEventListener(MouseEvent.CLICK, unoMissClick);
getPlayClip().uno_lights.light1.gotoAndStop(1);
getPlayClip().uno_lights.light2.gotoAndStop(1);
} else {
_local3.addEventListener(MouseEvent.CLICK, unoClick);
_local4 = new Segments();
_local4.addSegment(1, 9.99, 10);
_local4.addSegment(1, 1, 1);
_local5 = new PlayFramesAnim(getPlayClip().uno_lights.light1, _local4);
animPlayer_.addAnim(_local5);
_local4 = new Segments();
_local4.addSegment(1, 1, 2);
_local4.addSegment(1, 9.99, 10);
_local4.addSegment(1, 1, 1);
_local5 = new PlayFramesAnim(getPlayClip().uno_lights.light2, _local4);
animPlayer_.addAnim(_local5);
};
}
public function playSoundStabbPositive(){
soundManager_.get("stabb_positive").play((soundOn_) ? 1 : 0);
}
public function getSoundOn():Boolean{
return (soundOn_);
}
public function throwCard(_arg1:CardView, _arg2:Player):void{
animPlayer_.addAnim(new HandToTableAnim(this, _arg2, _arg1));
cardInAir_ = true;
clickedCard_ = null;
}
public function getPlayClip():MovieClip{
return (playClip_);
}
public function playSoundReverse(){
soundManager_.get("reverse").play((soundOn_) ? 1 : 0);
}
public function addDealer(_arg1:Dealer):void{
dealer_ = new DealerView(_arg1, this);
_arg1.addViewer(dealer_);
}
public function timeOverReply(){
timeOverRule_.reply();
}
public function playSoundStabbNegative(){
soundManager_.get("stabb_negative").play((soundOn_) ? 1 : 0);
}
private function onAvatarLoaded(_arg1:Event):void{
var _local2:MovieClip = MovieClip(_arg1.target.content.getAvatar(avatarString_));
var _local3:MovieClip = MovieClip(_arg1.target.content.getAvatar(avatarString_));
if ((((_local2 == null)) || ((_arg1.target.content == undefined)))){
avatarLoader_.load(onAvatarLoaded);
} else {
avatar_ = Avatar(_local2);
_local2.x = (-(avatar_.getWidth()) / 2);
_local2.y = ((-(avatar_.getHeight()) / 2) - 5);
getPlayClip().avatarHolder.addChild(avatar_);
if (avatarString_ == ""){
_local2.y = (_local2.y + 10);
};
signAvatar_ = Avatar(_local3);
};
}
public function playSoundShuffle(){
animPlayer_.addAnim(new DelayAnim(0, playSoundShuffle2));
animPlayer_.addAnim(new DelayAnim(23, playSoundShuffle3));
}
public function unoClick(_arg1:Event){
var _local2:MovieClip;
playSoundButton();
hasUno(unoRule_.getPlayer());
inactivateUnoButton();
inactivateDrawCardButton(true);
_local2 = getPlayClip().uno;
var _local3:Segments = new Segments();
_local3.addSegment(3, 4.99, 5);
_local3.addSegment(4.99, 4.99, 10);
_local3.addSegment(2.99, 1, 5);
var _local4:PlayFramesAnim = new PlayFramesAnim(_local2, _local3);
animPlayer_.addAnim(_local4);
game_.saidUno();
inactivatePassButton(false);
}
public function playSoundDeal(){
soundManager_.get("deal").play((soundOn_) ? 1 : 0);
}
public function getAnimPlayer():AnimPlayer{
return (animPlayer_);
}
public function clearStackBimap(_arg1:int):void{
if (_arg1 == 0){
stackBitmapData2_.copyPixels(stackBitmapData_, new Rectangle(0, 0, 200, 145), new Point(0, 0));
stackBitmapData_.fillRect(new Rectangle(0, 0, stackBitmap_.width, stackBitmap_.height), 0);
} else {
keepStackBitmapCopy_ = true;
stackBitmapData_.fillRect(new Rectangle(0, 0, stackBitmap_.width, stackBitmap_.height), 0);
refreshCard_ = lastCard_;
refreshStackBitmap_ = true;
lastCard_.visible = true;
lastCard_.changed = true;
};
}
public function soundOn(){
soundOn_ = true;
getPlayClip().btn_sound.gotoAndStop(1);
}
public function playSoundUnoMiss(){
soundManager_.get("uno_miss").play((soundOn_) ? 0.5 : 0);
}
public function playSoundBells(){
soundManager_.get("bells").play((soundOn_) ? 1 : 0);
}
private function onAvatarProgress(_arg1:Event):void{
}
public function playSoundThrow(){
soundManager_.get(("add_card_" + (random_.nextInt(3) + 1))).play((soundOn_) ? 1 : 0);
}
private function loadAvatars(){
var _local1:String = game_.getGameData().getElementTextAsString("avatarpath");
avatarLoader_ = new AvatarLoader(_local1);
avatarLoader2_ = new AvatarLoader(_local1);
avatarString_ = game_.getGameData().getElementTextAsString("avatar");
avatarLoader2_.load(onAvatarLoaded2, onAvatarProgress);
avatarLoader_.load(onAvatarLoaded, onAvatarProgress);
}
public function getCardById(_arg1:int):CardView{
return (cards_[_arg1]);
}
public function playSoundButton(){
soundManager_.get("button").play((soundOn_) ? 1 : 0);
}
public function passOut(_arg1:Event){
var _local2:MovieClip;
_local2 = getPlayClip().pass;
_local2.gotoAndStop(2);
}
public function unoOut(_arg1:Event){
var _local2:MovieClip;
_local2 = getPlayClip().uno;
_local2.gotoAndStop(2);
}
public function passOver(_arg1:Event){
var _local2:MovieClip;
_local2 = getPlayClip().pass;
_local2.gotoAndStop(3);
}
public function playSoundWrong(){
soundManager_.get("wrong").play((soundOn_) ? 1 : 0);
}
public function getGame():Game{
return (game_);
}
public function inactivateUnoButton(_arg1:Boolean=true){
var _local2:MovieClip;
_local2 = getPlayClip().uno;
_local2.mouseEnabled = false;
_local2.buttonMode = false;
if (_arg1){
_local2.gotoAndStop(1);
};
_local2.removeEventListener(MouseEvent.ROLL_OVER, unoOver);
_local2.removeEventListener(MouseEvent.ROLL_OUT, unoOut);
_local2.removeEventListener(MouseEvent.CLICK, unoClick);
_local2.removeEventListener(MouseEvent.CLICK, unoMissClick);
}
public function drawButtonOver(_arg1:Event){
var _local2:MovieClip;
_local2 = MovieClip(_arg1.target);
}
private function onAvatarLoaded2(_arg1:Event):void{
var _local2:MovieClip = MovieClip(_arg1.target.content.getAvatar(avatarString_));
if ((((_local2 == null)) || ((_arg1.target.content == undefined)))){
avatarLoader2_.load(onAvatarLoaded2);
};
}
public function unoMissClick(_arg1:Event){
game_.reportUnoMissClicked(unoRule_.getPlayer().getId());
inactivateUnoButton(true);
}
public function activateDrawCardButton(_arg1:Rule){
var _local2:MovieClip;
var _local3:Segments;
var _local4:PlayFramesAnim;
drawCardRule_ = _arg1;
_local2 = getPlayClip().table.drawbtn;
_local2.buttonMode = true;
_local2.mouseChildren = false;
_local3 = new Segments();
_local3.addSegment(3.99, 2, 1);
_local3.addSegment(2, 2, 4);
_local3.addSegment(2, 3.99, 1);
_local4 = new PlayFramesAnim(_local2, _local3);
animPlayer_.addAnim(_local4);
_local3 = new Segments();
_local3.addSegment(1, 9.99, 10);
_local3.addSegment(1, 1, 1);
_local4 = new PlayFramesAnim(getPlayClip().table.drawbtn_lights.light1, _local3);
animPlayer_.addAnim(_local4);
_local3 = new Segments();
_local3.addSegment(1, 1, 2);
_local3.addSegment(1, 9.99, 10);
_local3.addSegment(1, 1, 1);
_local4 = new PlayFramesAnim(getPlayClip().table.drawbtn_lights.light2, _local3);
animPlayer_.addAnim(_local4);
getPlayClip().table.drawbtn_lights.scaleY = 0.8;
_local2.addEventListener(MouseEvent.ROLL_OVER, drawButtonOver);
_local2.addEventListener(MouseEvent.ROLL_OUT, drawButtonOut);
_local2.addEventListener(MouseEvent.CLICK, drawButtonClick);
}
public function tick(_arg1:Number){
var _local2:CardView;
var _local4:Array;
if (endGame_){
endGame_ = false;
game_.endGamePressed();
};
var _local3:* = 0;
while (_local3 < cards_.length) {
_local2 = cards_[_local3];
_local2.ox = _local2.nx;
_local2.oy = _local2.ny;
_local2.oz = _local2.nz;
_local2.oTilt = _local2.nTilt;
_local2.oPan = _local2.nPan;
_local2.oRoll = _local2.nRoll;
_local3++;
};
animPlayer_.tick(_arg1);
if (clickedCard_ != null){
_local4 = game_.getPlayers();
throwCard(clickedCard_, clickedCard_.getHand().getPlayer());
};
}
public function playSoundDealOne(){
soundManager_.get("deal1").play((soundOn_) ? 1 : 0);
}
public function introSignClicked(){
introSign_.clicked();
}
public function getMusicOn():Boolean{
return (musicOn_);
}
public function getStackBitmapCopy():Bitmap{
return (stackBitmap2_);
}
public function playSoundShuffle2(){
soundManager_.get("shuffle").play((soundOn_) ? 1 : 0);
}
public function drawButtonClick(_arg1:Event){
var _local2:MovieClip;
playSoundButton();
drawCardRule_.getPlayer().disallowPlay();
inactivateDrawCardButton(false);
inactivateUnoButton(true);
_local2 = MovieClip(getPlayClip().table.drawbtn);
var _local3:Segments = new Segments();
_local3.addSegment(3, 4.99, 2);
_local3.addSegment(4, 5.99, 3);
_local3.addSegment(5.99, 5.99, 6);
_local3.addSegment(5.99, 4, 1);
_local3.addSegment(1, 1, 1);
var _local4:PlayFramesAnim = new PlayFramesAnim(_local2, _local3);
animPlayer_.addAnim(_local4);
game_.drawCard();
}
private function musicOnOffClicked(_arg1:Event){
if (musicOn_){
musicOff();
} else {
musicOn();
};
}
public function playSoundShuffle3(){
soundManager_.get("shuffle").play((soundOn_) ? 0.5 : 0, 0.2);
}
private function soundOnOffClicked(_arg1:Event){
if (soundOn_){
soundOff();
} else {
soundOn();
};
}
public function playSoundTimeWarning(){
soundManager_.get("time_warning").play((soundOn_) ? 1 : 0);
}
public function setColorBubbleAnim(_arg1:ShowBubbleAnim){
colorBubbleAnim_ = _arg1;
}
public function drawButtonOut(_arg1:Event){
var _local2:MovieClip;
_local2 = MovieClip(_arg1.target);
}
public function inactivatePassButton(_arg1:Boolean=true){
var _local2:MovieClip;
_local2 = getPlayClip().pass;
_local2.mouseEnabled = false;
_local2.buttonMode = false;
if (_arg1){
_local2.gotoAndStop(1);
};
var _local3:TextField = getPlayClip().pass.pass_active;
var _local4:TextFormat = _local3.getTextFormat();
_local4 = new TextFormat(_local4.font, passSize_, 0x808080);
_local3.setTextFormat(_local4);
_local2.removeEventListener(MouseEvent.ROLL_OVER, passOver);
_local2.removeEventListener(MouseEvent.ROLL_OUT, passOut);
_local2.removeEventListener(MouseEvent.CLICK, passClick);
}
public function soundOff(){
soundOn_ = false;
getPlayClip().btn_sound.gotoAndStop(2);
}
public function addPlayer(_arg1:Player):void{
_arg1.addViewer(new PlayerView(_arg1, this));
_arg1.getHand().addViewer(new HandView(_arg1.getHand(), this));
}
public function musicOn(){
musicOn_ = true;
soundManager_.get("uno_loop").setVolume(0.3);
soundManager_.get("music").setVolume(0.5);
soundManager_.get("outro").setVolume(0.5);
getPlayClip().btn_music.gotoAndStop(1);
}
public function actOnRule(_arg1:Rule):void{
var player:Player;
var bp:BotPlayer;
var i:int;
var sign4:WinnerSign;
var sign2:MissedSayUnoSign;
var segments:Segments;
var anim:PlayFramesAnim;
var dir:*;
var rule = _arg1;
var localPlayer:Player = game_.getPlayers()[0];
var players:Array = game_.getPlayers();
if (rule.getType() == Rule.INFO){
if (rule.getMessage() == "register_to_play"){
registerSign_ = new register_sign();
animPlayer_.addAnim(new ShowSignAnim(getPlayClip().signs, registerSign_, rule, ((30 * 3) - 15)));
} else {
if (rule.getMessage() == "winning_draw_player"){
player = rule.getPlayer();
drawWinnerSign_ = new draw_winner_sign();
drawWinnerSign_.setGameView(this);
drawWinnerSign_.setPlayer(player, signAvatar_);
animPlayer_.addAnim(new ShowSignAnim(getPlayClip().signs, drawWinnerSign_, rule, ((30 * 3) - 15)));
} else {
if (rule.getMessage() == "round starts"){
soundManager_.get("music").stop();
soundManager_.get("uno_loop").loop((musicOn_) ? 0.3 : 0, 0);
stackBitmapData_.fillRect(new Rectangle(0, 0, stackBitmap_.width, stackBitmap_.height), 0);
stackBitmapData2_.fillRect(new Rectangle(0, 0, stackBitmap2_.width, stackBitmap2_.height), 0);
getPlayClip().station_left.numcards.visible = false;
getPlayClip().station_right.numcards.visible = false;
getPlayClip().numcards.visible = false;
lastDir_ = 1;
getPlayClip().table.dir.gotoAndStop(16);
getPlayClip().table.dir.visible = false;
rule.reply();
} else {
if (rule.getMessage() == "winning_round_player"){
soundManager_.get("uno_loop").stop();
soundManager_.get("outro2").play((soundOn_) ? 1 : 0);
player = rule.getPlayer();
roundWinnerSign_ = new round_winner_sign();
roundWinnerSign_.setGameView(this);
roundWinnerSign_.init(game_.getScoreBoard(), player, players, game_.getRoundNum(), signAvatar_);
i = 0;
while (i < players.length) {
player = players[i];
player.getViewer().removeBubbles();
i = (i + 1);
};
if (colorBubbleAnim_ != null){
colorBubbleAnim_.stop();
colorBubbleAnim_ = null;
};
animPlayer_.addAnim(new ShowSignAnim(getPlayClip().signs, roundWinnerSign_, rule, (30 * 5)));
} else {
if (rule.getMessage() == "winning_player"){
soundManager_.get("uno_loop").stop();
soundManager_.get("outro").play((musicOn_) ? 0.5 : 0);
sign4 = new winner_sign();
sign4.init(game_.getScoreBoard(), players, signAvatar_, this);
animPlayer_.addAnim(new ShowSignAnim(getPlayClip().signs, sign4, null, -1));
} else {
if (rule.getMessage() == "dealing initial cards"){
getPlayClip().station_left.numcards.visible = true;
getPlayClip().station_right.numcards.visible = true;
getPlayClip().numcards.visible = true;
rule.reply();
} else {
if (rule.getMessage() == "missed_say_uno"){
inactivateUnoButton();
player = rule.getPlayer();
player.getViewer().setMood("ashamed");
if (player.isLocalPlayer()){
sign2 = new missed_say_uno_sign();
sign2.setPlayer(game_.getPlayers()[rule.getNum()], signAvatar_);
animPlayer_.addAnim(new ShowSignAnim(getPlayClip().signs, sign2, null, 50));
animPlayer_.addAnim(new DelayAnim(10, function (){
rule.reply();
}));
} else {
playSoundUnoMiss();
rule.reply();
};
} else {
if (rule.getMessage() == "game_starts"){
introSign_ = new intro_sign();
introSign_.setGameView(this);
animPlayer_.addAnim(new ShowSignAnim(getPlayClip().signs, introSign_, rule));
} else {
rule.reply();
};
};
};
};
};
};
};
};
} else {
if (rule.getType() == Rule.PLAYER_TURN_TO_ACT){
player = rule.getPlayer();
player.actOnRule(rule);
if (!player.isLocalPlayer()){
localPlayer.getViewer().hidePlayableCards();
};
} else {
if (rule.getType() == Rule.PLAYER_TURN_END){
player = rule.getPlayer();
player.actOnRule(rule);
} else {
if (rule.getType() == Rule.PLAYER_PLAY_CARD){
player = rule.getPlayer();
player.actOnRule(rule);
} else {
if (rule.getType() == Rule.PLAYER_DRAW_CARD){
player = rule.getPlayer();
player.actOnRule(rule);
} else {
if (rule.getType() == Rule.PLAYER_DRAW_CARD_PENALTY){
player = rule.getPlayer();
player.actOnRule(rule);
} else {
if (rule.getType() == Rule.PLAYER_PLAY_OR_DRAW_CARD){
player = rule.getPlayer();
player.actOnRule(rule);
} else {
if (rule.getType() == Rule.PLAYER_SAY_UNO){
player = rule.getPlayer();
player.actOnRule(rule);
} else {
if (rule.getType() == Rule.PLAYER_SKIPPED){
player = rule.getPlayer();
player.actOnRule(rule);
} else {
if (rule.getType() == Rule.CHOOSE_COLOR){
player = rule.getPlayer();
player.actOnRule(rule);
} else {
if (rule.getType() == Rule.PLAY_DIRECTION_CHANGE){
dir = rule.getNum();
if (((!((dir == lastDir_))) && ((dir < 0)))){
lastDir_ = dir;
segments = new Segments();
segments.addSegment(1, 6.99, 25);
anim = new PlayFramesAnim(getPlayClip().table.dir, segments);
anim.addRule(rule);
animPlayer_.addAnim(anim);
getPlayClip().table.dir.visible = true;
segments = new Segments();
segments.addSegment(17.99, 1, 25);
segments.addSegment(1, 1, 1);
anim = new PlayFramesAnim(getPlayClip().table.glow, segments, false, false);
animPlayer_.addAnim(anim);
segments = new Segments();
segments.addSegment(1, 1, 15);
segments.addSegment(17.99, 1, 25);
segments.addSegment(1, 1, 1);
anim = new PlayFramesAnim(getPlayClip().table.glow2, segments, false, false);
animPlayer_.addAnim(anim);
} else {
if (((!((dir == lastDir_))) && ((dir > 0)))){
lastDir_ = dir;
segments = new Segments();
segments.addSegment(1, 16.99, 25);
anim = new PlayFramesAnim(getPlayClip().table.dir, segments);
anim.addRule(rule);
animPlayer_.addAnim(anim);
getPlayClip().table.dir.visible = true;
segments = new Segments();
segments.addSegment(1, 17.99, 25);
segments.addSegment(1, 1, 1);
anim = new PlayFramesAnim(getPlayClip().table.glow, segments, false, false);
animPlayer_.addAnim(anim);
segments = new Segments();
segments.addSegment(1, 1, 15);
segments.addSegment(1, 17.99, 25);
segments.addSegment(1, 1, 1);
anim = new PlayFramesAnim(getPlayClip().table.glow2, segments, false, false);
animPlayer_.addAnim(anim);
} else {
getPlayClip().table.dir.visible = true;
rule.reply();
};
};
} else {
if (rule.getType() == Rule.SHOW_HAND){
player = rule.getPlayer();
player.actOnRule(rule);
} else {
if (rule.getType() == Rule.START_ROUND){
getPlayClip().round.text = ("" + (rule.getNum() + 1));
rule.reply();
} else {
if (rule.getType() == Rule.TIME_OVER){
timeOverRule_ = rule;
if (game_.hasEndGameBeenPressed()){
animPlayer_.addAnim(new DelayAnim((30 * 0.5), timeOverReply));
} else {
animPlayer_.addAnim(new DelayAnim((30 * 3), timeOverReply));
};
localPlayer.disallowPlay();
inactivateDrawCardButton(true);
inactivatePassButton(true);
inactivateUnoButton(true);
};
};
};
};
};
};
};
};
};
};
};
};
};
};
}
public function unoOver(_arg1:Event){
var _local2:MovieClip;
_local2 = getPlayClip().uno;
_local2.gotoAndStop(3);
}
public function setAvatarMood(_arg1:String){
if (avatar_ != null){
avatar_.setMood(_arg1);
};
}
public function inactivateDrawCardButton2(){
var _local1:MovieClip;
_local1 = getPlayClip().table.drawbtn;
_local1.gotoAndStop(1);
}
public function passClick(_arg1:Event){
var _local2:MovieClip;
playSoundButton();
inactivatePassButton(false);
inactivateUnoButton();
passRule_.getPlayer().disallowPlay();
_local2 = getPlayClip().pass;
var _local3:Segments = new Segments();
_local3.addSegment(2, 4.99, 5);
_local3.addSegment(4.99, 4.99, 10);
_local3.addSegment(2.99, 1, 5);
var _local4:PlayFramesAnim = new PlayFramesAnim(_local2, _local3);
animPlayer_.addAnim(_local4);
game_.passed();
}
public function render(_arg1:Number, _arg2:Number):void{
var _local3:CardView;
soundManager_.update();
animPlayer_.render(_arg1, _arg2);
var _local4:* = 0;
while (_local4 < cards_.length) {
cards_[_local4].render(_arg2);
_local4++;
};
scene_.render();
if (refreshStackBitmap_){
if (!keepStackBitmapCopy_){
stackBitmapData2_.copyPixels(stackBitmapData_, new Rectangle(0, 0, 200, 145), new Point(0, 0));
};
stackBitmapData_.draw(playClip_.cards, new Matrix(1, 0, 0, 1, -275, -210), null, null, new Rectangle(0, 0, 200, 145), false);
refreshCard_.visible = false;
refreshCard_.changed = true;
refreshCard_ = null;
refreshStackBitmap_ = false;
};
}
private function endGameClicked(_arg1:Event){
endGame_ = true;
getPlayClip().btn_endgame.removeEventListener(MouseEvent.CLICK, endGameClicked);
}
public function roundWinnerSignClicked(){
roundWinnerSign_.onClick(null);
}
public function inactivateDrawCardButton(_arg1:Boolean=true){
var _local2:MovieClip;
_local2 = getPlayClip().table.drawbtn;
if (_arg1){
_local2.gotoAndStop(1);
};
_local2.buttonMode = false;
_local2.removeEventListener(MouseEvent.ROLL_OVER, drawButtonOver);
_local2.removeEventListener(MouseEvent.ROLL_OUT, drawButtonOut);
_local2.removeEventListener(MouseEvent.CLICK, drawButtonClick);
if (_arg1){
animPlayer_.addAnim(new DelayAnim(10, inactivateDrawCardButton2));
};
}
}
}//package king.game.uno.view
Section 37
//GameViewer (king.game.uno.view.GameViewer)
package king.game.uno.view {
import king.game.uno.*;
public interface GameViewer {
function init(_arg1:Game):void;
function addPlayer(_arg1:Player):void;
function cardClicked(_arg1:CardView):void;
function getSoundOn():Boolean;
function addDealer(_arg1:Dealer):void;
function actOnRule(_arg1:Rule):void;
function getMusicOn():Boolean;
}
}//package king.game.uno.view
Section 38
//HandView (king.game.uno.view.HandView)
package king.game.uno.view {
import king.game.uno.*;
import king.util.*;
import king.game.uno.anim.*;
public class HandView implements HandViewer {
private var gameView_:GameView;
private var animPlayer_:AnimPlayer;
private var hand_:Hand;
private var handAnim_:HandAnim;
public function HandView(_arg1:Hand, _arg2:GameView){
var _local3:Player;
super();
hand_ = _arg1;
gameView_ = _arg2;
animPlayer_ = gameView_.getAnimPlayer();
_local3 = _arg1.getPlayer();
if (_local3.isLocalPlayer()){
handAnim_ = new HandAnimLocal(gameView_, hand_.getPlayer());
} else {
if (_local3.getName() == "bot1"){
handAnim_ = new HandAnimBotLeft(gameView_, hand_.getPlayer());
} else {
handAnim_ = new HandAnimBotRight(gameView_, hand_.getPlayer());
};
};
animPlayer_.addAnim(handAnim_);
}
public function playCard(_arg1:Card):void{
var _local2:CardView = gameView_.getCardById(_arg1.getId());
_local2.enableEvents = false;
handAnim_.playCard(_arg1.getId());
}
public function addCard(_arg1:Card):void{
var _local2:CardView = gameView_.getCardById(_arg1.getId());
_local2.visible = true;
if (hand_.getPlayer().isLocalPlayer()){
_local2.enableEvents = true;
};
}
}
}//package king.game.uno.view
Section 39
//HandViewer (king.game.uno.view.HandViewer)
package king.game.uno.view {
import king.game.uno.*;
public interface HandViewer {
function addCard(_arg1:Card):void;
function playCard(_arg1:Card):void;
}
}//package king.game.uno.view
Section 40
//I18nTextField (king.game.uno.view.I18nTextField)
package king.game.uno.view {
import flash.display.*;
import flash.text.*;
import com.midasplayer.text.*;
public class I18nTextField extends Sprite {
public var intro_reverse_header:TextField;
public var intro_draw_two_text:TextField;
public var intro_uno_text:TextField;
public var intro_wild_draw4_header:TextField;
public var intro_wild_header:TextField;
public var pass:TextField;
public var intro_draw_header:TextField;
public var intro_pass_text:TextField;
public var intro_skip_text:TextField;
public var intro_reverse_text:TextField;
public var intro_objectives_text:TextField;
public var intro_pass_header:TextField;
public var intro_uno_header:TextField;
public var intro_wild_draw4_text:TextField;
public var intro_draw_two_header:TextField;
public var intro_draw_text:TextField;
public var intro_wild_text:TextField;
public var intro_skip_header:TextField;
public var intro_objectives_header:TextField;
public function I18nTextField(){
translateTextfields(this);
}
public static function translateTextfields(_arg1:Sprite):void{
var _local3:TextField;
var _local2:int;
while (_local2 < _arg1.numChildren) {
if ((_arg1.getChildAt(_local2) is TextField)){
_local3 = TextField(_arg1.getChildAt(_local2));
translateTextfield(_local3);
} else {
if ((_arg1.getChildAt(_local2) is Sprite)){
translateTextfields(Sprite(_arg1.getChildAt(_local2)));
};
};
_local2++;
};
}
public static function translateTextfield(_arg1:TextField):void{
var _local2:String;
_local2 = I18n.getString(_arg1.name);
if (((!((_local2 == ""))) && (!((_local2 == null))))){
_arg1.text = _local2;
};
}
}
}//package king.game.uno.view
Section 41
//IntroSign (king.game.uno.view.IntroSign)
package king.game.uno.view {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import king.util.*;
import com.midasplayer.text.*;
public class IntroSign extends Sign {
private var removeTick:Number;// = -1
private var gameView_:GameView;
private var nextClicked_:Boolean;// = false
public var intro:MovieClip;
private var introSegments_:Segments;
private var of;
private var nf:Number;
public function IntroSign(){
super(622, 474);
intro.y = Math.round(intro.y);
intro.x = Math.round(intro.x);
intro.gotoAndStop(1);
introSegments_ = new Segments();
introSegments_.addSegment(1, 45.99, 1);
of = (nf = 1);
intro.clickArea.buttonMode = true;
intro.clickArea.addEventListener(MouseEvent.CLICK, onClick);
intro.soundBtn.buttonMode = true;
intro.soundBtn.addEventListener(MouseEvent.CLICK, soundClick);
intro.musicBtn.buttonMode = true;
intro.musicBtn.addEventListener(MouseEvent.CLICK, musicClick);
}
public function soundClick(_arg1:Event){
if (gameView_.getSoundOn()){
intro.soundBtn.gotoAndStop(2);
gameView_.soundOff();
} else {
intro.soundBtn.gotoAndStop(1);
gameView_.soundOn();
};
}
public function musicClick(_arg1:Event){
if (gameView_.getMusicOn()){
intro.musicBtn.gotoAndStop(2);
gameView_.musicOff();
} else {
intro.musicBtn.gotoAndStop(1);
gameView_.musicOn();
};
}
override public function render(_arg1:Number):void{
var _local3:TextField;
var _local4:TextFormat;
var _local5:*;
var _local2:* = Math.floor((of + ((nf - of) * _arg1)));
intro.gotoAndStop(_local2);
if (intro.page1 != undefined){
_local3 = intro.page1.pass;
_local4 = _local3.getTextFormat();
_local5 = 24;
while (_local3.textWidth > 48) {
_local5--;
_local4 = new TextFormat(_local4.font, _local5, 0xFFEF00);
_local3.setTextFormat(_local4);
};
};
}
public function clicked(){
intro.clickArea.removeEventListener(MouseEvent.CLICK, onClick);
intro.clickArea.buttonMode = false;
removeTick = 0;
}
public function onClick(_arg1:Event){
clicked();
}
public function nextClick(_arg1:Event){
nextClicked_ = true;
}
public function setGameView(_arg1:GameView){
gameView_ = _arg1;
intro.txt_game_starts.text = "";
intro.txt_copyright.text = I18n.getString("copyright");
var _local2:MovieClip = MovieClip(gameView_.getPlayClip().fg);
if (!gameView_.getSoundOn()){
intro.soundBtn.gotoAndStop(2);
};
if (!gameView_.getMusicOn()){
intro.musicBtn.gotoAndStop(2);
};
}
override public function tick(_arg1:Number):void{
var _local2:*;
var _local3:Number = 0;
_local2 = 5;
_local3 = 70;
var _local4:* = AnimPlayer.tickToPercent(_arg1, _local2, _local3);
_local2 = (_local2 + (_local3 + 20));
_local3 = (30 * 20);
var _local5:* = AnimPlayer.tickToPercent(_arg1, _local2, _local3);
_local2 = (_local2 + _local3);
_local3 = (30 * 20);
var _local6:* = AnimPlayer.tickToPercent(_arg1, _local2, _local3);
_local2 = (_local2 + _local3);
if (intro.nextBtn != undefined){
intro.nextBtn.buttonMode = true;
intro.nextBtn.addEventListener(MouseEvent.CLICK, nextClick);
};
of = nf;
nf = Math.floor(introSegments_.getPointAt(_local4));
if (_local5 > 0){
nf = 46;
};
if (_local6 > 0){
nf = 47;
};
if (nextClicked_){
nf = 47;
};
if ((((_arg1 >= (_local2 - 20))) && ((removeTick == -1)))){
removeTick = 0;
};
var _local7:MovieClip = MovieClip(gameView_.getPlayClip().fg);
if (removeTick == 0){
gameView_.getGame().introClicked();
};
if (removeTick >= 0){
removeTick++;
_local7.alpha = (1 - (removeTick / 20));
};
if (removeTick >= 20){
gameView_.getPlayClip().removeChild(_local7);
this.remove();
};
var _local8:* = ((removeTick == -1)) ? Math.floor(((_local2 - _arg1) / 30)) : 0;
intro.txt_game_starts.text = I18n.getString("game_starts", _local8);
}
}
}//package king.game.uno.view
Section 42
//MissedSayUnoSign (king.game.uno.view.MissedSayUnoSign)
package king.game.uno.view {
import king.game.uno.*;
import flash.display.*;
import flash.text.*;
import com.midasplayer.avatar.*;
import com.midasplayer.text.*;
public class MissedSayUnoSign extends Sign {
public var txt:TextField;
private var avatarClip_:MovieClip;// = null
public var bot:MovieClip;
public function MissedSayUnoSign(){
super(380, 160);
txt.text = I18n.getString("missed_say_uno");
}
public function setPlayer(_arg1:Player, _arg2:Avatar){
var _local3:MovieClip;
var _local4:BotPlayer;
if (_arg1.isLocalPlayer()){
bot.visible = false;
if (_arg2 != null){
_arg2.setMood("happy");
_local3 = MovieClip(_arg2);
_local3.x = (bot.x - (_arg2.getWidth() / 2));
_local3.y = (bot.y - (_arg2.getHeight() / 2));
addChild(_local3);
avatarClip_ = _local3;
};
} else {
_local4 = BotPlayer(_arg1);
bot.visible = true;
bot.gotoAndStop((_local4.getBotId() + 1));
};
}
override public function end(){
super.end();
if (avatarClip_ != null){
removeChild(avatarClip_);
};
}
}
}//package king.game.uno.view
Section 43
//PlayerView (king.game.uno.view.PlayerView)
package king.game.uno.view {
import king.game.uno.*;
import king.util.*;
import king.game.uno.anim.*;
import king.math.*;
import com.midasplayer.text.*;
public class PlayerView implements PlayerViewer {
private var gameView_:GameView;
private var forgotSayUno_:Boolean;// = false
private var displayName_:String;
private var chooseColorSign_:ChooseColorSign;
private var player_:Player;
private var botFrame_:int;
private var bubbleAnims_:Array;
private var animPlayer_:AnimPlayer;
private var hasUno_:Boolean;// = false
private var moodFrame_:int;// = 1
private var turnToActRule_:Rule;
private var randomSayUno_:MtRandom;
private var lampAnim_:PlayFramesAnim;// = null
private var random2_:MtRandom;
private var random_:MtRandom;
private var unoBubble_:ShowBubbleAnim;
public function PlayerView(_arg1:Player, _arg2:GameView){
var _local3:BotPlayer;
super();
player_ = _arg1;
gameView_ = _arg2;
animPlayer_ = gameView_.getAnimPlayer();
bubbleAnims_ = new Array();
random_ = new MtRandom((gameView_.getGame().getSeed() + player_.getId()));
random2_ = new MtRandom((gameView_.getGame().getSeed() + player_.getId()));
randomSayUno_ = new MtRandom((gameView_.getGame().getSeed() + player_.getId()));
if (player_.getName() == "bot1"){
_local3 = BotPlayer(player_);
botFrame_ = ((_local3.getBotId() * 2) + 1);
gameView_.getPlayClip().station_left.bot.gotoAndStop((botFrame_ + 1));
displayName_ = I18n.getString(("bot" + (_local3.getBotId() + 1)));
} else {
if (player_.getName() == "bot2"){
_local3 = BotPlayer(player_);
botFrame_ = (((_local3.getBotId() - 3) * 2) + 1);
gameView_.getPlayClip().station_right.bot.gotoAndStop((botFrame_ + 1));
displayName_ = I18n.getString(("bot" + (_local3.getBotId() + 1)));
} else {
displayName_ = I18n.getString("you");
};
};
}
public function wrongPlay(_arg1:Card):void{
if (player_.isLocalPlayer()){
gameView_.playSoundWrong();
};
}
public function showPlayableCards():void{
var _local1:int;
var _local2:Rules = gameView_.getGame().getRules();
var _local3:Array = player_.getHand().getCards();
var _local4:Array = _local2.getPlayableCards(player_);
_local1 = 0;
while (_local1 < _local3.length) {
gameView_.getCardById(_local3[_local1].getId()).setFade(0.5);
_local1++;
};
_local1 = 0;
while (_local1 < _local4.length) {
gameView_.getCardById(_local4[_local1].getId()).setFade(1);
_local1++;
};
}
public function addBubble(_arg1:String, _arg2:int=-1):ShowBubbleAnim{
if (player_.getName() == "human"){
return (null);
};
var _local3:* = -1;
if (_arg1 == "UNO"){
gameView_.hasUno(player_);
_local3 = (30 * 3);
};
var _local4:* = (bubbleAnims_.length - 1);
while (_local4 >= 0) {
if (bubbleAnims_[_local4].isStopped()){
bubbleAnims_.splice(_local4, 1);
};
_local4--;
};
var _local5:* = null;
if (player_.getName() == "bot1"){
_local5 = new BubbleLeft();
_local5.x = 266;
} else {
_local5 = new BubbleRight();
_local5.x = 488;
};
_local5.y = ((bubbleAnims_.length * 55) + 80);
_local5.setColor(random2_.nextInt(100));
_local5.setCardColor(_arg2);
_local5.setText(_arg1);
var _local6:ShowBubbleAnim = new ShowBubbleAnim(gameView_.getPlayClip().bubbles, _local5, _local3);
bubbleAnims_.push(_local6);
animPlayer_.addAnim(_local6);
if (_arg2 != -1){
gameView_.setColorBubbleAnim(_local6);
};
return (_local6);
}
public function restoreMood(){
setMood("neutral", false);
}
public function actOnRule(_arg1:Rule):void{
var i:int;
var s:Segments;
var cards:Array;
var playableCards:Array;
var unoPossible:Boolean;
var hasUno:Boolean;
var color:int;
var currentColor:int;
var rule = _arg1;
if (rule.getType() == Rule.PLAYER_TURN_TO_ACT){
turnToActRule_ = rule;
animPlayer_.addAnim(new NextPlayerAnim(gameView_, rule, this));
} else {
if (rule.getType() == Rule.PLAYER_TURN_END){
hasUno = (player_.getHand().size() == 1);
if (lampAnim_ != null){
lampAnim_.stop();
lampAnim_ = null;
};
if (player_.getName() == "bot1"){
gameView_.getPlayClip().station_left.numcards.textColor = 9949650;
gameView_.getPlayClip().station_left.bot.gotoAndStop((botFrame_ + 1));
s = new Segments();
s.addSegment(gameView_.getPlayClip().station_left.lamp.currentFrame, 1, 6);
animPlayer_.addAnim(new PlayFramesAnim(gameView_.getPlayClip().station_left.lamp, s));
} else {
if (player_.getName() == "bot2"){
gameView_.getPlayClip().station_right.numcards.textColor = 373931;
gameView_.getPlayClip().station_right.bot.gotoAndStop((botFrame_ + 1));
s = new Segments();
s.addSegment(gameView_.getPlayClip().station_right.lamp.currentFrame, 1, 6);
animPlayer_.addAnim(new PlayFramesAnim(gameView_.getPlayClip().station_right.lamp, s));
} else {
if (player_.getName() == "human"){
gameView_.getPlayClip().numcards.textColor = 9867928;
s = new Segments();
s.addSegment(gameView_.getPlayClip().lamp.currentFrame, 1, 6);
animPlayer_.addAnim(new PlayFramesAnim(gameView_.getPlayClip().lamp, s));
hidePlayableCards();
};
};
};
if (((hasUno_) && (!(hasUno)))){
hasUno_ = false;
if (unoBubble_ != null){
unoBubble_.stop();
};
unoBubble_ = null;
};
if (((((!(player_.isLocalPlayer())) && (hasUno))) && (forgotSayUno_))){
forgotSayUno_ = false;
gameView_.activateUnoButton(rule, true);
};
rule.reply();
} else {
if (rule.getType() == Rule.PLAYER_PLAY_CARD){
unoPossible = false;
if (((!(player_.isLocalPlayer())) && (!(rule.isOptional())))){
if (player_.getName() == "bot1"){
s = new Segments();
s.addSegment(6, 12.99, 14);
moodFrame_ = 1;
s.addSegment(moodFrame_, moodFrame_, 1);
animPlayer_.addAnim(new PlayFramesAnim(gameView_.getPlayClip().station_left.bot.head, s));
} else {
if (player_.getName() == "bot2"){
s = new Segments();
s.addSegment(6, 12.99, 14);
moodFrame_ = 1;
s.addSegment(moodFrame_, moodFrame_, 1);
animPlayer_.addAnim(new PlayFramesAnim(gameView_.getPlayClip().station_right.bot.head, s));
};
};
} else {
if (player_.isLocalPlayer()){
cards = player_.getHand().getCards();
playableCards = rule.getRules().getPlayableCards(player_);
showPlayableCards();
if (rule.isOptional()){
if (playableCards.length == 0){
rule.reply();
} else {
if (playableCards.length > 1){
trace("Something wrong. should only have one playable card");
};
gameView_.activatePassButton(rule);
};
} else {
unoPossible = (playableCards.length == 2);
};
};
};
} else {
if (rule.getType() == Rule.PLAYER_PLAY_OR_DRAW_CARD){
unoPossible = false;
activateStation();
if (((!(player_.isLocalPlayer())) && (!(rule.isOptional())))){
if (player_.getName() == "bot1"){
s = new Segments();
s.addSegment(6, 12.99, 14);
moodFrame_ = 1;
s.addSegment(moodFrame_, moodFrame_, 1);
animPlayer_.addAnim(new PlayFramesAnim(gameView_.getPlayClip().station_left.bot.head, s));
} else {
if (player_.getName() == "bot2"){
s = new Segments();
s.addSegment(6, 12.99, 14);
moodFrame_ = 1;
s.addSegment(moodFrame_, moodFrame_, 1);
animPlayer_.addAnim(new PlayFramesAnim(gameView_.getPlayClip().station_right.bot.head, s));
};
};
} else {
if (player_.isLocalPlayer()){
gameView_.activateDrawCardButton(rule);
cards = player_.getHand().getCards();
playableCards = rule.getRules().getPlayableCards(player_);
showPlayableCards();
if (rule.isOptional()){
if (playableCards.length == 0){
rule.reply();
} else {
if (playableCards.length > 1){
trace("Something wrong. should only have one playable card");
};
gameView_.activatePassButton(rule);
};
} else {
unoPossible = (playableCards.length == 2);
};
};
};
} else {
if (rule.getType() == Rule.PLAYER_DRAW_CARD){
activateStation();
if (player_.isLocalPlayer()){
showPlayableCards();
gameView_.activateDrawCardButton(rule);
setMood("tired");
} else {
hasUno_ = false;
setMood("tired");
};
} else {
if (rule.getType() == Rule.PLAYER_DRAW_CARD_PENALTY){
setMood("angry");
if (player_.isLocalPlayer()){
animPlayer_.addAnim(new DelayAnim(0, gameView_.playSoundStabbNegative));
} else {
animPlayer_.addAnim(new DelayAnim(0, gameView_.playSoundStabbPositive));
};
rule.reply();
} else {
if (rule.getType() == Rule.PLAYER_SAY_UNO){
if (player_.isLocalPlayer()){
gameView_.activateUnoButton(rule);
} else {
if (randomSayUno_.nextInt(1000) > 500){
rule.setNum(1);
rule.reply();
hasUno_ = true;
unoBubble_ = addBubble("UNO", -1);
forgotSayUno_ = false;
} else {
rule.setNum(0);
rule.reply();
forgotSayUno_ = true;
};
};
} else {
if (rule.getType() == Rule.PLAYER_SKIPPED){
setMood("angry");
if (player_.isLocalPlayer()){
animPlayer_.addAnim(new DelayAnim(0, gameView_.playSoundStabbNegative));
} else {
animPlayer_.addAnim(new DelayAnim(0, gameView_.playSoundStabbPositive));
};
rule.reply();
} else {
if (rule.getType() == Rule.CHOOSE_COLOR){
if (!player_.isLocalPlayer()){
currentColor = rule.getNum();
do {
color = random_.nextInt(4);
} while (color == currentColor);
rule.setNum(color);
addBubble("", color);
animPlayer_.addAnim(new DelayAnim(15, function (){
rule.reply();
}));
} else {
chooseColorSign_ = new choose_color_sign();
chooseColorSign_.setGameView(gameView_);
animPlayer_.addAnim(new ShowSignAnim(gameView_.getPlayClip(), chooseColorSign_, null));
};
} else {
if (rule.getType() == Rule.SHOW_HAND){
random_ = new MtRandom(((gameView_.getGame().getSeed() + player_.getId()) + gameView_.getGame().getRoundNum()));
animPlayer_.addAnim(new ShowHandAnim(gameView_, rule));
};
};
};
};
};
};
};
};
};
};
}
public function clickCard(_arg1:Card):void{
if (player_.isLocalPlayer()){
gameView_.inactivatePassButton();
gameView_.inactivateDrawCardButton();
};
}
public function turnToActDone():void{
var _local1:Player = gameView_.getGame().getPlayers()[0];
var _local2:Player = turnToActRule_.getRules().getPlayerPlayedLastCard();
if ((((_local2.getHand().size() == 1)) && (!(turnToActRule_.getRules().hasSaidUno(_local2))))){
if (_local2.isLocalPlayer()){
animPlayer_.addAnim(new DelayAnim((30 * 1), this.reportUnoMiss));
} else {
animPlayer_.addAnim(new DelayAnim((15 * 1), this.reportUnoMiss));
};
} else {
gameView_.getGame().turnToAct(player_.getId());
turnToActRule_.reply();
};
}
public function reportUnoMiss():void{
var _local2:Player;
var _local1:Player = turnToActRule_.getRules().getPlayerPlayedLastCard();
if (_local1.isLocalPlayer()){
_local2 = gameView_.getGame().getPlayers()[0];
gameView_.getGame().reportUnoMiss(0);
turnToActRule_.getRules().reportUnoMiss(player_, _local2);
gameView_.getGame().turnToAct(player_.getId());
turnToActRule_.reply();
} else {
gameView_.inactivateUnoButton();
gameView_.getGame().turnToAct(player_.getId());
turnToActRule_.reply();
};
}
public function activateStation():void{
var _local1:Segments;
if (player_.getName() == "bot1"){
_local1 = new Segments();
_local1.addSegment(7.99, 1, 15);
_local1.addSegment(7.99, 1, 15);
_local1.addSegment(1, 1, 1);
animPlayer_.addAnim(new PlayFramesAnim(gameView_.getPlayClip().station_left_over.lamps, _local1));
if (lampAnim_ == null){
_local1 = new Segments();
_local1.addSegment(1, 4.99, 10);
_local1.addSegment(4.99, 4.99, 100000);
_local1.addSegment(1, 1, 1);
lampAnim_ = new PlayFramesAnim(gameView_.getPlayClip().station_left.lamp, _local1);
animPlayer_.addAnim(lampAnim_);
};
gameView_.getPlayClip().station_left.numcards.textColor = 0xFFFFFF;
gameView_.getPlayClip().station_left.bot.gotoAndStop(botFrame_);
} else {
if (player_.getName() == "bot2"){
_local1 = new Segments();
_local1.addSegment(7.99, 1, 15);
_local1.addSegment(7.99, 1, 15);
_local1.addSegment(1, 1, 1);
animPlayer_.addAnim(new PlayFramesAnim(gameView_.getPlayClip().station_right_over.lamps, _local1));
if (lampAnim_ == null){
_local1 = new Segments();
_local1.addSegment(1, 4.99, 10);
_local1.addSegment(4.99, 4.99, 100000);
_local1.addSegment(1, 1, 1);
lampAnim_ = new PlayFramesAnim(gameView_.getPlayClip().station_right.lamp, _local1);
animPlayer_.addAnim(lampAnim_);
};
gameView_.getPlayClip().station_right.numcards.textColor = 0xFFFFFF;
gameView_.getPlayClip().station_right.bot.gotoAndStop(botFrame_);
} else {
if (player_.getName() == "human"){
if (lampAnim_ == null){
_local1 = new Segments();
_local1.addSegment(1, 4.99, 10);
_local1.addSegment(4.99, 4.99, 100000);
_local1.addSegment(1, 1, 1);
lampAnim_ = new PlayFramesAnim(gameView_.getPlayClip().lamp, _local1);
animPlayer_.addAnim(lampAnim_);
};
gameView_.getPlayClip().numcards.textColor = 0xFFFFFF;
};
};
};
}
public function removeBubbles():void{
var _local1:* = (bubbleAnims_.length - 1);
while (_local1 >= 0) {
bubbleAnims_[_local1].stop();
_local1--;
};
}
public function colorChosen(_arg1:int):void{
chooseColorSign_.clicked(_arg1);
}
public function getDisplayName():String{
return (displayName_);
}
public function hidePlayableCards():void{
var _local1:int;
var _local2:Rules = gameView_.getGame().getRules();
var _local3:Array = player_.getHand().getCards();
_local1 = 0;
while (_local1 < _local3.length) {
gameView_.getCardById(_local3[_local1].getId()).setFade(0.5);
_local1++;
};
}
public function playCard(_arg1:Card):void{
if (player_.isLocalPlayer()){
gameView_.inactivatePassButton();
};
}
public function setMood(_arg1:String, _arg2:Boolean=true):void{
if (!player_.isLocalPlayer()){
if (_arg1 == "happy"){
moodFrame_ = 2;
} else {
if (_arg1 == "angry"){
moodFrame_ = 3;
} else {
if (_arg1 == "tired"){
moodFrame_ = 4;
} else {
if (_arg1 == "suprised"){
moodFrame_ = 5;
} else {
if (_arg1 == "ashamed"){
moodFrame_ = 3;
} else {
moodFrame_ = 1;
};
};
};
};
};
if (player_.getName() == "bot1"){
gameView_.getPlayClip().station_left.bot.head.gotoAndStop(moodFrame_);
} else {
gameView_.getPlayClip().station_right.bot.head.gotoAndStop(moodFrame_);
};
} else {
gameView_.setAvatarMood(_arg1);
};
if (_arg2){
animPlayer_.addAnim(new DelayAnim((30 * 2), restoreMood));
};
}
}
}//package king.game.uno.view
Section 44
//PlayerViewer (king.game.uno.view.PlayerViewer)
package king.game.uno.view {
import king.game.uno.*;
public interface PlayerViewer {
function wrongPlay(_arg1:Card):void;
function hidePlayableCards():void;
function playCard(_arg1:Card):void;
function colorChosen(_arg1:int):void;
function getDisplayName():String;
function showPlayableCards():void;
function setMood(_arg1:String, _arg2:Boolean=true):void;
function removeBubbles():void;
function actOnRule(_arg1:Rule):void;
function clickCard(_arg1:Card):void;
}
}//package king.game.uno.view
Section 45
//RegisterSign (king.game.uno.view.RegisterSign)
package king.game.uno.view {
import flash.text.*;
import com.midasplayer.text.*;
public class RegisterSign extends Sign {
public var txt:TextField;
public function RegisterSign(){
super(320, 110);
txt.text = I18n.getString("register");
}
}
}//package king.game.uno.view
Section 46
//RoundWinnerSign (king.game.uno.view.RoundWinnerSign)
package king.game.uno.view {
import king.game.uno.*;
import flash.events.*;
import flash.display.*;
import flash.text.*;
import king.util.*;
import com.midasplayer.avatar.*;
import com.midasplayer.text.*;
public class RoundWinnerSign extends Sign {
public var txt1:TextField;
public var txt3:TextField;
private var gameView_:GameView;
public var txt2:TextField;
public var bot1:MovieClip;
public var bot3:MovieClip;
public var ntxt:TextField;
public var bot2:MovieClip;
private var removeTick:int;// = -1
private var bots:Array;
private var texts:Array;
private var winningPlayer_:Player;
public var txt:TextField;
private var avatarClip_:MovieClip;// = null
public function RoundWinnerSign(){
super(360, 210);
texts = new Array();
texts.push(txt1);
texts.push(txt2);
texts.push(txt3);
bots = new Array();
bots.push(bot1);
bots.push(bot2);
bots.push(bot3);
this.buttonMode = true;
this.mouseChildren = false;
this.addEventListener(MouseEvent.CLICK, onClick);
}
public function init(_arg1:ScoreBoard, _arg2:Player, _arg3:Array, _arg4:int, _arg5:Avatar){
var _local6:Player;
var _local7:Player;
var _local9:TextField;
var _local10:MovieClip;
var _local11:int;
var _local12:*;
var _local13:*;
var _local14:*;
var _local15:MovieClip;
var _local16:*;
var _local17:*;
var _local8:ArrayList = new ArrayList();
winningPlayer_ = _arg2;
_local11 = 0;
while (_local11 < _arg3.length) {
_local6 = Player(_arg3[_local11]);
_local12 = 0;
while (_local12 < _local8.size()) {
_local7 = Player(_local8.get(_local12));
_local13 = ((_arg1.getScore(_local6) - _arg1.getScore(_local6, "extra")) - _arg1.getScore(_local6, "timebonus"));
_local14 = ((_arg1.getScore(_local7) - _arg1.getScore(_local7, "extra")) - _arg1.getScore(_local7, "timebonus"));
if (_local13 > _local14){
break;
};
_local12++;
};
_local8.addI(_local12, _local6);
_local11++;
};
_local11 = 0;
while (_local11 < _local8.size()) {
_local6 = Player(_local8.get(_local11));
_local9 = texts[_local11];
_local10 = bots[_local11];
_local9.text = ("" + ((_arg1.getScore(_local6) - _arg1.getScore(_local6, "extra")) - _arg1.getScore(_local6, "timebonus")));
if (_local6.isLocalPlayer()){
_local10.visible = false;
if (_arg5 != null){
if (_local11 == 0){
_arg5.setMood("happy");
} else {
_arg5.setMood("sad");
};
_local15 = MovieClip(_arg5);
_local15.x = (_local10.x - (_arg5.getWidth() / 2));
_local15.y = (_local10.y - (_arg5.getHeight() / 2));
addChild(_local15);
avatarClip_ = _local15;
};
} else {
_local16 = BotPlayer(_local6);
_local10.visible = true;
_local17 = (_local16.getBotId() + 1);
if (_local11 >= 1){
_local17 = (_local17 + 10);
};
_local10.gotoAndStop(_local17);
};
_local11++;
};
}
override public function tick(_arg1:Number):void{
var _local2:* = AnimPlayer.tickToPercent(_arg1, 0, (30 * 5));
var _local3:* = ((removeTick == -1)) ? Math.floor((((30 * 5) - _arg1) / 30)) : 0;
if (_local3 < 0){
_local3 = 0;
};
if (gameView_.getGame().getRoundNum() < 2){
ntxt.text = I18n.getString("next_round_starts", _local3);
} else {
ntxt.text = "";
};
if (txt != null){
txt.text = I18n.getString("won_round", winningPlayer_.getViewer().getDisplayName());
};
}
override public function end(){
super.end();
if (avatarClip_ != null){
};
}
override public function done(){
gameView_.getGame().roundWinnerDone();
}
public function onClick(_arg1:Event){
removeTick = 0;
this.removeEventListener(MouseEvent.CLICK, onClick);
remove();
}
public function setGameView(_arg1:GameView){
gameView_ = _arg1;
}
}
}//package king.game.uno.view
Section 47
//ScorePop (king.game.uno.view.ScorePop)
package king.game.uno.view {
import flash.display.*;
import flash.text.*;
public class ScorePop extends MovieClip {
public var score:TextField;
}
}//package king.game.uno.view
Section 48
//Sign (king.game.uno.view.Sign)
package king.game.uno.view {
import flash.display.*;
public class Sign extends MovieClip {
protected var width_:Number;
private var stopped_:Boolean;// = false
protected var height_:Number;
private static var YPIECE_HEIGHT:Number = 19;
public static var CORNER_HEIGHT:Number = 59;
public static var CORNER_WIDTH:Number = 59;
private static var XPIECE_WIDTH:Number = 19;
public function Sign(_arg1:int=-1, _arg2:int=-1){
setWidth(((_arg1 == -1)) ? this.width : _arg1);
setHeight(((_arg2 == -1)) ? this.height : _arg2);
update();
}
public function update(){
var _local10:MovieClip;
var _local1:* = 0;
var _local2:* = (width_ - (CORNER_WIDTH * 2));
var _local3:* = (height_ - (CORNER_HEIGHT * 2));
var _local4:* = Math.ceil((_local2 / XPIECE_WIDTH));
var _local5:* = Math.ceil((_local3 / YPIECE_HEIGHT));
var _local6:* = XPIECE_WIDTH;
var _local7:* = YPIECE_HEIGHT;
var _local8:* = 0;
var _local9:* = 0;
_local1 = 0;
while (_local1 < _local4) {
_local10 = new sign_top();
_local10.x = _local8;
_local10.y = _local9;
_local10.width = _local6;
this.addChildAt(_local10, 0);
_local10 = new sign_bottom();
_local10.x = _local8;
_local10.y = (_local9 + _local3);
_local10.width = _local6;
this.addChildAt(_local10, 0);
_local8 = (_local8 + _local6);
_local1++;
};
_local8 = 0;
_local9 = 0;
_local1 = 0;
while (_local1 < _local5) {
_local10 = new sign_left();
_local10.x = 0;
_local10.y = _local9;
_local10.height = _local7;
this.addChildAt(_local10, 0);
_local10 = new sign_right();
_local10.x = (_local8 + _local2);
_local10.y = _local9;
_local10.height = _local7;
this.addChildAt(_local10, 0);
_local9 = (_local9 + _local7);
_local1++;
};
_local10 = new sign_top_left();
_local10.x = 0;
_local10.y = 0;
this.addChildAt(_local10, 0);
_local10 = new sign_top_right();
_local10.x = _local2;
_local10.y = 0;
this.addChildAt(_local10, 0);
_local10 = new sign_bottom_left();
_local10.x = 0;
_local10.y = _local3;
this.addChildAt(_local10, 0);
_local10 = new sign_bottom_right();
_local10.x = _local2;
_local10.y = _local3;
this.addChildAt(_local10, 0);
_local10 = new sign_middle();
_local10.x = 0;
_local10.y = 0;
_local10.width = _local2;
_local10.height = _local3;
this.addChildAt(_local10, 0);
}
public function done(){
}
public function isStopped(){
return (stopped_);
}
public function setHeight(_arg1:Number){
if (_arg1 < (CORNER_HEIGHT * 2)){
_arg1 = (CORNER_HEIGHT * 2);
};
_arg1 = (Math.ceil((_arg1 / YPIECE_HEIGHT)) * YPIECE_HEIGHT);
_arg1 = (_arg1 + (CORNER_HEIGHT * 2));
height_ = _arg1;
}
public function remove(){
stopped_ = true;
}
public function tick(_arg1:Number):void{
}
public function render(_arg1:Number):void{
}
public function getWidth():Number{
return ((width_ - (CORNER_WIDTH * 2)));
}
public function end(){
}
public function setWidth(_arg1:Number){
if (_arg1 < (CORNER_WIDTH * 2)){
_arg1 = (CORNER_WIDTH * 2);
};
_arg1 = (Math.ceil((_arg1 / XPIECE_WIDTH)) * XPIECE_WIDTH);
_arg1 = (_arg1 + (CORNER_WIDTH * 2));
width_ = _arg1;
}
public function getHeight():Number{
return ((height_ - (CORNER_HEIGHT * 2)));
}
}
}//package king.game.uno.view
Section 49
//WinnerSign (king.game.uno.view.WinnerSign)
package king.game.uno.view {
import king.game.uno.*;
import flash.events.*;
import flash.display.*;
import flash.text.*;
import king.util.*;
import com.midasplayer.avatar.*;
import com.midasplayer.text.*;
public class WinnerSign extends Sign {
public var txt1:TextField;
public var txt3:TextField;
private var removeTick:int;// = -1
public var txt_total_score:TextField;
public var txt2:TextField;
public var bot1:MovieClip;
public var bot2:MovieClip;
public var bot3:MovieClip;
public var txt_time_bonus_value:TextField;
private var gameView_:GameView;
public var txt_score:TextField;
public var plupps1:MovieClip;
public var plupps2:MovieClip;
public var txt_extra:TextField;
private var bots:Array;
public var txt_time_bonus:TextField;
public var txt_game_ends:TextField;
private var texts:Array;
public var txt_extra_value:TextField;
public var txt_score_value:TextField;
public var txt_total_score_value:TextField;
public function WinnerSign(){
super(622, 474);
texts = new Array();
texts.push(txt1);
texts.push(txt2);
texts.push(txt3);
bots = new Array();
bots.push(bot1);
bots.push(bot2);
bots.push(bot3);
txt_score.text = (I18n.getString("points") + "..............");
txt_extra.text = (I18n.getString("extra") + "..............");
txt_time_bonus.text = (I18n.getString("time_bonus") + "..............");
txt_total_score.text = I18n.getString("total_score");
var _local1:int = txt_total_score.textWidth;
var _local2:int = ((txt_total_score.x + (txt_total_score.width / 2)) - (_local1 / 2));
plupps1.x = (_local2 - plupps1.width);
plupps2.x = ((_local2 + _local1) + 20);
}
override public function tick(_arg1:Number):void{
var _local2:* = AnimPlayer.tickToPercent(_arg1, 0, (30 * 20));
var _local3:* = ((removeTick == -1)) ? Math.floor((((30 * 20) - _arg1) / 30)) : 0;
if (_local3 < 0){
_local3 = 0;
};
txt_game_ends.text = I18n.getString("game_ends", _local3);
if (_arg1 == (30 * 2)){
this.buttonMode = true;
this.mouseChildren = false;
this.addEventListener(MouseEvent.CLICK, onClick);
};
if ((((removeTick == 0)) || ((_arg1 >= (30 * 20))))){
gameView_.getGame().quitGame();
};
}
public function onClick(_arg1:Event){
clicked();
}
public function init(_arg1:ScoreBoard, _arg2:Array, _arg3:Avatar, _arg4:GameView){
var _local5:Player;
var _local6:Player;
var _local8:TextField;
var _local9:MovieClip;
var _local10:int;
var _local11:*;
var _local12:*;
var _local13:*;
var _local14:*;
var _local15:*;
var _local16:*;
var _local17:MovieClip;
var _local18:*;
var _local19:*;
var _local7:ArrayList = new ArrayList();
gameView_ = _arg4;
_local10 = 0;
while (_local10 < _arg2.length) {
_local5 = Player(_arg2[_local10]);
_local11 = 0;
while (_local11 < _local7.size()) {
_local6 = Player(_local7.get(_local11));
_local12 = ((_arg1.getScore(_local5) - _arg1.getScore(_local5, "extra")) - _arg1.getScore(_local5, "timebonus"));
_local13 = ((_arg1.getScore(_local6) - _arg1.getScore(_local6, "extra")) - _arg1.getScore(_local6, "timebonus"));
if (_local12 > _local13){
break;
};
_local11++;
};
_local7.addI(_local11, _local5);
_local10++;
};
_local10 = 0;
while (_local10 < _local7.size()) {
_local5 = Player(_local7.get(_local10));
_local8 = texts[_local10];
_local9 = bots[_local10];
if (_local5.isLocalPlayer()){
_local9.visible = false;
if (_arg3 != null){
if (_local10 == 0){
_arg3.setMood("happy");
} else {
_arg3.setMood("sad");
};
_local17 = MovieClip(_arg3);
_local17.x = (_local9.x - (_arg3.getWidth() / 2));
_local17.y = (_local9.y - (_arg3.getHeight() / 2));
addChild(_local17);
};
_local14 = _arg1.getScore(_local5, "extra");
_local15 = _arg1.getScore(_local5, "timebonus");
_local16 = ((_arg1.getScore(_local5) - _local14) - _local15);
txt_score_value.text = ("" + _local16);
txt_extra_value.text = ("" + _local14);
txt_time_bonus_value.text = ("" + _local15);
txt_total_score_value.text = ("" + _arg1.getScore(_local5));
} else {
_local18 = BotPlayer(_local5);
_local9.visible = true;
_local19 = (_local18.getBotId() + 1);
if (_local10 >= 1){
_local19 = (_local19 + 10);
};
_local9.gotoAndStop(_local19);
};
_local10++;
};
}
public function clicked(){
this.removeEventListener(MouseEvent.CLICK, onClick);
this.buttonMode = false;
removeTick = 0;
}
}
}//package king.game.uno.view
Section 50
//BotPlayer (king.game.uno.BotPlayer)
package king.game.uno {
import king.math.*;
public class BotPlayer extends Player {
private var randomOptionalPlay_:MtRandom;
private var playableCards_:Array;
private var actRule_:Rule;
private var botId_:int;
public function BotPlayer(_arg1:Game, _arg2:String, _arg3:int, _arg4:int){
super(_arg1, _arg2, _arg3);
botId_ = _arg4;
randomOptionalPlay_ = new MtRandom((_arg1.getSeed() + _arg3));
}
override public function cardPlayed(_arg1:Card):void{
actRule_.reply();
}
override public function playCard(_arg1:Card):void{
var _local2:Boolean;
var _local3:*;
if (allowedToPlay_){
_local2 = false;
_local3 = 0;
while (_local3 < playableCards_.length) {
if (playableCards_[_local3] == _arg1){
_local2 = true;
break;
};
_local3++;
};
if (_local2){
allowedToPlay_ = false;
hand_.playCard(_arg1);
};
};
}
public function getBotId(){
return (botId_);
}
override public function actOnRule(_arg1:Rule):void{
var _local2:Card;
viewer_.actOnRule(_arg1);
if (_arg1.getType() == Rule.PLAYER_TURN_TO_ACT){
} else {
if ((((_arg1.getType() == Rule.PLAYER_PLAY_CARD)) || ((_arg1.getType() == Rule.PLAYER_PLAY_OR_DRAW_CARD)))){
if (((((_arg1.isOptional()) && ((hand_.size() > 3)))) && ((randomOptionalPlay_.nextInt(1000) > 500)))){
_arg1.reply();
} else {
allowedToPlay_ = true;
actRule_ = _arg1;
if (hand_.size() > 0){
playableCards_ = _arg1.getRules().getPlayableCards(this);
_local2 = playableCards_[0];
playCard(_local2);
};
};
} else {
if (_arg1.getType() == Rule.PLAYER_DRAW_CARD){
_arg1.reply();
} else {
if (_arg1.getType() == Rule.SHOW_HAND){
} else {
if (_arg1.getType() == Rule.CHOOSE_COLOR){
};
};
};
};
};
}
override public function clickCard(_arg1:Card):void{
playCard(_arg1);
}
}
}//package king.game.uno
Section 51
//Card (king.game.uno.Card)
package king.game.uno {
public class Card {
private var id_:int;
private var type_:int;
private var hand_:Hand;
private var rank_:int;
public var id:int;
private var color_:int;
public static var TYPE_NORMAL = 0;
public static var TYPE_TO_STRING2 = ["", "+2", "R", "¤", "W", "+4"];
public static var TYPE_TO_STRING:Array = ["NOR", "N+2", "REV", "SKP", "WLD", "W+4"];
public static var COLOR_BLUE = 0;
public static var COLOR_TO_STRING:Array = ["Blue", "Green", "Red", "Yellow", "Black"];
public static var TYPE_DRAW_TWO = 1;
public static var COLOR_BLACK = 4;
public static var TYPE_SKIP = 3;
public static var COLOR_GREEN = 1;
public static var COLOR_YELLOW = 3;
public static var TYPE_WILD_DRAW_FOUR = 5;
public static var COLOR_RED = 2;
public static var TYPE_WILD = 4;
public static var COLOR_TO_STRING2 = ["B", "G", "R", "Y", "X"];
public static var TYPE_REVERSE = 2;
public function Card(_arg1:int, _arg2:int, _arg3:int, _arg4:int){
type_ = _arg1;
color_ = _arg2;
rank_ = _arg3;
id_ = _arg4;
this.id = id_;
}
public function getRank():int{
return (rank_);
}
public function setHand(_arg1:Hand):void{
hand_ = _arg1;
}
public function getHand():Hand{
return (hand_);
}
public function getColor():int{
return (color_);
}
public function toString():String{
return (((((((TYPE_TO_STRING[type_] + " ") + rank_) + " ") + COLOR_TO_STRING[color_]) + " ") + id_));
}
public function getId():int{
return (id_);
}
public function toString2():String{
if (type_ == TYPE_NORMAL){
return ((COLOR_TO_STRING2[color_] + rank_));
};
return ((COLOR_TO_STRING2[color_] + TYPE_TO_STRING2[type_]));
}
public function getType():int{
return (type_);
}
public function getValue():int{
if (type_ == TYPE_NORMAL){
return (rank_);
};
if (type_ == TYPE_DRAW_TWO){
return (20);
};
if (type_ == TYPE_REVERSE){
return (20);
};
if (type_ == TYPE_SKIP){
return (20);
};
if (type_ == TYPE_WILD){
return (50);
};
if (type_ == TYPE_WILD_DRAW_FOUR){
return (50);
};
trace("Card.getValue - type error");
return (0);
}
}
}//package king.game.uno
Section 52
//Clock (king.game.uno.Clock)
package king.game.uno {
import king.game.uno.view.*;
public class Clock {
private var viewer_:ClockViewer;
private var maxTime_:Number;
private var stopped_:Boolean;
private var time_:Number;
public function Clock(){
time_ = 0;
stopped_ = true;
}
public function start(){
stopped_ = false;
}
public function getTime():Number{
return (time_);
}
public function stop(){
stopped_ = true;
}
public function getTimeLeft():Number{
var _local1:Number = (maxTime_ - time_);
if (_local1 < 0){
_local1 = 0;
};
return (_local1);
}
public function setMaxTime(_arg1:Number){
maxTime_ = _arg1;
if (viewer_ != null){
viewer_.setMaxTime(maxTime_);
};
}
public function setTime(_arg1:Number){
time_ = _arg1;
if (viewer_ != null){
viewer_.setTime(time_);
};
}
public function addViewer(_arg1:ClockViewer){
viewer_ = _arg1;
}
public function getMaxTime():Number{
return (maxTime_);
}
public function tick(){
if (!stopped_){
setTime((time_ + 1));
};
}
}
}//package king.game.uno
Section 53
//Dealer (king.game.uno.Dealer)
package king.game.uno {
import king.game.uno.view.*;
import king.math.*;
public class Dealer {
private var randomShuffle_:MtRandom;
private var game_:Game;
private var drawPile_:Pile;
private var viewer_:DealerViewer;// = null
private var deck_:Deck;
private var random_:MtRandom;
public function Dealer(_arg1:Deck, _arg2:uint, _arg3:Game){
deck_ = _arg1;
game_ = _arg3;
drawPile_ = new Pile();
random_ = new MtRandom(_arg2);
}
public function shuffle(_arg1=null){
var _local5:Card;
var _local2:Array = new Array();
var _local3:int = drawPile_.size();
var _local4:* = 0;
while (_local4 < _local3) {
_local5 = drawPile_.removeCard();
_local2.splice(randomShuffle_.nextInt((_local4 + 1)), 0, _local5);
_local4++;
};
drawPile_.addCards(_local2);
if (viewer_ != null){
viewer_.shuffle(_arg1);
};
}
public function addViewer(_arg1:DealerViewer){
viewer_ = _arg1;
}
public function actOnRule(_arg1:Rule):void{
if (_arg1.getType() == Rule.DEAL_CARDS_TO_PLAYER){
dealCards(_arg1.getPlayer(), _arg1.getNum(), _arg1);
} else {
if (_arg1.getType() == Rule.DEAL_CARDS_TO_TABLE){
dealCards(null, _arg1.getNum(), _arg1);
} else {
if (_arg1.getType() == Rule.TAKE_CARDS_FROM_PLAYER){
takeCardsFromPlayer(_arg1.getPlayer(), _arg1);
} else {
if (_arg1.getType() == Rule.TAKE_CARDS_FROM_TABLE){
takeCardsFromTable(_arg1);
} else {
if (_arg1.getType() == Rule.SHUFFLE){
shuffle(_arg1);
};
};
};
};
};
}
public function takeCardsFromPlayer(_arg1:Player, _arg2:Rule){
var _local3:* = null;
var _local4:Array = _arg1.getHand().getCards();
var _local5:int;
while (_local5 < _local4.length) {
_local3 = _local4[_local5];
drawPile_.addCard(_local3);
cardsLeft();
_local5++;
};
viewer_.takeCards(_arg1, _local4, _arg2);
}
public function getPile():Pile{
return (drawPile_);
}
public function cardsLeft():int{
return (drawPile_.size());
}
public function takeCardsFromTable(_arg1:Rule){
var _local3:*;
viewer_.takeCardsFromTable(_arg1);
var _local2:Array = game_.getDiscardPile().getCards();
if (_arg1.getNum() == 0){
drawPile_.addCards(_local2);
game_.getDiscardPile().clear();
} else {
_local3 = _local2.pop();
drawPile_.addCards(_local2);
game_.getDiscardPile().clear();
game_.getDiscardPile().addCard(_local3);
};
}
public function dealCards(_arg1:Player, _arg2:int, _arg3:Rule){
var _local4:* = null;
var _local5:Array = new Array();
var _local6:int;
while (_local6 < _arg2) {
_local4 = drawPile_.removeCard();
if (_local4 != null){
_local5.push(_local4);
};
_local6++;
};
viewer_.dealCards(_arg1, _local5, _arg3);
if (_arg1 != null){
_arg1.getHand().addCards(_local5);
};
}
public function startRound(){
drawPile_.clear();
drawPile_.addCards(deck_.getCards());
randomShuffle_ = new MtRandom(random_.nextInt(1000000));
}
}
}//package king.game.uno
Section 54
//Deck (king.game.uno.Deck)
package king.game.uno {
public class Deck {
private var cards_:Array;
public function Deck(){
init();
}
public function init(){
var _local3:int;
cards_ = new Array();
var _local1:int;
var _local2:int;
while (_local2 <= 3) {
var _temp1 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_NORMAL, _local2, 0, _temp1));
_local3 = 1;
while (_local3 <= 9) {
var _temp2 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_NORMAL, _local2, _local3, _temp2));
var _temp3 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_NORMAL, _local2, _local3, _temp3));
_local3++;
};
var _temp4 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_DRAW_TWO, _local2, 0, _temp4));
var _temp5 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_DRAW_TWO, _local2, 0, _temp5));
var _temp6 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_REVERSE, _local2, 0, _temp6));
var _temp7 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_REVERSE, _local2, 0, _temp7));
var _temp8 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_SKIP, _local2, 0, _temp8));
var _temp9 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_SKIP, _local2, 0, _temp9));
_local2++;
};
var _temp10 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_WILD, Card.COLOR_BLACK, 0, _temp10));
var _temp11 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_WILD, Card.COLOR_BLACK, 0, _temp11));
var _temp12 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_WILD, Card.COLOR_BLACK, 0, _temp12));
var _temp13 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_WILD, Card.COLOR_BLACK, 0, _temp13));
var _temp14 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_WILD_DRAW_FOUR, Card.COLOR_BLACK, 0, _temp14));
var _temp15 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_WILD_DRAW_FOUR, Card.COLOR_BLACK, 0, _temp15));
var _temp16 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_WILD_DRAW_FOUR, Card.COLOR_BLACK, 0, _temp16));
var _temp17 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_WILD_DRAW_FOUR, Card.COLOR_BLACK, 0, _temp17));
}
public function init2(){
cards_ = new Array();
var _local1:int;
var _local2:int;
var _temp1 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_NORMAL, _local2, 0, _temp1));
var _temp2 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_NORMAL, _local2, 1, _temp2));
var _temp3 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_NORMAL, _local2, 2, _temp3));
var _temp4 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_NORMAL, _local2, 3, _temp4));
var _temp5 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_NORMAL, _local2, 4, _temp5));
var _temp6 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_NORMAL, _local2, 5, _temp6));
var _temp7 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_NORMAL, _local2, 6, _temp7));
var _temp8 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_NORMAL, _local2, 7, _temp8));
var _temp9 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_NORMAL, _local2, 8, _temp9));
var _temp10 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_NORMAL, _local2, 9, _temp10));
var _temp11 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_NORMAL, (_local2 + 1), 0, _temp11));
var _temp12 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_NORMAL, (_local2 + 1), 1, _temp12));
var _temp13 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_NORMAL, (_local2 + 1), 2, _temp13));
var _temp14 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_NORMAL, (_local2 + 1), 3, _temp14));
var _temp15 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_NORMAL, (_local2 + 1), 4, _temp15));
var _temp16 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_NORMAL, (_local2 + 1), 5, _temp16));
var _temp17 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_NORMAL, (_local2 + 1), 6, _temp17));
var _temp18 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_NORMAL, (_local2 + 1), 7, _temp18));
var _temp19 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_NORMAL, (_local2 + 1), 8, _temp19));
var _temp20 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_NORMAL, (_local2 + 1), 9, _temp20));
var _temp21 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_DRAW_TWO, (_local2 + 0), 0, _temp21));
var _temp22 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_DRAW_TWO, (_local2 + 0), 0, _temp22));
var _temp23 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_DRAW_TWO, (_local2 + 1), 0, _temp23));
var _temp24 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_DRAW_TWO, (_local2 + 1), 0, _temp24));
var _temp25 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_DRAW_TWO, (_local2 + 2), 0, _temp25));
var _temp26 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_DRAW_TWO, (_local2 + 2), 0, _temp26));
var _temp27 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_DRAW_TWO, (_local2 + 3), 0, _temp27));
var _temp28 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_DRAW_TWO, (_local2 + 3), 0, _temp28));
var _temp29 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_WILD_DRAW_FOUR, Card.COLOR_BLACK, 0, _temp29));
var _temp30 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_WILD_DRAW_FOUR, Card.COLOR_BLACK, 0, _temp30));
var _temp31 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_WILD_DRAW_FOUR, Card.COLOR_BLACK, 0, _temp31));
var _temp32 = _local1;
_local1 = (_local1 + 1);
cards_.push(new Card(Card.TYPE_WILD_DRAW_FOUR, Card.COLOR_BLACK, 0, _temp32));
}
public function getCard(_arg1:int){
return (cards_[_arg1]);
}
public function getCards():Array{
return (cards_);
}
}
}//package king.game.uno
Section 55
//Game (king.game.uno.Game)
package king.game.uno {
import com.midasplayer.gamecomm.*;
import king.game.uno.view.*;
import king.math.*;
import com.midasplayer.text.*;
import flash.utils.*;
public class Game {
protected var endGamePressed_:Boolean;// = false
protected var viewer_:GameViewer;
protected var seed_:uint;
protected var clock_:Clock;
protected var gameData_:GameData;
protected var introClicked_:Boolean;// = false
protected var saidUno_:Boolean;// = false
protected var unoMissPlayer_:Player;// = null
protected var roundNum_:int;
protected var rules_:Rules;
protected var colorChosen_:Boolean;// = false
protected var drawCardClicked_:Boolean;// = false
protected var endGameHasBeenPressed_:Boolean;// = false
protected var gameCommunicator_:IGameComm;
protected var tick_:Number;// = 0
protected var deck_:Deck;
protected var dealer_:Dealer;
protected var clickedCard_:Card;// = null
protected var scoreBoard_:ScoreBoard;
protected var chosenColor_:int;
protected var discardPile_:Pile;
protected var players_:Array;
protected var passed_:Boolean;// = false
protected var quitted_:Boolean;// = false
protected var random_:MtRandom;
public function Game(){
var _local1:String;
super();
deck_ = new Deck();
if (GameComm.isAvailable()){
gameCommunicator_ = new GameComm();
} else {
_local1 = ((((((((((((((((((((((((((((((((((((((((((((((((((("<gamedata randomseed=\"1685808415\">" + "<music>1</music>") + "<sound>1</sound>") + "<gameMode>0</gameMode>") + "<avatarpath></avatarpath>") + "<avatar2>head3:blush1:mouth1:beard3,dda976:sweat1:eyes2:wrinkles1:eyebrows1:nose2:hair20B,dda976:glasses3:ear1:hair20A,dda976:hats8A:</avatar2>") + "<avatar>head1,955a38:blush1,955a38:mouth1,955a38:lips2,513618:sweat1,955a38:makeup7:eyes1:eyebrows1:nose4,955a38:hair14B,513618:ear1,955a38:earring6:hair14A,513618:</avatar>") + "<text id=\"game_starts\">THE GAME STARTS IN {0} SECONDS</text>") + "<text id=\"copyright\">UNO and associated trademarks and trade dress are owned by, and used under license from, Mattel, Inc. © 2009 Mattel, Inc. All Rights Reserved.</text>") + "<text id=\"intro_objectives_header\">OBJECTIVES</text>") + "<text id=\"intro_objectives_text\">The game is played in three rounds. Try to get rid of all the cards in your hand before your opponents.\nWhen its your turn try to match the card on the Discard pile, either by number, colour or symbol.</text>") + "<text id=\"intro_pass_header\">PASS BUTTON</text>") + "<text id=\"intro_pass_text\">If you don't want to play the card picked up using the draw card button you can press the pass button to end your turn without playing any card. </text>") + "<text id=\"intro_draw_header\">DRAW CARD</text>") + "<text id=\"intro_draw_text\">If you don’t have a matching card you must draw a card from the Draw pile. If the card picked up can be played, you are free to do this in the same round. Otherwise, play move to the next person in turn.</text>") + "<text id=\"intro_uno_header\">UNO™ BUTTON</text>") + "<text id=\"intro_uno_text\">When you have only one card left you must press the UNO™ button. Failure to do this results in having to pick up 2 cards from Draw pile.</text>") + "<text id=\"intro_skip_header\">SKIP</text>") + "<text id=\"intro_skip_text\">The next player to play after this card has been laid loses his/her turn and is “skipped”. Can only be played on a matching color or on another Skip card.</text>") + "<text id=\"intro_draw_two_header\">DRAW TWO</text>") + "<text id=\"intro_draw_two_text\">The next person to play must draw 2 cards and miss his/her turn. Can only be played on matching colors and other Draw Two cards.</text>") + "<text id=\"intro_reverse_header\">REVERSE</text>") + "<text id=\"intro_reverse_text\">This simply reverses direction of play. Can only be played on a matching color or on another Reverse card. </text>") + "<text id=\"intro_wild_header\">WILD</text>") + "<text id=\"intro_wild_text\">The person playing this card calls for any color to continue the play, including the one currently being played, if so desired. \nA Wild card can be played at any time even if the player has another playable card in the hand.</text>") + "<text id=\"intro_wild_draw4_header\">WILD DRAW 4</text>") + "<text id=\"intro_wild_draw4_text\">The person who plays it calls the color that continues play.\nThe next player has to pick up 4 cards from the Draw pile and miss his/her turn. \nThe card can only be played when the player holding it does not have a card in his/her hand to match the color on the Discard pile.\nIf the player holds matching numbers or Action Cards, however, the Wild Draw Four card may be played.</text>") + "<text id=\"action_skip\">SKIP</text>") + "<text id=\"action_reverse\">REVERSE</text>") + "<text id=\"action_draw2\">DRAW 2</text>") + "<text id=\"action_draw4\">DRAW 4</text>") + "<text id=\"pass\">PASS</text>") + "<text id=\"points\">POINTS</text>") + "<text id=\"extra\">EXTRA</text>") + "<text id=\"time_bonus\">TIME BONUS</text>") + "<text id=\"total_score\">TOTAL SCORE</text>") + "<text id=\"game_ends\">THE GAME ENDS IN {0} SECONDS</text>") + "<text id=\"won_round\">{0} won this round!</text>") + "<text id=\"next_round_starts\">THE NEXT ROUND STARTS IN {0} SECONDS</text>") + "<text id=\"will_start\">{0} will start the game!</text>") + "<text id=\"missed_say_uno\">You forgot to press the UNO™ button!</text>") + "<text id=\"choose_color\">Choose a color!</text>") + "<text id=\"cards_left\">CARDS LEFT</text>") + "<text id=\"bot1\">Señor Ordóñez</text>") + "<text id=\"bot2\">Monsieur Tournesol</text>") + "<text id=\"bot3\">Miss Purpleby</text>") + "<text id=\"bot4\">Signorina Carota</text>") + "<text id=\"bot5\">Mevrouw Oranje</text>") + "<text id=\"bot6\">Herr Altmann</text>") + "<text id=\"you\">You</text>") + "<text id=\"register\">Register to continue playing and complete the game!</text>") + "</gamedata>");
gameCommunicator_ = new DebugGameComm(_local1);
};
gameData_ = new GameData(gameCommunicator_.getGameData());
I18n.init(gameData_.getTexts());
seed_ = gameData_.randomSeed;
roundNum_ = 0;
random_ = new MtRandom(seed_);
discardPile_ = new Pile();
players_ = new Array();
scoreBoard_ = new ScoreBoard(players_);
rules_ = new Rules(this);
clock_ = new Clock();
}
public function drawCard(){
drawCardClicked_ = true;
}
public function reportUnoMissClicked(_arg1:int){
unoMissPlayer_ = players_[_arg1];
}
public function getPlayers():Array{
return (players_);
}
public function roundWinnerDone(){
gameCommunicator_.addPlayData((("37," + tick_) + "=0"));
}
public function addViewer(_arg1:GameViewer){
viewer_ = _arg1;
viewer_.init(this);
}
public function throwCard(_arg1:int, _arg2:Player){
var _local3:* = ((_arg2)!=null) ? _arg2.getId() : -1;
if (_arg2 != null){
_arg2.getHand().removeCardById(_arg1);
};
discardPile_.addCard(deck_.getCard(_arg1));
}
public function init(){
addDealer();
addPlayers();
clock_.setMaxTime((160 * 30));
rules_.readyToPlay();
}
public function getRoundNum():int{
return (roundNum_);
}
public function turnEnd(_arg1:int){
gameCommunicator_.addPlayData((((("40," + tick_) + " ") + _arg1) + "=0"));
}
public function getDeck():Deck{
return (deck_);
}
public function addDealer():void{
dealer_ = new Dealer(deck_, seed_, this);
viewer_.addDealer(dealer_);
}
public function getDealer():Dealer{
return (dealer_);
}
public function turnToAct(_arg1:int){
var _local2:Player = players_[_arg1];
if (_local2.isLocalPlayer()){
clock_.start();
};
gameCommunicator_.addPlayData((((("38," + tick_) + " ") + _arg1) + "=0"));
}
public function introClicked(){
if (!introClicked_){
introClicked_ = true;
gameCommunicator_.gameStart();
gameCommunicator_.addPlayData((("19,0 " + 2) + "=0"));
gameCommunicator_.addPlayData((("30," + tick_) + "=0"));
};
}
public function getTick():Number{
return (tick_);
}
public function actOnRule(_arg1:Rule):void{
var _local2:int;
var _local3:Array;
var _local4:Number;
var _local5:Player;
var _local6:Number;
if (_arg1 != null){
};
if (_arg1 == null){
} else {
if (_arg1.getType() == Rule.INFO){
if (_arg1.getMessage() == "winning_player"){
_local6 = Math.round(((200 * clock_.getTimeLeft()) / clock_.getMaxTime()));
scoreBoard_.addScore(players_[0], _local6, "timebonus");
gameCommunicator_.gameEnd(scoreBoard_.getScore(players_[0]));
gameCommunicator_.addPlayData((((("101," + tick_) + " ") + (viewer_.getMusicOn()) ? "1" : "0") + "=0"));
gameCommunicator_.addPlayData((((("102," + tick_) + " ") + (viewer_.getSoundOn()) ? "1" : "0") + "=0"));
};
viewer_.actOnRule(_arg1);
} else {
if (_arg1.getType() == Rule.LIST_OF_RULES){
_local3 = _arg1.getList();
_local2 = 0;
while (_local2 < _local3.length) {
actOnRule(_local3[_local2]);
_local2++;
};
} else {
if (_arg1.getType() == Rule.DEAL_CARDS_TO_PLAYER){
dealer_.actOnRule(_arg1);
} else {
if (_arg1.getType() == Rule.DEAL_CARDS_TO_TABLE){
dealer_.actOnRule(_arg1);
} else {
if (_arg1.getType() == Rule.PLAYER_TURN_TO_ACT){
viewer_.actOnRule(_arg1);
} else {
if (_arg1.getType() == Rule.PLAYER_TURN_END){
viewer_.actOnRule(_arg1);
if (_arg1.getPlayer().isLocalPlayer()){
clock_.stop();
};
turnEnd(_arg1.getPlayer().getId());
} else {
if (_arg1.getType() == Rule.PLAYER_PLAY_CARD){
viewer_.actOnRule(_arg1);
} else {
if (_arg1.getType() == Rule.PLAYER_DRAW_CARD){
if (((!(_arg1.getPlayer().isLocalPlayer())) && ((rules_.getPlayerPlayedLastCard() == players_[0])))){
scoreBoard_.addScore(players_[0], 1, "extra");
};
viewer_.actOnRule(_arg1);
} else {
if (_arg1.getType() == Rule.PLAYER_PLAY_OR_DRAW_CARD){
viewer_.actOnRule(_arg1);
} else {
if (_arg1.getType() == Rule.PLAYER_SAY_UNO){
viewer_.actOnRule(_arg1);
} else {
if (_arg1.getType() == Rule.PLAYER_SKIPPED){
viewer_.actOnRule(_arg1);
} else {
if (_arg1.getType() == Rule.CHOOSE_COLOR){
viewer_.actOnRule(_arg1);
} else {
if (_arg1.getType() == Rule.PLAY_DIRECTION_CHANGE){
viewer_.actOnRule(_arg1);
} else {
if (_arg1.getType() == Rule.SHOW_HAND){
viewer_.actOnRule(_arg1);
} else {
if (_arg1.getType() == Rule.TAKE_CARDS_FROM_PLAYER){
dealer_.actOnRule(_arg1);
} else {
if (_arg1.getType() == Rule.TAKE_CARDS_FROM_TABLE){
dealer_.actOnRule(_arg1);
} else {
if (_arg1.getType() == Rule.SHUFFLE){
dealer_.actOnRule(_arg1);
} else {
if (_arg1.getType() == Rule.PLAYER_ADD_SCORE){
scoreBoard_.addScore(_arg1.getPlayer(), _arg1.getNum(), ("round" + roundNum_));
_arg1.reply();
} else {
if (_arg1.getType() == Rule.PLAYER_DRAW_CARD_PENALTY){
if (((!(_arg1.getPlayer().isLocalPlayer())) && ((rules_.getPlayerPlayedLastCard() == players_[0])))){
scoreBoard_.addScore(players_[0], _arg1.getNum(), "extra");
};
viewer_.actOnRule(_arg1);
} else {
if (_arg1.getType() == Rule.START_ROUND){
roundNum_ = _arg1.getNum();
dealer_.startRound();
viewer_.actOnRule(_arg1);
} else {
if (_arg1.getType() == Rule.TIME_OVER){
viewer_.actOnRule(_arg1);
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
}
public function colorChosen(_arg1:int){
colorChosen_ = true;
chosenColor_ = _arg1;
}
public function clickCard(_arg1:int){
clickedCard_ = deck_.getCard(_arg1);
}
public function getGameData():GameData{
return (gameData_);
}
public function reportUnoMiss(_arg1:int){
gameCommunicator_.addPlayData((((("39," + tick_) + " ") + _arg1) + "=0"));
}
public function tick(_arg1:Number):void{
tick_ = _arg1;
if (clickedCard_ != null){
players_[0].playCard(clickedCard_);
gameCommunicator_.addPlayData((((("31," + tick_) + " ") + clickedCard_.getId()) + "=0"));
clickedCard_ = null;
};
if (drawCardClicked_){
drawCardClicked_ = false;
players_[0].drawCard();
gameCommunicator_.addPlayData((("35," + tick_) + "=0"));
};
if (saidUno_){
saidUno_ = false;
players_[0].saidUno();
gameCommunicator_.addPlayData((("33," + tick_) + "=0"));
};
if (passed_){
passed_ = false;
players_[0].passed();
gameCommunicator_.addPlayData((("34," + tick_) + "=0"));
};
if (colorChosen_){
colorChosen_ = false;
players_[0].colorChosen(chosenColor_);
gameCommunicator_.addPlayData((((("32," + tick_) + " ") + chosenColor_) + "=0"));
};
if (unoMissPlayer_ != null){
gameCommunicator_.addPlayData((((("41," + tick_) + " ") + unoMissPlayer_.getId()) + "=0"));
rules_.reportUnoMiss(players_[0], unoMissPlayer_);
unoMissPlayer_ = null;
};
if (endGamePressed_){
endGamePressed_ = false;
gameCommunicator_.addPlayData(((("50," + tick_) + " ") + "=0"));
if (clock_.getTime() < clock_.getMaxTime()){
clock_.setTime(clock_.getMaxTime());
};
};
var _local2:Rule = rules_.getNextRule();
actOnRule(_local2);
clock_.tick();
if (clock_.getTimeLeft() == 0){
rules_.timeOver();
};
}
public function getRules():Rules{
return (rules_);
}
public function drawWinnerDone(){
gameCommunicator_.addPlayData((("36," + tick_) + "=0"));
}
public function getDiscardPile():Pile{
return (discardPile_);
}
public function saidUno(){
saidUno_ = true;
}
public function addPlayers():void{
var _local1:HumanPlayer = new HumanPlayer(this, "human", 0);
_local1.setIsLocalPlayer(true);
addPlayer(_local1);
var _local2:BotPlayer = new BotPlayer(this, "bot1", 1, random_.nextInt(3));
addPlayer(_local2);
var _local3:BotPlayer = new BotPlayer(this, "bot2", 2, (3 + random_.nextInt(3)));
addPlayer(_local3);
}
public function quitGame():void{
if (!quitted_){
quitted_ = true;
setTimeout(gameCommunicator_.gameQuit, 100);
};
}
public function hasEndGameBeenPressed(){
return (endGameHasBeenPressed_);
}
public function addPlayer(_arg1:Player):void{
players_.push(_arg1);
viewer_.addPlayer(_arg1);
}
public function getScoreBoard():ScoreBoard{
return (scoreBoard_);
}
public function getGameCommunicator():IGameComm{
return (gameCommunicator_);
}
public function getClock():Clock{
return (clock_);
}
public function playCard(_arg1:int){
}
public function endGamePressed(){
endGamePressed_ = true;
endGameHasBeenPressed_ = true;
}
public function passed(){
passed_ = true;
}
public function getSeed():uint{
return (seed_);
}
}
}//package king.game.uno
Section 56
//Hand (king.game.uno.Hand)
package king.game.uno {
import king.game.uno.view.*;
public class Hand extends Pile {
private var sort_:int;
private var lastAddedCard_:Card;// = null
private var viewer_:HandViewer;
private var player_:Player;
public static var SORT_NONE:int = 0;
public static var SORT_COLOR:int = 1;
public function Hand(_arg1:Player){
sort_ = SORT_NONE;
super();
player_ = _arg1;
}
public function setSort(_arg1:int){
sort_ = _arg1;
}
public function playCard(_arg1:Card){
var _local2:* = 0;
while (_local2 < cards_.length) {
if (cards_[_local2] == _arg1){
viewer_.playCard(_arg1);
return;
};
_local2++;
};
}
public function getLastAddedCard():Card{
return (lastAddedCard_);
}
public function getViewer():HandViewer{
return (viewer_);
}
public function addViewer(_arg1:HandViewer){
viewer_ = _arg1;
}
override public function addCard(_arg1:Card){
super.addCard(_arg1);
lastAddedCard_ = _arg1;
_arg1.setHand(this);
viewer_.addCard(_arg1);
sort();
}
public function sort(){
if (sort_ == SORT_COLOR){
cards_ = cards_.sortOn("id", (Array.DESCENDING | Array.NUMERIC));
};
}
public function getPlayer():Player{
return (player_);
}
}
}//package king.game.uno
Section 57
//HumanPlayer (king.game.uno.HumanPlayer)
package king.game.uno {
public class HumanPlayer extends Player {
private var playableCards_:Array;
private var actRule_:Rule;
private var chooseColorRule_:Rule;
private var unoRule_:Rule;
public function HumanPlayer(_arg1:Game, _arg2:String, _arg3:int){
super(_arg1, _arg2, _arg3);
this.getHand().setSort(Hand.SORT_COLOR);
}
override public function cardPlayed(_arg1:Card):void{
actRule_.reply();
}
override public function playCard(_arg1:Card):void{
viewer_.playCard(_arg1);
hand_.playCard(_arg1);
}
override public function saidUno():void{
unoRule_.setNum(1);
unoRule_.reply();
}
override public function actOnRule(_arg1:Rule):void{
viewer_.actOnRule(_arg1);
if (_arg1.getType() == Rule.PLAYER_TURN_TO_ACT){
} else {
if (_arg1.getType() == Rule.PLAYER_PLAY_CARD){
playableCards_ = _arg1.getRules().getPlayableCards(this);
allowedToPlay_ = true;
actRule_ = _arg1;
} else {
if (_arg1.getType() == Rule.PLAYER_PLAY_OR_DRAW_CARD){
playableCards_ = _arg1.getRules().getPlayableCards(this);
allowedToPlay_ = true;
actRule_ = _arg1;
} else {
if (_arg1.getType() == Rule.PLAYER_DRAW_CARD){
actRule_ = _arg1;
} else {
if (_arg1.getType() == Rule.SHOW_HAND){
} else {
if (_arg1.getType() == Rule.CHOOSE_COLOR){
chooseColorRule_ = _arg1;
} else {
if (_arg1.getType() == Rule.PLAYER_SAY_UNO){
unoRule_ = _arg1;
_arg1.setNum(0);
_arg1.reply();
};
};
};
};
};
};
};
}
override public function passed():void{
actRule_.reply();
}
override public function colorChosen(_arg1:int):void{
chooseColorRule_.setNum(_arg1);
chooseColorRule_.reply();
viewer_.colorChosen(_arg1);
}
override public function clickCard(_arg1:Card):void{
var _local2:Boolean;
var _local3:*;
if (allowedToPlay_){
_local2 = false;
_local3 = 0;
while (_local3 < playableCards_.length) {
if (playableCards_[_local3] == _arg1){
_local2 = true;
break;
};
_local3++;
};
if (_local2){
game_.clickCard(_arg1.getId());
allowedToPlay_ = false;
viewer_.clickCard(_arg1);
} else {
viewer_.wrongPlay(_arg1);
};
};
}
override public function drawCard():void{
actRule_.reply();
}
}
}//package king.game.uno
Section 58
//Library (king.game.uno.Library)
package king.game.uno {
import flash.display.*;
public class Library {
private static var cardBitmaps_:Array = new Array(new Array(13), new Array(13), new Array(13), new Array(13), new Array(3));
public static function getCardFadeBitmap():Bitmap{
return (cardBitmaps_[Card.COLOR_BLACK][3]);
}
public static function getCardBackBitmap():Bitmap{
return (cardBitmaps_[Card.COLOR_BLACK][2]);
}
public static function getCardBitmap(_arg1:int, _arg2:int, _arg3:int):Bitmap{
var _local4:int = _arg3;
if (_arg1 != Card.TYPE_NORMAL){
if (_arg1 == Card.TYPE_DRAW_TWO){
_local4 = 10;
} else {
if (_arg1 == Card.TYPE_REVERSE){
_local4 = 11;
} else {
if (_arg1 == Card.TYPE_SKIP){
_local4 = 12;
} else {
if (_arg1 == Card.TYPE_WILD){
_local4 = 0;
_arg2 = Card.COLOR_BLACK;
} else {
if (_arg1 == Card.TYPE_WILD_DRAW_FOUR){
_local4 = 1;
_arg2 = Card.COLOR_BLACK;
};
};
};
};
};
};
return (cardBitmaps_[_arg2][_local4]);
}
cardBitmaps_[Card.COLOR_BLUE][0] = new Bitmap(new blue_0(0, 0));
cardBitmaps_[Card.COLOR_BLUE][1] = new Bitmap(new blue_1(0, 0));
cardBitmaps_[Card.COLOR_BLUE][2] = new Bitmap(new blue_2(0, 0));
cardBitmaps_[Card.COLOR_BLUE][3] = new Bitmap(new blue_3(0, 0));
cardBitmaps_[Card.COLOR_BLUE][4] = new Bitmap(new blue_4(0, 0));
cardBitmaps_[Card.COLOR_BLUE][5] = new Bitmap(new blue_5(0, 0));
cardBitmaps_[Card.COLOR_BLUE][6] = new Bitmap(new blue_6(0, 0));
cardBitmaps_[Card.COLOR_BLUE][7] = new Bitmap(new blue_7(0, 0));
cardBitmaps_[Card.COLOR_BLUE][8] = new Bitmap(new blue_8(0, 0));
cardBitmaps_[Card.COLOR_BLUE][9] = new Bitmap(new blue_9(0, 0));
cardBitmaps_[Card.COLOR_BLUE][10] = new Bitmap(new blue_draw_two_card(0, 0));
cardBitmaps_[Card.COLOR_BLUE][11] = new Bitmap(new blue_reverse_card(0, 0));
cardBitmaps_[Card.COLOR_BLUE][12] = new Bitmap(new blue_skip_card(0, 0));
cardBitmaps_[Card.COLOR_GREEN][0] = new Bitmap(new green_0(0, 0));
cardBitmaps_[Card.COLOR_GREEN][1] = new Bitmap(new green_1(0, 0));
cardBitmaps_[Card.COLOR_GREEN][2] = new Bitmap(new green_2(0, 0));
cardBitmaps_[Card.COLOR_GREEN][3] = new Bitmap(new green_3(0, 0));
cardBitmaps_[Card.COLOR_GREEN][4] = new Bitmap(new green_4(0, 0));
cardBitmaps_[Card.COLOR_GREEN][5] = new Bitmap(new green_5(0, 0));
cardBitmaps_[Card.COLOR_GREEN][6] = new Bitmap(new green_6(0, 0));
cardBitmaps_[Card.COLOR_GREEN][7] = new Bitmap(new green_7(0, 0));
cardBitmaps_[Card.COLOR_GREEN][8] = new Bitmap(new green_8(0, 0));
cardBitmaps_[Card.COLOR_GREEN][9] = new Bitmap(new green_9(0, 0));
cardBitmaps_[Card.COLOR_GREEN][10] = new Bitmap(new green_draw_two_card(0, 0));
cardBitmaps_[Card.COLOR_GREEN][11] = new Bitmap(new green_reverse_card(0, 0));
cardBitmaps_[Card.COLOR_GREEN][12] = new Bitmap(new green_skip_card(0, 0));
cardBitmaps_[Card.COLOR_RED][0] = new Bitmap(new red_0(0, 0));
cardBitmaps_[Card.COLOR_RED][1] = new Bitmap(new red_1(0, 0));
cardBitmaps_[Card.COLOR_RED][2] = new Bitmap(new red_2(0, 0));
cardBitmaps_[Card.COLOR_RED][3] = new Bitmap(new red_3(0, 0));
cardBitmaps_[Card.COLOR_RED][4] = new Bitmap(new red_4(0, 0));
cardBitmaps_[Card.COLOR_RED][5] = new Bitmap(new red_5(0, 0));
cardBitmaps_[Card.COLOR_RED][6] = new Bitmap(new red_6(0, 0));
cardBitmaps_[Card.COLOR_RED][7] = new Bitmap(new red_7(0, 0));
cardBitmaps_[Card.COLOR_RED][8] = new Bitmap(new red_8(0, 0));
cardBitmaps_[Card.COLOR_RED][9] = new Bitmap(new red_9(0, 0));
cardBitmaps_[Card.COLOR_RED][10] = new Bitmap(new red_draw_two_card(0, 0));
cardBitmaps_[Card.COLOR_RED][11] = new Bitmap(new red_reverse_card(0, 0));
cardBitmaps_[Card.COLOR_RED][12] = new Bitmap(new red_skip_card(0, 0));
cardBitmaps_[Card.COLOR_YELLOW][0] = new Bitmap(new yellow_0(0, 0));
cardBitmaps_[Card.COLOR_YELLOW][1] = new Bitmap(new yellow_1(0, 0));
cardBitmaps_[Card.COLOR_YELLOW][2] = new Bitmap(new yellow_2(0, 0));
cardBitmaps_[Card.COLOR_YELLOW][3] = new Bitmap(new yellow_3(0, 0));
cardBitmaps_[Card.COLOR_YELLOW][4] = new Bitmap(new yellow_4(0, 0));
cardBitmaps_[Card.COLOR_YELLOW][5] = new Bitmap(new yellow_5(0, 0));
cardBitmaps_[Card.COLOR_YELLOW][6] = new Bitmap(new yellow_6(0, 0));
cardBitmaps_[Card.COLOR_YELLOW][7] = new Bitmap(new yellow_7(0, 0));
cardBitmaps_[Card.COLOR_YELLOW][8] = new Bitmap(new yellow_8(0, 0));
cardBitmaps_[Card.COLOR_YELLOW][9] = new Bitmap(new yellow_9(0, 0));
cardBitmaps_[Card.COLOR_YELLOW][10] = new Bitmap(new yellow_draw_two_card(0, 0));
cardBitmaps_[Card.COLOR_YELLOW][11] = new Bitmap(new yellow_reverse_card(0, 0));
cardBitmaps_[Card.COLOR_YELLOW][12] = new Bitmap(new yellow_skip_card(0, 0));
cardBitmaps_[Card.COLOR_BLACK][0] = new Bitmap(new wild_draw_four_card(0, 0));
cardBitmaps_[Card.COLOR_BLACK][1] = new Bitmap(new wild_card(0, 0));
cardBitmaps_[Card.COLOR_BLACK][2] = new Bitmap(new back(0, 0));
cardBitmaps_[Card.COLOR_BLACK][3] = new Bitmap(new fade(0, 0));
}
}//package king.game.uno
Section 59
//Main (king.game.uno.Main)
package king.game.uno {
import king.game.uno.view.*;
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.utils.*;
public class Main extends Sprite {
public var fpsMeter:TextField;
private var tick_;
private var lastTime:Number;// = -1
private var gameView_:GameView;
private var fps:int;
private var game_:Game;
private var tickCount:int;// = 0
private var frames:int;
private static var MAX_TICKS_PER_FRAME:int = 10;
private static var TICKS_PER_SECOND:int = 30;
public function Main(){
stage.quality = "medium";
stage.scaleMode = "noScale";
this.mouseEnabled = false;
tick_ = 0;
start();
}
public function advanceTime(_arg1:Event):void{
var _local2:Number = getTimer();
if (lastTime < 0){
lastTime = _local2;
};
var _local3:Number = (1000 / TICKS_PER_SECOND);
var _local4:int;
while ((_local2 - lastTime) > _local3) {
var _temp1 = _local4;
_local4 = (_local4 + 1);
if (_temp1 < MAX_TICKS_PER_FRAME){
if (game_ != null){
game_.tick(tick_);
};
if (gameView_ != null){
gameView_.tick(tick_);
};
tick_++;
};
lastTime = (lastTime + _local3);
tickCount++;
if ((tickCount % TICKS_PER_SECOND) == 0){
fps = frames;
frames = 0;
};
};
var _local5:Number = ((_local2 - lastTime) / _local3);
if (gameView_ != null){
gameView_.render(tick_, _local5);
};
frames++;
}
public function start(){
game_ = new Game();
gameView_ = new GameView(this);
game_.addViewer(gameView_);
game_.init();
addEventListener(Event.ENTER_FRAME, advanceTime);
}
}
}//package king.game.uno
Section 60
//Pile (king.game.uno.Pile)
package king.game.uno {
public class Pile {
protected var cards_:Array;
public function Pile(){
cards_ = new Array();
}
public function size():int{
return (cards_.length);
}
public function addCard(_arg1:Card){
cards_.push(_arg1);
}
public function addCards(_arg1:Array){
var _local2:int;
while (_local2 < _arg1.length) {
addCard(_arg1[_local2]);
_local2++;
};
}
public function removeCard():Card{
var _local1:* = null;
if (size() > 0){
_local1 = cards_.shift();
} else {
trace("Pile.removeCard: Pile is empty.");
};
return (_local1);
}
public function clear():void{
cards_.splice(0, cards_.length);
}
public function removeCardById(_arg1:int):void{
var _local2:Card;
var _local3:* = 0;
while (_local3 < cards_.length) {
_local2 = cards_[_local3];
if (_local2.getId() == _arg1){
cards_.splice(_local3, 1);
return;
};
_local3++;
};
trace("Pile.removeCardById: Id not found.");
}
public function toString():String{
var _local3:Card;
var _local1 = "";
var _local2:* = 0;
while (_local2 < cards_.length) {
_local3 = cards_[_local2];
_local1 = (_local1 + (_local3.toString2() + ", "));
_local2++;
};
return (_local1);
}
public function getCards():Array{
return (cards_);
}
}
}//package king.game.uno
Section 61
//Player (king.game.uno.Player)
package king.game.uno {
import king.game.uno.view.*;
public class Player {
protected var viewer_:PlayerViewer;
protected var hand_:Hand;
protected var id_:int;
protected var allowedToPlay_:Boolean;// = false
protected var name_:String;
protected var game_:Game;
protected var isLocalPlayer_:Boolean;
public function Player(_arg1:Game, _arg2:String, _arg3:int){
game_ = _arg1;
name_ = _arg2;
id_ = _arg3;
hand_ = new Hand(this);
isLocalPlayer_ = false;
}
public function getName():String{
return (name_);
}
public function cardPlayed(_arg1:Card):void{
}
public function getViewer():PlayerViewer{
return (viewer_);
}
public function getId():int{
return (id_);
}
public function addViewer(_arg1:PlayerViewer){
viewer_ = _arg1;
}
public function saidUno():void{
}
public function disallowPlay():void{
allowedToPlay_ = false;
}
public function isLocalPlayer():Boolean{
return (isLocalPlayer_);
}
public function getHand():Hand{
return (hand_);
}
public function setIsLocalPlayer(_arg1:Boolean){
isLocalPlayer_ = _arg1;
}
public function playCard(_arg1:Card):void{
}
public function toString():String{
return (name_);
}
public function actOnRule(_arg1:Rule):void{
}
public function passed():void{
}
public function colorChosen(_arg1:int):void{
}
public function clickCard(_arg1:Card):void{
}
public function drawCard():void{
}
}
}//package king.game.uno
Section 62
//Rule (king.game.uno.Rule)
package king.game.uno {
public class Rule {
private var list_:Array;// = null
private var replied_:Boolean;// = false
private var rules_:Rules;
private var num_:Number;// = 0
private var player_:Player;// = null
private var type_:int;
private var message_:String;// = ""
private var optional_:Boolean;// = false
public static var START_ROUND = 20;
public static var PLAYER_SKIPPED = 13;
public static var PLAYER_WON_ROUND = 16;
public static var PLAYER_SAY_UNO = 15;
public static var PLAYER_DRAW_CARD = 14;
public static var PLAYER_TURN_TO_ACT = 3;
public static var TAKE_CARDS_FROM_TABLE = 17;
public static var TIME_OVER = 22;
public static var DEAL_CARDS_TO_PLAYER = 5;
public static var PLAYER_TURN_END = 4;
public static var SHUFFLE = 11;
public static var CHOOSE_COLOR = 12;
public static var PLAYER_PLAY_CARD = 7;
public static var PLAYER_PLAY_OR_DRAW_CARD = 18;
public static var PLAYER_ADD_SCORE = 19;
public static var DEAL_CARDS_TO_TABLE = 6;
public static var LIST_OF_RULES = 2;
public static var TAKE_CARDS_FROM_PLAYER = 10;
public static var INFO = 1;
public static var PLAYER_DRAW_CARD_PENALTY = 21;
public static var SHOW_HAND = 9;
public static var PLAY_DIRECTION_CHANGE = 8;
public function Rule(_arg1:Rules, _arg2:int){
rules_ = _arg1;
type_ = _arg2;
}
public function setNum(_arg1:Number):void{
num_ = _arg1;
}
public function setMessage(_arg1:String):void{
message_ = _arg1;
}
public function getRules():Rules{
return (rules_);
}
public function addToList(_arg1){
if (list_ == null){
list_ = new Array();
};
list_.push(_arg1);
}
public function getMessage():String{
return (message_);
}
public function getList():Array{
return (list_);
}
public function getPlayer():Player{
return (player_);
}
public function getNum():Number{
return (num_);
}
public function setPlayer(_arg1:Player){
player_ = _arg1;
}
public function reply(){
if (replied_){
trace("ERROR: Already replied!!!!!!!!!!!!");
};
replied_ = true;
rules_.replyOnRule(this);
}
public function setIsOptional(_arg1:Boolean):void{
optional_ = _arg1;
}
public function isOptional():Boolean{
return (optional_);
}
public function getType():int{
return (type_);
}
public function hasBeenReplied():Boolean{
var _local1:*;
if (type_ == LIST_OF_RULES){
_local1 = 0;
while (_local1 < list_.length) {
if (!list_[_local1].hasBeenReplied()){
return (false);
};
_local1++;
};
return (true);
//unresolved jump
};
return (replied_);
}
public function toString():String{
var _local1 = "";
_local1 = (_local1 + (type_ + " "));
if (message_.length > 0){
_local1 = (_local1 + (message_ + " "));
};
if (player_ != null){
_local1 = (_local1 + (player_.getName() + " "));
};
_local1 = (_local1 + (num_ + " "));
return (_local1);
}
}
}//package king.game.uno
Section 63
//Rules (king.game.uno.Rules)
package king.game.uno {
import king.util.*;
public class Rules {
private var lastDrawnCard_:Card;// = null
private var drawPile_:Pile;
private var STATE_SHOW_HANDS;// = 14
private var STATE_PLAYER_WON_ROUND;// = 10
private var STATE_HAS_DRAWN_CARD;// = 8
private var turnDirection_:int;
private var playerPlayedLastCard_:Player;// = null
private var game_:Game;
private var previousColor_:int;// = -1
private var declaredColor_:int;
private var STATE_TIME_OVER;// = 13
private var STATE_PLAYER_HAS_ACTED;// = 9
private var hasDrawn_:Boolean;// = false
private var STATE_GAME_OVER;// = 12
private var awaitingReplies_:ArrayList;
private var roundNum_:int;
private var STATE_START_NEXT_ROUND;// = 11
private var discardCard_:Card;// = null
private var outgoingRules_:Array;// = null
private var STATE_ACT_ON_CARD;// = 6
private var maxRounds_:int;
private var outgoingRule_:Rule;// = null
private var STATE_INIT_DISCARD_PILE;// = 4
private var STATE_START_GAME;// = 0
private var STATE_PLAYER_TURN_TO_ACT;// = 5
private var STATE_DEAL_INITIAL_CARDS;// = 3
private var STATE_START_ROUND;// = 1
private var players_:Array;
private var currentPlayerNum_:int;
private var STATE_DECIDE_STARTING_PLAYER;// = 2
private var STATE_PLAY_ON_CARD;// = 7
private var hasSaidUno_:Array;
private var state_:int;
public function Rules(_arg1:Game){
game_ = _arg1;
currentPlayerNum_ = 0;
turnDirection_ = 0;
outgoingRule_ = null;
outgoingRules_ = new Array();
awaitingReplies_ = new ArrayList();
hasSaidUno_ = new Array();
roundNum_ = 0;
maxRounds_ = 3;
state_ = STATE_START_GAME;
}
public function actOnState(){
var _local7:int;
var _local8:Player;
var _local9:*;
var _local10:int;
var _local11:Player;
var _local12:int;
var _local1:Array;
var _local2:Rule;
var _local3:Rule;
var _local4:Player;
var _local5:Card;
var _local6:int;
if (state_ == STATE_START_GAME){
state_ = STATE_START_ROUND;
players_ = game_.getPlayers();
_local2 = new Rule(this, Rule.START_ROUND);
_local2.setNum(roundNum_);
outgoingRules_.push(_local2);
_local2 = new Rule(this, Rule.INFO);
_local2.setMessage("round starts");
outgoingRules_.push(_local2);
_local2 = new Rule(this, Rule.SHUFFLE);
outgoingRules_.push(_local2);
} else {
if (state_ == STATE_START_ROUND){
state_ = STATE_DECIDE_STARTING_PLAYER;
_local9 = 0;
while (_local9 < players_.length) {
hasSaidUno_.push(0);
_local9++;
};
hasDrawn_ = false;
lastDrawnCard_ = null;
previousColor_ = -1;
playerPlayedLastCard_ = null;
discardCard_ = null;
prepareDrawPileForDecidingCards();
_local2 = new Rule(this, Rule.LIST_OF_RULES);
_local9 = 0;
while (_local9 < players_.length) {
_local1 = dealCardsRules(players_[_local9], 1);
_local10 = 0;
while (_local10 < _local1.length) {
_local2.addToList(_local1[_local10]);
_local10++;
};
_local9++;
};
outgoingRules_.push(_local2);
_local2 = new Rule(this, Rule.LIST_OF_RULES);
_local9 = 0;
while (_local9 < players_.length) {
_local3 = new Rule(this, Rule.SHOW_HAND);
_local3.setPlayer(players_[_local9]);
_local3.setNum(0);
_local2.addToList(_local3);
_local9++;
};
outgoingRules_.push(_local2);
if ((((roundNum_ > 0)) && ((game_.getGameData().getElementTextAsInt("gameMode") == 1)))){
state_ = STATE_GAME_OVER;
_local2 = new Rule(this, Rule.INFO);
_local2.setMessage("register_to_play");
outgoingRules_.push(_local2);
};
} else {
if (state_ == STATE_DECIDE_STARTING_PLAYER){
state_ = STATE_DEAL_INITIAL_CARDS;
_local11 = getWinningDrawPlayer();
currentPlayerNum_ = _local11.getId();
_local2 = new Rule(this, Rule.INFO);
_local2.setMessage("winning_draw_player");
_local2.setPlayer(_local11);
outgoingRules_.push(_local2);
turnDirection_ = 1;
_local2 = new Rule(this, Rule.LIST_OF_RULES);
_local9 = 0;
while (_local9 < players_.length) {
_local3 = new Rule(this, Rule.TAKE_CARDS_FROM_PLAYER);
_local3.setPlayer(players_[getNextPlayerNum((currentPlayerNum_ + _local9))]);
_local2.addToList(_local3);
_local9++;
};
outgoingRules_.push(_local2);
_local2 = new Rule(this, Rule.SHUFFLE);
outgoingRules_.push(_local2);
_local2 = new Rule(this, Rule.INFO);
_local2.setMessage("dealing initial cards");
outgoingRules_.push(_local2);
_local2 = new Rule(this, Rule.LIST_OF_RULES);
_local9 = 0;
while (_local9 < players_.length) {
_local1 = dealCardsRules(players_[getNextPlayerNum(((currentPlayerNum_ + _local9) - 1))], 7);
_local10 = 0;
while (_local10 < _local1.length) {
_local2.addToList(_local1[_local10]);
_local10++;
};
_local9++;
};
outgoingRules_.push(_local2);
turnDirection_ = 0;
} else {
if (state_ == STATE_DEAL_INITIAL_CARDS){
state_ = STATE_ACT_ON_CARD;
prepareDrawPileForStartingCard();
_local2 = new Rule(this, Rule.DEAL_CARDS_TO_TABLE);
_local2.setNum(1);
outgoingRules_.push(_local2);
_local2 = new Rule(this, Rule.PLAY_DIRECTION_CHANGE);
_local2.setPlayer(players_[_local7]);
_local2.setNum(1);
outgoingRules_.push(_local2);
} else {
if (state_ == STATE_ACT_ON_CARD){
lastDrawnCard_ = null;
_local7 = getNextPlayerNum(currentPlayerNum_);
_local8 = players_[_local7];
if (turnDirection_ == 0){
turnDirection_ = 1;
};
_local4 = players_[currentPlayerNum_];
if (_local4.getHand().size() == 0){
state_ = STATE_PLAYER_WON_ROUND;
actOnState();
return;
};
_local5 = getDiscardCard();
if (_local5 != discardCard_){
discardCard_ = _local5;
hasDrawn_ = false;
playerPlayedLastCard_ = _local4;
if (_local5.getType() == Card.TYPE_DRAW_TWO){
previousColor_ = _local5.getColor();
_local2 = new Rule(this, Rule.PLAYER_TURN_TO_ACT);
_local2.setPlayer(players_[_local7]);
_local2.setNum(currentPlayerNum_);
outgoingRules_.push(_local2);
_local2 = new Rule(this, Rule.PLAYER_DRAW_CARD_PENALTY);
_local2.setPlayer(players_[_local7]);
_local2.setNum(2);
outgoingRules_.push(_local2);
_local1 = dealCardsRules(_local8, 2);
_local10 = 0;
while (_local10 < _local1.length) {
outgoingRules_.push(_local1[_local10]);
_local10++;
};
_local2 = new Rule(this, Rule.PLAYER_TURN_END);
_local2.setPlayer(_local8);
outgoingRules_.push(_local2);
_local2 = new Rule(this, Rule.PLAYER_TURN_TO_ACT);
_local2.setPlayer(players_[getNextPlayerNum(_local7)]);
_local2.setNum(_local7);
outgoingRules_.push(_local2);
currentPlayerNum_ = getNextPlayerNum(_local7);
return;
} else {
if (_local5.getType() == Card.TYPE_WILD){
_local2 = new Rule(this, Rule.CHOOSE_COLOR);
_local2.setPlayer(players_[currentPlayerNum_]);
_local2.setNum(previousColor_);
outgoingRules_.push(_local2);
_local2 = new Rule(this, Rule.PLAYER_TURN_TO_ACT);
_local2.setPlayer(players_[_local7]);
_local2.setNum(currentPlayerNum_);
outgoingRules_.push(_local2);
currentPlayerNum_ = _local7;
return;
};
if (_local5.getType() == Card.TYPE_WILD_DRAW_FOUR){
_local2 = new Rule(this, Rule.PLAYER_DRAW_CARD_PENALTY);
_local2.setPlayer(players_[_local7]);
_local2.setNum(4);
outgoingRules_.push(_local2);
_local1 = dealCardsRules(_local8, 4);
_local10 = 0;
while (_local10 < _local1.length) {
outgoingRules_.push(_local1[_local10]);
_local10++;
};
_local2 = new Rule(this, Rule.CHOOSE_COLOR);
_local2.setPlayer(players_[currentPlayerNum_]);
_local2.setNum(previousColor_);
outgoingRules_.push(_local2);
_local2 = new Rule(this, Rule.PLAYER_TURN_TO_ACT);
_local2.setPlayer(players_[_local7]);
_local2.setNum(currentPlayerNum_);
outgoingRules_.push(_local2);
_local2 = new Rule(this, Rule.PLAYER_TURN_END);
_local2.setPlayer(_local8);
outgoingRules_.push(_local2);
_local2 = new Rule(this, Rule.PLAYER_TURN_TO_ACT);
_local2.setPlayer(players_[getNextPlayerNum(_local7)]);
_local2.setNum(_local7);
outgoingRules_.push(_local2);
currentPlayerNum_ = getNextPlayerNum(_local7);
return;
} else {
if (_local5.getType() == Card.TYPE_SKIP){
previousColor_ = _local5.getColor();
_local2 = new Rule(this, Rule.PLAYER_SKIPPED);
_local2.setPlayer(players_[_local7]);
outgoingRules_.push(_local2);
_local2 = new Rule(this, Rule.PLAYER_TURN_TO_ACT);
_local2.setPlayer(players_[_local7]);
_local2.setNum(currentPlayerNum_);
outgoingRules_.push(_local2);
_local2 = new Rule(this, Rule.PLAYER_TURN_END);
_local2.setPlayer(players_[_local7]);
outgoingRules_.push(_local2);
_local2 = new Rule(this, Rule.PLAYER_TURN_TO_ACT);
_local2.setPlayer(players_[getNextPlayerNum(_local7)]);
_local2.setNum(_local7);
outgoingRules_.push(_local2);
currentPlayerNum_ = getNextPlayerNum(_local7);
return;
};
if (_local5.getType() == Card.TYPE_REVERSE){
previousColor_ = _local5.getColor();
turnDirection_ = (turnDirection_ * -1);
_local2 = new Rule(this, Rule.PLAY_DIRECTION_CHANGE);
_local2.setPlayer(players_[_local7]);
_local2.setNum(turnDirection_);
outgoingRules_.push(_local2);
_local7 = getNextPlayerNum(currentPlayerNum_);
_local2 = new Rule(this, Rule.PLAYER_TURN_TO_ACT);
_local2.setPlayer(players_[_local7]);
_local2.setNum(currentPlayerNum_);
outgoingRules_.push(_local2);
currentPlayerNum_ = getNextPlayerNum(currentPlayerNum_);
return;
};
previousColor_ = _local5.getColor();
_local2 = new Rule(this, Rule.PLAYER_TURN_TO_ACT);
_local2.setPlayer(players_[_local7]);
_local2.setNum(currentPlayerNum_);
outgoingRules_.push(_local2);
currentPlayerNum_ = _local7;
return;
};
};
} else {
if (hasDrawn_){
hasDrawn_ = false;
_local2 = new Rule(this, Rule.PLAYER_TURN_TO_ACT);
_local2.setPlayer(players_[_local7]);
_local2.setNum(currentPlayerNum_);
outgoingRules_.push(_local2);
currentPlayerNum_ = _local7;
return;
};
_local4 = players_[currentPlayerNum_];
if (hasPlayableCards(_local4)){
if (_local4.getHand().size() == 2){
_local2 = new Rule(this, Rule.PLAYER_SAY_UNO);
_local2.setPlayer(_local4);
_local2.setIsOptional(true);
outgoingRules_.push(_local2);
};
state_ = STATE_PLAYER_HAS_ACTED;
_local2 = new Rule(this, Rule.PLAYER_PLAY_OR_DRAW_CARD);
_local2.setPlayer(_local4);
outgoingRules_.push(_local2);
} else {
state_ = STATE_PLAYER_HAS_ACTED;
_local2 = new Rule(this, Rule.PLAYER_DRAW_CARD);
_local2.setPlayer(_local4);
_local2.setNum(1);
outgoingRules_.push(_local2);
};
};
} else {
if (state_ == STATE_PLAYER_HAS_ACTED){
_local4 = players_[currentPlayerNum_];
_local5 = getDiscardCard();
if (_local5 != discardCard_){
state_ = STATE_ACT_ON_CARD;
_local2 = new Rule(this, Rule.PLAYER_TURN_END);
_local2.setPlayer(_local4);
outgoingRules_.push(_local2);
return;
};
state_ = STATE_HAS_DRAWN_CARD;
_local1 = dealCardsRules(_local4, 1);
_local10 = 0;
while (_local10 < _local1.length) {
outgoingRules_.push(_local1[_local10]);
_local10++;
};
} else {
if (state_ == STATE_HAS_DRAWN_CARD){
hasDrawn_ = true;
state_ = STATE_ACT_ON_CARD;
_local4 = players_[currentPlayerNum_];
lastDrawnCard_ = _local4.getHand().getLastAddedCard();
if (hasPlayableCards(_local4)){
if (_local4.getHand().size() == 2){
_local2 = new Rule(this, Rule.PLAYER_SAY_UNO);
_local2.setPlayer(_local4);
_local2.setIsOptional(true);
outgoingRules_.push(_local2);
};
_local2 = new Rule(this, Rule.PLAYER_PLAY_CARD);
_local2.setPlayer(_local4);
_local2.setIsOptional(true);
outgoingRules_.push(_local2);
_local2 = new Rule(this, Rule.PLAYER_TURN_END);
_local2.setPlayer(_local4);
outgoingRules_.push(_local2);
} else {
_local2 = new Rule(this, Rule.PLAYER_TURN_END);
_local2.setPlayer(_local4);
outgoingRules_.push(_local2);
};
} else {
if (state_ == STATE_PLAYER_WON_ROUND){
state_ = STATE_SHOW_HANDS;
_local7 = getNextPlayerNum(currentPlayerNum_);
_local8 = players_[_local7];
_local5 = getDiscardCard();
if (_local5.getType() == Card.TYPE_DRAW_TWO){
_local2 = new Rule(this, Rule.PLAYER_TURN_TO_ACT);
_local2.setPlayer(players_[_local7]);
_local2.setNum(currentPlayerNum_);
outgoingRules_.push(_local2);
_local2 = new Rule(this, Rule.PLAYER_DRAW_CARD_PENALTY);
_local2.setPlayer(players_[_local7]);
_local2.setNum(2);
outgoingRules_.push(_local2);
_local1 = dealCardsRules(_local8, 2);
_local10 = 0;
while (_local10 < _local1.length) {
outgoingRules_.push(_local1[_local10]);
_local10++;
};
} else {
if (_local5.getType() == Card.TYPE_WILD_DRAW_FOUR){
_local2 = new Rule(this, Rule.PLAYER_DRAW_CARD_PENALTY);
_local2.setPlayer(players_[_local7]);
_local2.setNum(4);
outgoingRules_.push(_local2);
_local1 = dealCardsRules(_local8, 4);
_local10 = 0;
while (_local10 < _local1.length) {
outgoingRules_.push(_local1[_local10]);
_local10++;
};
} else {
actOnState();
};
};
} else {
if (state_ == STATE_SHOW_HANDS){
state_ = STATE_START_NEXT_ROUND;
_local4 = players_[currentPlayerNum_];
_local6 = 0;
_local2 = new Rule(this, Rule.LIST_OF_RULES);
_local9 = 0;
while (_local9 < players_.length) {
_local12 = getHandValue(players_[_local9]);
_local6 = (_local6 + _local12);
_local3 = new Rule(this, Rule.SHOW_HAND);
_local3.setPlayer(players_[_local9]);
_local3.setNum(_local12);
_local2.addToList(_local3);
_local9++;
};
outgoingRules_.push(_local2);
roundNum_++;
_local2 = new Rule(this, Rule.PLAYER_ADD_SCORE);
_local2.setPlayer(_local4);
_local2.setNum(_local6);
outgoingRules_.push(_local2);
if (roundNum_ < maxRounds_){
_local2 = new Rule(this, Rule.INFO);
_local2.setMessage("winning_round_player");
_local2.setPlayer(_local4);
outgoingRules_.push(_local2);
} else {
state_ = STATE_GAME_OVER;
_local2 = new Rule(this, Rule.INFO);
_local2.setMessage("winning_round_player");
_local2.setPlayer(_local4);
outgoingRules_.push(_local2);
};
} else {
if (state_ == STATE_START_NEXT_ROUND){
state_ = STATE_START_ROUND;
_local2 = new Rule(this, Rule.LIST_OF_RULES);
_local9 = 0;
while (_local9 < players_.length) {
_local3 = new Rule(this, Rule.TAKE_CARDS_FROM_PLAYER);
_local3.setPlayer(players_[getNextPlayerNum((currentPlayerNum_ + _local9))]);
_local2.addToList(_local3);
_local9++;
};
outgoingRules_.push(_local2);
_local2 = new Rule(this, Rule.TAKE_CARDS_FROM_TABLE);
_local2.setNum(0);
outgoingRules_.push(_local2);
_local2 = new Rule(this, Rule.START_ROUND);
_local2.setNum(roundNum_);
outgoingRules_.push(_local2);
_local2 = new Rule(this, Rule.INFO);
_local2.setMessage("round starts");
outgoingRules_.push(_local2);
_local2 = new Rule(this, Rule.SHUFFLE);
outgoingRules_.push(_local2);
} else {
if (state_ == STATE_TIME_OVER){
state_ = -1;
_local4 = players_[0];
_local2 = new Rule(this, Rule.TIME_OVER);
outgoingRules_.push(_local2);
_local2 = new Rule(this, Rule.INFO);
_local2.setMessage("winning_player");
_local2.setPlayer(_local4);
outgoingRules_.push(_local2);
} else {
if (state_ == STATE_GAME_OVER){
state_ = -1;
_local4 = players_[currentPlayerNum_];
_local2 = new Rule(this, Rule.INFO);
_local2.setMessage("winning_player");
_local2.setPlayer(_local4);
outgoingRules_.push(_local2);
};
};
};
};
};
};
};
};
};
};
};
};
}
public function replyOnRule(_arg1:Rule){
var _local2:Player = _arg1.getPlayer();
var _local3:* = ((_local2)!=null) ? _local2.getId() : 0;
if (_arg1.getType() == Rule.CHOOSE_COLOR){
declaredColor_ = _arg1.getNum();
previousColor_ = declaredColor_;
};
if (_arg1.getType() == Rule.PLAYER_SAY_UNO){
hasSaidUno_[_local2.getId()] = _arg1.getNum();
};
if (((!((outgoingRule_ == null))) && (outgoingRule_.hasBeenReplied()))){
outgoingRules_.shift();
outgoingRule_ = null;
} else {
return;
};
if (outgoingRules_.length > 0){
return;
};
actOnState();
}
public function hasPlayableCards(_arg1:Player):Boolean{
var _local2:Array = getPlayableCards(_arg1);
return ((_local2.length > 0));
}
public function getNextRule():Rule{
if ((((outgoingRules_.length == 0)) || (!((outgoingRule_ == null))))){
return (null);
};
if (outgoingRule_ == null){
outgoingRule_ = outgoingRules_[0];
};
return (outgoingRule_);
}
public function getHandValue(_arg1:Player):int{
var _local2:Card;
var _local4:int;
var _local3:Array = _arg1.getHand().getCards();
var _local5:int;
_local4 = 0;
while (_local4 < _local3.length) {
_local2 = _local3[_local4];
_local5 = (_local5 + _local2.getValue());
_local4++;
};
return (_local5);
}
private function canCardBePlayed(_arg1:Card){
var _local2:Card = getDiscardCard();
if (_local2 == null){
return (true);
};
var _local3:int = _arg1.getColor();
var _local4:int = _arg1.getType();
var _local5:int = _arg1.getRank();
var _local6:int = _local2.getColor();
var _local7:int = _local2.getType();
var _local8:int = _local2.getRank();
if ((((((_local4 == _local7)) && ((_local4 == Card.TYPE_NORMAL)))) && ((_local5 == _local8)))){
return (true);
};
if (_local3 == Card.COLOR_BLACK){
return (true);
};
if ((((_local6 == Card.COLOR_BLACK)) && ((_local3 == declaredColor_)))){
return (true);
};
if (((!((_local6 == Card.COLOR_BLACK))) && ((_local3 == _local6)))){
return (true);
};
if ((((_local4 == _local7)) && (!((_local4 == Card.TYPE_NORMAL))))){
return (true);
};
return (false);
}
public function getDiscardCard():Card{
var _local1:Card;
var _local2:Array = game_.getDiscardPile().getCards();
if (_local2.length > 0){
_local1 = _local2[(_local2.length - 1)];
};
return (_local1);
}
public function getPlayableCards(_arg1:Player):Array{
var _local2:Card;
var _local7:int;
var _local3:Array = _arg1.getHand().getCards();
var _local4:Array = new Array();
var _local5:Boolean;
var _local6:Boolean;
var _local8:Card = getDiscardCard();
_local7 = 0;
while (_local7 < _local3.length) {
_local2 = _local3[_local7];
if (canCardBePlayed(_local2)){
_local4.push(_local2);
if (_local2.getType() != Card.TYPE_WILD_DRAW_FOUR){
if (((!((_local8 == null))) && ((_local8.getColor() == _local2.getColor())))){
_local5 = true;
if (_local2.getType() != Card.TYPE_WILD){
_local6 = true;
};
};
};
};
_local7++;
};
if (((!(_arg1.isLocalPlayer())) && (_local5))){
_local7 = (_local4.length - 1);
while (_local7 >= 0) {
_local2 = _local4[_local7];
if (_local2.getType() == Card.TYPE_WILD_DRAW_FOUR){
_local4.splice(_local7, 1);
};
_local7--;
};
};
if (((!(_arg1.isLocalPlayer())) && (_local6))){
_local7 = (_local4.length - 1);
while (_local7 >= 0) {
_local2 = _local4[_local7];
if (_local2.getType() == Card.TYPE_WILD){
_local4.splice(_local7, 1);
};
_local7--;
};
};
if (lastDrawnCard_ != null){
_local7 = (_local4.length - 1);
while (_local7 >= 0) {
_local2 = _local4[_local7];
if (_local2 != lastDrawnCard_){
_local4.splice(_local7, 1);
};
_local7--;
};
};
return (_local4);
}
public function getWinningDrawPlayer():Player{
var _local1:Player;
var _local2:int;
var _local3 = -1;
var _local4:Player;
var _local5:* = 0;
while (_local5 < players_.length) {
_local1 = players_[_local5];
_local2 = _local1.getHand().getCards()[0].getRank();
if ((((_local4 == null)) || ((_local2 > _local3)))){
_local3 = _local2;
_local4 = _local1;
};
_local5++;
};
return (_local4);
}
public function reportUnoMiss(_arg1:Player, _arg2:Player){
var _local5:*;
var _local6:int;
var _local3:Array;
var _local4:Rule;
if (hasSaidUno_[_arg2.getId()] == 0){
if (outgoingRules_.length == 1){
};
hasSaidUno_[_arg2.getId()] = 1;
_local4 = new Rule(this, Rule.INFO);
_local4.setMessage("missed_say_uno");
_local4.setPlayer(_arg2);
_local4.setNum(_arg1.getId());
outgoingRules_.push(_local4);
_local4 = new Rule(this, Rule.PLAYER_DRAW_CARD_PENALTY);
_local4.setPlayer(_arg2);
_local4.setNum(2);
outgoingRules_.push(_local4);
_local3 = dealCardsRules(_arg2, 2);
_local6 = 0;
while (_local6 < _local3.length) {
outgoingRules_.push(_local3[_local6]);
_local6++;
};
};
}
public function timeOver():void{
if ((((state_ >= 0)) && (!((state_ == STATE_TIME_OVER))))){
outgoingRule_ = null;
outgoingRules_.splice(0, outgoingRules_.length);
state_ = STATE_TIME_OVER;
actOnState();
};
}
public function initRules():void{
var _local1:Rule;
_local1 = new Rule(this, Rule.INFO);
_local1.setMessage("game_starts");
outgoingRules_.push(_local1);
}
public function readyToPlay():void{
drawPile_ = game_.getDealer().getPile();
initRules();
}
public function hasSaidUno(_arg1:Player){
return ((hasSaidUno_[_arg1.getId()] == 1));
}
public function prepareDrawPileForDecidingCards(_arg1:int=0):void{
var _local5:*;
var _local6:Card;
var _local2:Array = drawPile_.getCards();
var _local3:Card = _local2[_arg1];
var _local4:Boolean;
if (_local3.getType() == Card.TYPE_NORMAL){
_local4 = true;
_local5 = 0;
while (_local5 < _arg1) {
_local6 = _local2[_local5];
if (_local3.getRank() == _local6.getRank()){
_local4 = false;
break;
};
_local5++;
};
};
if (!_local4){
_local2.splice(_arg1, 1);
_local2.push(_local3);
prepareDrawPileForDecidingCards(_arg1);
} else {
if (_arg1 < 2){
prepareDrawPileForDecidingCards((_arg1 + 1));
};
};
}
public function dealCardsRules(_arg1:Player, _arg2:int):Array{
var _local5:*;
var _local3:Array = new Array();
var _local4:Rule;
if (drawPile_.size() >= _arg2){
_local4 = new Rule(this, Rule.DEAL_CARDS_TO_PLAYER);
_local4.setPlayer(_arg1);
_local4.setNum(_arg2);
_local3.push(_local4);
} else {
_local5 = drawPile_.size();
if (_local5 > 0){
_local4 = new Rule(this, Rule.DEAL_CARDS_TO_PLAYER);
_local4.setPlayer(_arg1);
_local4.setNum(_local5);
_local3.push(_local4);
};
_local4 = new Rule(this, Rule.TAKE_CARDS_FROM_TABLE);
_local4.setNum(1);
_local3.push(_local4);
_local4 = new Rule(this, Rule.SHUFFLE);
_local3.push(_local4);
_local5 = (_arg2 - _local5);
_local4 = new Rule(this, Rule.DEAL_CARDS_TO_PLAYER);
_local4.setPlayer(_arg1);
_local4.setNum(_local5);
_local3.push(_local4);
};
return (_local3);
}
public function prepareDrawPileForStartingCard():void{
var _local3:Card;
var _local1:Array = drawPile_.getCards();
var _local2:* = 0;
while (_local2 < _local1.length) {
_local3 = _local1[_local2];
if (_local3.getColor() != Card.COLOR_BLACK){
_local1[_local2] = _local1[0];
_local1[0] = _local3;
return;
};
_local2++;
};
}
public function getNextPlayerNum(_arg1:int){
return ((((_arg1 + turnDirection_) + players_.length) % players_.length));
}
public function getPlayerPlayedLastCard():Player{
return (playerPlayedLastCard_);
}
}
}//package king.game.uno
Section 64
//ScoreBoard (king.game.uno.ScoreBoard)
package king.game.uno {
import king.util.*;
public class ScoreBoard {
private var scores_:Map;
public function ScoreBoard(_arg1:Array){
var _local3:Player;
super();
scores_ = new Map([]);
var _local2:int;
while (_local2 < _arg1.length) {
_local3 = (_arg1[_local2] as Player);
scores_.put(_local3.getName(), 0);
_local2++;
};
}
public function addScore(_arg1:Player, _arg2:int, _arg3:String=""){
var _local4:String;
_local4 = _arg1.getName();
if (scores_.get(_local4) == null){
scores_.put(_local4, _arg2);
} else {
scores_.put(_local4, (scores_.get(_local4) + _arg2));
};
if (((!((_arg3 == null))) && ((_arg3.length > 0)))){
_local4 = ((_arg3 + "_") + _arg1.getName());
if (scores_.get(_local4) == null){
scores_.put(_local4, _arg2);
} else {
scores_.put(_local4, (scores_.get(_local4) + _arg2));
};
};
}
public function getScore(_arg1:Player, _arg2:String=""):int{
var _local3:String;
var _local4:*;
if (((!((_arg2 == null))) && ((_arg2.length > 0)))){
_local3 = ((_arg2 + "_") + _arg1.getName());
_local4 = scores_.get(_local3);
} else {
_local3 = _arg1.getName();
_local4 = scores_.get(_local3);
};
if (_local4 == null){
return (0);
};
return (_local4);
}
public function toString():String{
var _local1 = "";
var _local2:Array = scores_.keySet();
var _local3:int;
while (_local3 < _local2.length) {
_local1 = (_local1 + (_local2[_local3] + " : "));
_local1 = (_local1 + scores_.get(_local2[_local3]));
_local1 = (_local1 + "\n");
_local3++;
};
return (_local1);
}
}
}//package king.game.uno
Section 65
//MtRandom (king.math.MtRandom)
package king.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 king.math
Section 66
//ManagedSound (king.sound.ManagedSound)
package king.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):ManagedSoundChannel{
var _local3:SoundChannel = new ClassReference().play(0, 0, new SoundTransform(_arg1, _arg2));
return (new ManagedSoundChannel(manager, this, _local3));
}
public function loop(_arg1:Number=1, _arg2:Number=0):ManagedSoundChannel{
var _local3:SoundChannel = new ClassReference().play(0, 999999999, new SoundTransform(_arg1, _arg2));
return (new ManagedSoundChannel(manager, this, _local3));
}
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 king.sound
Section 67
//ManagedSoundChannel (king.sound.ManagedSoundChannel)
package king.sound {
import flash.events.*;
import flash.media.*;
import flash.utils.*;
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 panStartVolume:Number;// = -1
public function ManagedSoundChannel(_arg1:SoundManager, _arg2:ManagedSound, _arg3:SoundChannel){
this.manager = _arg1;
this.sound = _arg2;
this.channel = _arg3;
_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 panTo(_arg1:Number, _arg2:Number):void{
if (!playing){
return;
};
panStartVolume = targetPan;
panEndVolume = _arg1;
panStartTime = getTimer();
panEndTime = (getTimer() + _arg2);
}
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);
playing = false;
}
public function isPlaying():Boolean{
return (playing);
}
}
}//package king.sound
Section 68
//SoundManager (king.sound.SoundManager)
package king.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 get(_arg1:String):ManagedSound{
var _local2:Class;
if (managedSoundMap[_arg1] == null){
_local2 = (getDefinitionByName(("sound." + _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 king.sound
Section 69
//Anim (king.util.Anim)
package king.util {
public class Anim {
public var lastTick:Boolean;
public var startTick:Number;
public function render(_arg1:Number):void{
}
public function end():void{
}
public function tick(_arg1:Number):Boolean{
return (true);
}
}
}//package king.util
Section 70
//AnimPlayer (king.util.AnimPlayer)
package king.util {
public class AnimPlayer {
private var anims_:ArrayList;
public function AnimPlayer(){
anims_ = new ArrayList();
}
public function addAnim(_arg1:Object){
_arg1.lastTick = false;
_arg1.startTick = -1;
anims_.add(_arg1);
}
public function tick(_arg1:Number){
var _local4:*;
var _local2:int = anims_.size();
var _local3:int = (_local2 - 1);
while (_local3 >= 0) {
_local4 = anims_.get(_local3);
if (_local4.startTick == -1){
_local4.startTick = _arg1;
};
if (_local4.lastTick){
_local4.render(1);
_local4.end();
anims_.removeI(_local3);
} else {
_local4.lastTick = _local4.tick((_arg1 - _local4.startTick));
};
_local3--;
};
}
public function render(_arg1:Number, _arg2:Number){
var _local5:*;
var _local3:int = anims_.size();
var _local4:int = (_local3 - 1);
while (_local4 >= 0) {
_local5 = anims_.get(_local4);
_local5.render(_arg2);
_local4--;
};
}
public function getNumAnims():int{
return (anims_.size());
}
public static function easeInOutElastic(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
var _local7:*;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 == 2){
return ((_arg2 + _arg3));
};
if (!_arg6){
_arg6 = (_arg4 * (0.3 * 1.5));
};
if (_arg5 < Math.abs(_arg3)){
_arg5 = _arg3;
_local7 = (_arg6 / 4);
} else {
_local7 = ((_arg6 / (2 * Math.PI)) * Math.asin((_arg3 / _arg5)));
};
if (_arg1 < 1){
--_arg1;
return (((-0.5 * ((_arg5 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _arg6)))) + _arg2));
};
--_arg1;
return ((((((_arg5 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _arg6))) * 0.5) + _arg3) + _arg2));
}
public static function easeInOutQuad(_arg1, _arg2, _arg3, _arg4){
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return (((((_arg3 / 2) * _arg1) * _arg1) + _arg2));
};
--_arg1;
return ((((-(_arg3) / 2) * ((_arg1 * (_arg1 - 2)) - 1)) + _arg2));
}
public static function easeOutInCirc(_arg1, _arg2, _arg3, _arg4){
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
--_arg1;
return ((((_arg3 / 2) * Math.sqrt((1 - (_arg1 * _arg1)))) + _arg2));
};
--_arg1;
return ((((_arg3 / 2) * (2 - Math.sqrt((1 - (_arg1 * _arg1))))) + _arg2));
}
public static function easeInOutBack(_arg1, _arg2, _arg3, _arg4, _arg5=1.70158){
if (_arg5 == undefined){
_arg5 = 1.70158;
};
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
_arg5 = (_arg5 * 1.525);
return ((((_arg3 / 2) * ((_arg1 * _arg1) * (((_arg5 + 1) * _arg1) - _arg5))) + _arg2));
};
_arg1 = (_arg1 - 2);
_arg5 = (_arg5 * 1.525);
return ((((_arg3 / 2) * (((_arg1 * _arg1) * (((_arg5 + 1) * _arg1) + _arg5)) + 2)) + _arg2));
}
public static function easeOutInCubic(_arg1, _arg2, _arg3, _arg4){
_arg1 = (_arg1 / (_arg4 / 2));
--_arg1;
return ((((_arg3 / 2) * (((_arg1 * _arg1) * _arg1) + 1)) + _arg2));
}
public static function easeOutInQuint(_arg1, _arg2, _arg3, _arg4){
_arg1 = (_arg1 / (_arg4 / 2));
--_arg1;
return ((((_arg3 / 2) * (((((_arg1 * _arg1) * _arg1) * _arg1) * _arg1) + 1)) + _arg2));
}
public static function easeOutBack(_arg1, _arg2, _arg3, _arg4, _arg5=1.70158){
if (_arg5 == undefined){
_arg5 = 1.70158;
};
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * (((_arg1 * _arg1) * (((_arg5 + 1) * _arg1) + _arg5)) + 1)) + _arg2));
}
public static function easeInOutSine(_arg1, _arg2, _arg3, _arg4){
return ((((-(_arg3) / 2) * (Math.cos(((Math.PI * _arg1) / _arg4)) - 1)) + _arg2));
}
public static function easeInBack(_arg1, _arg2, _arg3, _arg4, _arg5=1.70158){
if (_arg5 == undefined){
_arg5 = 1.70158;
};
_arg1 = (_arg1 / _arg4);
return (((((_arg3 * _arg1) * _arg1) * (((_arg5 + 1) * _arg1) - _arg5)) + _arg2));
}
public static function easeInOutBounce(_arg1, _arg2, _arg3, _arg4){
if (_arg1 < (_arg4 / 2)){
return (((easeInBounce((_arg1 * 2), 0, _arg3, _arg4) * 0.5) + _arg2));
};
return ((((easeOutBounce(((_arg1 * 2) - _arg4), 0, _arg3, _arg4) * 0.5) + (_arg3 * 0.5)) + _arg2));
}
public static function easeInQuart(_arg1, _arg2, _arg3, _arg4){
_arg1 = (_arg1 / _arg4);
return ((((((_arg3 * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
}
public static function easeOutInBounce(_arg1, _arg2, _arg3, _arg4){
if (_arg1 < (_arg4 / 2)){
return (((easeOutBounce((_arg1 * 2), 0, _arg3, _arg4) * 0.5) + _arg2));
};
return ((((easeInBounce(((_arg1 * 2) - _arg4), 0, _arg3, _arg4) * 0.5) + (_arg3 * 0.5)) + _arg2));
}
public static function easeOutInElastic(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
var _local7:*;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 == 2){
return ((_arg2 + _arg3));
};
if (!_arg6){
_arg6 = (_arg4 * (0.3 * 1.5));
};
if (_arg5 < Math.abs(_arg3)){
_arg5 = _arg3;
_local7 = (_arg6 / 4);
} else {
_local7 = ((_arg6 / (2 * Math.PI)) * Math.asin((_arg3 / _arg5)));
};
if (_arg1 < 1){
return ((((0.5 * ((_arg5 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _arg6)))) + (_arg3 / 2)) + _arg2));
};
return ((((_arg3 / 2) + (0.5 * ((_arg5 * Math.pow(2, (10 * (_arg1 - 2)))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _arg6))))) + _arg2));
}
public static function easeOutExpo(_arg1, _arg2, _arg3, _arg4){
return (((_arg1)==_arg4) ? (_arg2 + _arg3) : ((_arg3 * (-(Math.pow(2, ((-10 * _arg1) / _arg4))) + 1)) + _arg2));
}
public static function easeOutInBack(_arg1, _arg2, _arg3, _arg4, _arg5){
if (_arg5 == undefined){
_arg5 = 1.70158;
};
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
--_arg1;
_arg5 = (_arg5 * 1.525);
return ((((_arg3 / 2) * (((_arg1 * _arg1) * (((_arg5 + 1) * _arg1) + _arg5)) + 1)) + _arg2));
};
--_arg1;
_arg5 = (_arg5 * 1.525);
return ((((_arg3 / 2) * (((_arg1 * _arg1) * (((_arg5 + 1) * _arg1) - _arg5)) + 1)) + _arg2));
}
public static function easeInExpo(_arg1, _arg2, _arg3, _arg4){
return (((_arg1)==0) ? _arg2 : ((_arg3 * Math.pow(2, (10 * ((_arg1 / _arg4) - 1)))) + _arg2));
}
public static function easeInCubic(_arg1, _arg2, _arg3, _arg4){
_arg1 = (_arg1 / _arg4);
return (((((_arg3 * _arg1) * _arg1) * _arg1) + _arg2));
}
public static function easeInQuint(_arg1, _arg2, _arg3, _arg4){
_arg1 = (_arg1 / _arg4);
return (((((((_arg3 * _arg1) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
}
public static function easeInOutCirc(_arg1, _arg2, _arg3, _arg4){
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return ((((-(_arg3) / 2) * (Math.sqrt((1 - (_arg1 * _arg1))) - 1)) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((_arg3 / 2) * (Math.sqrt((1 - (_arg1 * _arg1))) + 1)) + _arg2));
}
public static function easeInQuad(_arg1, _arg2, _arg3, _arg4){
_arg1 = (_arg1 / _arg4);
return ((((_arg3 * _arg1) * _arg1) + _arg2));
}
public static function easeInBounce(_arg1, _arg2, _arg3, _arg4){
return (((_arg3 - easeOutBounce((_arg4 - _arg1), 0, _arg3, _arg4)) + _arg2));
}
public static function easeOutInExpo(_arg1, _arg2, _arg3, _arg4){
if (_arg1 == 0){
return (_arg2);
};
if (_arg1 == _arg4){
return ((_arg2 + _arg3));
};
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return ((((_arg3 / 2) * (-(Math.pow(2, (-10 * _arg1))) + 1)) + _arg2));
};
return ((((_arg3 / 2) * (Math.pow(2, (10 * (_arg1 - 2))) + 1)) + _arg2));
}
public static function easeOutQuart(_arg1, _arg2, _arg3, _arg4){
_arg1 = ((_arg1 / _arg4) - 1);
return (((-(_arg3) * ((((_arg1 * _arg1) * _arg1) * _arg1) - 1)) + _arg2));
}
public static function easeInSine(_arg1, _arg2, _arg3, _arg4){
return ((((-(_arg3) * Math.cos(((_arg1 / _arg4) * (Math.PI / 2)))) + _arg3) + _arg2));
}
public static function easeInOutQuart(_arg1, _arg2, _arg3, _arg4){
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return (((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((-(_arg3) / 2) * ((((_arg1 * _arg1) * _arg1) * _arg1) - 2)) + _arg2));
}
public static function easeOutQuad(_arg1, _arg2, _arg3, _arg4){
_arg1 = (_arg1 / _arg4);
return ((((-(_arg3) * _arg1) * (_arg1 - 2)) + _arg2));
}
public static function easeOutBounce(_arg1, _arg2, _arg3, _arg4){
_arg1 = (_arg1 / _arg4);
if (_arg1 < (1 / 2.75)){
return (((_arg3 * ((7.5625 * _arg1) * _arg1)) + _arg2));
};
if (_arg1 < (2 / 2.75)){
_arg1 = (_arg1 - (1.5 / 2.75));
return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.75)) + _arg2));
};
if (_arg1 < (2.5 / 2.75)){
_arg1 = (_arg1 - (2.25 / 2.75));
return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.9375)) + _arg2));
};
_arg1 = (_arg1 - (2.625 / 2.75));
return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.984375)) + _arg2));
}
public static function easeInElastic(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
var _local7:*;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / _arg4);
if (_arg1 == 1){
return ((_arg2 + _arg3));
};
if (!_arg6){
_arg6 = (_arg4 * 0.3);
};
if (_arg5 < Math.abs(_arg3)){
_arg5 = _arg3;
_local7 = (_arg6 / 4);
} else {
_local7 = ((_arg6 / (2 * Math.PI)) * Math.asin((_arg3 / _arg5)));
};
--_arg1;
return ((-(((_arg5 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _arg6)))) + _arg2));
}
public static function easeOutCubic(_arg1, _arg2, _arg3, _arg4){
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * (((_arg1 * _arg1) * _arg1) + 1)) + _arg2));
}
public static function easeOutQuint(_arg1, _arg2, _arg3, _arg4){
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * (((((_arg1 * _arg1) * _arg1) * _arg1) * _arg1) + 1)) + _arg2));
}
public static function easeOutInQuad(_arg1, _arg2, _arg3, _arg4){
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
--_arg1;
return ((((-(_arg3) / 2) * ((_arg1 * _arg1) - 1)) + _arg2));
};
--_arg1;
return ((((_arg3 / 2) * ((_arg1 * _arg1) + 1)) + _arg2));
}
public static function tickToPercent(_arg1, _arg2, _arg3){
var _local4:* = ((_arg1 - _arg2) / _arg3);
_local4 = ((_local4 < 0)) ? 0 : _local4;
_local4 = ((_local4 > 1)) ? 1 : _local4;
return (_local4);
}
public static function easeInOutCubic(_arg1, _arg2, _arg3, _arg4){
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return ((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((_arg3 / 2) * (((_arg1 * _arg1) * _arg1) + 2)) + _arg2));
}
public static function easeInOutQuint(_arg1, _arg2, _arg3, _arg4){
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return ((((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((_arg3 / 2) * (((((_arg1 * _arg1) * _arg1) * _arg1) * _arg1) + 2)) + _arg2));
}
public static function easeInCirc(_arg1, _arg2, _arg3, _arg4){
_arg1 = (_arg1 / _arg4);
return (((-(_arg3) * (Math.sqrt((1 - (_arg1 * _arg1))) - 1)) + _arg2));
}
public static function easeOutInSine(_arg1, _arg2, _arg3, _arg4){
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return ((((_arg3 / 2) * Math.sin(((Math.PI * _arg1) / 2))) + _arg2));
};
--_arg1;
return ((((-(_arg3) / 2) * (Math.cos(((Math.PI * _arg1) / 2)) - 2)) + _arg2));
}
public static function easeOutSine(_arg1, _arg2, _arg3, _arg4){
return (((_arg3 * Math.sin(((_arg1 / _arg4) * (Math.PI / 2)))) + _arg2));
}
public static function easeOutElastic(_arg1, _arg2, _arg3, _arg4, _arg5=0, _arg6=0){
var _local7:*;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / _arg4);
if (_arg1 == 1){
return ((_arg2 + _arg3));
};
if (!_arg6){
_arg6 = (_arg4 * 0.3);
};
if (_arg5 < Math.abs(_arg3)){
_arg5 = _arg3;
_local7 = (_arg6 / 4);
} else {
_local7 = ((_arg6 / (2 * Math.PI)) * Math.asin((_arg3 / _arg5)));
};
return (((((_arg5 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _arg6))) + _arg3) + _arg2));
}
public static function easeOutCirc(_arg1, _arg2, _arg3, _arg4){
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * Math.sqrt((1 - (_arg1 * _arg1)))) + _arg2));
}
public static function easeOutInQuart(_arg1, _arg2, _arg3, _arg4){
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
--_arg1;
return ((((-(_arg3) / 2) * ((((_arg1 * _arg1) * _arg1) * _arg1) - 1)) + _arg2));
};
--_arg1;
return ((((_arg3 / 2) * ((((_arg1 * _arg1) * _arg1) * _arg1) + 1)) + _arg2));
}
public static function easeInOutExpo(_arg1, _arg2, _arg3, _arg4){
if (_arg1 == 0){
return (_arg2);
};
if (_arg1 == _arg4){
return ((_arg2 + _arg3));
};
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return ((((_arg3 / 2) * Math.pow(2, (10 * (_arg1 - 1)))) + _arg2));
};
--_arg1;
return ((((_arg3 / 2) * (-(Math.pow(2, (-10 * _arg1))) + 2)) + _arg2));
}
}
}//package king.util
Section 71
//ArrayList (king.util.ArrayList)
package king.util {
public class ArrayList {
private var arr:Array;
public function ArrayList(_arg1:int=0){
arr = new Array(_arg1);
}
public function size():int{
return (arr.length);
}
public function add(_arg1:Object):void{
arr.push(_arg1);
}
public function removeI(_arg1:int):Object{
return (arr.splice(_arg1, 1)[0]);
}
public function get(_arg1:int):Object{
return (arr[_arg1]);
}
public function set(_arg1:int, _arg2:Object):void{
arr[_arg1] = _arg2;
}
public function isEmpty():Boolean{
return ((arr.length == 0));
}
public function removeO(_arg1:Object):Boolean{
var _local2:int = (arr.length - 1);
do {
if (_arg1 == arr[_local2]){
arr.splice(_local2, 1);
return (true);
};
var _temp1 = _local2;
_local2 = (_local2 - 1);
} while (_temp1 > 0);
return (false);
}
public function clear():void{
arr = new Array();
}
public function addI(_arg1:int, _arg2:Object):void{
arr.splice(_arg1, 0, _arg2);
}
}
}//package king.util
Section 72
//Map (king.util.Map)
package king.util {
public class Map {
private var lastSize;
private var map:Object;
public function Map(_arg1:Object){
var _local2:*;
super();
map = new Object();
for (_local2 in _arg1) {
map[("@" + _local2)] = _arg1[_local2];
};
lastSize = -1;
}
public function size():int{
return (count());
}
public function keySet():Array{
var _local2:*;
var _local1:* = [];
for (_local2 in map) {
_local1[_local1.length] = _local2.substring(1);
};
return (_local1);
}
public function remove(_arg1:Object):Object{
var _local2:* = map[("@" + _arg1)];
delete map[("@" + _arg1)];
lastSize = -1;
return (_local2);
}
public function toArray():Array{
var _local2:*;
var _local1:* = [];
for (_local2 in map) {
_local1[_local1.length] = map[_local2];
};
return (_local1);
}
public function foreach(_arg1:Function):void{
var _local2:*;
for (_local2 in map) {
if (_arg1(_local2.substring(1), map[_local2]) == false){
break;
};
};
lastSize = -1;
}
public function clear():void{
map = {};
lastSize = 0;
}
public function count():int{
var _local1:*;
if (lastSize < 0){
lastSize = 0;
for (_local1 in map) {
lastSize++;
};
};
return (lastSize);
}
public function dump():void{
var _local2:*;
var _local1 = "";
for (_local2 in map) {
_local1 = (_local1 + "x");
_local1 = (_local1 + (((_local2 + "=>") + map[_local2]) + "\n"));
};
trace(_local1);
}
public function get(_arg1:Object):Object{
return (map[("@" + _arg1)]);
}
public function put(_arg1:Object, _arg2:Object):void{
map[("@" + _arg1)] = _arg2;
lastSize = -1;
}
}
}//package king.util
Section 73
//Segments (king.util.Segments)
package king.util {
public class Segments {
private var lastT_:Number;
private var dts_:Array;
private var lastSegmentIndex_:uint;
private var maxT_:Number;
private var points_:Array;
public function Segments(){
points_ = new Array();
dts_ = new Array();
maxT_ = 0;
lastT_ = 0;
lastSegmentIndex_ = 0;
}
public function getPointAt(_arg1:Number):Number{
_arg1 = (_arg1 * maxT_);
if (_arg1 > maxT_){
_arg1 = maxT_;
};
var _local2:* = lastSegmentIndex_;
while (_arg1 > (dts_[_local2] + dts_[(_local2 + 1)])) {
_local2 = (_local2 + 2);
};
var _local3:Number = ((_arg1 - dts_[_local2]) / dts_[(_local2 + 1)]);
var _local4:* = (points_[_local2] + ((points_[(_local2 + 1)] - points_[_local2]) * _local3));
return (_local4);
}
public function addSegment(_arg1:Number, _arg2:Number, _arg3:Number):void{
points_.push(_arg1);
points_.push(_arg2);
dts_.push(maxT_);
dts_.push(_arg3);
maxT_ = (maxT_ + _arg3);
}
public function getMaxTime():Number{
return (maxT_);
}
}
}//package king.util
Section 74
//BBox (sandy.bounds.BBox)
package sandy.bounds {
import sandy.core.data.*;
public class BBox {
public var maxEdge:Point3D;
public var uptodate:Boolean;// = false
public var minEdge:Point3D;
public function BBox(_arg1:Point3D=null, _arg2:Point3D=null){
minEdge = ((_arg1)!=null) ? _arg1 : new Point3D(-0.5, -0.5, -0.5);
maxEdge = ((_arg2)!=null) ? _arg2 : new Point3D(0.5, 0.5, 0.5);
}
public function getEdges(_arg1:Array):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Point3D;
if (_arg1 == null){
return;
};
_local2 = ((this.maxEdge.x + this.minEdge.x) / 2);
_local3 = ((this.maxEdge.y + this.minEdge.y) / 2);
_local4 = ((this.maxEdge.z + this.minEdge.z) / 2);
_local5 = (_local2 - this.maxEdge.x);
_local6 = (_local3 - this.maxEdge.y);
_local7 = (_local4 - this.maxEdge.z);
_local8 = _arg1[0];
_local8.x = (_local2 + _local5);
_local8.y = (_local3 + _local6);
_local8.z = (_local4 + _local7);
_local8 = _arg1[1];
_local8.x = (_local2 + _local5);
_local8.y = (_local3 - _local6);
_local8.z = (_local4 + _local7);
_local8 = _arg1[2];
_local8.x = (_local2 + _local5);
_local8.y = (_local3 + _local6);
_local8.z = (_local4 - _local7);
_local8 = _arg1[3];
_local8.x = (_local2 + _local5);
_local8.y = (_local3 - _local6);
_local8.z = (_local4 - _local7);
_local8 = _arg1[4];
_local8.x = (_local2 - _local5);
_local8.y = (_local3 + _local6);
_local8.z = (_local4 + _local7);
_local8 = _arg1[5];
_local8.x = (_local2 - _local5);
_local8.y = (_local3 - _local6);
_local8.z = (_local4 + _local7);
_local8 = _arg1[6];
_local8.x = (_local2 - _local5);
_local8.y = (_local3 + _local6);
_local8.z = (_local4 - _local7);
_local8 = _arg1[7];
_local8.x = (_local2 - _local5);
_local8.y = (_local3 - _local6);
_local8.z = (_local4 - _local7);
}
public function intersectsBox(_arg1:BBox):Boolean{
return ((((((((((((this.minEdge.x <= _arg1.maxEdge.x)) && ((this.minEdge.y <= _arg1.maxEdge.y)))) && ((this.minEdge.z <= _arg1.maxEdge.z)))) && ((this.maxEdge.x >= _arg1.minEdge.x)))) && ((this.maxEdge.y >= _arg1.minEdge.y)))) && ((this.maxEdge.z >= _arg1.minEdge.z))));
}
public function addInternalPointXYZ(_arg1:Number, _arg2:Number, _arg3:Number):void{
if (_arg1 > this.maxEdge.x){
this.maxEdge.x = _arg1;
};
if (_arg2 > this.maxEdge.y){
this.maxEdge.y = _arg2;
};
if (_arg3 > this.maxEdge.z){
this.maxEdge.z = _arg3;
};
if (_arg1 < this.minEdge.x){
this.minEdge.x = _arg1;
};
if (_arg2 < this.minEdge.y){
this.minEdge.y = _arg2;
};
if (_arg3 < this.minEdge.z){
this.minEdge.z = _arg3;
};
}
public function getCenter():Point3D{
return (new Point3D(((this.maxEdge.x + this.minEdge.x) / 2), ((this.maxEdge.y + this.minEdge.y) / 2), ((this.maxEdge.z + this.minEdge.z) / 2)));
}
public function transform(_arg1:Matrix4):BBox{
var _local4:Point3D;
var _local2:BBox = new BBox();
var _local3:Array = [Pool.getInstance().nextPoint3D, Pool.getInstance().nextPoint3D, Pool.getInstance().nextPoint3D, Pool.getInstance().nextPoint3D, Pool.getInstance().nextPoint3D, Pool.getInstance().nextPoint3D, Pool.getInstance().nextPoint3D, Pool.getInstance().nextPoint3D];
getEdges(_local3);
for each (_local4 in _local3) {
_arg1.transform(_local4);
_local2.addInternalPoint(_local4);
};
return (_local2);
}
public function reset():void{
minEdge.reset();
maxEdge.reset();
uptodate = false;
}
public function addInternalPoint(_arg1:Point3D):void{
if (_arg1.x > this.maxEdge.x){
this.maxEdge.x = _arg1.x;
};
if (_arg1.y > this.maxEdge.y){
this.maxEdge.y = _arg1.y;
};
if (_arg1.z > this.maxEdge.z){
this.maxEdge.z = _arg1.z;
};
if (_arg1.x < this.minEdge.x){
this.minEdge.x = _arg1.x;
};
if (_arg1.y < this.minEdge.y){
this.minEdge.y = _arg1.y;
};
if (_arg1.z < this.minEdge.z){
this.minEdge.z = _arg1.z;
};
}
public function isPointInsideXYZ(_arg1:Number, _arg2:Number, _arg3:Number):Boolean{
return ((((((((((((_arg1 >= this.minEdge.x)) && ((_arg1 <= this.maxEdge.x)))) && ((_arg2 >= this.minEdge.y)))) && ((_arg2 <= this.maxEdge.y)))) && ((_arg3 >= this.minEdge.z)))) && ((_arg3 <= this.maxEdge.z))));
}
public function merge(_arg1:BBox):void{
this.addInternalPointXYZ(_arg1.maxEdge.x, _arg1.maxEdge.y, _arg1.maxEdge.z);
this.addInternalPointXYZ(_arg1.minEdge.x, _arg1.minEdge.y, _arg1.minEdge.z);
uptodate = false;
}
public function getSize():Point3D{
return (new Point3D(Math.abs((maxEdge.x - minEdge.x)), Math.abs((maxEdge.y - minEdge.y)), Math.abs((maxEdge.z - minEdge.z))));
}
public function isPointTotalInside(_arg1:Point3D):Boolean{
return ((((((((((((_arg1.x > this.minEdge.x)) && ((_arg1.x < this.maxEdge.x)))) && ((_arg1.y > this.minEdge.y)))) && ((_arg1.y < this.maxEdge.y)))) && ((_arg1.z > this.minEdge.z)))) && ((_arg1.z < this.maxEdge.z))));
}
public function toString():String{
return (((("sandy.bounds.BBox " + minEdge) + " ") + maxEdge));
}
public function clone():BBox{
var _local1:BBox = new BBox();
_local1.maxEdge = maxEdge.clone();
_local1.minEdge = minEdge.clone();
return (_local1);
}
public static function create(_arg1:Array):BBox{
var _local3:Vertex;
if (_arg1.length == 0){
return (null);
};
var _local2:BBox = new (BBox);
for each (_local3 in _arg1) {
_local2.addInternalPointXYZ(_local3.x, _local3.y, _local3.z);
};
return (_local2);
}
}
}//package sandy.bounds
Section 75
//BSphere (sandy.bounds.BSphere)
package sandy.bounds {
import sandy.core.data.*;
public final class BSphere {
public var position:Point3D;
public var uptodate:Boolean;// = false
public var center:Point3D;
public var radius:Number;// = 1
public function BSphere(){
center = new Point3D();
position = new Point3D();
super();
}
public function resetFromBox(_arg1:BBox):void{
this.center.copy(_arg1.getCenter());
this.radius = Math.sqrt(((((_arg1.maxEdge.x - this.center.x) * (_arg1.maxEdge.x - this.center.x)) + ((_arg1.maxEdge.y - this.center.y) * (_arg1.maxEdge.y - this.center.y))) + ((_arg1.maxEdge.z - this.center.z) * (_arg1.maxEdge.z - this.center.z))));
}
public function transform(_arg1:Matrix4):void{
position.copy(center);
_arg1.transform(position);
uptodate = true;
}
public function reset():void{
center.reset();
radius = 0;
position.reset();
uptodate = false;
}
private function computeRadius(_arg1:Array):Number{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local7:int;
var _local6:Number = 0;
var _local8:int = _arg1.length;
while (_local7 < _local8) {
_local2 = (_arg1[int(_local7)].x - center.x);
_local3 = (_arg1[int(_local7)].x - center.x);
_local4 = (_arg1[int(_local7)].x - center.x);
_local5 = (((_local2 * _local2) + (_local3 * _local3)) + (_local4 * _local4));
if (_local5 > _local6){
_local6 = _local5;
};
_local7++;
};
return (Math.sqrt(_local6));
}
private function pointsOutofSphere(_arg1:Array):Array{
var _local3:int;
var _local2:Array = new Array();
var _local4:int = _arg1.length;
while (_local3 < _local4) {
if (distance(_arg1[int(_local3)]) > 0){
_local2.push(_arg1[int(_local3)]);
};
_local3++;
};
return (_local2);
}
public function compute(_arg1:Array):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local12:Vertex;
var _local13:Vertex;
if (_arg1.length == 0){
return;
};
var _local6:int;
var _local7:int;
var _local8:int = _arg1.length;
var _local9:Vertex = _arg1[0].clone();
var _local10:Vertex = _arg1[0].clone();
var _local11:Number = 0;
while (_local6 < _local8) {
_local7 = (_local6 + 1);
while (_local7 < _local8) {
_local12 = _arg1[int(_local6)];
_local13 = _arg1[int(_local7)];
_local2 = (_local13.x - _local12.x);
_local3 = (_local13.y - _local12.y);
_local4 = (_local13.z - _local12.z);
_local5 = (((_local2 * _local2) + (_local3 * _local3)) + (_local4 * _local4));
if (_local5 > _local11){
_local11 = _local5;
_local9.copy(_local12);
_local10.copy(_local13);
};
_local7 = (_local7 + 1);
};
_local6 = (_local6 + 1);
};
center = new Point3D(((_local9.x + _local10.x) / 2), ((_local9.y + _local10.y) / 2), ((_local9.z + _local10.z) / 2));
radius = (Math.sqrt(_local11) / 2);
}
public function toString():String{
return ((((("sandy.bounds.BSphere (center : " + center) + ", radius : ") + radius) + ")"));
}
public function distance(_arg1:Point3D):Number{
var _local2:Number = (_arg1.x - center.x);
var _local3:Number = (_arg1.y - center.y);
var _local4:Number = (_arg1.z - center.z);
return ((Math.sqrt((((_local2 * _local2) + (_local3 * _local3)) + (_local4 * _local4))) - radius));
}
public static function create(_arg1:Array):BSphere{
var _local2:BSphere = new (BSphere);
_local2.compute(_arg1);
return (_local2);
}
}
}//package sandy.bounds
Section 76
//Edge3D (sandy.core.data.Edge3D)
package sandy.core.data {
public final class Edge3D {
public var vertexId1:uint;
public var vertexId2:uint;
public var vertex1:Vertex;
public var vertex2:Vertex;
public function Edge3D(_arg1:uint, _arg2:uint){
vertexId1 = _arg1;
vertexId2 = _arg2;
}
public function clone():Edge3D{
var _local1:Edge3D = new Edge3D(vertexId1, vertexId2);
return (_local1);
}
}
}//package sandy.core.data
Section 77
//Matrix4 (sandy.core.data.Matrix4)
package sandy.core.data {
import sandy.util.*;
import sandy.math.*;
public final class Matrix4 {
private const _fastMathInitialized:Boolean;
public var n11:Number;
public var n12:Number;
public var n13:Number;
public var n14:Number;
public var n21:Number;
public var n22:Number;
public var n23:Number;
public var n24:Number;
public var n31:Number;
public var n32:Number;
public var n33:Number;
public var n34:Number;
public var n41:Number;
public var n42:Number;
public var n43:Number;
public var n44:Number;
public static const USE_FAST_MATH:Boolean = false;
public function Matrix4(_arg1:Number=1, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0, _arg5:Number=0, _arg6:Number=1, _arg7:Number=0, _arg8:Number=0, _arg9:Number=0, _arg10:Number=0, _arg11:Number=1, _arg12:Number=0, _arg13:Number=0, _arg14:Number=0, _arg15:Number=0, _arg16:Number=1){
_fastMathInitialized = FastMath.initialized;
super();
n11 = _arg1;
n12 = _arg2;
n13 = _arg3;
n14 = _arg4;
n21 = _arg5;
n22 = _arg6;
n23 = _arg7;
n24 = _arg8;
n31 = _arg9;
n32 = _arg10;
n33 = _arg11;
n34 = _arg12;
n41 = _arg13;
n42 = _arg14;
n43 = _arg15;
n44 = _arg16;
}
final public function getTranslation():Point3D{
return (new Point3D(n14, n24, n34));
}
final public function eulerRotation(_arg1:Number, _arg2:Number, _arg3:Number):void{
identity();
_arg1 = -(NumberUtil.toRadian(_arg1));
_arg2 = NumberUtil.toRadian(_arg2);
_arg3 = -(NumberUtil.toRadian(_arg3));
var _local4:Number = ((USE_FAST_MATH)==false) ? Math.cos(_arg1) : FastMath.cos(_arg1);
var _local5:Number = ((USE_FAST_MATH)==false) ? Math.sin(_arg1) : FastMath.sin(_arg1);
var _local6:Number = ((USE_FAST_MATH)==false) ? Math.cos(_arg2) : FastMath.cos(_arg2);
var _local7:Number = ((USE_FAST_MATH)==false) ? Math.sin(_arg2) : FastMath.sin(_arg2);
var _local8:Number = ((USE_FAST_MATH)==false) ? Math.cos(_arg3) : FastMath.cos(_arg3);
var _local9:Number = ((USE_FAST_MATH)==false) ? Math.sin(_arg3) : FastMath.sin(_arg3);
var _local10:Number = (_local4 * _local7);
var _local11:Number = (_local5 * _local7);
n11 = (_local6 * _local8);
n12 = (_local6 * _local9);
n13 = -(_local7);
n21 = ((_local11 * _local8) - (_local4 * _local9));
n22 = ((_local11 * _local9) + (_local4 * _local8));
n23 = (_local5 * _local6);
n31 = ((_local10 * _local8) + (_local5 * _local9));
n32 = ((_local10 * _local9) - (_local5 * _local8));
n33 = (_local4 * _local6);
}
final public function multiply3x3(_arg1:Matrix4):void{
var _local2:Number = n11;
var _local3:Number = _arg1.n11;
var _local4:Number = n21;
var _local5:Number = _arg1.n21;
var _local6:Number = n31;
var _local7:Number = _arg1.n31;
var _local8:Number = n12;
var _local9:Number = _arg1.n12;
var _local10:Number = n22;
var _local11:Number = _arg1.n22;
var _local12:Number = n32;
var _local13:Number = _arg1.n32;
var _local14:Number = n13;
var _local15:Number = _arg1.n13;
var _local16:Number = n23;
var _local17:Number = _arg1.n23;
var _local18:Number = n33;
var _local19:Number = _arg1.n33;
n11 = (((_local2 * _local3) + (_local8 * _local5)) + (_local14 * _local7));
n12 = (((_local2 * _local9) + (_local8 * _local11)) + (_local14 * _local13));
n13 = (((_local2 * _local15) + (_local8 * _local17)) + (_local14 * _local19));
n21 = (((_local4 * _local3) + (_local10 * _local5)) + (_local16 * _local7));
n22 = (((_local4 * _local9) + (_local10 * _local11)) + (_local16 * _local13));
n23 = (((_local4 * _local15) + (_local10 * _local17)) + (_local16 * _local19));
n31 = (((_local6 * _local3) + (_local12 * _local5)) + (_local18 * _local7));
n32 = (((_local6 * _local9) + (_local12 * _local11)) + (_local18 * _local13));
n33 = (((_local6 * _local15) + (_local12 * _local17)) + (_local18 * _local19));
n14 = (n24 = (n34 = (n41 = (n42 = (n43 = 0)))));
n44 = 1;
}
final public function det():Number{
return (((((((((n11 * n22) - (n21 * n12)) * ((n33 * n44) - (n43 * n34))) - (((n11 * n32) - (n31 * n12)) * ((n23 * n44) - (n43 * n24)))) + (((n11 * n42) - (n41 * n12)) * ((n23 * n34) - (n33 * n24)))) + (((n21 * n32) - (n31 * n22)) * ((n13 * n44) - (n43 * n14)))) - (((n21 * n42) - (n41 * n22)) * ((n13 * n34) - (n33 * n14)))) + (((n31 * n42) - (n41 * n32)) * ((n13 * n24) - (n23 * n14)))));
}
final public function getTrace():Number{
return ((((n11 + n22) + n33) + n44));
}
final public function translationPoint3D(_arg1:Point3D):void{
identity();
n14 = _arg1.x;
n24 = _arg1.y;
n34 = _arg1.z;
}
final public function rotationX(_arg1:Number):void{
identity();
_arg1 = NumberUtil.toRadian(_arg1);
var _local2:Number = ((USE_FAST_MATH)==false) ? Math.cos(_arg1) : FastMath.cos(_arg1);
var _local3:Number = ((USE_FAST_MATH)==false) ? Math.sin(_arg1) : FastMath.sin(_arg1);
n22 = _local2;
n23 = -(_local3);
n32 = _local3;
n33 = _local2;
}
final public function rotationY(_arg1:Number):void{
identity();
_arg1 = NumberUtil.toRadian(_arg1);
var _local2:Number = ((USE_FAST_MATH)==false) ? Math.cos(_arg1) : FastMath.cos(_arg1);
var _local3:Number = ((USE_FAST_MATH)==false) ? Math.sin(_arg1) : FastMath.sin(_arg1);
n11 = _local2;
n13 = -(_local3);
n31 = _local3;
n33 = _local2;
}
final public function multiply(_arg1:Matrix4):void{
var _local2:Number = n11;
var _local3:Number = n21;
var _local4:Number = n31;
var _local5:Number = n41;
var _local6:Number = n12;
var _local7:Number = n22;
var _local8:Number = n32;
var _local9:Number = n42;
var _local10:Number = n13;
var _local11:Number = n23;
var _local12:Number = n33;
var _local13:Number = n43;
var _local14:Number = n14;
var _local15:Number = n24;
var _local16:Number = n34;
var _local17:Number = n44;
var _local18:Number = _arg1.n11;
var _local19:Number = _arg1.n21;
var _local20:Number = _arg1.n31;
var _local21:Number = _arg1.n41;
var _local22:Number = _arg1.n12;
var _local23:Number = _arg1.n22;
var _local24:Number = _arg1.n32;
var _local25:Number = _arg1.n42;
var _local26:Number = _arg1.n13;
var _local27:Number = _arg1.n23;
var _local28:Number = _arg1.n33;
var _local29:Number = _arg1.n43;
var _local30:Number = _arg1.n14;
var _local31:Number = _arg1.n24;
var _local32:Number = _arg1.n34;
var _local33:Number = _arg1.n44;
n11 = ((((_local2 * _local18) + (_local6 * _local19)) + (_local10 * _local20)) + (_local14 * _local21));
n12 = ((((_local2 * _local22) + (_local6 * _local23)) + (_local10 * _local24)) + (_local14 * _local25));
n13 = ((((_local2 * _local26) + (_local6 * _local27)) + (_local10 * _local28)) + (_local14 * _local29));
n14 = ((((_local2 * _local30) + (_local6 * _local31)) + (_local10 * _local32)) + (_local14 * _local33));
n21 = ((((_local3 * _local18) + (_local7 * _local19)) + (_local11 * _local20)) + (_local15 * _local21));
n22 = ((((_local3 * _local22) + (_local7 * _local23)) + (_local11 * _local24)) + (_local15 * _local25));
n23 = ((((_local3 * _local26) + (_local7 * _local27)) + (_local11 * _local28)) + (_local15 * _local29));
n24 = ((((_local3 * _local30) + (_local7 * _local31)) + (_local11 * _local32)) + (_local15 * _local33));
n31 = ((((_local4 * _local18) + (_local8 * _local19)) + (_local12 * _local20)) + (_local16 * _local21));
n32 = ((((_local4 * _local22) + (_local8 * _local23)) + (_local12 * _local24)) + (_local16 * _local25));
n33 = ((((_local4 * _local26) + (_local8 * _local27)) + (_local12 * _local28)) + (_local16 * _local29));
n34 = ((((_local4 * _local30) + (_local8 * _local31)) + (_local12 * _local32)) + (_local16 * _local33));
n41 = ((((_local5 * _local18) + (_local9 * _local19)) + (_local13 * _local20)) + (_local17 * _local21));
n42 = ((((_local5 * _local22) + (_local9 * _local23)) + (_local13 * _local24)) + (_local17 * _local25));
n43 = ((((_local5 * _local26) + (_local9 * _local27)) + (_local13 * _local28)) + (_local17 * _local29));
n44 = ((((_local5 * _local30) + (_local9 * _local31)) + (_local13 * _local32)) + (_local17 * _local33));
}
final public function axisRotationWithReference(_arg1:Point3D, _arg2:Point3D, _arg3:Number):void{
var _local4:Matrix4 = new Matrix4();
var _local5:Number = ((_arg3 + 360) % 360);
translation(_arg2.x, _arg2.y, _arg2.z);
_local4.axisRotation(_arg1.x, _arg1.y, _arg1.z, _local5);
multiply(_local4);
_local4.translation(-(_arg2.x), -(_arg2.y), -(_arg2.z));
multiply(_local4);
_local4 = null;
}
final public function zero():void{
n11 = 0;
n12 = 0;
n13 = 0;
n14 = 0;
n21 = 0;
n22 = 0;
n23 = 0;
n24 = 0;
n31 = 0;
n32 = 0;
n33 = 0;
n34 = 0;
n41 = 0;
n42 = 0;
n43 = 0;
n44 = 0;
}
final public function rotationZ(_arg1:Number):void{
identity();
_arg1 = NumberUtil.toRadian(_arg1);
var _local2:Number = ((USE_FAST_MATH)==false) ? Math.cos(_arg1) : FastMath.cos(_arg1);
var _local3:Number = ((USE_FAST_MATH)==false) ? Math.sin(_arg1) : FastMath.sin(_arg1);
n11 = _local2;
n12 = -(_local3);
n21 = _local3;
n22 = _local2;
}
final public function translation(_arg1:Number, _arg2:Number, _arg3:Number):void{
identity();
n14 = _arg1;
n24 = _arg2;
n34 = _arg3;
}
final public function getEulerAngles():Point3D{
var _local3:Number;
var _local4:Number;
var _local1:Number = 57.295779513;
var _local2:Number = (Math.asin(-(this.n13)) * _local1);
if (!NumberUtil.isZero((Math.abs(this.n13) - 1))){
_local3 = (-(Math.atan2(this.n23, this.n33)) * _local1);
_local4 = (-(Math.atan2(this.n12, this.n11)) * _local1);
} else {
_local3 = 0;
_local4 = Math.atan2(-(this.n21), this.n22);
};
if (_local3 < 0){
_local3 = (_local3 + 360);
};
if (_local2 < 0){
_local2 = (_local2 + 360);
};
if (_local4 < 0){
_local4 = (_local4 + 360);
};
return (new Point3D(_local3, _local2, _local4));
}
final public function inverse():void{
var _local1:Number = det();
if (Math.abs(_local1) < 0.001){
throw (new Error("cannot invert a matrix with a null determinant"));
};
_local1 = (1 / _local1);
var _local2:Number = n11;
var _local3:Number = n21;
var _local4:Number = n31;
var _local5:Number = n41;
var _local6:Number = n12;
var _local7:Number = n22;
var _local8:Number = n32;
var _local9:Number = n42;
var _local10:Number = n13;
var _local11:Number = n23;
var _local12:Number = n33;
var _local13:Number = n43;
var _local14:Number = n14;
var _local15:Number = n24;
var _local16:Number = n34;
var _local17:Number = n44;
n11 = (_local1 * (((_local7 * ((_local12 * _local17) - (_local13 * _local16))) - (_local8 * ((_local11 * _local17) - (_local13 * _local15)))) + (_local9 * ((_local11 * _local16) - (_local12 * _local15)))));
n12 = (-(_local1) * (((_local6 * ((_local12 * _local17) - (_local13 * _local16))) - (_local8 * ((_local10 * _local17) - (_local13 * _local14)))) + (_local9 * ((_local10 * _local16) - (_local12 * _local14)))));
n13 = (_local1 * (((_local6 * ((_local11 * _local17) - (_local13 * _local15))) - (_local7 * ((_local10 * _local17) - (_local13 * _local14)))) + (_local9 * ((_local10 * _local15) - (_local11 * _local14)))));
n14 = (-(_local1) * (((_local6 * ((_local11 * _local16) - (_local12 * _local15))) - (_local7 * ((_local10 * _local16) - (_local12 * _local14)))) + (_local8 * ((_local10 * _local15) - (_local11 * _local14)))));
n21 = (-(_local1) * (((_local3 * ((_local12 * _local17) - (_local13 * _local16))) - (_local4 * ((_local11 * _local17) - (_local13 * _local15)))) + (_local5 * ((_local11 * _local16) - (_local12 * _local15)))));
n22 = (_local1 * (((_local2 * ((_local12 * _local17) - (_local13 * _local16))) - (_local4 * ((_local10 * _local17) - (_local13 * _local14)))) + (_local5 * ((_local10 * _local16) - (_local12 * _local14)))));
n23 = (-(_local1) * (((_local2 * ((_local11 * _local17) - (_local13 * _local15))) - (_local3 * ((_local10 * _local17) - (_local13 * _local14)))) + (_local5 * ((_local10 * _local15) - (_local11 * _local14)))));
n24 = (_local1 * (((_local2 * ((_local11 * _local16) - (_local12 * _local15))) - (_local3 * ((_local10 * _local16) - (_local12 * _local14)))) + (_local4 * ((_local10 * _local15) - (_local11 * _local14)))));
n31 = (_local1 * (((_local3 * ((_local8 * _local17) - (_local9 * _local16))) - (_local4 * ((_local7 * _local17) - (_local9 * _local15)))) + (_local5 * ((_local7 * _local16) - (_local8 * _local15)))));
n32 = (-(_local1) * (((_local2 * ((_local8 * _local17) - (_local9 * _local16))) - (_local4 * ((_local6 * _local17) - (_local9 * _local14)))) + (_local5 * ((_local6 * _local16) - (_local8 * _local14)))));
n33 = (_local1 * (((_local2 * ((_local7 * _local17) - (_local9 * _local15))) - (_local3 * ((_local6 * _local17) - (_local9 * _local14)))) + (_local5 * ((_local6 * _local15) - (_local7 * _local14)))));
n34 = (-(_local1) * (((_local2 * ((_local7 * _local16) - (_local8 * _local15))) - (_local3 * ((_local6 * _local16) - (_local8 * _local14)))) + (_local4 * ((_local6 * _local15) - (_local7 * _local14)))));
n41 = (-(_local1) * (((_local3 * ((_local8 * _local13) - (_local9 * _local12))) - (_local4 * ((_local7 * _local13) - (_local9 * _local11)))) + (_local5 * ((_local7 * _local12) - (_local8 * _local11)))));
n42 = (_local1 * (((_local2 * ((_local8 * _local13) - (_local9 * _local12))) - (_local4 * ((_local6 * _local13) - (_local9 * _local10)))) + (_local5 * ((_local6 * _local12) - (_local8 * _local10)))));
n43 = (-(_local1) * (((_local2 * ((_local7 * _local13) - (_local9 * _local11))) - (_local3 * ((_local6 * _local13) - (_local9 * _local10)))) + (_local5 * ((_local6 * _local11) - (_local7 * _local10)))));
n44 = (_local1 * (((_local2 * ((_local7 * _local12) - (_local8 * _local11))) - (_local3 * ((_local6 * _local12) - (_local8 * _local10)))) + (_local4 * ((_local6 * _local11) - (_local7 * _local10)))));
}
final public function det3x3():Number{
return ((((n11 * ((n22 * n33) - (n23 * n32))) + (n21 * ((n32 * n13) - (n12 * n33)))) + (n31 * ((n12 * n23) - (n22 * n13)))));
}
final public function identity():void{
n11 = 1;
n12 = 0;
n13 = 0;
n14 = 0;
n21 = 0;
n22 = 1;
n23 = 0;
n24 = 0;
n31 = 0;
n32 = 0;
n33 = 1;
n34 = 0;
n41 = 0;
n42 = 0;
n43 = 0;
n44 = 1;
}
final public function axisRotation(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{
identity();
_arg4 = NumberUtil.toRadian(_arg4);
var _local5:Number = ((USE_FAST_MATH)==false) ? Math.cos(_arg4) : FastMath.cos(_arg4);
var _local6:Number = ((USE_FAST_MATH)==false) ? Math.sin(_arg4) : FastMath.sin(_arg4);
var _local7:Number = (1 - _local5);
var _local8:Number = ((_arg1 * _arg2) * _local7);
var _local9:Number = ((_arg2 * _arg3) * _local7);
var _local10:Number = ((_arg1 * _arg3) * _local7);
var _local11:Number = (_local6 * _arg3);
var _local12:Number = (_local6 * _arg2);
var _local13:Number = (_local6 * _arg1);
n11 = (_local5 + ((_arg1 * _arg1) * _local7));
n12 = (-(_local11) + _local8);
n13 = (_local12 + _local10);
n21 = (_local11 + _local8);
n22 = (_local5 + ((_arg2 * _arg2) * _local7));
n23 = (-(_local13) + _local9);
n31 = (-(_local12) + _local10);
n32 = (_local13 + _local9);
n33 = (_local5 + ((_arg3 * _arg3) * _local7));
}
final public function addMatrix(_arg1:Matrix4):void{
n11 = (n11 + _arg1.n11);
n12 = (n12 + _arg1.n12);
n13 = (n13 + _arg1.n13);
n14 = (n14 + _arg1.n14);
n21 = (n21 + _arg1.n21);
n22 = (n22 + _arg1.n22);
n23 = (n23 + _arg1.n23);
n24 = (n24 + _arg1.n24);
n31 = (n31 + _arg1.n31);
n32 = (n32 + _arg1.n32);
n33 = (n33 + _arg1.n33);
n34 = (n34 + _arg1.n34);
n41 = (n41 + _arg1.n41);
n42 = (n42 + _arg1.n42);
n43 = (n43 + _arg1.n43);
n44 = (n44 + _arg1.n44);
}
final public function transform3x3(_arg1:Point3D):void{
var _local2:Number = _arg1.x;
var _local3:Number = _arg1.y;
var _local4:Number = _arg1.z;
_arg1.x = (((_local2 * n11) + (_local3 * n12)) + (_local4 * n13));
_arg1.y = (((_local2 * n21) + (_local3 * n22)) + (_local4 * n23));
_arg1.z = (((_local2 * n31) + (_local3 * n32)) + (_local4 * n33));
}
final public function scale(_arg1:Number, _arg2:Number, _arg3:Number):void{
identity();
n11 = _arg1;
n22 = _arg2;
n33 = _arg3;
}
final public function multiply4x3(_arg1:Matrix4):void{
var _local2:Number = n11;
var _local3:Number = _arg1.n11;
var _local4:Number = n21;
var _local5:Number = _arg1.n21;
var _local6:Number = n31;
var _local7:Number = _arg1.n31;
var _local8:Number = n12;
var _local9:Number = _arg1.n12;
var _local10:Number = n22;
var _local11:Number = _arg1.n22;
var _local12:Number = n32;
var _local13:Number = _arg1.n32;
var _local14:Number = n13;
var _local15:Number = _arg1.n13;
var _local16:Number = n23;
var _local17:Number = _arg1.n23;
var _local18:Number = n33;
var _local19:Number = _arg1.n33;
var _local20:Number = _arg1.n14;
var _local21:Number = _arg1.n24;
var _local22:Number = _arg1.n34;
n11 = (((_local2 * _local3) + (_local8 * _local5)) + (_local14 * _local7));
n12 = (((_local2 * _local9) + (_local8 * _local11)) + (_local14 * _local13));
n13 = (((_local2 * _local15) + (_local8 * _local17)) + (_local14 * _local19));
n14 = ((((_local20 * _local2) + (_local21 * _local8)) + (_local22 * _local14)) + n14);
n21 = (((_local4 * _local3) + (_local10 * _local5)) + (_local16 * _local7));
n22 = (((_local4 * _local9) + (_local10 * _local11)) + (_local16 * _local13));
n23 = (((_local4 * _local15) + (_local10 * _local17)) + (_local16 * _local19));
n24 = ((((_local20 * _local4) + (_local21 * _local10)) + (_local22 * _local16)) + n24);
n31 = (((_local6 * _local3) + (_local12 * _local5)) + (_local18 * _local7));
n32 = (((_local6 * _local9) + (_local12 * _local11)) + (_local18 * _local13));
n33 = (((_local6 * _local15) + (_local12 * _local17)) + (_local18 * _local19));
n34 = ((((_local20 * _local6) + (_local21 * _local12)) + (_local22 * _local18)) + n34);
n41 = (n42 = (n43 = 0));
n44 = 1;
}
final public function axisRotationPoint3D(_arg1:Point3D, _arg2:Number):void{
axisRotation(_arg1.x, _arg1.y, _arg1.z, _arg2);
}
final public function scalePoint3D(_arg1:Point3D):void{
identity();
n11 = _arg1.x;
n22 = _arg1.y;
n33 = _arg1.z;
}
final public function fromPoint3Ds(_arg1:Point3D, _arg2:Point3D, _arg3:Point3D, _arg4:Point3D):void{
zero();
n11 = _arg1.x;
n21 = _arg1.y;
n31 = _arg1.z;
n12 = _arg2.x;
n22 = _arg2.y;
n32 = _arg2.z;
n13 = _arg3.x;
n23 = _arg3.y;
n33 = _arg3.z;
n14 = _arg4.x;
n24 = _arg4.y;
n34 = _arg4.z;
}
final public function clone():Matrix4{
return (new Matrix4(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44));
}
public function serialize(_arg1:Number=1E-6):String{
var _local2:Function = NumberUtil.roundTo;
var _local3:String = new String("");
_local3 = (_local3 + (((((((_local2(n11, _arg1) + ",") + _local2(n12, _arg1)) + ",") + _local2(n13, _arg1)) + ",") + _local2(n14, _arg1)) + ","));
_local3 = (_local3 + (((((((_local2(n21, _arg1) + ",") + _local2(n22, _arg1)) + ",") + _local2(n23, _arg1)) + ",") + _local2(n24, _arg1)) + ","));
_local3 = (_local3 + (((((((_local2(n31, _arg1) + ",") + _local2(n32, _arg1)) + ",") + _local2(n33, _arg1)) + ",") + _local2(n34, _arg1)) + ","));
_local3 = (_local3 + ((((((_local2(n41, _arg1) + ",") + _local2(n42, _arg1)) + ",") + _local2(n43, _arg1)) + ",") + _local2(n44, _arg1)));
return (_local3);
}
final public function transform(_arg1:Point3D):void{
var _local2:Number = _arg1.x;
var _local3:Number = _arg1.y;
var _local4:Number = _arg1.z;
_arg1.x = ((((_local2 * n11) + (_local3 * n12)) + (_local4 * n13)) + n14);
_arg1.y = ((((_local2 * n21) + (_local3 * n22)) + (_local4 * n23)) + n24);
_arg1.z = ((((_local2 * n31) + (_local3 * n32)) + (_local4 * n33)) + n34);
}
final public function copy(_arg1:Matrix4):void{
n11 = _arg1.n11;
n12 = _arg1.n12;
n13 = _arg1.n13;
n14 = _arg1.n14;
n21 = _arg1.n21;
n22 = _arg1.n22;
n23 = _arg1.n23;
n24 = _arg1.n24;
n31 = _arg1.n31;
n32 = _arg1.n32;
n33 = _arg1.n33;
n34 = _arg1.n34;
n41 = _arg1.n41;
n42 = _arg1.n42;
n43 = _arg1.n43;
n44 = _arg1.n44;
}
final public function toString():String{
var _local1 = ("sandy.core.data.Matrix4" + "\n (");
_local1 = (_local1 + (((((((n11 + "\t") + n12) + "\t") + n13) + "\t") + n14) + "\n"));
_local1 = (_local1 + (((((((n21 + "\t") + n22) + "\t") + n23) + "\t") + n24) + "\n"));
_local1 = (_local1 + (((((((n31 + "\t") + n32) + "\t") + n33) + "\t") + n34) + "\n"));
_local1 = (_local1 + (((((((n41 + "\t") + n42) + "\t") + n43) + "\t") + n44) + "\n)"));
return (_local1);
}
public static function deserialize(_arg1:String):Matrix4{
var _local2:Array = _arg1.split(",");
if (_local2.length != 16){
trace(("Unexpected length of string to deserialize into a matrix4 " + _arg1));
};
var _local3:Number = 0;
while (_local3 < _local2.length) {
_local2[_local3] = Number(_local2[_local3]);
_local3++;
};
var _local4:Matrix4 = new Matrix4(_local2[0], _local2[1], _local2[2], _local2[3], _local2[4], _local2[5], _local2[6], _local2[7], _local2[8], _local2[9], _local2[10], _local2[11], _local2[12], _local2[13], _local2[14], _local2[15]);
return (_local4);
}
}
}//package sandy.core.data
Section 78
//Plane (sandy.core.data.Plane)
package sandy.core.data {
public final class Plane {
public var a:Number;
public var c:Number;
public var b:Number;
public var d:Number;
public function Plane(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0){
this.a = _arg1;
this.b = _arg2;
this.c = _arg3;
this.d = _arg4;
}
public function toString():String{
return (((((((((("sandy.core.data.Plane" + "(a:") + a) + ", b:") + b) + ", c:") + c) + ", d:") + d) + ")"));
}
}
}//package sandy.core.data
Section 79
//Point3D (sandy.core.data.Point3D)
package sandy.core.data {
import sandy.util.*;
public final class Point3D {
public var y:Number;
public var x:Number;
public var z:Number;
public function Point3D(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0){
x = _arg1;
y = _arg2;
z = _arg3;
}
final public function sub(_arg1:Point3D):void{
x = (x - _arg1.x);
y = (y - _arg1.y);
z = (z - _arg1.z);
}
final public function getMinComponent():Number{
return (Math.min(x, Math.min(y, z)));
}
final public function negate():Point3D{
return (new Point3D(-(x), -(y), -(z)));
}
public function resetToNegativeInfinity():void{
x = (y = (z = Number.NEGATIVE_INFINITY));
}
final public function dot(_arg1:Point3D):Number{
return ((((x * _arg1.x) + (y * _arg1.y)) + (z * _arg1.z)));
}
final public function scale(_arg1:Number):void{
x = (x * _arg1);
y = (y * _arg1);
z = (z * _arg1);
}
public function resetToPositiveInfinity():void{
x = (y = (z = Number.POSITIVE_INFINITY));
}
final public function normalize():void{
var _local1:Number = getNorm();
if ((((_local1 == 0)) || ((_local1 == 1)))){
return;
};
x = (x / _local1);
y = (y / _local1);
z = (z / _local1);
}
final public function cross(_arg1:Point3D):Point3D{
return (new Point3D(((y * _arg1.z) - (z * _arg1.y)), ((z * _arg1.x) - (x * _arg1.z)), ((x * _arg1.y) - (y * _arg1.x))));
}
public function reset(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0):void{
x = _arg1;
y = _arg2;
z = _arg3;
}
final public function pow(_arg1:Number):void{
x = Math.pow(x, _arg1);
y = Math.pow(y, _arg1);
z = Math.pow(z, _arg1);
}
final public function getAngle(_arg1:Point3D):Number{
var _local5:Number;
var _local6:Number;
var _local2:Number = getNorm();
var _local3:Number = _arg1.getNorm();
var _local4:Number = (_local2 * _local3);
if (_local4 == 0){
return (0);
};
_local5 = (dot(_arg1) / _local4);
_local6 = (1 - (_local5 * _local5));
if (_local6 < 0){
trace((" wrong " + _local5));
_local6 = 0;
};
return (Math.atan2(Math.sqrt(_local6), _local5));
}
public function serialize(_arg1:Number=0.1):String{
return (((((NumberUtil.roundTo(x, _arg1) + ",") + NumberUtil.roundTo(y, _arg1)) + ",") + NumberUtil.roundTo(z, _arg1)));
}
final public function add(_arg1:Point3D):void{
x = (x + _arg1.x);
y = (y + _arg1.y);
z = (z + _arg1.z);
}
final public function clone():Point3D{
var _local1:Point3D = new Point3D(x, y, z);
return (_local1);
}
final public function crossWith(_arg1:Point3D):void{
var _local2:Number = ((y * _arg1.z) - (z * _arg1.y));
var _local3:Number = ((z * _arg1.x) - (x * _arg1.z));
var _local4:Number = ((x * _arg1.y) - (y * _arg1.x));
x = _local2;
y = _local3;
z = _local4;
}
final public function toString(_arg1:Number=0):String{
return ((("{" + serialize(Math.pow(10, -(_arg1)))) + "}"));
}
final public function getMaxComponent():Number{
return (Math.max(x, Math.max(y, z)));
}
final public function getNorm():Number{
return (Math.sqrt((((x * x) + (y * y)) + (z * z))));
}
final public function copy(_arg1:Point3D):void{
x = _arg1.x;
y = _arg1.y;
z = _arg1.z;
}
final public function equals(_arg1:Point3D):Boolean{
return ((((((_arg1.x == x)) && ((_arg1.y == y)))) && ((_arg1.z == z))));
}
public static function deserialize(_arg1:String):Point3D{
var _local2:Array = _arg1.split(",");
if (_local2.length != 3){
trace(("Unexpected length of string to deserialize into a Point3D " + _arg1));
};
var _local3:Number = 0;
while (_local3 < _local2.length) {
_local2[_local3] = Number(_local2[_local3]);
_local3++;
};
return (new Point3D(_local2[0], _local2[1], _local2[2]));
}
}
}//package sandy.core.data
Section 80
//Polygon (sandy.core.data.Polygon)
package sandy.core.data {
import sandy.events.*;
import sandy.core.scenegraph.*;
import sandy.materials.*;
import sandy.view.*;
import sandy.core.*;
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import sandy.core.interaction.*;
import flash.utils.*;
import sandy.math.*;
public final class Polygon implements IDisplayable {
public const id:uint;
protected var m_oContainer:Sprite;
private var m_nDepth:Number;
protected var m_oEB:BubbleEventBroadcaster;
private var m_nNormalId:uint;
public var shape:Shape3D;
private var mouseEvents:Boolean;// = false
public var vertexNormals:Array;
private var m_bWasOver:Boolean;// = false
public var aNeighboors:Array;
public var isClipped:Boolean;// = false
public var caUVCoord:Array;
public var uvBounds:Rectangle;
private var m_oGeometry:Geometry3D;
public var minZ:Number;
public var aUVCoord:Array;
private var mouseInteractivity:Boolean;// = false
public var cvertices:Array;
public var a:Vertex;
public var c:Vertex;
private var m_oAppearance:Appearance;
public var b:Vertex;
public var d:Vertex;
private var m_oScene:Scene3D;// = null
public var visible:Boolean;
public var aEdges:Array;
public var vertices:Array;
private static var _ID_:uint = 0;
public static var POLYGON_MAP:Dictionary = new Dictionary(true);
public function Polygon(_arg1:Shape3D, _arg2:Geometry3D, _arg3:Array, _arg4:Array=null, _arg5:Number=0, _arg6:uint=0){
id = _ID_++;
aNeighboors = new Array();
super();
shape = _arg1;
m_oGeometry = _arg2;
__update(_arg3, _arg4, _arg5, _arg6);
m_oContainer = new Sprite();
POLYGON_MAP[id] = this;
m_oEB = new BubbleEventBroadcaster(this);
}
private function _finishMaterial(_arg1:SandyEvent):void{
if (!m_oAppearance){
return;
};
if (m_oAppearance.frontMaterial){
m_oAppearance.frontMaterial.finish(m_oScene);
if (m_oAppearance.backMaterial != m_oAppearance.frontMaterial){
m_oAppearance.backMaterial.finish(m_oScene);
};
};
}
public function createNormal():Point3D{
var _local1:Point3D;
var _local2:Point3D;
var _local3:Vertex;
var _local4:Vertex;
var _local5:Vertex;
var _local6:Point3D;
if (vertices.length > 2){
_local3 = vertices[0];
_local4 = vertices[1];
_local5 = vertices[2];
_local1 = new Point3D((_local4.x - _local3.x), (_local4.y - _local3.y), (_local4.z - _local3.z));
_local2 = new Point3D((_local4.x - _local5.x), (_local4.y - _local5.y), (_local4.z - _local5.z));
_local6 = Point3DMath.cross(_local1, _local2);
Point3DMath.normalize(_local6);
return (_local6);
};
return (new Point3D());
}
public function toString():String{
return ((((("sandy.core.data.Polygon::id=" + id) + " [Points: ") + vertices.length) + "]"));
}
public function set depth(_arg1:Number):void{
m_nDepth = _arg1;
}
private function _beginMaterial(_arg1:SandyEvent):void{
if (!m_oAppearance){
return;
};
if (m_oAppearance.frontMaterial){
m_oAppearance.frontMaterial.begin(m_oScene);
if (m_oAppearance.backMaterial != m_oAppearance.frontMaterial){
m_oAppearance.backMaterial.begin(m_oScene);
};
};
}
public function get scene():Scene3D{
return (m_oScene);
}
public function get appearance():Appearance{
return (m_oAppearance);
}
public function _onTextureInteraction(_arg1:Event=null):void{
if ((((_arg1 == null)) || (!((_arg1 is MouseEvent))))){
_arg1 = new MouseEvent(MouseEvent.MOUSE_MOVE, true, false, 0, 0, null, false, false, false, false, 0);
};
var _local2:Point = new Point(scene.container.mouseX, scene.container.mouseY);
var _local3:UVCoord = getUVFrom2D(_local2);
VirtualMouse.getInstance().interactWithTexture(this, _local3, (_arg1 as MouseEvent));
_onInteraction(_arg1);
}
public function updateNormal():void{
var _local1:Number = (((a.y - b.y) * (c.z - b.z)) - ((a.z - b.z) * (c.y - b.y)));
var _local2:Number = (((a.z - b.z) * (c.x - b.x)) - ((a.x - b.x) * (c.z - b.z)));
var _local3:Number = (((a.x - b.x) * (c.y - b.y)) - ((a.y - b.y) * (c.x - b.x)));
normal.reset(_local1, _local2, _local3);
}
public function set scene(_arg1:Scene3D):void{
if (_arg1 == null){
return;
};
if (m_oScene != null){
m_oScene.removeEventListener(SandyEvent.SCENE_RENDER_FINISH, _finishMaterial);
m_oScene.removeEventListener(SandyEvent.SCENE_RENDER_DISPLAYLIST, _beginMaterial);
};
m_oScene = _arg1;
m_oScene.addEventListener(SandyEvent.SCENE_RENDER_FINISH, _finishMaterial);
m_oScene.addEventListener(SandyEvent.SCENE_RENDER_DISPLAYLIST, _beginMaterial);
}
public function get container():Sprite{
return (m_oContainer);
}
public function swapCulling():void{
normal.negate();
}
public function get3DFrom2D(_arg1:Point):Point3D{
var _local2:Matrix = new Matrix((vertices[1].sx - vertices[0].sx), (vertices[2].sx - vertices[0].sx), (vertices[1].sy - vertices[0].sy), (vertices[2].sy - vertices[0].sy), 0, 0);
_local2.invert();
var _local3:Number = ((_local2.a * (_arg1.x - vertices[0].sx)) + (_local2.b * (_arg1.y - vertices[0].sy)));
var _local4:Number = ((_local2.c * (_arg1.x - vertices[0].sx)) + (_local2.d * (_arg1.y - vertices[0].sy)));
var _local5:Point3D = new Point3D(((vertices[0].x + (_local3 * (vertices[1].x - vertices[0].x))) + (_local4 * (vertices[2].x - vertices[0].x))), ((vertices[0].y + (_local3 * (vertices[1].y - vertices[0].y))) + (_local4 * (vertices[2].y - vertices[0].y))), ((vertices[0].z + (_local3 * (vertices[1].z - vertices[0].z))) + (_local4 * (vertices[2].z - vertices[0].z))));
this.shape.matrix.transform(_local5);
return (_local5);
}
public function get material():Material{
if (m_oAppearance == null){
return (null);
};
return ((visible) ? m_oAppearance.frontMaterial : m_oAppearance.backMaterial);
}
private function __update(_arg1:Array, _arg2:Array, _arg3:uint, _arg4:uint):void{
var _local6:*;
var _local7:uint;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:*;
var _local13:UVCoord;
var _local14:Point3D;
var _local15:Edge3D;
var _local5:int;
vertexNormals = new Array();
vertices = new Array();
for each (_local6 in _arg1) {
vertices[_local5] = Vertex(m_oGeometry.aVertex[_arg1[_local5]]);
vertexNormals[_local5] = m_oGeometry.aVertexNormals[_arg1[_local5]];
_local5++;
};
a = vertices[0];
b = vertices[1];
c = vertices[2];
d = vertices[3];
if (_arg2){
_local8 = Number.POSITIVE_INFINITY;
_local9 = Number.POSITIVE_INFINITY;
_local10 = Number.NEGATIVE_INFINITY;
_local11 = Number.NEGATIVE_INFINITY;
aUVCoord = new Array();
_local5 = 0;
if (_arg2){
for each (_local12 in _arg2) {
_local13 = (m_oGeometry.aUVCoords[_arg2[_local5]] as UVCoord);
if (_local13 == null){
_local13 = new UVCoord(0, 0);
};
aUVCoord[_local5] = _local13;
if (_local13.u < _local8){
_local8 = _local13.u;
} else {
if (_local13.u > _local10){
_local10 = _local13.u;
};
};
if (_local13.v < _local9){
_local9 = _local13.v;
} else {
if (_local13.v > _local11){
_local11 = _local13.v;
};
};
_local5++;
};
uvBounds = new Rectangle(_local8, _local9, (_local10 - _local8), (_local11 - _local9));
} else {
aUVCoord = [new UVCoord(), new UVCoord(), new UVCoord()];
uvBounds = new Rectangle(0, 0, 0, 0);
};
};
m_nNormalId = _arg3;
normal = Vertex(m_oGeometry.aFacesNormals[_arg3]);
if (normal == null){
_local14 = createNormal();
m_nNormalId = m_oGeometry.setFaceNormal(m_oGeometry.getNextFaceNormalID(), _local14.x, _local14.y, _local14.z);
};
aEdges = new Array();
for each (_local7 in m_oGeometry.aFaceEdges[_arg4]) {
_local15 = m_oGeometry.aEdges[_local7];
_local15.vertex1 = m_oGeometry.aVertex[_local15.vertexId1];
_local15.vertex2 = m_oGeometry.aVertex[_local15.vertexId2];
aEdges.push(_local15);
};
}
public function clipFrontPlane(_arg1:Frustum):Array{
cvertices = vertices.concat();
if (vertices.length < 3){
isClipped = _arg1.clipLineFrontPlane(cvertices);
} else {
caUVCoord = aUVCoord.concat();
isClipped = _arg1.clipFrontPlane(cvertices, caUVCoord);
};
return (cvertices);
}
public function get broadcaster():BubbleEventBroadcaster{
return (m_oEB);
}
public function get enableInteractivity():Boolean{
return (mouseInteractivity);
}
public function _startMouseInteraction(_arg1:MouseEvent=null):void{
container.addEventListener(MouseEvent.CLICK, _onTextureInteraction);
container.addEventListener(MouseEvent.MOUSE_UP, _onTextureInteraction);
container.addEventListener(MouseEvent.MOUSE_DOWN, _onTextureInteraction);
container.addEventListener(MouseEvent.DOUBLE_CLICK, _onTextureInteraction);
container.addEventListener(MouseEvent.MOUSE_MOVE, _onTextureInteraction);
container.addEventListener(MouseEvent.MOUSE_OVER, _onTextureInteraction);
container.addEventListener(MouseEvent.MOUSE_OUT, _onTextureInteraction);
container.addEventListener(MouseEvent.MOUSE_WHEEL, _onTextureInteraction);
container.addEventListener(KeyboardEvent.KEY_DOWN, _onTextureInteraction);
container.addEventListener(KeyboardEvent.KEY_UP, _onTextureInteraction);
m_oContainer.addEventListener(Event.ENTER_FRAME, _onTextureInteraction);
}
public function get changed():Boolean{
return (shape.changed);
}
public function get depth():Number{
return (m_nDepth);
}
public function precompute():void{
isClipped = false;
minZ = a.wz;
if (b.wz < minZ){
minZ = b.wz;
};
m_nDepth = (a.wz + b.wz);
if (c != null){
if (c.wz < minZ){
minZ = c.wz;
};
m_nDepth = (m_nDepth + c.wz);
};
if (d != null){
if (d.wz < minZ){
minZ = d.wz;
};
m_nDepth = (m_nDepth + d.wz);
};
m_nDepth = (m_nDepth / vertices.length);
}
public function addEventListener(_arg1:String, _arg2):void{
m_oEB.addEventListener.apply(m_oEB, arguments);
}
public function set normal(_arg1:Vertex):void{
if (_arg1 != null){
m_oGeometry.aFacesNormals[m_nNormalId].copy(_arg1);
};
}
public function removeEventListener(_arg1:String, _arg2):void{
m_oEB.removeEventListener(_arg1, _arg2);
}
public function clear():void{
if (m_oContainer != null){
m_oContainer.graphics.clear();
};
}
protected function _onInteraction(_arg1:Event):void{
var _local2:Point = new Point(m_oContainer.mouseX, m_oContainer.mouseY);
var _local3:UVCoord = getUVFrom2D(_local2);
var _local4:Point3D = get3DFrom2D(_local2);
shape.m_oLastContainer = this.m_oContainer;
shape.m_oLastEvent = new Shape3DEvent(_arg1.type, shape, this, _local3, _local4, _arg1);
m_oEB.dispatchEvent(shape.m_oLastEvent);
if (_arg1.type == MouseEvent.MOUSE_OVER){
shape.m_bWasOver = true;
};
}
public function clip(_arg1:Frustum):Array{
cvertices = null;
caUVCoord = null;
var _local2:CullingState = _arg1.polygonInFrustum(this);
if (_local2 == CullingState.INSIDE){
return (vertices);
};
if (_local2 == CullingState.OUTSIDE){
return (null);
};
if (vertices.length < 3){
clipFrontPlane(_arg1);
} else {
cvertices = vertices.concat();
caUVCoord = aUVCoord.concat();
isClipped = _arg1.clipFrustum(cvertices, caUVCoord);
};
return (cvertices);
}
public function createTransformedNormal():Point3D{
var _local1:Point3D;
var _local2:Point3D;
var _local3:Vertex;
var _local4:Vertex;
var _local5:Vertex;
var _local6:Point3D;
if (vertices.length > 2){
_local3 = vertices[0];
_local4 = vertices[1];
_local5 = vertices[2];
_local1 = new Point3D((_local4.wx - _local3.wx), (_local4.wy - _local3.wy), (_local4.wz - _local3.wz));
_local2 = new Point3D((_local4.wx - _local5.wx), (_local4.wy - _local5.wy), (_local4.wz - _local5.wz));
_local6 = Point3DMath.cross(_local1, _local2);
Point3DMath.normalize(_local6);
return (_local6);
};
return (new Point3D());
}
public function getUVFrom2D(_arg1:Point):UVCoord{
var _local2:Point = new Point(vertices[0].sx, vertices[0].sy);
var _local3:Point = new Point(vertices[1].sx, vertices[1].sy);
var _local4:Point = new Point(vertices[2].sx, vertices[2].sy);
var _local5:UVCoord = aUVCoord[0];
var _local6:UVCoord = aUVCoord[1];
var _local7:UVCoord = aUVCoord[2];
var _local8:Point = new Point((_local3.x - _local2.x), (_local3.y - _local2.y));
var _local9:Point = _local8.clone();
_local9.normalize(1);
var _local10:Point = new Point((_local4.x - _local2.x), (_local4.y - _local2.y));
var _local11:Point = _local10.clone();
_local11.normalize(1);
var _local12:Point = new Point((_arg1.x - _local8.x), (_arg1.y - _local8.y));
var _local13:Point = IntersectionMath.intersectionLine2D(_local2, _local4, _arg1, _local12);
var _local14:Point = new Point((_local13.x - _local2.x), (_local13.y - _local2.y));
var _local15:Point = new Point((_arg1.x - _local13.x), (_arg1.y - _local13.y));
var _local16:Number = (_local15.length / _local8.length);
var _local17:Number = (_local14.length / _local10.length);
return (new UVCoord(((_local5.u + (_local16 * (_local6.u - _local5.u))) + (_local17 * (_local7.u - _local5.u))), ((_local5.v + (_local16 * (_local6.v - _local5.v))) + (_local17 * (_local7.v - _local5.v)))));
}
public function _stopMouseInteraction(_arg1:MouseEvent=null):void{
m_oContainer.removeEventListener(MouseEvent.CLICK, _onTextureInteraction);
m_oContainer.removeEventListener(MouseEvent.MOUSE_UP, _onTextureInteraction);
m_oContainer.removeEventListener(MouseEvent.MOUSE_DOWN, _onTextureInteraction);
m_oContainer.removeEventListener(MouseEvent.DOUBLE_CLICK, _onTextureInteraction);
m_oContainer.removeEventListener(MouseEvent.MOUSE_MOVE, _onTextureInteraction);
m_oContainer.removeEventListener(MouseEvent.MOUSE_OVER, _onTextureInteraction);
m_oContainer.removeEventListener(MouseEvent.MOUSE_OUT, _onTextureInteraction);
m_oContainer.removeEventListener(MouseEvent.MOUSE_WHEEL, _onTextureInteraction);
m_oContainer.removeEventListener(Event.ENTER_FRAME, _onTextureInteraction);
m_oContainer.removeEventListener(KeyboardEvent.KEY_DOWN, _onTextureInteraction);
m_oContainer.removeEventListener(KeyboardEvent.KEY_UP, _onTextureInteraction);
}
public function set enableInteractivity(_arg1:Boolean):void{
if (_arg1 != mouseInteractivity){
if (_arg1){
container.addEventListener(MouseEvent.ROLL_OVER, _startMouseInteraction, false);
container.addEventListener(MouseEvent.ROLL_OUT, _stopMouseInteraction, false);
} else {
_stopMouseInteraction();
};
mouseInteractivity = _arg1;
};
}
public function set appearance(_arg1:Appearance):void{
if (_arg1 == m_oAppearance){
return;
};
if (((!((m_oAppearance == null))) && (!((_arg1 == null))))){
if (_arg1.frontMaterial != m_oAppearance.frontMaterial){
m_oAppearance.frontMaterial.unlink(this);
_arg1.frontMaterial.init(this);
};
if (((!((m_oAppearance.frontMaterial == m_oAppearance.backMaterial))) && (!((_arg1.backMaterial == m_oAppearance.backMaterial))))){
m_oAppearance.backMaterial.unlink(this);
};
if (((!((_arg1.frontMaterial == _arg1.backMaterial))) && (!((_arg1.backMaterial == m_oAppearance.backMaterial))))){
_arg1.backMaterial.init(this);
};
m_oAppearance = _arg1;
} else {
if (_arg1){
m_oAppearance = _arg1;
m_oAppearance.frontMaterial.init(this);
if (m_oAppearance.backMaterial != m_oAppearance.frontMaterial){
m_oAppearance.backMaterial.init(this);
};
} else {
if (m_oAppearance){
m_oAppearance.frontMaterial.unlink(this);
if (m_oAppearance.backMaterial != m_oAppearance.frontMaterial){
m_oAppearance.backMaterial.unlink(this);
};
m_oAppearance = null;
};
};
};
}
public function get normal():Vertex{
return (m_oGeometry.aFacesNormals[m_nNormalId]);
}
public function set enableEvents(_arg1:Boolean):void{
if (((_arg1) && (!(mouseEvents)))){
container.addEventListener(MouseEvent.CLICK, _onInteraction);
container.addEventListener(MouseEvent.MOUSE_UP, _onInteraction);
container.addEventListener(MouseEvent.MOUSE_DOWN, _onInteraction);
container.addEventListener(MouseEvent.ROLL_OVER, _onInteraction);
container.addEventListener(MouseEvent.ROLL_OUT, _onInteraction);
container.addEventListener(MouseEvent.DOUBLE_CLICK, _onInteraction);
container.addEventListener(MouseEvent.MOUSE_MOVE, _onInteraction);
container.addEventListener(MouseEvent.MOUSE_OVER, _onInteraction);
container.addEventListener(MouseEvent.MOUSE_OUT, _onInteraction);
container.addEventListener(MouseEvent.MOUSE_WHEEL, _onInteraction);
} else {
if (((!(_arg1)) && (mouseEvents))){
container.removeEventListener(MouseEvent.CLICK, _onInteraction);
container.removeEventListener(MouseEvent.MOUSE_UP, _onInteraction);
container.removeEventListener(MouseEvent.MOUSE_DOWN, _onInteraction);
container.removeEventListener(MouseEvent.ROLL_OVER, _onInteraction);
container.removeEventListener(MouseEvent.ROLL_OUT, _onInteraction);
container.removeEventListener(MouseEvent.DOUBLE_CLICK, _onInteraction);
container.removeEventListener(MouseEvent.MOUSE_MOVE, _onInteraction);
container.removeEventListener(MouseEvent.MOUSE_OVER, _onInteraction);
container.removeEventListener(MouseEvent.MOUSE_OUT, _onInteraction);
container.removeEventListener(MouseEvent.MOUSE_WHEEL, _onInteraction);
};
};
mouseEvents = _arg1;
}
public function destroy():void{
clear();
scene.removeEventListener(SandyEvent.SCENE_RENDER_FINISH, _finishMaterial);
scene.removeEventListener(SandyEvent.SCENE_RENDER_DISPLAYLIST, _beginMaterial);
enableEvents = false;
enableInteractivity = false;
if (appearance){
if (appearance.backMaterial){
appearance.backMaterial.unlink(this);
};
if (appearance.frontMaterial){
appearance.frontMaterial.unlink(this);
};
appearance = null;
};
if (m_oContainer.parent){
m_oContainer.parent.removeChild(m_oContainer);
};
if (m_oContainer){
m_oContainer = null;
};
cvertices = null;
vertices = null;
m_oEB = null;
m_oGeometry = null;
shape = null;
scene = null;
delete POLYGON_MAP[id];
}
public function display(_arg1:Sprite=null):void{
var _local2:Sprite = (_arg1) ? _arg1 : m_oContainer;
if (material){
material.renderPolygon(scene, this, _local2);
};
}
public function get enableEvents():Boolean{
return (mouseEvents);
}
}
}//package sandy.core.data
Section 81
//Pool (sandy.core.data.Pool)
package sandy.core.data {
public class Pool {
private const m_aPoint3Ds:Array;
private const m_aVertices:Array;
private const m_aUV:Array;
private var m_nIdVertice:int;// = 0
private var m_nIdPoint3D:int;// = 0
private var m_nIdUV:int;// = 0
private var m_nSize:int;// = 300
private static var INSTANCE:Pool = null;
public function Pool(){
m_aVertices = new Array();
m_aUV = new Array();
m_aPoint3Ds = new Array();
super();
if (INSTANCE != null){
throw (new Error("There *MUST* be single Pool instance."));
};
var _local1:int;
while (_local1 < m_nSize) {
m_aVertices[int(_local1)] = new Vertex();
m_aUV[int(_local1)] = new UVCoord();
m_aPoint3Ds[int(_local1)] = new Point3D();
_local1++;
};
}
public function get nextPoint3D():Point3D{
if (m_nIdPoint3D >= m_aPoint3Ds.length){
m_aPoint3Ds[m_aPoint3Ds.length] = new Point3D();
};
return (m_aPoint3Ds[int(m_nIdPoint3D++)]);
}
public function init():void{
m_nIdVertice = (m_nIdUV = (m_nIdPoint3D = 0));
}
public function get nextUV():UVCoord{
if (m_nIdUV >= m_aUV.length){
m_aUV[m_aUV.length] = new UVCoord();
};
return (m_aUV[int(m_nIdUV++)]);
}
public function get nextVertex():Vertex{
if (m_nIdVertice >= m_aVertices.length){
m_aVertices[m_aVertices.length] = new Vertex();
};
var _local1:Vertex = m_aVertices[int(m_nIdVertice++)];
_local1.projected = false;
_local1.transformed = false;
return (_local1);
}
public static function getInstance():Pool{
if (INSTANCE == null){
INSTANCE = new (Pool);
};
return (INSTANCE);
}
}
}//package sandy.core.data
Section 82
//UVCoord (sandy.core.data.UVCoord)
package sandy.core.data {
public final class UVCoord {
public var u:Number;
public var v:Number;
public function UVCoord(_arg1:Number=0, _arg2:Number=0){
u = _arg1;
v = _arg2;
}
public function sub(_arg1:UVCoord):void{
u = (u - _arg1.u);
v = (v - _arg1.v);
}
public function add(_arg1:UVCoord):void{
u = (u + _arg1.u);
v = (v + _arg1.v);
}
public function length():Number{
return (Math.sqrt(((u * u) + (v * v))));
}
public function scale(_arg1:Number):void{
u = (u * _arg1);
v = (v * _arg1);
}
public function toString():String{
return (((((("sandy.core.data.UVCoord" + "(u:") + u) + ", v:") + v) + ")"));
}
public function normalize():void{
var _local1:Number = length();
u = (u / _local1);
v = (v / _local1);
}
public function copy(_arg1:UVCoord):void{
u = _arg1.u;
v = _arg1.v;
}
public function clone():UVCoord{
return (new UVCoord(u, v));
}
}
}//package sandy.core.data
Section 83
//Vertex (sandy.core.data.Vertex)
package sandy.core.data {
import sandy.util.*;
public final class Vertex {
public const id:uint;
private const m_oCamera:Point3D;
private const m_oLocal:Point3D;
public var flags:int;// = 0
public var transformed:Boolean;// = false
public var x:Number;
public var aFaces:Array;
public var wx:Number;
public var wy:Number;
public var wz:Number;
public var sx:Number;
public var sy:Number;
public var nbFaces:uint;// = 0
public var projected:Boolean;// = false
public var y:Number;
public var z:Number;
private static var ID:uint = 0;
public function Vertex(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0, ... _args){
id = ID++;
aFaces = new Array();
m_oCamera = new Point3D();
m_oLocal = new Point3D();
super();
x = _arg1;
y = _arg2;
z = _arg3;
wx = (_args[0]) ? _args[0] : x;
wy = (_args[1]) ? _args[1] : y;
wz = (_args[2]) ? _args[2] : z;
sy = (sx = 0);
}
final public function negate():void{
x = -(x);
y = -(y);
z = -(z);
wx = -(wx);
wy = -(wy);
wz = -(wz);
}
final public function normalize():void{
var _local1:Number = getNorm();
if ((((_local1 == 0)) || ((_local1 == 1)))){
return;
};
x = (x / _local1);
y = (y / _local1);
z = (z / _local1);
wx = (wx / _local1);
wy = (wy / _local1);
wz = (wz / _local1);
}
final public function getAngle(_arg1:Vertex):Number{
var _local2:Number = (dot(_arg1) / (getNorm() * _arg1.getNorm()));
var _local3:Number = (1 - (_local2 * _local2));
if (_local3 < 0){
trace((" wrong " + _local2));
_local3 = 0;
};
return (Math.atan2(Math.sqrt(_local3), _local2));
}
final public function add(_arg1:Vertex):void{
x = (x + _arg1.x);
y = (y + _arg1.y);
z = (z + _arg1.z);
wx = (wx + _arg1.wx);
wy = (wy + _arg1.wy);
wz = (wz + _arg1.wz);
}
final public function getNorm():Number{
return (Math.sqrt((((x * x) + (y * y)) + (z * z))));
}
final public function equals(_arg1:Vertex):Boolean{
return (Boolean((((((((((((((((_arg1.x == x)) && ((_arg1.y == y)))) && ((_arg1.z == z)))) && ((_arg1.wx == wx)))) && ((_arg1.wy == wy)))) && ((_arg1.wz == wz)))) && ((_arg1.sx == wx)))) && ((_arg1.sy == sy)))));
}
public function sub(_arg1:Vertex):void{
x = (x - _arg1.x);
y = (y - _arg1.y);
z = (z - _arg1.z);
wx = (wx - _arg1.wx);
wy = (wy - _arg1.wy);
wz = (wz - _arg1.wz);
}
final public function cross(_arg1:Vertex):Vertex{
return (new Vertex(((y * _arg1.z) - (z * _arg1.y)), ((z * _arg1.x) - (x * _arg1.z)), ((x * _arg1.y) - (y * _arg1.x))));
}
final public function dot(_arg1:Vertex):Number{
return ((((x * _arg1.x) + (y * _arg1.y)) + (z * _arg1.z)));
}
final public function getPoint3D():Point3D{
m_oLocal.x = x;
m_oLocal.y = y;
m_oLocal.z = z;
return (m_oLocal);
}
public function getScreenPoint():Point3D{
return (new Point3D(sx, sy, wz));
}
public function reset(_arg1:Number, _arg2:Number, _arg3:Number):void{
x = _arg1;
y = _arg2;
z = _arg3;
wx = x;
wy = y;
wz = z;
}
final public function scale(_arg1:Number):void{
x = (x * _arg1);
y = (y * _arg1);
z = (z * _arg1);
wx = (wx * _arg1);
wy = (wy * _arg1);
wz = (wz * _arg1);
}
final public function pow(_arg1:Number):void{
x = Math.pow(x, _arg1);
y = Math.pow(y, _arg1);
z = Math.pow(z, _arg1);
wx = Math.pow(wx, _arg1);
wy = Math.pow(wy, _arg1);
wz = Math.pow(wz, _arg1);
}
final public function clone():Vertex{
var _local1:Vertex = new Vertex(x, y, z);
_local1.wx = wx;
_local1.sx = sx;
_local1.wy = wy;
_local1.sy = sy;
_local1.wz = wz;
_local1.nbFaces = nbFaces;
_local1.aFaces = aFaces.concat();
return (_local1);
}
final public function serialize(_arg1:Number=0):String{
if (_arg1 == 0){
_arg1 = 0.01;
};
return (((((((((((((((NumberUtil.roundTo(x, _arg1) + ",") + NumberUtil.roundTo(y, _arg1)) + ",") + NumberUtil.roundTo(z, _arg1)) + ",") + NumberUtil.roundTo(wx, _arg1)) + ",") + NumberUtil.roundTo(wy, _arg1)) + ",") + NumberUtil.roundTo(wz, _arg1)) + ",") + NumberUtil.roundTo(sx, _arg1)) + ",") + NumberUtil.roundTo(sy, _arg1)));
}
final public function toString(_arg1:Number=0):String{
if (_arg1 == 0){
_arg1 = 0.01;
};
return ((((((((((((((((("{" + NumberUtil.roundTo(x, _arg1)) + ", ") + NumberUtil.roundTo(y, _arg1)) + ", ") + NumberUtil.roundTo(z, _arg1)) + ", ") + NumberUtil.roundTo(wx, _arg1)) + ", ") + NumberUtil.roundTo(wy, _arg1)) + ", ") + NumberUtil.roundTo(wz, _arg1)) + ", ") + NumberUtil.roundTo(sx, _arg1)) + ", ") + NumberUtil.roundTo(sy, _arg1)) + "}"));
}
final public function getCameraPoint3D():Point3D{
m_oCamera.x = wx;
m_oCamera.y = wy;
m_oCamera.z = wz;
return (m_oCamera);
}
final public function clone2():Vertex{
return (new Vertex(wx, wy, wz));
}
final public function copy(_arg1:Vertex):void{
x = _arg1.x;
y = _arg1.y;
z = _arg1.z;
wx = _arg1.wx;
wy = _arg1.wy;
wz = _arg1.wz;
sx = _arg1.sx;
sy = _arg1.sy;
}
final public function deserialize(_arg1:String):void{
var _local2:Array = _arg1.split(",");
if (_local2.length != 9){
trace(("Unexpected length of string to deserialize into a Point3D " + _arg1));
};
x = _local2[0];
y = _local2[1];
z = _local2[2];
wx = _local2[3];
wy = _local2[4];
wz = _local2[5];
sx = _local2[6];
sy = _local2[7];
}
public static function createFromPoint3D(_arg1:Point3D):Vertex{
return (new Vertex(_arg1.x, _arg1.y, _arg1.z));
}
}
}//package sandy.core.data
Section 84
//TextLink (sandy.core.interaction.TextLink)
package sandy.core.interaction {
import flash.geom.*;
import flash.text.*;
import flash.utils.*;
public class TextLink {
private var __tfOwner:TextField;
private var __sTarget:String;
private var __sHRef:String;
public var width:Number;
private var __iOpenIndex:int;
private var __iCloseIndex:int;
public var height:Number;
private var __rBounds:Rectangle;
public var x:Number;
public var y:Number;
public static var textLinks:Dictionary;
public function TextLink(){
x = 0;
y = 0;
height = 0;
width = 0;
}
public function get href():String{
return (__sHRef);
}
public function get closeIndex():int{
return (__iCloseIndex);
}
public function set openIndex(_arg1:int):void{
__iOpenIndex = _arg1;
}
public function get target():String{
return (__sTarget);
}
public function set href(_arg1:String):void{
__sHRef = _arg1;
}
public function set target(_arg1:String):void{
__sTarget = _arg1;
}
public function set owner(_arg1:TextField):void{
__tfOwner = _arg1;
}
public function get openIndex():int{
return (__iOpenIndex);
}
public function getBounds():Rectangle{
return (__rBounds);
}
protected function _init():void{
var _local2:Rectangle;
var _local1:Number = 0;
while (_local1 < (__iCloseIndex - __iOpenIndex)) {
_local2 = __tfOwner.getCharBoundaries((openIndex + _local1));
if (_local1 == 0){
x = _local2.x;
y = _local2.y;
};
width = (width + _local2.width);
height = ((height < _local2.height)) ? _local2.height : height;
_local1++;
};
__rBounds = new Rectangle();
__rBounds.x = x;
__rBounds.y = y;
__rBounds.height = height;
__rBounds.width = width;
}
public function set closeIndex(_arg1:int):void{
__iCloseIndex = _arg1;
}
public function get owner():TextField{
return (__tfOwner);
}
public static function getTextLinks(_arg1:TextField, _arg2:Boolean=false):Array{
var _local11:TextLink;
var _local12:String;
var _local13:String;
if (!_arg1.htmlText){
return (null);
};
if (!textLinks){
textLinks = new Dictionary();
};
if (((textLinks[_arg1]) && (!(_arg2)))){
return (textLinks[_arg1]);
};
textLinks[_arg1] = new Array();
var _local3:String = _arg1.htmlText;
var _local4:RegExp = /href=['"].*?['"]/i;
var _local5:RegExp = /target=['"].*?['"]/i;
var _local6:RegExp = /<A.*?A>/i;
var _local7:RegExp = /<A.*?\>/i;
var _local8:RegExp = /<\/A>/i;
var _local9:RegExp = /<[^A][^\/A].*?>/gi;
_local3 = _local3.replace(_local9, "");
var _local10:Object = _local6.exec(_local3);
while (_local10 != null) {
_local11 = new (TextLink);
_local11.owner = _arg1;
textLinks[_arg1].push(_local11);
_local12 = _local10[0].match(_local4);
_local11.href = _local12.substring(6, (_local12.length - 1));
_local13 = _local10[0].match(_local5);
_local11.target = _local13.substring(8, (_local13.length - 1));
_local11.openIndex = _local3.search(_local7);
_local3 = _local3.replace(_local7, "");
_local11.closeIndex = _local3.search(_local8);
_local3 = _local3.replace(_local8, "");
_local11._init();
_local10 = _local6.exec(_local3);
};
return (textLinks[_arg1]);
}
}
}//package sandy.core.interaction
Section 85
//VirtualMouse (sandy.core.interaction.VirtualMouse)
package sandy.core.interaction {
import sandy.materials.*;
import sandy.core.data.*;
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.text.*;
public class VirtualMouse extends EventDispatcher {
private var m_ioOldTarget:Sprite;
private var _lastEvent:Event;
private var m_oCurrentTargets:Array;
private var m_ioTarget:Sprite;
private var lastLocation:Point;
private var m_oPreviousTargets:Array;
private var lastDownTarget:InteractiveObject;
private var location:Point;
private var lastWithinStage:Boolean;// = true
private static var _oI:VirtualMouse;
public function VirtualMouse(_arg1:PrivateConstructorAccess){
m_oPreviousTargets = [];
m_oCurrentTargets = [];
super();
location = new Point(0, 0);
lastLocation = location.clone();
}
private function _checkLinks(_arg1:TextField):void{
var _local2:Point = _arg1.globalToLocal(location);
var _local3:Array = TextLink.getTextLinks(_arg1);
var _local4:Number = _local3.length;
var _local5:Number = 0;
while (_local5 < _local4) {
if (((_local3[_local5] as TextLink).getBounds() as Rectangle).containsPoint(_local2)){
};
_local5++;
};
}
public function interactWithTexture(_arg1:Polygon, _arg2:UVCoord, _arg3:MouseEvent):void{
var _local6:Sprite;
var _local10:Point;
var _local11:Point;
var _local12:Boolean;
var _local4:MovieMaterial = ((_arg1.visible) ? _arg1.appearance.frontMaterial : _arg1.appearance.backMaterial as MovieMaterial);
if (_local4 == null){
return;
};
m_ioTarget = _local4.movie;
location = new Point((_arg2.u * _local4.texture.width), (_arg2.v * _local4.texture.height));
if (_arg3.type == MouseEvent.MOUSE_OUT){
_local10 = _arg1.container.globalToLocal(location);
if (m_ioOldTarget){
_lastEvent = new MouseEvent(MouseEvent.MOUSE_OUT, true, false, _local10.x, _local10.y, _local6, _arg3.ctrlKey, _arg3.altKey, _arg3.shiftKey, _arg3.buttonDown, _arg3.delta);
m_ioOldTarget.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
_lastEvent = new MouseEvent(MouseEvent.ROLL_OUT, false, false, _local10.x, _local10.y, _local6, _arg3.ctrlKey, _arg3.altKey, _arg3.shiftKey, _arg3.buttonDown, _arg3.delta);
m_ioOldTarget.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
m_ioOldTarget = null;
};
return;
};
var _local5:Array = m_ioTarget.getObjectsUnderPoint(m_ioTarget.localToGlobal(location));
_local6 = null;
var _local7:DisplayObject;
var _local8:int = _local5.length;
while (--_local8 > -1) {
_local7 = _local5[_local8];
while (_local7) {
if (((_local6) && ((_local7 is SimpleButton)))){
_local6 = null;
_local7 = _local7.parent;
continue;
} else {
if (((((_local6) && ((_local7 is DisplayObjectContainer)))) && (!(DisplayObjectContainer(_local7).mouseChildren)))){
_local6 = null;
_local7 = _local7.parent;
continue;
};
};
if (((((!(_local6)) && ((_local7 is DisplayObjectContainer)))) && (DisplayObjectContainer(_local7).mouseEnabled))){
_local6 = (_local7 as Sprite);
};
if (!_local6){
_local7 = _local7.parent;
} else {
m_oCurrentTargets.push(_local6);
_local10 = _arg1.container.globalToLocal(location);
_local11 = _local6.globalToLocal(location);
if (((!((lastLocation.x == location.x))) || (!((lastLocation.y == location.y))))){
_local12 = Boolean((((((((location.x >= 0)) && ((location.y >= 0)))) && ((location.x <= _arg1.container.stage.stageWidth)))) && ((location.y <= _arg1.container.stage.stageHeight))));
if (((!(_local12)) && (lastWithinStage))){
_lastEvent = new MouseEvent(Event.MOUSE_LEAVE, false, false);
_arg1.container.stage.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
if (_local12){
_lastEvent = new MouseEvent(Event.MOUSE_LEAVE, false, false);
_local6.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
lastWithinStage = _local12;
};
if (m_oPreviousTargets.indexOf(_local6) == -1){
_lastEvent = new MouseEvent(MouseEvent.MOUSE_OVER, true, false, _local11.x, _local11.y, m_ioOldTarget, _arg3.ctrlKey, _arg3.altKey, _arg3.shiftKey, _arg3.buttonDown, _arg3.delta);
_local6.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
_lastEvent = new MouseEvent(MouseEvent.ROLL_OVER, false, false, _local11.x, _local11.y, m_ioOldTarget, _arg3.ctrlKey, _arg3.altKey, _arg3.shiftKey, _arg3.buttonDown, _arg3.delta);
_local6.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
if (_arg3.type == MouseEvent.MOUSE_DOWN){
_lastEvent = new MouseEvent(MouseEvent.MOUSE_DOWN, true, false, _local11.x, _local11.y, _local6, _arg3.ctrlKey, _arg3.altKey, _arg3.shiftKey, _arg3.buttonDown, _arg3.delta);
_local6.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
lastDownTarget = _local6;
} else {
if (_arg3.type == MouseEvent.MOUSE_UP){
_lastEvent = new MouseEvent(MouseEvent.MOUSE_UP, true, false, _local11.x, _local11.y, _local6, _arg3.ctrlKey, _arg3.altKey, _arg3.shiftKey, _arg3.buttonDown, _arg3.delta);
_local6.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
} else {
if (_arg3.type == MouseEvent.CLICK){
_lastEvent = new MouseEvent(MouseEvent.CLICK, true, false, _local11.x, _local11.y, _local6, _arg3.ctrlKey, _arg3.altKey, _arg3.shiftKey, _arg3.buttonDown, _arg3.delta);
_local6.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
lastDownTarget = null;
} else {
if ((((_arg3.type == MouseEvent.DOUBLE_CLICK)) && (_local6.doubleClickEnabled))){
_lastEvent = new MouseEvent(MouseEvent.DOUBLE_CLICK, true, false, _local11.x, _local11.y, _local6, _arg3.ctrlKey, _arg3.altKey, _arg3.shiftKey, _arg3.buttonDown, _arg3.delta);
_local6.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
};
};
};
_local7 = _local7.parent;
};
};
};
var _local9:int = m_oPreviousTargets.length;
_local8 = 0;
while (_local8 < _local9) {
if (m_oCurrentTargets.indexOf(m_oPreviousTargets[_local8]) == -1){
m_ioOldTarget = m_oPreviousTargets[_local8];
_lastEvent = new MouseEvent(MouseEvent.MOUSE_OUT, true, false, _local10.x, _local10.y, _local6, _arg3.ctrlKey, _arg3.altKey, _arg3.shiftKey, _arg3.buttonDown, _arg3.delta);
m_ioOldTarget.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
_lastEvent = new MouseEvent(MouseEvent.ROLL_OUT, false, false, _local10.x, _local10.y, _local6, _arg3.ctrlKey, _arg3.altKey, _arg3.shiftKey, _arg3.buttonDown, _arg3.delta);
m_ioOldTarget.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
_local8++;
};
lastLocation = location.clone();
m_oPreviousTargets = m_oCurrentTargets.concat();
m_oCurrentTargets = [];
}
public static function getInstance():VirtualMouse{
if (!_oI){
_oI = new VirtualMouse(new PrivateConstructorAccess());
};
return (_oI);
}
}
}//package sandy.core.interaction
class PrivateConstructorAccess {
private function PrivateConstructorAccess(){
}
}
Section 86
//Light3D (sandy.core.light.Light3D)
package sandy.core.light {
import sandy.events.*;
import sandy.core.data.*;
import flash.events.*;
import sandy.util.*;
public class Light3D extends EventDispatcher {
private var _color:uint;
private var _dir:Point3D;
public var changed:Boolean;
private var _power:Number;
private var _nPower:Number;
public static const MAX_POWER:Number = 150;
public function Light3D(_arg1:Point3D, _arg2:Number){
_dir = _arg1;
_dir.normalize();
setPower(_arg2);
}
public function get color():uint{
return (_color);
}
public function setDirectionPoint3D(_arg1:Point3D):void{
_dir = _arg1;
_dir.normalize();
changed = true;
dispatchEvent(new SandyEvent(SandyEvent.LIGHT_UPDATED));
}
public function calculate(_arg1:Point3D):Number{
var _local2:Number = _dir.dot(_arg1);
_local2 = -(_local2);
if (_local2 < 0){
_local2 = 0;
};
return ((_nPower * _local2));
}
public function setPower(_arg1:Number):void{
_power = NumberUtil.constrain(_arg1, 0, Light3D.MAX_POWER);
_nPower = (_power / Light3D.MAX_POWER);
changed = true;
dispatchEvent(new SandyEvent(SandyEvent.LIGHT_UPDATED));
}
public function set color(_arg1:uint):void{
_color = _arg1;
changed = true;
dispatchEvent(new SandyEvent(SandyEvent.LIGHT_COLOR_CHANGED));
}
public function getPower():Number{
return (_power);
}
public function getDirectionPoint3D():Point3D{
return (_dir);
}
public function destroy():void{
}
public function setDirection(_arg1:Number, _arg2:Number, _arg3:Number):void{
_dir.x = _arg1;
_dir.y = _arg2;
_dir.z = _arg3;
_dir.normalize();
changed = true;
dispatchEvent(new SandyEvent(SandyEvent.LIGHT_UPDATED));
}
public function getNormalizedPower():Number{
return (_nPower);
}
}
}//package sandy.core.light
Section 87
//ATransformable (sandy.core.scenegraph.ATransformable)
package sandy.core.scenegraph {
import sandy.core.data.*;
public class ATransformable extends Node {
private var _nYaw:Number;
protected var m_oPreviousOffsetRotation:Point3D;
protected var _vUp:Point3D;
private var _nRoll:Number;
private var _vLookAt:Point3D;
private var _vRotation:Point3D;
public var invModelMatrix:Matrix4;
protected var _p:Point3D;
private var m_oMatrix:Matrix4;
private var _nTilt:Number;
protected var _oScale:Point3D;
protected var m_tmpMt:Matrix4;
public var disable:Boolean;// = false
protected var _vSide:Point3D;
protected var _vOut:Point3D;
private var _vLookatDown:Point3D;
public function ATransformable(_arg1:String=""){
invModelMatrix = new Matrix4();
m_oPreviousOffsetRotation = new Point3D();
super(_arg1);
resetCoords();
}
public function set tilt(_arg1:Number):void{
var _local2:Number = (_arg1 - _nTilt);
if (_local2 == 0){
return;
};
changed = true;
m_tmpMt.axisRotation(_vSide.x, _vSide.y, _vSide.z, _local2);
m_tmpMt.transform3x3(_vOut);
m_tmpMt.transform3x3(_vUp);
_nTilt = _arg1;
}
public function set matrix(_arg1:Matrix4):void{
m_oMatrix = _arg1;
m_oMatrix.transform3x3(_vSide);
m_oMatrix.transform3x3(_vUp);
m_oMatrix.transform3x3(_vOut);
_vSide.normalize();
_vUp.normalize();
_vOut.normalize();
_p.x = _arg1.n14;
_p.y = _arg1.n24;
_p.z = _arg1.n34;
changed = true;
}
public function get z():Number{
return (_p.z);
}
public function moveLateraly(_arg1:Number):void{
changed = true;
_p.x = (_p.x + _arg1);
}
public function get up():Point3D{
return (_vUp);
}
public function set scaleX(_arg1:Number):void{
if (_oScale.x == _arg1){
return;
};
_oScale.x = _arg1;
changed = true;
}
public function get pan():Number{
return (_nYaw);
}
public function set scaleY(_arg1:Number):void{
if (_oScale.y == _arg1){
return;
};
_oScale.y = _arg1;
changed = true;
}
public function getPosition(_arg1:String="local"):Point3D{
var _local2:Point3D;
switch (_arg1){
case "local":
_local2 = new Point3D(_p.x, _p.y, _p.z);
break;
case "camera":
_local2 = new Point3D(viewMatrix.n14, viewMatrix.n24, viewMatrix.n34);
break;
case "absolute":
_local2 = new Point3D(modelMatrix.n14, modelMatrix.n24, modelMatrix.n34);
break;
default:
_local2 = new Point3D(_p.x, _p.y, _p.z);
break;
};
return (_local2);
}
public function set scaleZ(_arg1:Number):void{
if (_oScale.z == _arg1){
return;
};
_oScale.z = _arg1;
changed = true;
}
public function moveHorizontally(_arg1:Number):void{
changed = true;
_p.x = (_p.x + (_vOut.x * _arg1));
_p.z = (_p.z + (_vOut.z * _arg1));
}
public function rotateAxis(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{
changed = true;
_arg4 = ((_arg4 + 360) % 360);
var _local5:Number = Math.sqrt((((_arg1 * _arg1) + (_arg2 * _arg2)) + (_arg3 * _arg3)));
m_tmpMt.axisRotation((_arg1 / _local5), (_arg2 / _local5), (_arg3 / _local5), _arg4);
m_tmpMt.transform3x3(_vSide);
m_tmpMt.transform3x3(_vUp);
m_tmpMt.transform3x3(_vOut);
}
public function getLookAt():Point3D{
return (_vLookAt);
}
public function set target(_arg1:Point3D):void{
lookAt(_arg1.x, _arg1.y, _arg1.z);
}
public function updateTransform():void{
if (changed){
m_oMatrix.n11 = (_vSide.x * _oScale.x);
m_oMatrix.n12 = (_vUp.x * _oScale.y);
m_oMatrix.n13 = (_vOut.x * _oScale.z);
m_oMatrix.n14 = _p.x;
m_oMatrix.n21 = (_vSide.y * _oScale.x);
m_oMatrix.n22 = (_vUp.y * _oScale.y);
m_oMatrix.n23 = (_vOut.y * _oScale.z);
m_oMatrix.n24 = _p.y;
m_oMatrix.n31 = (_vSide.z * _oScale.x);
m_oMatrix.n32 = (_vUp.z * _oScale.y);
m_oMatrix.n33 = (_vOut.z * _oScale.z);
m_oMatrix.n34 = _p.z;
_vOut.normalize();
_vSide.normalize();
_vUp.normalize();
};
}
public function setPosition(_arg1:Number, _arg2:Number, _arg3:Number):void{
changed = true;
_p.x = _arg1;
_p.y = _arg2;
_p.z = _arg3;
}
public function moveSideways(_arg1:Number):void{
changed = true;
_p.x = (_p.x + (_vSide.x * _arg1));
_p.y = (_p.y + (_vSide.y * _arg1));
_p.z = (_p.z + (_vSide.z * _arg1));
}
public function moveVertically(_arg1:Number):void{
changed = true;
_p.y = (_p.y + _arg1);
}
public function lookAt(_arg1:Number, _arg2:Number, _arg3:Number):void{
changed = true;
_vLookAt = new Point3D(_arg1, _arg2, _arg3);
_vOut.x = _arg1;
_vOut.y = _arg2;
_vOut.z = _arg3;
_vOut.sub(_p);
_vOut.normalize();
_vSide = null;
_vSide = _vOut.cross(_vLookatDown);
_vSide.normalize();
_vUp = null;
_vUp = _vOut.cross(_vSide);
_vUp.normalize();
}
public function set pan(_arg1:Number):void{
var _local2:Number = (_arg1 - _nYaw);
if (_local2 == 0){
return;
};
changed = true;
m_tmpMt.axisRotation(_vUp.x, _vUp.y, _vUp.z, _local2);
m_tmpMt.transform3x3(_vOut);
m_tmpMt.transform3x3(_vSide);
_nYaw = _arg1;
}
public function moveForward(_arg1:Number):void{
changed = true;
_p.x = (_p.x + (_vOut.x * _arg1));
_p.y = (_p.y + (_vOut.y * _arg1));
_p.z = (_p.z + (_vOut.z * _arg1));
}
public function set rotateY(_arg1:Number):void{
var _local2:Number = (_arg1 - _vRotation.y);
if (_local2 == 0){
return;
};
changed = true;
m_tmpMt.rotationY(_local2);
m_tmpMt.transform3x3(_vSide);
m_tmpMt.transform3x3(_vUp);
m_tmpMt.transform3x3(_vOut);
_vRotation.y = _arg1;
}
public function get tilt():Number{
return (_nTilt);
}
public function set rotateZ(_arg1:Number):void{
var _local2:Number = (_arg1 - _vRotation.z);
if (_local2 == 0){
return;
};
changed = true;
m_tmpMt.rotationZ(_local2);
m_tmpMt.transform3x3(_vSide);
m_tmpMt.transform3x3(_vUp);
m_tmpMt.transform3x3(_vOut);
_vRotation.z = _arg1;
}
public function get matrix():Matrix4{
return (m_oMatrix);
}
public function moveUpwards(_arg1:Number):void{
changed = true;
_p.x = (_p.x + (_vUp.x * _arg1));
_p.y = (_p.y + (_vUp.y * _arg1));
_p.z = (_p.z + (_vUp.z * _arg1));
}
public function initFrame():void{
_vSide = new Point3D(1, 0, 0);
_vUp = new Point3D(0, 1, 0);
_vOut = new Point3D(0, 0, 1);
_vRotation = new Point3D(0, 0, 0);
changed = true;
}
public function set rotateX(_arg1:Number):void{
var _local2:Number;
_local2 = (_arg1 - _vRotation.x);
if (_local2 == 0){
return;
};
changed = true;
m_tmpMt.rotationX(_local2);
m_tmpMt.transform3x3(_vSide);
m_tmpMt.transform3x3(_vUp);
m_tmpMt.transform3x3(_vOut);
_vRotation.x = _arg1;
}
public function resetCoords():void{
initFrame();
_p = new Point3D();
_oScale = new Point3D(1, 1, 1);
_vRotation = new Point3D(0, 0, 0);
_vLookatDown = new Point3D(1E-11, -1, 0);
_nRoll = 0;
_nTilt = 0;
_nYaw = 0;
m_tmpMt = new Matrix4();
m_oMatrix = new Matrix4();
changed = true;
}
public function get out():Point3D{
return (_vOut);
}
public function get scaleY():Number{
return (_oScale.y);
}
public function get scaleX():Number{
return (_oScale.x);
}
public function get side():Point3D{
return (_vSide);
}
override public function update(_arg1:Matrix4, _arg2:Boolean):void{
updateTransform();
if (((_arg2) || (changed))){
if (((_arg1) && (!(disable)))){
modelMatrix.copy(_arg1);
modelMatrix.multiply4x3(m_oMatrix);
} else {
modelMatrix.copy(m_oMatrix);
};
invModelMatrix.n11 = modelMatrix.n11;
invModelMatrix.n12 = modelMatrix.n21;
invModelMatrix.n13 = modelMatrix.n31;
invModelMatrix.n21 = modelMatrix.n12;
invModelMatrix.n22 = modelMatrix.n22;
invModelMatrix.n23 = modelMatrix.n32;
invModelMatrix.n31 = modelMatrix.n13;
invModelMatrix.n32 = modelMatrix.n23;
invModelMatrix.n33 = modelMatrix.n33;
invModelMatrix.n14 = -((((modelMatrix.n11 * modelMatrix.n14) + (modelMatrix.n21 * modelMatrix.n24)) + (modelMatrix.n31 * modelMatrix.n34)));
invModelMatrix.n24 = -((((modelMatrix.n12 * modelMatrix.n14) + (modelMatrix.n22 * modelMatrix.n24)) + (modelMatrix.n32 * modelMatrix.n34)));
invModelMatrix.n34 = -((((modelMatrix.n13 * modelMatrix.n14) + (modelMatrix.n23 * modelMatrix.n24)) + (modelMatrix.n33 * modelMatrix.n34)));
};
super.update(modelMatrix, _arg2);
}
public function translate(_arg1:Number, _arg2:Number, _arg3:Number):void{
changed = true;
_p.x = (_p.x + _arg1);
_p.y = (_p.y + _arg2);
_p.z = (_p.z + _arg3);
}
public function get rotateY():Number{
return (_vRotation.y);
}
public function get scaleZ():Number{
return (_oScale.z);
}
public function get rotateX():Number{
return (_vRotation.x);
}
public function get rotateZ():Number{
return (_vRotation.z);
}
override public function toString():String{
return ("sandy.core.scenegraph.ATransformable");
}
public function set x(_arg1:Number):void{
if (_arg1 == _p.x){
return;
};
_p.x = _arg1;
changed = true;
}
public function set y(_arg1:Number):void{
if (_arg1 == _p.y){
return;
};
_p.y = _arg1;
changed = true;
}
public function set z(_arg1:Number):void{
if (_arg1 == _p.z){
return;
};
_p.z = _arg1;
changed = true;
}
public function get x():Number{
return (_p.x);
}
public function get y():Number{
return (_p.y);
}
public function set roll(_arg1:Number):void{
var _local2:Number = (_arg1 - _nRoll);
if (_local2 == 0){
return;
};
changed = true;
m_tmpMt.axisRotation(_vOut.x, _vOut.y, _vOut.z, _local2);
m_tmpMt.transform3x3(_vSide);
m_tmpMt.transform3x3(_vUp);
_nRoll = _arg1;
}
public function get roll():Number{
return (_nRoll);
}
}
}//package sandy.core.scenegraph
Section 88
//Camera3D (sandy.core.scenegraph.Camera3D)
package sandy.core.scenegraph {
import sandy.core.data.*;
import sandy.view.*;
import flash.geom.*;
import sandy.util.*;
public class Camera3D extends ATransformable {
public var frustrum:Frustum;
private var mp11:Number;
private var mp13:Number;
private var mp12:Number;
private var mp14:Number;
private var mp21:Number;
private var mp22:Number;
private var mp23:Number;
private var mp24:Number;
public var viewport:ViewPort;
private var m_nOffx:int;
private var m_nOffy:int;
private var _nFar:Number;
private var _nNear:Number;
private var mp31:Number;
private var _mp:Matrix4;
private var mp33:Number;
private var _mpInv:Matrix4;
private var mp32:Number;
private var mp34:Number;
private var _nFov:Number;
private var mp41:Number;
private var mp42:Number;
private var mp43:Number;
private var mp44:Number;
private var _perspectiveChanged:Boolean;// = false
public function Camera3D(_arg1:Number=550, _arg2:Number=400, _arg3:Number=45, _arg4:Number=50, _arg5:Number=10000){
viewport = new ViewPort(640, 480);
frustrum = new Frustum();
_mp = new Matrix4();
_mpInv = new Matrix4();
super(null);
viewport.width = _arg1;
viewport.height = _arg2;
_nFov = _arg3;
_nFar = _arg5;
_nNear = _arg4;
setPerspectiveProjection(_nFov, viewport.ratio, _nNear, _nFar);
m_nOffx = viewport.width2;
m_nOffy = viewport.height2;
visible = false;
z = -300;
lookAt(0, 0, 0);
}
public function get invProjectionMatrix():Matrix4{
_mpInv.copy(_mp);
_mpInv.inverse();
return (_mpInv);
}
public function get far():Number{
return (_nFar);
}
public function set fov(_arg1:Number):void{
_nFov = _arg1;
_perspectiveChanged = true;
changed = true;
}
public function projectVertex(_arg1:Vertex):void{
var _local2:Number = (viewport.offset.x + m_nOffx);
var _local3:Number = (viewport.offset.y + m_nOffy);
var _local4:Number = (1 / _arg1.wz);
_arg1.sx = ((((_local4 * _arg1.wx) * mp11) * m_nOffx) + _local2);
_arg1.sy = ((((-(_local4) * _arg1.wy) * mp22) * m_nOffy) + _local3);
}
public function get near():Number{
return (_nNear);
}
public function get focalLength():Number{
return ((viewport.height2 / Math.tan((_nFov * 0.00872664626))));
}
public function set far(_arg1:Number):void{
_nFar = _arg1;
_perspectiveChanged = true;
changed = true;
}
protected function updatePerspective():void{
setPerspectiveProjection(_nFov, viewport.ratio, _nNear, _nFar);
_perspectiveChanged = false;
}
public function projectArray(_arg1:Array):void{
var _local4:Number;
var _local7:Vertex;
var _local2:Number = (viewport.offset.x + m_nOffx);
var _local3:Number = (viewport.offset.y + m_nOffy);
var _local5:Number = (mp11 * m_nOffx);
var _local6:Number = (mp22 * m_nOffy);
for each (_local7 in _arg1) {
if (_local7.projected == false){
_local4 = (1 / _local7.wz);
_local7.sx = (((_local4 * _local7.wx) * _local5) + _local2);
_local7.sy = (((-(_local4) * _local7.wy) * _local6) + _local3);
_local7.projected = true;
};
};
}
override public function update(_arg1:Matrix4, _arg2:Boolean):void{
if (viewport.hasChanged){
_perspectiveChanged = true;
m_nOffx = viewport.width2;
m_nOffy = viewport.height2;
if (scene.rectClipping){
scene.container.scrollRect = new Rectangle(0, 0, viewport.width, viewport.height);
} else {
scene.container.scrollRect = null;
};
viewport.hasChanged = false;
};
if (_perspectiveChanged){
updatePerspective();
};
super.update(_arg1, _arg2);
}
public function get fov():Number{
return (_nFov);
}
public function set near(_arg1:Number):void{
_nNear = _arg1;
_perspectiveChanged = true;
changed = true;
}
public function set focalLength(_arg1:Number):void{
_nFov = (Math.atan2(viewport.height2, _arg1) * 114.591559);
_perspectiveChanged = true;
changed = true;
}
protected function setPerspectiveProjection(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{
var _local5:Number;
var _local6:Number;
frustrum.computePlanes(_arg2, _arg3, _arg4, _arg1);
_arg1 = NumberUtil.toRadian(_arg1);
_local5 = (1 / Math.tan((_arg1 / 2)));
_local6 = (_arg4 / (_arg4 - _arg3));
_mp.zero();
_mp.n11 = (_local5 / _arg2);
_mp.n22 = _local5;
_mp.n33 = _local6;
_mp.n34 = (-(_local6) * _arg3);
_mp.n43 = 1;
mp11 = _mp.n11;
mp21 = _mp.n21;
mp31 = _mp.n31;
mp41 = _mp.n41;
mp12 = _mp.n12;
mp22 = _mp.n22;
mp32 = _mp.n32;
mp42 = _mp.n42;
mp13 = _mp.n13;
mp23 = _mp.n23;
mp33 = _mp.n33;
mp43 = _mp.n43;
mp14 = _mp.n14;
mp24 = _mp.n24;
mp34 = _mp.n34;
mp44 = _mp.n44;
changed = true;
}
override public function toString():String{
return ("sandy.core.scenegraph.Camera3D");
}
public function get projectionMatrix():Matrix4{
return (_mp);
}
override public function cull(_arg1:Frustum, _arg2:Matrix4, _arg3:Boolean):void{
}
override public function destroy():void{
viewport = null;
frustrum = null;
_mp = null;
_mpInv = null;
super.destroy();
}
}
}//package sandy.core.scenegraph
Section 89
//Geometry3D (sandy.core.scenegraph.Geometry3D)
package sandy.core.scenegraph {
import sandy.core.data.*;
import flash.utils.*;
public final class Geometry3D {
public var aUVCoords:Array;
public var aFacesUVCoordsID:Array;
public var aFaceEdges:Array;
private var EDGES_DICO:Dictionary;
private var m_nLastVertexNormalId:int;// = 0
public var aFacesVertexID:Array;
public var aVertexNormals:Array;
private var m_nLastVertexId:int;// = 0
private var m_nLastNormalId:int;// = 0
public var aFacesNormals:Array;
private var m_nLastFaceId:int;// = 0
private var m_aVertexFaces:Array;
public var aVertex:Array;
private var m_nLastFaceUVId:int;// = 0
private var m_nLastUVId:int;// = 0
public var aEdges:Array;
public function Geometry3D(_arg1:Array=null){
EDGES_DICO = new Dictionary(true);
aVertex = new Array();
aFacesVertexID = new Array();
aFacesUVCoordsID = new Array();
aFacesNormals = new Array();
aVertexNormals = new Array();
aEdges = new Array();
aFaceEdges = new Array();
aUVCoords = new Array();
m_aVertexFaces = new Array();
super();
init();
}
public function getNextFaceID():int{
return (m_nLastFaceId);
}
public function setUVCoords(_arg1:int, _arg2:Number, _arg3:Number):int{
if (aUVCoords[_arg1]){
return (-1);
};
aUVCoords[_arg1] = new UVCoord(_arg2, _arg3);
return ((++m_nLastUVId - 1));
}
public function init():void{
}
public function generateFaceNormals():void{
var _local1:Array;
var _local2:Vertex;
var _local3:Vertex;
var _local4:Vertex;
var _local5:Point3D;
var _local6:Point3D;
var _local7:Point3D;
if (aFacesNormals.length > 0){
return;
};
for each (_local1 in aFacesVertexID) {
if (_local1.length < 3){
} else {
_local2 = aVertex[_local1[0]];
_local3 = aVertex[_local1[1]];
_local4 = aVertex[_local1[2]];
_local5 = new Point3D((_local3.wx - _local2.wx), (_local3.wy - _local2.wy), (_local3.wz - _local2.wz));
_local6 = new Point3D((_local3.wx - _local4.wx), (_local3.wy - _local4.wy), (_local3.wz - _local4.wz));
_local7 = _local5.cross(_local6);
_local7.normalize();
setFaceNormal(getNextFaceNormalID(), _local7.x, _local7.y, _local7.z);
};
};
}
public function setVertex(_arg1:int, _arg2:Number, _arg3:Number, _arg4:Number):int{
if (aVertex[_arg1]){
return (-1);
};
aVertex[_arg1] = new Vertex(_arg2, _arg3, _arg4);
return ((++m_nLastVertexId - 1));
}
public function setFaceNormal(_arg1:int, _arg2:Number, _arg3:Number, _arg4:Number):int{
if (aFacesNormals[_arg1]){
return (-1);
};
aFacesNormals[_arg1] = new Vertex(_arg2, _arg3, _arg4);
return ((++m_nLastNormalId - 1));
}
public function generateVertexNormals():void{
var _local1:uint;
var _local2:Array;
var _local3:Vertex;
var _local4:Vertex;
if (aVertexNormals.length > 0){
return;
};
_local1 = 0;
_local1 = 0;
while (_local1 < aFacesVertexID.length) {
_local2 = aFacesVertexID[_local1];
_local3 = aFacesNormals[_local1];
if (_local3 == null){
} else {
if (null == aVertexNormals[_local2[0]]){
m_nLastVertexNormalId++;
aVertexNormals[_local2[0]] = new Vertex();
};
Vertex(aVertexNormals[_local2[0]]).add(_local3);
if (null == aVertexNormals[_local2[1]]){
m_nLastVertexNormalId++;
aVertexNormals[_local2[1]] = new Vertex();
};
Vertex(aVertexNormals[_local2[1]]).add(_local3);
if (null == aVertexNormals[_local2[2]]){
m_nLastVertexNormalId++;
aVertexNormals[_local2[2]] = new Vertex();
};
Vertex(aVertexNormals[_local2[2]]).add(_local3);
if ((aVertex[_local2[0]] as Vertex).aFaces.indexOf(_local1) == 0){
(aVertex[_local2[0]] as Vertex).aFaces.push(_local1);
};
if ((aVertex[_local2[1]] as Vertex).aFaces.indexOf(_local1) == 0){
(aVertex[_local2[1]] as Vertex).aFaces.push(_local1);
};
if ((aVertex[_local2[2]] as Vertex).aFaces.indexOf(_local1) == 0){
(aVertex[_local2[2]] as Vertex).aFaces.push(_local1);
};
aVertex[_local2[0]].nbFaces++;
aVertex[_local2[1]].nbFaces++;
aVertex[_local2[2]].nbFaces++;
};
_local1++;
};
_local1 = 0;
while (_local1 < aVertexNormals.length) {
_local4 = aVertex[_local1];
if (_local4.nbFaces){
Vertex(aVertexNormals[_local1]).scale((1 / _local4.nbFaces));
};
_local1++;
};
}
public function getNextUVCoordID():int{
return (m_nLastUVId);
}
public function setVertexNormal(_arg1:int, _arg2:Number, _arg3:Number, _arg4:Number):int{
if (aVertexNormals[_arg1]){
return (-1);
};
aVertexNormals[_arg1] = new Vertex(_arg2, _arg3, _arg4);
return ((++m_nLastVertexNormalId - 1));
}
private function isEdgeExist(_arg1:uint, _arg2:uint):Boolean{
var _local3:String;
if (_arg1 < _arg2){
_local3 = ((_arg1 + "_") + _arg2);
} else {
_local3 = ((_arg2 + "_") + _arg1);
};
if (EDGES_DICO[_local3] == null){
return (false);
};
return (true);
}
public function dispose():void{
var _local1:Array;
var _local2:Vertex;
var _local3:Array;
var _local4:UVCoord;
for each (_local2 in aVertex) {
_local2 = null;
};
aVertex = null;
for each (_local1 in aFacesVertexID) {
_local1 = null;
};
aFacesVertexID = null;
for each (_local2 in aFacesNormals) {
_local2 = null;
};
aFacesNormals = null;
for each (_local2 in aVertexNormals) {
_local2 = null;
};
aVertexNormals = null;
for each (_local3 in aFacesUVCoordsID) {
_local3 = null;
};
aFacesUVCoordsID = null;
for each (_local4 in aUVCoords) {
_local4 = null;
};
aUVCoords = null;
}
public function getNextVertexID():int{
return (m_nLastVertexId);
}
public function getNextFaceUVCoordID():int{
return (m_nLastFaceUVId);
}
public function getNextFaceNormalID():int{
return (m_nLastNormalId);
}
public function getVertexId(_arg1:Vertex):int{
return (aVertex.indexOf(_arg1));
}
public function setFaceUVCoordsIds(_arg1:int, ... _args):int{
var _local3:Array;
if (aFacesUVCoordsID[_arg1]){
return (-1);
};
_local3 = ((_args[0] is Array)) ? _args[0] : _args.splice(0);
aFacesUVCoordsID[_arg1] = _local3;
return ((++m_nLastFaceUVId - 1));
}
public function clone():Geometry3D{
var _local3:Vertex;
var _local4:Array;
var _local5:Array;
var _local6:UVCoord;
var _local7:Edge3D;
var _local8:Array;
var _local1:Geometry3D = new Geometry3D();
var _local2:uint;
for each (_local3 in aVertex) {
_local1.aVertex[_local2] = _local3.clone();
_local2++;
};
_local2 = 0;
for each (_local4 in aFacesVertexID) {
_local1.aFacesVertexID[_local2] = _local4.concat();
_local2++;
};
_local2 = 0;
for each (_local3 in aFacesNormals) {
_local1.aFacesNormals[_local2] = _local3.clone();
_local2++;
};
_local2 = 0;
for each (_local3 in aVertexNormals) {
_local1.aVertexNormals[_local2] = _local3.clone();
_local2++;
};
_local2 = 0;
for each (_local5 in aFacesUVCoordsID) {
_local1.aFacesUVCoordsID[_local2] = _local5.concat();
_local2++;
};
_local2 = 0;
for each (_local6 in aUVCoords) {
_local1.aUVCoords[_local2] = _local6.clone();
_local2++;
};
_local2 = 0;
for each (_local7 in aEdges) {
_local1.aEdges[_local2] = _local7.clone();
_local2++;
};
_local2 = 0;
for each (_local8 in aFaceEdges) {
_local1.aFaceEdges[_local2] = _local8.concat();
_local2++;
};
return (_local1);
}
public function getNextVertexNormalID():int{
return (m_nLastVertexNormalId);
}
public function setFaceVertexIds(_arg1:int, ... _args):int{
var _local3:Array;
var _local4:uint;
var _local5:uint;
var _local6:uint;
var _local7:uint;
var _local8:String;
if (aFacesVertexID[_arg1]){
return (-1);
};
_local3 = ((_args[0] is Array)) ? _args[0] : _args.splice(0);
aFacesVertexID[_arg1] = _local3;
_local4 = 0;
while (_local4 < _local3.length) {
_local5 = _local3[_local4];
_local6 = _local3[((_local4 + 1) % _local3.length)];
if (isEdgeExist(_local5, _local6) == false){
_local7 = (aEdges.push(new Edge3D(_local5, _local6)) - 1);
if (_local5 < _local6){
_local8 = ((_local5 + "_") + _local6);
} else {
_local8 = ((_local6 + "_") + _local5);
};
EDGES_DICO[_local8] = _local7;
} else {
if (_local5 < _local6){
_local8 = ((_local5 + "_") + _local6);
} else {
_local8 = ((_local6 + "_") + _local5);
};
_local7 = EDGES_DICO[_local8];
};
if (null == aFaceEdges[_arg1]){
aFaceEdges[_arg1] = new Array();
};
(aFaceEdges[_arg1] as Array).push(_local7);
_local4++;
};
return ((++m_nLastFaceId - 1));
}
public function toString():String{
return ((((((((("[Geometry: " + aFacesVertexID.length) + " faces, ") + aVertex.length) + " points, ") + aFacesNormals.length) + " normals, ") + aUVCoords.length) + " uv coords]"));
}
}
}//package sandy.core.scenegraph
Section 90
//Group (sandy.core.scenegraph.Group)
package sandy.core.scenegraph {
import sandy.core.data.*;
import sandy.view.*;
public class Group extends Node {
public function Group(_arg1:String=""){
super(_arg1);
}
override public function cull(_arg1:Frustum, _arg2:Matrix4, _arg3:Boolean):void{
var _local4:Boolean;
var _local5:Node;
if (visible == false){
culled = CullingState.OUTSIDE;
} else {
_local4 = ((_arg3) || (changed));
for each (_local5 in children) {
_local5.cull(_arg1, _arg2, _local4);
};
};
}
override public function toString():String{
return ((("sandy.core.scenegraph.Group :[" + name) + "]"));
}
public function clone(_arg1:String):Group{
var _local3:*;
var _local2:Group = new Group(_arg1);
for each (_local3 in children) {
if ((((((_local3 is Shape3D)) || ((_local3 is Group)))) || ((_local3 is TransformGroup)))){
_local2.addChild(_local3.clone(((_arg1 + "_") + _local3.name)));
};
};
return (_local2);
}
}
}//package sandy.core.scenegraph
Section 91
//IDisplayable (sandy.core.scenegraph.IDisplayable)
package sandy.core.scenegraph {
import sandy.materials.*;
import flash.display.*;
public interface IDisplayable {
function get container():Sprite;
function display(_arg1:Sprite=null):void;
function get depth():Number;
function get changed():Boolean;
function get material():Material;
function clear():void;
}
}//package sandy.core.scenegraph
Section 92
//INodeOperation (sandy.core.scenegraph.INodeOperation)
package sandy.core.scenegraph {
public interface INodeOperation {
function performOnEntry(_arg1:Node):void;
function performOnExit(_arg1:Node):void;
}
}//package sandy.core.scenegraph
Section 93
//Node (sandy.core.scenegraph.Node)
package sandy.core.scenegraph {
import sandy.events.*;
import sandy.materials.*;
import sandy.core.data.*;
import sandy.view.*;
import sandy.core.*;
import flash.events.*;
import sandy.bounds.*;
public class Node {
public const children:Array;
public const id:uint;
public const viewMatrix:Matrix4;
public const modelMatrix:Matrix4;
protected var m_oEB:BubbleEventBroadcaster;
public var boundingBox:BBox;
public var name:String;
public var culled:CullingState;
public var boundingSphere:BSphere;
protected var m_bChanged:Boolean;
protected var m_bVisible:Boolean;// = true
private var _parent:Node;
protected var m_oScene:Scene3D;// = null
private static var _ID_:uint = 0;
public function Node(_arg1:String=""){
culled = CullingState.OUTSIDE;
children = new Array();
modelMatrix = new Matrix4();
viewMatrix = new Matrix4();
boundingBox = new BBox();
boundingSphere = new BSphere();
id = _ID_++;
super();
parent = null;
if (((_arg1) && (!((_arg1 == ""))))){
name = _arg1;
} else {
name = id.toString();
};
changed = true;
m_oEB = new BubbleEventBroadcaster(this);
culled = CullingState.INSIDE;
scene = null;
boundingBox.reset();
boundingSphere.reset();
}
public function getChildByName(_arg1:String, _arg2:Boolean=false):Node{
var _local3:Node;
var _local4:Node;
for each (_local3 in children) {
if (_local3.name == _arg1){
return (_local3);
};
};
if (_arg2){
_local4 = null;
for each (_local3 in children) {
_local4 = _local3.getChildByName(_arg1, _arg2);
if (_local4 != null){
return (_local4);
};
};
};
return (null);
}
public function remove():void{
var _local2:Node;
if (hasParent() == true){
parent.removeChildByName(name);
};
var _local1:Array = children.concat();
for each (_local2 in _local1) {
parent.addChild(_local2);
};
children.splice(0);
m_oEB = null;
changed = true;
}
public function removeChildByName(_arg1:String):Boolean{
var _local3:int;
var _local2:Boolean;
var _local4:int = children.length;
while ((((_local3 < _local4)) && (!(_local2)))) {
if (children[int(_local3)].name == _arg1){
broadcaster.removeChild(children[int(_local3)].broadcaster);
children.splice(_local3, 1);
changed = true;
_local2 = true;
};
_local3++;
};
return (_local2);
}
public function swapParent(_arg1:Node):void{
if (parent.removeChildByName(this.name)){
};
_arg1.addChild(this);
changed = true;
}
public function set scene(_arg1:Scene3D):void{
var _local2:Node;
if (_arg1 == null){
return;
};
if (m_oScene){
m_oScene.removeEventListener(SandyEvent.SCENE_RENDER_FINISH, _updateFlags);
};
m_oScene = _arg1;
m_oScene.addEventListener(SandyEvent.SCENE_RENDER_FINISH, _updateFlags);
for each (_local2 in children) {
_local2.scene = m_oScene;
};
}
public function get scene():Scene3D{
return (m_oScene);
}
public function get parent():Node{
return (_parent);
}
public function set useSingleContainer(_arg1:Boolean):void{
var _local2:Node;
for each (_local2 in children) {
_local2.useSingleContainer = _arg1;
};
changed = true;
}
public function get broadcaster():BubbleEventBroadcaster{
return (m_oEB);
}
public function get changed():Boolean{
return (m_bChanged);
}
public function set appearance(_arg1:Appearance):void{
var _local2:Node;
for each (_local2 in children) {
_local2.appearance = _arg1;
};
changed = true;
}
public function update(_arg1:Matrix4, _arg2:Boolean):void{
var _local3:Node;
culled = CullingState.INSIDE;
if (boundingBox){
boundingBox.uptodate = false;
};
if (boundingSphere){
boundingSphere.uptodate = false;
};
changed = ((changed) || (_arg2));
for each (_local3 in children) {
_local3.update(_arg1, changed);
};
}
public function updateBoundingVolumes():void{
}
public function addEventListener(_arg1:String, _arg2):Boolean{
return (m_oEB.addEventListener.apply(_arg1, arguments));
}
public function set enableInteractivity(_arg1:Boolean):void{
var _local2:Node;
for each (_local2 in children) {
_local2.enableInteractivity = _arg1;
};
}
public function removeEventListener(_arg1:String, _arg2):void{
m_oEB.removeEventListener(_arg1, _arg2);
}
public function set enableBackFaceCulling(_arg1:Boolean):void{
var _local2:Node;
for each (_local2 in children) {
_local2.enableBackFaceCulling = _arg1;
};
changed = true;
}
public function set parent(_arg1:Node):void{
if (_arg1){
_parent = _arg1;
changed = true;
};
}
public function set enableClipping(_arg1:Boolean):void{
var _local2:Node;
for each (_local2 in children) {
_local2.enableClipping = _arg1;
};
changed = true;
}
public function perform(_arg1:INodeOperation):void{
var _local2:Node;
_arg1.performOnEntry(this);
for each (_local2 in children) {
_local2.perform(_arg1);
};
_arg1.performOnExit(this);
}
public function set visible(_arg1:Boolean):void{
var _local2:Node;
m_bVisible = _arg1;
changed = true;
for each (_local2 in children) {
_local2.changed = true;
};
}
public function set changed(_arg1:Boolean):void{
m_bChanged = _arg1;
}
public function hasParent():Boolean{
return (!((_parent == null)));
}
public function toString():String{
return ("sandy.core.scenegraph.Node");
}
public function get visible():Boolean{
return (m_bVisible);
}
public function isParent(_arg1:Node):Boolean{
return ((((_parent == _arg1)) && (!((_arg1 == null)))));
}
public function set enableEvents(_arg1:Boolean):void{
var _local2:Node;
for each (_local2 in children) {
_local2.enableEvents = _arg1;
};
}
public function cull(_arg1:Frustum, _arg2:Matrix4, _arg3:Boolean):void{
if (visible == false){
culled = CullingState.OUTSIDE;
} else {
if (((_arg3) || (changed))){
viewMatrix.copy(_arg2);
viewMatrix.multiply4x3(modelMatrix);
};
};
}
public function destroy():void{
var _local2:Node;
if (hasParent() == true){
parent.removeChildByName(name);
};
var _local1:Array = children.concat();
for each (_local2 in _local1) {
_local2.destroy();
};
children.splice(0);
m_oEB = null;
scene = null;
}
public function addChild(_arg1:Node):void{
if (_arg1.hasParent()){
_arg1.parent.removeChildByName(_arg1.name);
};
_arg1.parent = this;
changed = true;
children.push(_arg1);
if (_arg1.broadcaster){
m_oEB.addChild(_arg1.broadcaster);
};
if (scene){
_arg1.scene = scene;
};
}
private function _updateFlags(_arg1:Event=null):void{
changed = false;
}
}
}//package sandy.core.scenegraph
Section 94
//Renderable (sandy.core.scenegraph.Renderable)
package sandy.core.scenegraph {
public interface Renderable {
function render(_arg1:Camera3D):void;
}
}//package sandy.core.scenegraph
Section 95
//Shape3D (sandy.core.scenegraph.Shape3D)
package sandy.core.scenegraph {
import sandy.events.*;
import sandy.materials.*;
import sandy.core.data.*;
import sandy.view.*;
import sandy.core.*;
import flash.events.*;
import flash.display.*;
import sandy.bounds.*;
import flash.geom.*;
import sandy.math.*;
public class Shape3D extends ATransformable implements IDisplayable {
public const aVisiblePolygons:Array;
private var m_bNotConvex:Boolean;// = true
public var m_oLastEvent:Shape3DEvent;
public var aPolygons:Array;
private var m_bClipping:Boolean;
public var m_oLastContainer:Sprite;
protected var m_oContainer:Sprite;
protected var m_nDepth:Number;// = 0
public var animated:Boolean;// = false
public var enableNearClipping:Boolean;// = false
private var m_oGeometry:Geometry3D;
protected var m_oGeomCenter:Point3D;
public var m_bWasOver:Boolean;// = false
private var m_bForcedSingleContainer:Boolean;// = false
private var m_oAppearance:Appearance;
public var enableForcedDepth:Boolean;// = false
private var m_bEv:Boolean;// = false
public var forcedDepth:Number;// = 0
private var m_bMouseInteractivity:Boolean;// = false
protected var m_bUseSingleContainer:Boolean;// = true
private var m_bBackFaceCulling:Boolean;// = true
public static var DEFAULT_APPEARANCE:Appearance = new Appearance(DEFAULT_MATERIAL);
public static var DEFAULT_MATERIAL:Material = new WireFrameMaterial();
public function Shape3D(_arg1:String="", _arg2:Geometry3D=null, _arg3:Appearance=null, _arg4:Boolean=true){
aPolygons = new Array();
aVisiblePolygons = new Array();
m_oGeomCenter = new Point3D();
super(_arg1);
m_oContainer = new Sprite();
m_oContainer.name = name;
geometry = _arg2;
m_bUseSingleContainer = !(_arg4);
useSingleContainer = _arg4;
appearance = (_arg3) ? _arg3 : Shape3D.DEFAULT_APPEARANCE;
updateBoundingVolumes();
}
public function get container():Sprite{
return (m_oContainer);
}
public function set depth(_arg1:Number):void{
m_nDepth = _arg1;
changed = true;
}
public function get useSingleContainer():Boolean{
return (m_bUseSingleContainer);
}
override public function set scene(_arg1:Scene3D):void{
var _local2:Polygon;
super.scene = _arg1;
for each (_local2 in aPolygons) {
_local2.scene = null;
_local2.scene = _arg1;
};
}
public function swapCulling():void{
var _local1:Polygon;
for each (_local1 in aPolygons) {
_local1.swapCulling();
};
changed = true;
}
override public function set useSingleContainer(_arg1:Boolean):void{
var _local2:Polygon;
if (_arg1 == m_bUseSingleContainer){
return;
};
if (_arg1){
for each (_local2 in aPolygons) {
if (_local2.container.parent){
_local2.container.graphics.clear();
_local2.container.parent.removeChild(_local2.container);
this.broadcaster.removeChild(_local2.broadcaster);
};
};
} else {
if (m_oContainer.parent){
m_oContainer.graphics.clear();
m_oContainer.parent.removeChild(m_oContainer);
};
for each (_local2 in aPolygons) {
this.broadcaster.addChild(_local2.broadcaster);
_local2.container.graphics.clear();
};
};
m_bUseSingleContainer = _arg1;
changed = true;
}
public function get material():Material{
return ((aPolygons[0].visible) ? m_oAppearance.frontMaterial : m_oAppearance.backMaterial);
}
public function get enableInteractivity():Boolean{
return (m_bMouseInteractivity);
}
public function get enableBackFaceCulling():Boolean{
return (m_bBackFaceCulling);
}
protected function _onInteraction(_arg1:Event):void{
var _local6:Polygon;
var _local9:int;
var _local10:int;
var _local11:int;
var _local12:int;
var _local13:UVCoord;
var _local14:Point3D;
var _local2:Point = new Point(m_oContainer.mouseX, m_oContainer.mouseY);
var _local3:Point = new Point();
var _local4:Point = new Point();
var _local5:Point = new Point();
var _local7:Array = aPolygons.sortOn("depth", (Array.NUMERIC | Array.RETURNINDEXEDARRAY));
var _local8:int = aPolygons.length;
_local9 = 0;
while (_local9 < _local8) {
_local6 = aPolygons[_local7[int(_local9)]];
if (((!(_local6.visible)) && (m_bBackFaceCulling))){
} else {
_local10 = _local6.vertices.length;
_local11 = (_local10 - 2);
_local12 = 0;
while (_local12 < _local11) {
_local3.x = _local6.vertices[_local12].sx;
_local3.y = _local6.vertices[_local12].sy;
_local4.x = _local6.vertices[(_local12 + 1)].sx;
_local4.y = _local6.vertices[(_local12 + 1)].sy;
_local5.x = _local6.vertices[((_local12 + 2) % _local10)].sx;
_local5.y = _local6.vertices[((_local12 + 2) % _local10)].sy;
if (IntersectionMath.isPointInTriangle2D(_local2, _local3, _local4, _local5)){
_local13 = _local6.getUVFrom2D(_local2);
_local14 = _local6.get3DFrom2D(_local2);
m_oLastContainer = m_oContainer;
m_oLastEvent = new Shape3DEvent(_arg1.type, this, _local6, _local13, _local14, _arg1);
m_oEB.dispatchEvent(m_oLastEvent);
if (_arg1.type == MouseEvent.MOUSE_OVER){
m_bWasOver = true;
};
return;
};
_local12++;
};
};
_local9 = (_local9 + 1);
};
}
private function __destroyPolygons():void{
var _local1:int;
var _local2:int;
if (((!((aPolygons == null))) && ((aPolygons.length > 0)))){
_local2 = aPolygons.length;
while (_local1 < _local2) {
if (broadcaster != null){
broadcaster.removeChild(aPolygons[_local1].broadcaster);
};
if (aPolygons[_local1]){
Polygon(aPolygons[int(_local1)]).destroy();
};
aPolygons[int(_local1)] = null;
_local1++;
};
};
aPolygons.splice(0);
aPolygons = null;
}
public function display(_arg1:Sprite=null):void{
var _local2:Polygon;
if (((m_bNotConvex) || ((m_bBackFaceCulling == false)))){
aVisiblePolygons.sortOn("depth", (Array.NUMERIC | Array.DESCENDING));
};
for each (_local2 in aVisiblePolygons) {
_local2.display(m_oContainer);
};
}
public function get depth():Number{
return (m_nDepth);
}
override public function set appearance(_arg1:Appearance):void{
var _local2:Polygon;
m_oAppearance = _arg1;
if (m_oGeometry){
for each (_local2 in aPolygons) {
_local2.appearance = m_oAppearance;
};
};
changed = true;
}
override public function set enableClipping(_arg1:Boolean):void{
m_bClipping = _arg1;
}
override public function updateBoundingVolumes():void{
if (m_oGeometry){
boundingBox = BBox.create(m_oGeometry.aVertex);
boundingSphere.resetFromBox(boundingBox);
};
if (parent){
parent.updateBoundingVolumes();
};
}
override public function set enableInteractivity(_arg1:Boolean):void{
var _local2:Polygon;
if (_arg1 != m_bMouseInteractivity){
changed = true;
if (_arg1){
if (m_bUseSingleContainer == true){
m_bUseSingleContainer = false;
m_bForcedSingleContainer = true;
};
} else {
if (m_bForcedSingleContainer == true){
useSingleContainer = true;
m_bForcedSingleContainer = false;
};
};
for each (_local2 in aPolygons) {
_local2.enableInteractivity = _arg1;
};
m_bMouseInteractivity = _arg1;
};
}
override public function set enableBackFaceCulling(_arg1:Boolean):void{
if (_arg1 != m_bBackFaceCulling){
m_bBackFaceCulling = _arg1;
changed = true;
};
}
public function set geometryCenter(_arg1:Point3D):void{
var _local3:Vertex;
var _local2:Point3D = _arg1.clone();
_local2.sub(m_oGeomCenter);
if (m_oGeometry){
for each (_local3 in m_oGeometry.aVertex) {
_local3.x = (_local3.x + _local2.x);
_local3.y = (_local3.y + _local2.y);
_local3.z = (_local3.z + _local2.z);
};
};
m_oGeomCenter.copy(_arg1);
updateBoundingVolumes();
changed = true;
}
public function clear():void{
if (m_oContainer){
m_oContainer.graphics.clear();
};
changed = true;
}
public function clone(_arg1:String="", _arg2:Boolean=false):Shape3D{
var _local3:Shape3D = new Shape3D(_arg1, geometry.clone(), appearance, m_bUseSingleContainer);
if (_arg2 == true){
_local3.matrix.copy(this.matrix);
};
return (_local3);
}
public function set geometry(_arg1:Geometry3D):void{
if (_arg1 == null){
return;
};
m_oGeometry = _arg1;
updateBoundingVolumes();
m_oGeometry.generateFaceNormals();
m_oGeometry.generateVertexNormals();
__destroyPolygons();
__generatePolygons(m_oGeometry);
changed = true;
}
public function get enableClipping():Boolean{
return (m_bClipping);
}
override public function toString():String{
return ((("sandy.core.scenegraph.Shape3D" + " ") + m_oGeometry.toString()));
}
public function get geometryCenter():Point3D{
return (m_oGeomCenter);
}
public function get geometry():Geometry3D{
return (m_oGeometry);
}
public function get appearance():Appearance{
return (m_oAppearance);
}
public function setConvexFlag(_arg1:Boolean):void{
m_bNotConvex = !(_arg1);
}
override public function set enableEvents(_arg1:Boolean):void{
var _local2:Polygon;
if (_arg1){
if (!m_bEv){
if (m_bUseSingleContainer == false){
for each (_local2 in aPolygons) {
_local2.enableEvents = true;
};
} else {
m_oContainer.addEventListener(MouseEvent.CLICK, _onInteraction);
m_oContainer.addEventListener(MouseEvent.MOUSE_UP, _onInteraction);
m_oContainer.addEventListener(MouseEvent.MOUSE_DOWN, _onInteraction);
m_oContainer.addEventListener(MouseEvent.ROLL_OVER, _onInteraction);
m_oContainer.addEventListener(MouseEvent.ROLL_OUT, _onInteraction);
m_oContainer.addEventListener(MouseEvent.DOUBLE_CLICK, _onInteraction);
m_oContainer.addEventListener(MouseEvent.MOUSE_OVER, _onInteraction);
m_oContainer.addEventListener(MouseEvent.MOUSE_OUT, _onInteraction);
m_oContainer.addEventListener(MouseEvent.MOUSE_WHEEL, _onInteraction);
};
};
} else {
if (((!(_arg1)) && (m_bEv))){
if (m_bUseSingleContainer == false){
for each (_local2 in aPolygons) {
_local2.enableEvents = false;
};
} else {
m_oContainer.removeEventListener(MouseEvent.CLICK, _onInteraction);
m_oContainer.removeEventListener(MouseEvent.MOUSE_UP, _onInteraction);
m_oContainer.removeEventListener(MouseEvent.MOUSE_DOWN, _onInteraction);
m_oContainer.removeEventListener(MouseEvent.ROLL_OVER, _onInteraction);
m_oContainer.removeEventListener(MouseEvent.ROLL_OUT, _onInteraction);
m_oContainer.removeEventListener(MouseEvent.DOUBLE_CLICK, _onInteraction);
m_oContainer.removeEventListener(MouseEvent.MOUSE_OVER, _onInteraction);
m_oContainer.removeEventListener(MouseEvent.MOUSE_OUT, _onInteraction);
m_oContainer.removeEventListener(MouseEvent.MOUSE_WHEEL, _onInteraction);
};
};
};
m_bEv = _arg1;
}
override public function cull(_arg1:Frustum, _arg2:Matrix4, _arg3:Boolean):void{
super.cull(_arg1, _arg2, _arg3);
if (culled == Frustum.OUTSIDE){
return;
};
boundingSphere.transform(viewMatrix);
culled = _arg1.sphereInFrustum(boundingSphere);
if (culled == Frustum.INTERSECT){
culled = _arg1.boxInFrustum(boundingBox.transform(viewMatrix));
};
if (((!((culled == CullingState.OUTSIDE))) && (!((m_oAppearance == null))))){
scene.renderer.addToDisplayList(this);
};
if (((m_bEv) || (m_bMouseInteractivity))){
if ((((m_bWasOver == true)) && ((m_oLastContainer.hitTestPoint(m_oLastContainer.mouseX, m_oLastContainer.mouseY) == false)))){
m_oEB.dispatchEvent(new Shape3DEvent(MouseEvent.MOUSE_OUT, this, m_oLastEvent.polygon, m_oLastEvent.uv, m_oLastEvent.point, m_oLastEvent.event));
m_bWasOver = false;
if (m_oLastContainer != m_oContainer){
m_oLastEvent.polygon._onTextureInteraction(m_oLastEvent.event);
m_oLastEvent.polygon._stopMouseInteraction();
};
};
};
}
override public function destroy():void{
m_oGeometry.dispose();
clear();
if (m_oContainer.parent){
m_oContainer.parent.removeChild(m_oContainer);
};
if (m_oContainer){
m_oContainer = null;
};
__destroyPolygons();
super.destroy();
}
private function __generatePolygons(_arg1:Geometry3D):void{
var _local2:int;
var _local3:int = _arg1.aFacesVertexID.length;
aPolygons = new Array(_local3);
_local2 = 0;
while (_local2 < _local3) {
aPolygons[_local2] = new Polygon(this, _arg1, _arg1.aFacesVertexID[_local2], _arg1.aFacesUVCoordsID[_local2], _local2, _local2);
if (m_oAppearance){
aPolygons[int(_local2)].appearance = m_oAppearance;
};
this.broadcaster.addChild(aPolygons[int(_local2)].broadcaster);
_local2 = (_local2 + 1);
};
}
}
}//package sandy.core.scenegraph
Section 96
//Sprite2D (sandy.core.scenegraph.Sprite2D)
package sandy.core.scenegraph {
import sandy.events.*;
import sandy.materials.*;
import sandy.core.data.*;
import sandy.view.*;
import sandy.core.*;
import flash.events.*;
import flash.display.*;
public class Sprite2D extends ATransformable implements IDisplayable {
public var floorCenter:Boolean;// = false
protected var m_nDepth:Number;
protected var m_oMaterial:Material;
private var m_nH2:Number;// = 0
protected var _nScale:Number;
protected var m_oContent:DisplayObject;
protected var m_nRotation:Number;// = 0
public var fixedAngle:Boolean;// = false
public var vx:Vertex;
public var vy:Vertex;
private var m_nW2:Number;// = 0
private var m_bEv:Boolean;// = false
public var autoCenter:Boolean;// = true
public var enableForcedDepth:Boolean;// = false
public var forcedDepth:Number;// = 0
private var m_oContainer:Sprite;
protected var m_nPerspScaleY:Number;// = 0
public var v:Vertex;
protected var m_nPerspScaleX:Number;// = 0
public function Sprite2D(_arg1:String="", _arg2:DisplayObject=null, _arg3:Number=1){
super(_arg1);
m_oContainer = new Sprite();
v = new Vertex();
vx = new Vertex();
vy = new Vertex();
_nScale = _arg3;
if (_arg2){
content = _arg2;
};
setBoundingSphereRadius(Math.max(30, (Math.abs(_nScale) * Math.max(content.width, content.height))));
}
private function _finishMaterial(_arg1:SandyEvent):void{
if (!m_oMaterial){
return;
};
if (!visible){
return;
};
m_oMaterial.finish(scene);
}
public function setBoundingSphereRadius(_arg1:Number):void{
boundingSphere.radius = _arg1;
}
public function set content(_arg1:DisplayObject):void{
_arg1.transform.matrix.identity();
if (m_oContent){
m_oContainer.removeChild(m_oContent);
};
m_oContent = _arg1;
m_oContainer.addChildAt(m_oContent, 0);
m_oContent.x = 0;
m_oContent.y = 0;
m_nW2 = (m_oContainer.width / 2);
m_nH2 = (m_oContainer.height / 2);
changed = true;
}
override public function remove():void{
if (m_oContainer.parent){
m_oContainer.parent.removeChild(m_oContainer);
};
m_oContainer.graphics.clear();
enableEvents = false;
if (scene){
scene.removeEventListener(SandyEvent.SCENE_RENDER_FINISH, _finishMaterial);
scene.removeEventListener(SandyEvent.SCENE_RENDER_DISPLAYLIST, _beginMaterial);
};
super.remove();
}
public function set depth(_arg1:Number):void{
m_nDepth = _arg1;
changed = true;
}
public function get container():Sprite{
return (m_oContainer);
}
public function set scale(_arg1:Number):void{
if (_arg1){
_nScale = _arg1;
};
changed = true;
}
override public function set scene(_arg1:Scene3D):void{
if (_arg1 == null){
return;
};
if (scene){
scene.removeEventListener(SandyEvent.SCENE_RENDER_FINISH, _finishMaterial);
scene.removeEventListener(SandyEvent.SCENE_RENDER_DISPLAYLIST, _beginMaterial);
};
super.scene = _arg1;
scene.addEventListener(SandyEvent.SCENE_RENDER_FINISH, _finishMaterial);
scene.addEventListener(SandyEvent.SCENE_RENDER_DISPLAYLIST, _beginMaterial);
}
public function get material():Material{
return (m_oMaterial);
}
protected function _onInteraction(_arg1:Event):void{
m_oEB.dispatchEvent(new BubbleEvent(_arg1.type, this));
}
public function display(_arg1:Sprite=null):void{
m_nPerspScaleX = ((_nScale)==0) ? 1 : (_nScale * (vx.sx - v.sx));
m_nPerspScaleY = ((_nScale)==0) ? 1 : (_nScale * (v.sy - vy.sy));
m_nRotation = Math.atan2(viewMatrix.n12, viewMatrix.n22);
m_oContainer.scaleX = m_nPerspScaleX;
m_oContainer.scaleY = m_nPerspScaleY;
m_oContainer.x = (v.sx - (autoCenter) ? (m_oContainer.width / 2) : 0);
m_oContainer.y = (v.sy - (autoCenter) ? (m_oContainer.height / 2) : (floorCenter) ? m_oContainer.height : 0);
if (fixedAngle){
m_oContainer.rotation = ((m_nRotation * 180) / Math.PI);
};
if (m_oMaterial){
m_oMaterial.renderSprite(this, m_oMaterial, scene);
};
}
public function get scale():Number{
return (_nScale);
}
public function clear():void{
}
public function set material(_arg1:Material):void{
m_oMaterial = _arg1;
changed = true;
}
public function get depth():Number{
return (m_nDepth);
}
override public function toString():String{
return (("sandy.core.scenegraph.Sprite2D, container:" + m_oContainer));
}
private function _beginMaterial(_arg1:SandyEvent):void{
if (!m_oMaterial){
return;
};
if (!visible){
return;
};
m_oMaterial.begin(scene);
}
override public function cull(_arg1:Frustum, _arg2:Matrix4, _arg3:Boolean):void{
super.cull(_arg1, _arg2, _arg3);
if (visible == false){
container.visible = visible;
return;
};
if (viewMatrix){
boundingSphere.transform(viewMatrix);
culled = _arg1.sphereInFrustum(boundingSphere);
};
if (culled == CullingState.OUTSIDE){
container.visible = false;
} else {
if (culled == CullingState.INTERSECT){
if (boundingSphere.position.z <= scene.camera.near){
container.visible = false;
} else {
container.visible = true;
scene.renderer.addToDisplayList(this);
};
} else {
container.visible = true;
scene.renderer.addToDisplayList(this);
};
};
}
override public function set enableEvents(_arg1:Boolean):void{
if (((_arg1) && (!(m_bEv)))){
m_oContainer.addEventListener(MouseEvent.CLICK, _onInteraction);
m_oContainer.addEventListener(MouseEvent.MOUSE_UP, _onInteraction);
m_oContainer.addEventListener(MouseEvent.MOUSE_DOWN, _onInteraction);
m_oContainer.addEventListener(MouseEvent.ROLL_OVER, _onInteraction);
m_oContainer.addEventListener(MouseEvent.ROLL_OUT, _onInteraction);
m_oContainer.addEventListener(MouseEvent.DOUBLE_CLICK, _onInteraction);
m_oContainer.addEventListener(MouseEvent.MOUSE_MOVE, _onInteraction);
m_oContainer.addEventListener(MouseEvent.MOUSE_OVER, _onInteraction);
m_oContainer.addEventListener(MouseEvent.MOUSE_OUT, _onInteraction);
m_oContainer.addEventListener(MouseEvent.MOUSE_WHEEL, _onInteraction);
} else {
if (((!(_arg1)) && (m_bEv))){
m_oContainer.removeEventListener(MouseEvent.CLICK, _onInteraction);
m_oContainer.removeEventListener(MouseEvent.MOUSE_UP, _onInteraction);
m_oContainer.removeEventListener(MouseEvent.MOUSE_DOWN, _onInteraction);
m_oContainer.removeEventListener(MouseEvent.ROLL_OVER, _onInteraction);
m_oContainer.removeEventListener(MouseEvent.ROLL_OUT, _onInteraction);
m_oContainer.removeEventListener(MouseEvent.DOUBLE_CLICK, _onInteraction);
m_oContainer.removeEventListener(MouseEvent.MOUSE_MOVE, _onInteraction);
m_oContainer.removeEventListener(MouseEvent.MOUSE_OVER, _onInteraction);
m_oContainer.removeEventListener(MouseEvent.MOUSE_OUT, _onInteraction);
m_oContainer.removeEventListener(MouseEvent.MOUSE_WHEEL, _onInteraction);
};
};
}
public function get content():DisplayObject{
return (m_oContent);
}
override public function destroy():void{
remove();
super.destroy();
}
public function get enableEvents():Boolean{
return (m_bEv);
}
}
}//package sandy.core.scenegraph
Section 97
//TransformGroup (sandy.core.scenegraph.TransformGroup)
package sandy.core.scenegraph {
import sandy.core.data.*;
import sandy.view.*;
public class TransformGroup extends ATransformable {
public function TransformGroup(_arg1:String=""){
super(_arg1);
}
override public function cull(_arg1:Frustum, _arg2:Matrix4, _arg3:Boolean):void{
var _local4:Boolean;
var _local5:Node;
if (visible == false){
culled = CullingState.OUTSIDE;
} else {
_local4 = ((_arg3) || (changed));
for each (_local5 in children) {
_local5.cull(_arg1, _arg2, _local4);
};
};
}
override public function toString():String{
return ((("sandy.core.scenegraph.TransformGroup :[" + name) + "]"));
}
public function clone(_arg1:String):TransformGroup{
var _local3:*;
var _local2:TransformGroup = new TransformGroup(_arg1);
for each (_local3 in children) {
if ((((((_local3 is Shape3D)) || ((_local3 is Group)))) || ((_local3 is TransformGroup)))){
_local2.addChild(_local3.clone(((_arg1 + "_") + _local3.name)));
};
};
return (_local2);
}
}
}//package sandy.core.scenegraph
Section 98
//Renderer (sandy.core.Renderer)
package sandy.core {
import sandy.core.scenegraph.*;
import sandy.core.data.*;
import sandy.view.*;
import flash.display.*;
public class Renderer {
protected const m_aDisplayList:Array;
protected const m_aRenderingList:Array;
protected var m_nRenderingListCount:int;
private var m_bGlobalRedraw:Boolean;
protected var m_nDisplayListCount:int;
protected var m_aCamera:Camera3D;
private var pool:Pool;
public function Renderer(){
m_aDisplayList = new Array();
m_aRenderingList = new Array();
pool = Pool.getInstance();
super();
m_nRenderingListCount = 0;
m_nDisplayListCount = 0;
}
public function addToDisplayList(_arg1:IDisplayable):void{
var _local2 = m_nDisplayListCount++;
m_aDisplayList[_local2] = _arg1;
m_bGlobalRedraw = ((((m_bGlobalRedraw) || (_arg1.changed))) || (((_arg1.material)!=null) ? _arg1.material.modified : false));
}
public function render(_arg1:Scene3D, _arg2:Boolean=true):Boolean{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local22:Matrix4;
var _local24:Vertex;
var _local25:Array;
var _local26:Polygon;
var _local27:Number;
var _local28:int;
var _local30:int;
var _local32:IDisplayable;
var _local33:Shape3D;
var _local34:Boolean;
var _local35:Sprite2D;
var _local18:Camera3D = _arg1.camera;
var _local19:Number = _local18.near;
var _local20:Point3D = pool.nextPoint3D;
var _local21:uint;
var _local23:Frustum = _local18.frustrum;
var _local29:int;
var _local31:Boolean = ((_arg1.camera.changed) || (!(_arg2)));
m_bGlobalRedraw = ((m_bGlobalRedraw) || ((m_aRenderingList.length == m_aDisplayList.length)));
if ((((m_bGlobalRedraw == false)) && ((_local31 == false)))){
return (false);
};
for each (_local32 in m_aRenderingList) {
if (_local32){
if ((((((_local31 == true)) || (((_local32.material)!=null) ? _local32.material.modified : false))) || ((_local32.changed == true)))){
_local32.clear();
};
};
};
m_nRenderingListCount = 0;
m_aRenderingList.length = 0;
_local30 = 0;
for (;_local30 < m_nDisplayListCount;_local30++) {
if ((m_aDisplayList[int(_local30)] is Shape3D)){
_local33 = (m_aDisplayList[int(_local30)] as Shape3D);
if ((((_local33.changed == false)) && ((_local31 == false)))){
if (_local33.useSingleContainer){
m_aRenderingList[int(m_nRenderingListCount++)] = _local33;
} else {
for each (_local26 in _local33.aVisiblePolygons) {
m_aRenderingList[int(m_nRenderingListCount++)] = _local26;
};
};
continue;
};
_local28 = _local33.appearance.flags;
_local33.depth = 0;
_local33.aVisiblePolygons.length = 0;
_local20.reset(_local18.modelMatrix.n14, _local18.modelMatrix.n24, _local18.modelMatrix.n34);
_local33.invModelMatrix.transform(_local20);
_local22 = _local33.viewMatrix;
_local3 = _local22.n11;
_local4 = _local22.n21;
_local5 = _local22.n31;
_local6 = _local22.n12;
_local7 = _local22.n22;
_local8 = _local22.n32;
_local9 = _local22.n13;
_local10 = _local22.n23;
_local11 = _local22.n33;
_local12 = _local22.n14;
_local13 = _local22.n24;
_local14 = _local22.n34;
_local34 = (((_local33.culled == CullingState.INTERSECT)) && (((_local33.enableClipping) || (_local33.enableNearClipping))));
for each (_local24 in _local33.geometry.aVertex) {
_local24.projected = (_local24.transformed = false);
};
for each (_local26 in _local33.aPolygons) {
if (_local33.animated){
_local26.updateNormal();
};
_local24 = _local26.normal;
_local15 = _local26.a.x;
_local16 = _local26.a.y;
_local17 = _local26.a.z;
_local26.visible = ((((_local24.x * (_local20.x - _local15)) + (_local24.y * (_local20.y - _local16))) + (_local24.z * (_local20.z - _local17))) > 0);
if (_local33.enableBackFaceCulling){
//unresolved if
} else {
_local24 = _local26.a;
if (_local24.transformed == false){
_local24.wx = ((((_local15 * _local3) + (_local16 * _local6)) + (_local17 * _local9)) + _local12);
_local24.wy = ((((_local15 * _local4) + (_local16 * _local7)) + (_local17 * _local10)) + _local13);
_local24.wz = ((((_local15 * _local5) + (_local16 * _local8)) + (_local17 * _local11)) + _local14);
_local24.transformed = true;
};
_local24 = _local26.b;
if (_local24.transformed == false){
_local15 = _local24.x;
_local16 = _local24.y;
_local17 = _local24.z;
_local24.wx = ((((_local15 * _local3) + (_local16 * _local6)) + (_local17 * _local9)) + _local12);
_local24.wy = ((((_local15 * _local4) + (_local16 * _local7)) + (_local17 * _local10)) + _local13);
_local24.wz = ((((_local15 * _local5) + (_local16 * _local8)) + (_local17 * _local11)) + _local14);
_local24.transformed = true;
};
_local24 = _local26.c;
if (_local24){
if (_local24.transformed == false){
_local15 = _local24.x;
_local16 = _local24.y;
_local17 = _local24.z;
_local24.wx = ((((_local15 * _local3) + (_local16 * _local6)) + (_local17 * _local9)) + _local12);
_local24.wy = ((((_local15 * _local4) + (_local16 * _local7)) + (_local17 * _local10)) + _local13);
_local24.wz = ((((_local15 * _local5) + (_local16 * _local8)) + (_local17 * _local11)) + _local14);
_local24.transformed = true;
};
};
_local24 = _local26.d;
if (_local24){
if (_local24.transformed == false){
_local15 = _local24.x;
_local16 = _local24.y;
_local17 = _local24.z;
_local24.wx = ((((_local15 * _local3) + (_local16 * _local6)) + (_local17 * _local9)) + _local12);
_local24.wy = ((((_local15 * _local4) + (_local16 * _local7)) + (_local17 * _local10)) + _local13);
_local24.wz = ((((_local15 * _local5) + (_local16 * _local8)) + (_local17 * _local11)) + _local14);
_local24.transformed = true;
};
};
_local26.precompute();
_local27 = _local26.minZ;
if (_local34){
if (_local33.enableClipping){
_local26.clip(_local23);
} else {
if (((_local33.enableNearClipping) && ((_local27 < _local19)))){
_local26.clipFrontPlane(_local23);
} else {
if (_local27 < _local19){
continue;
};
};
};
} else {
if (_local27 < _local19){
continue;
};
};
_local25 = (_local26.isClipped) ? _local26.cvertices : _local26.vertices;
if (_local25.length > 1){
_local18.projectArray(_local25);
if (_local33.enableForcedDepth){
_local26.depth = _local33.forcedDepth;
} else {
_local33.depth = (_local33.depth + _local26.depth);
};
_local29++;
_local33.aVisiblePolygons[int(_local33.aVisiblePolygons.length)] = _local26;
_local21 = (_local21 | _local28);
if (_local33.useSingleContainer == false){
m_aRenderingList[int(m_nRenderingListCount++)] = _local26;
};
};
};
};
if (_local33.aVisiblePolygons.length > 0){
if (_local33.useSingleContainer == true){
if (_local33.enableForcedDepth){
_local33.depth = _local33.forcedDepth;
} else {
_local33.depth = (_local33.depth / _local33.aVisiblePolygons.length);
};
m_aRenderingList[int(m_nRenderingListCount++)] = _local33;
};
if (((!((_local28 == 0))) || (!((_local21 == 0))))){
if (((_local28 | _local21) & SandyFlags.POLYGON_NORMAL_WORLD)){
_local22 = _local33.modelMatrix;
_local3 = _local22.n11;
_local4 = _local22.n21;
_local5 = _local22.n31;
_local6 = _local22.n12;
_local7 = _local22.n22;
_local8 = _local22.n32;
_local9 = _local22.n13;
_local10 = _local22.n23;
_local11 = _local22.n33;
for each (_local26 in _local33.aVisiblePolygons) {
_local24 = _local26.normal;
_local15 = _local24.x;
_local16 = _local24.y;
_local17 = _local24.z;
_local26.normal.wx = (((_local15 * _local3) + (_local16 * _local6)) + (_local17 * _local9));
_local24.wy = (((_local15 * _local4) + (_local16 * _local7)) + (_local17 * _local10));
_local24.wz = (((_local15 * _local5) + (_local16 * _local8)) + (_local17 * _local11));
};
};
if (((_local28 | _local21) & SandyFlags.VERTEX_NORMAL_WORLD)){
_local22 = _local33.modelMatrix;
_local3 = _local22.n11;
_local4 = _local22.n21;
_local5 = _local22.n31;
_local6 = _local22.n12;
_local7 = _local22.n22;
_local8 = _local22.n32;
_local9 = _local22.n13;
_local10 = _local22.n23;
_local11 = _local22.n33;
for each (_local24 in _local33.geometry.aVertexNormals) {
_local15 = _local24.x;
_local16 = _local24.y;
_local17 = _local24.z;
_local24.wx = (((_local15 * _local3) + (_local16 * _local6)) + (_local17 * _local9));
_local24.wy = (((_local15 * _local4) + (_local16 * _local7)) + (_local17 * _local10));
_local24.wz = (((_local15 * _local5) + (_local16 * _local8)) + (_local17 * _local11));
};
};
};
};
} else {
if ((m_aDisplayList[int(_local30)] is Sprite2D)){
_local35 = (m_aDisplayList[int(_local30)] as Sprite2D);
_local35.v.projected = false;
_local35.vx.projected = false;
_local35.vy.projected = false;
_local24 = _local35.v;
_local22 = _local35.viewMatrix;
_local24.wx = ((((_local24.x * _local22.n11) + (_local24.y * _local22.n12)) + (_local24.z * _local22.n13)) + _local22.n14);
_local24.wy = ((((_local24.x * _local22.n21) + (_local24.y * _local22.n22)) + (_local24.z * _local22.n23)) + _local22.n24);
_local24.wz = ((((_local24.x * _local22.n31) + (_local24.y * _local22.n32)) + (_local24.z * _local22.n33)) + _local22.n34);
_local35.depth = (_local35.enableForcedDepth) ? _local35.forcedDepth : _local24.wz;
_local18.projectVertex(_local24);
m_aRenderingList[int(m_nRenderingListCount++)] = _local35;
_local35.vx.copy(_local24);
_local35.vx.wx++;
_local18.projectVertex(_local35.vx);
_local35.vy.copy(_local24);
_local35.vy.wy++;
_local18.projectVertex(_local35.vy);
} else {
if ((m_aDisplayList[int(_local30)] is Renderable)){
(m_aDisplayList[int(_local30)] as Renderable).render(_local18);
m_aRenderingList[int(m_nRenderingListCount++)] = (m_aDisplayList[int(_local30)] as Renderable);
};
};
};
};
return (true);
}
public function init():void{
m_nDisplayListCount = 0;
m_bGlobalRedraw = false;
}
public function removeFromDisplayList(_arg1:IDisplayable):void{
_arg1.clear();
if (m_aDisplayList.indexOf(_arg1) > -1){
m_aDisplayList.splice(m_aDisplayList.indexOf(_arg1), 1);
};
}
public function renderDisplayList(_arg1:Scene3D):void{
var _local3:IDisplayable;
var _local2:Sprite = _arg1.container;
m_aRenderingList.sortOn("depth", (Array.NUMERIC | Array.DESCENDING));
var _local4:int;
while (_local4 < m_nRenderingListCount) {
_local3 = m_aRenderingList[int(_local4)];
if (((((_local3.changed) || (((_local3.material)!=null) ? _local3.material.modified : false))) || (_arg1.camera.changed))){
_local3.display();
};
if (_local4 < _local2.numChildren){
if (_local2.getChildAt(_local4) != _local3.container){
_local2.addChildAt(_local3.container, _local4);
};
} else {
_local2.addChildAt(_local3.container, _local4);
};
_local4++;
};
}
}
}//package sandy.core
Section 99
//SandyFlags (sandy.core.SandyFlags)
package sandy.core {
public final class SandyFlags {
public static const VERTEX_NORMAL_WORLD:uint = 2;
public static const POLYGON_NORMAL_WORLD:uint = 1;
}
}//package sandy.core
Section 100
//Scene3D (sandy.core.Scene3D)
package sandy.core {
import sandy.events.*;
import sandy.core.scenegraph.*;
import sandy.core.data.*;
import flash.events.*;
import flash.display.*;
import sandy.core.light.*;
public class Scene3D extends EventDispatcher {
public var container:Sprite;
public var renderer:Renderer;
public var camera:Camera3D;
private var m_bRectClipped:Boolean;// = false
private var _light:Light3D;
protected var m_sName:String;
protected var m_oRoot:Group;
private static var _version:String = "3.1";
public function Scene3D(_arg1:String, _arg2:Sprite, _arg3:Camera3D=null, _arg4:Group=null){
renderer = new Renderer();
super();
if (_arg1 != null){
if (SceneLocator.getInstance().registerScene(_arg1, this)){
container = _arg2;
camera = _arg3;
root = _arg4;
if (((!((root == null))) && (!((camera == null))))){
if (!camera.hasParent()){
root.addChild(camera);
};
};
};
m_sName = _arg1;
};
_light = new Light3D(new Point3D(0, 0, 1), 100);
}
public function set root(_arg1:Group):void{
if (m_oRoot){
m_oRoot.scene = null;
m_oRoot = null;
};
if (_arg1){
m_oRoot = _arg1;
m_oRoot.scene = this;
if (!camera.hasParent()){
root.addChild(camera);
};
};
}
private function _onLightUpdate(_arg1:SandyEvent):void{
}
public function get root():Group{
return (m_oRoot);
}
public function get name():String{
return (m_sName);
}
public function set light(_arg1:Light3D):void{
if (_light){
_light.destroy();
};
_light = _arg1;
dispatchEvent(new SandyEvent(SandyEvent.LIGHT_ADDED));
}
public function get rectClipping():Boolean{
return (m_bRectClipped);
}
public function dispose():Boolean{
SceneLocator.getInstance().unregisterScene(m_sName);
if (root){
root.destroy();
root = null;
};
if (camera){
camera = null;
};
if (_light){
_light = null;
};
return (true);
}
public function render(_arg1:Boolean=true):void{
var _local2:Boolean;
if (((((root) && (camera))) && (container))){
Pool.getInstance().init();
renderer.init();
dispatchEvent(new SandyEvent(SandyEvent.SCENE_UPDATE));
root.update(null, false);
dispatchEvent(new SandyEvent(SandyEvent.SCENE_CULL));
root.cull(camera.frustrum, camera.invModelMatrix, camera.changed);
dispatchEvent(new SandyEvent(SandyEvent.SCENE_RENDER));
_local2 = renderer.render(this, _arg1);
dispatchEvent(new SandyEvent(SandyEvent.SCENE_RENDER_DISPLAYLIST));
if (((_local2) || (_light.changed))){
renderer.renderDisplayList(this);
_light.changed = false;
};
dispatchEvent(new SandyEvent(SandyEvent.SCENE_RENDER_FINISH));
};
}
public function set rectClipping(_arg1:Boolean):void{
m_bRectClipped = _arg1;
if (camera){
camera.viewport.hasChanged = true;
};
}
public function get light():Light3D{
return (_light);
}
public static function getVersion():String{
return (_version);
}
}
}//package sandy.core
Section 101
//SceneLocator (sandy.core.SceneLocator)
package sandy.core {
import flash.utils.*;
public class SceneLocator {
private var _m:Dictionary;
private static var _oI:SceneLocator;
public function SceneLocator(_arg1:PrivateConstructorAccess){
_m = new Dictionary(true);
}
public function unregisterScene(_arg1:String):void{
_m[_arg1] = null;
}
public function getScene(_arg1:String):Scene3D{
if (!isRegistered(_arg1)){
trace(((("Can't locate scene instance with '" + _arg1) + "' name in ") + this));
};
return ((_m[_arg1] as Scene3D));
}
public function registerScene(_arg1:String, _arg2:Scene3D):Boolean{
if (isRegistered(_arg1)){
trace(((("scene instance is already registered with '" + _arg1) + "' name in ") + this));
return (false);
};
_m[_arg1] = _arg2;
return (true);
}
public function isRegistered(_arg1:String):Boolean{
return (!((_m[_arg1] == null)));
}
public static function getInstance():SceneLocator{
if (!_oI){
_oI = new SceneLocator(new PrivateConstructorAccess());
};
return (_oI);
}
}
}//package sandy.core
final class PrivateConstructorAccess {
private function PrivateConstructorAccess(){
}
}
Section 102
//BubbleEvent (sandy.events.BubbleEvent)
package sandy.events {
import flash.events.*;
public class BubbleEvent extends Event {
private var m_oTarget:Object;
public function BubbleEvent(_arg1:String, _arg2:Object){
super(_arg1, true, true);
m_oTarget = _arg2;
}
override public function toString():String{
return ("BubbleEvent");
}
public function get object():Object{
return (m_oTarget);
}
}
}//package sandy.events
Section 103
//BubbleEventBroadcaster (sandy.events.BubbleEventBroadcaster)
package sandy.events {
import flash.events.*;
public final class BubbleEventBroadcaster extends EventBroadcaster {
private var m_oParent:BubbleEventBroadcaster;// = null
private var m_oTarget:Object;
public function BubbleEventBroadcaster(_arg1:Object){
m_oTarget = _arg1;
}
override public function dispatchEvent(_arg1:Event):Boolean{
if ((_arg1 is BubbleEvent)){
super.dispatchEvent(_arg1);
if (parent){
parent.dispatchEvent(_arg1);
};
} else {
super.dispatchEvent(_arg1);
};
return (true);
}
public function get target():Object{
return (m_oTarget);
}
public function set parent(_arg1:BubbleEventBroadcaster):void{
m_oParent = _arg1;
}
public function removeChild(_arg1:BubbleEventBroadcaster):void{
}
public function get parent():BubbleEventBroadcaster{
return (m_oParent);
}
public function addChild(_arg1:BubbleEventBroadcaster):void{
_arg1.parent = this;
}
}
}//package sandy.events
Section 104
//EventBroadcaster (sandy.events.EventBroadcaster)
package sandy.events {
import flash.events.*;
public class EventBroadcaster extends EventDispatcher {
override public function dispatchEvent(_arg1:Event):Boolean{
if (((hasEventListener(_arg1.type)) || (_arg1.bubbles))){
return (super.dispatchEvent(_arg1));
};
return (true);
}
}
}//package sandy.events
Section 105
//SandyEvent (sandy.events.SandyEvent)
package sandy.events {
import flash.events.*;
public class SandyEvent extends Event {
public static const QUEUE_LOADER_ERROR:String = "queueLoaderError";
public static const SCENE_CULL:String = "scene_cull";
public static const QUEUE_COMPLETE:String = "queueComplete";
public static const SCENE_RENDER:String = "scene_render";
public static const CONTAINER_CREATED:String = "containerCreated";
public static const LIGHT_COLOR_CHANGED:String = "lightColorChanged";
public static const SCENE_RENDER_FINISH:String = "scene_render_finish";
public static const SCENE_RENDER_DISPLAYLIST:String = "scene_render_display_list";
public static const LIGHT_ADDED:String = "lightAdded";
public static const LIGHT_UPDATED:String = "lightUpdated";
public static const SCENE_UPDATE:String = "scene_update";
public function SandyEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
override public function clone():Event{
return (new SandyEvent(type, bubbles, cancelable));
}
}
}//package sandy.events
Section 106
//Shape3DEvent (sandy.events.Shape3DEvent)
package sandy.events {
import sandy.core.scenegraph.*;
import sandy.core.data.*;
import flash.events.*;
public class Shape3DEvent extends BubbleEvent {
public var point:Point3D;
public var uv:UVCoord;
public var shape:Shape3D;
public var polygon:Polygon;
public var event:Event;
public function Shape3DEvent(_arg1:String, _arg2:Shape3D, _arg3:Polygon, _arg4:UVCoord, _arg5:Point3D, _arg6:Event){
super(_arg1, _arg2);
shape = _arg2;
polygon = _arg3;
uv = _arg4;
point = _arg5;
event = _arg6;
}
}
}//package sandy.events
Section 107
//AAttributes (sandy.materials.attributes.AAttributes)
package sandy.materials.attributes {
import sandy.core.scenegraph.*;
import sandy.materials.*;
import sandy.core.data.*;
import sandy.core.*;
import flash.display.*;
public class AAttributes implements IAttributes {
protected var m_nFlags:uint;// = 0
public function get flags():uint{
return (m_nFlags);
}
public function drawOnSprite(_arg1:Sprite2D, _arg2:Material, _arg3:Scene3D):void{
}
public function draw(_arg1:Graphics, _arg2:Polygon, _arg3:Material, _arg4:Scene3D):void{
}
public function finish(_arg1:Scene3D):void{
}
public function init(_arg1:Polygon):void{
}
public function begin(_arg1:Scene3D):void{
}
public function unlink(_arg1:Polygon):void{
}
}
}//package sandy.materials.attributes
Section 108
//ALightAttributes (sandy.materials.attributes.ALightAttributes)
package sandy.materials.attributes {
import sandy.core.scenegraph.*;
import sandy.materials.*;
import sandy.core.data.*;
import sandy.core.*;
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
public class ALightAttributes implements IAttributes {
protected const m_oH:Point3D;
private var _gloss:Number;// = 5
private var _scenes:Dictionary;
private var _specular:Number;// = 0
private var _diffuse:Number;// = 1
protected var m_oCurrentH:Point3D;
protected var m_nI:Number;
protected var m_oCurrentL:Point3D;
protected var m_oCurrentV:Point3D;
protected var m_oL:Point3D;
protected var m_nFlags:uint;// = 0
protected var m_oV:Point3D;
protected var m_oCurrentShape:Shape3D;
private var _ambient:Number;// = 0.3
public function ALightAttributes(){
m_oH = new Point3D();
m_oCurrentL = new Point3D();
m_oCurrentV = new Point3D();
m_oCurrentH = new Point3D();
_scenes = new Dictionary(true);
super();
}
public function set specular(_arg1:Number):void{
_specular = _arg1;
onPropertyChange();
}
public function get flags():uint{
return (m_nFlags);
}
public function get gloss():Number{
return (_gloss);
}
public function init(_arg1:Polygon):void{
}
private function applyColorToDisplayObject(_arg1:DisplayObject, _arg2:uint, _arg3:Number):void{
var _local4:Number;
var _local5:Number;
var _local6:Number;
if ((((_arg2 < 1)) || ((_arg2 > 0xFFFFFF)))){
_arg2 = 0xFFFFFF;
};
_local4 = ((0xFF0000 & _arg2) >> 16);
_local5 = ((0xFF00 & _arg2) >> 8);
_local6 = (0xFF & _arg2);
var _local7:Number = ((_arg3 * 1.7321) / Math.sqrt((((_local4 * _local4) + (_local5 * _local5)) + (_local6 * _local6))));
_local4 = (_local4 * _local7);
_local5 = (_local5 * _local7);
_local6 = (_local6 * _local7);
var _local8:ColorTransform = _arg1.transform.colorTransform;
if (((((!((_local8.redMultiplier == _local4))) || (!((_local8.greenMultiplier == _local5))))) || (!((_local8.blueMultiplier == _local6))))){
_local8.redMultiplier = _local4;
_local8.greenMultiplier = _local5;
_local8.blueMultiplier = _local6;
_arg1.transform.colorTransform = _local8;
};
}
public function unlink(_arg1:Polygon):void{
if (m_oCurrentShape == _arg1.shape){
m_oCurrentShape = null;
};
}
public function set gloss(_arg1:Number):void{
_gloss = _arg1;
onPropertyChange();
}
public function get ambient():Number{
return (_ambient);
}
protected function onPropertyChange():void{
}
public function finish(_arg1:Scene3D):void{
}
public function set ambient(_arg1:Number):void{
_ambient = _arg1;
onPropertyChange();
}
public function begin(_arg1:Scene3D):void{
m_nI = _arg1.light.getNormalizedPower();
m_oL = _arg1.light.getDirectionPoint3D();
m_oV = _arg1.camera.getPosition("absolute");
m_oV.scale(-1);
m_oV.normalize();
m_oH.copy(m_oL);
m_oH.add(m_oV);
m_oH.normalize();
m_oCurrentShape = null;
m_oCurrentL.copy(m_oL);
m_oCurrentV.copy(m_oV);
m_oCurrentH.copy(m_oH);
}
public function get specular():Number{
return (_specular);
}
public function set diffuse(_arg1:Number):void{
_diffuse = _arg1;
onPropertyChange();
}
public function draw(_arg1:Graphics, _arg2:Polygon, _arg3:Material, _arg4:Scene3D):void{
var _local5:Matrix4;
if (_arg3.lightingEnable){
applyColorToDisplayObject((_arg2.shape.useSingleContainer) ? _arg2.shape.container : _arg2.container, _arg4.light.color, 1);
if (m_oCurrentShape != _arg2.shape){
m_oCurrentShape = _arg2.shape;
_local5 = m_oCurrentShape.invModelMatrix;
if (m_oL){
m_oCurrentL.copy(m_oL);
_local5.transform3x3(m_oCurrentL);
};
if (m_oV){
m_oCurrentV.copy(m_oV);
_local5.transform3x3(m_oCurrentV);
};
if (m_oH){
m_oCurrentH.copy(m_oH);
_local5.transform3x3(m_oCurrentH);
};
};
};
}
public function get diffuse():Number{
return (_diffuse);
}
protected function calculate(_arg1:Point3D, _arg2:Boolean, _arg3:Boolean=false):Number{
var _local6:Number;
var _local4:Number = (_arg2) ? -1 : 1;
var _local5:Number = (_local4 * m_oCurrentL.dot(_arg1));
if (_local5 < 0){
_local5 = 0;
};
_local5 = (_ambient + (_diffuse * _local5));
if (((!(_arg3)) && ((specular > 0)))){
_local6 = (_local4 * m_oCurrentH.dot(_arg1));
if (_local6 < 0){
_local6 = 0;
};
_local5 = (_local5 + (_specular * Math.pow(_local6, _gloss)));
};
return ((_local5 * m_nI));
}
public function drawOnSprite(_arg1:Sprite2D, _arg2:Material, _arg3:Scene3D):void{
if (_arg2.lightingEnable){
applyColorToDisplayObject(_arg1.container, _arg3.light.color, (ambient * _arg3.light.getNormalizedPower()));
};
}
}
}//package sandy.materials.attributes
Section 109
//IAttributes (sandy.materials.attributes.IAttributes)
package sandy.materials.attributes {
import sandy.core.scenegraph.*;
import sandy.materials.*;
import sandy.core.data.*;
import sandy.core.*;
import flash.display.*;
public interface IAttributes {
function init(_arg1:Polygon):void;
function finish(_arg1:Scene3D):void;
function draw(_arg1:Graphics, _arg2:Polygon, _arg3:Material, _arg4:Scene3D):void;
function get flags():uint;
function drawOnSprite(_arg1:Sprite2D, _arg2:Material, _arg3:Scene3D):void;
function begin(_arg1:Scene3D):void;
function unlink(_arg1:Polygon):void;
}
}//package sandy.materials.attributes
Section 110
//LightAttributes (sandy.materials.attributes.LightAttributes)
package sandy.materials.attributes {
import sandy.materials.*;
import sandy.core.data.*;
import sandy.core.*;
import flash.display.*;
public final class LightAttributes extends ALightAttributes {
public var useBright:Boolean;// = false
public function LightAttributes(_arg1:Boolean=false, _arg2:Number=0.3){
useBright = _arg1;
ambient = Math.min(Math.max(_arg2, 0), 1);
}
override public function draw(_arg1:Graphics, _arg2:Polygon, _arg3:Material, _arg4:Scene3D):void{
var _local5:Array;
var _local6:Point3D;
var _local7:Number;
var _local8:Vertex;
super.draw(_arg1, _arg2, _arg3, _arg4);
if (_arg3.lightingEnable){
_local5 = (_arg2.isClipped) ? _arg2.cvertices : _arg2.vertices;
_local6 = _arg2.normal.getPoint3D();
_local7 = calculate(_local6, _arg2.visible);
if (_local7 > 1){
_local7 = 1;
} else {
if (_local7 < ambient){
_local7 = ambient;
};
};
_arg1.lineStyle();
if (useBright){
_arg1.beginFill(((_local7)<0.5) ? 0 : 0xFFFFFF, ((_local7)<0.5) ? (1 - (2 * _local7)) : ((2 * _local7) - 1));
} else {
_arg1.beginFill(0, (1 - _local7));
};
_arg1.moveTo(Vertex(_local5[0]).sx, Vertex(_local5[0]).sy);
for each (_local8 in _local5) {
_arg1.lineTo(_local8.sx, _local8.sy);
};
_arg1.endFill();
_local6 = null;
_local8 = null;
};
}
}
}//package sandy.materials.attributes
Section 111
//LineAttributes (sandy.materials.attributes.LineAttributes)
package sandy.materials.attributes {
import sandy.materials.*;
import sandy.core.data.*;
import sandy.core.*;
import flash.display.*;
public class LineAttributes extends AAttributes {
private var m_nAlpha:Number;
private var m_nColor:Number;
public var modified:Boolean;
private var m_nThickness:Number;
public function LineAttributes(_arg1:uint=1, _arg2:uint=0, _arg3:Number=1){
m_nThickness = _arg1;
m_nAlpha = _arg3;
m_nColor = _arg2;
modified = true;
}
public function get color():Number{
return (m_nColor);
}
public function set color(_arg1:Number):void{
m_nColor = _arg1;
modified = true;
}
public function set thickness(_arg1:Number):void{
m_nThickness = _arg1;
modified = true;
}
override public function draw(_arg1:Graphics, _arg2:Polygon, _arg3:Material, _arg4:Scene3D):void{
var _local6:Vertex;
var _local5:Array = (_arg2.isClipped) ? _arg2.cvertices : _arg2.vertices;
_arg1.lineStyle(m_nThickness, m_nColor, m_nAlpha);
_arg1.moveTo(_local5[0].sx, _local5[0].sy);
var _local7:int = _local5.length;
while ((_local6 = _local5[--_local7])) {
_arg1.lineTo(_local6.sx, _local6.sy);
};
}
public function get thickness():Number{
return (m_nThickness);
}
public function set alpha(_arg1:Number):void{
m_nAlpha = _arg1;
modified = true;
}
public function get alpha():Number{
return (m_nAlpha);
}
}
}//package sandy.materials.attributes
Section 112
//MaterialAttributes (sandy.materials.attributes.MaterialAttributes)
package sandy.materials.attributes {
import sandy.core.scenegraph.*;
import sandy.materials.*;
import sandy.core.data.*;
import sandy.core.*;
import flash.display.*;
public class MaterialAttributes {
public var attributes:Array;
public function MaterialAttributes(... _args){
attributes = new Array();
super();
var _local2:int;
while (_local2 < _args.length) {
if ((_args[_local2] is IAttributes)){
attributes.push(_args[_local2]);
};
_local2++;
};
}
public function init(_arg1:Polygon):void{
var _local2:IAttributes;
for each (_local2 in attributes) {
_local2.init(_arg1);
};
}
public function finish(_arg1:Scene3D):void{
var _local2:IAttributes;
for each (_local2 in attributes) {
_local2.finish(_arg1);
};
}
public function unlink(_arg1:Polygon):void{
var _local2:IAttributes;
for each (_local2 in attributes) {
_local2.unlink(_arg1);
};
}
public function draw(_arg1:Graphics, _arg2:Polygon, _arg3:Material, _arg4:Scene3D):void{
var _local5:IAttributes;
for each (_local5 in attributes) {
_local5.draw(_arg1, _arg2, _arg3, _arg4);
};
}
public function get flags():uint{
var _local2:IAttributes;
var _local1:uint;
for each (_local2 in attributes) {
_local1 = (_local1 | _local2.flags);
};
return (_local1);
}
public function drawOnSprite(_arg1:Sprite2D, _arg2:Material, _arg3:Scene3D):void{
var _local4:IAttributes;
for each (_local4 in attributes) {
_local4.drawOnSprite(_arg1, _arg2, _arg3);
};
}
public function begin(_arg1:Scene3D):void{
var _local2:IAttributes;
for each (_local2 in attributes) {
_local2.begin(_arg1);
};
}
}
}//package sandy.materials.attributes
Section 113
//Appearance (sandy.materials.Appearance)
package sandy.materials {
import sandy.core.data.*;
public class Appearance {
private var m_oBackMaterial:Material;
private var m_oFrontMaterial:Material;
public function Appearance(_arg1:Material=null, _arg2:Material=null){
m_oFrontMaterial = ((_arg1)!=null) ? _arg1 : new ColorMaterial();
m_oBackMaterial = ((_arg2)!=null) ? _arg2 : m_oFrontMaterial;
}
public function set frontMaterial(_arg1:Material):void{
var _local2:Array;
var _local3:Polygon;
if (m_oFrontMaterial == _arg1){
return;
};
if (m_oFrontMaterial){
_local2 = m_oFrontMaterial.unlinkAll();
};
m_oFrontMaterial = _arg1;
if (m_oFrontMaterial == null){
return;
};
for each (_local3 in _local2) {
m_oFrontMaterial.init(_local3);
};
if (m_oBackMaterial == null){
m_oBackMaterial = _arg1;
};
}
public function get flags():uint{
var _local1:uint = m_oFrontMaterial.flags;
if (m_oFrontMaterial != m_oBackMaterial){
_local1 = (_local1 | m_oBackMaterial.flags);
};
return (_local1);
}
public function get modified():Boolean{
return (((m_oFrontMaterial.modified) || (m_oBackMaterial.modified)));
}
public function toString():String{
return ("sandy.materials.Appearance");
}
public function get backMaterial():Material{
return (m_oBackMaterial);
}
public function get lightingEnable():Boolean{
return (((m_oFrontMaterial.lightingEnable) || (m_oBackMaterial.lightingEnable)));
}
public function get frontMaterial():Material{
return (m_oFrontMaterial);
}
public function get useVertexNormal():Boolean{
return (Boolean(((m_oBackMaterial.useVertexNormal) && (m_oFrontMaterial.useVertexNormal))));
}
public function set backMaterial(_arg1:Material):void{
var _local2:Array;
var _local3:Polygon;
if (m_oBackMaterial == _arg1){
return;
};
if (m_oBackMaterial){
_local2 = m_oBackMaterial.unlinkAll();
};
m_oBackMaterial = _arg1;
if (m_oBackMaterial == null){
return;
};
for each (_local3 in _local2) {
m_oBackMaterial.init(_local3);
};
if (m_oFrontMaterial == null){
m_oFrontMaterial = _arg1;
};
}
public function set lightingEnable(_arg1:Boolean):void{
m_oFrontMaterial.lightingEnable = _arg1;
if (m_oFrontMaterial != m_oBackMaterial){
m_oBackMaterial.lightingEnable = _arg1;
};
}
public function dispose():void{
m_oFrontMaterial.dispose();
if (m_oFrontMaterial != m_oBackMaterial){
m_oBackMaterial.dispose();
};
m_oFrontMaterial = (m_oBackMaterial = null);
}
}
}//package sandy.materials
Section 114
//BitmapMaterial (sandy.materials.BitmapMaterial)
package sandy.materials {
import sandy.core.data.*;
import sandy.core.*;
import flash.display.*;
import sandy.materials.attributes.*;
import flash.geom.*;
import flash.utils.*;
import sandy.util.*;
public class BitmapMaterial extends Material implements IAlphaMaterial {
protected const m_oOffset:Point;
protected const m_oTiling:Point;
protected var m_oPolygonMatrixMap:Dictionary;
private var m_nWidth:Number;
var graphics:Graphics;
private var m_nInvWidth:Number;
private var m_nRecLevel:int;// = 0
private var m_nAlpha:Number;// = 1
public var forceUpdate:Boolean;// = false
private var m_oDrawMatrix:Matrix;
public var smooth:Boolean;// = false
var polygon:Polygon;
private var m_nInvHeight:Number;
private var m_oTextureClone:BitmapData;
protected var matrix:Matrix;
protected var m_oTexture:BitmapData;
private var m_oColorTransform:ColorTransform;
var map:Matrix;
public var maxRecurssionDepth:uint;// = 5
private var m_nHeight:Number;
protected var m_oPoint:Point;
public var precision:uint;// = 0
public function BitmapMaterial(_arg1:BitmapData=null, _arg2:MaterialAttributes=null, _arg3:uint=0){
m_oDrawMatrix = new Matrix();
m_oColorTransform = new ColorTransform();
map = new Matrix();
m_oPoint = new Point();
matrix = new Matrix();
m_oTiling = new Point(1, 1);
m_oOffset = new Point(0, 0);
super(_arg2);
m_oType = MaterialType.BITMAP;
texture = _arg1;
m_oPolygonMatrixMap = new Dictionary(true);
precision = _arg3;
}
override public function init(_arg1:Polygon):void{
var _local2:Matrix;
var _local3:Array;
if (_arg1.vertices.length >= 3){
_local2 = null;
if ((((m_nWidth > 0)) && ((m_nHeight > 0)))){
_local3 = _arg1.aUVCoord;
if (_local3){
_local2 = _createTextureMatrix(_local3[0].u, _local3[0].v, _local3[int(1)].u, _local3[int(1)].v, _local3[int(2)].u, _local3[int(2)].v);
};
};
m_oPolygonMatrixMap[_arg1.id] = _local2;
};
super.init(_arg1);
}
override public function unlink(_arg1:Polygon):void{
if (m_oPolygonMatrixMap){
if (m_oPolygonMatrixMap[_arg1.id]){
delete m_oPolygonMatrixMap[_arg1.id];
};
};
super.unlink(_arg1);
}
protected function renderRec(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number, _arg9:Number, _arg10:Number, _arg11:Number, _arg12:Number, _arg13:Number, _arg14:Number, _arg15:Number):void{
m_nRecLevel++;
var _local16:Number = (_arg1 + _arg1);
var _local17:Number = (_arg2 + _arg2);
var _local18:Number = (_arg3 + _arg3);
var _local19:Number = (_arg4 + _arg4);
var _local20:Number = (_arg5 + _arg5);
var _local21:Number = (_arg6 + _arg6);
var _local22:Number = (2 / (_arg9 + _arg12));
var _local23:Number = (2 / (_arg12 + _arg15));
var _local24:Number = (2 / (_arg15 + _arg9));
var _local25:Number = (((_arg7 * _arg9) + (_arg10 * _arg12)) * _local22);
var _local26:Number = (((_arg8 * _arg9) + (_arg11 * _arg12)) * _local22);
var _local27:Number = (((_arg10 * _arg12) + (_arg13 * _arg15)) * _local23);
var _local28:Number = (((_arg11 * _arg12) + (_arg14 * _arg15)) * _local23);
var _local29:Number = (((_arg13 * _arg15) + (_arg7 * _arg9)) * _local24);
var _local30:Number = (((_arg14 * _arg15) + (_arg8 * _arg9)) * _local24);
var _local31:Number = ((_arg7 + _arg10) - _local25);
var _local32:Number = ((_arg8 + _arg11) - _local26);
var _local33:Number = ((_arg10 + _arg13) - _local27);
var _local34:Number = ((_arg11 + _arg14) - _local28);
var _local35:Number = ((_arg13 + _arg7) - _local29);
var _local36:Number = ((_arg14 + _arg8) - _local30);
var _local37:Number = ((_local31 * _local31) + (_local32 * _local32));
var _local38:Number = ((_local33 * _local33) + (_local34 * _local34));
var _local39:Number = ((_local35 * _local35) + (_local36 * _local36));
var _local40:Number = (_local25 * 0.5);
var _local41:Number = (_local26 * 0.5);
var _local42:Number = ((_arg9 + _arg12) * 0.5);
var _local43:Number = (_local29 * 0.5);
var _local44:Number = (_local30 * 0.5);
var _local45:Number = ((_arg15 + _arg9) * 0.5);
var _local46:Number = (_local27 * 0.5);
var _local47:Number = (_local28 * 0.5);
var _local48:Number = ((_arg12 + _arg15) * 0.5);
if ((((m_nRecLevel > maxRecurssionDepth)) || ((((((_local37 <= precision)) && ((_local39 <= precision)))) && ((_local38 <= precision)))))){
renderTriangle(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg10, _arg11, _arg13, _arg14);
m_nRecLevel--;
return;
};
if ((((((_local37 > precision)) && ((_local39 > precision)))) && ((_local38 > precision)))){
renderRec(_local16, _local17, _local18, _local19, _local20, _local21, _arg7, _arg8, _arg9, _local40, _local41, _local42, _local43, _local44, _local45);
renderRec(_local16, _local17, _local18, _local19, (_local20 - 1), _local21, _local40, _local41, _local42, _arg10, _arg11, _arg12, _local46, _local47, _local48);
renderRec(_local16, _local17, _local18, _local19, _local20, (_local21 - 1), _local43, _local44, _local45, _local46, _local47, _local48, _arg13, _arg14, _arg15);
renderRec(-(_local16), -(_local17), -(_local18), -(_local19), (-(_local20) + 1), (-(_local21) + 1), _local46, _local47, _local48, _local43, _local44, _local45, _local40, _local41, _local42);
m_nRecLevel--;
return;
};
var _local49:Number = Math.max(_local37, Math.max(_local39, _local38));
if (_local37 == _local49){
renderRec(_local16, _arg2, _local18, _arg4, _local20, _arg6, _arg7, _arg8, _arg9, _local40, _local41, _local42, _arg13, _arg14, _arg15);
renderRec((_local16 + _arg2), _arg2, (_local18 + _arg4), _arg4, ((_local20 + _arg6) - 1), _arg6, _local40, _local41, _local42, _arg10, _arg11, _arg12, _arg13, _arg14, _arg15);
m_nRecLevel--;
return;
};
if (_local39 == _local49){
renderRec(_arg1, _local17, _arg3, _local19, _arg5, _local21, _arg7, _arg8, _arg9, _arg10, _arg11, _arg12, _local43, _local44, _local45);
renderRec(_arg1, (_local17 + _arg1), _arg3, (_local19 + _arg3), _arg5, ((_local21 + _arg5) - 1), _local43, _local44, _local45, _arg10, _arg11, _arg12, _arg13, _arg14, _arg15);
m_nRecLevel--;
return;
};
renderRec((_arg1 - _arg2), _local17, (_arg3 - _arg4), _local19, (_arg5 - _arg6), _local21, _arg7, _arg8, _arg9, _arg10, _arg11, _arg12, _local46, _local47, _local48);
renderRec(_local16, (_arg2 - _arg1), _local18, (_arg4 - _arg3), _local20, (_arg6 - _arg5), _arg7, _arg8, _arg9, _local46, _local47, _local48, _arg13, _arg14, _arg15);
m_nRecLevel--;
}
public function get texture():BitmapData{
return (m_oTexture);
}
override public function dispose():void{
super.dispose();
if (m_oTexture){
m_oTexture.dispose();
};
m_oTexture = null;
if (m_oTextureClone){
m_oTextureClone.dispose();
};
m_oTextureClone = null;
m_oPolygonMatrixMap = null;
}
public function set texture(_arg1:BitmapData):void{
var _local3:String;
var _local4:Dictionary;
var _local5:Polygon;
if (_arg1 == m_oTexture){
return;
};
if (m_oTexture){
m_oTexture.dispose();
};
var _local2:Boolean;
if (m_nHeight != _arg1.height){
_local2 = true;
} else {
if (m_nWidth != _arg1.width){
_local2 = true;
};
};
m_oTexture = _arg1;
m_nHeight = m_oTexture.height;
m_nWidth = m_oTexture.width;
m_nInvHeight = (1 / m_nHeight);
m_nInvWidth = (1 / m_nWidth);
if (_local2){
_local4 = new Dictionary(true);
for (_local3 in m_oPolygonMatrixMap) {
_local4[_local3] = m_oPolygonMatrixMap[_local3];
};
for (_local3 in _local4) {
_local5 = Polygon.POLYGON_MAP[_local3];
unlink(_local5);
init(_local5);
};
_local4 = null;
};
}
protected function renderTriangle(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number, _arg9:Number, _arg10:Number, _arg11:Number, _arg12:Number):void{
var _local13:Number = (_arg9 - _arg7);
var _local14:Number = (_arg10 - _arg8);
var _local15:Number = (_arg11 - _arg7);
var _local16:Number = (_arg12 - _arg8);
matrix.a = ((_arg1 * _local13) + (_arg2 * _local15));
matrix.b = ((_arg1 * _local14) + (_arg2 * _local16));
matrix.c = ((_arg3 * _local13) + (_arg4 * _local15));
matrix.d = ((_arg3 * _local14) + (_arg4 * _local16));
matrix.tx = (((_arg5 * _local13) + (_arg6 * _local15)) + _arg7);
matrix.ty = (((_arg5 * _local14) + (_arg6 * _local16)) + _arg8);
var _local17:Number = (((_arg7 * (_local16 - _local14)) - (_arg9 * _local16)) + (_arg11 * _local14));
if (_local17 < 0){
_local17 = -(_local17);
};
graphics.lineStyle();
graphics.beginBitmapFill(((m_nAlpha)==1) ? m_oTexture : m_oTextureClone, matrix, repeat, ((smooth) && ((_local17 > 100))));
graphics.moveTo(_arg7, _arg8);
graphics.lineTo(_arg9, _arg10);
graphics.lineTo(_arg11, _arg12);
graphics.endFill();
}
override public function renderPolygon(_arg1:Scene3D, _arg2:Polygon, _arg3:Sprite):void{
var _local4:Array;
var _local5:Array;
var _local6:Vertex;
var _local7:Vertex;
var _local8:Vertex;
var _local9:int;
var _local10:int;
if (m_oTexture == null){
return;
};
polygon = _arg2;
graphics = _arg3.graphics;
m_nRecLevel = 0;
if (((polygon.isClipped) || ((polygon.vertices.length > 3)))){
_local4 = (polygon.isClipped) ? _arg2.cvertices : _arg2.vertices;
_local5 = (polygon.isClipped) ? _arg2.caUVCoord : _arg2.aUVCoord;
_local10 = (_local4.length - 1);
_local9 = 1;
while (_local9 < _local10) {
map = _createTextureMatrix(_local5[0].u, _local5[0].v, _local5[int(_local9)].u, _local5[int(_local9)].v, _local5[int((_local9 + 1))].u, _local5[int((_local9 + 1))].v);
_local6 = _local4[0];
_local7 = _local4[int(_local9)];
_local8 = _local4[int((_local9 + 1))];
if (precision == 0){
renderTriangle(map.a, map.b, map.c, map.d, map.tx, map.ty, _local6.sx, _local6.sy, _local7.sx, _local7.sy, _local8.sx, _local8.sy);
} else {
renderRec(map.a, map.b, map.c, map.d, map.tx, map.ty, _local6.sx, _local6.sy, _local6.wz, _local7.sx, _local7.sy, _local7.wz, _local8.sx, _local8.sy, _local8.wz);
};
_local9++;
};
} else {
_local4 = _arg2.vertices;
_local5 = _arg2.aUVCoord;
map = (m_oPolygonMatrixMap[polygon.id] as Matrix);
_local6 = _local4[0];
_local7 = _local4[1];
_local8 = _local4[2];
if (precision == 0){
renderTriangle(map.a, map.b, map.c, map.d, map.tx, map.ty, _local6.sx, _local6.sy, _local7.sx, _local7.sy, _local8.sx, _local8.sy);
} else {
renderRec(map.a, map.b, map.c, map.d, map.tx, map.ty, _local6.sx, _local6.sy, _local6.wz, _local7.sx, _local7.sy, _local7.wz, _local8.sx, _local8.sy, _local8.wz);
};
};
super.renderPolygon(_arg1, _arg2, _arg3);
_local4 = null;
_local5 = null;
}
public function set alpha(_arg1:Number):void{
setTransparency(_arg1);
m_bModified = true;
}
public function setTransparency(_arg1:Number):void{
if (m_oTexture == null){
throw (new Error("Setting transparency requires setting texture first."));
};
_arg1 = NumberUtil.constrain(_arg1, 0, 1);
m_nAlpha = _arg1;
if (_arg1 == 1){
return;
};
if (m_oTextureClone != null){
if (((!((m_oTextureClone.height == m_oTexture.height))) || (!((m_oTextureClone.width == m_oTexture.width))))){
m_oTextureClone.dispose();
m_oTextureClone = null;
};
};
if (m_oTextureClone == null){
m_oTextureClone = new BitmapData(m_oTexture.width, m_oTexture.height, true, 0);
};
m_oColorTransform.alphaMultiplier = _arg1;
m_oTextureClone.lock();
m_oTextureClone.fillRect(m_oTextureClone.rect, 0);
m_oTextureClone.draw(m_oTexture, m_oDrawMatrix, m_oColorTransform);
m_oTextureClone.unlock();
}
protected function _createTextureMatrix(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):Matrix{
var _local7:Number = (((_arg1 * m_oTiling.x) + m_oOffset.x) * m_nWidth);
var _local8:Number = (((_arg2 * m_oTiling.y) + m_oOffset.y) * m_nHeight);
var _local9:Number = (((_arg3 * m_oTiling.x) + m_oOffset.x) * m_nWidth);
var _local10:Number = (((_arg4 * m_oTiling.y) + m_oOffset.y) * m_nHeight);
var _local11:Number = (((_arg5 * m_oTiling.x) + m_oOffset.x) * m_nWidth);
var _local12:Number = (((_arg6 * m_oTiling.y) + m_oOffset.y) * m_nHeight);
if ((((((_local7 == _local9)) && ((_local8 == _local10)))) || ((((_local7 == _local11)) && ((_local8 == _local12)))))){
_local7 = (_local7 - ((_local7)>0.05) ? 0.05 : -0.05);
_local8 = (_local8 - ((_local8)>0.07) ? 0.07 : -0.07);
};
if ((((_local11 == _local9)) && ((_local12 == _local10)))){
_local11 = (_local11 - ((_local11)>0.05) ? 0.04 : -0.04);
_local12 = (_local12 - ((_local12)>0.06) ? 0.06 : -0.06);
};
var _local13:Matrix = new Matrix((_local9 - _local7), (_local10 - _local8), (_local11 - _local7), (_local12 - _local8), _local7, _local8);
_local13.invert();
return (_local13);
}
public function get alpha():Number{
return (m_nAlpha);
}
public function toString():String{
return ((this.id + "::sandy.materials.BitmapMaterial"));
}
public function setTiling(_arg1:Number, _arg2:Number, _arg3:Number=0, _arg4:Number=0):void{
var _local5:String;
var _local7:Polygon;
m_oTiling.x = _arg1;
m_oTiling.y = _arg2;
m_oOffset.x = (_arg3 - Math.floor(_arg3));
m_oOffset.y = (_arg4 - Math.floor(_arg4));
m_bModified = true;
var _local6:Dictionary = new Dictionary(true);
for (_local5 in m_oPolygonMatrixMap) {
_local6[_local5] = m_oPolygonMatrixMap[_local5];
};
for (_local5 in _local6) {
_local7 = Polygon.POLYGON_MAP[_local5];
unlink(_local7);
init(_local7);
};
_local6 = null;
}
}
}//package sandy.materials
Section 115
//ColorMaterial (sandy.materials.ColorMaterial)
package sandy.materials {
import sandy.core.data.*;
import sandy.core.*;
import flash.display.*;
import sandy.materials.attributes.*;
public final class ColorMaterial extends Material implements IAlphaMaterial {
private var m_nAlpha:Number;
private var m_nColor:Number;
public function ColorMaterial(_arg1:uint=0, _arg2:Number=1, _arg3:MaterialAttributes=null){
super(_arg3);
m_oType = MaterialType.COLOR;
m_nColor = _arg1;
m_nAlpha = _arg2;
}
public function get color():Number{
return (m_nColor);
}
override public function renderPolygon(_arg1:Scene3D, _arg2:Polygon, _arg3:Sprite):void{
var _local5:Vertex;
var _local4:Array = (_arg2.isClipped) ? _arg2.cvertices : _arg2.vertices;
if (!_local4.length){
return;
};
var _local6:int = _local4.length;
var _local7:Graphics = _arg3.graphics;
_local7.lineStyle();
_local7.beginFill(m_nColor, m_nAlpha);
_local7.moveTo(_local4[0].sx, _local4[0].sy);
while ((_local5 = _local4[--_local6])) {
_local7.lineTo(_local5.sx, _local5.sy);
};
_local7.endFill();
super.renderPolygon(_arg1, _arg2, _arg3);
}
public function set color(_arg1:Number):void{
m_nColor = _arg1;
m_bModified = true;
}
public function set alpha(_arg1:Number):void{
m_nAlpha = _arg1;
m_bModified = true;
}
public function get alpha():Number{
return (m_nAlpha);
}
}
}//package sandy.materials
Section 116
//IAlphaMaterial (sandy.materials.IAlphaMaterial)
package sandy.materials {
public interface IAlphaMaterial {
function set alpha(_arg1:Number):void;
function get alpha():Number;
}
}//package sandy.materials
Section 117
//Material (sandy.materials.Material)
package sandy.materials {
import sandy.core.scenegraph.*;
import sandy.core.data.*;
import sandy.core.*;
import flash.display.*;
import sandy.materials.attributes.*;
import flash.utils.*;
public class Material {
private var _id:Number;
protected var m_nFlags:uint;// = 0
public var useVertexNormal:Boolean;// = false
public var attributes:MaterialAttributes;
public var repeat:Boolean;// = true
public var autoDipose:Boolean;// = true
protected var m_nRefCounting:int;
public var lightingEnable:Boolean;// = false
protected var _useLight:Boolean;// = false
protected var m_oType:MaterialType;
protected var m_bModified:Boolean;
private var _filters:Array;
protected var m_oPolygonMap:Dictionary;
private static var _ID_:Number = 0;
public function Material(_arg1:MaterialAttributes=null){
_filters = [];
_useLight = false;
_id = _ID_++;
attributes = ((_arg1)==null) ? new MaterialAttributes() : _arg1;
m_bModified = true;
m_oType = MaterialType.NONE;
m_nRefCounting = 0;
m_oPolygonMap = new Dictionary(true);
}
public function get filters():Array{
return (_filters);
}
public function renderPolygon(_arg1:Scene3D, _arg2:Polygon, _arg3:Sprite):void{
if (attributes){
attributes.draw(_arg3.graphics, _arg2, this, _arg1);
};
if (_filters.length > 0){
_arg3.filters = _filters;
};
}
public function get flags():uint{
var _local1:uint = m_nFlags;
if (attributes){
_local1 = (_local1 | attributes.flags);
};
return (_local1);
}
public function get modified():Boolean{
return (m_bModified);
}
public function unlinkAll():Array{
var _local2:Appearance;
var _local3:Polygon;
var _local4:String;
var _local1:Array = [];
for (_local4 in m_oPolygonMap) {
_local3 = Polygon(Polygon.POLYGON_MAP[_local4]);
_local2 = _local3.appearance;
if ((((_local2.frontMaterial == this)) || ((_local2.backMaterial == this)))){
unlink(_local3);
_local1.push(_local3);
};
};
return (_local1);
}
public function init(_arg1:Polygon):void{
if (!m_oPolygonMap[_arg1.id]){
m_oPolygonMap[_arg1.id] = 1;
m_nRefCounting++;
if (attributes){
attributes.init(_arg1);
};
} else {
var _local2 = m_oPolygonMap;
var _local3 = _arg1.id;
var _local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
};
}
public function unlink(_arg1:Polygon):void{
if (m_oPolygonMap[_arg1.id]){
var _local2 = m_oPolygonMap;
var _local3 = _arg1.id;
var _local4 = (_local2[_local3] - 1);
_local2[_local3] = _local4;
if (m_oPolygonMap[_arg1.id] == 0){
delete m_oPolygonMap[_arg1.id];
m_nRefCounting--;
if (attributes){
attributes.unlink(_arg1);
};
};
};
if (((autoDipose) && ((m_nRefCounting <= 0)))){
dispose();
};
}
public function finish(_arg1:Scene3D):void{
if (attributes){
attributes.finish(_arg1);
};
m_bModified = false;
}
public function get id():Number{
return (_id);
}
public function dispose():void{
var _local1:Appearance;
var _local2:Polygon;
var _local3:String;
for (_local3 in m_oPolygonMap) {
_local2 = Polygon(Polygon.POLYGON_MAP[_local3]);
unlink(_local2);
_local1 = _local2.appearance;
if (_local1.frontMaterial == this){
_local1.frontMaterial = null;
} else {
if (_local1.backMaterial == this){
_local1.backMaterial = null;
};
};
delete m_oPolygonMap[_local3];
};
attributes = null;
_filters = null;
}
public function begin(_arg1:Scene3D):void{
if (attributes){
attributes.begin(_arg1);
};
}
public function set filters(_arg1:Array):void{
if (_arg1 != _filters){
_filters = _arg1;
m_bModified = true;
};
}
public function get type():MaterialType{
return (m_oType);
}
public function renderSprite(_arg1:Sprite2D, _arg2:Material, _arg3:Scene3D):void{
if (attributes){
attributes.drawOnSprite(_arg1, _arg2, _arg3);
};
if (_filters.length > 0){
_arg1.content.filters = _filters;
};
}
}
}//package sandy.materials
Section 118
//MaterialType (sandy.materials.MaterialType)
package sandy.materials {
public class MaterialType {
private var m_sType:String;
public static const COLOR:MaterialType = new MaterialType("color");
;
public static const WIREFRAME:MaterialType = new MaterialType("wireframe");
;
public static const OUTLINE:MaterialType = new MaterialType("outline");
;
public static const BITMAP:MaterialType = new MaterialType("bitmap");
;
public static const NONE:MaterialType = new MaterialType("default");
;
public static const VIDEO:MaterialType = new MaterialType("video");
;
public static const MOVIE:MaterialType = new MaterialType("movie");
;
public function MaterialType(_arg1:String){
m_sType = _arg1;
}
public function typeString():String{
return (m_sType);
}
}
}//package sandy.materials
Section 119
//MovieMaterial (sandy.materials.MovieMaterial)
package sandy.materials {
import sandy.core.data.*;
import sandy.core.*;
import flash.events.*;
import flash.display.*;
import sandy.materials.attributes.*;
import flash.geom.*;
import flash.utils.*;
import sandy.util.*;
import sandy.math.*;
public class MovieMaterial extends BitmapMaterial {
private var m_oAlpha:ColorTransform;
private var m_oTimer:Timer;
private var m_oMovie:Sprite;
private var m_bUpdate:Boolean;
public static const DEFAULT_FILL_COLOR:uint = 0;
public function MovieMaterial(_arg1:Sprite, _arg2:uint=40, _arg3:MaterialAttributes=null, _arg4:Boolean=false, _arg5:Number=0, _arg6:Number=0){
var _local7:Number;
var _local8:Number;
var _local9:BitmapData;
var _local10:Rectangle;
m_oAlpha = new ColorTransform();
if (_arg4){
_local9 = new BitmapData(_arg1.width, _arg1.height, true, 0);
_local9.draw(_arg1);
_local10 = _local9.getColorBoundsRect(4278190080, 0, false);
_local7 = _local10.width;
_local8 = _local10.height;
} else {
_local7 = (_arg6) ? _arg6 : _arg1.width;
_local8 = (_arg5) ? _arg5 : _arg1.height;
};
super(new BitmapData(_local7, _local8, true, DEFAULT_FILL_COLOR), _arg3);
m_oMovie = _arg1;
m_oType = MaterialType.MOVIE;
m_bUpdate = true;
m_oTimer = new Timer(_arg2);
m_oTimer.addEventListener(TimerEvent.TIMER, update);
m_oTimer.start();
if (_local9){
_local9.dispose();
_local9 = null;
};
_local10 = null;
_local7 = undefined;
_local8 = undefined;
}
override public function renderPolygon(_arg1:Scene3D, _arg2:Polygon, _arg3:Sprite):void{
m_bUpdate = true;
super.renderPolygon(_arg1, _arg2, _arg3);
}
override public function setTransparency(_arg1:Number):void{
m_oAlpha.alphaMultiplier = NumberUtil.constrain(_arg1, 0, 1);
}
public function stop():void{
m_oTimer.stop();
}
public function start():void{
m_oTimer.start();
}
public function get movie():Sprite{
return (m_oMovie);
}
public function update(_arg1:Event=null):void{
if (((m_bUpdate) || (forceUpdate))){
m_oTexture.fillRect(m_oTexture.rect, ColorMath.applyAlpha(DEFAULT_FILL_COLOR, m_oAlpha.alphaMultiplier));
m_oTexture.draw(m_oMovie, null, m_oAlpha, null, null, smooth);
m_bModified = true;
};
m_bUpdate = false;
}
override public function dispose():void{
super.dispose();
stop();
m_oTimer = null;
m_oMovie = null;
}
}
}//package sandy.materials
Section 120
//WireFrameMaterial (sandy.materials.WireFrameMaterial)
package sandy.materials {
import sandy.core.data.*;
import sandy.core.*;
import flash.display.*;
import sandy.materials.attributes.*;
public final class WireFrameMaterial extends Material {
public function WireFrameMaterial(_arg1:uint=1, _arg2:uint=0, _arg3:Number=1, _arg4:MaterialAttributes=null){
super(_arg4);
m_oType = MaterialType.WIREFRAME;
attributes.attributes.push(new LineAttributes(_arg1, _arg2, _arg3));
}
override public function renderPolygon(_arg1:Scene3D, _arg2:Polygon, _arg3:Sprite):void{
attributes.draw(_arg3.graphics, _arg2, this, _arg1);
}
}
}//package sandy.materials
Section 121
//ColorMath (sandy.math.ColorMath)
package sandy.math {
public class ColorMath {
public static function applyAlpha(_arg1:uint, _arg2:Number):uint{
var _local3:uint = (_arg1 / 16777216);
return (((_arg1 & 0xFFFFFF) + (Math.floor((_arg2 * _local3)) * 16777216)));
}
public static function calculateLitColour(_arg1:Number, _arg2:Number):Number{
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local3:Number = ((_arg1 >> 16) & 0xFF);
var _local4:Number = ((_arg1 >> 8) & 0xFF);
var _local5:Number = (_arg1 & 0xFF);
_local3 = (_local3 * 0.00390625);
_local4 = (_local4 * 0.00390625);
_local5 = (_local5 * 0.00390625);
var _local14:Number = 0;
var _local15:Array = [_local3, _local4, _local5];
_local15.sort();
_local6 = _local15[0];
_local7 = _local15[1];
_local8 = _local15[2];
var _local16:Number = (_local8 - _local6);
_local10 = ((_local6 + _local8) * 0.5);
if (_local10 == 0){
_local11 = 1;
} else {
_local9 = (_local16 * 0.5);
if (_local10 < 0.5){
_local11 = (_local9 / _local10);
} else {
_local11 = (_local9 / (1 - _local10));
};
if (_local16 != 0){
while (true) {
if (_local3 == _local8){
if (_local5 == _local6){
_local14 = 0;
} else {
_local14 = 5;
};
break;
};
if (_local4 == _local8){
if (_local5 == _local6){
_local14 = 1;
} else {
_local14 = 2;
};
break;
};
if (_local3 == _local6){
_local14 = 3;
} else {
_local14 = 4;
};
break;
};
if ((_local14 % 2) == 0){
_local13 = (_local7 - _local6);
} else {
_local13 = (_local8 - _local7);
};
_local13 = (_local13 / _local16);
_local12 = (60 * (_local14 + _local13));
};
};
if (_arg2 < 0.5){
_local9 = (_local11 * _arg2);
} else {
_local9 = (_local11 * (1 - _arg2));
};
_local6 = (_arg2 - _local9);
_local8 = (_arg2 + _local9);
_local14 = Math.floor((_local12 / 60));
_local13 = (((_local12 - (_local14 * 60)) * _local9) / 30);
_local14 = (_local14 % 6);
var _local17:Number = (_local6 + _local13);
var _local18:Number = (_local8 - _local13);
switch (_local14){
case 0:
_local3 = _local8;
_local4 = _local17;
_local5 = _local6;
break;
case 1:
_local3 = _local18;
_local4 = _local8;
_local5 = _local6;
break;
case 2:
_local3 = _local6;
_local4 = _local8;
_local5 = _local17;
break;
case 3:
_local3 = _local6;
_local4 = _local18;
_local5 = _local8;
break;
case 4:
_local3 = _local17;
_local4 = _local6;
_local5 = _local8;
break;
case 5:
_local3 = _local8;
_local4 = _local6;
_local5 = _local18;
break;
};
return (((((_local3 * 0x0100) << 16) | ((_local4 * 0x0100) << 8)) | (_local5 * 0x0100)));
}
public static function hex2rgb(_arg1:Number):Object{
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local2 = ((0xFF0000 & _arg1) >> 16);
_local3 = ((0xFF00 & _arg1) >> 8);
_local4 = (0xFF & _arg1);
return ({r:_local2, g:_local3, b:_local4});
}
public static function rgb2hex(_arg1:Number, _arg2:Number, _arg3:Number):Number{
return ((((_arg1 << 16) | (_arg2 << 8)) | _arg3));
}
public static function hex2rgbn(_arg1:Number):Object{
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local2 = ((0xFF0000 & _arg1) >> 16);
_local3 = ((0xFF00 & _arg1) >> 8);
_local4 = (0xFF & _arg1);
return ({r:(_local2 / 0xFF), g:(_local3 / 0xFF), b:(_local4 / 0xFF)});
}
}
}//package sandy.math
Section 122
//FastMath (sandy.math.FastMath)
package sandy.math {
public class FastMath {
public static const PRECISION_DIV_2PI:Number = 20860.7567009409;
public static const HALF_PI:Number = 1.5707963267949;
public static const TWO_PI:Number = 6.28318530717959;
public static const PRECISION_S:int = 131071;
public static const initialized:Boolean = initialize();
public static const PRECISION:int = 131072;
private static var RAD_SLICE:Number = 4.79368996214263E-5;
private static var tanTable:Array = new Array(PRECISION);
private static var sinTable:Array = new Array(PRECISION);
public static function tan(_arg1:Number):Number{
return (tanTable[int(radToIndex(_arg1))]);
}
public static function sin(_arg1:Number):Number{
return (sinTable[int(radToIndex(_arg1))]);
}
private static function radToIndex(_arg1:Number):int{
return (int(((_arg1 * PRECISION_DIV_2PI) & PRECISION_S)));
}
public static function cos(_arg1:Number):Number{
return (sinTable[int(radToIndex((HALF_PI - _arg1)))]);
}
private static function initialize():Boolean{
var _local1:Number = 0;
var _local2:int;
while (_local2 < PRECISION) {
_local1 = Number((_local2 * RAD_SLICE));
sinTable[_local2] = Number(Math.sin(_local1));
tanTable[_local2] = Number(Math.tan(_local1));
_local2++;
};
return (true);
}
}
}//package sandy.math
Section 123
//IntersectionMath (sandy.math.IntersectionMath)
package sandy.math {
import sandy.core.data.*;
import sandy.bounds.*;
import flash.geom.*;
import sandy.util.*;
public final class IntersectionMath {
public static function isPointInTriangle2D(_arg1:Point, _arg2:Point, _arg3:Point, _arg4:Point):Boolean{
var _local5:Number = (1 / (((_arg2.y - _arg4.y) * (_arg3.x - _arg4.x)) + ((_arg3.y - _arg4.y) * (_arg4.x - _arg2.x))));
var _local6:Number = (_local5 * (((_arg1.y - _arg4.y) * (_arg3.x - _arg4.x)) + ((_arg3.y - _arg4.y) * (_arg4.x - _arg1.x))));
var _local7:Number = (_local5 * (((_arg1.y - _arg2.y) * (_arg4.x - _arg2.x)) + ((_arg4.y - _arg2.y) * (_arg2.x - _arg1.x))));
var _local8:Number = (_local5 * (((_arg1.y - _arg3.y) * (_arg2.x - _arg3.x)) + ((_arg2.y - _arg3.y) * (_arg3.x - _arg1.x))));
return ((((((_local6 > 0)) && ((_local7 > 0)))) && ((_local8 > 0))));
}
public static function intersectionLine3D(_arg1:Point3D, _arg2:Point3D, _arg3:Point3D, _arg4:Point3D):Array{
var _local5:Array = [new Point3D((0.5 * (_arg1.x + _arg2.x)), (0.5 * (_arg1.y + _arg2.y)), (0.5 * (_arg1.z + _arg2.z))), new Point3D((0.5 * (_arg3.x + _arg4.x)), (0.5 * (_arg3.y + _arg4.y)), (0.5 * (_arg3.z + _arg4.z)))];
var _local6:Number = (_arg1.x - _arg3.x);
var _local7:Number = (_arg1.y - _arg3.y);
var _local8:Number = (_arg1.z - _arg3.z);
var _local9:Number = (_arg4.x - _arg3.x);
var _local10:Number = (_arg4.y - _arg3.y);
var _local11:Number = (_arg4.z - _arg3.z);
if (((((NumberUtil.isZero(_local9)) && (NumberUtil.isZero(_local10)))) && (NumberUtil.isZero(_local11)))){
return (_local5);
};
var _local12:Number = (_arg2.x - _arg1.x);
var _local13:Number = (_arg2.y - _arg1.y);
var _local14:Number = (_arg2.z - _arg1.z);
if (((((NumberUtil.isZero(_local12)) && (NumberUtil.isZero(_local13)))) && (NumberUtil.isZero(_local14)))){
return (_local5);
};
var _local15:Number = (((_local6 * _local9) + (_local7 * _local10)) + (_local8 * _local11));
var _local16:Number = (((_local9 * _local12) + (_local10 * _local13)) + (_local11 * _local14));
var _local17:Number = (((_local6 * _local12) + (_local7 * _local13)) + (_local8 * _local14));
var _local18:Number = (((_local9 * _local9) + (_local10 * _local10)) + (_local11 * _local11));
var _local19:Number = (((_local12 * _local12) + (_local13 * _local13)) + (_local14 * _local14));
var _local20:Number = ((_local19 * _local18) - (_local16 * _local16));
if (NumberUtil.isZero(_local20)){
return (_local5);
};
var _local21:Number = (((_local15 * _local16) - (_local17 * _local18)) / _local20);
var _local22:Number = ((_local15 + (_local16 * _local21)) / _local18);
return ([new Point3D((_arg1.x + (_local21 * _local12)), (_arg1.y + (_local21 * _local13)), (_arg1.z + (_local21 * _local14))), new Point3D((_arg3.x + (_local22 * _local9)), (_arg3.y + (_local22 * _local10)), (_arg3.z + (_local22 * _local11)))]);
}
public static function intersectionBSphere(_arg1:BSphere, _arg2:BSphere):Boolean{
var _local3:Point3D = _arg1.position.clone();
_local3.sub(_arg2.position);
var _local4:Number = (_arg1.radius + _arg2.radius);
var _local5:Number = _local3.getNorm();
return ((_local5 <= _local4));
}
public static function intersectionLine2D(_arg1:Point, _arg2:Point, _arg3:Point, _arg4:Point):Point{
var _local5:Number = _arg1.x;
var _local6:Number = _arg1.y;
var _local7:Number = _arg2.x;
var _local8:Number = _arg2.y;
var _local9:Number = _arg3.x;
var _local10:Number = _arg3.y;
var _local11:Number = _arg4.x;
var _local12:Number = _arg4.y;
var _local13:Number = (((_local12 - _local10) * (_local7 - _local5)) - ((_local11 - _local9) * (_local8 - _local6)));
if (_local13 == 0){
return (null);
};
var _local14:Number = (((_local11 - _local9) * (_local6 - _local10)) - ((_local12 - _local10) * (_local5 - _local9)));
_local14 = (_local14 / _local13);
return (new Point((_local5 + (_local14 * (_local7 - _local5))), (_local6 + (_local14 * (_local8 - _local6)))));
}
}
}//package sandy.math
Section 124
//PlaneMath (sandy.math.PlaneMath)
package sandy.math {
import sandy.core.data.*;
public class PlaneMath {
public static const NEGATIVE:int = -1;
public static const POSITIVE:int = 1;
public static const ON_PLANE:int = 0;
public static function distanceToPoint(_arg1:Plane, _arg2:Point3D):Number{
return (((((_arg1.a * _arg2.x) + (_arg1.b * _arg2.y)) + (_arg1.c * _arg2.z)) + _arg1.d));
}
public static function classifyPoint(_arg1:Plane, _arg2:Point3D):Number{
var _local3:Number;
_local3 = PlaneMath.distanceToPoint(_arg1, _arg2);
if (_local3 < 0){
return (PlaneMath.NEGATIVE);
};
if (_local3 > 0){
return (PlaneMath.POSITIVE);
};
return (PlaneMath.ON_PLANE);
}
public static function computePlaneFromPoints(_arg1:Point3D, _arg2:Point3D, _arg3:Point3D):Plane{
var _local4:Point3D = Point3DMath.cross(Point3DMath.sub(_arg1, _arg2), Point3DMath.sub(_arg1, _arg3));
Point3DMath.normalize(_local4);
var _local5:Number = Point3DMath.dot(_arg1, _local4);
return (new Plane(_local4.x, _local4.y, _local4.z, _local5));
}
public static function createFromNormalAndPoint(_arg1:Point3D, _arg2:Number):Plane{
var _local3:Plane = new Plane();
Point3DMath.normalize(_arg1);
_local3.a = _arg1.x;
_local3.b = _arg1.y;
_local3.c = _arg1.z;
_local3.d = _arg2;
PlaneMath.normalizePlane(_local3);
return (_local3);
}
public static function normalizePlane(_arg1:Plane):void{
var _local2:Number;
_local2 = Math.sqrt((((_arg1.a * _arg1.a) + (_arg1.b * _arg1.b)) + (_arg1.c * _arg1.c)));
_arg1.a = (_arg1.a / _local2);
_arg1.b = (_arg1.b / _local2);
_arg1.c = (_arg1.c / _local2);
_arg1.d = (_arg1.d / _local2);
}
}
}//package sandy.math
Section 125
//Point3DMath (sandy.math.Point3DMath)
package sandy.math {
import sandy.core.data.*;
public class Point3DMath {
public static function addPoint3D(_arg1:Point3D, _arg2:Point3D):Point3D{
return (new Point3D((_arg1.x + _arg2.x), (_arg1.y + _arg2.y), (_arg1.z + _arg2.z)));
}
public static function dot(_arg1:Point3D, _arg2:Point3D):Number{
return ((((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y)) + (_arg2.z * _arg1.z)));
}
public static function negate(_arg1:Point3D):Point3D{
return (new Point3D(-(_arg1.x), -(_arg1.y), -(_arg1.z)));
}
public static function clone(_arg1:Point3D):Point3D{
return (new Point3D(_arg1.x, _arg1.y, _arg1.z));
}
public static function sub(_arg1:Point3D, _arg2:Point3D):Point3D{
return (new Point3D((_arg1.x - _arg2.x), (_arg1.y - _arg2.y), (_arg1.z - _arg2.z)));
}
public static function scale(_arg1:Point3D, _arg2:Number):Point3D{
return (new Point3D((_arg1.x * _arg2), (_arg1.y * _arg2), (_arg1.z * _arg2)));
}
public static function normalize(_arg1:Point3D):Boolean{
var _local2:Number = Point3DMath.getNorm(_arg1);
if ((((_local2 == 0)) || ((_local2 == 1)))){
return (false);
};
_arg1.x = (_arg1.x / _local2);
_arg1.y = (_arg1.y / _local2);
_arg1.z = (_arg1.z / _local2);
return (true);
}
public static function cross(_arg1:Point3D, _arg2:Point3D):Point3D{
return (new Point3D(((_arg1.y * _arg2.z) - (_arg1.z * _arg2.y)), ((_arg1.z * _arg2.x) - (_arg1.x * _arg2.z)), ((_arg1.x * _arg2.y) - (_arg1.y * _arg2.x))));
}
public static function sphrand(_arg1:Number, _arg2:Number):Point3D{
var _local3:Point3D = new Point3D((Math.random() - 0.5), (Math.random() - 0.5), (Math.random() - 0.5));
_local3.normalize();
var _local4:Number = Math.random();
_local4 = (((_arg2 - _arg1) * _local4) + _arg1);
_local3.scale(_local4);
return (_local3);
}
public static function getNorm(_arg1:Point3D):Number{
return (Math.sqrt((((_arg1.x * _arg1.x) + (_arg1.y * _arg1.y)) + (_arg1.z * _arg1.z))));
}
public static function pow(_arg1:Point3D, _arg2:Number):Point3D{
return (new Point3D(Math.pow(_arg1.x, _arg2), Math.pow(_arg1.y, _arg2), Math.pow(_arg1.z, _arg2)));
}
public static function getAngle(_arg1:Point3D, _arg2:Point3D):Number{
var _local3:Number = (Point3DMath.dot(_arg1, _arg2) / (Point3DMath.getNorm(_arg1) * Point3DMath.getNorm(_arg2)));
var _local4:Number = (1 - (_local3 * _local3));
if (_local4 < 0){
trace((" wrong " + _local3));
_local4 = 0;
};
return (Math.atan2(Math.sqrt(_local4), _local3));
}
}
}//package sandy.math
Section 126
//Plane3D (sandy.primitive.Plane3D)
package sandy.primitive {
import sandy.core.scenegraph.*;
public class Plane3D extends Shape3D implements Primitive3D {
private var _mode:String;
private var _h:Number;
private var _qV:uint;
private var _qH:uint;
private var _lg:Number;
private var m_sType:String;
public static const ZX_ALIGNED:String = "zx_aligned";
public static const YZ_ALIGNED:String = "yz_aligned";
public static const XY_ALIGNED:String = "xy_aligned";
public function Plane3D(_arg1:String=null, _arg2:Number=100, _arg3:Number=100, _arg4:uint=1, _arg5:uint=1, _arg6:String="xy_aligned", _arg7:String=null){
super(_arg1);
setConvexFlag(true);
_h = _arg2;
_lg = _arg3;
_qV = _arg5;
_qH = _arg4;
_mode = (((!((_arg7 == PrimitiveMode.TRI))) && (!((_arg7 == PrimitiveMode.QUAD))))) ? PrimitiveMode.TRI : _arg7;
m_sType = _arg6;
geometry = generate();
}
override public function toString():String{
return ("sandy.primitive.Plane3D");
}
public function generate(... _args):Geometry3D{
var _local3:uint;
var _local4:uint;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local2:Geometry3D = new Geometry3D();
var _local5:Number = (_h / 2);
var _local6:Number = (_lg / 2);
var _local7:Number = (_h / _qV);
var _local8:Number = (_lg / _qH);
_local3 = 0;
_local9 = -(_local5);
_local11 = 0;
while (_local3 <= _qV) {
_local4 = 0;
_local10 = -(_local6);
_local12 = 0;
while (_local4 <= _qH) {
if (m_sType == Plane3D.ZX_ALIGNED){
_local2.setVertex(_local2.getNextVertexID(), _local10, 0, _local9);
} else {
if (m_sType == Plane3D.YZ_ALIGNED){
_local2.setVertex(_local2.getNextVertexID(), 0, _local10, _local9);
} else {
_local2.setVertex(_local2.getNextVertexID(), _local10, _local9, 0);
};
};
_local2.setUVCoords(_local2.getNextUVCoordID(), (_local12 / _lg), (1 - (_local11 / _h)));
_local10 = (_local10 + _local8);
_local12 = (_local12 + _local8);
_local4++;
};
_local9 = (_local9 + _local7);
_local11 = (_local11 + _local7);
_local3++;
};
_local3 = 0;
while (_local3 < _qV) {
_local4 = 0;
while (_local4 < _qH) {
if (_mode == PrimitiveMode.TRI){
_local2.setFaceVertexIds(_local2.getNextFaceID(), ((_local3 * (_qH + 1)) + _local4), (((_local3 * (_qH + 1)) + _local4) + 1), (((_local3 + 1) * (_qH + 1)) + _local4));
_local2.setFaceUVCoordsIds(_local2.getNextFaceUVCoordID(), ((_local3 * (_qH + 1)) + _local4), (((_local3 * (_qH + 1)) + _local4) + 1), (((_local3 + 1) * (_qH + 1)) + _local4));
_local2.setFaceVertexIds(_local2.getNextFaceID(), (((_local3 * (_qH + 1)) + _local4) + 1), ((((_local3 + 1) * (_qH + 1)) + _local4) + 1), (((_local3 + 1) * (_qH + 1)) + _local4));
_local2.setFaceUVCoordsIds(_local2.getNextFaceUVCoordID(), (((_local3 * (_qH + 1)) + _local4) + 1), ((((_local3 + 1) * (_qH + 1)) + _local4) + 1), (((_local3 + 1) * (_qH + 1)) + _local4));
} else {
if (_mode == PrimitiveMode.QUAD){
_local2.setFaceVertexIds(_local2.getNextFaceID(), ((_local3 * (_qH + 1)) + _local4), (((_local3 * (_qH + 1)) + _local4) + 1), ((((_local3 + 1) * (_qH + 1)) + _local4) + 1), (((_local3 + 1) * (_qH + 1)) + _local4));
_local2.setFaceUVCoordsIds(_local2.getNextFaceUVCoordID(), ((_local3 * (_qH + 1)) + _local4), (((_local3 * (_qH + 1)) + _local4) + 1), ((((_local3 + 1) * (_qH + 1)) + _local4) + 1), (((_local3 + 1) * (_qH + 1)) + _local4));
};
};
_local4++;
};
_local3++;
};
return (_local2);
}
}
}//package sandy.primitive
Section 127
//Primitive3D (sandy.primitive.Primitive3D)
package sandy.primitive {
import sandy.core.scenegraph.*;
public interface Primitive3D {
function generate(... _args):Geometry3D;
}
}//package sandy.primitive
Section 128
//PrimitiveMode (sandy.primitive.PrimitiveMode)
package sandy.primitive {
public final class PrimitiveMode {
public static const TRI:String = "tri";
public static const QUAD:String = "quad";
}
}//package sandy.primitive
Section 129
//NumberUtil (sandy.util.NumberUtil)
package sandy.util {
public class NumberUtil {
private static var __TO_RADIAN:Number = 0.0174532925199433;
private static var _fABS:Function = Math.abs;
private static var __TWO_PI:Number = 6.28318530717959;
private static var __PI:Number = 3.14159265358979;
private static var __TO_DREGREE:Number = 57.2957795130823;
private static var __HALF_PI:Number = 1.5707963267949;
public static var TOL:Number = 1E-5;
public static function areEqual(_arg1:Number, _arg2:Number):Boolean{
return ((_fABS((_arg1 - _arg2)) < TOL));
}
public static function get TO_DEGREE():Number{
return (__TO_DREGREE);
}
public static function get HALF_PI():Number{
return (__HALF_PI);
}
public static function toDegree(_arg1:Number):Number{
return ((_arg1 * TO_DEGREE));
}
public static function roundTo(_arg1:Number, _arg2:Number=0):Number{
if (_arg2 == 0){
_arg2 = 1;
};
return ((Math.round((_arg1 / _arg2)) * _arg2));
}
public static function get TWO_PI():Number{
return (__TWO_PI);
}
public static function isZero(_arg1:Number):Boolean{
return ((_fABS(_arg1) < TOL));
}
public static function get TO_RADIAN():Number{
return (__TO_RADIAN);
}
public static function constrain(_arg1:Number, _arg2:Number, _arg3:Number):Number{
return (Math.max(Math.min(_arg1, _arg3), _arg2));
}
public static function get PI():Number{
return (__PI);
}
public static function toRadian(_arg1:Number):Number{
return ((_arg1 * TO_RADIAN));
}
}
}//package sandy.util
Section 130
//CullingState (sandy.view.CullingState)
package sandy.view {
public class CullingState {
private var m_sState:String;
public static const OUTSIDE:CullingState = new CullingState("outside");
;
public static const INSIDE:CullingState = new CullingState("inside");
;
public static const INTERSECT:CullingState = new CullingState("intersect");
;
public function CullingState(_arg1:String){
m_sState = _arg1;
}
public function toString():String{
return (("[sandy.view.CullingState] :: state : " + m_sState));
}
}
}//package sandy.view
Section 131
//Frustum (sandy.view.Frustum)
package sandy.view {
import sandy.core.data.*;
import sandy.bounds.*;
import sandy.util.*;
import sandy.math.*;
public class Frustum {
private const aDist:Array;
private const m_aBoxEdges:Array;
public var aPoints:Array;
public var aNormals:Array;
public var aConstants:Array;
private var pool:Pool;
public var aPlanes:Array;
public static const INSIDE:CullingState = CullingState.INSIDE;
public static const OUTSIDE:CullingState = CullingState.OUTSIDE;
public static const INTERSECT:CullingState = CullingState.INTERSECT;
public static const LEFT:uint = 3;
public static const NEAR:uint = 1;
public static const BOTTOM:uint = 5;
public static const TOP:uint = 4;
public static const FAR:uint = 0;
public static const EPSILON:Number = 0.005;
public static const RIGHT:uint = 2;
public function Frustum(){
m_aBoxEdges = new Array(8);
pool = Pool.getInstance();
aDist = [];
super();
aPlanes = new Array(6);
aPoints = new Array(8);
aNormals = new Array(6);
aConstants = new Array(6);
var _local1:int;
while (_local1 < 8) {
m_aBoxEdges[int(_local1)] = new Point3D();
_local1++;
};
}
public function polygonInFrustum(_arg1:Polygon):CullingState{
var _local4:Number;
var _local6:Plane;
var _local7:Vertex;
var _local2:int;
var _local3:int;
var _local5:Array = _arg1.vertices;
for each (_local6 in aPlanes) {
for each (_local7 in _local5) {
_local4 = ((((_local6.a * _local7.wx) + (_local6.b * _local7.wy)) + (_local6.c * _local7.wz)) + _local6.d);
if (_local4 < 0){
if (_local2 > 0){
return (Frustum.INTERSECT);
};
_local3++;
} else {
if (_local3 > 0){
return (Frustum.INTERSECT);
};
_local2++;
};
};
};
if (_local2 == 0){
return (Frustum.OUTSIDE);
};
return (Frustum.INSIDE);
}
public function pointInFrustum(_arg1:Point3D):CullingState{
var _local2:Plane;
for each (_local2 in aPlanes) {
if (PlaneMath.classifyPoint(_local2, _arg1) == PlaneMath.NEGATIVE){
return (Frustum.OUTSIDE);
};
};
return (Frustum.INSIDE);
}
public function clipPolygon(_arg1:Plane, _arg2:Array, _arg3:Array):Boolean{
var _local6:Vertex;
var _local7:Number;
var _local9:Number;
var _local22:Number;
var _local4:Boolean;
var _local5:Boolean;
var _local8:Number = _arg2.length;
var _local10:Number = _arg1.a;
var _local11:Number = _arg1.b;
var _local12:Number = _arg1.c;
var _local13:Number = _arg1.d;
aDist.length = 0;
for each (_local6 in _arg2) {
_local9 = ((((_local10 * _local6.wx) + (_local11 * _local6.wy)) + (_local12 * _local6.wz)) + _local13);
if (_local9 < 0){
_local4 = false;
};
if (_local9 >= 0){
_local5 = false;
};
aDist[int(aDist.length)] = _local9;
};
if (_local4){
return (false);
};
if (_local5){
_arg2.splice(0);
_arg3.splice(0);
return (true);
};
var _local14:Array = _arg2.splice(0);
var _local15:Array = _arg3.splice(0);
var _local16:UVCoord = _local15[0];
var _local17:UVCoord;
var _local18:UVCoord;
var _local19:Vertex = _local14[0];
var _local20:Vertex;
var _local21:Vertex;
var _local23:Number = aDist[0];
var _local24:Boolean;
var _local25 = (_local23 >= 0);
_local7 = 1;
while (_local7 <= _local8) {
_local20 = _local14[int((_local7 % _local8))];
_local17 = _local15[int((_local7 % _local8))];
_local22 = aDist[int((_local7 % _local8))];
if (((_local25) && ((_local22 >= 0)))){
_arg2[_arg2.length] = _local20;
_arg3[_arg3.length] = _local17;
} else {
if (((!(_local25)) && ((_local22 >= 0)))){
_local25 = true;
_local24 = _local25;
_local21 = pool.nextVertex;
_local13 = (_local23 / (_local23 - _local22));
_local21.wx = (_local19.wx + ((_local20.wx - _local19.wx) * _local13));
_local21.wy = (_local19.wy + ((_local20.wy - _local19.wy) * _local13));
_local21.wz = (_local19.wz + ((_local20.wz - _local19.wz) * _local13));
_arg2[int(_arg2.length)] = _local21;
_arg2[int(_arg2.length)] = _local20;
_local18 = pool.nextUV;
_local18.u = (_local16.u + ((_local17.u - _local16.u) * _local13));
_local18.v = (_local16.v + ((_local17.v - _local16.v) * _local13));
_arg3[int(_arg3.length)] = _local18;
_arg3[int(_arg3.length)] = _local17;
} else {
if (((_local25) && ((_local22 < 0)))){
_local24 = true;
_local25 = false;
_local21 = pool.nextVertex;
_local13 = (_local23 / (_local23 - _local22));
_local21.wx = (_local19.wx + ((_local20.wx - _local19.wx) * _local13));
_local21.wy = (_local19.wy + ((_local20.wy - _local19.wy) * _local13));
_local21.wz = (_local19.wz + ((_local20.wz - _local19.wz) * _local13));
_local18 = pool.nextUV;
_local18.u = (_local16.u + ((_local17.u - _local16.u) * _local13));
_local18.v = (_local16.v + ((_local17.v - _local16.v) * _local13));
_arg3[int(_arg3.length)] = _local18;
_arg2[int(_arg2.length)] = _local21;
} else {
_local24 = true;
};
};
};
_local19 = _local20;
_local23 = _local22;
_local16 = _local17;
_local7++;
};
return (true);
}
public function boxInFrustum(_arg1:BBox):CullingState{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Plane;
var _local7:Point3D;
var _local2:CullingState = Frustum.INSIDE;
_arg1.getEdges(m_aBoxEdges);
for each (_local6 in aPlanes) {
_local3 = 0;
_local4 = 0;
for each (_local7 in m_aBoxEdges) {
_local5 = ((((_local6.a * _local7.x) + (_local6.b * _local7.y)) + (_local6.c * _local7.z)) + _local6.d);
if (_local5 < 0){
_local3++;
} else {
_local4++;
};
if ((((_local4 > 0)) && ((_local3 > 0)))){
break;
};
};
if (_local4 == 0){
return (Frustum.OUTSIDE);
};
if (_local3 > 0){
return (Frustum.INTERSECT);
};
};
return (_local2);
}
public function computePlanes(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{
var _local5:Number = NumberUtil.toRadian(_arg4);
var _local6:Number = Math.tan((_local5 * 0.5));
var _local7:Number = (-(_local6) * _arg2);
var _local8:Number = (_local7 * _arg1);
var _local9:Number = ((_local7 * _arg3) / _arg2);
var _local10:Number = ((_local8 * _arg3) / _arg2);
_arg2 = -(_arg2);
_arg3 = -(_arg3);
var _local11:Array = aPoints;
_local11[0] = new Point3D(_local8, _local7, _arg2);
_local11[1] = new Point3D(_local8, -(_local7), _arg2);
_local11[2] = new Point3D(-(_local8), -(_local7), _arg2);
_local11[3] = new Point3D(-(_local8), _local7, _arg2);
_local11[4] = new Point3D(_local10, _local9, _arg3);
_local11[5] = new Point3D(_local10, -(_local9), _arg3);
_local11[6] = new Point3D(-(_local10), -(_local9), _arg3);
_local11[7] = new Point3D(-(_local10), _local9, _arg3);
aPlanes[LEFT] = PlaneMath.computePlaneFromPoints(_local11[2], _local11[3], _local11[6]);
aPlanes[RIGHT] = PlaneMath.computePlaneFromPoints(_local11[0], _local11[1], _local11[4]);
aPlanes[TOP] = PlaneMath.computePlaneFromPoints(_local11[0], _local11[7], _local11[3]);
aPlanes[BOTTOM] = PlaneMath.computePlaneFromPoints(_local11[1], _local11[2], _local11[5]);
aPlanes[NEAR] = PlaneMath.computePlaneFromPoints(_local11[0], _local11[2], _local11[1]);
aPlanes[FAR] = PlaneMath.computePlaneFromPoints(_local11[4], _local11[5], _local11[6]);
var _local12:int;
while (_local12 < 6) {
PlaneMath.normalizePlane(aPlanes[int(_local12)]);
_local12++;
};
}
public function sphereInFrustum(_arg1:BSphere):CullingState{
var _local8:Plane;
var _local2:Number = 0;
var _local3:int;
var _local4:Number = _arg1.position.x;
var _local5:Number = _arg1.position.y;
var _local6:Number = _arg1.position.z;
var _local7:Number = _arg1.radius;
for each (_local8 in aPlanes) {
_local2 = ((((_local8.a * _local4) + (_local8.b * _local5)) + (_local8.c * _local6)) + _local8.d);
if (_local2 <= -(_local7)){
return (Frustum.OUTSIDE);
};
if (_local2 > _local7){
_local3++;
};
};
return (((_local3)==6) ? Frustum.INSIDE : Frustum.INTERSECT);
}
public function clipFrustum(_arg1:Array, _arg2:Array):Boolean{
var _local3:Boolean;
var _local4:Boolean;
if (_arg1.length <= 2){
return (true);
};
_local3 = clipPolygon(aPlanes[NEAR], _arg1, _arg2);
if (_arg1.length <= 2){
return (true);
};
_local4 = clipPolygon(aPlanes[LEFT], _arg1, _arg2);
if (_arg1.length <= 2){
return (true);
};
_local3 = ((_local3) || (_local4));
_local4 = clipPolygon(aPlanes[RIGHT], _arg1, _arg2);
if (_arg1.length <= 2){
return (true);
};
_local3 = ((_local3) || (_local4));
_local4 = clipPolygon(aPlanes[BOTTOM], _arg1, _arg2);
if (_arg1.length <= 2){
return (true);
};
_local3 = ((_local3) || (_local4));
_local4 = clipPolygon(aPlanes[TOP], _arg1, _arg2);
if (_arg1.length <= 2){
return (true);
};
_local3 = ((_local3) || (_local4));
return (_local3);
}
public function clipFrontPlane(_arg1:Array, _arg2:Array):Boolean{
if (_arg1.length <= 2){
return (true);
};
return (clipPolygon(aPlanes[NEAR], _arg1, _arg2));
}
public function clipLineFrontPlane(_arg1:Array):Boolean{
var _local4:Vertex;
var _local5:Vertex;
var _local8:Number;
var _local2:Plane = aPlanes[NEAR];
var _local3:Array = _arg1.splice(0);
_local4 = _local3[0];
_local5 = _local3[1];
var _local6:Number = ((((_local2.a * _local4.wx) + (_local2.b * _local4.wy)) + (_local2.c * _local4.wz)) + _local2.d);
var _local7:Number = ((((_local2.a * _local5.wx) + (_local2.b * _local5.wy)) + (_local2.c * _local5.wz)) + _local2.d);
_local8 = 0;
var _local9:Vertex = pool.nextVertex;
if ((((_local6 < 0)) && ((_local7 >= 0)))){
_local8 = (_local6 / (_local6 - _local7));
_local9.wx = (_local4.wx + ((_local5.wx - _local4.wx) * _local8));
_local9.wy = (_local4.wy + ((_local5.wy - _local4.wy) * _local8));
_local9.wz = (_local4.wz + ((_local5.wz - _local4.wz) * _local8));
_arg1[_arg1.length] = _local9;
_arg1[_arg1.length] = _local5;
return (true);
};
if ((((_local7 < 0)) && ((_local6 >= 0)))){
_local8 = (_local6 / (_local6 - _local7));
_local9.wx = (_local4.wx + ((_local5.wx - _local4.wx) * _local8));
_local9.wy = (_local4.wy + ((_local5.wy - _local4.wy) * _local8));
_local9.wz = (_local4.wz + ((_local5.wz - _local4.wz) * _local8));
_arg1[_arg1.length] = _local4;
_arg1[_arg1.length] = _local9;
return (true);
};
if ((((_local7 < 0)) && ((_local6 < 0)))){
_arg1 = null;
return (true);
};
if ((((_local7 > 0)) && ((_local6 > 0)))){
_arg1[_arg1.length] = _local4;
_arg1[_arg1.length] = _local5;
return (false);
};
return (true);
}
}
}//package sandy.view
Section 132
//ViewPort (sandy.view.ViewPort)
package sandy.view {
import flash.geom.*;
public final class ViewPort {
public const offset:Point;
public var hasChanged:Boolean;// = false
private var m_nW:int;// = 0
private var m_nH:int;// = 0
private var m_nRatio:Number;// = 0
private var m_nW2:int;// = 0
private var m_nH2:int;// = 0
public function ViewPort(_arg1:Number, _arg2:Number){
offset = new Point();
super();
width = _arg1;
height = _arg2;
}
public function get height():int{
return (m_nH);
}
public function update():void{
m_nW2 = (m_nW >> 1);
m_nH2 = (m_nH >> 1);
m_nRatio = (m_nH) ? (m_nW / m_nH) : 0;
hasChanged = true;
}
public function get ratio():Number{
return (m_nRatio);
}
public function get width2():int{
return (m_nW2);
}
public function get width():int{
return (m_nW);
}
public function set height(_arg1:int):void{
m_nH = _arg1;
update();
}
public function get height2():int{
return (m_nH2);
}
public function set width(_arg1:int):void{
m_nW = _arg1;
update();
}
}
}//package sandy.view
Section 133
//add_card_1 (sound.add_card_1)
package sound {
import flash.media.*;
public dynamic class add_card_1 extends Sound {
}
}//package sound
Section 134
//add_card_2 (sound.add_card_2)
package sound {
import flash.media.*;
public dynamic class add_card_2 extends Sound {
}
}//package sound
Section 135
//add_card_3 (sound.add_card_3)
package sound {
import flash.media.*;
public dynamic class add_card_3 extends Sound {
}
}//package sound
Section 136
//bells (sound.bells)
package sound {
import flash.media.*;
public dynamic class bells extends Sound {
}
}//package sound
Section 137
//button (sound.button)
package sound {
import flash.media.*;
public dynamic class button extends Sound {
}
}//package sound
Section 138
//deal (sound.deal)
package sound {
import flash.media.*;
public dynamic class deal extends Sound {
}
}//package sound
Section 139
//deal1 (sound.deal1)
package sound {
import flash.media.*;
public dynamic class deal1 extends Sound {
}
}//package sound
Section 140
//music (sound.music)
package sound {
import flash.media.*;
public dynamic class music extends Sound {
}
}//package sound
Section 141
//outro (sound.outro)
package sound {
import flash.media.*;
public dynamic class outro extends Sound {
}
}//package sound
Section 142
//outro2 (sound.outro2)
package sound {
import flash.media.*;
public dynamic class outro2 extends Sound {
}
}//package sound
Section 143
//reverse (sound.reverse)
package sound {
import flash.media.*;
public dynamic class reverse extends Sound {
}
}//package sound
Section 144
//shuffle (sound.shuffle)
package sound {
import flash.media.*;
public dynamic class shuffle extends Sound {
}
}//package sound
Section 145
//stabb_negative (sound.stabb_negative)
package sound {
import flash.media.*;
public dynamic class stabb_negative extends Sound {
}
}//package sound
Section 146
//stabb_positive (sound.stabb_positive)
package sound {
import flash.media.*;
public dynamic class stabb_positive extends Sound {
}
}//package sound
Section 147
//time_warning (sound.time_warning)
package sound {
import flash.media.*;
public dynamic class time_warning extends Sound {
}
}//package sound
Section 148
//uno (sound.uno)
package sound {
import flash.media.*;
public dynamic class uno extends Sound {
}
}//package sound
Section 149
//uno_loop (sound.uno_loop)
package sound {
import flash.media.*;
public dynamic class uno_loop extends Sound {
}
}//package sound
Section 150
//uno_miss (sound.uno_miss)
package sound {
import flash.media.*;
public dynamic class uno_miss extends Sound {
}
}//package sound
Section 151
//wrong (sound.wrong)
package sound {
import flash.media.*;
public dynamic class wrong extends Sound {
}
}//package sound
Section 152
//bot_blue_73 (uno_fla.bot_blue_73)
package uno_fla {
import flash.display.*;
public dynamic class bot_blue_73 extends MovieClip {
public function bot_blue_73(){
addFrameScript(0, frame1);
}
function frame1(){
mouseEnabled = false;
stop();
}
}
}//package uno_fla
Section 153
//bot_brown_74 (uno_fla.bot_brown_74)
package uno_fla {
import flash.display.*;
public dynamic class bot_brown_74 extends MovieClip {
public function bot_brown_74(){
addFrameScript(0, frame1);
}
function frame1(){
mouseEnabled = false;
stop();
}
}
}//package uno_fla
Section 154
//bot_green_81 (uno_fla.bot_green_81)
package uno_fla {
import flash.display.*;
public dynamic class bot_green_81 extends MovieClip {
public function bot_green_81(){
addFrameScript(0, frame1);
}
function frame1(){
mouseEnabled = false;
stop();
}
}
}//package uno_fla
Section 155
//bot_left_72 (uno_fla.bot_left_72)
package uno_fla {
import flash.display.*;
public dynamic class bot_left_72 extends MovieClip {
public var head:MovieClip;
public function bot_left_72(){
addFrameScript(0, frame1);
}
function frame1(){
mouseEnabled = false;
stop();
}
}
}//package uno_fla
Section 156
//bot_plain_37 (uno_fla.bot_plain_37)
package uno_fla {
import flash.display.*;
public dynamic class bot_plain_37 extends MovieClip {
public function bot_plain_37(){
addFrameScript(0, frame1, 10, frame11);
}
function frame1(){
mouseEnabled = false;
mouseChildren = false;
stop();
}
function frame11(){
mouseEnabled = false;
mouseChildren = false;
stop();
}
}
}//package uno_fla
Section 157
//bot_purple_75 (uno_fla.bot_purple_75)
package uno_fla {
import flash.display.*;
public dynamic class bot_purple_75 extends MovieClip {
public function bot_purple_75(){
addFrameScript(0, frame1);
}
function frame1(){
mouseEnabled = false;
stop();
}
}
}//package uno_fla
Section 158
//bot_red_79 (uno_fla.bot_red_79)
package uno_fla {
import flash.display.*;
public dynamic class bot_red_79 extends MovieClip {
public function bot_red_79(){
addFrameScript(0, frame1);
}
function frame1(){
mouseEnabled = false;
stop();
}
}
}//package uno_fla
Section 159
//bot_right_78 (uno_fla.bot_right_78)
package uno_fla {
import flash.display.*;
public dynamic class bot_right_78 extends MovieClip {
public var head:MovieClip;
public function bot_right_78(){
addFrameScript(0, frame1);
}
function frame1(){
mouseEnabled = false;
stop();
}
}
}//package uno_fla
Section 160
//bot_yellow_80 (uno_fla.bot_yellow_80)
package uno_fla {
import flash.display.*;
public dynamic class bot_yellow_80 extends MovieClip {
public function bot_yellow_80(){
addFrameScript(0, frame1);
}
function frame1(){
mouseEnabled = false;
stop();
}
}
}//package uno_fla
Section 161
//brickor_h_1_100 (uno_fla.brickor_h_1_100)
package uno_fla {
import flash.display.*;
public dynamic class brickor_h_1_100 extends MovieClip {
public function brickor_h_1_100(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 162
//brickor_h_2_101 (uno_fla.brickor_h_2_101)
package uno_fla {
import flash.display.*;
public dynamic class brickor_h_2_101 extends MovieClip {
public function brickor_h_2_101(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 163
//brickor_h_3_102 (uno_fla.brickor_h_3_102)
package uno_fla {
import flash.display.*;
public dynamic class brickor_h_3_102 extends MovieClip {
public function brickor_h_3_102(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 164
//brickor_h_4_103 (uno_fla.brickor_h_4_103)
package uno_fla {
import flash.display.*;
public dynamic class brickor_h_4_103 extends MovieClip {
public function brickor_h_4_103(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 165
//brickor_h_5_104 (uno_fla.brickor_h_5_104)
package uno_fla {
import flash.display.*;
public dynamic class brickor_h_5_104 extends MovieClip {
public function brickor_h_5_104(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 166
//brickor_h_6_105 (uno_fla.brickor_h_6_105)
package uno_fla {
import flash.display.*;
public dynamic class brickor_h_6_105 extends MovieClip {
public function brickor_h_6_105(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 167
//brickor_h_7_106 (uno_fla.brickor_h_7_106)
package uno_fla {
import flash.display.*;
public dynamic class brickor_h_7_106 extends MovieClip {
public function brickor_h_7_106(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 168
//brickor_h_8_107 (uno_fla.brickor_h_8_107)
package uno_fla {
import flash.display.*;
public dynamic class brickor_h_8_107 extends MovieClip {
public function brickor_h_8_107(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 169
//brickor_h_9_108 (uno_fla.brickor_h_9_108)
package uno_fla {
import flash.display.*;
public dynamic class brickor_h_9_108 extends MovieClip {
public function brickor_h_9_108(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 170
//brickor_t_1_96 (uno_fla.brickor_t_1_96)
package uno_fla {
import flash.display.*;
public dynamic class brickor_t_1_96 extends MovieClip {
public function brickor_t_1_96(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 171
//brickor_t_2_93 (uno_fla.brickor_t_2_93)
package uno_fla {
import flash.display.*;
public dynamic class brickor_t_2_93 extends MovieClip {
public function brickor_t_2_93(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 172
//brickor_t_3_94 (uno_fla.brickor_t_3_94)
package uno_fla {
import flash.display.*;
public dynamic class brickor_t_3_94 extends MovieClip {
public function brickor_t_3_94(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 173
//brickor_t_4_97 (uno_fla.brickor_t_4_97)
package uno_fla {
import flash.display.*;
public dynamic class brickor_t_4_97 extends MovieClip {
public function brickor_t_4_97(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 174
//brickor_t_5_95 (uno_fla.brickor_t_5_95)
package uno_fla {
import flash.display.*;
public dynamic class brickor_t_5_95 extends MovieClip {
public function brickor_t_5_95(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 175
//brickor_t_6_98 (uno_fla.brickor_t_6_98)
package uno_fla {
import flash.display.*;
public dynamic class brickor_t_6_98 extends MovieClip {
public function brickor_t_6_98(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 176
//brickor_v_1_89 (uno_fla.brickor_v_1_89)
package uno_fla {
import flash.display.*;
public dynamic class brickor_v_1_89 extends MovieClip {
public function brickor_v_1_89(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 177
//brickor_v_10_109 (uno_fla.brickor_v_10_109)
package uno_fla {
import flash.display.*;
public dynamic class brickor_v_10_109 extends MovieClip {
public function brickor_v_10_109(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 178
//brickor_v_2_88 (uno_fla.brickor_v_2_88)
package uno_fla {
import flash.display.*;
public dynamic class brickor_v_2_88 extends MovieClip {
public function brickor_v_2_88(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 179
//brickor_v_3_87 (uno_fla.brickor_v_3_87)
package uno_fla {
import flash.display.*;
public dynamic class brickor_v_3_87 extends MovieClip {
public function brickor_v_3_87(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 180
//brickor_v_4_86 (uno_fla.brickor_v_4_86)
package uno_fla {
import flash.display.*;
public dynamic class brickor_v_4_86 extends MovieClip {
public function brickor_v_4_86(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 181
//brickor_v_5_85 (uno_fla.brickor_v_5_85)
package uno_fla {
import flash.display.*;
public dynamic class brickor_v_5_85 extends MovieClip {
public function brickor_v_5_85(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 182
//brickor_v_6_84 (uno_fla.brickor_v_6_84)
package uno_fla {
import flash.display.*;
public dynamic class brickor_v_6_84 extends MovieClip {
public function brickor_v_6_84(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 183
//brickor_v_7_83 (uno_fla.brickor_v_7_83)
package uno_fla {
import flash.display.*;
public dynamic class brickor_v_7_83 extends MovieClip {
public function brickor_v_7_83(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 184
//brickor_v_8_90 (uno_fla.brickor_v_8_90)
package uno_fla {
import flash.display.*;
public dynamic class brickor_v_8_90 extends MovieClip {
public function brickor_v_8_90(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 185
//brickor_v_9_91 (uno_fla.brickor_v_9_91)
package uno_fla {
import flash.display.*;
public dynamic class brickor_v_9_91 extends MovieClip {
public function brickor_v_9_91(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 186
//btn_blue_29 (uno_fla.btn_blue_29)
package uno_fla {
import flash.display.*;
public dynamic class btn_blue_29 extends MovieClip {
public function btn_blue_29(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 187
//btn_endgame_118 (uno_fla.btn_endgame_118)
package uno_fla {
import flash.display.*;
public dynamic class btn_endgame_118 extends MovieClip {
public function btn_endgame_118(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 188
//btn_green_28 (uno_fla.btn_green_28)
package uno_fla {
import flash.display.*;
public dynamic class btn_green_28 extends MovieClip {
public function btn_green_28(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 189
//btn_music_116 (uno_fla.btn_music_116)
package uno_fla {
import flash.display.*;
public dynamic class btn_music_116 extends MovieClip {
public function btn_music_116(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 190
//btn_red_27 (uno_fla.btn_red_27)
package uno_fla {
import flash.display.*;
public dynamic class btn_red_27 extends MovieClip {
public function btn_red_27(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 191
//btn_sound_117 (uno_fla.btn_sound_117)
package uno_fla {
import flash.display.*;
public dynamic class btn_sound_117 extends MovieClip {
public function btn_sound_117(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 192
//btn_yellow_30 (uno_fla.btn_yellow_30)
package uno_fla {
import flash.display.*;
public dynamic class btn_yellow_30 extends MovieClip {
public function btn_yellow_30(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 193
//button_light_62 (uno_fla.button_light_62)
package uno_fla {
import flash.display.*;
public dynamic class button_light_62 extends MovieClip {
public function button_light_62(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
mouseEnabled = false;
mouseChildren = false;
}
}
}//package uno_fla
Section 194
//button_lights_61 (uno_fla.button_lights_61)
package uno_fla {
import flash.display.*;
public dynamic class button_lights_61 extends MovieClip {
public var light1:MovieClip;
public var light2:MovieClip;
public function button_lights_61(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
mouseEnabled = false;
mouseChildren = false;
}
}
}//package uno_fla
Section 195
//dir_66 (uno_fla.dir_66)
package uno_fla {
import flash.display.*;
public dynamic class dir_66 extends MovieClip {
public function dir_66(){
addFrameScript(0, frame1);
}
function frame1(){
mouseEnabled = false;
gotoAndStop(11);
}
}
}//package uno_fla
Section 196
//draw_button_60 (uno_fla.draw_button_60)
package uno_fla {
import flash.display.*;
public dynamic class draw_button_60 extends MovieClip {
public function draw_button_60(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 197
//draw_button_anim_59 (uno_fla.draw_button_anim_59)
package uno_fla {
import flash.display.*;
public dynamic class draw_button_anim_59 extends MovieClip {
public function draw_button_anim_59(){
addFrameScript(0, frame1);
}
function frame1(){
mouseEnabled = false;
stop();
}
}
}//package uno_fla
Section 198
//glowc_65 (uno_fla.glowc_65)
package uno_fla {
import flash.display.*;
public dynamic class glowc_65 extends MovieClip {
public function glowc_65(){
addFrameScript(0, frame1);
}
function frame1(){
mouseEnabled = false;
stop();
}
}
}//package uno_fla
Section 199
//intro_music_button_129 (uno_fla.intro_music_button_129)
package uno_fla {
import flash.display.*;
public dynamic class intro_music_button_129 extends MovieClip {
public function intro_music_button_129(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 200
//intro_sound_button_128 (uno_fla.intro_sound_button_128)
package uno_fla {
import flash.display.*;
public dynamic class intro_sound_button_128 extends MovieClip {
public function intro_sound_button_128(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 201
//lamp_119 (uno_fla.lamp_119)
package uno_fla {
import flash.display.*;
public dynamic class lamp_119 extends MovieClip {
public function lamp_119(){
addFrameScript(0, frame1);
}
function frame1(){
mouseEnabled = false;
stop();
}
}
}//package uno_fla
Section 202
//left_in_pile_anim_63 (uno_fla.left_in_pile_anim_63)
package uno_fla {
import flash.display.*;
public dynamic class left_in_pile_anim_63 extends MovieClip {
public function left_in_pile_anim_63(){
addFrameScript(0, frame1);
}
function frame1(){
mouseEnabled = false;
stop();
}
}
}//package uno_fla
Section 203
//next_player_1_82 (uno_fla.next_player_1_82)
package uno_fla {
import flash.display.*;
public dynamic class next_player_1_82 extends MovieClip {
public var stone1:MovieClip;
public var stone2:MovieClip;
public var stone3:MovieClip;
public var stone4:MovieClip;
public var stone5:MovieClip;
public var stone6:MovieClip;
public var stone7:MovieClip;
public var stone8:MovieClip;
public var stone9:MovieClip;
public function next_player_1_82(){
addFrameScript(0, frame1);
}
function frame1(){
mouseChildren = false;
mouseEnabled = false;
stop();
}
}
}//package uno_fla
Section 204
//next_player_2_92 (uno_fla.next_player_2_92)
package uno_fla {
import flash.display.*;
public dynamic class next_player_2_92 extends MovieClip {
public var stone1:MovieClip;
public var stone2:MovieClip;
public var stone3:MovieClip;
public var stone4:MovieClip;
public var stone5:MovieClip;
public var stone6:MovieClip;
public function next_player_2_92(){
addFrameScript(0, frame1);
}
function frame1(){
mouseEnabled = false;
mouseChildren = false;
stop();
}
}
}//package uno_fla
Section 205
//next_player_3_99 (uno_fla.next_player_3_99)
package uno_fla {
import flash.display.*;
public dynamic class next_player_3_99 extends MovieClip {
public var stone10:MovieClip;
public var stone1:MovieClip;
public var stone2:MovieClip;
public var stone3:MovieClip;
public var stone4:MovieClip;
public var stone5:MovieClip;
public var stone6:MovieClip;
public var stone7:MovieClip;
public var stone8:MovieClip;
public var stone9:MovieClip;
public function next_player_3_99(){
addFrameScript(0, frame1);
}
function frame1(){
mouseEnabled = false;
mouseChildren = false;
stop();
}
}
}//package uno_fla
Section 206
//nextBtn_133 (uno_fla.nextBtn_133)
package uno_fla {
import flash.display.*;
public dynamic class nextBtn_133 extends MovieClip {
public function nextBtn_133(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 207
//numbers1_67 (uno_fla.numbers1_67)
package uno_fla {
import flash.display.*;
public dynamic class numbers1_67 extends MovieClip {
public function numbers1_67(){
addFrameScript(0, frame1);
}
function frame1(){
mouseEnabled = false;
stop();
}
}
}//package uno_fla
Section 208
//numbers2_68 (uno_fla.numbers2_68)
package uno_fla {
import flash.display.*;
public dynamic class numbers2_68 extends MovieClip {
public function numbers2_68(){
addFrameScript(0, frame1);
}
function frame1(){
mouseEnabled = false;
stop();
}
}
}//package uno_fla
Section 209
//pass_114 (uno_fla.pass_114)
package uno_fla {
import flash.display.*;
import flash.text.*;
public dynamic class pass_114 extends MovieClip {
public var pass_active:TextField;
public function pass_114(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 210
//pile_anim_64 (uno_fla.pile_anim_64)
package uno_fla {
import flash.display.*;
public dynamic class pile_anim_64 extends MovieClip {
public function pile_anim_64(){
addFrameScript(0, frame1);
}
function frame1(){
mouseEnabled = false;
stop();
}
}
}//package uno_fla
Section 211
//shuffle_69 (uno_fla.shuffle_69)
package uno_fla {
import flash.display.*;
public dynamic class shuffle_69 extends MovieClip {
public function shuffle_69(){
addFrameScript(0, frame1);
}
function frame1(){
mouseEnabled = false;
stop();
}
}
}//package uno_fla
Section 212
//small_card_32 (uno_fla.small_card_32)
package uno_fla {
import flash.display.*;
public dynamic class small_card_32 extends MovieClip {
public function small_card_32(){
addFrameScript(0, frame1);
}
function frame1(){
mouseEnabled = false;
mouseChildren = false;
stop();
}
}
}//package uno_fla
Section 213
//station_left_70 (uno_fla.station_left_70)
package uno_fla {
import flash.display.*;
import flash.text.*;
public dynamic class station_left_70 extends MovieClip {
public var bot:MovieClip;
public var lamp:MovieClip;
public var numcards:TextField;
public function station_left_70(){
addFrameScript(0, frame1);
}
function frame1(){
mouseEnabled = false;
stop();
}
}
}//package uno_fla
Section 214
//station_left_lamp_71 (uno_fla.station_left_lamp_71)
package uno_fla {
import flash.display.*;
public dynamic class station_left_lamp_71 extends MovieClip {
public function station_left_lamp_71(){
addFrameScript(0, frame1);
}
function frame1(){
mouseEnabled = false;
stop();
}
}
}//package uno_fla
Section 215
//station_left_lamps_123 (uno_fla.station_left_lamps_123)
package uno_fla {
import flash.display.*;
public dynamic class station_left_lamps_123 extends MovieClip {
public function station_left_lamps_123(){
addFrameScript(0, frame1);
}
function frame1(){
mouseEnabled = false;
stop();
}
}
}//package uno_fla
Section 216
//station_left_over_122 (uno_fla.station_left_over_122)
package uno_fla {
import flash.display.*;
public dynamic class station_left_over_122 extends MovieClip {
public var lamps:MovieClip;
public function station_left_over_122(){
addFrameScript(0, frame1);
}
function frame1(){
this.mouseEnabled = false;
}
}
}//package uno_fla
Section 217
//station_right_76 (uno_fla.station_right_76)
package uno_fla {
import flash.display.*;
import flash.text.*;
public dynamic class station_right_76 extends MovieClip {
public var bot:MovieClip;
public var lamp:MovieClip;
public var numcards:TextField;
public function station_right_76(){
addFrameScript(0, frame1);
}
function frame1(){
mouseEnabled = false;
stop();
}
}
}//package uno_fla
Section 218
//station_right_lamp_77 (uno_fla.station_right_lamp_77)
package uno_fla {
import flash.display.*;
public dynamic class station_right_lamp_77 extends MovieClip {
public function station_right_lamp_77(){
addFrameScript(0, frame1);
}
function frame1(){
mouseEnabled = false;
stop();
}
}
}//package uno_fla
Section 219
//station_right_lamps_121 (uno_fla.station_right_lamps_121)
package uno_fla {
import flash.display.*;
public dynamic class station_right_lamps_121 extends MovieClip {
public function station_right_lamps_121(){
addFrameScript(0, frame1);
}
function frame1(){
mouseEnabled = false;
stop();
}
}
}//package uno_fla
Section 220
//station_right_over_120 (uno_fla.station_right_over_120)
package uno_fla {
import flash.display.*;
public dynamic class station_right_over_120 extends MovieClip {
public var lamps:MovieClip;
public function station_right_over_120(){
addFrameScript(0, frame1);
}
function frame1(){
mouseEnabled = false;
stop();
}
}
}//package uno_fla
Section 221
//uno_115 (uno_fla.uno_115)
package uno_fla {
import flash.display.*;
public dynamic class uno_115 extends MovieClip {
public function uno_115(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package uno_fla
Section 222
//action_draw2 (action_draw2)
package {
import flash.display.*;
import flash.text.*;
public dynamic class action_draw2 extends MovieClip {
public var txt:TextField;
}
}//package
Section 223
//action_draw4 (action_draw4)
package {
import flash.display.*;
import flash.text.*;
public dynamic class action_draw4 extends MovieClip {
public var txt:TextField;
}
}//package
Section 224
//action_reverse (action_reverse)
package {
import flash.display.*;
import flash.text.*;
public dynamic class action_reverse extends MovieClip {
public var txt:TextField;
}
}//package
Section 225
//action_skip (action_skip)
package {
import flash.display.*;
import flash.text.*;
public dynamic class action_skip extends MovieClip {
public var txt:TextField;
}
}//package
Section 226
//back (back)
package {
import flash.display.*;
public dynamic class back extends BitmapData {
public function back(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 227
//blue_0 (blue_0)
package {
import flash.display.*;
public dynamic class blue_0 extends BitmapData {
public function blue_0(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 228
//blue_1 (blue_1)
package {
import flash.display.*;
public dynamic class blue_1 extends BitmapData {
public function blue_1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 229
//blue_2 (blue_2)
package {
import flash.display.*;
public dynamic class blue_2 extends BitmapData {
public function blue_2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 230
//blue_3 (blue_3)
package {
import flash.display.*;
public dynamic class blue_3 extends BitmapData {
public function blue_3(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 231
//blue_4 (blue_4)
package {
import flash.display.*;
public dynamic class blue_4 extends BitmapData {
public function blue_4(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 232
//blue_5 (blue_5)
package {
import flash.display.*;
public dynamic class blue_5 extends BitmapData {
public function blue_5(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 233
//blue_6 (blue_6)
package {
import flash.display.*;
public dynamic class blue_6 extends BitmapData {
public function blue_6(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 234
//blue_7 (blue_7)
package {
import flash.display.*;
public dynamic class blue_7 extends BitmapData {
public function blue_7(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 235
//blue_8 (blue_8)
package {
import flash.display.*;
public dynamic class blue_8 extends BitmapData {
public function blue_8(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 236
//blue_9 (blue_9)
package {
import flash.display.*;
public dynamic class blue_9 extends BitmapData {
public function blue_9(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 237
//blue_draw_two_card (blue_draw_two_card)
package {
import flash.display.*;
public dynamic class blue_draw_two_card extends BitmapData {
public function blue_draw_two_card(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 238
//blue_reverse_card (blue_reverse_card)
package {
import flash.display.*;
public dynamic class blue_reverse_card extends BitmapData {
public function blue_reverse_card(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 239
//blue_skip_card (blue_skip_card)
package {
import flash.display.*;
public dynamic class blue_skip_card extends BitmapData {
public function blue_skip_card(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 240
//BubbleLeft (BubbleLeft)
package {
import king.game.uno.view.*;
public dynamic class BubbleLeft extends Bubble {
public function BubbleLeft(){
addFrameScript(0, frame1);
}
function frame1(){
mouseEnabled = false;
mouseChildren = false;
stop();
}
}
}//package
Section 241
//BubbleRight (BubbleRight)
package {
import king.game.uno.view.*;
public dynamic class BubbleRight extends Bubble {
public function BubbleRight(){
addFrameScript(0, frame1);
}
function frame1(){
mouseEnabled = false;
mouseChildren = false;
stop();
}
}
}//package
Section 242
//char (char)
package {
import flash.display.*;
public dynamic class char extends MovieClip {
}
}//package
Section 243
//choose_color_sign (choose_color_sign)
package {
import king.game.uno.view.*;
public dynamic class choose_color_sign extends ChooseColorSign {
public function choose_color_sign(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 244
//draw_winner_sign (draw_winner_sign)
package {
import king.game.uno.view.*;
public dynamic class draw_winner_sign extends DrawWinnerSign {
}
}//package
Section 245
//fade (fade)
package {
import flash.display.*;
public dynamic class fade extends BitmapData {
public function fade(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 246
//green_0 (green_0)
package {
import flash.display.*;
public dynamic class green_0 extends BitmapData {
public function green_0(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 247
//green_1 (green_1)
package {
import flash.display.*;
public dynamic class green_1 extends BitmapData {
public function green_1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 248
//green_2 (green_2)
package {
import flash.display.*;
public dynamic class green_2 extends BitmapData {
public function green_2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 249
//green_3 (green_3)
package {
import flash.display.*;
public dynamic class green_3 extends BitmapData {
public function green_3(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 250
//green_4 (green_4)
package {
import flash.display.*;
public dynamic class green_4 extends BitmapData {
public function green_4(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 251
//green_5 (green_5)
package {
import flash.display.*;
public dynamic class green_5 extends BitmapData {
public function green_5(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 252
//green_6 (green_6)
package {
import flash.display.*;
public dynamic class green_6 extends BitmapData {
public function green_6(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 253
//green_7 (green_7)
package {
import flash.display.*;
public dynamic class green_7 extends BitmapData {
public function green_7(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 254
//green_8 (green_8)
package {
import flash.display.*;
public dynamic class green_8 extends BitmapData {
public function green_8(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 255
//green_9 (green_9)
package {
import flash.display.*;
public dynamic class green_9 extends BitmapData {
public function green_9(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 256
//green_draw_two_card (green_draw_two_card)
package {
import flash.display.*;
public dynamic class green_draw_two_card extends BitmapData {
public function green_draw_two_card(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 257
//green_reverse_card (green_reverse_card)
package {
import flash.display.*;
public dynamic class green_reverse_card extends BitmapData {
public function green_reverse_card(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 258
//green_skip_card (green_skip_card)
package {
import flash.display.*;
public dynamic class green_skip_card extends BitmapData {
public function green_skip_card(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 259
//handscore (handscore)
package {
import king.game.uno.view.*;
public dynamic class handscore extends ScorePop {
}
}//package
Section 260
//intro_page1 (intro_page1)
package {
import king.game.uno.view.*;
public dynamic class intro_page1 extends I18nTextField {
}
}//package
Section 261
//intro_page2 (intro_page2)
package {
import king.game.uno.view.*;
public dynamic class intro_page2 extends I18nTextField {
}
}//package
Section 262
//intro_sign (intro_sign)
package {
import king.game.uno.view.*;
public dynamic class intro_sign extends IntroSign {
}
}//package
Section 263
//missed_say_uno_sign (missed_say_uno_sign)
package {
import king.game.uno.view.*;
public dynamic class missed_say_uno_sign extends MissedSayUnoSign {
}
}//package
Section 264
//PlayClip (PlayClip)
package {
import king.game.uno.view.*;
import flash.display.*;
import flash.text.*;
public dynamic class PlayClip extends MovieClip {
public var btn_music:MovieClip;
public var uno_lights:MovieClip;
public var pass_lights:MovieClip;
public var clock:ClockView;
public var stack:MovieClip;
public var pass:MovieClip;
public var round:TextField;
public var numcards:TextField;
public var station_right_over:MovieClip;
public var station_left:MovieClip;
public var station_left_over:MovieClip;
public var stones1:MovieClip;
public var stones2:MovieClip;
public var stones3:MovieClip;
public var fg:MovieClip;
public var table:MovieClip;
public var station_right:MovieClip;
public var signs:MovieClip;
public var lamp:MovieClip;
public var cards:MovieClip;
public var avatarHolder:MovieClip;
public var bubbles:MovieClip;
public var btn_endgame:MovieClip;
public var btn_sound:MovieClip;
public var uno:MovieClip;
}
}//package
Section 265
//red_0 (red_0)
package {
import flash.display.*;
public dynamic class red_0 extends BitmapData {
public function red_0(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 266
//red_1 (red_1)
package {
import flash.display.*;
public dynamic class red_1 extends BitmapData {
public function red_1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 267
//red_2 (red_2)
package {
import flash.display.*;
public dynamic class red_2 extends BitmapData {
public function red_2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 268
//red_3 (red_3)
package {
import flash.display.*;
public dynamic class red_3 extends BitmapData {
public function red_3(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 269
//red_4 (red_4)
package {
import flash.display.*;
public dynamic class red_4 extends BitmapData {
public function red_4(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 270
//red_5 (red_5)
package {
import flash.display.*;
public dynamic class red_5 extends BitmapData {
public function red_5(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 271
//red_6 (red_6)
package {
import flash.display.*;
public dynamic class red_6 extends BitmapData {
public function red_6(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 272
//red_7 (red_7)
package {
import flash.display.*;
public dynamic class red_7 extends BitmapData {
public function red_7(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 273
//red_8 (red_8)
package {
import flash.display.*;
public dynamic class red_8 extends BitmapData {
public function red_8(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 274
//red_9 (red_9)
package {
import flash.display.*;
public dynamic class red_9 extends BitmapData {
public function red_9(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 275
//red_draw_two_card (red_draw_two_card)
package {
import flash.display.*;
public dynamic class red_draw_two_card extends BitmapData {
public function red_draw_two_card(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 276
//red_reverse_card (red_reverse_card)
package {
import flash.display.*;
public dynamic class red_reverse_card extends BitmapData {
public function red_reverse_card(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 277
//red_skip_card (red_skip_card)
package {
import flash.display.*;
public dynamic class red_skip_card extends BitmapData {
public function red_skip_card(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 278
//register_sign (register_sign)
package {
import king.game.uno.view.*;
public dynamic class register_sign extends RegisterSign {
}
}//package
Section 279
//round_winner_sign (round_winner_sign)
package {
import king.game.uno.view.*;
public dynamic class round_winner_sign extends RoundWinnerSign {
}
}//package
Section 280
//sign_bottom (sign_bottom)
package {
import flash.display.*;
public dynamic class sign_bottom extends MovieClip {
}
}//package
Section 281
//sign_bottom_left (sign_bottom_left)
package {
import flash.display.*;
public dynamic class sign_bottom_left extends MovieClip {
}
}//package
Section 282
//sign_bottom_right (sign_bottom_right)
package {
import flash.display.*;
public dynamic class sign_bottom_right extends MovieClip {
}
}//package
Section 283
//sign_left (sign_left)
package {
import flash.display.*;
public dynamic class sign_left extends MovieClip {
}
}//package
Section 284
//sign_middle (sign_middle)
package {
import flash.display.*;
public dynamic class sign_middle extends MovieClip {
}
}//package
Section 285
//sign_right (sign_right)
package {
import flash.display.*;
public dynamic class sign_right extends MovieClip {
}
}//package
Section 286
//sign_top (sign_top)
package {
import flash.display.*;
public dynamic class sign_top extends MovieClip {
}
}//package
Section 287
//sign_top_left (sign_top_left)
package {
import flash.display.*;
public dynamic class sign_top_left extends MovieClip {
}
}//package
Section 288
//sign_top_right (sign_top_right)
package {
import flash.display.*;
public dynamic class sign_top_right extends MovieClip {
}
}//package
Section 289
//wild_card (wild_card)
package {
import flash.display.*;
public dynamic class wild_card extends BitmapData {
public function wild_card(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 290
//wild_draw_four_card (wild_draw_four_card)
package {
import flash.display.*;
public dynamic class wild_draw_four_card extends BitmapData {
public function wild_draw_four_card(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 291
//winner_sign (winner_sign)
package {
import king.game.uno.view.*;
public dynamic class winner_sign extends WinnerSign {
}
}//package
Section 292
//yellow_0 (yellow_0)
package {
import flash.display.*;
public dynamic class yellow_0 extends BitmapData {
public function yellow_0(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 293
//yellow_1 (yellow_1)
package {
import flash.display.*;
public dynamic class yellow_1 extends BitmapData {
public function yellow_1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 294
//yellow_2 (yellow_2)
package {
import flash.display.*;
public dynamic class yellow_2 extends BitmapData {
public function yellow_2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 295
//yellow_3 (yellow_3)
package {
import flash.display.*;
public dynamic class yellow_3 extends BitmapData {
public function yellow_3(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 296
//yellow_4 (yellow_4)
package {
import flash.display.*;
public dynamic class yellow_4 extends BitmapData {
public function yellow_4(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 297
//yellow_5 (yellow_5)
package {
import flash.display.*;
public dynamic class yellow_5 extends BitmapData {
public function yellow_5(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 298
//yellow_6 (yellow_6)
package {
import flash.display.*;
public dynamic class yellow_6 extends BitmapData {
public function yellow_6(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 299
//yellow_7 (yellow_7)
package {
import flash.display.*;
public dynamic class yellow_7 extends BitmapData {
public function yellow_7(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 300
//yellow_8 (yellow_8)
package {
import flash.display.*;
public dynamic class yellow_8 extends BitmapData {
public function yellow_8(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 301
//yellow_9 (yellow_9)
package {
import flash.display.*;
public dynamic class yellow_9 extends BitmapData {
public function yellow_9(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 302
//yellow_draw_two_card (yellow_draw_two_card)
package {
import flash.display.*;
public dynamic class yellow_draw_two_card extends BitmapData {
public function yellow_draw_two_card(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 303
//yellow_reverse_card (yellow_reverse_card)
package {
import flash.display.*;
public dynamic class yellow_reverse_card extends BitmapData {
public function yellow_reverse_card(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 304
//yellow_skip_card (yellow_skip_card)
package {
import flash.display.*;
public dynamic class yellow_skip_card extends BitmapData {
public function yellow_skip_card(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package