Section 1
//Base64 (lib.external.Base64)
package lib.external {
import flash.utils.*;
public class Base64 {
public static const version:String = "1.1.0";
private static const BASE64_CHARS:String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
public function Base64(){
throw (new Error("Base64 class is static container only"));
}
public static function encode(_arg1:String):String{
var _local2:ByteArray;
_local2 = new ByteArray();
_local2.writeUTFBytes(_arg1);
return (encodeByteArray(_local2));
}
public static function encodeByteArray(_arg1:ByteArray):String{
var _local2:String;
var _local3:Array;
var _local4:Array;
var _local5:uint;
var _local6:uint;
var _local7:uint;
_local2 = "";
_local4 = new Array(4);
_arg1.position = 0;
while (_arg1.bytesAvailable > 0) {
_local3 = new Array();
_local5 = 0;
while ((((_local5 < 3)) && ((_arg1.bytesAvailable > 0)))) {
_local3[_local5] = _arg1.readUnsignedByte();
_local5++;
};
_local4[0] = ((_local3[0] & 252) >> 2);
_local4[1] = (((_local3[0] & 3) << 4) | (_local3[1] >> 4));
_local4[2] = (((_local3[1] & 15) << 2) | (_local3[2] >> 6));
_local4[3] = (_local3[2] & 63);
_local6 = _local3.length;
while (_local6 < 3) {
_local4[(_local6 + 1)] = 64;
_local6++;
};
_local7 = 0;
while (_local7 < _local4.length) {
_local2 = (_local2 + BASE64_CHARS.charAt(_local4[_local7]));
_local7++;
};
};
return (_local2);
}
public static function decode(_arg1:String):String{
var _local2:ByteArray;
_local2 = decodeToByteArray(_arg1);
return (_local2.readUTFBytes(_local2.length));
}
public static function decodeToByteArray(_arg1:String):ByteArray{
var _local2:ByteArray;
var _local3:Array;
var _local4:Array;
var _local5:uint;
var _local6:uint;
var _local7:uint;
_local2 = new ByteArray();
_local3 = new Array(4);
_local4 = new Array(3);
_local5 = 0;
while (_local5 < _arg1.length) {
_local6 = 0;
while ((((_local6 < 4)) && (((_local5 + _local6) < _arg1.length)))) {
_local3[_local6] = BASE64_CHARS.indexOf(_arg1.charAt((_local5 + _local6)));
_local6++;
};
_local4[0] = ((_local3[0] << 2) + ((_local3[1] & 48) >> 4));
_local4[1] = (((_local3[1] & 15) << 4) + ((_local3[2] & 60) >> 2));
_local4[2] = (((_local3[2] & 3) << 6) + _local3[3]);
_local7 = 0;
while (_local7 < _local4.length) {
if (_local3[(_local7 + 1)] == 64){
break;
};
_local2.writeByte(_local4[_local7]);
_local7++;
};
_local5 = (_local5 + 4);
};
_local2.position = 0;
return (_local2);
}
}
}//package lib.external
Section 2
//ButtonList (lib.ui.ButtonList)
package lib.ui {
import flash.display.*;
import flash.events.*;
import flash.filters.*;
public class ButtonList {
var clickAction:Function;
var overAction:Function;
var buttonList:Array;
var outAction:Function;
var buttonState:Array;
static var OVER:int = 2;
static var NORMAL:int = 1;
public function ButtonList(_arg1:Array):void{
var _local2:int;
var _local3:MovieClip;
super();
buttonList = _arg1;
buttonState = new Array();
clickAction = null;
overAction = null;
outAction = null;
_local2 = 0;
while (_local2 < buttonList.length) {
_local3 = buttonList[_local2];
_local3.mouseChildren = false;
_local3.addEventListener(MouseEvent.CLICK, buttonClick);
_local3.addEventListener(MouseEvent.MOUSE_OVER, buttonOver);
_local3.addEventListener(MouseEvent.MOUSE_OUT, buttonOut);
_local3.stop();
buttonState.push(false);
_local2++;
};
}
public function glowOut(_arg1:int):void{
var _local2:*;
_local2 = buttonList[_arg1].filters;
if (_local2 == null){
_local2 = new Array();
};
if (_local2.length > 0){
_local2.pop();
};
buttonList[_arg1].filters = _local2;
}
public function cleanup():void{
var _local1:int;
var _local2:MovieClip;
_local1 = 0;
while (_local1 < buttonList.length) {
_local2 = buttonList[_local1];
_local2.removeEventListener(MouseEvent.CLICK, this.buttonClick);
_local2.removeEventListener(MouseEvent.MOUSE_OVER, this.buttonOver);
_local2.removeEventListener(MouseEvent.MOUSE_OUT, this.buttonOut);
_local1++;
};
}
function buttonOver(_arg1:MouseEvent):void{
var _local2:int;
_local2 = getButtonIndex(_arg1);
if (((!((_local2 == -1))) && (!(buttonState[_local2])))){
buttonState[_local2] = true;
if (overAction != null){
overAction(_local2);
};
};
}
public function frameOver(_arg1:int):void{
buttonList[_arg1].gotoAndStop(OVER);
}
function getButtonIndex(_arg1:MouseEvent):int{
var _local2:int;
var _local3:int;
_local2 = -1;
_local3 = 0;
while (_local3 < buttonList.length) {
if (buttonList[_local3] == _arg1.target){
_local2 = _local3;
break;
};
_local3++;
};
return (_local2);
}
public function frameOut(_arg1:int):void{
buttonList[_arg1].gotoAndStop(NORMAL);
}
public function get(_arg1:int):MovieClip{
return (buttonList[_arg1]);
}
public function glowOver(_arg1:int):void{
var _local2:*;
var _local3:*;
_local2 = new GlowFilter(0xFFFFFF, 0.5, 10, 10, 5, 3);
_local3 = buttonList[_arg1].filters;
if (_local3 == null){
_local3 = new Array();
};
_local3.push(_local2);
buttonList[_arg1].filters = _local3;
}
public function setActions(_arg1:Function, _arg2:Function, _arg3:Function):void{
clickAction = _arg1;
overAction = _arg2;
outAction = _arg3;
}
function buttonOut(_arg1:MouseEvent):void{
var _local2:int;
_local2 = getButtonIndex(_arg1);
if (((!((_local2 == -1))) && (buttonState[_local2]))){
buttonState[_local2] = false;
if (outAction != null){
outAction(_local2);
};
};
}
function buttonClick(_arg1:MouseEvent):void{
var _local2:int;
_local2 = getButtonIndex(_arg1);
if (_local2 != -1){
if (clickAction != null){
clickAction(_local2);
};
};
}
}
}//package lib.ui
Section 3
//Image (lib.ui.Image)
package lib.ui {
import flash.display.*;
import lib.*;
import flash.utils.*;
import flash.filters.*;
public class Image {
var scaleChanged:Boolean;
protected var frameChanged:Boolean;
var typeChanged:Boolean;
var type:ImageType;
var filterChanged:Boolean;
var posChanged:Boolean;
var scale:Number;
var pos:Point;
var rotationChanged:Boolean;
protected var image:MovieClip;
var alpha:Number;
var visibleChanged:Boolean;
var frame:int;
var visible:Boolean;
var alphaChanged:Boolean;
var filter:BitmapFilter;
var rotation:int;
public function Image(_arg1:ImageType):void{
image = null;
type = _arg1;
pos = new Point(0, 0);
visible = true;
frame = 1;
filter = null;
rotation = 0;
alpha = 1;
scale = 1;
invalidate();
}
public function setRotation(_arg1:int):void{
if (rotation != _arg1){
rotation = _arg1;
rotationChanged = true;
};
}
public function setScale(_arg1:Number):void{
if (scale != _arg1){
scale = _arg1;
scaleChanged = true;
};
}
protected function clearImage():void{
if (image != null){
image.parent.removeChild(image);
};
image = null;
}
function updateScale():void{
if (((scaleChanged) && (!((image == null))))){
image.scaleX = scale;
image.scaleY = scale;
};
scaleChanged = false;
}
public function setPos(_arg1:Point):void{
if (!Point.isEqual(pos, _arg1)){
pos = _arg1.clone();
posChanged = true;
};
}
function updateAlpha():void{
if (((alphaChanged) && (!((image == null))))){
image.alpha = alpha;
};
alphaChanged = false;
}
public function setAlpha(_arg1:Number):void{
if (alpha != _arg1){
alpha = _arg1;
alphaChanged = true;
};
}
function updateFilter():void{
if (((filterChanged) && (!((image == null))))){
if (filter == null){
image.filters = null;
} else {
image.filters = [filter];
};
};
filterChanged = false;
}
function updateType(_arg1:Window):void{
if (((typeChanged) && (!((image == null))))){
resetImage(_arg1);
};
typeChanged = false;
}
public function cleanup():void{
clearImage();
}
protected function updateFrame():void{
if (((frameChanged) && (!((image == null))))){
image.gotoAndStop(frame);
};
frameChanged = false;
}
public function setVisible(_arg1:Boolean):void{
if (visible != _arg1){
visible = _arg1;
visibleChanged = true;
};
}
public function setFrame(_arg1:int):void{
if (frame != _arg1){
frame = _arg1;
frameChanged = true;
};
}
protected function invalidate():void{
typeChanged = true;
posChanged = true;
visibleChanged = true;
frameChanged = true;
filterChanged = true;
rotationChanged = true;
alphaChanged = true;
scaleChanged = true;
}
public function setType(_arg1:ImageType):void{
if (type != _arg1){
type = _arg1;
typeChanged = true;
};
}
function isInside(_arg1:Window):Boolean{
return ((((((((pos.x >= (_arg1.getOffset().x - type.size.x))) && ((pos.x <= ((_arg1.getOffset().x + _arg1.getSize().x) + type.size.x))))) && ((pos.y >= (_arg1.getOffset().y - type.size.y))))) && ((pos.y <= ((_arg1.getOffset().y + _arg1.getSize().y) + type.size.y)))));
}
public function update(_arg1:Window):void{
if (_arg1.isMoved()){
posChanged = true;
};
if (((posChanged) || (visibleChanged))){
if (((isInside(_arg1)) && (visible))){
if (image == null){
resetImage(_arg1);
};
} else {
clearImage();
};
visibleChanged = false;
};
updateType(_arg1);
updatePos(_arg1);
updateFrame();
updateFilter();
updateRotation();
updateAlpha();
updateScale();
}
function updatePos(_arg1:Window):void{
if (((posChanged) && (!((image == null))))){
image.x = (pos.x - _arg1.getOffset().x);
image.y = (pos.y - _arg1.getOffset().y);
};
posChanged = false;
}
protected function resetImage(_arg1:Window):void{
var _local2:*;
clearImage();
image = createClip(type.linkage);
_local2 = _arg1.getLayer(type.layer);
_local2.addChild(image);
image.cacheAsBitmap = true;
invalidate();
typeChanged = false;
}
function updateRotation():void{
if (((rotationChanged) && (!((image == null))))){
image.rotation = rotation;
};
rotationChanged = false;
}
public function setFilter(_arg1:BitmapFilter):void{
if (filter != _arg1){
filter = _arg1;
filterChanged = true;
};
}
public static function createClip(_arg1:String):MovieClip{
var _local2:*;
_local2 = (getDefinitionByName(_arg1) as Class);
return (new (_local2));
}
}
}//package lib.ui
Section 4
//ImageList (lib.ui.ImageList)
package lib.ui {
import lib.*;
public class ImageList {
var images:DList;
public function ImageList():void{
images = new DList();
}
public function add(_arg1:Image):void{
images.pushBack(_arg1);
}
public function cleanup():void{
var _local1:DIterator;
_local1 = images.frontIterator();
while (_local1.isValid()) {
_local1.get().cleanup();
_local1.increment();
};
}
public function update(_arg1:Window):void{
var _local2:DIterator;
_local2 = images.frontIterator();
while (_local2.isValid()) {
_local2.get().update(_arg1);
_local2.increment();
};
_arg1.clearMoved();
}
public function remove(_arg1:Image):void{
images.remove(_arg1);
}
}
}//package lib.ui
Section 5
//ImageText (lib.ui.ImageText)
package lib.ui {
import ui.*;
import flash.text.*;
public class ImageText extends Image {
var text:String;
var textClip:TextClip;
var textChanged:Boolean;
public function ImageText(_arg1:ImageType):void{
text = null;
textClip = null;
super(_arg1);
}
override protected function clearImage():void{
if (textClip != null){
textClip.parent.removeChild(textClip);
};
textClip = null;
super.clearImage();
}
function updateText():void{
if (((((textChanged) && (!((image == null))))) && (!((textClip == null))))){
if (text == null){
textClip.visible = false;
} else {
textClip.text.text = text;
textClip.visible = true;
textClip.text.x = (-(textClip.text.width) / 2);
textClip.text.y = (-(textClip.text.height) / 2);
};
};
textChanged = false;
}
override protected function updateFrame():void{
if (((((frameChanged) && (!((image == null))))) && (!((textClip == null))))){
super.updateFrame();
textClip.parent.removeChild(textClip);
image.addChild(textClip);
};
}
public function setText(_arg1:String):void{
if (text != _arg1){
text = _arg1;
textChanged = true;
};
}
override protected function invalidate():void{
super.invalidate();
textChanged = true;
}
override public function update(_arg1:Window):void{
super.update(_arg1);
updateText();
}
override protected function resetImage(_arg1:Window):void{
super.resetImage(_arg1);
textClip = new TextClip();
image.addChild(textClip);
textClip.cacheAsBitmap = true;
textClip.text.autoSize = TextFieldAutoSize.CENTER;
}
}
}//package lib.ui
Section 6
//ImageType (lib.ui.ImageType)
package lib.ui {
import lib.*;
public class ImageType {
public var size:Point;
public var linkage:String;
public var layer:int;
public function ImageType(_arg1:String, _arg2:int, _arg3:Point):void{
linkage = _arg1;
layer = _arg2;
size = _arg3.clone();
}
}
}//package lib.ui
Section 7
//Keyboard (lib.ui.Keyboard)
package lib.ui {
import flash.display.*;
import flash.events.*;
import flash.ui.*;
public class Keyboard {
var shiftPressed:Boolean;
var hotkeyHandlers:Array;
var repeat:int;
var stage:Stage;
public static var enterCode = Keyboard.ENTER;
static var repeatWait = 0;
public static var deleteCode = Keyboard.DELETE;
public static var backSpaceCode = Keyboard.BACKSPACE;
public static var escapeCode = Keyboard.ESCAPE;
public function Keyboard(_arg1:Stage):void{
stage = _arg1;
repeat = repeatWait;
shiftPressed = false;
hotkeyHandlers = new Array();
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
stage.addEventListener(KeyboardEvent.KEY_UP, onKeyUp);
stage.addEventListener(Event.ENTER_FRAME, step);
}
function onKeyDown(_arg1:KeyboardEvent):void{
var _local2:*;
var _local3:*;
var _local4:*;
if (repeat == repeatWait){
repeat = 0;
_local2 = String.fromCharCode(_arg1.charCode);
_local3 = _arg1.keyCode;
if (_local3 == Keyboard.SHIFT){
shiftPressed = true;
};
for each (_local4 in hotkeyHandlers) {
if (_local4(_local2, _local3)){
break;
};
};
};
}
public function cleanup():void{
stage.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
stage.removeEventListener(KeyboardEvent.KEY_UP, onKeyUp);
stage.removeEventListener(Event.ENTER_FRAME, step);
}
public function removeHandler(_arg1:Function):void{
var _local2:*;
_local2 = hotkeyHandlers.indexOf(_arg1);
if (_local2 != -1){
hotkeyHandlers.splice(_local2, 1);
};
}
public function addHandler(_arg1:Function):void{
hotkeyHandlers.push(_arg1);
}
function step(_arg1:Event):void{
if (repeat < repeatWait){
repeat++;
};
}
public function shift():Boolean{
return (shiftPressed);
}
public function clearHandlers():void{
hotkeyHandlers = new Array();
}
function onKeyUp(_arg1:KeyboardEvent):void{
repeat = repeatWait;
if (_arg1.keyCode == Keyboard.SHIFT){
shiftPressed = false;
};
}
}
}//package lib.ui
Section 8
//MenuList (lib.ui.MenuList)
package lib.ui {
public class MenuList {
var menus:Array;
var current:int;
var isHidden:Boolean;
public static var HIDE_MENU = -2;
public static var CURRENT_MENU = -1;
public function MenuList(_arg1:Array):void{
current = 0;
menus = _arg1;
isHidden = true;
}
public function hide():void{
if ((((current >= 0)) && ((current < menus.length)))){
menus[current].hide();
};
isHidden = true;
}
public function cleanup():void{
var _local1:*;
for each (_local1 in menus) {
_local1.cleanup();
};
}
public function changeState(_arg1:int):void{
if (((((!((_arg1 == CURRENT_MENU))) && ((_arg1 >= 0)))) && ((_arg1 < menus.length)))){
if (!isHidden){
if ((((current >= 0)) && ((current < menus.length)))){
menus[current].hide();
};
};
current = _arg1;
menus[current].show();
isHidden = false;
};
}
public function update():void{
var _local1:*;
if ((((current >= 0)) && ((current < menus.length)))){
_local1 = menus[current].getNextMenu();
if (_local1 == HIDE_MENU){
hide();
} else {
changeState(_local1);
};
};
}
public function show():void{
if ((((current >= 0)) && ((current < menus.length)))){
menus[current].show();
isHidden = false;
};
}
}
}//package lib.ui
Section 9
//MenuRoot (lib.ui.MenuRoot)
package lib.ui {
import flash.display.*;
public class MenuRoot {
var parent:DisplayObjectContainer;
protected var rootClip:MovieClip;
protected var nextMenu:int;
public function MenuRoot(_arg1:DisplayObjectContainer, _arg2:MovieClip, _arg3:Boolean, _arg4:Boolean):void{
nextMenu = MenuList.CURRENT_MENU;
parent = _arg1;
rootClip = _arg2;
parent.addChild(rootClip);
if (_arg3){
rootClip.x = parent.stage.stageWidth;
};
if (_arg4){
rootClip.y = parent.stage.stageHeight;
};
hide();
}
public function hide():void{
rootClip.visible = false;
}
public function cleanup():void{
rootClip.parent.removeChild(rootClip);
}
public function getNextMenu():int{
var _local1:*;
_local1 = nextMenu;
nextMenu = MenuList.CURRENT_MENU;
return (_local1);
}
public function show():void{
rootClip.visible = true;
}
}
}//package lib.ui
Section 10
//Window (lib.ui.Window)
package lib.ui {
import flash.display.*;
import lib.*;
import flash.events.*;
import flash.geom.*;
public class Window {
var size:Point;
var offset:Point;
var screenOffset:Point;
var parent:DisplayObjectContainer;
var margin:int;
var dragEndCommands:Array;
var clickCommands:Array;
var moved:Boolean;
var border:WindowBorder;
var background:MovieClip;
var foreground:Array;
var backgroundSize:Point;
var hoverCommands:Array;
var screen:Point;
var backParent:Sprite;
var scrollCommands:Array;
var images:ImageList;
var dragBeginCommands:Array;
public function Window(_arg1:DisplayObjectContainer, _arg2:Point, _arg3:Point, _arg4:int, _arg5:ImageList, _arg6:WindowBorder, _arg7:MovieClip, _arg8:int):void{
var _local9:int;
super();
offset = new Point(0, 0);
screen = new Point(0, 0);
screenOffset = new Point(0, 0);
size = _arg2.clone();
moved = false;
parent = _arg1;
backParent = new Sprite();
parent.addChild(backParent);
backParent.mouseEnabled = false;
background = _arg7;
margin = _arg8;
backParent.addChild(background);
border = _arg6;
border.init(parent);
background.addEventListener(MouseEvent.CLICK, click);
background.addEventListener(MouseEvent.MOUSE_DOWN, dragBegin);
background.stage.addEventListener(MouseEvent.MOUSE_UP, dragEnd);
background.addEventListener(MouseEvent.MOUSE_MOVE, hover);
background.addEventListener(MouseEvent.MOUSE_OVER, hover);
background.addEventListener(MouseEvent.MOUSE_OUT, hoverOut);
background.cacheAsBitmap = true;
foreground = new Array(_arg4);
_local9 = 0;
while (_local9 < foreground.length) {
foreground[_local9] = new Sprite();
parent.addChild(foreground[_local9]);
foreground[_local9].mouseChildren = false;
foreground[_local9].mouseEnabled = false;
_local9++;
};
clickCommands = new Array();
hoverCommands = new Array();
scrollCommands = new Array();
dragBeginCommands = new Array();
dragEndCommands = new Array();
images = _arg5;
resizeBackground(_arg3);
}
public function resizeBackground(_arg1:Point):void{
backgroundSize = _arg1.clone();
setScreenSize();
scrollWindow(new Point(0, 0));
}
function click(_arg1:MouseEvent):void{
runCommand(new Point(((Math.floor(_arg1.stageX) + offset.x) - screen.x), ((Math.floor(_arg1.stageY) + offset.y) - screen.y)), clickCommands);
}
public function getOffset():Point{
return (offset);
}
function dragEnd(_arg1:MouseEvent):void{
runCommand(new Point(((Math.floor(_arg1.stageX) + offset.x) - screen.x), ((Math.floor(_arg1.stageY) + offset.y) - screen.y)), dragEndCommands);
}
function setScreenSize():void{
var _local1:*;
screen.x = screenOffset.x;
screen.y = screenOffset.y;
if (backgroundSize.x < size.x){
screen.x = (screen.x + Math.floor(((size.x - backgroundSize.x) / 2)));
};
if (backgroundSize.y < size.y){
screen.y = (screen.y + Math.floor(((size.y - backgroundSize.y) / 2)));
};
backParent.x = screen.x;
backParent.y = screen.y;
for each (_local1 in foreground) {
_local1.x = screen.x;
_local1.y = screen.y;
};
}
public function setOffset(_arg1:Point):void{
offset.x = _arg1.x;
offset.y = _arg1.y;
updatePos();
}
public function getLayer(_arg1:int):Sprite{
return (foreground[_arg1]);
}
public function scrollWindow(_arg1:Point):void{
offset.plusEquals(_arg1);
updatePos();
}
public function setScreenOffset(_arg1:Point):void{
size.x = ((size.x - _arg1.x) + screenOffset.x);
size.y = ((size.y - _arg1.y) + screenOffset.y);
screenOffset = _arg1.clone();
setScreenSize();
scrollWindow(new Point(0, 0));
}
public function cleanup():void{
var _local1:*;
for each (_local1 in foreground) {
_local1.parent.removeChild(_local1);
};
background.removeEventListener(MouseEvent.CLICK, click);
background.removeEventListener(MouseEvent.MOUSE_DOWN, dragBegin);
background.stage.removeEventListener(MouseEvent.MOUSE_UP, dragEnd);
background.removeEventListener(MouseEvent.MOUSE_MOVE, hover);
background.removeEventListener(MouseEvent.MOUSE_OVER, hover);
background.removeEventListener(MouseEvent.MOUSE_OUT, hoverOut);
border.cleanup();
background.parent.removeChild(background);
backParent.parent.removeChild(backParent);
}
public function isMoved():Boolean{
return (moved);
}
public function addScrollCommand(_arg1:Function):void{
scrollCommands.push(_arg1);
}
public function addHoverCommand(_arg1:Function):void{
hoverCommands.push(_arg1);
}
public function swapLayers(_arg1:int, _arg2:int):void{
parent.swapChildren(foreground[_arg1], foreground[_arg2]);
}
function hover(_arg1:MouseEvent):void{
runCommand(new Point(((Math.floor(_arg1.stageX) + offset.x) - screen.x), ((Math.floor(_arg1.stageY) + offset.y) - screen.y)), hoverCommands);
}
function runCommand(_arg1:Point, _arg2:Array):void{
var _local3:*;
var _local4:*;
if (_arg2.length > 0){
for each (_local3 in _arg2) {
_local4 = _local3(_arg1);
if (_local4){
break;
};
};
};
}
public function resizeWindow(_arg1:Point):void{
size = _arg1.clone();
size.x = (size.x - screenOffset.x);
size.y = (size.y - screenOffset.y);
setScreenSize();
scrollWindow(new Point(0, 0));
}
public function addDragEndCommand(_arg1:Function):void{
dragEndCommands.push(_arg1);
}
public function getCenter():Point{
return (new Point(Math.floor(((backgroundSize.x - size.x) / 2)), Math.floor(((backgroundSize.y - size.y) / 2))));
}
public function updatePos():void{
var _local1:*;
var _local2:*;
moved = true;
_local1 = Math.max(margin, (-(backgroundSize.x) + size.x));
_local2 = Math.max(margin, (-(backgroundSize.y) + size.y));
if (offset.x < (0 - margin)){
offset.x = (0 - margin);
};
if (offset.x > ((backgroundSize.x - size.x) + _local1)){
offset.x = ((backgroundSize.x - size.x) + _local1);
};
if (backgroundSize.x < size.x){
offset.x = 0;
};
if (offset.y < (0 - margin)){
offset.y = (0 - margin);
};
if (offset.y >= ((backgroundSize.y - size.y) + _local2)){
offset.y = ((backgroundSize.y - size.y) + _local2);
};
if (backgroundSize.y < size.y){
offset.y = 0;
};
backParent.scrollRect = new Rectangle(offset.x, offset.y, Math.min(size.x, backgroundSize.x), Math.min(size.y, backgroundSize.y));
border.update(offset, screen, backgroundSize, size);
runCommand(offset, scrollCommands);
}
function dragBegin(_arg1:MouseEvent):void{
runCommand(new Point(((Math.floor(_arg1.stageX) + offset.x) - screen.x), ((Math.floor(_arg1.stageY) + offset.y) - screen.y)), dragBeginCommands);
}
public function getScreen():Point{
return (screen);
}
public function addClickCommand(_arg1:Function):void{
clickCommands.push(_arg1);
}
public function toRelative(_arg1:Point):Point{
return (new Point(((_arg1.x - offset.x) + screen.x), ((_arg1.y - offset.y) + screen.y)));
}
public function clearMoved():void{
moved = false;
}
function hoverOut(_arg1:MouseEvent):void{
runCommand(null, hoverCommands);
}
public function addDragBeginCommand(_arg1:Function):void{
dragBeginCommands.push(_arg1);
}
public function getSize():Point{
return (size);
}
}
}//package lib.ui
Section 11
//WindowBorder (lib.ui.WindowBorder)
package lib.ui {
import flash.display.*;
import lib.*;
public class WindowBorder {
protected var clip:Sprite;
public function WindowBorder():void{
}
public function init(_arg1:DisplayObjectContainer):void{
clip = new Sprite();
_arg1.addChild(clip);
clip.cacheAsBitmap = true;
}
public function cleanup():void{
clip.parent.removeChild(clip);
}
public function update(_arg1:Point, _arg2:Point, _arg3:Point, _arg4:Point):void{
clip.graphics.clear();
clip.graphics.lineStyle(10, 0);
clip.graphics.drawRect((-(_arg1.x) + _arg2.x), (-(_arg1.y) + _arg2.y), _arg3.x, _arg3.y);
}
}
}//package lib.ui
Section 12
//Box (lib.Box)
package lib {
public class Box {
var limit:Point;
var size:Point;
var offset:Point;
public function Box(_arg1:Point, _arg2:Point):void{
offset = new Point(Math.floor(Math.min(_arg1.x, _arg2.x)), Math.floor(Math.min(_arg1.y, _arg2.y)));
limit = new Point(Math.floor(Math.max(_arg1.x, _arg2.x)), Math.floor(Math.max(_arg1.y, _arg2.y)));
size = new Point((limit.x - offset.x), (limit.y - offset.y));
}
public function getLimit():Point{
return (limit);
}
public function search(_arg1:Function, _arg2, ... _args){
var _local4:*;
var _local5:Point;
var _local6:Array;
_local4 = null;
_local5 = new Point(0, 0);
_local6 = [_local5];
_local6 = _local6.concat(_args);
_local5.y = offset.y;
while (_local5.y < limit.y) {
_local5.x = offset.x;
while (_local5.x < limit.x) {
_local4 = _arg1.apply(_arg2, _local6);
if (_local4 != null){
break;
};
_local5.x++;
};
if (_local4 != null){
break;
};
_local5.y++;
};
return (_local4);
}
public function getOffset():Point{
return (offset);
}
public function foreach(_arg1:Function, _arg2, ... _args):void{
var _local4:Point;
var _local5:Array;
_local4 = new Point(0, 0);
_local5 = [_local4];
_local5 = _local5.concat(_args);
_local4.y = offset.y;
while (_local4.y < limit.y) {
_local4.x = offset.x;
while (_local4.x < limit.x) {
_arg1.apply(_arg2, _local5);
_local4.x++;
};
_local4.y++;
};
}
public function containsBox(_arg1:Box):Boolean{
return ((((((((_arg1.offset.x >= offset.x)) && ((_arg1.offset.y >= offset.y)))) && ((_arg1.limit.x <= limit.x)))) && ((_arg1.limit.y <= limit.y))));
}
public function isSome(_arg1:Function, _arg2, ... _args):Boolean{
var _local4:*;
var _local5:Point;
var _local6:Array;
_local4 = false;
_local5 = new Point(0, 0);
_local6 = [_local5];
_local6 = _local6.concat(_args);
_local5.y = offset.y;
while (_local5.y < limit.y) {
_local5.x = offset.x;
while (_local5.x < limit.x) {
_local4 = ((_local4) || (_arg1.apply(_arg2, _local6)));
if (_local4){
break;
};
_local5.x++;
};
if (_local4){
break;
};
_local5.y++;
};
return (_local4);
}
public function foreachBorder(_arg1:Function, _arg2, ... _args):void{
var _local4:Point;
var _local5:Array;
_local4 = new Point(0, 0);
_local5 = [_local4];
_local5 = _local5.concat(_args);
_local4.y = offset.y;
while (_local4.y < limit.y) {
_local4.x = offset.x;
_arg1.apply(_arg2, _local5);
_local4.x = (limit.x - 1);
_arg1.apply(_arg2, _local5);
_local4.y++;
};
_local4.x = (offset.x + 1);
while (_local4.x < (limit.x - 1)) {
_local4.y = offset.y;
_arg1.apply(_arg2, _local5);
_local4.y = (limit.y - 1);
_arg1.apply(_arg2, _local5);
_local4.x++;
};
}
public function getSize():Point{
return (size);
}
public function moveTo(_arg1:Point):void{
offset = _arg1.clone();
limit = new Point((offset.x + size.x), (offset.y + size.y));
}
public function clone():Box{
return (new Box(offset, limit));
}
public function isAll(_arg1:Function, _arg2, ... _args):Boolean{
var _local4:*;
var _local5:Point;
var _local6:Array;
_local4 = true;
_local5 = new Point(0, 0);
_local6 = [_local5];
_local6 = _local6.concat(_args);
_local5.y = offset.y;
while (_local5.y < limit.y) {
_local5.x = offset.x;
while (_local5.x < limit.x) {
_local4 = ((_local4) && (_arg1.apply(_arg2, _local6)));
_local5.x++;
};
_local5.y++;
};
return (_local4);
}
public function contains(_arg1:Point):Boolean{
return ((((((((_arg1.x >= offset.x)) && ((_arg1.x < limit.x)))) && ((_arg1.y >= offset.y)))) && ((_arg1.y < limit.y))));
}
public static function createSize(_arg1:Point, _arg2:Point):Box{
return (new Box(_arg1, new Point((_arg1.x + _arg2.x), (_arg1.y + _arg2.y))));
}
}
}//package lib
Section 13
//ChangeList (lib.ChangeList)
package lib {
import logic.*;
import ui.*;
public class ChangeList {
var changes:DList;
public function ChangeList():void{
changes = new DList();
}
public function add(_arg1:Function):void{
changes.pushBack(_arg1);
}
public function execute(_arg1:Model, _arg2:View):void{
var _local3:*;
while (!(changes.isEmpty())) {
_local3 = changes.front();
changes.popFront();
_local3.call(null, _arg1, _arg2);
};
}
public function getSize():int{
return (changes.size());
}
}
}//package lib
Section 14
//DIterator (lib.DIterator)
package lib {
public class DIterator {
protected var current:DNode;
public function DIterator():void{
this.current = null;
}
public function setNode(_arg1:DNode):void{
this.current = _arg1;
}
public function increment():void{
if (this.current != null){
this.current = this.current.next;
};
}
public function isValid():Boolean{
return (!((this.current == null)));
}
public function get(){
if (this.current == null){
return (null);
};
return (this.current.data);
}
public function getNode():DNode{
return (this.current);
}
public function decrement():void{
if (this.current != null){
this.current = this.current.prev;
};
}
public function clone():DIterator{
var _local1:*;
_local1 = new DIterator();
_local1.copyFrom(this);
return (_local1);
}
public function copyFrom(_arg1:DIterator):void{
this.current = _arg1.current;
}
}
}//package lib
Section 15
//DList (lib.DList)
package lib {
public class DList {
protected var head:DNode;
protected var tail:DNode;
protected var currentSize:int;
public function DList():void{
head = null;
tail = null;
currentSize = 0;
}
public function find(_arg1):DIterator{
var _local2:*;
_local2 = frontIterator();
while (_local2.isValid()) {
if (_local2.get() == _arg1){
break;
};
_local2.increment();
};
return (_local2);
}
public function size():int{
return (currentSize);
}
public function isEmpty():Boolean{
return ((head == null));
}
public function remove(_arg1):void{
var _local2:*;
_local2 = find(_arg1);
if (_local2.isValid()){
erase(_local2);
};
}
public function erase(_arg1:DIterator):DIterator{
var _local2:DIterator;
_local2 = new DIterator();
if (_arg1.isValid()){
if (_arg1.getNode() == head){
popFront();
_local2.setNode(head);
} else {
if (_arg1.getNode() == tail){
popBack();
_local2.setNode(tail);
} else {
_arg1.getNode().prev.next = _arg1.getNode().next;
_arg1.getNode().next.prev = _arg1.getNode().prev;
_local2.setNode(_arg1.getNode().next);
currentSize--;
};
};
};
return (_local2);
}
public function front(){
if (head != null){
return (head.data);
};
return (null);
}
public function clear():void{
head = null;
tail = null;
currentSize = 0;
}
public function back(){
if (tail != null){
return (tail.data);
};
return (null);
}
public function pushBack(_arg1):void{
var _local2:DNode;
_local2 = new DNode();
_local2.data = _arg1;
if (tail == null){
head = _local2;
tail = _local2;
} else {
tail.next = _local2;
_local2.prev = tail;
tail = _local2;
};
currentSize++;
}
public function backIterator():DIterator{
var _local1:DIterator;
_local1 = new DIterator();
_local1.setNode(tail);
return (_local1);
}
public function pushFront(_arg1):void{
var _local2:DNode;
_local2 = new DNode();
_local2.data = _arg1;
if (head == null){
head = _local2;
tail = _local2;
} else {
head.prev = _local2;
_local2.next = head;
head = _local2;
};
currentSize++;
}
public function frontIterator():DIterator{
var _local1:DIterator;
_local1 = new DIterator();
_local1.setNode(head);
return (_local1);
}
public function popFront():void{
if (((!((head == null))) && (!((tail == null))))){
if (head == tail){
head = null;
tail = null;
} else {
head.next.prev = null;
head = head.next;
};
currentSize--;
};
}
public function insert(_arg1:DIterator, _arg2):DIterator{
var _local3:DIterator;
var _local4:DNode;
_local3 = new DIterator();
if (!_arg1.isValid()){
pushBack(_arg2);
_local3.setNode(tail);
} else {
if (_arg1.getNode() == head){
pushFront(_arg2);
_local3.setNode(head);
} else {
_local4 = new DNode();
_local4.data = _arg2;
_local4.prev = _arg1.getNode().prev;
_local4.next = _arg1.getNode();
_arg1.getNode().prev.next = _local4;
_arg1.getNode().prev = _local4;
_local3.setNode(_local4);
currentSize++;
};
};
return (_local3);
}
public function popBack():void{
if (((!((head == null))) && (!((tail == null))))){
if (head == tail){
head = null;
tail = null;
} else {
tail.prev.next = null;
tail = tail.prev;
};
currentSize--;
};
}
}
}//package lib
Section 16
//DNode (lib.DNode)
package lib {
public class DNode {
public var prev:DNode;
public var next:DNode;
public var data;
public function DNode():void{
this.next = null;
this.prev = null;
this.data = null;
}
}
}//package lib
Section 17
//Grid (lib.Grid)
package lib {
public class Grid {
var buffer:Array;
var size:Point;
public function Grid(_arg1:Point):void{
size = _arg1.clone();
buffer = new Array((size.x * size.y));
}
public function set(_arg1:Point, _arg2):void{
if ((((((((_arg1.x < 0)) || ((_arg1.x >= size.x)))) || ((_arg1.y < 0)))) || ((_arg1.y >= size.y)))){
throw (new Error(("Grid out of bounds: " + _arg1.toString())));
};
buffer[(_arg1.x + (_arg1.y * size.x))] = _arg2;
}
public function get(_arg1:Point){
if ((((((((_arg1.x < 0)) || ((_arg1.x >= size.x)))) || ((_arg1.y < 0)))) || ((_arg1.y >= size.y)))){
throw (new Error(("Grid out of bounds: " + _arg1.toString())));
};
return (buffer[(_arg1.x + (_arg1.y * size.x))]);
}
public function getSize():Point{
return (size);
}
}
}//package lib
Section 18
//Point (lib.Point)
package lib {
public class Point {
public var x:int;
public var y:int;
public function Point(_arg1:int, _arg2:int):void{
x = _arg1;
y = _arg2;
}
public function save(){
return ({x:this.x, y:this.y});
}
public function plusEquals(_arg1:Point):void{
x = (x + _arg1.x);
y = (y + _arg1.y);
}
public function toString():String{
return ((((("(" + String(x)) + ", ") + String(y)) + ")"));
}
public function clone():Point{
return (new Point(x, y));
}
public static function debug(_arg1:Point):String{
if (_arg1 == null){
return ("<NULL>");
};
return (_arg1.toString());
}
public static function save(_arg1:Point){
return (_arg1.save());
}
public static function load(_arg1):Point{
if (_arg1 != null){
return (new Point(_arg1.x, _arg1.y));
};
return (null);
}
public static function isEqual(_arg1:Point, _arg2:Point):Boolean{
return ((((((_arg1 == null)) && ((_arg2 == null)))) || (((((((!((_arg1 == null))) && (!((_arg2 == null))))) && ((_arg1.x == _arg2.x)))) && ((_arg1.y == _arg2.y))))));
}
public static function isAdjacent(_arg1:Point, _arg2:Point):Boolean{
var _local3:Boolean;
var _local4:int;
var _local5:int;
_local3 = false;
if ((((_arg1 == null)) && ((_arg2 == null)))){
_local3 = true;
} else {
if (((!((_arg1 == null))) && (!((_arg2 == null))))){
_local4 = Math.floor(Math.abs((_arg1.x - _arg2.x)));
_local5 = Math.floor(Math.abs((_arg1.y - _arg2.y)));
_local3 = (((((_local4 <= 1)) && ((_local5 == 0)))) || ((((_local5 <= 1)) && ((_local4 == 0)))));
};
};
return (_local3);
}
public static function isHorizontallyAdjacent(_arg1:Point, _arg2:Point):Boolean{
var _local3:Boolean;
var _local4:int;
var _local5:int;
_local3 = false;
if ((((_arg1 == null)) && ((_arg2 == null)))){
_local3 = true;
} else {
if (((!((_arg1 == null))) && (!((_arg2 == null))))){
_local4 = Math.floor(Math.abs((_arg1.x - _arg2.x)));
_local5 = Math.floor(Math.abs((_arg1.y - _arg2.y)));
_local3 = (((_local5 == 0)) && ((_local4 <= 1)));
};
};
return (_local3);
}
public static function isVerticallyAdjacent(_arg1:Point, _arg2:Point):Boolean{
var _local3:Boolean;
var _local4:int;
var _local5:int;
_local3 = false;
if ((((_arg1 == null)) && ((_arg2 == null)))){
_local3 = true;
} else {
if (((!((_arg1 == null))) && (!((_arg2 == null))))){
_local4 = Math.floor(Math.abs((_arg1.x - _arg2.x)));
_local5 = Math.floor(Math.abs((_arg1.y - _arg2.y)));
_local3 = (((_local4 == 0)) && ((_local5 <= 1)));
};
};
return (_local3);
}
}
}//package lib
Section 19
//Util (lib.Util)
package lib {
public class Util {
public static function shuffle(_arg1:Array):void{
var _local2:*;
var _local3:*;
var _local4:*;
_local2 = (_arg1.length - 1);
while (_local2 > 0) {
_local3 = rand((_local2 + 1));
_local4 = _arg1[_local2];
_arg1[_local2] = _arg1[_local3];
_arg1[_local3] = _local4;
_local2--;
};
}
public static function rand(_arg1:int):int{
return (Math.floor((Math.random() * _arg1)));
}
public static function makeChange(_arg1:Function, ... _args):Function{
var func = _arg1;
var boundArgs = _args;
return (function (... _args){
return (func.apply(null, boundArgs.concat(_args)));
});
}
}
}//package lib
Section 20
//ChangeItem (logic.change.ChangeItem)
package logic.change {
import lib.*;
import logic.*;
import ui.*;
public class ChangeItem {
public static function setRotation(_arg1:Point, _arg2:Dir, _arg3:Model, _arg4:View):void{
var _local5:*;
_local5 = _arg3.getMap().getTile(_arg1);
if (_local5.item != null){
_local5.item.setRotation(_arg2);
};
}
public static function push(_arg1:Point, _arg2:Dir, _arg3:Model, _arg4:View):void{
var _local5:*;
_local5 = _arg3.getMap().getTile(_arg1);
if (_local5.item != null){
_local5.item.push(_arg2, _arg3.getChanges());
};
}
public static function startMove(_arg1:Point, _arg2:Dir, _arg3:Model, _arg4:View):void{
var _local5:*;
var _local6:*;
var _local7:*;
_local5 = Dir.step(_arg1, _arg2);
if (((_arg3.getMap().insideMap(_arg1)) && (_arg3.getMap().insideMap(_local5)))){
_local6 = _arg3.getMap().getTile(_arg1);
_local7 = _arg3.getMap().getTile(Dir.step(_arg1, _arg2));
if (((!((_local6.item == null))) && ((_local7.itemNext == null)))){
_local6.item.moveStarted();
_local7.itemNext = _local6.item;
_local6.item = null;
} else {
_arg3.getChanges().add(Util.makeChange(ChangeWorld.itemBlocked, Item.COLLISION, _arg1));
_arg3.getChanges().add(Util.makeChange(ChangeWorld.itemBlocked, Item.COLLISION, _local5));
};
} else {
_arg3.getChanges().add(Util.makeChange(ChangeWorld.itemBlocked, Item.COLLISION, _arg1));
};
}
public static function finishMove(_arg1:Point, _arg2:Model, _arg3:View):void{
var _local4:*;
_local4 = _arg2.getMap().getTile(_arg1);
if (((!((_local4.itemNext == null))) && ((_local4.item == null)))){
_local4.item = _local4.itemNext;
_local4.itemNext = null;
} else {
_arg2.getChanges().add(Util.makeChange(ChangeWorld.itemBlocked, Item.COLLISION, _arg1));
};
}
public static function shrink(_arg1:Item, _arg2:Model, _arg3:View):void{
var _local4:*;
_local4 = _arg1.getPos();
_arg1.startShrinking();
_arg2.getMap().getTile(_local4).item = null;
}
public static function destroy(_arg1:Item, _arg2:Model, _arg3:View):void{
_arg2.removeItem(_arg1);
_arg1.cleanup();
}
public static function create(_arg1:int, _arg2:Point, _arg3:Boolean, _arg4:Model, _arg5:View):void{
var _local6:*;
var _local7:*;
if (_arg4.getMap().canPlaceItem(_arg2)){
_local6 = new ItemView(_arg1, _arg2, _arg5.getImages());
_local7 = new Item(_arg1, _arg2, _local6, _arg3);
_arg4.addItem(_local7);
} else {
_arg4.getChanges().add(Util.makeChange(ChangeWorld.itemBlocked, Item.COLLISION, _arg2));
};
}
}
}//package logic.change
Section 21
//ChangePart (logic.change.ChangePart)
package logic.change {
import lib.*;
import logic.*;
import ui.*;
public class ChangePart {
public static function destroyPartWires(_arg1:Part, _arg2:Model, _arg3:View):void{
_arg1.cleanupWires(_arg2.removeWire);
}
public static function mix(_arg1:Point, _arg2:Dir, _arg3:Model, _arg4:View):void{
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
var _local10:*;
_local5 = Dir.step(_arg1, _arg2.clockwise());
_local6 = Dir.step(_arg1, _arg2.counter());
if (((_arg3.getMap().insideMap(_local5)) && (_arg3.getMap().insideMap(_local6)))){
_local7 = _arg3.getMap().getTile(_local5).item;
_local8 = _arg3.getMap().getTile(_local6).item;
if (((((((!((_local7 == null))) && (!((_local8 == null))))) && (_local7.isPaint()))) && (_local8.isPaint()))){
_local9 = _local7.mixFrom(_local8);
_arg3.getChanges().add(Util.makeChange(ChangeItem.create, (Item.PAINT_BEGIN + _local9), _arg1.clone(), false));
_arg3.getChanges().add(Util.makeChange(ChangeItem.push, _arg1.clone(), _arg2));
_arg3.getChanges().add(Util.makeChange(ChangeItem.shrink, _local7));
_arg3.getChanges().add(Util.makeChange(ChangeItem.shrink, _local8));
_local10 = _arg3.getMap().getTile(_arg1).part;
if (_local10 != null){
_local10.beginOp(null);
};
};
};
}
public static function addWire(_arg1:Point, _arg2:Point, _arg3:Model, _arg4:View):void{
var _local5:*;
var _local6:*;
var _local7:*;
if (((_arg3.getMap().canStartWire(_arg1)) && (_arg3.getMap().canEndWire(_arg1, _arg2)))){
_local5 = _arg3.getMap().getTile(_arg2).part.findWire(_arg1);
if (_local5 != null){
_arg3.removeWire(_local5);
_local5.cleanup();
} else {
_local6 = new WireView(_arg4.getWireParent().getParent(), _arg1, _arg2);
_local7 = new Wire(_arg1, _arg2, _local6);
_arg3.addWire(_local7);
};
};
}
static function pushHelper(_arg1:Point, _arg2:Dir, _arg3:Model, _arg4:View):void{
if (_arg3.getMap().getTile(_arg1).item != null){
_arg3.getChanges().add(Util.makeChange(ChangeItem.push, _arg1.clone(), _arg2));
};
}
public static function spray(_arg1:Point, _arg2:Dir, _arg3:Model, _arg4:View):void{
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
_local5 = Dir.step(_arg1, _arg2.opposite());
_local6 = Dir.step(_arg1, _arg2);
if (((_arg3.getMap().insideMap(_local5)) && (_arg3.getMap().insideMap(_local6)))){
_local7 = _arg3.getMap().getTile(_local5).item;
_local8 = _arg3.getMap().getTile(_local6).item;
if (((((((!((_local7 == null))) && (!((_local8 == null))))) && (!(_local7.isTile())))) && (_local8.isTile()))){
if (_local7.isPaint()){
_local8.paintFrom(_local7);
} else {
if (_local7.isStencil()){
_local8.stencilFrom(_local7);
} else {
if (_local7.isSolvent()){
_local8.solvent();
} else {
if (_local7.isGlue()){
_local8.glue();
};
};
};
};
_local9 = _arg3.getMap().getTile(_arg1).part;
if (_local9 != null){
_local9.beginOp(_local7);
};
_arg3.getChanges().add(Util.makeChange(ChangeItem.shrink, _local7));
};
};
}
public static function pushLine(_arg1:Point, _arg2:Dir, _arg3:Model, _arg4:View):void{
_arg3.getMap().forEachInLine(_arg1, _arg2, pushHelper, null, _arg2, _arg3, _arg4);
}
public static function copyItem(_arg1:Point, _arg2:Dir, _arg3:Model, _arg4:View):void{
var _local5:*;
var _local6:*;
_local5 = Dir.step(_arg1, _arg2.opposite());
if (_arg3.getMap().insideMap(_local5)){
_local6 = _arg3.getMap().getTile(_local5).item;
if (_local6 != null){
_arg3.getChanges().add(Util.makeChange(ChangeItem.create, _local6.getType(), _arg1.clone(), false));
_arg3.getChanges().add(Util.makeChange(ChangeItem.push, _arg1.clone(), _arg2));
_arg3.getChanges().add(Util.makeChange(ChangeItem.setRotation, _arg1.clone(), _local6.getDir()));
};
};
}
public static function clearNeighbors(_arg1:Point, _arg2:Model, _arg3:View):void{
var _local4:*;
var _local5:*;
var _local6:*;
for each (_local4 in Dir.dirs) {
_local5 = Dir.step(_arg1, _local4);
if (_arg2.getMap().insideMap(_local5)){
_local6 = _arg2.getMap().getTile(_local5);
if (_local6.part != null){
_local6.part.setClear();
};
};
};
}
public static function destroySpec(_arg1:PartSpec, _arg2:Model, _arg3:View):void{
_arg2.removeSpec(_arg1);
}
public static function createSpec(_arg1:PartSpec, _arg2:Model, _arg3:View):void{
_arg2.addSpec(_arg1);
}
public static function destroy(_arg1:Part, _arg2:Model, _arg3:View):void{
_arg2.removePart(_arg1);
_arg1.removeAllTracks();
_arg2.getMap().retrackAll(_arg1.getPos());
_arg1.cleanup();
}
public static function rotate(_arg1:Point, _arg2:Boolean, _arg3:Model, _arg4:View):void{
var _local5:*;
var _local6:*;
if (_arg3.getMap().insideMap(_arg1)){
_local5 = _arg3.getMap().getTile(_arg1).item;
if (((!((_local5 == null))) && (((_local5.isTile()) || (_local5.isStencil()))))){
_local5.rotate(_arg2);
_local6 = _arg3.getMap().getTile(_arg1).part;
if (_local6 != null){
_local6.beginOp(null);
};
};
};
}
public static function create(_arg1:PartSpec, _arg2:Model, _arg3:View):void{
var _local4:*;
var _local5:*;
if (_arg2.getMap().canPlacePart(_arg1.pos)){
_arg2.getMap().untrackAll(_arg1.pos);
_local4 = new PartView(_arg1, _arg3.getImages(), _arg3.getAnims());
_local5 = new Part(_arg1, _local4, _arg2.getMap());
_arg2.addPart(_local5);
_arg2.getMap().retrackAll(_arg1.pos);
};
}
public static function setNeighbors(_arg1:Point, _arg2:Model, _arg3:View):void{
var _local4:*;
var _local5:*;
var _local6:*;
for each (_local4 in Dir.dirs) {
_local5 = Dir.step(_arg1, _local4);
if (_arg2.getMap().insideMap(_local5)){
_local6 = _arg2.getMap().getTile(_local5);
if (_local6.part != null){
_local6.part.setSet();
};
};
};
}
}
}//package logic.change
Section 22
//ChangeWorld (logic.change.ChangeWorld)
package logic.change {
import lib.*;
import logic.*;
import ui.*;
public class ChangeWorld {
public static function stepPlay(_arg1:Model, _arg2:View):void{
_arg1.beginStepping();
}
public static function resumePlay(_arg1:Model, _arg2:View):void{
_arg1.resume();
}
static function addExplosion(_arg1:Point, _arg2:Model, _arg3:View):void{
var _local4:*;
_local4 = new ExplosionView(Map.toCenterPixel(_arg1), _arg3.getImages(), _arg3.getAnims());
_arg3.addExplosion(_local4);
Sound.play(Sound.JAM);
}
public static function slowPlay(_arg1:Model, _arg2:View):void{
_arg1.slow();
}
public static function togglePlay(_arg1:Model, _arg2:View):void{
if (_arg1.isPlaying()){
_arg1.stopPlay();
_arg2.stopPlay();
} else {
_arg1.startPlay();
_arg2.startPlay();
};
}
public static function itemBlocked(_arg1:int, _arg2:Point, _arg3:Model, _arg4:View):void{
if (_arg3.getMap().insideMap(_arg2)){
destroyGroup(_arg3.getMap().getTile(_arg2).item, _arg3, _arg4);
destroyGroup(_arg3.getMap().getTile(_arg2).itemNext, _arg3, _arg4);
};
}
public static function pausePlay(_arg1:Model, _arg2:View):void{
_arg1.pause();
}
public static function speedPlay(_arg1:Model, _arg2:View):void{
_arg1.speed();
}
static function destroyGroup(_arg1:Item, _arg2:Model, _arg3:View):void{
var _local4:*;
var _local5:*;
var _local6:*;
if (_arg1 != null){
_local4 = _arg1.getGroup();
_local5 = _local4.getMembers();
for each (_local6 in _local5) {
_arg2.getChanges().add(Util.makeChange(addExplosion, _local6.getPos().clone()));
_arg2.getChanges().add(Util.makeChange(ChangeItem.destroy, _local6));
};
};
}
}
}//package logic.change
Section 23
//ButtonStatus (logic.ButtonStatus)
package logic {
public class ButtonStatus {
var buttons:int;
public static var WIRE_BUTTON = 26;
public function ButtonStatus():void{
buttons = 67112959;
}
public function setAllStatus(_arg1:int):void{
buttons = _arg1;
}
public function toggleStatus(_arg1:int):void{
buttons = ((1 << _arg1) ^ buttons);
}
public function getStatus(_arg1:int):Boolean{
return ((((buttons >> _arg1) & 1) == 1));
}
public function getAllStatus():int{
return (buttons);
}
}
}//package logic
Section 24
//Goal (logic.Goal)
package logic {
import lib.*;
import ui.*;
import flash.utils.*;
public class Goal {
var sprite:GoalView;
var tiles:Array;
var area:Box;
var count:int;
static var START_COUNT = 5;
static var minSize = new Point(3, 3);
public function Goal(_arg1:GoalView, _arg2:Box):void{
sprite = _arg1;
area = _arg2.clone();
count = START_COUNT;
tiles = new Array();
sprite.updateCount(count);
}
public function showNormal():void{
sprite.updateBounds(area, GoalView.boxColorNormal);
}
public function check(_arg1:Map, _arg2:ChangeList):Boolean{
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
_local3 = null;
_local4 = true;
for each (_local5 in tiles) {
_local6 = _local5.check(_arg1);
if (((!((_local6 == null))) && ((((_local3 == null)) || ((_local6 == _local3)))))){
_local3 = _local6;
} else {
_local4 = false;
break;
};
};
_local4 = ((((_local4) && (!((_local3 == null))))) && ((_local3.getSize() == tiles.length)));
if (_local4){
removeItems(_arg1, _arg2);
count--;
Sound.play(Sound.PLACE);
};
sprite.updateCount(count);
return ((count <= 0));
}
function findTile(_arg1:Point):int{
var _local2:*;
var _local3:*;
_local2 = -1;
_local3 = 0;
while (_local3 < tiles.length) {
if (Point.isEqual(_arg1, tiles[_local3].getPos())){
_local2 = _local3;
break;
};
_local3++;
};
return (_local2);
}
public function move(_arg1:Dir, _arg2:Map):void{
var _local3:*;
var _local4:*;
_local3 = area.getOffset();
area.moveTo(Dir.step(_local3, _arg1));
if (_arg2.insideMapBox(area)){
sprite.updateBounds(area, GoalView.boxColorSelected);
for each (_local4 in tiles) {
_local4.move(_arg1);
};
} else {
area.moveTo(_local3);
};
}
public function removeTile(_arg1:Point):void{
var _local2:*;
_local2 = findTile(_arg1);
if (_local2 != -1){
tiles[_local2].cleanup();
tiles.splice(_local2, 1);
};
}
public function contract(_arg1:Dir, _arg2:Map):void{
var _local3:*;
var _local4:*;
var _local5:*;
_local3 = Dir.remainder(area, _arg1, 1);
_local4 = true;
for each (_local5 in tiles) {
if (!_local3.contains(_local5.getPos())){
_local4 = false;
break;
};
};
if (((((_local4) && ((_local3.getSize().x >= minSize.x)))) && ((_local3.getSize().y >= minSize.y)))){
area = _local3;
sprite.updateBounds(_local3, GoalView.boxColorSelected);
};
}
function removeItems(_arg1:Map, _arg2:ChangeList):void{
var _local3:*;
for each (_local3 in tiles) {
_local3.removeItem(_arg1, _arg2);
};
}
public function reset():void{
count = START_COUNT;
sprite.updateCount(count);
}
public function contains(_arg1:Point):Boolean{
return (area.contains(_arg1));
}
public function expand(_arg1:Dir, _arg2:Map):void{
var _local3:*;
_local3 = Dir.extend(area, _arg1, 1);
if (_arg2.insideMapBox(_local3)){
area = _local3;
sprite.updateBounds(area, GoalView.boxColorSelected);
};
}
public function cleanup():void{
var _local1:*;
for each (_local1 in tiles) {
_local1.cleanup();
};
sprite.cleanup();
}
public function getTile(_arg1:Point):RegionList{
var _local2:*;
var _local3:*;
_local2 = null;
_local3 = findTile(_arg1);
if (_local3 != -1){
_local2 = tiles[_local3].getColor();
};
return (_local2);
}
public function getBounds():Box{
return (area);
}
public function showSelected():void{
sprite.updateBounds(area, GoalView.boxColorSelected);
}
public function save(_arg1:ByteArray):void{
var _local2:*;
var _local3:*;
SaveLoad.savePoint(_arg1, area.getOffset());
SaveLoad.savePoint(_arg1, area.getLimit());
_arg1.writeShort(tiles.length);
for each (_local2 in tiles) {
SaveLoad.savePoint(_arg1, _local2.getPos());
};
for each (_local3 in tiles) {
_local3.getColor().save(_arg1);
};
}
public function changeTile(_arg1:Point, _arg2:RegionList):void{
var _local3:*;
var _local4:*;
_local3 = findTile(_arg1);
if (_local3 != -1){
tiles[_local3].changeColor(_arg2);
} else {
_local4 = new GoalTile(sprite.makeTileSprite(_arg1), _arg1);
_local4.changeColor(_arg2);
tiles.push(_local4);
};
}
}
}//package logic
Section 25
//GoalSpec (logic.GoalSpec)
package logic {
import lib.*;
public class GoalSpec {
public var color:Array;
public var pos:Array;
public var bounds:Box;
public function GoalSpec(_arg1:Box):void{
bounds = _arg1.clone();
pos = new Array();
color = new Array();
}
}
}//package logic
Section 26
//GoalTile (logic.GoalTile)
package logic {
import lib.*;
import ui.*;
import logic.change.*;
public class GoalTile {
var color:RegionList;
var sprite:GoalTileView;
var pos:Point;
public function GoalTile(_arg1:GoalTileView, _arg2:Point):void{
sprite = _arg1;
pos = _arg2.clone();
color = new RegionList();
sprite.updateColor(color);
}
public function cleanup():void{
sprite.cleanup();
}
public function check(_arg1:Map):Group{
var _local2:*;
var _local3:*;
_local2 = null;
_local3 = _arg1.getTile(pos).item;
if (((((!((_local3 == null))) && (_local3.isTile()))) && (_local3.hasColor(color)))){
_local2 = _local3.getGroup();
};
return (_local2);
}
public function getColor():RegionList{
return (color.clone());
}
public function move(_arg1:Dir):void{
Dir.stepMod(pos, _arg1);
sprite.updatePos(pos);
}
public function removeItem(_arg1:Map, _arg2:ChangeList):void{
var _local3:*;
_local3 = _arg1.getTile(pos).item;
if (_local3 != null){
_arg2.add(Util.makeChange(ChangeItem.destroy, _local3));
};
}
public function changeColor(_arg1:RegionList):void{
color.copyFrom(_arg1);
sprite.updateColor(color);
}
public function getPos():Point{
return (pos);
}
}
}//package logic
Section 27
//Group (logic.Group)
package logic {
import lib.*;
import logic.change.*;
public class Group {
var force:Dir;
var isForced:Boolean;
var members:Array;
public function Group(_arg1:Item):void{
isForced = false;
force = Dir.east;
members = new Array();
members.push(_arg1);
}
public function mergeFrom(_arg1:Group, _arg2:ChangeList):void{
var _local3:*;
for each (_local3 in _arg1.members) {
_local3.changeGroup(this);
members.push(_local3);
};
_arg1.members = [];
if (!isForced){
force = _arg1.force;
isForced = _arg1.isForced;
} else {
if (((_arg1.isForced) && (!((_arg1.force == force))))){
_arg2.add(Util.makeChange(ChangeWorld.itemBlocked, Item.JAM, members[0].getPos().clone()));
};
};
}
public function getMembers():Array{
return (members.slice());
}
public function isGlued():Boolean{
return ((members.length > 1));
}
public function addForce(_arg1:Dir, _arg2:ChangeList):void{
if (((!(isForced)) || ((force == _arg1)))){
force = _arg1;
isForced = true;
} else {
_arg2.add(Util.makeChange(ChangeWorld.itemBlocked, Item.JAM, members[0].getPos().clone()));
};
}
public function removeMember(_arg1:Item):void{
var _local2:*;
_local2 = members.indexOf(_arg1);
if (_local2 != -1){
members.splice(_local2, 1);
};
}
public function hasForce():Boolean{
return (isForced);
}
public function getForce():Dir{
return (force);
}
public function getSize():int{
return (members.length);
}
public function spawn(_arg1:Item):Group{
var _local2:*;
_local2 = new Group(_arg1);
_local2.isForced = isForced;
_local2.force = force;
removeMember(_arg1);
return (_local2);
}
public function clearForce():void{
isForced = false;
}
}
}//package logic
Section 28
//Item (logic.Item)
package logic {
import lib.*;
import ui.*;
import logic.change.*;
public class Item {
var dir:Dir;
var group:Group;
var hasSprayed:Boolean;
var hasStuck:Boolean;
var isRotating:Boolean;
var isClockwise:Boolean;
var type:int;
var isShrinking:Boolean;
var isStart:Boolean;
var sprite:ItemView;
var pos:Point;
var isGrowing:Boolean;
var sticky:Boolean;
var color:RegionList;
var didMove:Boolean;
public static var SOLVENT = 2;
public static var STENCIL_BEGIN = 4;
public static var PAINT_BEGIN = 9;
static var ROTATE_INCREMENT = (90 / Model.DELAY_MAX);
public static var TILE = 1;
public static var COLLISION = 0;
public static var GLUE = 3;
public static var JAM = 1;
public static var STENCIL_END = 9;
public static var PAINT_END = 25;
public function Item(_arg1:int, _arg2:Point, _arg3:ItemView, _arg4:Boolean):void{
type = _arg1;
pos = _arg2.clone();
sprite = _arg3;
isStart = _arg4;
group = new Group(this);
sticky = false;
hasStuck = false;
didMove = false;
isRotating = false;
isClockwise = false;
hasSprayed = false;
isShrinking = false;
isGrowing = !(isStart);
dir = Dir.east;
if (isStart){
sprite.normalSize();
};
color = new RegionList();
if (isTile()){
sprite.updateColor(color);
} else {
sprite.updateColor(null);
};
if (isPaint()){
color.setColor(0, (type - PAINT_BEGIN));
} else {
if (isStencil()){
color.addStencil(RegionList.stencils[(type - STENCIL_BEGIN)]);
};
};
}
public function setRotation(_arg1:Dir):void{
if (isStencil()){
while (dir != _arg1) {
color.clockwise();
dir = dir.clockwise();
};
};
sprite.updateRotation(dir);
isRotating = false;
}
public function stencilFrom(_arg1:Item):void{
if (((isTile()) && (_arg1.isStencil()))){
color.addStencil(_arg1.color.getStencil());
hasSprayed = true;
};
}
public function moveStarted():void{
if (didMove){
pos = Dir.step(pos, group.getForce());
};
}
public function isTile():Boolean{
return ((type == TILE));
}
public function checkSticky(_arg1:Item, _arg2:ChangeList){
if (((((((isTile()) && (_arg1.isTile()))) && (((sticky) || (_arg1.sticky))))) && (!((group == _arg1.group))))){
group.mergeFrom(_arg1.group, _arg2);
hasStuck = true;
_arg1.hasStuck = true;
};
}
public function push(_arg1:Dir, _arg2:ChangeList):void{
group.addForce(_arg1, _arg2);
}
public function finalize(_arg1:ChangeList):void{
if (didMove){
didMove = false;
_arg1.add(Util.makeChange(ChangeItem.finishMove, pos.clone()));
};
}
public function cleanup():void{
sprite.cleanup();
group.removeMember(this);
}
public function clearForce(_arg1:ChangeList):void{
if (hasSprayed){
sprite.updateColor(color);
sprite.updateSticky(sticky);
hasSprayed = false;
};
group.clearForce();
sprite.move(pos);
if (isShrinking){
_arg1.add(Util.makeChange(ChangeItem.destroy, this));
};
if (isGrowing){
isGrowing = false;
sprite.normalSize();
};
}
public function mixFrom(_arg1:Item):int{
var _local2:*;
_local2 = 0;
if (((isPaint()) && (_arg1.isPaint()))){
_local2 = RegionList.mix(color.getColor(0), _arg1.color.getColor(0));
};
return (_local2);
}
public function finalizeSticky():void{
if (hasStuck){
sticky = false;
hasStuck = false;
sprite.updateSticky(sticky);
};
}
public function getPos():Point{
return (pos);
}
public function getType():int{
return (type);
}
public function isStencil():Boolean{
return ((((type >= STENCIL_BEGIN)) && ((type < STENCIL_END))));
}
public function glue():void{
if (isTile()){
sticky = true;
hasSprayed = true;
};
}
public function changeGroup(_arg1:Group):void{
group = _arg1;
}
public function paintFrom(_arg1:Item):void{
if (((isTile()) && (_arg1.isPaint()))){
color.paint(_arg1.color.getColor(0));
hasSprayed = true;
};
}
public function isSolvent():Boolean{
return ((type == SOLVENT));
}
public function isSticky():Boolean{
return (sticky);
}
public function solvent():void{
if (isTile()){
color.solvent();
if (group.isGlued()){
group = group.spawn(this);
};
sticky = false;
hasSprayed = true;
};
}
public function getGroup():Group{
return (group);
}
public function step(_arg1:ChangeList):void{
if (isRotating){
isRotating = false;
if (isClockwise){
color.clockwise();
dir = dir.clockwise();
} else {
color.counter();
dir = dir.counter();
};
if (isTile()){
sprite.updateRotation(Dir.east);
sprite.updateColor(color);
} else {
sprite.updateRotation(dir);
};
};
if (group.hasForce()){
didMove = true;
_arg1.add(Util.makeChange(ChangeItem.startMove, pos.clone(), group.getForce()));
};
}
public function isPaint():Boolean{
return ((((type >= PAINT_BEGIN)) && ((type < PAINT_END))));
}
public function getDir():Dir{
return (dir);
}
public function rotate(_arg1:Boolean):void{
if (((((isTile()) || (isStencil()))) && (!(group.isGlued())))){
isRotating = true;
isClockwise = _arg1;
};
}
public function animate():void{
if (group.hasForce()){
sprite.moveDir(group.getForce(), Model.MOVE_SPEED);
};
if (isRotating){
if (isClockwise){
sprite.rotate(ROTATE_INCREMENT);
} else {
sprite.rotate(-(ROTATE_INCREMENT));
};
};
if (isShrinking){
sprite.shrink();
} else {
if (isGrowing){
sprite.grow();
};
};
}
public function startShrinking():void{
isShrinking = true;
}
public function hasColor(_arg1:RegionList):Boolean{
return (((isTile()) && (RegionList.isEqual(color, _arg1))));
}
public function isGlue():Boolean{
return ((type == GLUE));
}
}
}//package logic
Section 29
//Map (logic.Map)
package logic {
import lib.*;
public class Map {
var tiles:Grid;
var bounds:Box;
public static var maxSize = new Point(60, 60);
public static var halfTileSize:int = 16;
public static var tileSize:int = 32;
public static var minSize = new Point(7, 7);
public function Map(_arg1:Point):void{
var _local2:*;
super();
tiles = new Grid(maxSize);
bounds = Box.createSize(new Point(0, 0), _arg1);
_local2 = Box.createSize(new Point(0, 0), maxSize);
_local2.foreach(initTile, this);
}
public function insideMap(_arg1:Point):Boolean{
return (bounds.contains(_arg1));
}
public function forEachInLine(_arg1:Point, _arg2:Dir, _arg3:Function, _arg4, ... _args):void{
var _local6:Point;
var _local7:Point;
var _local8:Array;
var _local9:*;
var _local10:*;
var _local11:*;
var _local12:*;
var _local13:*;
var _local14:*;
_local6 = _arg1.clone();
_local7 = _arg1.clone();
Dir.stepMod(_local7, _arg2);
_local8 = [_local6];
_local8 = _local8.concat(_args);
_local9 = false;
_local10 = true;
while (((!(_local9)) && (insideMap(_local7)))) {
_local11 = getTile(_local6);
_local12 = getTile(_local7);
_local13 = (((((_local11.part == null)) || (!(_local11.part.isConveyer())))) || (_local10));
_local14 = (((_local12.part == null)) || (!(_local12.part.isBarrier())));
_local9 = ((!(_local13)) || (!(_local14)));
if (!_local9){
_arg3.apply(_arg4, _local8);
Dir.stepMod(_local6, _arg2);
Dir.stepMod(_local7, _arg2);
};
_local10 = false;
};
}
public function getTile(_arg1:Point):MapTile{
var _local2:*;
_local2 = null;
if (insideMap(_arg1)){
_local2 = tiles.get(_arg1);
};
return (_local2);
}
public function canStartWire(_arg1:Point):Boolean{
return (((((insideMap(_arg1)) && (!((tiles.get(_arg1).part == null))))) && (tiles.get(_arg1).part.canStartWire())));
}
public function retrackAll(_arg1:Point):void{
var _local2:*;
var _local3:*;
_local2 = new Point(0, 0);
_local3 = 0;
_local2.y = _arg1.y;
_local3 = 0;
while (_local3 < bounds.getLimit().x) {
_local2.x = _local3;
retrack(_local2);
_local3++;
};
_local2.x = _arg1.x;
_local3 = 0;
while (_local3 < bounds.getLimit().y) {
_local2.y = _local3;
retrack(_local2);
_local3++;
};
}
public function canPlacePart(_arg1:Point):Boolean{
return (((insideMap(_arg1)) && ((tiles.get(_arg1).part == null))));
}
public function insideMapBox(_arg1:Box):Boolean{
return (bounds.containsBox(_arg1));
}
public function setTile(_arg1:Point, _arg2:MapTile):void{
tiles.set(_arg1, _arg2);
}
public function changeSize(_arg1:Dir, _arg2:int):Boolean{
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:Point;
_local3 = false;
_local4 = Dir.walk(bounds.getSize(), _arg1, _arg2);
if ((((((((_local4.x >= minSize.x)) && ((_local4.x <= maxSize.x)))) && ((_local4.y >= minSize.y)))) && ((_local4.y <= maxSize.y)))){
if (_arg2 < 0){
_local5 = Dir.slice(bounds, _arg1, -(_arg2));
_local6 = Dir.remainder(bounds, _arg1, -(_arg2));
_local7 = true;
_local8 = new Point(0, 0);
_local8.y = _local5.getOffset().y;
while (_local8.y < _local5.getLimit().y) {
_local8.x = _local5.getOffset().x;
while (_local8.x < _local5.getLimit().x) {
if (getTile(_local8).part != null){
_local7 = false;
break;
};
_local8.x++;
};
_local8.y++;
};
if (_local7){
bounds = _local6;
_local3 = true;
};
} else {
bounds = Dir.extend(bounds, _arg1, _arg2);
_local3 = true;
};
};
return (_local3);
}
function untrack(_arg1:Point):void{
if (getTile(_arg1).part != null){
getTile(_arg1).part.removeAllTracks();
};
}
public function untrackAll(_arg1:Point):void{
var _local2:*;
var _local3:*;
_local2 = new Point(0, 0);
_local3 = 0;
_local2.y = _arg1.y;
_local3 = 0;
while (_local3 < bounds.getLimit().x) {
_local2.x = _local3;
untrack(_local2);
_local3++;
};
_local2.x = _arg1.x;
_local3 = 0;
while (_local3 < bounds.getLimit().y) {
_local2.y = _local3;
untrack(_local2);
_local3++;
};
}
public function getSize():Point{
return (bounds.getSize());
}
function retrack(_arg1:Point):void{
if (getTile(_arg1).part != null){
getTile(_arg1).part.addAllTracks();
};
}
public function canPlaceItem(_arg1:Point):Boolean{
return (((((insideMap(_arg1)) && ((tiles.get(_arg1).item == null)))) && ((tiles.get(_arg1).itemNext == null))));
}
function initTile(_arg1:Point):void{
setTile(_arg1, new MapTile());
}
public function canEndWire(_arg1:Point, _arg2:Point):Boolean{
return (((((((!(Point.isEqual(_arg1, _arg2))) && (insideMap(_arg2)))) && (!((tiles.get(_arg2).part == null))))) && (tiles.get(_arg2).part.canEndWire(_arg1, this))));
}
public static function toPixel(_arg1:Point):Point{
return (new Point((_arg1.x * tileSize), (_arg1.y * tileSize)));
}
public static function toTile(_arg1:Point):Point{
return (new Point(Math.floor((_arg1.x / tileSize)), Math.floor((_arg1.y / tileSize))));
}
public static function toCenterPixelBox(_arg1:Box):Point{
var _local2:*;
var _local3:*;
_local2 = _arg1.getOffset();
_local3 = _arg1.getSize();
return (new Point(((_local2.x * tileSize) + (_local3.x * halfTileSize)), ((_local2.y * tileSize) + (_local3.y * halfTileSize))));
}
public static function toCenterPixel(_arg1:Point):Point{
return (new Point(((_arg1.x * tileSize) + halfTileSize), ((_arg1.y * tileSize) + halfTileSize)));
}
}
}//package logic
Section 30
//MapTile (logic.MapTile)
package logic {
public class MapTile {
public var item:Item;
public var part:Part;
public var itemNext:Item;
public var track:Track;
public function MapTile():void{
part = null;
item = null;
itemNext = null;
track = null;
}
}
}//package logic
Section 31
//Model (logic.Model)
package logic {
import lib.*;
import ui.*;
import logic.change.*;
public class Model {
var delay:int;
var wires:Array;
var settings:GameSettings;
var view:View;
var specs:Array;
var stepCount:int;
var paused:Boolean;
var stepping:Boolean;
var changes:ChangeList;
var items:Array;
var map:Map;
var parts:Array;
var goals:Array;
var fast:Boolean;
var isPlay:Boolean;
public static var MOVE_FRAMES:int = 16;
public static var HALF_DELAY:int = Math.floor((DELAY_MAX / 2));
public static var MOVE_SPEED:int = 2;
static var DELAY_MAX:int = MOVE_FRAMES;
public function Model(_arg1:GameSettings, _arg2:View, _arg3:Function):void{
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
super();
settings = _arg1;
view = _arg2;
map = new Map(settings.getSize());
changes = new ChangeList();
parts = new Array();
items = new Array();
wires = new Array();
specs = new Array();
isPlay = false;
fast = false;
paused = false;
stepping = false;
delay = DELAY_MAX;
goals = new Array();
view.setModel(settings, changes, map, saveMap, goals, forEachPart, _arg3, countParts, countSteps);
settings.initMap(changes);
for each (_local4 in settings.getGoals()) {
_local5 = new GoalView(_local4.bounds, view.getImages());
_local6 = new Goal(_local5, _local4.bounds.clone());
_local7 = 0;
while (_local7 < _local4.pos.length) {
_local6.changeTile(_local4.pos[_local7], _local4.color[_local7]);
_local7++;
};
goals.push(_local6);
};
if (settings.isMovie()){
changes.add(Util.makeChange(ChangeWorld.togglePlay));
};
}
public function slow():void{
fast = false;
}
function stepSensors():void{
var _local1:*;
for each (_local1 in parts) {
_local1.updateSensor(map);
};
}
public function beginStepping():void{
stepping = true;
fast = false;
}
function countParts():int{
return (specs.length);
}
function stepConveyers():void{
var _local1:*;
for each (_local1 in parts) {
_local1.stepConveyer(changes);
};
}
public function getChanges():ChangeList{
return (changes);
}
public function removePart(_arg1:Part):void{
var _local2:*;
var _local3:*;
_local2 = map.getTile(_arg1.getPos());
if (_local2.part == _arg1){
_local2.part = null;
};
_local3 = parts.indexOf(_arg1);
if (_local3 != -1){
parts.splice(_local3, 1);
};
}
function checkGoals():void{
var _local1:*;
var _local2:*;
_local1 = true;
for each (_local2 in goals) {
if (!_local2.check(map, changes)){
_local1 = false;
};
};
if (((((((((_local1) && (!(settings.isEditor())))) && (!(settings.isMovie())))) && (!((settings.getId() == "sandbox"))))) && ((goals.length > 0)))){
view.declareVictory();
};
}
function clearForce():void{
var _local1:*;
for each (_local1 in items) {
_local1.clearForce(changes);
};
}
function saveMap():String{
return (SaveLoad.saveMap(map.getSize(), specs, wires, goals, settings.getButtonStatus(), settings.getName()));
}
function stepGlue():void{
var _local1:*;
var _local2:*;
var _local3:*;
var _local4:*;
for each (_local1 in items) {
if (_local1.isSticky()){
for each (_local2 in Dir.dirs) {
_local3 = Dir.step(_local1.getPos(), _local2);
if (map.insideMap(_local3)){
_local4 = map.getTile(_local3).item;
if (_local4 != null){
_local1.checkSticky(_local4, changes);
};
};
};
};
};
}
public function cleanup():void{
var _local1:*;
var _local2:*;
var _local3:*;
var _local4:*;
for each (_local1 in parts) {
_local1.cleanup();
};
for each (_local2 in items) {
_local2.cleanup();
};
for each (_local3 in wires) {
_local3.cleanup();
};
for each (_local4 in goals) {
_local4.cleanup();
};
}
public function getMap():Map{
return (map);
}
public function removeWire(_arg1:Wire):void{
var _local2:*;
map.getTile(_arg1.getSource()).part.removeOutput(_arg1);
map.getTile(_arg1.getDest()).part.removeInput(_arg1);
_local2 = wires.indexOf(_arg1);
if (_local2 != -1){
wires.splice(_local2, 1);
};
}
public function isPlaying():Boolean{
return (isPlay);
}
public function resume():void{
paused = false;
}
function initLogic():Array{
var _local1:*;
var _local2:*;
_local1 = new Array();
for each (_local2 in parts) {
_local2.resetLogic();
if (_local2.isRoot()){
_local1.push(_local2);
};
};
return (_local1);
}
public function addPart(_arg1:Part):void{
map.getTile(_arg1.getPos()).part = _arg1;
parts.push(_arg1);
}
public function startPlay():void{
var _local1:*;
if (!isPlay){
stepCount = 0;
isPlay = true;
paused = false;
stepping = false;
fast = false;
delay = (DELAY_MAX - 1);
for each (_local1 in parts) {
_local1.startPlay(changes);
};
};
}
public function removeItem(_arg1:Item):void{
var _local2:*;
var _local3:*;
_local2 = map.getTile(_arg1.getPos());
if (_local2.item == _arg1){
_local2.item = null;
};
if (_local2.itemNext == _arg1){
_local2.itemNext = null;
};
_local3 = items.indexOf(_arg1);
if (_local3 != -1){
items.splice(_local3, 1);
};
}
function finalizeItems():void{
var _local1:*;
for each (_local1 in items) {
_local1.finalize(changes);
};
}
public function addWire(_arg1:Wire):void{
map.getTile(_arg1.getSource()).part.addOutput(_arg1);
map.getTile(_arg1.getDest()).part.addInput(_arg1);
wires.push(_arg1);
}
public function speed():void{
fast = true;
}
function stepRotaters():void{
var _local1:*;
for each (_local1 in parts) {
_local1.stepRotater(changes);
};
}
function step():void{
changes.execute(this, view);
if (((isPlay) && (((!(paused)) || (stepping))))){
if (delay == (MOVE_FRAMES - 1)){
ifPlaying(moveItems);
ifPlaying(stepParts);
ifPlaying(stepRotaters);
} else {
if ((((delay < (MOVE_FRAMES - 1))) && ((delay > (HALF_DELAY - 1))))){
ifPlaying(moveItems);
} else {
if (delay == (HALF_DELAY - 1)){
ifPlaying(moveItems);
ifPlaying(clearForce);
ifPlaying(stepConveyers);
ifPlaying(stepGlue);
ifPlaying(finalizeGlue);
ifPlaying(checkGoals);
stepping = false;
stepCount++;
} else {
if (delay > 0){
ifPlaying(moveItems);
} else {
if (delay == 0){
ifPlaying(moveItems);
ifPlaying(stepItems);
ifPlaying(finalizeItems);
ifPlaying(checkGoals);
ifPlaying(stepSensors);
ifPlaying(stepLogic);
delay = DELAY_MAX;
};
};
};
};
};
delay--;
};
}
function ifPlaying(_arg1:Function):void{
if (isPlay){
_arg1();
changes.execute(this, view);
};
}
public function addItem(_arg1:Item):void{
map.getTile(_arg1.getPos()).item = _arg1;
items.push(_arg1);
}
public function stopPlay():void{
var _local1:*;
var _local2:*;
var _local3:*;
if (isPlay){
isPlay = false;
while (parts.length > 0) {
ChangePart.destroy(parts[0], this, view);
};
while (items.length > 0) {
ChangeItem.destroy(items[0], this, view);
};
for each (_local1 in specs) {
ChangePart.create(_local1, this, view);
};
for each (_local2 in wires) {
map.getTile(_local2.getSource()).part.addOutput(_local2);
map.getTile(_local2.getDest()).part.addInput(_local2);
_local2.show();
};
for each (_local3 in goals) {
_local3.reset();
};
};
}
function countSteps():int{
return (stepCount);
}
function stepItems():void{
var _local1:*;
for each (_local1 in items) {
_local1.step(changes);
};
}
public function removeSpec(_arg1:PartSpec){
var _local2:*;
_local2 = specs.indexOf(_arg1);
if (_local2 != -1){
specs.splice(_local2, 1);
};
}
function moveItems():void{
var _local1:*;
for each (_local1 in items) {
_local1.animate();
};
}
function stepLogic():void{
var _local1:*;
var _local2:*;
_local1 = initLogic();
while (_local1.length > 0) {
_local2 = _local1.pop();
_local2.powerChildren(map, _local1);
};
}
function finalizeGlue():void{
var _local1:*;
for each (_local1 in items) {
_local1.finalizeSticky();
};
}
function stepParts():void{
var _local1:*;
for each (_local1 in parts) {
_local1.step(changes);
};
}
public function enterFrame():void{
step();
if (fast){
step();
};
}
public function pause():void{
paused = true;
stepping = true;
fast = false;
}
public function addSpec(_arg1:PartSpec){
specs.push(_arg1);
}
public function forEachPart(_arg1:Function):void{
var _local2:*;
for each (_local2 in parts) {
_arg1(_local2);
};
}
}
}//package logic
Section 32
//Part (logic.Part)
package logic {
import lib.*;
import ui.*;
import logic.change.*;
public class Part {
var power:Boolean;
var dir:Dir;
var outputs:Array;
var shouldSet:Boolean;
var memPower:Boolean;
var parentsLeft:int;
var type:int;
var spec:PartSpec;
var sprite:PartView;
var pos:Point;
var map:Map;
var shouldClear:Boolean;
var inputs:Array;
public static var ALL = 0;
public static var SOME = 1;
public static var TRIANGLE = 16;
public static var WHITE = 21;
public static var YELLOW = 24;
public static var BIG_CIRCLE = 20;
public static var CONVEYER = 6;
public static var BARRIER = 7;
public static var STENCIL_END = 21;
public static var MAGENTA = 23;
public static var CYAN = 22;
public static var SOLVENT = 14;
public static var STENCIL_BEGIN = 16;
public static var SMALL_CIRCLE = 18;
public static var CLEAR = 5;
public static var TILE = 13;
public static var NONE = 2;
public static var SENSOR = 9;
public static var MEM = 3;
static var paintType = [0, 8, 4, 2, 15];
public static var PAINT_END = 26;
public static var SET = 4;
public static var GLUE = 15;
public static var PAINT_BEGIN = 21;
public static var RECTANGLE = 17;
public static var ROTATER = 8;
public static var COPIER = 12;
public static var CIRCLE = 19;
public static var BLACK = 25;
public static var MIXER = 11;
public static var SPRAYER = 10;
public function Part(_arg1:PartSpec, _arg2:PartView, _arg3:Map):void{
spec = _arg1;
type = spec.type;
pos = spec.pos.clone();
dir = spec.dir;
power = spec.power;
memPower = spec.power;
shouldSet = false;
shouldClear = false;
inputs = new Array();
outputs = new Array();
sprite = _arg2;
parentsLeft = 0;
map = _arg3;
}
function updateTrack(_arg1:Point){
if (!Point.isEqual(pos, _arg1)){
map.getTile(_arg1).track.update();
};
}
public function stepConveyer(_arg1:ChangeList):void{
if (power){
if (type == CONVEYER){
_arg1.add(Util.makeChange(ChangePart.pushLine, pos.clone(), dir));
} else {
if (type == MIXER){
_arg1.add(Util.makeChange(ChangePart.mix, pos.clone(), dir));
} else {
if (type == COPIER){
_arg1.add(Util.makeChange(ChangePart.copyItem, pos.clone(), dir));
};
};
};
};
}
public function addOutput(_arg1:Wire){
outputs.push(_arg1);
}
public function stepRotater(_arg1:ChangeList):void{
var _local2:*;
if (((power) && ((type == ROTATER)))){
_local2 = (((dir == Dir.east)) || ((dir == Dir.north)));
_arg1.add(Util.makeChange(ChangePart.rotate, pos.clone(), _local2));
};
}
public function canEndWire(_arg1:Point, _arg2:Map):Boolean{
var _local3:*;
_local3 = _arg2.getTile(_arg1).part;
return (((((((((!((_local3 == null))) && (!((type == SENSOR))))) && (!((type == BARRIER))))) && ((type < TILE)))) && (!(hasChild(_arg2, _local3)))));
}
public function setClear():void{
shouldClear = true;
}
public function canStartWire():Boolean{
return ((((((((((type == SENSOR)) || ((type == ALL)))) || ((type == SOME)))) || ((type == NONE)))) || ((type == MEM))));
}
public function getPos():Point{
return (pos);
}
public function setSet():void{
shouldSet = true;
}
function hasChild(_arg1:Map, _arg2:Part):Boolean{
var _local3:*;
var _local4:*;
var _local5:*;
_local3 = false;
if (type != MEM){
for each (_local4 in outputs) {
_local5 = _arg1.getTile(_local4.getDest()).part;
_local3 = ((((_local3) || ((_local5 == _arg2)))) || (_local5.hasChild(_arg1, _arg2)));
if (_local3){
break;
};
};
};
return (_local3);
}
public function cleanup(){
sprite.cleanup();
}
public function removeOutput(_arg1:Wire){
var _local2:*;
_local2 = outputs.indexOf(_arg1);
if (_local2 != -1){
outputs.splice(_local2, 1);
};
}
public function removeInput(_arg1:Wire){
var _local2:*;
_local2 = inputs.indexOf(_arg1);
if (_local2 != -1){
inputs.splice(_local2, 1);
};
}
function removeTrack(_arg1:Point):void{
if (!Point.isEqual(pos, _arg1)){
map.getTile(_arg1).track.removeParent(this);
};
}
public function addInput(_arg1:Wire){
inputs.push(_arg1);
}
function addTrack(_arg1:Point):void{
if (!Point.isEqual(pos, _arg1)){
if (map.getTile(_arg1).track == null){
map.getTile(_arg1).track = new Track(sprite.getTrackSprite(), _arg1, this);
} else {
map.getTile(_arg1).track.addParent(this);
};
};
}
public function powerChildren(_arg1:Map, _arg2:Array):void{
var _local3:*;
var _local4:*;
for each (_local3 in outputs) {
_local4 = _local3.sendPower(_arg1, power);
if (_local4 != null){
_arg2.push(_local4);
};
};
}
public function isRoot():Boolean{
return ((((parentsLeft <= 0)) || ((type == MEM))));
}
public function isBarrier():Boolean{
return (isBarrierType(type));
}
public function getSpec():PartSpec{
return (spec);
}
public function startPlay(_arg1:ChangeList):void{
var _local2:*;
if (type >= TILE){
_local2 = ((type - TILE) + 1);
if ((((type >= PAINT_BEGIN)) && ((type < PAINT_END)))){
_local2 = (Item.PAINT_BEGIN + paintType[(type - PAINT_BEGIN)]);
};
_arg1.add(Util.makeChange(ChangeItem.create, _local2, pos.clone(), true));
if ((((type >= STENCIL_BEGIN)) && ((type < STENCIL_END)))){
_arg1.add(Util.makeChange(ChangeItem.setRotation, pos.clone(), dir));
};
hide();
};
updatePower();
}
function updatePower():void{
if (type == CONVEYER){
map.forEachInLine(pos, dir, updateTrack, this);
};
sprite.updatePower(power);
}
public function hide():void{
sprite.hide();
}
public function cleanupWires(_arg1:Function):void{
var _local2:*;
_local2 = null;
while (inputs.length > 0) {
_local2 = inputs[0];
_arg1(_local2);
_local2.cleanup();
};
while (outputs.length > 0) {
_local2 = outputs[0];
_arg1(_local2);
_local2.cleanup();
};
}
public function step(_arg1:ChangeList):void{
if (power){
if (type == SET){
_arg1.add(Util.makeChange(ChangePart.setNeighbors, pos.clone()));
} else {
if (type == CLEAR){
_arg1.add(Util.makeChange(ChangePart.clearNeighbors, pos.clone()));
} else {
if (type == SPRAYER){
_arg1.add(Util.makeChange(ChangePart.spray, pos.clone(), dir));
} else {
if (type == COPIER){
sprite.animate(null);
};
};
};
};
};
}
public function modifyPart(_arg1:Point, _arg2:Dir, _arg3:Boolean):void{
var _local4:*;
var _local5:*;
dir = _arg2;
spec.dir = _arg2;
sprite.updateDir(dir);
pos = _arg1.clone();
spec.pos = _arg1.clone();
sprite.updatePos(pos);
for each (_local4 in outputs) {
_local4.changeSource(pos);
};
for each (_local5 in inputs) {
_local5.changeDest(pos);
};
power = _arg3;
memPower = _arg3;
spec.power = _arg3;
sprite.updatePower(_arg3);
}
public function resetLogic():void{
parentsLeft = inputs.length;
if (type == MEM){
if (((shouldSet) && (shouldClear))){
power = !(power);
memPower = power;
} else {
if (shouldSet){
power = true;
memPower = true;
} else {
if (shouldClear){
power = false;
memPower = false;
} else {
power = memPower;
};
};
};
shouldSet = false;
shouldClear = false;
updatePower();
};
if (parentsLeft > 0){
if ((((type == ALL)) || ((type == NONE)))){
power = true;
} else {
if (type == MEM){
memPower = false;
} else {
power = false;
};
};
};
}
public function getDir():Dir{
return (dir);
}
public function isPowered():Boolean{
return (power);
}
public function sendPower(_arg1:Boolean):Boolean{
parentsLeft--;
if (type == ALL){
if (!_arg1){
power = false;
};
} else {
if (type == NONE){
if (_arg1){
power = false;
};
} else {
if (type == MEM){
if (((_arg1) && (!(memPower)))){
memPower = _arg1;
};
} else {
if (((_arg1) && (!(power)))){
power = _arg1;
};
};
};
};
if (parentsLeft <= 0){
updatePower();
};
return ((((parentsLeft <= 0)) && (!((type == MEM)))));
}
public function findWire(_arg1:Point):Wire{
var _local2:*;
var _local3:*;
_local2 = null;
for each (_local3 in inputs) {
if (Point.isEqual(_local3.getSource(), _arg1)){
_local2 = _local3;
break;
};
};
return (_local2);
}
public function isConveyer():Boolean{
return ((type == CONVEYER));
}
public function updateSensor(_arg1:Map){
if (type == SENSOR){
power = !((_arg1.getTile(pos).item == null));
updatePower();
};
}
public function removeAllTracks():void{
if (type == CONVEYER){
map.forEachInLine(pos, dir, removeTrack, this);
};
}
public function addAllTracks():void{
if (type == CONVEYER){
map.forEachInLine(pos, dir, addTrack, this);
};
}
public function beginOp(_arg1:Item):void{
sprite.animate(_arg1);
}
public function isFixed():Boolean{
return (spec.fixed);
}
public function show():void{
sprite.show();
}
public static function isBarrierType(_arg1:int):Boolean{
return ((((((((_arg1 == BARRIER)) || ((_arg1 == SPRAYER)))) || ((_arg1 == MIXER)))) || ((_arg1 == COPIER))));
}
public static function canPower(_arg1:int):Boolean{
return ((((_arg1 < TILE)) && (!((_arg1 == BARRIER)))));
}
public static function canRotate(_arg1:int):Boolean{
return ((((((((((((_arg1 == CONVEYER)) || ((_arg1 == ROTATER)))) || ((_arg1 == SPRAYER)))) || ((_arg1 == MIXER)))) || ((_arg1 == COPIER)))) || ((((_arg1 >= STENCIL_BEGIN)) && ((_arg1 < STENCIL_END))))));
}
}
}//package logic
Section 33
//PartSpec (logic.PartSpec)
package logic {
import lib.*;
import flash.utils.*;
public class PartSpec {
public var fixed:Boolean;
public var power:Boolean;
public var type:int;
public var dir:Dir;
public var pos:Point;
public function PartSpec(_arg1:int, _arg2:Point, _arg3:Dir, _arg4:Boolean):void{
type = _arg1;
pos = _arg2;
dir = _arg3;
power = _arg4;
fixed = false;
}
public function save(_arg1:ByteArray):void{
var _local2:*;
_arg1.writeByte(type);
SaveLoad.savePoint(_arg1, pos);
_local2 = dir.toIndex();
if (power){
_local2 = (_local2 | 4);
};
if (fixed){
_local2 = (_local2 | 8);
};
_arg1.writeByte(_local2);
}
public function clone():PartSpec{
var _local1:*;
_local1 = new PartSpec(type, pos, dir, power);
_local1.fixed = fixed;
return (_local1);
}
}
}//package logic
Section 34
//Track (logic.Track)
package logic {
import lib.*;
import ui.*;
public class Track {
var sprite:TrackView;
var parents:Array;
var pos:Point;
public function Track(_arg1:TrackView, _arg2:Point, _arg3:Part):void{
sprite = _arg1;
pos = _arg2.clone();
parents = [_arg3];
sprite.update(pos, getDir(), false);
}
public function update():void{
sprite.update(pos, getDir(), true);
}
public function addParent(_arg1:Part):void{
var _local2:*;
_local2 = parents.indexOf(_arg1);
if (_local2 == -1){
parents.push(_arg1);
sprite.update(pos, getDir(), false);
};
}
public function removeParent(_arg1:Part):void{
var _local2:*;
_local2 = parents.indexOf(_arg1);
if (_local2 != -1){
parents.splice(_local2, 1);
};
if (parents.length == 0){
sprite.destroy();
} else {
sprite.update(pos, getDir(), false);
};
}
function getDir():Dir{
var _local1:*;
var _local2:*;
_local1 = null;
for each (_local2 in parents) {
if (((_local2.isPowered()) && ((_local1 == null)))){
_local1 = _local2.getDir();
} else {
if (_local2.isPowered()){
_local1 = null;
break;
};
};
};
return (_local1);
}
public function getParents():Array{
return (parents);
}
}
}//package logic
Section 35
//Wire (logic.Wire)
package logic {
import lib.*;
import ui.*;
import flash.utils.*;
public class Wire {
var dest:Point;
var sprite:WireView;
var source:Point;
public function Wire(_arg1:Point, _arg2:Point, _arg3:WireView):void{
sprite = _arg3;
source = _arg1.clone();
dest = _arg2.clone();
}
public function cleanup():void{
sprite.cleanup();
}
public function changeSource(_arg1:Point){
source = _arg1.clone();
sprite.update(source, dest);
}
public function show():void{
sprite.show();
}
public function getSource():Point{
return (source);
}
public function changeDest(_arg1:Point){
dest = _arg1.clone();
sprite.update(source, dest);
}
public function sendPower(_arg1:Map, _arg2:Boolean):Part{
var _local3:*;
var _local4:*;
var _local5:*;
_local3 = null;
_local4 = _arg1.getTile(dest);
if (_local4.part != null){
_local5 = _local4.part.sendPower(_arg2);
if (_local5){
_local3 = _local4.part;
};
};
if (_arg2){
sprite.show();
} else {
sprite.hide();
};
return (_local3);
}
public function getDest():Point{
return (dest);
}
public function save(_arg1:ByteArray){
SaveLoad.savePoint(_arg1, source);
SaveLoad.savePoint(_arg1, dest);
}
}
}//package logic
Section 36
//WireSpec (logic.WireSpec)
package logic {
import lib.*;
public class WireSpec {
public var dest:Point;
public var source:Point;
public function WireSpec(_arg1:Point, _arg2:Point):void{
source = _arg1.clone();
dest = _arg2.clone();
}
}
}//package logic
Section 37
//ag_intro_mc_3 (tile_fla.ag_intro_mc_3)
package tile_fla {
import flash.display.*;
public dynamic class ag_intro_mc_3 extends MovieClip {
public function ag_intro_mc_3(){
addFrameScript(217, frame218);
}
function frame218(){
stop();
}
}
}//package tile_fla
Section 38
//AssetClip_22 (tile_fla.AssetClip_22)
package tile_fla {
import flash.display.*;
public dynamic class AssetClip_22 extends MovieClip {
public function AssetClip_22(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package tile_fla
Section 39
//button_79 (tile_fla.button_79)
package tile_fla {
import flash.display.*;
import flash.text.*;
public dynamic class button_79 extends MovieClip {
public var barText:TextField;
}
}//package tile_fla
Section 40
//ColorLabEquation_203 (tile_fla.ColorLabEquation_203)
package tile_fla {
import flash.display.*;
public dynamic class ColorLabEquation_203 extends MovieClip {
public var left:ItemClip;
public var right:ItemClip;
public var result:ItemClip;
}
}//package tile_fla
Section 41
//factory_205 (tile_fla.factory_205)
package tile_fla {
import flash.display.*;
public dynamic class factory_205 extends MovieClip {
public function factory_205(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package tile_fla
Section 42
//fullbgforanimation_78 (tile_fla.fullbgforanimation_78)
package tile_fla {
import flash.display.*;
public dynamic class fullbgforanimation_78 extends MovieClip {
public var bg2:MovieClip;
public var bg1:MovieClip;
}
}//package tile_fla
Section 43
//GoalMenuPart_142 (tile_fla.GoalMenuPart_142)
package tile_fla {
import flash.display.*;
public dynamic class GoalMenuPart_142 extends MovieClip {
public var contractNorth:MovieClip;
public var contractEast:MovieClip;
public var moveWest:MovieClip;
public var expandWest:MovieClip;
public var expandSouth:MovieClip;
public var moveSouth:MovieClip;
public var moveEast:MovieClip;
public var expandNorth:MovieClip;
public var expandEast:MovieClip;
public var moveNorth:MovieClip;
public var deleteButton:MovieClip;
public var contractSouth:MovieClip;
public var contractWest:MovieClip;
}
}//package tile_fla
Section 44
//JonLogo_6 (tile_fla.JonLogo_6)
package tile_fla {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.text.*;
import flash.filters.*;
import flash.media.*;
import flash.net.*;
import flash.ui.*;
import flash.geom.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class JonLogo_6 extends MovieClip {
public var wheelMax;
public var water;
public var waters;
public var speed;
public var wheelCount;
public var logospeed;
public var logomc:MovieClip;
public var waterIndex;
public var wheelspeed;
public var gears1;
public function JonLogo_6(){
addFrameScript(0, frame1);
}
function frame1(){
stage.addEventListener(Event.ENTER_FRAME, gears);
stop();
gears1 = true;
speed = 2;
wheelspeed = 1.2;
logospeed = 0;
wheelMax = 41.7;
wheelCount = wheelMax;
logomc.waterwheel.gotoAndStop(1);
waters = [logomc.ring.w1, logomc.ring.w2, logomc.ring.w3, logomc.ring.w4, logomc.ring.w5, logomc.ring.w6, logomc.ring.w7, logomc.ring.w8];
for each (water in waters) {
water.gotoAndStop(water.totalFrames);
};
waterIndex = 1;
waters[1].gotoAndPlay(1);
}
public function gears(_arg1:Event):void{
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
wheelCount = (wheelCount - 1);
if (wheelCount <= 0){
wheelCount = (wheelCount + wheelMax);
_local6 = logomc.waterwheel.currentFrame;
_local7 = logomc.waterwheel.totalFrames;
logomc.waterwheel.gotoAndStop(((_local6 % _local7) + 1));
waterIndex = ((waterIndex + 1) % 8);
waters[waterIndex].gotoAndPlay(1);
};
logomc.shelf.y = (logomc.shelf.y + speed);
logomc.biggear.rotation = (logomc.biggear.rotation + (speed * 0.8));
logomc.biggear2.rotation = (logomc.biggear2.rotation + (speed * 0.8));
logomc.biggear3.rotation = (logomc.biggear3.rotation + (speed * 0.8));
if (!gears1){
logospeed = 0;
} else {
logospeed = speed;
};
if (logomc.logo.y > 140){
gears1 = false;
};
_local2 = 1;
while (_local2 < 11) {
logomc[("chain" + _local2)].y = (logomc[("chain" + _local2)].y + speed);
if (logomc[("chain" + _local2)].y > 205.85){
logomc[("chain" + _local2)].y = 193.85;
};
_local2++;
};
logomc.logo.y = (logomc.logo.y + logospeed);
logomc.turner1.rotation = (logomc.turner1.rotation + wheelspeed);
logomc.turner2.rotation = (logomc.turner2.rotation + (speed * 3));
if ((((wheelspeed <= 1)) && (gears1))){
wheelspeed = (wheelspeed + 0.3);
};
logomc.waterwheel.rotation = (logomc.waterwheel.rotation + (wheelspeed / 1.109));
logomc.ring.rotation = logomc.waterwheel.rotation;
if (((gears1) && ((speed < 1)))){
speed = (speed + 0.03);
};
_local3 = 1;
while (_local3 < 7) {
logomc[("smallgear" + _local3)].rotation = (logomc[("smallgear" + _local3)].rotation - (speed * 2));
_local3++;
};
logomc.smallgearback1.rotation = (logomc.smallgearback1.rotation + (speed * 2));
logomc.smallgearback2.rotation = (logomc.smallgearback2.rotation + (speed * 2));
logomc.smallgearback3.rotation = (logomc.smallgearback3.rotation + (speed * 2));
_local4 = 1;
while (_local4 < 11) {
logomc[("gear" + _local4)].rotation = (logomc[("gear" + _local4)].rotation - (speed * 0.58));
_local4++;
};
_local5 = 11;
while (_local5 < 21) {
logomc[("gear" + _local5)].rotation = (logomc[("gear" + _local5)].rotation + (speed * 0.58));
_local5++;
};
}
}
}//package tile_fla
Section 45
//Main_logo_7 (tile_fla.Main_logo_7)
package tile_fla {
import flash.display.*;
public dynamic class Main_logo_7 extends MovieClip {
public var gear20:MovieClip;
public var ring:MovieClip;
public var shelf:MovieClip;
public var gear2:MovieClip;
public var gear3:MovieClip;
public var gear5:MovieClip;
public var gear6:MovieClip;
public var gear9:MovieClip;
public var gear4:MovieClip;
public var gear7:MovieClip;
public var gear8:MovieClip;
public var gear1:MovieClip;
public var biggear:MovieClip;
public var waterwheel:MovieClip;
public var chain10:MovieClip;
public var smallgearback1:MovieClip;
public var smallgearback2:MovieClip;
public var smallgearback3:MovieClip;
public var biggear2:MovieClip;
public var biggear3:MovieClip;
public var turner1:MovieClip;
public var turner2:MovieClip;
public var chain1:MovieClip;
public var chain2:MovieClip;
public var chain3:MovieClip;
public var chain6:MovieClip;
public var chain8:MovieClip;
public var chain9:MovieClip;
public var chain4:MovieClip;
public var chain5:MovieClip;
public var chain7:MovieClip;
public var logo:MovieClip;
public var smallgear1:MovieClip;
public var smallgear3:MovieClip;
public var smallgear5:MovieClip;
public var smallgear6:MovieClip;
public var smallgear2:MovieClip;
public var smallgear4:MovieClip;
public var gear11:MovieClip;
public var gear14:MovieClip;
public var gear15:MovieClip;
public var gear16:MovieClip;
public var gear17:MovieClip;
public var gear18:MovieClip;
public var gear19:MovieClip;
public var gear13:MovieClip;
public var gear10:MovieClip;
public var gear12:MovieClip;
}
}//package tile_fla
Section 46
//MainTimeline (tile_fla.MainTimeline)
package tile_fla {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.net.*;
public dynamic class MainTimeline extends MovieClip {
public var field:TextField;
public var ag:MovieClip;
public var bg:MovieClip;
public var frame;
public var logomc:MovieClip;
public var arrows:MovieClip;
public function MainTimeline(){
addFrameScript(1, frame2, 2, frame3, 3, frame4, 5, frame6);
}
public function agclick(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://armorgames.com"));
}
public function onProgress(_arg1:ProgressEvent):void{
var _local2:int;
_local2 = ((_arg1.bytesLoaded / _arg1.bytesTotal) * 100);
field.text = (("Loading Tile Factory\n" + _local2) + "%");
}
public function onComplete(_arg1:Event):void{
loaderInfo.removeEventListener(ProgressEvent.PROGRESS, onProgress);
loaderInfo.removeEventListener(Event.COMPLETE, onComplete);
removeEventListener(Event.ENTER_FRAME, preFrame);
play();
}
function frame3(){
stop();
ag.gotoAndPlay(1);
addEventListener(Event.ENTER_FRAME, agFrame);
ag.addEventListener(MouseEvent.CLICK, agclick);
}
function frame6(){
stop();
Main.init(this);
}
public function enterFrame(_arg1:Event):void{
if (frame >= 150){
removeEventListener(Event.ENTER_FRAME, enterFrame);
logomc.removeEventListener(MouseEvent.CLICK, click);
play();
};
frame++;
}
function frame4(){
stop();
frame = 0;
addEventListener(Event.ENTER_FRAME, enterFrame);
logomc.addEventListener(MouseEvent.CLICK, click);
}
function frame2(){
if (loaderInfo.bytesLoaded < loaderInfo.bytesTotal){
stop();
bg.x = 0;
arrows.x = 0;
field.x = 150;
this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress);
this.loaderInfo.addEventListener(Event.COMPLETE, onComplete);
addEventListener(Event.ENTER_FRAME, preFrame);
};
}
public function click(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://groups.google.com/group/tile-factory"));
}
public function preFrame(_arg1:Event):void{
if (arrows.y <= -600){
arrows.y = 0;
};
arrows.y = (arrows.y - 0.5);
}
public function agFrame(_arg1:Event):void{
if (ag.currentFrame == ag.totalFrames){
removeEventListener(Event.ENTER_FRAME, agFrame);
play();
};
}
}
}//package tile_fla
Section 47
//tabwithtext_26 (tile_fla.tabwithtext_26)
package tile_fla {
import flash.display.*;
import flash.text.*;
public dynamic class tabwithtext_26 extends MovieClip {
public var barText:TextField;
}
}//package tile_fla
Section 48
//TileMenuPart_144 (tile_fla.TileMenuPart_144)
package tile_fla {
import flash.display.*;
public dynamic class TileMenuPart_144 extends MovieClip {
public var b10:ItemClip;
public var b14:ItemClip;
public var counter:MovieClip;
public var b15:ItemClip;
public var b0:ItemClip;
public var b2:ItemClip;
public var b4:ItemClip;
public var b9:ItemClip;
public var b5:ItemClip;
public var b6:ItemClip;
public var b1:ItemClip;
public var b3:ItemClip;
public var s0:ItemClip;
public var s1:ItemClip;
public var s2:ItemClip;
public var s4:ItemClip;
public var s5:ItemClip;
public var b11:ItemClip;
public var b8:ItemClip;
public var b12:ItemClip;
public var b7:ItemClip;
public var s3:ItemClip;
public var b13:ItemClip;
public var clockwise:MovieClip;
public var deleteButton:MovieClip;
}
}//package tile_fla
Section 49
//water_12 (tile_fla.water_12)
package tile_fla {
import flash.display.*;
public dynamic class water_12 extends MovieClip {
public function water_12(){
addFrameScript(59, frame60);
}
function frame60(){
stop();
}
}
}//package tile_fla
Section 50
//WaterRing_11 (tile_fla.WaterRing_11)
package tile_fla {
import flash.display.*;
public dynamic class WaterRing_11 extends MovieClip {
public var w1:MovieClip;
public var w4:MovieClip;
public var w6:MovieClip;
public var w8:MovieClip;
public var w7:MovieClip;
public var w2:MovieClip;
public var w3:MovieClip;
public var w5:MovieClip;
}
}//package tile_fla
Section 51
//ButtonMenu (ui.menu.ButtonMenu)
package ui.menu {
import flash.display.*;
import logic.*;
import ui.*;
import lib.ui.*;
import flash.filters.*;
public class ButtonMenu extends TabMenu {
var buttonArray:Array;
var clip:ButtonMenuClip;
var buttons:ButtonList;
var partPlace:PartPlace;
var goalPlace:GoalPlace;
var status:ButtonStatus;
static var offGlow = new GlowFilter(0xCC0000, 1, 10, 10, 3, 3);
static var onGlow = new GlowFilter(0xCC00, 1, 10, 10, 3, 3);
public function ButtonMenu(_arg1:DisplayObjectContainer, _arg2:Function, _arg3:GoalPlace):void{
goalPlace = _arg3;
clip = new ButtonMenuClip();
super(_arg1, clip, _arg2, TabList.BUTTON_MENU);
buttonArray = [clip.all, clip.some, clip.none, clip.mem, clip.setButton, clip.clear, clip.conveyer, clip.barrier, clip.rotater, clip.sensor, clip.sprayer, clip.mixer, clip.copier, clip.tile, clip.solvent, clip.glue, clip.triangle, clip.rectangle, clip.smallCircle, clip.circle, clip.bigCircle, clip.white, clip.cyan, clip.magenta, clip.yellow, clip.black, clip.wireButton];
buttons = new ButtonList(buttonArray);
buttons.setActions(click, null, null);
clip.wireButton.barText.text = "Wires";
}
override public function hide():void{
super.hide();
if (partPlace != null){
partPlace.show();
};
goalPlace.show();
}
function click(_arg1:int):void{
status.toggleStatus(_arg1);
updateStatus(_arg1);
Sound.play(Sound.SELECT);
}
function updateStatus(_arg1:int):void{
if (status.getStatus(_arg1)){
buttonArray[_arg1].filters = [onGlow];
} else {
buttonArray[_arg1].filters = [offGlow];
};
}
override public function cleanup():void{
buttons.cleanup();
super.cleanup();
}
public function setModel(_arg1:ButtonStatus, _arg2:PartPlace):void{
status = _arg1;
partPlace = _arg2;
}
override public function show():void{
var _local1:*;
super.show();
_local1 = 0;
while (_local1 < buttonArray.length) {
updateStatus(_local1);
_local1++;
};
partPlace.hide();
goalPlace.hide();
}
}
}//package ui.menu
Section 52
//EditMenu (ui.menu.EditMenu)
package ui.menu {
import flash.display.*;
import logic.*;
import ui.*;
import lib.ui.*;
public class EditMenu extends TabMenu {
var forEachPart:Function;
var clip:EditMenuClip;
var buttons:ButtonList;
var partPlace:PartPlace;
var map:Map;
var settings:GameSettings;
var window:Window;
var goalPlace:GoalPlace;
static var WIDTH_ADD_1 = 2;
static var WIDTH_ADD_5 = 3;
static var HEIGHT_ADD_1 = 6;
static var WIDTH_SUB_1 = 0;
static var HEIGHT_SUB_1 = 4;
static var WIDTH_SUB_5 = 1;
static var HEIGHT_SUB_5 = 5;
static var HEIGHT_ADD_5 = 7;
public function EditMenu(_arg1:DisplayObjectContainer, _arg2:Window, _arg3:GoalPlace, _arg4:Function):void{
window = _arg2;
goalPlace = _arg3;
setMenu = _arg4;
clip = new EditMenuClip();
super(_arg1, clip, setMenu, TabList.EDIT_MENU);
buttons = new ButtonList([clip.widthSub1, clip.widthSub5, clip.widthAdd1, clip.widthAdd5, clip.heightSub1, clip.heightSub5, clip.heightAdd1, clip.heightAdd5]);
buttons.setActions(click, buttons.glowOver, buttons.glowOut);
}
override public function hide():void{
if (settings != null){
settings.setName(clip.nameField.text);
};
if (partPlace != null){
partPlace.show();
};
goalPlace.show();
super.hide();
}
function click(_arg1:int):void{
if (_arg1 == WIDTH_SUB_1){
changeSize(Dir.east, -1);
} else {
if (_arg1 == WIDTH_SUB_5){
changeSize(Dir.east, -5);
} else {
if (_arg1 == WIDTH_ADD_1){
changeSize(Dir.east, 1);
} else {
if (_arg1 == WIDTH_ADD_5){
changeSize(Dir.east, 5);
} else {
if (_arg1 == HEIGHT_SUB_1){
changeSize(Dir.south, -1);
} else {
if (_arg1 == HEIGHT_SUB_5){
changeSize(Dir.south, -5);
} else {
if (_arg1 == HEIGHT_ADD_1){
changeSize(Dir.south, 1);
} else {
if (_arg1 == HEIGHT_ADD_5){
changeSize(Dir.south, 5);
};
};
};
};
};
};
};
};
Sound.play(Sound.SELECT);
}
function changeSize(_arg1:Dir, _arg2:int):void{
if (goalPlace.canChangeSize(Dir.walk(map.getSize(), _arg1, _arg2))){
forEachPart(removeTrack);
if (map.changeSize(_arg1, _arg2)){
window.resizeBackground(Map.toPixel(map.getSize()));
};
forEachPart(addTrack);
};
}
override public function cleanup():void{
buttons.cleanup();
super.cleanup();
}
public function setModel(_arg1:Map, _arg2:PartPlace, _arg3:GameSettings, _arg4:Function):void{
map = _arg1;
partPlace = _arg2;
settings = _arg3;
clip.nameField.text = settings.getName();
forEachPart = _arg4;
}
function removeTrack(_arg1:Part):void{
_arg1.removeAllTracks();
}
function addTrack(_arg1:Part):void{
_arg1.addAllTracks();
}
override public function show():void{
super.show();
partPlace.hide();
goalPlace.hide();
}
}
}//package ui.menu
Section 53
//GoalMenu (ui.menu.GoalMenu)
package ui.menu {
import flash.display.*;
import ui.*;
import lib.ui.*;
public class GoalMenu extends TabMenu {
var clip:GoalMenuClip;
var buttons:ButtonList;
var partPlace:PartPlace;
var goalPlace:GoalPlace;
var arrowButtons:ButtonList;
public function GoalMenu(_arg1:DisplayObjectContainer, _arg2:GoalPlace, _arg3:Function):void{
goalPlace = _arg2;
clip = new GoalMenuClip();
super(_arg1, clip, _arg3, TabList.GOAL_MENU);
buttons = new ButtonList([clip.p.deleteButton, clip.addButton]);
buttons.setActions(click, buttons.frameOver, buttons.frameOut);
clip.p.deleteButton.barText.text = "Delete Goal";
clip.addButton.barText.text = "Add Goal";
arrowButtons = new ButtonList([clip.p.moveNorth, clip.p.expandNorth, clip.p.contractNorth, clip.p.moveSouth, clip.p.expandSouth, clip.p.contractSouth, clip.p.moveEast, clip.p.expandEast, clip.p.contractEast, clip.p.moveWest, clip.p.expandWest, clip.p.contractWest]);
arrowButtons.setActions(arrowClick, arrowButtons.glowOver, arrowButtons.glowOut);
}
override public function hide():void{
super.hide();
if (partPlace != null){
partPlace.show();
};
goalPlace.toggleGoalHeight();
}
function click(_arg1:int):void{
if (_arg1 == 0){
goalPlace.deleteGoal();
goalPlace.clearGoal();
show();
} else {
goalPlace.addGoal();
};
Sound.play(Sound.SELECT);
}
override public function cleanup():void{
buttons.cleanup();
arrowButtons.cleanup();
super.cleanup();
}
public function setModel(_arg1:PartPlace):void{
partPlace = _arg1;
}
override public function show():void{
super.show();
if (goalPlace.hasGoal()){
clip.p.visible = true;
clip.message.visible = false;
clip.addButton.visible = false;
} else {
clip.p.visible = false;
clip.message.visible = true;
clip.addButton.visible = true;
};
partPlace.hide();
goalPlace.toggleGoalHeight();
goalPlace.selectGoals();
}
function arrowClick(_arg1:int):void{
var _local2:*;
var _local3:*;
_local2 = (_arg1 % 3);
_local3 = Dir.dirs[Math.floor((_arg1 / 3))];
goalPlace.modifyGoal(_local2, _local3);
Sound.play(Sound.SELECT);
}
}
}//package ui.menu
Section 54
//ItemMenu (ui.menu.ItemMenu)
package ui.menu {
import flash.display.*;
import logic.*;
import ui.*;
import lib.ui.*;
public class ItemMenu extends TabMenu {
var clip:ItemMenuClip;
var buttons:ButtonList;
var partPlace:PartPlace;
var goalPlace:GoalPlace;
public function ItemMenu(_arg1:DisplayObjectContainer, _arg2:Function, _arg3:GoalPlace):void{
goalPlace = _arg3;
clip = new ItemMenuClip();
super(_arg1, clip, _arg2, TabList.ITEM_MENU);
buttons = new ButtonList([clip.tile, clip.solvent, clip.glue, clip.triangle, clip.rectangle, clip.smallCircle, clip.circle, clip.bigCircle, clip.white, clip.cyan, clip.magenta, clip.yellow, clip.black]);
buttons.setActions(click, buttons.glowOver, buttons.glowOut);
}
override public function hide():void{
goalPlace.show();
super.hide();
}
function click(_arg1:int):void{
partPlace.setPart((_arg1 + Part.TILE));
setMenu(TabList.PLACE_MENU);
Sound.play(Sound.SELECT);
}
override public function cleanup():void{
buttons.cleanup();
super.cleanup();
}
public function setModel(_arg1:PartPlace, _arg2:Boolean, _arg3:ButtonStatus):void{
var _local4:*;
var _local5:*;
var _local6:*;
partPlace = _arg1;
if (!_arg2){
_local4 = false;
_local5 = [clip.tile, clip.solvent, clip.glue, clip.triangle, clip.rectangle, clip.smallCircle, clip.circle, clip.bigCircle, clip.white, clip.cyan, clip.magenta, clip.yellow, clip.black];
_local6 = 0;
while (_local6 < _local5.length) {
if (!_arg3.getStatus((_local6 + Part.TILE))){
_local5[_local6].visible = false;
} else {
_local4 = true;
};
_local6++;
};
if (!_local4){
clip.visible = false;
};
};
}
override public function show():void{
goalPlace.hide();
super.show();
}
}
}//package ui.menu
Section 55
//MovieMenu (ui.menu.MovieMenu)
package ui.menu {
import flash.display.*;
import lib.*;
import logic.*;
import ui.*;
import lib.ui.*;
import flash.geom.*;
public class MovieMenu extends MenuRoot {
var buttons:ButtonList;
var clip:MovieMenuClip;
var flashFrame:int;
var saveMap:Function;
var settings:GameSettings;
var endGame:Function;
var window:Window;
var slide:int;
static var MAX_FLASH = (flashList.length - 1);
static var flashList = [1, 1.1, 1.2, 1.3, 1.2, 1.1];
public function MovieMenu(_arg1:DisplayObjectContainer, _arg2:Window):void{
window = _arg2;
clip = new MovieMenuClip();
super(_arg1, clip, false, false);
buttons = new ButtonList([clip.next, clip.prev]);
buttons.setActions(click, buttons.glowOver, buttons.glowOut);
clip.arrow.mouseEnabled = false;
clip.arrow.mouseChildren = false;
clip.mouseEnabled = false;
slide = 0;
flashFrame = -1;
}
function showArrow(_arg1:Point, _arg2:Boolean):void{
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
if (_arg1 != null){
_local3 = _arg1;
if (!_arg2){
_local8 = Map.toCenterPixel(_arg1);
_local3 = window.toRelative(_local8);
};
_local4 = new Point(400, 50);
_local5 = new Point((_local4.x - _local3.x), (_local4.y - _local3.y));
_local6 = Math.sqrt(((_local5.x * _local5.x) + (_local5.y * _local5.y)));
_local7 = ((Math.atan2(_local5.y, _local5.x) * 180) / Math.PI);
clip.arrow.visible = true;
clip.arrow.x = _local3.x;
clip.arrow.y = _local3.y;
clip.arrow.rotation = _local7;
clip.arrow.tail.width = _local6;
} else {
clip.arrow.visible = false;
};
}
function click(_arg1:int):void{
if (_arg1 == 0){
slide++;
} else {
slide--;
};
setText();
Sound.play(Sound.SELECT);
}
public function setModel(_arg1:GameSettings, _arg2:Function, _arg3:Function):void{
settings = _arg1;
endGame = _arg2;
saveMap = _arg3;
if (settings.shouldSkipToEnd()){
slide = (settings.getSlides().length - 1);
};
setText();
}
override public function cleanup():void{
buttons.cleanup();
super.cleanup();
}
function setText():void{
var _local1:*;
clip.visible = true;
window.setScreenOffset(new Point(0, 100));
if (settings.isMovie()){
window.resizeWindow(new Point(Main.WIDTH, Main.HEIGHT));
} else {
window.resizeWindow(new Point(Main.WIDTH, (Main.HEIGHT - View.MENU_HEIGHT)));
};
clip.prev.visible = !((((slide == 0)) && ((settings.getPrev() == null))));
clip.next.visible = !((((slide == (settings.getSlides().length - 1))) && (!(settings.isMovie()))));
if ((((slide < 0)) && (!((settings.getPrev() == null))))){
slide = 0;
if (settings.getId() != null){
Campaign.saveLevel(settings.getId(), saveMap());
};
endGame(Game.MOVIE_PREV);
} else {
if (slide >= settings.getSlides().length){
slide = (settings.getSlides().length - 1);
if (settings.isMovie()){
endGame(Game.MOVIE_NEXT);
} else {
clip.visible = false;
window.setScreenOffset(new Point(0, 0));
};
} else {
_local1 = settings.getSlides()[slide];
if (_local1.align == "middle"){
flashFrame = MAX_FLASH;
};
clip.message.text = _local1.text;
showArrow(_local1.pos, _local1.isPixel);
};
};
}
public function enterFrame():void{
var _local1:*;
if (flashFrame >= 0){
_local1 = flashList[flashFrame];
clip.transform.colorTransform = new ColorTransform(_local1, _local1, _local1, 1, 0, 0, 0, 0);
flashFrame--;
};
}
}
}//package ui.menu
Section 56
//PartMenu (ui.menu.PartMenu)
package ui.menu {
import flash.display.*;
import logic.*;
import ui.*;
import lib.ui.*;
public class PartMenu extends TabMenu {
var clip:PartMenuClip;
var partPlace:PartPlace;
var tip:ToolTipClip;
var buttons:ButtonList;
var goalPlace:GoalPlace;
static var partBlurbs = ["Powered only when ALL\ninput wires are on", "Powered when ANY\ninput wires are on", "Powered when NO\ninput wires are on", "Changes power after\nwaiting one second", "Turns ON adjacent\nmemory when powered", "Turns OFF adjacent\nmemory when powered", "Pushes tiles in\na straight line", "Stops conveyer\ntracks", "Rotates tiles\nand stencils", "Turns on when a\ntile moves over it", "Sprays paint, stencils, glue\nand solvent onto tiles", "Mixes paint together\nto make new colors", "Duplicates any item"];
static var partTitles = ["All", "Some", "None", "Memory", "Set", "Clear", "Conveyer", "Barrier", "Rotater", "Sensor", "Sprayer", "Mixer", "Copier"];
public function PartMenu(_arg1:DisplayObjectContainer, _arg2:Function, _arg3:GoalPlace):void{
goalPlace = _arg3;
clip = new PartMenuClip();
super(_arg1, clip, _arg2, TabList.PART_MENU);
buttons = new ButtonList([clip.all, clip.some, clip.none, clip.mem, clip.setButton, clip.clear, clip.conveyer, clip.barrier, clip.rotater, clip.sensor, clip.sprayer, clip.mixer, clip.copier]);
buttons.setActions(click, mouseOver, mouseOut);
}
override public function hide():void{
goalPlace.show();
super.hide();
}
function click(_arg1:int):void{
partPlace.setPart(_arg1);
setMenu(TabList.PLACE_MENU);
Sound.play(Sound.SELECT);
}
function mouseOver(_arg1:int):void{
buttons.glowOver(_arg1);
tip.x = buttons.get(_arg1).x;
if (tip.x < ((tip.width / 2) + 10)){
tip.x = ((tip.width / 2) + 10);
};
if (tip.x > ((Main.WIDTH - (tip.width / 2)) - 10)){
tip.x = ((Main.WIDTH - (tip.width / 2)) - 10);
};
tip.y = buttons.get(_arg1).y;
tip.visible = true;
tip.barText.text = partTitles[_arg1];
tip.blurb.text = partBlurbs[_arg1];
}
override public function cleanup():void{
buttons.cleanup();
super.cleanup();
}
public function setModel(_arg1:PartPlace, _arg2:Boolean, _arg3:ButtonStatus, _arg4:ToolTipClip):void{
var _local5:*;
var _local6:*;
partPlace = _arg1;
tip = _arg4;
if (!_arg2){
_local5 = [clip.all, clip.some, clip.none, clip.mem, clip.setButton, clip.clear, clip.conveyer, clip.barrier, clip.rotater, clip.sensor, clip.sprayer, clip.mixer, clip.copier];
_local6 = 0;
while (_local6 < _local5.length) {
if (!_arg3.getStatus(_local6)){
_local5[_local6].visible = false;
};
_local6++;
};
};
}
function mouseOut(_arg1:int):void{
buttons.glowOut(_arg1);
tip.visible = false;
}
override public function show():void{
goalPlace.hide();
super.show();
}
}
}//package ui.menu
Section 57
//PlaceMenu (ui.menu.PlaceMenu)
package ui.menu {
import flash.display.*;
import flash.events.*;
import ui.*;
import lib.ui.*;
public class PlaceMenu extends MenuRoot {
var buttons:ButtonList;
var partPlace:PartPlace;
var clip:PlaceMenuClip;
var goalPlace:GoalPlace;
static var POWER = 1;
static var CLOCKWISE = 2;
static var COUNTER = 0;
static var TRASH = 3;
public function PlaceMenu(_arg1:DisplayObjectContainer, _arg2:GoalPlace):void{
clip = new PlaceMenuClip();
goalPlace = _arg2;
super(_arg1, clip, false, false);
buttons = new ButtonList([clip.counter, clip.power, clip.clockwise, clip.trash]);
buttons.setActions(click, buttons.glowOver, buttons.glowOut);
clip.addEventListener(MouseEvent.MOUSE_MOVE, move);
}
override public function hide():void{
super.hide();
goalPlace.show();
}
override public function cleanup():void{
clip.removeEventListener(MouseEvent.MOUSE_MOVE, move);
buttons.cleanup();
super.cleanup();
}
public function setModel(_arg1:PartPlace):void{
partPlace = _arg1;
}
function move(_arg1:MouseEvent):void{
partPlace.hoverMenu(_arg1.stageX, _arg1.stageY);
}
function click(_arg1:int):void{
if (_arg1 == COUNTER){
partPlace.counter();
} else {
if (_arg1 == POWER){
partPlace.togglePower();
} else {
if (_arg1 == CLOCKWISE){
partPlace.clockwise();
} else {
if (_arg1 == TRASH){
partPlace.returnToMenu();
partPlace.hide();
partPlace.show();
};
};
};
};
Sound.play(Sound.SELECT);
}
override public function show():void{
super.show();
clip.parent.setChildIndex(clip, (clip.parent.numChildren - 1));
goalPlace.hide();
}
}
}//package ui.menu
Section 58
//SystemMenu (ui.menu.SystemMenu)
package ui.menu {
import flash.display.*;
import flash.events.*;
import ui.*;
import lib.ui.*;
import flash.system.*;
public class SystemMenu {
var buttonsSystem:ButtonList;
var buttonsTop:ButtonList;
var top:TopMenuClip;
var saveMap:Function;
var settings:GameSettings;
var endGame:Function;
var system:SystemMenuClip;
var save:SaveMenuClip;
static var MENU = 1;
static var RESTART = 4;
static var RESUME = 0;
static var BACK = 7;
static var SOUND = 2;
static var QUIT = 5;
static var COPY = 6;
static var MUTE = 0;
static var SAVE = 1;
static var SKIP = 3;
public function SystemMenu(_arg1:DisplayObjectContainer):void{
top = new TopMenuClip();
_arg1.addChild(top);
if (Sound.isMute()){
top.muteButton.gotoAndStop(2);
};
system = new SystemMenuClip();
_arg1.addChild(system);
system.visible = false;
system.resumeButton.barText.text = "Resume";
system.saveButton.barText.text = "Save";
system.soundButton.barText.text = "Toggle Sound";
system.skipButton.barText.text = "Skip Level";
system.restartButton.barText.text = "Restart Level";
system.quitButton.barText.text = "Quit to Menu";
save = new SaveMenuClip();
_arg1.addChild(save);
save.visible = false;
save.copyButton.barText.text = "Copy";
save.backButton.barText.text = "Back";
buttonsTop = new ButtonList([top.muteButton, top.menuButton]);
buttonsTop.setActions(clickTop, buttonsTop.glowOver, buttonsTop.glowOut);
buttonsSystem = new ButtonList([system.resumeButton, system.saveButton, system.soundButton, system.skipButton, system.restartButton, system.quitButton, save.copyButton, save.backButton]);
buttonsSystem.setActions(clickSystem, buttonsSystem.frameOver, buttonsSystem.frameOut);
}
function hide():void{
system.visible = false;
system.removeEventListener(Event.ENTER_FRAME, enterFrame);
}
function show():void{
system.visible = true;
system.addEventListener(Event.ENTER_FRAME, enterFrame);
}
function clickSystem(_arg1:int):void{
if (_arg1 == RESUME){
hide();
} else {
if (_arg1 == SAVE){
save.visible = true;
save.code.text = saveMap();
save.stage.focus = save.code;
save.code.setSelection(0, save.code.length);
} else {
if (_arg1 == SOUND){
toggleSound();
} else {
if (_arg1 == SKIP){
endGame(Game.SKIP_GAME);
} else {
if (_arg1 == RESTART){
if (settings.getId() != null){
Campaign.levelSaves[settings.getId()] = null;
};
endGame(Game.RESTART_GAME);
} else {
if (_arg1 == QUIT){
endGame(Game.END_GAME);
} else {
if (_arg1 == COPY){
System.setClipboard(save.code.text);
} else {
if (_arg1 == BACK){
save.visible = false;
};
};
};
};
};
};
};
};
Sound.play(Sound.SELECT);
}
function toggleSound():void{
if (top.muteButton.currentFrame == 1){
top.muteButton.gotoAndStop(2);
} else {
top.muteButton.gotoAndStop(1);
};
Sound.toggleMute();
Campaign.save();
}
public function cleanup():void{
system.removeEventListener(Event.ENTER_FRAME, enterFrame);
buttonsSystem.cleanup();
buttonsTop.cleanup();
top.parent.removeChild(top);
system.parent.removeChild(system);
}
public function setModel(_arg1:Function, _arg2:Function, _arg3:GameSettings):void{
endGame = _arg1;
saveMap = _arg2;
settings = _arg3;
}
function clickTop(_arg1:int):void{
if (_arg1 == MUTE){
toggleSound();
} else {
if (_arg1 == MENU){
if (settings.getId() != null){
Campaign.saveLevel(settings.getId(), saveMap());
};
show();
};
};
Sound.play(Sound.SELECT);
}
function enterFrame(_arg1:Event):void{
if (system.arrows.y <= -600){
system.arrows.y = 0;
};
system.arrows.y = (system.arrows.y - 0.5);
}
}
}//package ui.menu
Section 59
//TabMenu (ui.menu.TabMenu)
package ui.menu {
import flash.display.*;
import ui.*;
import lib.ui.*;
public class TabMenu extends MenuRoot {
protected var setMenu:Function;
protected var tabButtons:ButtonList;
var menuIndex:int;
public function TabMenu(_arg1:DisplayObjectContainer, _arg2:MovieClip, _arg3:Function, _arg4:int):void{
super(_arg1, _arg2, false, false);
tabButtons = new ButtonList([rootClip.tabButton]);
tabButtons.setActions(clickTab, tabButtons.glowOver, tabButtons.glowOut);
setMenu = _arg3;
menuIndex = _arg4;
rootClip.tabButton.barText.text = TabList.tabText[menuIndex];
hide();
}
override public function hide():void{
rootClip.tabButton.gotoAndStop(2);
}
override public function cleanup():void{
tabButtons.cleanup();
super.cleanup();
}
function clickTab(_arg1:int):void{
setMenu(menuIndex);
Sound.play(Sound.SELECT);
}
public function setTabPos(_arg1:int):void{
rootClip.tabButton.x = _arg1;
}
public function disable():void{
rootClip.visible = false;
}
override public function show():void{
rootClip.parent.setChildIndex(rootClip, (rootClip.parent.numChildren - 1));
rootClip.tabButton.gotoAndStop(1);
}
}
}//package ui.menu
Section 60
//TestMenu (ui.menu.TestMenu)
package ui.menu {
import flash.display.*;
import lib.*;
import ui.*;
import lib.ui.*;
import logic.change.*;
public class TestMenu extends TabMenu {
var changes:ChangeList;
var clip:TestMenuClip;
var buttons:ButtonList;
var partPlace:PartPlace;
var stateText;
var saveMap:Function;
var settings:GameSettings;
var state:int;
var goalPlace:GoalPlace;
static var STOP = 0;
static var PLAY = 1;
static var PAUSE = 3;
static var FAST = 2;
static var STEP = 4;
public function TestMenu(_arg1:DisplayObjectContainer, _arg2:Function, _arg3:GoalPlace):void{
stateText = ["Stopped", "Playing", "Fast", "Paused", "Error"];
clip = new TestMenuClip();
goalPlace = _arg3;
setState(STOP);
super(_arg1, clip, _arg2, TabList.TEST_MENU);
buttons = new ButtonList([clip.stopButton, clip.playButton, clip.fastButton, clip.pauseButton, clip.stepButton]);
buttons.setActions(click, buttons.glowOver, buttons.glowOut);
}
override public function hide():void{
super.hide();
if (state != STOP){
changes.add(Util.makeChange(ChangeWorld.togglePlay));
setState(STOP);
};
goalPlace.show();
if (partPlace != null){
partPlace.show();
};
}
function setState(_arg1:int):void{
state = _arg1;
clip.status.text = stateText[state];
if (state == STOP){
enableButtons([clip.playButton, clip.fastButton, clip.stepButton]);
disableButtons([clip.stopButton, clip.pauseButton]);
} else {
if (state == PLAY){
enableButtons([clip.stopButton, clip.fastButton, clip.pauseButton]);
disableButtons([clip.playButton, clip.stepButton]);
} else {
if (state == FAST){
enableButtons([clip.playButton, clip.stopButton, clip.pauseButton]);
disableButtons([clip.fastButton, clip.stepButton]);
} else {
if (state == PAUSE){
enableButtons([clip.playButton, clip.stopButton, clip.fastButton, clip.stepButton]);
disableButtons([clip.pauseButton]);
};
};
};
};
}
function click(_arg1:int):void{
if (_arg1 == STOP){
changes.add(Util.makeChange(ChangeWorld.togglePlay));
setState(STOP);
} else {
if (_arg1 == PLAY){
if (state == STOP){
changes.add(Util.makeChange(ChangeWorld.togglePlay));
} else {
if (state == FAST){
changes.add(Util.makeChange(ChangeWorld.slowPlay));
} else {
if (state == PAUSE){
changes.add(Util.makeChange(ChangeWorld.resumePlay));
};
};
};
setState(PLAY);
} else {
if (_arg1 == FAST){
if (state == STOP){
changes.add(Util.makeChange(ChangeWorld.togglePlay));
};
if (state == PAUSE){
changes.add(Util.makeChange(ChangeWorld.resumePlay));
};
changes.add(Util.makeChange(ChangeWorld.speedPlay));
setState(FAST);
} else {
if (_arg1 == PAUSE){
changes.add(Util.makeChange(ChangeWorld.pausePlay));
setState(PAUSE);
} else {
if (_arg1 == STEP){
if (state == STOP){
changes.add(Util.makeChange(ChangeWorld.togglePlay));
changes.add(Util.makeChange(ChangeWorld.pausePlay));
setState(PAUSE);
};
changes.add(Util.makeChange(ChangeWorld.stepPlay));
};
};
};
};
};
Sound.play(Sound.SELECT);
}
override public function cleanup():void{
buttons.cleanup();
super.cleanup();
}
public function setModel(_arg1:ChangeList, _arg2:PartPlace, _arg3:GameSettings, _arg4:Function):void{
changes = _arg1;
partPlace = _arg2;
settings = _arg3;
saveMap = _arg4;
}
function disableButtons(_arg1:Array):void{
var _local2:*;
for each (_local2 in _arg1) {
_local2.alpha = 0.3;
_local2.mouseEnabled = false;
};
}
override public function show():void{
super.show();
goalPlace.hide();
partPlace.hide();
if (settings.getId() != null){
Campaign.saveLevel(settings.getId(), saveMap());
};
}
function enableButtons(_arg1:Array):void{
var _local2:*;
for each (_local2 in _arg1) {
_local2.alpha = 1;
_local2.mouseEnabled = true;
};
}
}
}//package ui.menu
Section 61
//TileMenu (ui.menu.TileMenu)
package ui.menu {
import flash.display.*;
import lib.*;
import logic.*;
import ui.*;
import lib.ui.*;
public class TileMenu extends TabMenu {
var buttons:ButtonList;
var stencilDir:Dir;
var goalPlace:GoalPlace;
var testLeft:int;
var type:int;
var testRight:int;
var clip:TileMenuClip;
var side:TileMenuSide;
var partPlace:PartPlace;
var window:Window;
var testColor:int;
var tileButtons:ButtonList;
var testTile:RegionList;
static var COUNTER = 23;
static var SOLVENT = 21;
static var BEGIN_STENCIL = 16;
static var BEGIN_PAINT = 0;
public static var COLOR_LAB = 2;
static var CLOCKWISE = 22;
static var END_PAINT = 16;
public static var TILE_EDIT = 0;
public static var TILE_LAB = 1;
static var END_STENCIL = 21;
public function TileMenu(_arg1:DisplayObjectContainer, _arg2:Window, _arg3:GoalPlace, _arg4:Function, _arg5:int):void{
var _local6:*;
var _local7:*;
var _local8:*;
testColor = -1;
testLeft = -1;
testRight = -1;
testTile = null;
type = _arg5;
goalPlace = _arg3;
window = _arg2;
clip = new TileMenuClip();
side = new TileMenuSide();
_arg1.addChild(side);
_arg1.setChildIndex(side, 0);
side.visible = false;
_local6 = TabList.TILE_MENU;
if (type == TILE_LAB){
_local6 = TabList.TILE_LAB_MENU;
} else {
if (type == COLOR_LAB){
_local6 = TabList.COLOR_LAB_MENU;
};
};
super(_arg1, clip, _arg4, _local6);
buttons = new ButtonList([clip.p.deleteButton]);
buttons.setActions(click, buttons.frameOver, buttons.frameOut);
clip.p.deleteButton.barText.text = "Clear";
if (type == TILE_EDIT){
side.test.visible = false;
side.testLabel.visible = false;
side.paint.visible = false;
} else {
if (type == TILE_LAB){
side.paint.visible = false;
} else {
if (type == COLOR_LAB){
side.test.visible = false;
};
};
};
_local7 = [clip.p.b0, clip.p.b1, clip.p.b2, clip.p.b3, clip.p.b4, clip.p.b5, clip.p.b6, clip.p.b7, clip.p.b8, clip.p.b9, clip.p.b10, clip.p.b11, clip.p.b12, clip.p.b13, clip.p.b14, clip.p.b15, clip.p.s0, clip.p.s1, clip.p.s2, clip.p.s3, clip.p.s4, clip.p.s5, clip.p.clockwise, clip.p.counter];
tileButtons = new ButtonList(_local7);
tileButtons.setActions(tileClick, tileButtons.glowOver, tileButtons.glowOut);
_local8 = 0;
_local8 = BEGIN_PAINT;
while (_local8 < END_PAINT) {
_local7[_local8].gotoAndStop(((_local8 + 9) - BEGIN_PAINT));
_local8++;
};
_local8 = BEGIN_STENCIL;
while (_local8 < END_STENCIL) {
_local7[_local8].gotoAndStop(((_local8 + 4) - BEGIN_STENCIL));
_local8++;
};
_local7[SOLVENT].gotoAndStop(2);
stencilDir = Dir.east;
}
function click(_arg1:int):void{
if (type == TILE_EDIT){
goalPlace.deleteTile();
} else {
if (type == TILE_LAB){
testTile = null;
} else {
if (type == COLOR_LAB){
testColor = -1;
};
};
};
updateTile();
updateTest();
Sound.play(Sound.SELECT);
}
function updateTile():void{
var _local1:*;
_local1 = goalPlace.getTileColor();
updateTileView(_local1, side.tile);
}
override public function cleanup():void{
side.parent.removeChild(side);
buttons.cleanup();
tileButtons.cleanup();
super.cleanup();
}
function updateStencils():void{
var _local1:*;
for each (_local1 in [clip.p.s0, clip.p.s1, clip.p.s2, clip.p.s3, clip.p.s4]) {
_local1.rotation = stencilDir.toAngle();
};
}
override public function hide():void{
super.hide();
window.resizeWindow(new Point(Main.WIDTH, (Main.HEIGHT - View.MENU_HEIGHT)));
side.visible = false;
if (partPlace != null){
partPlace.show();
};
goalPlace.toggleGoalHeight();
}
function colorTypeClick(_arg1:int):void{
if (testColor >= 0){
testLeft = testColor;
testRight = (_arg1 - BEGIN_PAINT);
testColor = RegionList.mix(testLeft, testRight);
} else {
testColor = (_arg1 - BEGIN_PAINT);
testLeft = testColor;
testRight = testColor;
};
updateTest();
}
function updateTileView(_arg1:RegionList, _arg2:TileZoomClip):void{
if (_arg1 != null){
_arg2.stencil.visible = true;
_arg1.drawRegions(_arg2.draw.graphics, 0, 300);
} else {
_arg2.stencil.visible = false;
_arg2.draw.graphics.clear();
};
}
function tileTypeClick(_arg1:int):void{
var _local2:*;
_local2 = testTile;
if (type == TILE_EDIT){
_local2 = goalPlace.getTileColor();
};
if (_local2 == null){
_local2 = new RegionList();
if (type == TILE_EDIT){
goalPlace.setTileColor(_local2);
};
};
if ((((_arg1 >= BEGIN_PAINT)) && ((_arg1 < END_PAINT)))){
_local2.paint((_arg1 - BEGIN_PAINT));
} else {
if ((((_arg1 >= BEGIN_STENCIL)) && ((_arg1 < END_STENCIL)))){
applyStencil(_local2, RegionList.stencils[(_arg1 - BEGIN_STENCIL)]);
} else {
if (_arg1 == SOLVENT){
_local2.solvent();
} else {
if (_arg1 == CLOCKWISE){
stencilDir = stencilDir.clockwise();
updateStencils();
} else {
if (_arg1 == COUNTER){
stencilDir = stencilDir.counter();
updateStencils();
};
};
};
};
};
if (type == TILE_EDIT){
goalPlace.setTileColor(_local2);
} else {
if (type == TILE_LAB){
testTile = _local2;
};
};
updateTile();
updateTest();
}
public function setModel(_arg1:PartPlace, _arg2:ButtonStatus):void{
partPlace = _arg1;
if (type == COLOR_LAB){
if (!_arg2.getStatus(Part.MIXER)){
clip.visible = false;
};
};
}
function applyStencil(_arg1:RegionList, _arg2:int):void{
var _local3:*;
var _local4:*;
_local3 = new RegionList();
_local3.addStencil(_arg2);
_local4 = Dir.east;
while (_local4 != stencilDir) {
_local4 = _local4.clockwise();
_local3.clockwise();
};
_arg1.addStencil(_local3.getStencil());
}
function tileClick(_arg1:int):void{
if (type == COLOR_LAB){
colorTypeClick(_arg1);
} else {
tileTypeClick(_arg1);
};
Sound.play(Sound.SELECT);
}
function updateTest():void{
if (type == TILE_LAB){
updateTileView(testTile, side.test);
} else {
if (type == COLOR_LAB){
if (testColor >= 0){
side.paint.visible = true;
side.paint.result.gotoAndStop((testColor + Item.PAINT_BEGIN));
side.paint.left.gotoAndStop((testLeft + Item.PAINT_BEGIN));
side.paint.right.gotoAndStop((testRight + Item.PAINT_BEGIN));
} else {
side.paint.visible = false;
};
};
};
}
override public function show():void{
var _local1:*;
var _local2:*;
var _local3:*;
super.show();
goalPlace.selectTiles();
if (goalPlace.hasTile()){
updateTile();
updateTest();
window.resizeWindow(new Point((Main.WIDTH - 200), (Main.HEIGHT - View.MENU_HEIGHT)));
side.visible = true;
_local1 = goalPlace.getGoalOffset();
window.setOffset(Map.toPixel(new Point((_local1.x - 1), (_local1.y - 1))));
clip.p.visible = true;
clip.message.visible = false;
_local2 = (((type == TILE_EDIT)) || ((type == TILE_LAB)));
for each (_local3 in [clip.p.s0, clip.p.s1, clip.p.s2, clip.p.s3, clip.p.s4, clip.p.s5, clip.p.clockwise, clip.p.counter]) {
_local3.visible = _local2;
};
} else {
side.visible = false;
clip.p.visible = false;
clip.message.visible = true;
};
partPlace.hide();
goalPlace.toggleGoalHeight();
}
}
}//package ui.menu
Section 62
//VictoryMenu (ui.menu.VictoryMenu)
package ui.menu {
import flash.display.*;
import ui.*;
import lib.ui.*;
public class VictoryMenu extends TabMenu {
var clip:VictoryMenuClip;
var buttons:ButtonList;
var partPlace:PartPlace;
var countSteps:Function;
var settings:GameSettings;
var countParts:Function;
var endGame:Function;
var goalPlace:GoalPlace;
public function VictoryMenu(_arg1:DisplayObjectContainer, _arg2:Function, _arg3:GoalPlace):void{
clip = new VictoryMenuClip();
goalPlace = _arg3;
super(_arg1, clip, _arg2, TabList.VICTORY_MENU);
buttons = new ButtonList([clip.nextButton]);
buttons.setActions(click, buttons.frameOver, buttons.frameOut);
clip.nextButton.barText.text = "Complete";
}
override public function hide():void{
super.hide();
clip.visible = false;
goalPlace.show();
if (partPlace != null){
partPlace.show();
};
}
function click(_arg1:int):void{
Sound.play(Sound.SELECT);
endGame(Game.WIN_GAME);
}
override public function cleanup():void{
buttons.cleanup();
super.cleanup();
}
public function setModel(_arg1:GameSettings, _arg2:Function, _arg3:PartPlace, _arg4:Function, _arg5:Function):void{
settings = _arg1;
endGame = _arg2;
partPlace = _arg3;
countParts = _arg4;
countSteps = _arg5;
}
override public function show():void{
var _local1:*;
var _local2:*;
var _local3:*;
var _local4:*;
super.show();
clip.visible = true;
goalPlace.hide();
partPlace.hide();
_local1 = countSteps();
_local2 = Math.floor((_local1 / 60));
_local3 = (_local1 % 60);
_local4 = (_local2 + ":");
if (_local3 < 10){
_local4 = (_local4 + "0");
};
_local4 = (_local4 + _local3);
clip.time.text = _local4;
clip.parts.text = countParts();
if (settings.getId() == null){
clip.nextButton.visible = false;
} else {
clip.nextButton.visible = true;
};
}
}
}//package ui.menu
Section 63
//WireMenu (ui.menu.WireMenu)
package ui.menu {
import flash.display.*;
import logic.*;
import ui.*;
import flash.text.*;
public class WireMenu extends TabMenu {
var wirePlace:WirePlace;
var wireParent:WireParent;
var clip:WireMenuClip;
var partPlace:PartPlace;
var goalPlace:GoalPlace;
public function WireMenu(_arg1:DisplayObjectContainer, _arg2:Function, _arg3:WirePlace, _arg4:WireParent, _arg5:GoalPlace):void{
clip = new WireMenuClip();
wirePlace = _arg3;
wireParent = _arg4;
goalPlace = _arg5;
super(_arg1, clip, _arg2, TabList.WIRE_MENU);
}
override public function hide():void{
super.hide();
wirePlace.hide();
wireParent.hide();
if (partPlace != null){
partPlace.show();
};
goalPlace.show();
}
public function getWireText():TextField{
return (clip.wireText);
}
public function setModel(_arg1:PartPlace, _arg2:ButtonStatus):void{
partPlace = _arg1;
if (!_arg2.getStatus(ButtonStatus.WIRE_BUTTON)){
clip.visible = false;
};
}
override public function show():void{
super.show();
wirePlace.show();
wireParent.show();
partPlace.hide();
goalPlace.hide();
}
}
}//package ui.menu
Section 64
//Anim (ui.Anim)
package ui {
import lib.ui.*;
public class Anim {
public var start:int;
public var cycle:Boolean;
public var end:int;
public var frame:int;
public var paused:Boolean;
public var image:Image;
public function Anim(_arg1:int, _arg2:int):void{
start = _arg1;
end = _arg2;
image = null;
frame = start;
paused = true;
cycle = false;
}
public function clone():Anim{
return (new Anim(start, end));
}
public function play():void{
frame = start;
paused = false;
}
}
}//package ui
Section 65
//AnimList (ui.AnimList)
package ui {
import lib.*;
public class AnimList {
var anims:DList;
public function AnimList():void{
anims = new DList();
}
public function add(_arg1:Anim):void{
anims.pushBack(_arg1);
}
public function remove(_arg1:Anim):void{
anims.remove(_arg1);
}
public function enterFrame():void{
var _local1:DIterator;
var _local2:Anim;
_local1 = anims.frontIterator();
while (_local1.isValid()) {
_local2 = _local1.get();
if (!_local2.paused){
if (_local2.frame == _local2.end){
_local2.frame = _local2.start;
_local2.paused = !(_local2.cycle);
} else {
_local2.frame = (_local2.frame + 1);
};
_local2.image.setFrame(_local2.frame);
};
_local1.increment();
};
}
}
}//package ui
Section 66
//Draw (ui.Draw)
package ui {
public class Draw {
public var op:int;
public var x:Number;
public var y:Number;
var controlX:Number;
var controlY:Number;
static var MOVE = 0;
static var LINE = 1;
static var CURVE = 2;
public function Draw(_arg1:Number, _arg2:Number, _arg3:int, ... _args){
if (_args.length == 2){
controlX = _args[0];
controlY = _args[1];
};
x = _arg1;
y = _arg2;
op = _arg3;
}
}
}//package ui
Section 67
//ExplosionView (ui.ExplosionView)
package ui {
import lib.*;
import lib.ui.*;
public class ExplosionView {
var anims:AnimList;
var explosion:Image;
var images:ImageList;
var animation:Anim;
public function ExplosionView(_arg1:Point, _arg2:ImageList, _arg3:AnimList):void{
images = _arg2;
anims = _arg3;
explosion = new Image(ImageConfig.explosion);
explosion.setPos(_arg1);
images.add(explosion);
animation = new Anim(1, 26);
animation.image = explosion;
animation.play();
anims.add(animation);
}
public function cleanup():void{
images.remove(explosion);
explosion.cleanup();
anims.remove(animation);
}
public function isDone():Boolean{
return ((animation.frame >= 25));
}
}
}//package ui
Section 68
//FactoryBorder (ui.FactoryBorder)
package ui {
import flash.display.*;
import lib.*;
import logic.*;
import flash.events.*;
import lib.ui.*;
import flash.geom.*;
public class FactoryBorder extends WindowBorder {
var south:Array;
var partPlace:PartPlace;
var horizontal:Array;
var vertical:Array;
var type:int;
var border:MovieClip;
var east:Array;
var children:Array;
public static var DESERT = 1;
public static var GRASS = 0;
public function FactoryBorder(_arg1:int):void{
type = _arg1;
vertical = [];
horizontal = [];
super();
}
function cleanupChildren():void{
var _local1:*;
for each (_local1 in children) {
_local1.parent.removeChild(_local1);
};
children = [];
south = [];
east = [];
}
override public function update(_arg1:Point, _arg2:Point, _arg3:Point, _arg4:Point):void{
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
var _local10:*;
clip.x = ((-(_arg1.x) + _arg2.x) - Map.tileSize);
clip.y = ((-(_arg1.y) + _arg2.y) - Map.tileSize);
border.scaleX = ((_arg3.x / Map.tileSize) + 2);
border.scaleY = ((_arg3.y / Map.tileSize) + 2);
for each (_local5 in south) {
_local5.y = (_arg3.y + Map.tileSize);
};
for each (_local6 in east) {
_local6.x = (_arg3.x + Map.tileSize);
};
if (_arg3.x < _arg4.x){
for each (_local7 in horizontal) {
_local7.visible = false;
};
} else {
for each (_local8 in horizontal) {
if (_local8.visible == false){
_local8.visible = true;
};
};
};
if (_arg3.y < _arg4.y){
for each (_local9 in vertical) {
_local9.visible = false;
};
} else {
for each (_local10 in vertical) {
if (_local10.visible == false){
_local10.visible = true;
};
};
};
}
override public function init(_arg1:DisplayObjectContainer):void{
children = [];
east = [];
south = [];
super.init(_arg1);
createClip(new GrassEdgeClip(), 0x0400, Map.tileSize, 0, false, false);
createClip(new GrassEdgeClip(), 0x0400, 0, 180, true, false);
createClip(new GrassEdgeClip(), 0, 0x0400, 90, false, true);
createClip(new GrassEdgeClip(), Map.tileSize, 0x0400, -90, false, false);
createClip(new GrassCornerClip(), Map.tileSize, Map.tileSize, 0, false, false);
createClip(new GrassCornerClip(), 0, Map.tileSize, 90, false, true);
createClip(new GrassCornerClip(), 0, 0, 180, true, true);
createClip(new GrassCornerClip(), Map.tileSize, 0, -90, true, false);
border = new GrassOutsideClip();
clip.addChild(border);
clip.graphics.drawRect((-5 * 32), (-5 * 32), (11 * 32), (11 * 32));
clip.scale9Grid = new Rectangle(0, 0, 32, 32);
clip.addEventListener(MouseEvent.MOUSE_MOVE, mouseMove);
}
function mouseMove(_arg1:MouseEvent):void{
if (partPlace != null){
partPlace.hoverMenu(_arg1.stageX, _arg1.stageY);
};
}
override public function cleanup():void{
clip.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMove);
cleanupChildren();
border.parent.removeChild(border);
super.cleanup();
}
public function setModel(_arg1:Array, _arg2:Array, _arg3:PartPlace){
vertical = _arg1;
horizontal = _arg2;
partPlace = _arg3;
}
function createClip(_arg1:MovieClip, _arg2:int, _arg3:int, _arg4:int, _arg5:Boolean, _arg6:Boolean):void{
clip.addChild(_arg1);
children.push(_arg1);
_arg1.x = _arg2;
_arg1.y = _arg3;
_arg1.rotation = _arg4;
if (_arg5){
south.push(_arg1);
};
if (_arg6){
east.push(_arg1);
};
}
}
}//package ui
Section 69
//GoalPlace (ui.GoalPlace)
package ui {
import flash.display.*;
import lib.*;
import logic.*;
import lib.ui.*;
public class GoalPlace {
var buttons:ButtonList;
var currentGoal:Goal;
var arrowButtons:ButtonList;
var goals:Array;
var currentTile:Point;
var seekingTiles:Boolean;
var isActive:Boolean;
var refreshMenu:Function;
var map:Map;
var tileButtons:ButtonList;
var images:ImageList;
var select:SelectClip;
var window:Window;
static var MOVE = 0;
static var CONTRACT = 2;
static var EXPAND = 1;
public function GoalPlace(_arg1:DisplayObjectContainer, _arg2:Window, _arg3:ImageList):void{
window = _arg2;
window.addClickCommand(clickMap);
window.addScrollCommand(scrollMap);
images = _arg3;
select = new SelectClip();
_arg1.addChild(select);
select.visible = false;
goals = null;
map = null;
currentGoal = null;
currentTile = null;
isActive = false;
seekingTiles = false;
}
public function clearGoal():void{
if (currentGoal != null){
currentGoal.showNormal();
};
currentGoal = null;
currentTile = null;
}
public function getGoalOffset():Point{
return (currentGoal.getBounds().getOffset());
}
public function toggleGoalHeight():void{
window.swapLayers(ImageConfig.goalLayer, ImageConfig.goalTop);
window.swapLayers(ImageConfig.goalTileLayer, ImageConfig.goalTileTop);
window.swapLayers(ImageConfig.goalTextLayer, ImageConfig.goalTextTop);
}
public function setTileColor(_arg1:RegionList):void{
currentGoal.changeTile(currentTile, _arg1);
}
public function getTileColor():RegionList{
return (currentGoal.getTile(currentTile));
}
public function cleanup():void{
select.parent.removeChild(select);
}
function updateSelect():void{
var _local1:*;
if (currentTile != null){
select.visible = true;
_local1 = window.toRelative(Map.toCenterPixel(currentTile));
select.x = _local1.x;
select.y = _local1.y;
} else {
select.visible = false;
};
}
public function selectGoals():void{
seekingTiles = false;
currentTile = null;
updateSelect();
}
function selectGoal(_arg1:Point):Boolean{
var _local2:*;
var _local3:*;
if (currentGoal != null){
currentGoal.showNormal();
currentGoal = null;
currentTile = null;
};
_local2 = null;
for each (_local3 in goals) {
if (_local3.contains(_arg1)){
_local2 = _local3;
break;
};
};
if (_local2 != null){
Sound.play(Sound.SELECT);
currentGoal = _local2;
currentGoal.showSelected();
currentTile = null;
} else {
Sound.play(Sound.CANCEL);
currentGoal = null;
currentTile = null;
};
return (!((currentGoal == null)));
}
function clickMap(_arg1:Point):Boolean{
var _local2:*;
var _local3:*;
_local2 = false;
if (isActive){
_local3 = Map.toTile(_arg1);
_local2 = selectGoal(_local3);
if (((((!((currentGoal == null))) && (currentGoal.contains(_local3)))) && (seekingTiles))){
currentTile = _local3;
_local2 = true;
};
updateSelect();
refreshMenu();
};
return (_local2);
}
public function canChangeSize(_arg1:Point):Boolean{
var _local2:*;
var _local3:*;
var _local4:*;
_local2 = true;
_local3 = new Box(new Point(0, 0), _arg1);
for each (_local4 in goals) {
if (!_local3.containsBox(_local4.getBounds())){
_local2 = false;
break;
};
};
return (_local2);
}
public function hide():void{
isActive = false;
if (currentGoal != null){
currentGoal.showNormal();
currentGoal = null;
};
currentTile = null;
updateSelect();
}
public function hasGoal():Boolean{
return (!((currentGoal == null)));
}
function scrollMap(_arg1:Point):Boolean{
if (((isActive) && (!((currentTile == null))))){
updateSelect();
};
return (false);
}
public function addGoal():void{
var _local1:*;
var _local2:*;
var _local3:*;
var _local4:*;
_local1 = new Point((map.getSize().x / 2), (map.getSize().y / 2));
_local2 = new Box(_local1, new Point((_local1.x + 3), (_local1.y + 3)));
_local3 = new GoalView(_local2, images);
_local4 = new Goal(_local3, _local2);
goals.push(_local4);
}
public function deleteGoal():void{
var _local1:*;
_local1 = goals.indexOf(currentGoal);
if (_local1 != -1){
goals.splice(_local1, 1);
};
currentGoal.cleanup();
currentGoal = null;
}
public function hideSelect():void{
select.visible = false;
currentTile = null;
}
public function setModel(_arg1:Array, _arg2:Map, _arg3:Function):void{
goals = _arg1;
map = _arg2;
refreshMenu = _arg3;
}
public function hasTile():Boolean{
return (((!((currentGoal == null))) && (!((currentTile == null)))));
}
public function selectTiles():void{
seekingTiles = true;
}
public function modifyGoal(_arg1:int, _arg2:Dir):void{
if (_arg1 == MOVE){
currentGoal.move(_arg2, map);
} else {
if (_arg1 == EXPAND){
currentGoal.expand(_arg2, map);
} else {
if (_arg1 == CONTRACT){
currentGoal.contract(_arg2, map);
};
};
};
}
public function deleteTile():void{
currentGoal.removeTile(currentTile);
}
public function show():void{
isActive = true;
}
}
}//package ui
Section 70
//GoalTileView (ui.GoalTileView)
package ui {
import lib.*;
import logic.*;
import lib.ui.*;
public class GoalTileView {
var images:ImageList;
var tile:ImageRegion;
public function GoalTileView(_arg1:Point, _arg2:ImageList):void{
images = _arg2;
tile = new ImageRegion(ImageConfig.goalTile);
images.add(tile);
updatePos(_arg1);
}
public function cleanup():void{
images.remove(tile);
tile.cleanup();
}
public function updateColor(_arg1:RegionList):void{
tile.setRegion(_arg1);
}
public function updatePos(_arg1:Point):void{
tile.setPos(Map.toCenterPixel(_arg1));
}
}
}//package ui
Section 71
//GoalView (ui.GoalView)
package ui {
import lib.*;
import logic.*;
import lib.ui.*;
public class GoalView {
var text:ImageText;
var background:ImageBox;
var images:ImageList;
static var boxAlpha = 0.2;
public static var boxColorSelected = 0;
public static var boxColorNormal = 0x777777;
public function GoalView(_arg1:Box, _arg2:ImageList):void{
images = _arg2;
text = new ImageText(ImageConfig.goalText);
images.add(text);
background = null;
updateBounds(_arg1, boxColorNormal);
}
public function cleanup():void{
images.remove(text);
text.cleanup();
if (background != null){
images.remove(background);
background.cleanup();
};
}
public function updateCount(_arg1:int):void{
if (_arg1 <= 0){
text.setVisible(false);
} else {
text.setVisible(true);
text.setText(String(_arg1));
};
}
public function makeTileSprite(_arg1:Point):GoalTileView{
return (new GoalTileView(_arg1, images));
}
public function updateBounds(_arg1:Box, _arg2:int):void{
var _local3:*;
var _local4:*;
if (background != null){
images.remove(background);
background.cleanup();
background = null;
};
text.setPos(Map.toCenterPixel(_arg1.getOffset()));
_local3 = new ImageType("EmptyClip", ImageConfig.goalLayer, Map.toPixel(_arg1.getSize()));
background = new ImageBox(_local3);
images.add(background);
background.setPos(Map.toCenterPixelBox(_arg1));
_local4 = Map.toPixel(_arg1.getSize());
Map.toPixel(_arg1.getSize()).x = (_local4.x + Map.halfTileSize);
_local4.y = (_local4.y + Map.halfTileSize);
background.setBox(_local4, _arg2, boxAlpha);
}
}
}//package ui
Section 72
//ImageBox (ui.ImageBox)
package ui {
import lib.*;
import lib.ui.*;
public class ImageBox extends Image {
var boxAlpha:Number;
var boxColor:int;
var boxChanged:Boolean;
var boxSize:Point;
public function ImageBox(_arg1:ImageType):void{
boxSize = null;
boxColor = 0;
boxAlpha = 1;
super(_arg1);
}
public function setBox(_arg1:Point, _arg2:int, _arg3:Number):void{
if (_arg1 == null){
boxSize = _arg1;
} else {
boxSize = _arg1.clone();
boxColor = _arg2;
boxAlpha = _arg3;
};
boxChanged = true;
}
override protected function invalidate():void{
super.invalidate();
boxChanged = true;
}
function updateBox():void{
if (((boxChanged) && (!((image == null))))){
image.graphics.clear();
image.graphics.beginFill(boxColor, boxAlpha);
image.graphics.drawRect(-((boxSize.x / 2)), -((boxSize.y / 2)), boxSize.x, boxSize.y);
image.graphics.endFill();
};
boxChanged = false;
}
override public function update(_arg1:Window):void{
super.update(_arg1);
updateBox();
}
}
}//package ui
Section 73
//ImageConfig (ui.ImageConfig)
package ui {
import lib.*;
import logic.*;
import lib.ui.*;
public class ImageConfig {
public static var goalTop:int = 8;
public static var layerCount:int = 11;
public static var trackLayer:int = 3;
public static var goalLayer:int = 0;
public static var goalTextLayer:int = 2;
public static var track = new ImageType("TrackClip", trackLayer, new Point(Map.tileSize, Map.tileSize));
public static var wireLayer:int = 5;
public static var goalTextTop:int = 10;
public static var item = new ImageType("ItemClip", itemLayer, new Point(Map.tileSize, Map.tileSize));
public static var cloudLayer:int = 7;
public static var goalTile = new ImageType("ItemClip", goalTileLayer, new Point(Map.tileSize, Map.tileSize));
public static var explosion = new ImageType("ExplosionClip", cloudLayer, new Point(Map.tileSize, Map.tileSize));
public static var floorLayer:int = 4;
public static var goalText = new ImageType("EmptyClip", goalTextLayer, new Point(44, 89));
public static var goalTileLayer:int = 1;
public static var goalTileTop:int = 9;
public static var itemLayer:int = 6;
}
}//package ui
Section 74
//ImageRegion (ui.ImageRegion)
package ui {
import flash.display.*;
import logic.*;
import lib.ui.*;
public class ImageRegion extends Image {
var regionChanged:Boolean;
var regionClip:Shape;
var region:RegionList;
public function ImageRegion(_arg1:ImageType):void{
region = null;
regionClip = null;
super(_arg1);
}
override protected function clearImage():void{
if (regionClip != null){
regionClip.parent.removeChild(regionClip);
};
regionClip = null;
super.clearImage();
}
override protected function updateFrame():void{
if (((((frameChanged) && (!((image == null))))) && (!((regionClip == null))))){
super.updateFrame();
regionClip.parent.removeChild(regionClip);
image.addChild(regionClip);
};
}
function updateRegion():void{
if (((((regionChanged) && (!((image == null))))) && (!((regionClip == null))))){
regionClip.graphics.clear();
if (region != null){
region.drawRegions(regionClip.graphics, (-((Map.tileSize - 2)) / 2), (Map.tileSize - 2));
};
};
regionChanged = false;
}
override protected function invalidate():void{
super.invalidate();
regionChanged = true;
}
override public function update(_arg1:Window):void{
super.update(_arg1);
updateRegion();
}
override protected function resetImage(_arg1:Window):void{
super.resetImage(_arg1);
regionClip = new Shape();
image.addChild(regionClip);
regionClip.cacheAsBitmap = true;
}
public function setRegion(_arg1:RegionList):void{
if ((((region == null)) && (!((_arg1 == null))))){
region = _arg1.clone();
regionChanged = true;
} else {
if (_arg1 == null){
region = null;
regionChanged = true;
} else {
if (!RegionList.isEqual(region, _arg1)){
region.copyFrom(_arg1);
regionChanged = true;
};
};
};
}
}
}//package ui
Section 75
//ItemView (ui.ItemView)
package ui {
import lib.*;
import logic.*;
import lib.ui.*;
import flash.filters.*;
public class ItemView {
var item:ImageRegion;
var pos:Point;
var angle:Number;
var shrinkage:Number;
var images:ImageList;
static var shrinkStep = (1 / (Model.HALF_DELAY + 7));
static var stickyGlow = new GlowFilter(13382604, 0.8, 10, 10, 3, 3);
public function ItemView(_arg1:int, _arg2:Point, _arg3:ImageList):void{
shrinkage = 0;
angle = 0;
images = _arg3;
item = new ImageRegion(ImageConfig.item);
images.add(item);
item.setAlpha(shrinkage);
item.setScale(shrinkage);
updateType(_arg1);
move(_arg2);
}
public function grow():void{
shrinkage = (shrinkage + shrinkStep);
item.setAlpha(shrinkage);
item.setScale(shrinkage);
}
public function updateType(_arg1:int):void{
item.setFrame(_arg1);
}
public function cleanup():void{
images.remove(item);
item.cleanup();
}
public function normalSize():void{
shrinkage = 1;
item.setAlpha(shrinkage);
item.setScale(shrinkage);
}
public function shrink():void{
shrinkage = (shrinkage - shrinkStep);
item.setAlpha(shrinkage);
item.setScale(shrinkage);
}
public function updateRotation(_arg1:Dir):void{
angle = _arg1.toAngle();
item.setRotation(_arg1.toAngle());
}
public function move(_arg1:Point):void{
pos = Map.toCenterPixel(_arg1);
item.setPos(pos);
}
public function updateSticky(_arg1:Boolean):void{
if (_arg1){
item.setFilter(stickyGlow);
} else {
item.setFilter(null);
};
}
public function updateColor(_arg1:RegionList):void{
item.setRegion(_arg1);
}
public function rotate(_arg1:Number):void{
angle = (angle + _arg1);
item.setRotation(angle);
}
public function moveDir(_arg1:Dir, _arg2:int):void{
Dir.walkMod(pos, _arg1, _arg2);
item.setPos(pos);
}
}
}//package ui
Section 76
//PartPlace (ui.PartPlace)
package ui {
import flash.display.*;
import lib.*;
import logic.*;
import lib.ui.*;
import logic.change.*;
public class PartPlace {
var changes:ChangeList;
var overlay:Shape;
var moveTarget:Part;
var map:Map;
var lastPos:Point;
var setMenu:Function;
var plan:MovieClip;
var parent:DisplayObjectContainer;
var shouldMove:Boolean;
var keyboard:Keyboard;
var window:Window;
var isEditor:Boolean;
var part:PartSpec;
static var alphaLevel:Number = 0.5;
static var okColor:int = 3407667;
static var badColor:int = 16724787;
public function PartPlace(_arg1:DisplayObjectContainer, _arg2:Keyboard, _arg3:Window):void{
parent = _arg1;
keyboard = _arg2;
part = new PartSpec(0, new Point(0, 0), Dir.north, true);
plan = null;
overlay = null;
changes = null;
map = null;
window = _arg3;
window.addClickCommand(clickMap);
window.addHoverCommand(hoverMap);
isEditor = false;
shouldMove = true;
moveTarget = null;
}
function hoverMap(_arg1:Point):Boolean{
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
lastPos = null;
if (_arg1 != null){
lastPos = _arg1.clone();
};
_local2 = false;
if (plan != null){
_local2 = true;
if (_arg1 != null){
plan.visible = true;
_local3 = Map.toTile(_arg1);
_local4 = Map.toCenterPixel(_local3);
_local5 = window.toRelative(_local4);
plan.x = _local5.x;
plan.y = _local5.y;
if (((map.canPlacePart(_local3)) || (((map.insideMap(_local3)) && ((map.getTile(_local3).part == moveTarget)))))){
drawColorBox(okColor);
} else {
drawColorBox(badColor);
};
};
};
return (_local2);
}
public function hide():void{
cleanupPlan();
cleanupMove();
shouldMove = false;
}
function update():void{
var _local1:*;
var _local2:*;
var _local3:*;
var _local4:*;
_local1 = parent.stage.mouseX;
_local2 = parent.stage.mouseY;
if (plan != null){
_local1 = plan.x;
_local2 = plan.y;
};
cleanupPlan();
keyboard.addHandler(hotkey);
_local3 = PartView.getLinkage(part.type, part.dir);
plan = Image.createClip(_local3);
parent.addChild(plan);
plan.x = _local1;
plan.y = _local2;
plan.mouseChildren = false;
plan.mouseEnabled = false;
overlay = new Shape();
plan.addChild(overlay);
if (PartView.shouldRotate(part.type)){
plan.rotation = part.dir.toAngle();
};
_local4 = [];
if (PartView.shouldGlow(part.type)){
if (part.power){
_local4.push(PartView.glow);
};
} else {
if (part.power){
plan.gotoAndStop(2);
} else {
plan.gotoAndStop(1);
};
};
plan.filters = _local4;
hoverMap(lastPos);
}
public function returnToMenu():void{
if (part.type <= Part.COPIER){
setMenu(TabList.PART_MENU);
} else {
setMenu(TabList.ITEM_MENU);
};
}
function drawColorBox(_arg1:int):void{
var _local2:*;
_local2 = overlay.graphics;
_local2.clear();
_local2.beginFill(_arg1, alphaLevel);
_local2.drawRect(-(Map.halfTileSize), -(Map.halfTileSize), Map.tileSize, Map.tileSize);
_local2.endFill();
}
public function togglePower():void{
if (Part.canPower(part.type)){
part.power = !(part.power);
update();
};
}
function cleanupMove():void{
if (moveTarget != null){
changes.add(Util.makeChange(ChangePart.destroyPartWires, moveTarget));
changes.add(Util.makeChange(ChangePart.destroy, moveTarget));
changes.add(Util.makeChange(ChangePart.destroySpec, moveTarget.getSpec()));
moveTarget = null;
};
}
public function cleanup():void{
cleanupPlan();
}
public function setModel(_arg1:ChangeList, _arg2:Map, _arg3:Boolean, _arg4:Function):void{
changes = _arg1;
map = _arg2;
isEditor = _arg3;
setMenu = _arg4;
}
function cleanupPlan():void{
if (plan != null){
keyboard.removeHandler(hotkey);
overlay.parent.removeChild(overlay);
overlay = null;
plan.parent.removeChild(plan);
plan = null;
};
}
function hotkey(_arg1:String, _arg2:int):Boolean{
var _local3:*;
_local3 = false;
if (Part.canRotate(part.type)){
if ((((_arg1 == "w")) || ((_arg1 == "W")))){
part.dir = Dir.north;
_local3 = true;
} else {
if ((((_arg1 == "s")) || ((_arg1 == "S")))){
part.dir = Dir.south;
_local3 = true;
} else {
if ((((_arg1 == "d")) || ((_arg1 == "D")))){
part.dir = Dir.east;
_local3 = true;
} else {
if ((((_arg1 == "a")) || ((_arg1 == "A")))){
part.dir = Dir.west;
_local3 = true;
};
};
};
};
};
if (_arg1 == " "){
if (Part.canPower(part.type)){
part.power = !(part.power);
_local3 = true;
};
};
if (_local3){
Sound.play(Sound.SELECT);
update();
};
return (_local3);
}
function clickMap(_arg1:Point):Boolean{
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
_local2 = false;
_local3 = Map.toTile(_arg1);
if (((!((moveTarget == null))) && (((map.canPlacePart(_local3)) || (((map.insideMap(_local3)) && ((map.getTile(_local3).part == moveTarget)))))))){
_local2 = true;
_local4 = moveTarget.getPos();
map.untrackAll(_local3);
map.getTile(_local4).part = null;
map.getTile(_local3).part = moveTarget;
moveTarget.modifyPart(_local3, part.dir, part.power);
moveTarget.show();
moveTarget = null;
map.retrackAll(_local3);
map.retrackAll(_local4);
cleanupPlan();
setMenu(TabList.PART_MENU);
Sound.play(Sound.MOUSE_OVER);
} else {
if (((!((plan == null))) && ((moveTarget == null)))){
_local2 = true;
part.pos = _local3;
_local5 = part.clone();
changes.add(Util.makeChange(ChangePart.create, _local5));
changes.add(Util.makeChange(ChangePart.createSpec, _local5));
if (!keyboard.shift()){
returnToMenu();
cleanupPlan();
};
Sound.play(Sound.MOUSE_OVER);
} else {
if (((((((shouldMove) && ((moveTarget == null)))) && (!((map.getTile(_local3).part == null))))) && (((isEditor) || ((map.getTile(_local3).part.isFixed() == false)))))){
_local2 = true;
_local6 = map.getTile(_local3).part.getSpec();
setPart(_local6.type);
moveTarget = map.getTile(_local3).part;
part.pos = _local6.pos.clone();
part.dir = _local6.dir;
part.power = _local6.power;
part.fixed = _local6.fixed;
update();
moveTarget.hide();
moveTarget.removeAllTracks();
setMenu(TabList.PLACE_MENU);
Sound.play(Sound.MOUSE_OVER);
} else {
Sound.play(Sound.CANCEL);
};
};
};
return (_local2);
}
public function setPart(_arg1:int):void{
cleanupMove();
part.type = _arg1;
part.dir = Dir.east;
if (Part.canPower(part.type)){
part.power = true;
} else {
part.power = false;
};
part.fixed = isEditor;
update();
}
public function clockwise():void{
if (Part.canRotate(part.type)){
part.dir = part.dir.clockwise();
update();
};
}
public function hoverMenu(_arg1:Number, _arg2:Number):void{
if (plan != null){
plan.x = _arg1;
plan.y = _arg2;
overlay.graphics.clear();
};
}
public function counter():void{
if (Part.canRotate(part.type)){
part.dir = part.dir.counter();
update();
};
}
public function show():void{
shouldMove = true;
}
}
}//package ui
Section 77
//PartView (ui.PartView)
package ui {
import lib.*;
import logic.*;
import lib.ui.*;
import flash.filters.*;
public class PartView {
var anims:AnimList;
var part:Image;
var lastPos:Point;
var partAnim:Anim;
var cloudAnim:Anim;
var lastDir:Dir;
var cloud:Image;
var images:ImageList;
var type:int;
static var partLinkage = [["AllClip"], ["SomeClip"], ["NoneClip"], ["MemClip"], ["SetClip"], ["ClearClip"], ["ConveyerClip"], ["BarrierClip"], ["RotaterClip", "CounterClip", "RotaterClip", "CounterClip"], ["SensorClip"], ["SprayerClip"], ["MixerClip"], ["CopierClip"], ["TileClip"], ["SolventClip"], ["GlueClip"], ["TriangleMakerClip"], ["RectangleMakerClip"], ["SmallCircleMakerClip"], ["CircleMakerClip"], ["BigCircleMakerClip"], ["WhiteClip"], ["CyanClip"], ["MagentaClip"], ["YellowClip"], ["BlackClip"]];
static var partFrames = [null, null, null, null, null, null, new Anim(2, 17), null, new Anim(2, 17), null, new Anim(2, 17), new Anim(2, 17), new Anim(2, 17), null, null, null, null, null, null, null, null, null, null, null, null, null];
public static var glow = new GlowFilter(0xFFFF00, 0.8, 10, 10, 3, 3, true);
public function PartView(_arg1:PartSpec, _arg2:ImageList, _arg3:AnimList):void{
type = _arg1.type;
images = _arg2;
anims = _arg3;
updateDir(_arg1.dir);
updatePos(_arg1.pos);
partAnim = null;
cloud = null;
cloudAnim = null;
if (partFrames[type] != null){
partAnim = partFrames[type].clone();
partAnim.image = part;
if (type == Part.CONVEYER){
partAnim.cycle = true;
};
anims.add(partAnim);
};
updatePower(_arg1.power);
}
public function hide():void{
part.setVisible(false);
}
public function updateDir(_arg1:Dir):void{
lastDir = _arg1;
if (((!(shouldRotate(type))) && (!((part == null))))){
cleanup();
part = null;
};
if (part == null){
part = new Image(makeType(_arg1));
images.add(part);
if (partAnim != null){
partAnim.image = part;
};
};
if (shouldRotate(type)){
part.setRotation(_arg1.toAngle());
};
}
function getCloudLinkage(_arg1:Item):String{
var _local2:*;
var _local3:*;
_local2 = "Cloud_Paint_15";
if (_arg1 != null){
_local3 = _arg1.getType();
if (_local3 == Item.SOLVENT){
_local2 = "Cloud_Solvent";
} else {
if (_local3 == Item.GLUE){
_local2 = "Cloud_Glue";
} else {
if ((((_local3 >= Item.STENCIL_BEGIN)) && ((_local3 < Item.STENCIL_END)))){
_local2 = "Cloud_Stencil";
} else {
if ((((_local3 >= Item.PAINT_BEGIN)) && ((_local3 < Item.PAINT_END)))){
_local2 = ("Cloud_Paint_" + String((_local3 - Item.PAINT_BEGIN)));
};
};
};
};
};
return (_local2);
}
public function getTrackSprite():TrackView{
return (new TrackView(images, anims));
}
public function updatePos(_arg1:Point):void{
lastPos = _arg1.clone();
part.setPos(Map.toCenterPixel(_arg1));
}
function makeType(_arg1:Dir):ImageType{
var _local2:*;
_local2 = ImageConfig.floorLayer;
return (new ImageType(getLinkage(type, _arg1), _local2, new Point(Map.tileSize, Map.tileSize)));
}
public function animate(_arg1:Item):void{
var _local2:*;
var _local3:*;
if (partAnim != null){
partAnim.play();
};
if (type == Part.SPRAYER){
if (cloud == null){
_local2 = new ImageType(getCloudLinkage(_arg1), ImageConfig.cloudLayer, new Point(40, 40));
cloud = new Image(_local2);
images.add(cloud);
_local3 = Map.toCenterPixel(Dir.step(lastPos, lastDir));
cloud.setPos(_local3);
cloud.setRotation(lastDir.toAngle());
cloudAnim = new Anim(1, 16);
cloudAnim.image = cloud;
anims.add(cloudAnim);
};
cloudAnim.play();
};
}
public function cleanup():void{
images.remove(part);
part.cleanup();
if (partAnim != null){
anims.remove(partAnim);
};
if (cloud != null){
images.remove(cloud);
cloud.cleanup();
};
if (cloudAnim != null){
anims.remove(cloudAnim);
};
}
public function updatePower(_arg1:Boolean):void{
if (shouldGlow(type)){
if (_arg1){
part.setFilter(glow);
} else {
part.setFilter(null);
};
} else {
if (_arg1){
part.setFrame(2);
if (type == Part.CONVEYER){
animate(null);
};
} else {
part.setFrame(1);
};
if (partAnim != null){
partAnim.paused = true;
};
};
}
public function show():void{
part.setVisible(true);
}
public static function shouldGlow(_arg1:int):Boolean{
return (false);
}
public static function shouldRotate(_arg1:int):Boolean{
return ((partLinkage[_arg1].length <= 1));
}
public static function getLinkage(_arg1:int, _arg2:Dir):String{
var _local3:*;
_local3 = partLinkage[_arg1];
if (_local3.length == 0){
return ("TileMakerClip");
};
if (_local3.length == 1){
return (_local3[0]);
};
return (_local3[_arg2.toIndex()]);
}
}
}//package ui
Section 78
//RegionList (ui.RegionList)
package ui {
import flash.display.*;
import flash.utils.*;
public class RegionList {
var stencil:int;
var absorb:int;
var cyan:int;
var magenta:int;
var yellow:int;
static var OUTSIDE = 1;
static var stencilColor = 10309960;
public static var regionMap = null;
static var WHITE = 0;
static var blackTable = [14, 15, 3, 15, 5, 15, 7, 15, 9, 15, 11, 15, 13, 15, 1, 15];
static var BLACK = 15;
static var whiteTable = [0, 14, 0, 2, 0, 4, 0, 6, 0, 8, 0, 10, 0, 12, 0, 1];
public static var REGION_COUNT = 32;
public static var stencils = [4289331285, 4294901760, 50331648, 251658240, 1056964608];
static var colorMap = [0xFFFFFF, 0x555555, 16777045, 0xAA5500, 16733695, 0xAA00AA, 16733525, 0xAA0000, 5636095, 0xAAAA, 5635925, 0xAA00, 5592575, 170, 0xAAAAAA, 0];
static var INSIDE = 0;
public function RegionList():void{
cyan = 0;
magenta = 0;
yellow = 0;
absorb = 0;
stencil = 0;
}
public function solvent():void{
stencil = 0;
}
public function getStencil():int{
return (stencil);
}
function scale(_arg1:Number, _arg2:int, _arg3:int):Number{
return (((_arg1 * _arg3) + _arg2));
}
function counterColor(_arg1:int):int{
return ((((_arg1 >> 8) & 0xFFFFFF) | ((_arg1 << 24) & 4278190080)));
}
function clockwiseColor(_arg1:int):int{
return (((_arg1 << 8) | ((_arg1 >> 24) & 0xFF)));
}
public function reset(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int):void{
cyan = _arg1;
magenta = _arg2;
yellow = _arg3;
absorb = _arg4;
stencil = _arg5;
}
public function drawRegions(_arg1:Graphics, _arg2:int, _arg3:int):void{
var _local4:*;
var _local5:*;
_arg1.clear();
_local4 = 0;
while (_local4 < RegionList.REGION_COUNT) {
if (!isStencil(_local4)){
_local5 = getScreenColor(_local4);
drawNextRegion(_arg1, _local4, _local5, _arg2, _arg3);
};
_local4++;
};
}
public function clone():RegionList{
var _local1:*;
_local1 = new RegionList();
_local1.copyFrom(this);
return (_local1);
}
public function paint(_arg1:int):void{
cyan = ((cyan & stencil) | (-(((_arg1 >> 3) & 1)) & ~(stencil)));
magenta = ((magenta & stencil) | (-(((_arg1 >> 2) & 1)) & ~(stencil)));
yellow = ((yellow & stencil) | (-(((_arg1 >> 1) & 1)) & ~(stencil)));
absorb = ((absorb & stencil) | (-((_arg1 & 1)) & ~(stencil)));
}
public function setColor(_arg1:int, _arg2:int):void{
var _local3:*;
_local3 = ~((1 << _arg1));
cyan = ((cyan & _local3) | (((_arg2 >> 3) & 1) << _arg1));
magenta = ((magenta & _local3) | (((_arg2 >> 2) & 1) << _arg1));
yellow = ((yellow & _local3) | (((_arg2 >> 1) & 1) << _arg1));
absorb = ((absorb & _local3) | ((_arg2 & 1) << _arg1));
}
public function addStencil(_arg1:int):void{
stencil = (stencil | _arg1);
}
public function getScreenColor(_arg1:int):int{
var _local2:*;
_local2 = 0;
if (isStencil(_arg1)){
_local2 = stencilColor;
} else {
_local2 = colorMap[getColor(_arg1)];
};
return (_local2);
}
function drawNextRegion(_arg1:Graphics, _arg2:int, _arg3:int, _arg4:int, _arg5:int):void{
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
var _local10:*;
_arg1.beginFill(_arg3);
for each (_local6 in RegionList.regionMap[_arg2]) {
_local7 = scale(_local6.x, _arg4, _arg5);
_local8 = scale(_local6.y, _arg4, _arg5);
if (_local6.op == Draw.MOVE){
_arg1.moveTo(_local7, _local8);
} else {
if (_local6.op == Draw.LINE){
_arg1.lineTo(_local7, _local8);
} else {
if (_local6.op == Draw.CURVE){
_local9 = scale(_local6.controlX, _arg4, _arg5);
_local10 = scale(_local6.controlY, _arg4, _arg5);
_arg1.curveTo(_local9, _local10, _local7, _local8);
};
};
};
};
_arg1.endFill();
}
public function getColor(_arg1:int):int{
return (((((((cyan >> _arg1) & 1) << 3) | (((magenta >> _arg1) & 1) << 2)) | (((yellow >> _arg1) & 1) << 1)) | ((absorb >> _arg1) & 1)));
}
public function isStencil(_arg1:int):Boolean{
return ((((stencil >> _arg1) & 1) == 1));
}
public function clockwise():void{
cyan = clockwiseColor(cyan);
magenta = clockwiseColor(magenta);
yellow = clockwiseColor(yellow);
absorb = clockwiseColor(absorb);
stencil = clockwiseColor(stencil);
}
public function setStencil(_arg1:int):void{
stencil = (stencil | (1 << _arg1));
}
public function counter():void{
cyan = counterColor(cyan);
magenta = counterColor(magenta);
yellow = counterColor(yellow);
absorb = counterColor(absorb);
stencil = counterColor(stencil);
}
public function save(_arg1:ByteArray):void{
_arg1.writeUnsignedInt(cyan);
_arg1.writeUnsignedInt(magenta);
_arg1.writeUnsignedInt(yellow);
_arg1.writeUnsignedInt(absorb);
_arg1.writeUnsignedInt(stencil);
}
public function copyFrom(_arg1:RegionList):void{
cyan = _arg1.cyan;
magenta = _arg1.magenta;
yellow = _arg1.yellow;
absorb = _arg1.absorb;
stencil = _arg1.stencil;
}
public static function setupRegions():void{
var _local1:*;
regionMap = new Array(REGION_COUNT);
_local1 = 0;
_local1 = 0;
while (_local1 < REGION_COUNT) {
regionMap[_local1] = new Array();
_local1++;
};
addMove(0, 0, 0);
addLine(0, 0, 0.2);
addCurve(0, 0.2, OUTSIDE);
addLine(0, 0, 0);
addMove(2, 0, 0.2);
addLine(2, 0, 0.33);
addCurve(2, 0.33, OUTSIDE);
addLine(2, findMiddle(0.2), findMiddle(0.2));
addCurve(2, 0.2, INSIDE);
addMove(4, 0, 0.33);
addLine(4, 0, 0.5);
addCurve(4, 0.5, OUTSIDE);
addLine(4, findMiddle(0.33), findMiddle(0.33));
addCurve(4, 0.33, INSIDE);
addMove(6, 0, 0.5);
addLine(6, 0.5, 0.5);
addLine(6, findMiddle(0.5), findMiddle(0.5));
addCurve(6, 0.5, INSIDE);
}
static function addCurve(_arg1:int, _arg2:Number, _arg3:int):void{
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
_local4 = 0;
_local5 = _arg2;
if (_arg3 == OUTSIDE){
_local4 = findMiddle(_arg2);
_local5 = findMiddle(_arg2);
};
_local6 = ((Math.SQRT2 - 1) * _arg2);
_local7 = _arg2;
addAllRotations(_arg1, _local4, _local5, Draw.CURVE, _local6, _local7);
addAllRotations((_arg1 + 1), _local5, _local4, Draw.CURVE, _local7, _local6);
}
static function addMove(_arg1:int, _arg2:Number, _arg3:Number):void{
addAllRotations(_arg1, _arg2, _arg3, Draw.MOVE);
addAllRotations((_arg1 + 1), _arg3, _arg2, Draw.MOVE);
}
public static function mix(_arg1:int, _arg2:int):int{
var _local3:*;
_local3 = 0;
if ((((((_arg1 == WHITE)) && ((_arg2 == BLACK)))) || ((((_arg1 == BLACK)) && ((_arg2 == WHITE)))))){
_local3 = 1;
} else {
if (_arg1 == WHITE){
_local3 = whiteTable[_arg2];
} else {
if (_arg1 == BLACK){
_local3 = blackTable[_arg2];
} else {
if ((((_arg2 == WHITE)) || ((_arg2 == BLACK)))){
_local3 = mix(_arg2, _arg1);
} else {
_local3 = (_arg1 | _arg2);
};
};
};
};
return (_local3);
}
static function addAllRotations(_arg1:int, _arg2:Number, _arg3:Number, _arg4:int, ... _args):void{
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
var _local10:*;
var _local11:*;
var _local12:*;
var _local13:*;
_local6 = _arg2;
_local7 = _arg3;
_local8 = 0;
_local9 = 0;
if (_args.length >= 2){
_local8 = _args[0];
_local9 = _args[1];
};
_local10 = 0;
_local11 = 0;
_local11 = 0;
while (_local11 < 4) {
_local10 = ((_local11 * 8) + _arg1);
if (_args.length < 2){
regionMap[_local10].push(new Draw(_local6, _local7, _arg4));
} else {
regionMap[_local10].push(new Draw(_local6, _local7, _arg4, _local8, _local9));
};
_local12 = (1 - _local7);
_local13 = _local6;
_local6 = _local12;
_local7 = _local13;
_local12 = (1 - _local9);
_local13 = _local8;
_local8 = _local12;
_local9 = _local13;
_local11++;
};
}
public static function isEqual(_arg1:RegionList, _arg2:RegionList):Boolean{
return ((((((((((_arg1.cyan == _arg2.cyan)) && ((_arg1.magenta == _arg2.magenta)))) && ((_arg1.yellow == _arg2.yellow)))) && ((_arg1.absorb == _arg2.absorb)))) && ((_arg1.stencil == _arg2.stencil))));
}
static function addLine(_arg1:int, _arg2:Number, _arg3:Number):void{
addAllRotations(_arg1, _arg2, _arg3, Draw.LINE);
addAllRotations((_arg1 + 1), _arg3, _arg2, Draw.LINE);
}
static function findMiddle(_arg1:Number):Number{
return ((_arg1 / Math.SQRT2));
}
}
}//package ui
Section 79
//ScrollArrowClip (ui.ScrollArrowClip)
package ui {
import flash.display.*;
public dynamic class ScrollArrowClip extends MovieClip {
}
}//package ui
Section 80
//ScrollMenu (ui.ScrollMenu)
package ui {
import flash.display.*;
import lib.*;
import lib.ui.*;
public class ScrollMenu {
var scrollDir:Dir;
var clip:ScrollMenuClip;
var window:Window;
var buttons:ButtonList;
public function ScrollMenu(_arg1:DisplayObjectContainer, _arg2:Window, _arg3:Boolean):void{
window = _arg2;
scrollDir = null;
clip = new ScrollMenuClip();
_arg1.addChild(clip);
buttons = new ButtonList([clip.north, clip.south, clip.east, clip.west]);
buttons.setActions(null, beginScroll, endScroll);
if (!_arg3){
clip.south.y = (Main.HEIGHT - 5);
clip.east.y = (Main.HEIGHT / 2);
clip.west.y = (Main.HEIGHT / 2);
};
}
public function hide():void{
clip.visible = false;
}
public function cleanup():void{
buttons.cleanup();
clip.parent.removeChild(clip);
}
function endScroll(_arg1:int):void{
buttons.glowOut(_arg1);
scrollDir = null;
}
public function getVertical():Array{
return ([clip.north, clip.south]);
}
public function enterFrame():void{
if (scrollDir != null){
window.scrollWindow(Dir.walk(new Point(0, 0), scrollDir, 15));
};
}
function beginScroll(_arg1:int):void{
buttons.glowOver(_arg1);
scrollDir = Dir.dirs[_arg1];
}
public function getHorizontal():Array{
return ([clip.east, clip.west]);
}
}
}//package ui
Section 81
//Sound (ui.Sound)
package ui {
import flash.events.*;
import flash.media.*;
public class Sound {
static var channel = null;
static var sounds = [new CancelSound(), new JamSound(), new MixerSound(), new MouseOverSound(), new PlaceSound(), new SelectSound(), new SpraySound(), new SuccessSound(), new VictorySound()];
public static var SELECT = 5;
public static var MOUSE_OVER = 3;
public static var SPRAY = 6;
static var mute = false;
static var musicChannel = null;
static var music = new MusicClip();
public static var PLACE = 4;
public static var MIXER = 2;
public static var SUCCESS = 7;
static var musicPos = 0;
public static var JAM = 1;
public static var VICTORY = 8;
public static var CANCEL = 0;
public static function toggleMute():void{
mute = !(mute);
if (((mute) && (!((musicChannel == null))))){
musicChannel.stop();
musicChannel = null;
};
if (!mute){
playMusic();
};
}
public static function playMusic():void{
if (!mute){
musicChannel = music.play(0, 1000000, new SoundTransform(1));
};
}
public static function isMute():Boolean{
return (mute);
}
static function soundComplete(_arg1:Event):void{
channel.removeEventListener(Event.SOUND_COMPLETE, soundComplete);
channel = null;
if ((((musicChannel == null)) && (!(mute)))){
musicChannel = music.play(musicPos, 1000000, new SoundTransform(1));
};
}
public static function play(_arg1:int):void{
var _local2:*;
if (((!(mute)) && ((channel == null)))){
_local2 = 1;
if (_arg1 == JAM){
_local2 = 0.3;
};
channel = sounds[_arg1].play(0, 1, new SoundTransform(_local2));
if (((!((musicChannel == null))) && ((_arg1 == VICTORY)))){
channel.addEventListener(Event.SOUND_COMPLETE, soundComplete);
musicPos = musicChannel.position;
musicChannel.stop();
musicChannel = null;
} else {
channel = null;
};
};
}
}
}//package ui
Section 82
//TabList (ui.TabList)
package ui {
import flash.display.*;
import lib.*;
import logic.*;
import lib.ui.*;
import flash.text.*;
import ui.menu.*;
public class TabList {
var placeMenu:PlaceMenu;
var editMenu:EditMenu;
var wireMenu:WireMenu;
var clip:Sprite;
var victoryMenu:VictoryMenu;
var goalMenu:GoalMenu;
var testMenu:TestMenu;
var menuList:MenuList;
var itemMenu:ItemMenu;
var tileMenu:TileMenu;
var colorLabMenu:TileMenu;
var buttonMenu:ButtonMenu;
var partMenu:PartMenu;
var tileLabMenu:TileMenu;
public static var GOAL_MENU = 3;
public static var VICTORY_MENU = 5;
public static var TILE_MENU = 4;
public static var ITEM_MENU = 7;
public static var BUTTON_MENU = 0;
public static var WIRE_MENU = 8;
public static var TILE_LAB_MENU = 11;
public static var PART_MENU = 6;
public static var TEST_MENU = 9;
public static var COLOR_LAB_MENU = 10;
public static var tabText = ["Buttons", "Map", "Place", "Goal", "Tile", "Victory", "Parts", "Items", "Wires", "Test", "Dye Lab", "Tile Lab"];
public static var EDIT_MENU = 1;
public static var PLACE_MENU = 2;
public function TabList(_arg1:DisplayObjectContainer, _arg2:Window, _arg3:GoalPlace, _arg4:WirePlace, _arg5:WireParent):void{
clip = new Sprite();
_arg1.addChild(clip);
buttonMenu = new ButtonMenu(clip, setMenu, _arg3);
editMenu = new EditMenu(clip, _arg2, _arg3, setMenu);
placeMenu = new PlaceMenu(clip, _arg3);
goalMenu = new GoalMenu(clip, _arg3, setMenu);
tileMenu = new TileMenu(clip, _arg2, _arg3, setMenu, TileMenu.TILE_EDIT);
victoryMenu = new VictoryMenu(clip, setMenu, _arg3);
partMenu = new PartMenu(clip, setMenu, _arg3);
itemMenu = new ItemMenu(clip, setMenu, _arg3);
wireMenu = new WireMenu(clip, setMenu, _arg4, _arg5, _arg3);
testMenu = new TestMenu(clip, setMenu, _arg3);
colorLabMenu = new TileMenu(clip, _arg2, _arg3, setMenu, TileMenu.COLOR_LAB);
tileLabMenu = new TileMenu(clip, _arg2, _arg3, setMenu, TileMenu.TILE_LAB);
menuList = new MenuList([buttonMenu, editMenu, placeMenu, goalMenu, tileMenu, victoryMenu, partMenu, itemMenu, wireMenu, testMenu, colorLabMenu, tileLabMenu]);
}
public function getWireText():TextField{
return (wireMenu.getWireText());
}
public function refreshMenu():void{
menuList.hide();
menuList.show();
}
function setupTabs(_arg1:Array):void{
var _local2:*;
var _local3:*;
_local2 = 12;
for each (_local3 in _arg1) {
_local3.setTabPos(_local2);
_local2 = (_local2 + 97);
};
}
public function setMenu(_arg1:int):void{
menuList.changeState(_arg1);
}
public function cleanup():void{
clip.parent.removeChild(clip);
menuList.cleanup();
}
public function setModel(_arg1:GameSettings, _arg2:ChangeList, _arg3:Map, _arg4:Function, _arg5:Function, _arg6:Function, _arg7:PartPlace, _arg8:Function, _arg9:Function, _arg10:ToolTipClip){
var _local11:*;
var _local12:*;
partMenu.setModel(_arg7, _arg1.isEditor(), _arg1.getButtonStatus(), _arg10);
itemMenu.setModel(_arg7, _arg1.isEditor(), _arg1.getButtonStatus());
buttonMenu.setModel(_arg1.getButtonStatus(), _arg7);
editMenu.setModel(_arg3, _arg7, _arg1, _arg4);
placeMenu.setModel(_arg7);
victoryMenu.setModel(_arg1, _arg5, _arg7, _arg8, _arg9);
wireMenu.setModel(_arg7, _arg1.getButtonStatus());
testMenu.setModel(_arg2, _arg7, _arg1, _arg6);
goalMenu.setModel(_arg7);
tileMenu.setModel(_arg7, _arg1.getButtonStatus());
colorLabMenu.setModel(_arg7, _arg1.getButtonStatus());
tileLabMenu.setModel(_arg7, _arg1.getButtonStatus());
setMenu(PART_MENU);
if (_arg1.isMovie()){
clip.visible = false;
};
if (_arg1.isEditor()){
setupTabs([partMenu, itemMenu, wireMenu, testMenu, editMenu, buttonMenu, goalMenu, tileMenu]);
for each (_local11 in [colorLabMenu, tileLabMenu, victoryMenu]) {
_local11.disable();
};
} else {
setupTabs([partMenu, itemMenu, wireMenu, testMenu, colorLabMenu, tileLabMenu, victoryMenu]);
for each (_local12 in [editMenu, buttonMenu, goalMenu, tileMenu]) {
_local12.disable();
};
};
if (_arg1.getId() == "sandbox"){
colorLabMenu.disable();
tileLabMenu.disable();
};
}
public function enterFrame():void{
menuList.update();
}
}
}//package ui
Section 83
//TextClip (ui.TextClip)
package ui {
import flash.display.*;
import flash.text.*;
public dynamic class TextClip extends MovieClip {
public var text:TextField;
}
}//package ui
Section 84
//TrackView (ui.TrackView)
package ui {
import lib.*;
import logic.*;
import lib.ui.*;
public class TrackView {
var anims:AnimList;
var track:Image;
var images:ImageList;
var trackAnim:Anim;
public function TrackView(_arg1:ImageList, _arg2:AnimList):void{
images = _arg1;
anims = _arg2;
track = null;
trackAnim = null;
}
public function update(_arg1:Point, _arg2:Dir, _arg3:Boolean):void{
if (track == null){
track = new Image(ImageConfig.track);
images.add(track);
trackAnim = new Anim(2, 17);
trackAnim.image = track;
trackAnim.cycle = true;
anims.add(trackAnim);
};
track.setPos(Map.toCenterPixel(_arg1));
if (_arg2 == null){
trackAnim.paused = true;
track.setFrame(1);
} else {
track.setRotation(_arg2.toAngle());
if (_arg3){
trackAnim.frame = 2;
trackAnim.paused = false;
} else {
trackAnim.paused = true;
track.setFrame(2);
};
};
}
public function destroy():void{
if (track != null){
images.remove(track);
anims.remove(trackAnim);
track.cleanup();
track = null;
};
}
}
}//package ui
Section 85
//TutorialArrowClip (ui.TutorialArrowClip)
package ui {
import flash.display.*;
public dynamic class TutorialArrowClip extends MovieClip {
public var tail:MovieClip;
}
}//package ui
Section 86
//View (ui.View)
package ui {
import flash.display.*;
import lib.*;
import logic.*;
import lib.ui.*;
import ui.menu.*;
public class View {
var anims:AnimList;
var wirePlace:WirePlace;
var tabs:TabList;
var scrollMenu:ScrollMenu;
var partPlace:PartPlace;
var wireParent:WireParent;
var tip:ToolTipClip;
var settings:GameSettings;
var keyboard:Keyboard;
var parent:DisplayObjectContainer;
var explosions:Array;
var border:FactoryBorder;
var window:Window;
var images:ImageList;
var goalPlace:GoalPlace;
var systemMenu:SystemMenu;
var movieMenu:MovieMenu;
public static var MENU_HEIGHT = 75;
public function View(_arg1:DisplayObjectContainer, _arg2:Keyboard, _arg3:Point):void{
parent = _arg1;
keyboard = _arg2;
images = new ImageList();
anims = new AnimList();
border = new FactoryBorder(FactoryBorder.GRASS);
window = new Window(parent, new Point(Main.WIDTH, (Main.HEIGHT - MENU_HEIGHT)), _arg3, ImageConfig.layerCount, images, border, new WindowBackgroundClip(), 100);
window.scrollWindow(window.getCenter());
wirePlace = new WirePlace(parent, keyboard, window);
wireParent = new WireParent(parent, window);
wireParent.hide();
goalPlace = new GoalPlace(parent, window, images);
tabs = new TabList(parent, window, goalPlace, wirePlace, wireParent);
movieMenu = new MovieMenu(parent, window);
partPlace = new PartPlace(parent, keyboard, window);
scrollMenu = new ScrollMenu(parent, window, true);
tip = new ToolTipClip();
parent.addChild(tip);
tip.visible = false;
systemMenu = new SystemMenu(parent);
explosions = [];
}
public function getWireParent():WireParent{
return (wireParent);
}
public function declareVictory():void{
tabs.setMenu(TabList.VICTORY_MENU);
}
public function getAnims():AnimList{
return (anims);
}
public function stopPlay():void{
wireParent.stopPlay();
}
public function getParent():DisplayObjectContainer{
return (parent);
}
public function cleanup():void{
var _local1:*;
for each (_local1 in explosions) {
_local1.cleanup();
};
systemMenu.cleanup();
tip.parent.removeChild(tip);
scrollMenu.cleanup();
tabs.cleanup();
movieMenu.cleanup();
goalPlace.cleanup();
wireParent.cleanup();
wirePlace.cleanup();
partPlace.cleanup();
window.cleanup();
images.cleanup();
}
public function getWindow():Window{
return (window);
}
public function getImages():ImageList{
return (images);
}
public function addExplosion(_arg1:ExplosionView):void{
explosions.push(_arg1);
}
public function enterFrame():void{
scrollMenu.enterFrame();
anims.enterFrame();
images.update(window);
tabs.enterFrame();
while ((((explosions.length > 0)) && (explosions[0].isDone()))) {
explosions[0].cleanup();
explosions.splice(0, 1);
};
movieMenu.enterFrame();
}
public function startPlay():void{
wireParent.startPlay();
if (settings.isMovie()){
partPlace.hide();
goalPlace.hide();
};
}
public function setModel(_arg1:GameSettings, _arg2:ChangeList, _arg3:Map, _arg4:Function, _arg5:Array, _arg6:Function, _arg7:Function, _arg8:Function, _arg9:Function){
settings = _arg1;
partPlace.setModel(_arg2, _arg3, settings.isEditor(), tabs.setMenu);
wirePlace.setModel(_arg2, _arg3, tabs.getWireText());
movieMenu.setModel(settings, _arg7, _arg4);
goalPlace.setModel(_arg5, _arg3, tabs.refreshMenu);
tabs.setModel(settings, _arg2, _arg3, _arg6, _arg7, _arg4, partPlace, _arg8, _arg9, tip);
border.setModel(scrollMenu.getVertical(), scrollMenu.getHorizontal(), partPlace);
window.scrollWindow(new Point(0, 0));
systemMenu.setModel(_arg7, _arg4, settings);
}
}
}//package ui
Section 87
//WireParent (ui.WireParent)
package ui {
import flash.display.*;
import lib.*;
import lib.ui.*;
import flash.geom.*;
public class WireParent {
var parent:Sprite;
var back:Shape;
var window:Window;
public function WireParent(_arg1:DisplayObjectContainer, _arg2:Window){
window = _arg2;
window.addScrollCommand(scroll);
back = new Shape();
_arg1.addChild(back);
back.visible = false;
parent = window.getLayer(ImageConfig.wireLayer);
parent.mouseEnabled = false;
parent.mouseChildren = false;
scroll(window.getOffset());
}
public function getParent():DisplayObjectContainer{
return (parent);
}
public function hide():void{
parent.visible = false;
back.visible = false;
}
public function cleanup():void{
back.parent.removeChild(back);
}
public function show():void{
parent.visible = true;
back.visible = true;
}
function scroll(_arg1:Point):Boolean{
var _local2:*;
var _local3:*;
_local2 = window.getScreen();
parent.x = _local2.x;
parent.y = _local2.y;
_local3 = window.getSize();
parent.scrollRect = new Rectangle(_arg1.x, _arg1.y, _local3.x, _local3.y);
return (false);
}
public function stopPlay():void{
var _local1:*;
if (back.visible == false){
parent.visible = false;
};
_local1 = 0;
while (_local1 < parent.numChildren) {
parent.getChildAt(_local1).visible = true;
_local1++;
};
}
public function startPlay():void{
var _local1:*;
_local1 = 0;
while (_local1 < parent.numChildren) {
parent.getChildAt(_local1).visible = false;
_local1++;
};
parent.visible = true;
back.visible = false;
}
}
}//package ui
Section 88
//WirePlace (ui.WirePlace)
package ui {
import flash.display.*;
import lib.*;
import logic.*;
import lib.ui.*;
import flash.text.*;
import logic.change.*;
public class WirePlace {
var changes:ChangeList;
var wireText:TextField;
var map:Map;
var source:Point;
var plan:Shape;
var parent:DisplayObjectContainer;
var keyboard:Keyboard;
var window:Window;
static var okColor:int = 3407667;
static var textBegin = "Click a Sensor or Logic Piece
to Add or Remove a Wire";
static var textEnd = "Click a Destination Piece
to Add or Remove a Wire.";
static var badColor:int = 16724787;
public function WirePlace(_arg1:DisplayObjectContainer, _arg2:Keyboard, _arg3:Window):void{
parent = _arg1;
keyboard = _arg2;
window = _arg3;
window.addClickCommand(clickMap);
window.addHoverCommand(hoverMap);
plan = null;
source = null;
}
function hoverMap(_arg1:Point):Boolean{
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
_local2 = false;
if (((!((plan == null))) && (!((source == null))))){
_local2 = true;
if ((((_arg1 == null)) || (Point.isEqual(source, Map.toTile(_arg1))))){
plan.visible = false;
} else {
plan.visible = true;
_local3 = Map.toTile(_arg1);
_local4 = okColor;
if (!map.canEndWire(source, _local3)){
_local4 = badColor;
};
plan.graphics.clear();
_local5 = window.toRelative(Map.toCenterPixel(source));
plan.x = _local5.x;
plan.y = _local5.y;
_local6 = window.toRelative(Map.toCenterPixel(_local3));
window.toRelative(Map.toCenterPixel(_local3)).x = (_local6.x - _local5.x);
_local6.y = (_local6.y - _local5.y);
WireView.drawWire(plan.graphics, new Point(0, 0), _local6, _local4);
};
};
return (_local2);
}
public function hide():void{
cleanupPlan();
source = null;
}
public function reset():void{
source = null;
if (plan != null){
plan.visible = false;
};
}
public function toggle():void{
if (plan == null){
show();
wireText.text = textBegin;
} else {
hide();
};
}
public function cleanup():void{
cleanupPlan();
}
public function setModel(_arg1:ChangeList, _arg2:Map, _arg3:TextField):void{
changes = _arg1;
map = _arg2;
wireText = _arg3;
}
public function cleanupPlan():void{
if (plan != null){
plan.parent.removeChild(plan);
plan = null;
};
}
function clickMap(_arg1:Point):Boolean{
var _local2:*;
var _local3:*;
_local2 = false;
if (plan != null){
_local2 = true;
_local3 = Map.toTile(_arg1);
if (source == null){
if (map.canStartWire(_local3)){
Sound.play(Sound.SELECT);
source = _local3;
wireText.text = textEnd;
} else {
Sound.play(Sound.CANCEL);
};
} else {
if (map.canEndWire(source, _local3)){
Sound.play(Sound.MOUSE_OVER);
changes.add(Util.makeChange(ChangePart.addWire, source, _local3));
} else {
Sound.play(Sound.CANCEL);
};
if (!keyboard.shift()){
source = null;
plan.visible = false;
wireText.text = textBegin;
};
};
};
return (_local2);
}
public function show():void{
plan = new Shape();
parent.addChild(plan);
source = null;
}
}
}//package ui
Section 89
//WireView (ui.WireView)
package ui {
import flash.display.*;
import lib.*;
import logic.*;
public class WireView {
var wire:Shape;
var wireColor:int;
static var destLength = 6;
static var legLength = 13;
static var wireColor = 0x777777;
static var warp = 0.2;
public function WireView(_arg1:DisplayObjectContainer, _arg2:Point, _arg3:Point){
wireColor = ((int(((Math.random() * 96) + 160)) | (int(((Math.random() * 96) + 160)) << 8)) | (int(((Math.random() * 96) + 160)) << 16));
wire = new Shape();
_arg1.addChild(wire);
update(_arg2, _arg3);
}
public function hide():void{
wire.alpha = 0.2;
wire.visible = true;
}
public function cleanup():void{
wire.parent.removeChild(wire);
}
public function update(_arg1:Point, _arg2:Point):void{
wire.graphics.clear();
drawWire(wire.graphics, Map.toCenterPixel(_arg1), Map.toCenterPixel(_arg2), wireColor);
}
public function show():void{
wire.alpha = 1;
wire.visible = true;
}
static function drawHead(_arg1:Graphics, _arg2:Point, _arg3:int, _arg4:Number, _arg5:Number):void{
_arg1.moveTo(_arg2.x, _arg2.y);
_arg1.lineStyle(2, 0xAAAAAA);
_arg1.beginFill(_arg3);
drawLeg(_arg1, _arg2, _arg4);
drawLeg(_arg1, _arg2, _arg5);
_arg1.lineTo(_arg2.x, _arg2.y);
_arg1.endFill();
}
public static function drawWire(_arg1:Graphics, _arg2:Point, _arg3:Point, _arg4:int):void{
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
var _local10:*;
var _local11:*;
var _local12:*;
var _local13:*;
var _local14:*;
var _local15:*;
_local5 = Math.atan2((_arg3.y - _arg2.y), (_arg3.x - _arg2.x));
_local6 = (_local5 + (Math.PI / 2));
_local7 = Math.floor((Math.cos(_local6) * destLength));
_local8 = Math.floor((Math.sin(_local6) * destLength));
_local7 = Math.floor((Math.cos(_local5) * destLength));
_local8 = Math.floor((Math.sin(_local5) * destLength));
_local9 = new Point((_arg3.x - _local7), (_arg3.y - _local8));
_local10 = new Point((_arg2.x + _local7), (_arg2.y + _local8));
_local11 = (_local9.x - _local10.x);
_local12 = (_local9.y - _local10.y);
_local13 = Math.sqrt(((_local11 * _local11) + (_local12 * _local12)));
_local14 = (_local13 * warp);
if (_local13 < 35){
_local14 = 0;
};
_local15 = new Point(Math.floor(((_local9.x + _local10.x) / 2)), Math.floor(((_local9.y + _local10.y) / 2)));
new Point(Math.floor(((_local9.x + _local10.x) / 2)), Math.floor(((_local9.y + _local10.y) / 2))).x = (_local15.x - Math.floor((Math.cos(_local6) * _local14)));
_local15.y = (_local15.y - Math.floor((Math.sin(_local6) * _local14)));
_local5 = Math.atan2((_local9.y - _local15.y), (_local9.x - _local15.x));
_arg1.lineStyle(4, 0xAAAAAA);
_arg1.moveTo(_local10.x, _local10.y);
_arg1.curveTo(_local15.x, _local15.y, _local9.x, _local9.y);
drawHead(_arg1, _local9, _arg4, (_local5 + ((Math.PI * 3) / 4)), (_local5 - ((Math.PI * 3) / 4)));
}
static function drawLeg(_arg1:Graphics, _arg2:Point, _arg3:Number):void{
var _local4:*;
var _local5:*;
_local4 = (_arg2.x + Math.floor((Math.cos(_arg3) * legLength)));
_local5 = (_arg2.y + Math.floor((Math.sin(_arg3) * legLength)));
_arg1.lineTo(_local4, _local5);
}
}
}//package ui
Section 90
//AllClip (AllClip)
package {
import flash.display.*;
public dynamic class AllClip extends MovieClip {
}
}//package
Section 91
//BarrierClip (BarrierClip)
package {
import flash.display.*;
public dynamic class BarrierClip extends MovieClip {
}
}//package
Section 92
//BigCircleClip (BigCircleClip)
package {
import flash.display.*;
public dynamic class BigCircleClip extends MovieClip {
}
}//package
Section 93
//BigCircleMakerClip (BigCircleMakerClip)
package {
import flash.display.*;
public dynamic class BigCircleMakerClip extends MovieClip {
}
}//package
Section 94
//BlackClip (BlackClip)
package {
import flash.display.*;
public dynamic class BlackClip extends MovieClip {
}
}//package
Section 95
//ButtonMenuClip (ButtonMenuClip)
package {
import flash.display.*;
public dynamic class ButtonMenuClip extends MovieClip {
public var bigCircle:MovieClip;
public var mixer:MovieClip;
public var triangle:MovieClip;
public var sprayer:MovieClip;
public var wireButton:MovieClip;
public var cyan:MovieClip;
public var white:MovieClip;
public var some:MovieClip;
public var tabButton:MovieClip;
public var glue:MovieClip;
public var none:MovieClip;
public var setButton:MovieClip;
public var solvent:MovieClip;
public var rectangle:MovieClip;
public var rotater:MovieClip;
public var yellow:MovieClip;
public var conveyer:ConveyerClip;
public var all:MovieClip;
public var magenta:MovieClip;
public var clear:MovieClip;
public var tile:MovieClip;
public var smallCircle:MovieClip;
public var sensor:SensorClip;
public var barrier:MovieClip;
public var circle:MovieClip;
public var copier:MovieClip;
public var mem:MovieClip;
public var black:MovieClip;
}
}//package
Section 96
//Campaign (Campaign)
package {
import lib.*;
import flash.events.*;
import ui.*;
import flash.net.*;
public class Campaign {
public static var levelSaves = new URLVariables();
public static var ACTIVE = 1;
static var disk:SharedObject = null;
public static var levelTitles = new URLVariables();
public static var island:int = 0;
public static var TUTORIAL_ISLAND = 0;
static var campaign = <campaign>
<!--
<level number="0">
<movie />
<slide>This is a demo solution to see most of the parts in action.</slide>
<map>
eNotkGFyJCEIhRH1gYjO9Famk/zKUXKPnHZv1vt6K+In1FMQLS
KfD/k5IfEeEp9b4kMyHmvHth1vUmOJRRbbWTLSluciu4wMAlJq
mIA4mWSFYYc5SbLJQ8IWmWQQI52IkhZQ69Vcqw1UH2onlXAFOL
0Cu7Kk9unaEWrFQ8UFjPuctddkoYketXXUzrSB4szX2gpcR2Oh
1run1bFMQ6Oh3moBaunQbGgGzNYrumIl7I8pLIHMRqfCCyK9xf
bGX4HMxb6yDeO5AwtP2+Ow0Cc2Dt84R9q7xzjZ7GtsvHzLlw+7
zc3vyIOPKC5Bkrb5sGI+/N53fgY9nFpdlrce8MJW0dGZNeeKRe
a9rtVgyyzmYQcOe4Jmp59s4DVoXt7wMURfdtr197pu5Fvkv+f4
la7v3/jWmjyuf6s4KBQ=
</map>
</level>
-->
<level id="sandbox" title="Sandbox">
<map>
eNpjZGCQlGQAAfb///8DAAg/Azg=
</map>
</level>
<level id="conveyer-demo" next="conveyer" title="Conveyers">
<movie/>
<slide align="middle">Welcome to Tile Factory! Click next.</slide>
<slide x="2" y="2">This is a goal. Move at least 5 white tiles here.</slide>
<slide x="5" y="4">This copier is duplicating the white tile to its right.</slide>
<slide x="4" y="4">This conveyer pushes tiles to the left.</slide>
<slide x="3" y="4">Tracks like this show where a conveyer will push.</slide>
<slide>You can use conveyers to push tiles to the goal.</slide>
<map>
eNptxksKgDAMRdF8XhIMVbfgUgTHLqMDJxYcFNy9XYAXDlym5W
h3r299trP1q0ZQFsM6O9KBNcwyTNMFJYQzXAfLSTSJRQ3MDIwV
+m//ADzBBwI=
</map>
</level>
<level id="conveyer" prev="conveyer-demo">
<unlock name="jam-demo"/>
<slide align="middle">Now you try it.</slide>
<slide x="40" y="564" pixel="true">Click on the conveyer button to pick one up.</slide>
<slide>You can click a rotate button to turn your conveyer before placing it.</slide>
<slide x="1" y="2">Click on the factory floor to place it.</slide>
<slide>You can click on a piece to move it again.</slide>
<slide x="360" y="500" pixel="true">When you have finished, click the Test tab to try it out.</slide>
<slide>Once the test is successful, you will be able to move on to the next level.</slide>
<map>
eNptiUEKgFAQQrU/M8bQ70xBZ2lb0CLo9k2tU/QJEuN67Nd2b6
eEPpG9EylUBlbezWyIuTFS7qmwlBWtGJ6ok+WvSWsK0A3/Wh7P
FAUi
</map>
</level>
<level id="jam-demo" next="barrier-demo" title="Barriers">
<movie/>
<slide>Be careful! Your tiles are fragile.</slide>
<slide x="10" y="4">If two tiles collide, they will both break.</slide>
<slide x="3" y="4">A tile pulled in multiple directions will also break.</slide>
<map>
eNptiUEOgEAMAqHdti6umvj/v2q9CyEzCQT2wr0Y62BqzeZMJc
dZlioL1fatHd/a1VTTqSoqPZcDcvDEAMBuZ0ZrWHIOsAw/MUZ/
/vsNXM8LCC4DaQ==
</map>
</level>
<level id="barrier-demo" next="barrier" prev="jam-demo">
<movie/>
<slide x="4" y="2">Barriers stop conveyers.</slide>
<slide>Use them to prevent conveyers from interfering with each other.</slide>
<map>
eNptjEsKw1AMA+VPrFiNm13vf9PmvX0EAwMDMuAj/Magaegym6
ttCIgw0TfLz81ybaBqv8v8y3SxXBWYIoZRIksdqWYKzmyLNPPK
Xo888DLPY7V4bYn7/wAtqwPU
</map>
</level>
<level id="barrier" prev="barrier-demo">
<unlock name="sprayer-demo"/>
<slide>Hint: Type WASD to change orientation and space to change power when placing a piece.</slide>
<map>
eNptjMENgDAMA+2WtE0oHYpNePDg2wkZDfMGW6fEsRSi7sec1z
l9xejk2MCoQFQKJM0Una67Kzfll9AekWGiDCwwFNlgpPBkpTlY
9OkrS83UZfzrfgBNUwWB
</map>
</level>
<level id="sprayer-demo" next="sprayer" title="Sprayers">
<movie/>
<slide>Tiles can be painted different colors.</slide>
<slide x="6" y="1">You must send tiles of the specified color to the goal.</slide>
<slide x="4" y="2">Sprayers use a can of paint to color a tile.</slide>
<slide x="4" y="3">Paint is loaded into the back of the sprayer.</slide>
<slide x="4" y="1">The next tile to come along the nozzle will be sprayed.</slide>
<slide x="4" y="5">This copier is duplicating the can of paint below it.</slide>
<slide>The sprayer must be constantly supplied with new paint to operate.</slide>
<map>
eNpdwzsOglAUBNCZx/3g5IqhsXYx7IAVWFAaDZ2rx0frSQ5R62
d/frf9sWyv95iYZa3uFirzisapyOkKKpMKs0pCiXNTsh+8D6Wf
XRen0Jzmzs4xDmDw6PDHcDt+JVELqw==
</map>
</level>
<level id="sprayer" prev="sprayer-demo">
<unlock name="sensor-demo"/>
<slide>Now you must deliver 5 black tiles to the goal.</slide>
<map>
eNpdiTsOg1AMBP3bNbJeSJ1zcQIKekSq3C43SwwlI80WsyrTsh
/rZzvemTI/aJXU1iudlWC9gjUCY8Ce6eh22j+0nJidLAmCJ73R
wlQtIGr+uyEX8f0DKO0WMA==
</map>
</level>
<level id="sensor-demo" next="sensor" title="Sensors">
<movie/>
<slide x="8" y="2">Place sensors on top of conveyer tracks.</slide>
<slide>Sensors power on whenever something is over them.</slide>
<slide>You wire the sensor to conveyers, copiers, and sprayers.</slide>
<slide>The sensor activates them only when it is covered.</slide>
<slide x="8" y="2">This sensor is wired to a copier.</slide>
<slide x="8" y="9">So this copier creates a new can of paint whenever the tile passes it.</slide>
<slide x="2" y="4">This sensor is wired to a conveyer.</slide>
<slide x="8" y="6">And this one is wired to the same conveyer.</slide>
<slide x="7" y="9">So this conveyer only activates when the tile passes those sensors.</slide>
<slide x="3" y="7">This sensor is connected to the tile copier.</slide>
<slide x="1" y="1">So a new tile is created only when the previous tile reaches it.</slide>
<map>
eNo1TVsKwkAQm5ndeWW77a/45WG8gWfopxb0/tQBMRDyIBCm8d
hfn+N9u+/PA6DrwrxOYjgRnIskpQITXi14WrTNpE0TrayVfXN2
XDKxRA7PgEfAPAc0wnsimyPDkNJLBakJ0pCoovY1bc6sqcFsPY
ml3n84C3/faTu/ZDcM9Q==
</map>
</level>
<level id="sensor" prev="sensor-demo">
<unlock name="violet"/>
<unlock name="stencil-demo"/>
<slide align="middle">Now you try it.</slide>
<slide x="265" y="500" pixel="true">Click the Wires tab to set up wires between pieces.</slide>
<slide x="3" y="2">Click this sensor to start a wire.</slide>
<slide x="4" y="5">Click the paint copier to wire it in.</slide>
<slide>Now the paint will only be produced when a tile arrives.</slide>
<slide x="5" y="2">Click this sensor in wire mode to start another wire.</slide>
<slide x="1" y="2">Click on the tile copier to wire it in.</slide>
<slide>This slows down the rate of tile production.</slide>
<slide>A new tile will be created only when the old tile passes this point.</slide>
<slide>Remove a wire in the same way. Click the source, then click the destination.</slide>
<map>
eNpdw0EOQEAMBdDfdtqOnyG2zuUMtiRc0M0YWy95gli3/TrOmp
hHKBPSG5cSbMVrE53Sg2lfZ3ov1gtDdWKxNphycCUgjmqQkOcH
XUHcL5AOFRM=
</map>
</level>
<level id="violet" title="Violet">
<map>
eNpNw7ERgCAMBdAfCQRjsLV1IStnoJU7WNDNNHa+u0ewo/W6n/
UarY8isAJWQfBRTWg24lUyqaQvVLKn6INuAgVIqTBomeAehx9G
ul9WJgr2
</map>
</level>
<level id="stencil-demo" next="stencil" title="Stencils">
<movie/>
<slide x="5" y="6">Stencils cover up part of a tile.</slide>
<slide x="9" y="2">When you paint a tile, only the uncovered section is painted.</slide>
<slide x="13" y="6">You can use solvent to remove stencils.</slide>
<slide>Stencils and solvent are both applied with a sprayer.</slide>
<slide>The covered portion of a tile will always remain unchanged.</slide>
<map>
eNpNzb0NAjEMBWDbie3E5+QOKGhhFzZATIAokPhpmIop2Aycji
d9etZrjODH1+Vxvt52h8v9uVHYNyBTwJDMKxdH6mpiWgY2tYAp
oG2r2MKxyxB7HsScuajH7bH36B5b49KbmBB14+RWQ0teE1nVMM
XfVfRMBjkRs1LliRrPhIQzrjPgQjBy+r7hLxnk8wOZ2Qwd
</map>
</level>
<level id="stencil" prev="stencil-demo">
<slide>Hint: Use the Tile Lab to figure out what order to place your stencils.</slide>
<unlock name="imperial"/>
<unlock name="rotater-demo"/>
<map>
eNo9xkEOgkAMheHXmem01EIkuuBeHIGwMDGuPCA3g3ahL/nzPo
Ks3/2zvd5PwTKimFOZvLHOrdui3VxZJ493VqndpLIJZ2HJwkMW
vmXhMQuDTCir4WoA3enRQHPBf+f5U0M/Lr45COc=
</map>
</level>
<level id="imperial" title="Imperial">
<map>
eNolyUEKQjEMhOE/WNvXSa24U2/kMVy4EBTEE3qzZ6IJHxkyxn
J5vm7v+/Ux9px3oGHMk1cdHR0omizxKyGuqg/hzU1Naavmqem3
Fj/SJnKKjpRd6pG7wBb3ifUB65py/hkK9fMFrLoRaQ==
</map>
</level>
<level id="rotater-demo" next="rotater" title="Rotaters">
<movie/>
<slide>Stencils and tiles can be rotated.</slide>
<slide x="14" y="2">Place a rotater on a track and it will rotate any tile passing over it.</slide>
<map>
eNpdjUsOAkEIRIGG7mmkGT+Ja1eexBN4AxcujYnxgB7MZKzZSv
JSBRSBKa7P9+19f50u98fz0Og8SLwRg+LRbQqWbF69TSvmzQEX
gIwpcmtvHgwf8IFcQrN6DJtyVK8i6VrCOxglehHvDWzwawedxf
ekyGlOBaTkseNOsVPMTZKsCGuTbhsZNguLqgrPvFfirSzLd6G/
UqqfH8iWDq4=
</map>
</level>
<level id="rotater" prev="rotater-demo">
<slide>Hint: Shift-click to place more than one of the same piece</slide>
<unlock name="pyramid"/>
<unlock name="star"/>
<unlock name="mixer-demo"/>
<map>
eNpVxkEOg0AIheHHzDBQRKPRGM/VG3TRtUnjAXuzFpYS/ryPIM
/zel3vzyY4RhRzKpM31qV1c2WdPNZZpXaTyiachSULP7LwkIXH
LAwyoayGq+3aDaCZ1gZayg+Iv1+DfP/SVwj1
</map>
</level>
<level id="pyramid" title="Pyramid">
<map>
eNo1zbENQjEQA1CfCLp8O4RfIdExEg0DINFQ0NCxElOwGfgKLn
qKc5KVQJ5fz+vjfht7nHYAR2Ae1TnRnZv5ZtNgV2phsmyYKltn
i2CieBfFO5R0Lu6gej5Krmhc1XgQ/HaP4T8gILo0Ecv4ei5v4K
+mIT8/HSsO6g==
</map>
</level>
<level id="star" title="Star">
<map>
eNpdjcsNAjEMRGdW2Thr7HDJHrjTB0VQAS0gCqQ0xlcsPfnJHw
3Rnp/X+zpxPy39xvSZ6WuHJ+FBZjBG7DzC1DOGbXDb6IYUIS/k
TbOm3VHIu2Zdu1HIo5DPon51B/rq8GViKK9Xjhg8AF44Gxjb46
+garDvD50cC2w=
</map>
</level>
<level id="mixer-demo" next="mixer" title="Mixers">
<movie/>
<slide x="4" y="5">Mixers combine paint colors to make new ones.</slide>
<slide>There are 16 different paint colors.</slide>
<slide>The paint model is based on the CMYK color process.</slide>
<map>
eNpNizsOAjEMRO2JP4kTsiXQUXESWo6xBQVCouL24HRYeprnH1
PcH5/9fbntz9cWdD2ixclaDKt1oNYuPgw+zXw7EGIwpgHTD8sl
ziTRRXMmeaPDVcJUZ1gZZohmEq1kdoR5/nEL5xpeFum6SPdFOm
nuEyqZCXEmB6mJoYClALXAageDO08hHqCs71+tXmj7/gBonBXL
</map>
</level>
<level id="mixer" prev="mixer-demo">
<slide>Hint: Use the Dye Lab to figure out how to mix your colors.</slide>
<unlock name="monaco"/>
<unlock name="some-demo"/>
<map>
eNo1hrENgDAMBO0oKG/jgESBWIoxKGipGI/N4F1w0ulOZdjP+7
hml2Xr5tGBMKArXxEN5g3w5ik/Uv6U8iXlF7bAVzMX0VGnKhrl
JUL+JlXm5wNOIw24
</map>
</level>
<level id="monaco" title="Monaco">
<map>
eNpFjUEOwjAMBNeladONUxpAAu58h0cg7vSL/Kxdc8HSaEY+2I
bhuX5e7/XieFxr4a0VemP2ylxNbXSfmO9T4egBOc6BegnUp0DN
QJ3lLEOG3Mkd2ZI8BNr1ge4n5rmCXm0aZ+iu6UcAArZ05wRrB/
xm2/4APY7fHaplDxU=
</map>
</level>
<level id="some-demo" next="some" title="Some">
<movie/>
<slide x="5" y="5">The Some piece helps you control power.</slide>
<slide>It powers on if any of its incoming wires are powered.</slide>
<slide x="5" y="3">This sensor on the north path is wired to the Some piece.</slide>
<slide x="5" y="7">So is this sensor on the south path.</slide>
<slide x="10" y="5">And the Some piece is wired to the paint copier.</slide>
<slide>So the copier will create paint when either of these sensors is pressed.</slide>
<map>
eNptjcsNQjEMBO04ju3NhzM36IUOqOEdn+iBxsG5IlYaaaVZ2U
zxfJ3H7XGcrzHoPljWJMFgw4D2a1dYrzBsWvYGeJvwOiYZjB1G
m3S8yR1tSvaCUEsErLrCBeF5pdhqRZYF0MJmCxkt9GKWv4JBqq
aqkijUhc2NpTj3Shzl8xPKuPeeLv65Su39BUggKIc=
</map>
</level>
<level id="some" prev="some-demo">
<unlock name="two-triangles"/>
<unlock name="none-demo"/>
<slide>Now you try it.</slide>
<map>
eNptiUEKgDAMBDdptXUTFTz5L9/gUfyjH9MU9ObCsAMjyNt57O
5YXNI0ItGF7uysWGZho2exnqMYizKIRyNcoqOh4crVOgJaxTJk
ULy7Y5/XahZt+GsZ8/UAwEwNDA==
</map>
</level>
<level id="two-triangles" title="Two Triangles">
<map>
eNpNjMEKwjAQRHdLzTbTjU17ELx58JPaD/AgIoiCHvwnP8Mf09
mD4ITHJjOzUSnz87ab7+fD9XQ5PqYie1ctRQWuvbul3roVzAKD
dYaiDmt6wikB76JE6AWKjSRsc4Jl7iHgyQZHwnpM8Mp/R/o1YD
Yaase+8i1E6Qn7miDSDDq1orX5hF6y/BBqyJMzw/IfkFArw/sL
RYIdGg==
</map>
</level>
<level id="none-demo" next="none" title="None">
<movie/>
<slide x="6" y="3">The None piece activates when no incoming wires are powered.</slide>
<slide>You can use it to manage crossing conveyers and split up tiles.</slide>
<slide x="7" y="4">This sensor is wired to the None piece and two cross conveyers.</slide>
<slide x="4" y="4">The None piece is wired to the forward conveyer.</slide>
<slide>So when the sensor is pressed, the forward conveyer stops and the cross conveyers start.</slide>
<slide>And if the sensor is clear, only the forward conveyer runs.</slide>
<slide>This means that there won't be a jam and the pieces are split into two directions.</slide>
<map>
eNptiUkOwzAMA7VQZKzYzqX//2rr3kOAGAzGzdawz3RsBnYwN4
Fm1aRy6UIP/T0nKzZVi+LWzdYdvez0RMuy5edWh9VWglKoQyYT
SDhi1LzMm/ay4ROnxVuDPd8fUNEEGA==
</map>
</level>
<level id="none" prev="none-demo">
<unlock name="all-demo"/>
<unlock name="glue-demo"/>
<slide>Try it out.</slide>
<map>
eNptiksOgDAIRAdKS8VCExd6/8t4LcXEhQsneZnMh4C5YBuOqc
Gmrqah5oF0yvwgCWfXbXifw8s6vK4aT9/y12yPakcUA5iqdBC3
6xU+IhLJjf82wTxvUTcT2Q==
</map>
</level>
<level id="all-demo" next="all" title="All">
<movie/>
<slide x="6" y="4">This sensor is wired to the conveyer on its left.</slide>
<slide>That groups the tiles into pairs as they move past.</slide>
<slide>To split up the pairs, we use an All piece.</slide>
<slide>The All piece powers on only when every incoming wire has power.</slide>
<slide x="7" y="4">This sensor is wired to the All piece.</slide>
<slide x="8" y="4">This sensor is also wired to the All piece.</slide>
<slide x="9" y="6">The All piece powers on when both sensors are pressed.</slide>
<slide x="7" y="5">It is wired to the conveyer here.</slide>
<slide x="8" y="5">And the conveyer here.</slide>
<slide>So both conveyers are turned on at the same time when both sensors are pressed.</slide>
<slide>This splits the tiles so both goals can be supplied.</slide>
<map>
eNptjDsOAkEMQzMzsTPJfLal5CpIXIVuEfevIPRr6cmWLLtIf5
zn/fl6f7bLjRV7CWIWbELDmVjSNcw1aJi0NtnTe9u0ujnaEue2
WcOGhQNBYhpbmOSu/GFmhpAKNXX2xPMuE4CCGmWplFHlQoHVs+
NVp3J8f98oB6s=
</map>
</level>
<level id="all" prev="all-demo">
<slide>Try it out.</slide>
<map>
eNpNicsNgCAQRGcR2GVATLxoO/Zjn5aly8GEl7xkPoLluu+tYl
+R2CR1RaTKMFOReRp5GKiFbqHq0LOKO/ahsFmxZlKAUKVHSAtw
XgcTVTv9s7/Pf8T2fI+LDLA=
</map>
</level>
<level id="glue-demo" next="glue" title="Glue">
<movie/>
<slide x="12" y="2">Some goals are mosaics which must be glued together.</slide>
<slide x="0" y="4">Spray glue on a tile to make it sticky.</slide>
<slide x="5" y="4">Sticky tiles have a purple border.</slide>
<slide>When a sticky tile moves next to another tile, they are joined into a mosaic and are no longer sticky.</slide>
<slide>The entire mosaic is fragile.</slide>
<slide x="9" y="6">If pieces are pulled in different directions, the whole thing collapses.</slide>
<map>
eNqNjoeNBDAIBMGBsCY08v2398d1cEijIVgGJmrQXzBV8EGwlZ
JCeaA7HmiPB+IxQ9YpnFOyrORayN2TU/oVOPbMV6ksaAmaDpJs
IGSNy9GliNQX6R1pjact4e3PoSkQ9xDMv2E9Vat+e2OaOX/fbJ
BcmXM302DYOYvTnqfy47q0YsWmH+NQ/38A9WAHtg==
</map>
</level>
<level id="glue" prev="glue-demo">
<unlock name="white-tee"/>
<unlock name="black-box"/>
<unlock name="mem-demo"/>
<slide>Try it out.</slide>
<map>
eNpNikEOwkAMA51tQion2woQCA78/yk8C3zooZZGY1k24Nn4tL
PbbbYFExemCbgsFghjhhzyUoLqcpDTS4A7gq8qvmexi2tPrkl9
qG8lU2O2+iZvJGBXezjGbdwHjvyO4JTz5ti/f0DFFSY=
</map>
</level>
<level id="white-tee" title="White Tee">
<map>
eNqtze0NgyEIBOAjeSt6Av7Q7tD9l+haPXcoyRMI4cOA98InDB
VWFbtWbCyH0U22nCtVC8SSiRIwz1VccK4jhBRj+wzaCHMGszu6
9gRNWQZEd6fyvPfV25dmjswS/RpXEbD+yoFnNLapOfw5HqzvD4
0KB1E=
</map>
</level>
<level id="black-box" title="Black Box">
<map>
eNqlzTEOAzEIBMBFuhznNeDCTnE/yP8/kWcl6zZtVhqBEAIDng
OvMFRYVcwaMTEcRjeZsrZULxBLJkrAXFtxEFKM6T1oLcwZzMtx
aV9wqkqD6F5X7fuuZnPTzpJeoh9tK97LecMJWHtkw8Gzn93pn5
9A+Wd2YLy/J8lHKQ==
</map>
</level>
<level id="mem-demo" next="mem" title="Memory">
<movie/>
<slide>Memory pieces deliver the power they get after waiting one second.</slide>
<slide x="2" y="5">You can wire them up in a circle to act as a precise timer.</slide>
<slide>Make sure some start up powered and some not.</slide>
<slide x="7" y="1">You can also use them to delay power if you can't put a sensor in the right spot.</slide>
<slide x="10" y="1">The sensor is wired through this memory so the copier is activated one second after it is pressed.</slide>
<slide>Memory pieces can be useful in many situations.</slide>
<map>
eNptjEsOAzEIQ/kUSEwmWXfX+19y6tlWxXrCWBYqckE+7gH3hF
tst9xpupfqvkSRQy9MO6ut38tQIiglQq9kKaofnN4xS+HgPSYw
41S/mJNO7sTq6LMCcxhxCHyT8PS0R2HhYanKR1Qbi84i1aGVgN
ioMe6fEc6/7CXn/gIJXiXi
</map>
</level>
<level id="mem" prev="mem-demo">
<slide>Try it out.</slide>
<unlock name="set-clear-demo"/>
<unlock name="obelisk"/>
<unlock name="sunrise"/>
<map>
eNpdxUEOwyAMRNGxiw2xgAQaJbve/zY9Eh11147m6wlwZ7yqaL
82j9489uFRzUrdWGPDSoNGhkQWhgdlyZhHduq00EKDBq200k47
PehBJ50ewzwAmXIl6FNPxVr43/r+dwn7+wOCDwlT
</map>
</level>
<level id="set-clear-demo" next="set-clear" title="Set & Clear">
<movie/>
<slide>You can use memory to permanently store signals using the Set and Clear piece.</slide>
<slide x="6" y="4">This Memory has no incoming wires. Instead, it is next to a Set piece and a Clear piece.</slide>
<slide x="5" y="4">Set pieces turn on adjacent Memories when they are powered on.</slide>
<slide x="7" y="4">Clear pieces turn off adjacent Memories when they are powered on.</slide>
<slide x="4" y="2">When the block passes the first sensor, this activates the Set piece which turns on the Memory.</slide>
<slide x="7" y="2">The memory stays on until the block passes the second sensor, activating the Clear piece.</slide>
<slide x="1" y="6">When the memory turns on, it activates the second copier continuously.</slide>
<slide>Set and Clear can make your job easier, but you can always do without.</slide>
<map>
eNptyzEOwzAMQ1GKoaVacZwt979py+4R8PAHQgHcE88K7iT3bP
aUFftItYZ6lDqZe0X2hT92IbrCcLiG4RrKtSuNDYlDxVLK7wzy
jC3EIl7uHPvjLd824f7+AFOXBCE=
</map>
</level>
<level id="set-clear" prev="set-clear-demo">
<slide>Try using set and clear to pass this level.</slide>
<map>
eNotjEEKw0AMAyUaaq/WmxySbEr//8D+IFWhA8McZEzgangHqS
AUCDc0kNoBTUGvgq70Fj9919zmdre7wx1UJVvJloVlrjH97wzV
mX2dKYD7Yz7BY7nNZj4GfxZs9xfPogzf
</map>
</level>
<level id="obelisk" title="Obelisk">
<map>
eNqVikEKwzAQA7Xg1omsdXqJSaDf6if7yVS+FXqqYBjtogCOju
fewDPBB8BEUpCEWNVMxlojWUMGJli73W3atGVr3t7RO03c+0RU
06LU0ltyyyQQezmIMm7jPupY8JXXGz+5nH9+Bdv1AYAqEtg=
</map>
</level>
<level id="sunrise" title="Sunrise">
<map>
eNotzVkOwyAMBNBxFhyG7aNpk96iN8jVezM6VEF6whpsY8BZ8X
kF8CD4ruCJxFYLKwt3zCxwZvOaLTEzb7kOFjMliM10BNmEkumx
0JMUaQNUS5IoavRVMMlCN82YZk07TLtsZHpbTb0SJUmRNqi/SB
p/ZQL2CEfEtPvT+7f3ARfwv3XuqF93PbIFrf8ArJwe7A==
</map>
</level>
// ****************************************************************************
<level id="rainbow" title="Rainbow">
<map>
eNpNykEOwjAMRNFxhQiZOK5ok1KuwJYtt+dIHCAMggWWnr5k24
Btxm1j8FKE4F7Aq4eAcw9GB5caXAG2ClYEvVp2g1pPTini0qJ4
Q3HXvQg/fxEJE5MJqio5RA011C7tU1MlIGpWs3GH0c0I2PnYM6
Y1Lek5xnjJA8Ad3xm/Jf6WB8zjDRJDGJg=
</map>
</level>
<level id="crown" title="Crown">
<map>
eNp1j0tuhDAQRMsowqZo/FFGfBaYXCh35makjGYxLIL09Nxtu3
A74CfhN2Uw5cgCcUS+HPiq4ATP6fCMAxiXSO8m4UUvgnD0QQyC
Imk/iyKS6iyK2Bqgn9VfxCpqQzlVeVVZ1dEON9iO0VZ5EQW01O
pIm+NoxxRsbw6THb1ZUT+ppvqD6FRDhvbhzaAzUE6nnKAc6g2d
/ts5zaoZnWatbWb1d/V3x2WI3KhZR9WjHOQgz+392l/AbQUBF/
tvok8hhxKSz7543N+Fp+/19fQ/B6/z6fvGeX76feH89BfS9Qd2
gSWA
</map>
</level>
<level id="czech" title="Czech Flag">
<map>
eNoVjU0KAjEMRr+MbdOGps6g+LMR7+INhF7AYUDBhRs3HslTeL
OaJjxeCOELoVw+y3w/X5fX+/Z8zNuCU2GIEiQTafaUssuxNw8Q
Hkh4pUYWTh2bYXuQjN4cO3bjzI7kGFQOUWXPKjtn9ipTsGxvic
HgbvvBlAAawyaBJv4CtTXU2oBuWDmsf396/hGL
</map>
</level>
<level id="little-big-trouble" title="Little Big Trouble">
<map>
eNpdi1EKwjAQRGebpMlON7WKiBfw/lfowYQ4AT/EhcdbmBkDrs
QrsvXILcIKwzKrXG1lhbAkiwRhrEUucmrC9cvF2fMEfDTwSXXq
RD2XXd7kzRjNPGi+U1ufaL9NnMHW7si8oRBYuh0Zti/vMQb+rq
+HK6vnNzt/OhmX8QHUWhGE
</map>
</level>
// ****************************************************************************
<level id="widget" title="Widget">
<unlock name="light-bulb"/>
<unlock name="music-player"/>
<map>
eNpdTVtOAzEMtMNuJp446UdRtsfgNlwAhPiG+5dpVSSEo5GVed
kNr59vH+/fX8fJXoBC2E507T6JSGEwW7ZLGA8YF8R3F4woTf6N
8NB/EBAoHcpZMAuYLCOZ2ZsNeJVXmVA/1MFbh7hw3ShxxGRvM7
thLmu8mLSuLteNIlT5q3JVN+rg8J3j/pQv+zR7OvvazJ+Laa6P
scec6wpp+M/ftb6mtPzl/+qbna4/z54jdA==
</map>
</level>
<level id="light-bulb" title="Light Bulb">
<unlock name="music-player"/>
<unlock name="game-system"/>
<map>
eNptycEOwjAMA1CnK6Ryk+ywruPA///mSA9IHLD0FMsR4NrxNt
nCpIeKUbGQKkvNvpTshda9mSX3pnQqgxp5I+joaePswcuCL8/f
KdQhtIG+n6DORQjIUWdDGY/xxJ/cP/luFfv9AdzSEdA=
</map>
</level>
<level id="music-player" title="Music Player">
<unlock name="game-system"/>
<unlock name="mp3-player"/>
<map>
eNp1jUsOw0AIQyFqhsHhkywy6QF6/yumzC6L1tITCGyZia6kj4
HdGCG8QWiiEC6UCobYhGDi3Xqxe5fmkBb1r6kBJ8BBGBK4euC9
B0bWfQAS5YvyHZPaR3Wck+oYCjuRlt5zq46NlWiJ9VBasqXQD9
2l55xqq1ZCmvxNPN1TL8r7Cyx8F7A=
</map>
</level>
<level id="game-system" title="Game System">
<unlock name="mp3-player"/>
<unlock name="boombox"/>
<map>
eNptyssKwzAMRNFRGio8emQRY2fR///NVIYuSumFsxgkAeaBlw
vSJTOQDIADwQmnwqhidImyttQWDoLTwMtBbSWWujWhU5pbcWnK
pDKoVjx4WNI9CWznYzwhfb+/wqeTI7F1644//X6vdhz3G1d0Ge
8=
</map>
</level>
<level id="mp3-player" title="MP3 Player">
<unlock name="boombox"/>
<unlock name="lime6pack"/>
<map>
eNp1jV0KwzAMg5X9NLbsLEkfkp5g979h58IeylgFH8JCRgnYVr
yzgtkPErMmOlMpjBuZOQWw8EBa0KMX7uEjsnkQnZHpQ6pbc0/y
KhAW6yxTWA10S+pJGRN0beIMhpoP2tDOjZ0DyglyTuU2SeD+XI
S4LXkR/NH+1TmjFMfN1IgL/X7VZY2NltvlxtkPPVD3D6bjIIQ=
</map>
</level>
<level id="boombox" title="Boombox">
<unlock name="lime6pack"/>
<unlock name="dvd-player"/>
<map>
eNptycsOwjAMRNGxQHUycR0eSYEd//+TZVggsailo+s4Bmwdb8
dCR6Hbl/YCMXpTm1pWSXqooU51yNTfMEZdS1CajGwx0IJWo4p5
rnD2mQJuNflg8tmSs4IvgoBdFj1ON7/63fe/wcEc3X+3M/r+AW
GeGrg=
</map>
</level>
<level id="lime6pack" title="Lime 6-Pack">
<unlock name="dvd-player"/>
<unlock name="tank"/>
<map>
eNq1iAsOwjAMxZwBjZb1w7Z0gvsftKQSHAFL1nuywNXwC+wl2H
vBCtVan2LZ65adLSNrlnCZW6tSTCW8EYppD31uNC8G8nz0lbSn
I53p1EN3HQHB+PL7/2532vgAKyJMsw==
</map>
</level>
<level id="dvd-player" title="DVD Player">
<unlock name="tank"/>
<unlock name="car"/>
<map>
eNq1y90KgzAMhuEv1VlNUzrzI+7+L9RlBwPZ+V54CCSEgMNx1g
lcJ0qWlAUqAupCtElJpKuU5NbE0UYYj8ifUK6eIn+duMMS+EXg
KOCTjI9iDJRni4Fll71rt26icv2E7B+7+/ykj1hBtuDW9z5jXG
9HNmID
</map>
</level>
<level id="tank" title="Tank">
<unlock name="car"/>
<map>
eNrFzEsOgzAMBNCxBASMIc3HBi7R+9+OTqWuuuymIz1NHCUW4L
jw3CKpx6xXLJoDmvF26olKK426oZHRpAmiSQgDm5DYBGUTNjah
U+GZcLA5Czu4wyn41im4y0XNsZrPtKwmo5qAVpp285RNbDepnB
v7VEAeLU5o6bW3XrxEjRbVm3fHJzeDr/zr7pf/A/L9Ahj6Mho=
</map>
</level>
<level id="car" title="Car">
<map>
eNqtjltuwzAMBJdAE8o0SfklS75H73+1dPMX9NdZYDDiQqAkQL
/wqzpMtZvaG55PuhHMpkJQafIAEdNCFzrooFd6pU/SxOo5COxc
YL3CImGX0k/OcBsIC6RFGXZNw7x09zZmn3pxCXNxkulPCVeZfC
GVJOeGWcF3hIB/lM673CGwijfDAFnnvsA33/LIw3ffY4s9j2je
ouXrX8Dc6T57fOSb3Z1dP6ivPzLbivc=
</map>
</level>
</campaign>
;
public static var MAIN_ISLAND = 1;
public static var INACTIVE = 0;
static var levelXml = new URLVariables();
public static var COMPLETE = 2;
public static var levelState = new URLVariables();
public static var islandPos:Point = new Point(0, 0);
public static function parse(_arg1:GameSettings, _arg2:String):Boolean{
var _local3:*;
var _local4:*;
_local3 = false;
_local4 = levelXml[_arg2];
if (_local4 != null){
_arg1.setId(_arg2);
_arg1.setWinId(_arg2);
if (String(_local4.@next) != ""){
_arg1.setNext(String(_local4.@next));
};
if (String(_local4.@prev) != ""){
_arg1.setPrev(String(_local4.@prev));
};
parseLevel(_local4, _arg1);
_local3 = true;
};
return (_local3);
}
public static function saveLevel(_arg1:String, _arg2:String){
levelSaves[_arg1] = _arg2;
save();
}
public static function reset():void{
var _local1:*;
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
_local1 = campaign.descendants("level");
for each (_local2 in _local1) {
_local5 = String(_local2.@id);
levelState[_local5] = INACTIVE;
};
for each (_local3 in LevelMenu.tutorialBase) {
levelState[_local3] = ACTIVE;
};
for each (_local4 in LevelMenu.mainBase) {
levelState[_local4] = ACTIVE;
};
save();
}
public static function init():void{
var _local1:*;
var _local2:*;
var _local3:*;
disk = SharedObject.getLocal("tile-factory");
disk.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncHandler);
disk.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
disk.addEventListener(SyncEvent.SYNC, syncHandler);
load();
_local1 = campaign.descendants("level");
for each (_local2 in _local1) {
_local3 = String(_local2.@id);
levelXml[_local3] = _local2;
levelTitles[_local3] = String(_local2.@title);
if (levelState[_local3] == null){
levelState[_local3] = INACTIVE;
};
};
save();
}
static function parseLevel(_arg1:XML, _arg2:GameSettings):void{
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
var _local10:*;
var _local11:*;
var _local12:*;
var _local13:*;
var _local14:*;
_local3 = _arg1.child("movie");
if (_local3.length() > 0){
_arg2.setMovie();
};
_local4 = _arg1.child("unlock");
for each (_local5 in _local4) {
_local10 = String(_local5.@name);
if (_local10 != ""){
_arg2.addUnlock(_local10);
} else {
trace(("Empty name: " + String(_arg1.@id)));
};
};
_local6 = _arg1.child("slide");
for each (_local7 in _local6) {
_local11 = _local7.toString();
_local12 = null;
if (((!((String(_local7.@x) == ""))) && (!((String(_local7.@y) == ""))))){
_local12 = new Point(parseInt(String(_local7.@x)), parseInt(String(_local7.@y)));
};
_local13 = false;
if (String(_local7.@pixel) == "true"){
_local13 = true;
};
_local14 = String(_local7.@align);
if (_local14 == ""){
_local14 = "top";
};
_arg2.addSlide(new Slide(_local11, _local12, _local13, _local14));
};
_local8 = _arg1.child("map").toString();
_local9 = levelSaves[String(_arg1.@id)];
if (_local9 != null){
_arg2.setMap(_local8, SaveLoad.LOAD_LEVEL);
_arg2.setMap(_local9, SaveLoad.LOAD_SAVE);
} else {
_arg2.setMap(_local8, SaveLoad.LOAD_ALL);
};
}
public static function winTutorial():Boolean{
return (winAll(LevelMenu.tutorialIds));
}
static function netStatusHandler(_arg1:NetStatusEvent):void{
}
static function winAll(_arg1:Array):Boolean{
var _local2:*;
var _local3:*;
_local2 = true;
for each (_local3 in _arg1) {
if (((!((_local3 == ""))) && ((levelSaves[_local3] < COMPLETE)))){
_local2 = false;
break;
};
};
return (false);
}
static function load():void{
try {
if ((((disk.data.done == true)) && ((disk.data.version == 0)))){
if (((!((disk.data.levelState == null))) && (!((disk.data.levelState == ""))))){
levelState.decode(disk.data.levelState);
};
if (disk.data.mute == true){
Sound.toggleMute();
};
if (((!((disk.data.levelSaves == null))) && (!((disk.data.levelSaves == ""))))){
levelSaves.decode(disk.data.levelSaves);
};
if (disk.data.island != null){
island = disk.data.island;
};
if (((!((disk.data.islandX == null))) && (!((disk.data.islandY == null))))){
islandPos = new Point(disk.data.islandX, disk.data.islandY);
};
};
} catch(e:Error) {
reset();
};
if (levelState[LevelMenu.tutorialBase[0]] == INACTIVE){
reset();
};
}
static function asyncHandler(_arg1:AsyncErrorEvent):void{
}
static function syncHandler(_arg1:SyncEvent):void{
}
public static function winFirst():Boolean{
return (winAll(["conveyer-demo"]));
}
public static function winMain():Boolean{
return (winAll(LevelMenu.mainIds));
}
public static function save():void{
try {
disk.data.done = false;
disk.data.version = 0;
disk.data.levelState = levelState.toString();
disk.data.levelSaves = levelSaves.toString();
disk.data.island = island;
disk.data.islandX = islandPos.x;
disk.data.islandY = islandPos.y;
disk.data.mute = Sound.isMute();
disk.data.done = true;
disk.flush();
} catch(e:Error) {
};
}
}
}//package
Section 97
//CancelSound (CancelSound)
package {
import flash.media.*;
public dynamic class CancelSound extends Sound {
}
}//package
Section 98
//CircleClip (CircleClip)
package {
import flash.display.*;
public dynamic class CircleClip extends MovieClip {
}
}//package
Section 99
//CircleMakerClip (CircleMakerClip)
package {
import flash.display.*;
public dynamic class CircleMakerClip extends MovieClip {
}
}//package
Section 100
//ClearClip (ClearClip)
package {
import flash.display.*;
public dynamic class ClearClip extends MovieClip {
}
}//package
Section 101
//Cloud_Glue (Cloud_Glue)
package {
import flash.display.*;
public dynamic class Cloud_Glue extends MovieClip {
}
}//package
Section 102
//Cloud_Paint_0 (Cloud_Paint_0)
package {
import flash.display.*;
public dynamic class Cloud_Paint_0 extends MovieClip {
}
}//package
Section 103
//Cloud_Paint_1 (Cloud_Paint_1)
package {
import flash.display.*;
public dynamic class Cloud_Paint_1 extends MovieClip {
}
}//package
Section 104
//Cloud_Paint_10 (Cloud_Paint_10)
package {
import flash.display.*;
public dynamic class Cloud_Paint_10 extends MovieClip {
}
}//package
Section 105
//Cloud_Paint_11 (Cloud_Paint_11)
package {
import flash.display.*;
public dynamic class Cloud_Paint_11 extends MovieClip {
}
}//package
Section 106
//Cloud_Paint_12 (Cloud_Paint_12)
package {
import flash.display.*;
public dynamic class Cloud_Paint_12 extends MovieClip {
}
}//package
Section 107
//Cloud_Paint_13 (Cloud_Paint_13)
package {
import flash.display.*;
public dynamic class Cloud_Paint_13 extends MovieClip {
}
}//package
Section 108
//Cloud_Paint_14 (Cloud_Paint_14)
package {
import flash.display.*;
public dynamic class Cloud_Paint_14 extends MovieClip {
}
}//package
Section 109
//Cloud_Paint_15 (Cloud_Paint_15)
package {
import flash.display.*;
public dynamic class Cloud_Paint_15 extends MovieClip {
}
}//package
Section 110
//Cloud_Paint_2 (Cloud_Paint_2)
package {
import flash.display.*;
public dynamic class Cloud_Paint_2 extends MovieClip {
}
}//package
Section 111
//Cloud_Paint_3 (Cloud_Paint_3)
package {
import flash.display.*;
public dynamic class Cloud_Paint_3 extends MovieClip {
}
}//package
Section 112
//Cloud_Paint_4 (Cloud_Paint_4)
package {
import flash.display.*;
public dynamic class Cloud_Paint_4 extends MovieClip {
}
}//package
Section 113
//Cloud_Paint_5 (Cloud_Paint_5)
package {
import flash.display.*;
public dynamic class Cloud_Paint_5 extends MovieClip {
}
}//package
Section 114
//Cloud_Paint_6 (Cloud_Paint_6)
package {
import flash.display.*;
public dynamic class Cloud_Paint_6 extends MovieClip {
}
}//package
Section 115
//Cloud_Paint_7 (Cloud_Paint_7)
package {
import flash.display.*;
public dynamic class Cloud_Paint_7 extends MovieClip {
}
}//package
Section 116
//Cloud_Paint_8 (Cloud_Paint_8)
package {
import flash.display.*;
public dynamic class Cloud_Paint_8 extends MovieClip {
}
}//package
Section 117
//Cloud_Paint_9 (Cloud_Paint_9)
package {
import flash.display.*;
public dynamic class Cloud_Paint_9 extends MovieClip {
}
}//package
Section 118
//Cloud_Solvent (Cloud_Solvent)
package {
import flash.display.*;
public dynamic class Cloud_Solvent extends MovieClip {
}
}//package
Section 119
//Cloud_Stencil (Cloud_Stencil)
package {
import flash.display.*;
public dynamic class Cloud_Stencil extends MovieClip {
}
}//package
Section 120
//ConveyerClip (ConveyerClip)
package {
import flash.display.*;
public dynamic class ConveyerClip extends MovieClip {
}
}//package
Section 121
//CopierClip (CopierClip)
package {
import flash.display.*;
public dynamic class CopierClip extends MovieClip {
}
}//package
Section 122
//CounterClip (CounterClip)
package {
import flash.display.*;
public dynamic class CounterClip extends MovieClip {
}
}//package
Section 123
//CreditsMenuClip (CreditsMenuClip)
package {
import flash.display.*;
public dynamic class CreditsMenuClip extends MovieClip {
public var back:MovieClip;
}
}//package
Section 124
//CyanClip (CyanClip)
package {
import flash.display.*;
public dynamic class CyanClip extends MovieClip {
}
}//package
Section 125
//Dir (Dir)
package {
import lib.*;
public class Dir {
var index:int;
public static var angles = [-90, 90, 0, 180];
public static var north = new Dir(0);
;
public static var dirs = [north, south, east, west];
public static var south = new Dir(1);
;
public static var oppositeDirs = [south, north, west, east];
public static var clockwiseDirs = [east, west, south, north];
public static var counterDirs = [west, east, north, south];
public static var west = new Dir(3);
;
public static var deltaPoints = [new Point(0, -1), new Point(0, 1), new Point(1, 0), new Point(-1, 0)];
public static var east = new Dir(2);
;
public function Dir(_arg1:int):void{
index = _arg1;
}
public function opposite():Dir{
return (oppositeDirs[index]);
}
public function clockwise():Dir{
return (clockwiseDirs[index]);
}
public function toIndex():int{
return (index);
}
public function toAngle():int{
return (angles[index]);
}
public function counter():Dir{
return (counterDirs[index]);
}
public function toDelta():Point{
return (deltaPoints[index]);
}
public static function fromIndex(_arg1:int){
return (dirs[_arg1]);
}
public static function walk(_arg1:Point, _arg2:Dir, _arg3:int):Point{
var _local4:*;
_local4 = _arg1.clone();
walkMod(_local4, _arg2, _arg3);
return (_local4);
}
public static function slice(_arg1:Box, _arg2:Dir, _arg3:int):Box{
var _local4:*;
_local4 = null;
if (_arg2 == north){
_local4 = new Box(_arg1.getOffset(), new Point(_arg1.getLimit().x, (_arg1.getOffset().y + _arg3)));
} else {
if (_arg2 == south){
_local4 = new Box(new Point(_arg1.getOffset().x, (_arg1.getLimit().y - _arg3)), _arg1.getLimit());
} else {
if (_arg2 == east){
_local4 = new Box(new Point((_arg1.getLimit().x - _arg3), _arg1.getOffset().y), _arg1.getLimit());
} else {
_local4 = new Box(_arg1.getOffset(), new Point((_arg1.getOffset().x + _arg3), _arg1.getLimit().y));
};
};
};
return (_local4);
}
public static function step(_arg1:Point, _arg2:Dir):Point{
return (walk(_arg1, _arg2, 1));
}
public static function stepMod(_arg1:Point, _arg2:Dir):void{
walkMod(_arg1, _arg2, 1);
}
public static function remainder(_arg1:Box, _arg2:Dir, _arg3:int):Box{
return (slice(_arg1, _arg2.opposite(), (dirSize(_arg1, _arg2) - _arg3)));
}
public static function dirSize(_arg1:Box, _arg2:Dir):int{
var _local3:*;
_local3 = 0;
if ((((_arg2 == north)) || ((_arg2 == south)))){
_local3 = _arg1.getSize().y;
} else {
_local3 = _arg1.getSize().x;
};
return (_local3);
}
public static function extend(_arg1:Box, _arg2:Dir, _arg3:int):Box{
var _local4:*;
_local4 = null;
if (_arg2 == north){
_local4 = new Box(new Point(_arg1.getOffset().x, (_arg1.getOffset().y - _arg3)), _arg1.getLimit());
} else {
if (_arg2 == south){
_local4 = new Box(_arg1.getOffset(), new Point(_arg1.getLimit().x, (_arg1.getLimit().y + _arg3)));
} else {
if (_arg2 == east){
_local4 = new Box(_arg1.getOffset(), new Point((_arg1.getLimit().x + _arg3), _arg1.getLimit().y));
} else {
_local4 = new Box(new Point((_arg1.getOffset().x - _arg3), _arg1.getOffset().y), _arg1.getLimit());
};
};
};
return (_local4);
}
public static function walkMod(_arg1:Point, _arg2:Dir, _arg3:int):void{
var _local4:*;
_local4 = deltaPoints[_arg2.index];
_arg1.x = (_arg1.x + (_local4.x * _arg3));
_arg1.y = (_arg1.y + (_local4.y * _arg3));
}
}
}//package
Section 126
//EditMenuClip (EditMenuClip)
package {
import flash.display.*;
import flash.text.*;
public dynamic class EditMenuClip extends MovieClip {
public var tabButton:MovieClip;
public var nameField:TextField;
public var heightAdd1:MovieClip;
public var heightAdd5:MovieClip;
public var widthAdd5:MovieClip;
public var widthAdd1:MovieClip;
public var heightSub5:MovieClip;
public var heightSub1:MovieClip;
public var widthSub1:MovieClip;
public var widthSub5:MovieClip;
}
}//package
Section 127
//EmptyClip (EmptyClip)
package {
import flash.display.*;
public dynamic class EmptyClip extends MovieClip {
}
}//package
Section 128
//ExplosionClip (ExplosionClip)
package {
import flash.display.*;
public dynamic class ExplosionClip extends MovieClip {
}
}//package
Section 129
//FactoryBubbleClip (FactoryBubbleClip)
package {
import flash.display.*;
import flash.text.*;
public dynamic class FactoryBubbleClip extends MovieClip {
public var barText:TextField;
}
}//package
Section 130
//Game (Game)
package {
import flash.display.*;
import lib.*;
import logic.*;
import flash.events.*;
import ui.*;
import lib.ui.*;
public class Game implements MainState {
var state:int;
var settings:GameSettings;
var endGameFunction:Function;
var keyboard:Keyboard;
var model:Model;
var parent:DisplayObjectContainer;
var view:View;
var nextSettings:GameSettings;
public static var MOVIE_NEXT = 4;
public static var CONTINUE = 0;
public static var RESTART_GAME = 2;
public static var SKIP_GAME = 6;
public static var WIN_GAME = 3;
public static var END_GAME = 1;
public static var MOVIE_PREV = 5;
public function Game(_arg1:DisplayObjectContainer, _arg2:Keyboard, _arg3:GameSettings, _arg4:Function):void{
parent = _arg1;
keyboard = _arg2;
endGameFunction = _arg4;
init(_arg3);
}
function init(_arg1:GameSettings):void{
settings = _arg1;
nextSettings = null;
state = CONTINUE;
view = new View(parent, keyboard, Map.toPixel(settings.getSize()));
model = new Model(settings, view, endGame);
parent.addEventListener(Event.ENTER_FRAME, enterFrame);
}
public function cleanup():void{
model.cleanup();
view.cleanup();
parent.removeEventListener(Event.ENTER_FRAME, enterFrame);
}
public function endGame(_arg1:int):void{
var _local2:*;
var _local3:*;
var _local4:*;
state = _arg1;
if ((((state == WIN_GAME)) || ((state == SKIP_GAME)))){
for each (_local2 in settings.getUnlocks()) {
if (Campaign.levelState[_local2] == Campaign.INACTIVE){
Campaign.levelState[_local2] = Campaign.ACTIVE;
};
};
};
if (state == SKIP_GAME){
state = END_GAME;
};
if (state == WIN_GAME){
state = END_GAME;
Campaign.levelState[settings.getWinId()] = Campaign.COMPLETE;
Campaign.save();
if (Main.kongregate != null){
if (Campaign.winFirst()){
Main.kongregate.stats.submit("Tile Player", 1);
if (Campaign.winTutorial()){
Main.kongregate.stats.submit("Tile Winner", 1);
if (Campaign.winMain()){
Main.kongregate.stats.submit("Tile Master", 1);
};
};
};
};
} else {
if ((((state == MOVIE_NEXT)) || ((state == MOVIE_PREV)))){
_local3 = (state == MOVIE_PREV);
state = END_GAME;
_local4 = settings.getNext();
if (_local3){
_local4 = settings.getPrev();
};
if (_local4 != null){
setNextSettings(_local4, _local3);
};
};
};
}
function enterFrame(_arg1:Event):void{
var _local2:*;
if (state == END_GAME){
_local2 = true;
if ((((settings.getId() == null)) || ((settings.getId() == "sandbox")))){
_local2 = false;
};
endGameFunction(_local2);
} else {
if (state == RESTART_GAME){
if (nextSettings == null){
if (settings.getId() != null){
setNextSettings(settings.getId(), false);
} else {
nextSettings = settings;
};
};
cleanup();
init(nextSettings);
} else {
model.enterFrame();
view.enterFrame();
};
};
}
function setNextSettings(_arg1:String, _arg2:Boolean):void{
var _local3:*;
_local3 = new GameSettings(new Point(25, 25));
if (Campaign.parse(_local3, _arg1)){
nextSettings = _local3;
nextSettings.setWinId(settings.getWinId());
if (_arg2){
nextSettings.setSkipToEnd();
};
state = RESTART_GAME;
};
}
}
}//package
Section 131
//GameSettings (GameSettings)
package {
import lib.*;
import logic.*;
import logic.change.*;
public class GameSettings {
var name:String;
var wires:Array;
var winId:String;
var size:Point;
var id:String;
var skipToEnd:Boolean;
var unlocks:Array;
var movie:Boolean;
var prev:String;
var goals:Array;
var buttonStatus:ButtonStatus;
var slides:Array;
var parts:Array;
var next:String;
var editor:Boolean;
public function GameSettings(_arg1:Point):void{
reset(_arg1);
}
public function getName():String{
return (name);
}
public function getGoals():Array{
return (goals);
}
public function setName(_arg1:String):void{
name = _arg1;
}
public function addSlide(_arg1:Slide):void{
slides.push(_arg1);
}
public function getId():String{
return (id);
}
public function clearEditor():void{
editor = false;
}
public function setId(_arg1:String):void{
id = _arg1;
}
public function isMovie():Boolean{
return (movie);
}
public function getPrev():String{
return (prev);
}
public function initMap(_arg1:ChangeList){
var _local2:*;
var _local3:*;
var _local4:*;
for each (_local2 in parts) {
_local4 = _local2.clone();
_arg1.add(Util.makeChange(ChangePart.create, _local4));
_arg1.add(Util.makeChange(ChangePart.createSpec, _local4));
};
for each (_local3 in wires) {
_arg1.add(Util.makeChange(ChangePart.addWire, _local3.source.clone(), _local3.dest.clone()));
};
}
public function setMap(_arg1:String, _arg2:int):void{
var map = _arg1;
var loadType = _arg2;
try {
SaveLoad.loadMap(map, size, parts, wires, goals, buttonStatus, setName, loadType);
} catch(e:Error) {
trace(e.toString());
};
}
public function shouldSkipToEnd():Boolean{
return (skipToEnd);
}
public function isEditor():Boolean{
return (editor);
}
public function setPrev(_arg1:String):void{
prev = _arg1;
}
public function getButtonStatus():ButtonStatus{
return (buttonStatus);
}
public function addUnlock(_arg1:String):void{
unlocks.push(_arg1);
}
public function reset(_arg1:Point):void{
name = "";
editor = false;
movie = false;
skipToEnd = false;
id = null;
winId = null;
next = null;
prev = null;
slides = new Array();
size = _arg1.clone();
parts = new Array();
wires = new Array();
goals = new Array();
buttonStatus = new ButtonStatus();
unlocks = new Array();
}
public function setWinId(_arg1:String):void{
winId = _arg1;
}
public function getSlides():Array{
return (slides);
}
public function setSkipToEnd():void{
skipToEnd = true;
}
public function getWinId():String{
return (winId);
}
public function getNext():String{
return (next);
}
public function setMovie():void{
movie = true;
}
public function setEditor():void{
editor = true;
}
public function setNext(_arg1:String):void{
next = _arg1;
}
public function getSize():Point{
return (size);
}
public function getUnlocks():Array{
return (unlocks);
}
}
}//package
Section 132
//GlueClip (GlueClip)
package {
import flash.display.*;
public dynamic class GlueClip extends MovieClip {
}
}//package
Section 133
//GoalMenuClip (GoalMenuClip)
package {
import flash.display.*;
import flash.text.*;
public dynamic class GoalMenuClip extends MovieClip {
public var message:TextField;
public var tabButton:MovieClip;
public var addButton:MovieClip;
public var p:MovieClip;
}
}//package
Section 134
//GrassCornerClip (GrassCornerClip)
package {
import flash.display.*;
public dynamic class GrassCornerClip extends MovieClip {
}
}//package
Section 135
//GrassEdgeClip (GrassEdgeClip)
package {
import flash.display.*;
public dynamic class GrassEdgeClip extends MovieClip {
}
}//package
Section 136
//GrassOutsideClip (GrassOutsideClip)
package {
import flash.display.*;
public dynamic class GrassOutsideClip extends MovieClip {
}
}//package
Section 137
//IslandOverlayClip (IslandOverlayClip)
package {
import flash.display.*;
public dynamic class IslandOverlayClip extends MovieClip {
public var back:MovieClip;
}
}//package
Section 138
//ItemClip (ItemClip)
package {
import flash.display.*;
public dynamic class ItemClip extends MovieClip {
public function ItemClip(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 139
//ItemMenuClip (ItemMenuClip)
package {
import flash.display.*;
public dynamic class ItemMenuClip extends MovieClip {
public var bigCircle:MovieClip;
public var triangle:MovieClip;
public var cyan:MovieClip;
public var white:MovieClip;
public var tabButton:MovieClip;
public var glue:MovieClip;
public var solvent:MovieClip;
public var rectangle:MovieClip;
public var yellow:MovieClip;
public var magenta:MovieClip;
public var tile:MovieClip;
public var smallCircle:MovieClip;
public var circle:MovieClip;
public var black:MovieClip;
}
}//package
Section 140
//JamSound (JamSound)
package {
import flash.media.*;
public dynamic class JamSound extends Sound {
}
}//package
Section 141
//LevelMenu (LevelMenu)
package {
import flash.display.*;
import lib.*;
import flash.events.*;
import ui.*;
import lib.ui.*;
import flash.geom.*;
public class LevelMenu {
var beginGame:Function;
var bubble:FactoryBubbleClip;
var scrollMenu:ScrollMenu;
var clip:MovieClip;
var buttons:ButtonList;
var backButtons:ButtonList;
var levelIds:Array;
var newClips:Array;
var settings:GameSettings;
var changeIsland:Function;
var returnFunction:Function;
var parent:DisplayObjectContainer;
var frame:int;
var overlay:IslandOverlayClip;
var window:Window;
var images:ImageList;
var levelClips:Array;
static var mainBase = ["rainbow", "crown", "czech", "little-big-trouble", "widget"];
static var ghosted = new ColorTransform(0.3, 0.3, 0.3, 1, 112, 112, 112, 0);
static var mainIds = ["", "rainbow", "crown", "czech", "little-big-trouble", "widget", "light-bulb", "music-player", "game-system", "mp3-player", "boombox", "lime6pack", "dvd-player", "tank", "car"];
public static var tutorialIds = ["", "conveyer-demo", "jam-demo", "sprayer-demo", "sensor-demo", "violet", "stencil-demo", "imperial", "rotater-demo", "pyramid", "star", "mixer-demo", "monaco", "some-demo", "two-triangles", "none-demo", "all-demo", "glue-demo", "white-tee", "black-box", "mem-demo", "set-clear-demo", "obelisk", "sunrise"];
public static var tutorialBase = ["conveyer-demo"];
public function LevelMenu(_arg1:DisplayObjectContainer, _arg2:GameSettings, _arg3:Function, _arg4:Function, _arg5:Function):void{
parent = _arg1;
settings = _arg2;
beginGame = _arg3;
returnFunction = _arg4;
changeIsland = _arg5;
images = new ImageList();
newClips = [];
frame = 0;
}
public function startMain():void{
clip = new MainIslandClip();
levelClips = [clip.bridge, clip.rainbow, clip.crown, clip.czech, clip.littleBigTrouble, clip.widget, clip.lightBulb, clip.musicPlayer, clip.gameSystem, clip.mp3Player, clip.boombox, clip.lime6Pack, clip.dvdPlayer, clip.tank, clip.car];
levelIds = mainIds;
unlock(mainBase);
start(new Point(1600, 1200));
}
function unlock(_arg1:Array):void{
var _local2:*;
for each (_local2 in _arg1) {
if (Campaign.levelState[_local2] == Campaign.INACTIVE){
Campaign.levelState[_local2] = Campaign.ACTIVE;
};
};
}
function click(_arg1:int):void{
Sound.play(Sound.SELECT);
if (_arg1 == 0){
Campaign.island = (1 - Campaign.island);
Campaign.islandPos = new Point(0, 0);
Campaign.save();
changeIsland();
} else {
Campaign.islandPos = window.getOffset().clone();
Campaign.save();
Campaign.parse(settings, levelIds[_arg1]);
beginGame();
};
}
function clickBack(_arg1:int):void{
Campaign.islandPos = window.getOffset().clone();
Campaign.save();
Sound.play(Sound.SELECT);
returnFunction();
}
function resetWindow(_arg1:Point):void{
clip.addEventListener(Event.ENTER_FRAME, enterFrame);
if (window != null){
window.cleanup();
};
window = new Window(parent, new Point(Main.WIDTH, Main.HEIGHT), _arg1, 1, images, new WindowBorder(), clip, 0);
bubble = new FactoryBubbleClip();
parent.addChild(bubble);
bubble.visible = false;
bubble.mouseEnabled = false;
bubble.mouseChildren = false;
scrollMenu = new ScrollMenu(parent, window, false);
window.setOffset(Campaign.islandPos);
}
public function startTutorial():void{
clip = new TutorialIslandClip();
levelClips = [clip.bridge, clip.l0, clip.l1, clip.l2, clip.l3, clip.l4, clip.l5, clip.l6, clip.l7, clip.l8, clip.l9, clip.l10, clip.l11, clip.l12, clip.l13, clip.l14, clip.l15, clip.l16, clip.l17, clip.l18, clip.l19, clip.l20, clip.l21, clip.l22];
levelIds = tutorialIds;
unlock(tutorialBase);
start(new Point(Main.WIDTH, Main.HEIGHT));
scrollMenu.hide();
}
function start(_arg1:Point):void{
var _local2:*;
_local2 = 1;
while (_local2 < levelClips.length) {
updateLevel(_local2);
_local2++;
};
resetWindow(_arg1);
buttons = new ButtonList(levelClips);
buttons.setActions(click, factoryOver, factoryOut);
overlay = new IslandOverlayClip();
parent.addChild(overlay);
backButtons = new ButtonList([overlay.back]);
backButtons.setActions(clickBack, backButtons.frameOver, backButtons.frameOut);
overlay.back.barText.text = "Main Menu";
}
public function cleanup():void{
if (clip != null){
clip.removeEventListener(Event.ENTER_FRAME, enterFrame);
};
if (scrollMenu != null){
scrollMenu.cleanup();
};
if (bubble != null){
bubble.parent.removeChild(bubble);
};
if (backButtons != null){
backButtons.cleanup();
};
if (overlay != null){
overlay.parent.removeChild(overlay);
};
if (buttons != null){
buttons.cleanup();
};
if (window != null){
window.cleanup();
};
images.cleanup();
}
function factoryOut(_arg1:int):void{
buttons.glowOut(_arg1);
bubble.visible = false;
}
function enterFrame(_arg1:Event):void{
var _local2:*;
var _local3:*;
_local2 = 9;
if (frame < _local2){
for each (_local3 in newClips) {
if (_local3.height < 48){
_local3.height = (_local3.height + (_local2 - (frame / 2)));
} else {
_local3.height = (_local3.height - (_local2 - (frame / 2)));
};
if (frame == _local2){
_local3.height = 48;
};
};
frame++;
};
scrollMenu.enterFrame();
}
function updateLevel(_arg1:int):void{
var _local2:*;
if (_arg1 < levelIds.length){
_local2 = Campaign.levelState[levelIds[_arg1]];
if ((((_local2 == Campaign.ACTIVE)) || ((_local2 == Campaign.COMPLETE)))){
levelClips[_arg1].mouseEnabled = true;
if (_local2 == Campaign.COMPLETE){
levelClips[_arg1].gotoAndStop(2);
} else {
if (_local2 == Campaign.ACTIVE){
levelClips[_arg1].height = 1;
newClips.push(levelClips[_arg1]);
};
};
} else {
disableLevel(_arg1);
};
} else {
disableLevel(_arg1);
};
}
function disableLevel(_arg1:int):void{
levelClips[_arg1].transform.colorTransform = ghosted;
levelClips[_arg1].mouseEnabled = false;
}
function factoryOver(_arg1:int):void{
var _local2:*;
var _local3:*;
var _local4:*;
buttons.glowOver(_arg1);
if (_arg1 != 0){
bubble.visible = true;
_local2 = new Point(buttons.get(_arg1).x, buttons.get(_arg1).y);
_local3 = window.toRelative(_local2);
bubble.x = _local3.x;
bubble.y = _local3.y;
_local4 = "";
if (_arg1 < levelIds.length){
_local4 = Campaign.levelTitles[levelIds[_arg1]];
};
bubble.barText.text = _local4;
};
}
}
}//package
Section 142
//MagentaClip (MagentaClip)
package {
import flash.display.*;
public dynamic class MagentaClip extends MovieClip {
}
}//package
Section 143
//Main (Main)
package {
import flash.display.*;
import lib.*;
import ui.*;
import lib.ui.*;
public class Main {
static var settings:GameSettings;
public static var WIDTH = 800;
public static var HEIGHT = 600;
static var root:DisplayObjectContainer;
public static var kongregate = null;
static var state:MainState;
static var keyboard:Keyboard;
static function endGame(_arg1:Boolean):void{
var _local2:*;
state.cleanup();
settings = new GameSettings(new Point(25, 25));
_local2 = new MainMenu(root, settings, beginGame);
state = _local2;
if (_arg1){
_local2.selectLevel();
};
}
public static function init(_arg1:DisplayObjectContainer):void{
var _local2:*;
_local2 = _arg1.stage.loaderInfo.url.split("/")[2];
Campaign.init();
Sound.playMusic();
root = _arg1;
keyboard = new Keyboard(root.stage);
RegionList.setupRegions();
settings = new GameSettings(new Point(25, 25));
state = new MainMenu(root, settings, beginGame);
}
static function beginGame():void{
state.cleanup();
state = new Game(root, keyboard, settings, endGame);
}
}
}//package
Section 144
//MainIslandClip (MainIslandClip)
package {
import flash.display.*;
public dynamic class MainIslandClip extends MovieClip {
public var boombox:MovieClip;
public var mp3Player:MovieClip;
public var lightBulb:MovieClip;
public var widget:MovieClip;
public var musicPlayer:MovieClip;
public var littleBigTrouble:MovieClip;
public var bridge:MovieClip;
public var dvdPlayer:MovieClip;
public var czech:MovieClip;
public var lime6Pack:MovieClip;
public var rainbow:MovieClip;
public var crown:MovieClip;
public var gameSystem:MovieClip;
public var car:MovieClip;
public var tank:MovieClip;
}
}//package
Section 145
//MainMenu (MainMenu)
package {
import flash.display.*;
import lib.*;
import flash.events.*;
import ui.*;
import lib.ui.*;
import flash.net.*;
public class MainMenu implements MainState {
var levelMenu:LevelMenu;
var beginGame:Function;
var buttons:ButtonList;
var menu:MainMenuClip;
var settings:GameSettings;
var parent:DisplayObjectContainer;
var glowButtons:ButtonList;
static var EDITOR_PASTE = 4;
static var SANDBOX = 1;
static var PLAY_SAVE = 2;
static var PASTE_LOAD = 7;
static var CREDITS_BACK = 9;
static var EDITOR = 3;
static var CREDITS = 5;
static var PASTE_BACK = 8;
static var MORE_GAMES = 10;
static var COMMUNITY = 6;
static var PLAY_GAME = 0;
public function MainMenu(_arg1:DisplayObjectContainer, _arg2:GameSettings, _arg3:Function):void{
var _local4:*;
var _local5:*;
super();
parent = _arg1;
menu = new MainMenuClip();
parent.addChild(menu);
_local4 = [menu.start.playGame, menu.start.sandbox, menu.start.playSave, menu.start.editor, menu.start.editorPaste, menu.start.credits, menu.start.community, menu.paste.loadGame, menu.paste.back, menu.credits.back];
if (menu.start.moreGames != null){
_local4.push(menu.start.moreGames);
};
buttons = new ButtonList(_local4);
buttons.setActions(click, buttons.frameOver, buttons.frameOut);
_local5 = [menu.start.mute, menu.start.compLink];
if (menu.start.armor != null){
_local5.push(menu.start.armor);
_local5.push(menu.start.facebook);
_local5.push(menu.start.twitter);
};
glowButtons = new ButtonList(_local5);
glowButtons.setActions(clickGlow, glowButtons.glowOver, glowButtons.glowOut);
menu.start.playGame.barText.text = "New Game";
menu.start.sandbox.barText.text = "Sandbox Mode";
menu.start.playSave.barText.text = "Play Save";
menu.start.editor.barText.text = "Edit New Map";
menu.start.editorPaste.barText.text = "Edit Save";
menu.start.credits.barText.text = "Credits";
menu.start.community.barText.text = "Community";
if (menu.start.moreGames != null){
menu.start.moreGames.barText.text = "More Games";
};
menu.paste.loadGame.barText.text = "Load";
menu.paste.back.barText.text = "Back";
menu.credits.back.barText.text = "Back";
settings = _arg2;
settings.reset(new Point(25, 25));
beginGame = _arg3;
menu.start.visible = true;
menu.paste.visible = false;
menu.credits.visible = false;
menu.addEventListener(Event.ENTER_FRAME, moveArrows);
levelMenu = new LevelMenu(parent, settings, beginGame, clearLevelMenu, changeIsland);
if (Sound.isMute()){
menu.start.mute.gotoAndStop(2);
} else {
menu.start.mute.gotoAndStop(1);
};
}
function click(_arg1:int):void{
Sound.play(Sound.SELECT);
if (_arg1 == PLAY_GAME){
selectLevel();
} else {
if (_arg1 == SANDBOX){
Campaign.parse(settings, "sandbox");
beginGame();
} else {
if (_arg1 == PLAY_SAVE){
settings.clearEditor();
menu.start.visible = false;
menu.paste.visible = true;
menu.stage.focus = menu.paste.code;
} else {
if (_arg1 == EDITOR){
settings.setEditor();
beginGame();
} else {
if (_arg1 == EDITOR_PASTE){
settings.setEditor();
menu.start.visible = false;
menu.paste.visible = true;
menu.stage.focus = menu.paste.code;
} else {
if (_arg1 == CREDITS){
menu.start.visible = false;
menu.credits.visible = true;
} else {
if (_arg1 == COMMUNITY){
navigateToURL(new URLRequest("http://groups.google.com/group/tile-factory"));
} else {
if (_arg1 == PASTE_LOAD){
settings.setMap(menu.paste.code.text, SaveLoad.LOAD_ALL);
beginGame();
} else {
if (_arg1 == PASTE_BACK){
menu.start.visible = true;
menu.paste.visible = false;
} else {
if (_arg1 == CREDITS_BACK){
menu.start.visible = true;
menu.credits.visible = false;
} else {
if (_arg1 == MORE_GAMES){
navigateToURL(new URLRequest("http://armorgames.com"));
};
};
};
};
};
};
};
};
};
};
};
}
public function cleanup():void{
levelMenu.cleanup();
menu.removeEventListener(Event.ENTER_FRAME, moveArrows);
glowButtons.cleanup();
buttons.cleanup();
menu.parent.removeChild(menu);
}
function changeIsland():void{
clearLevelMenu();
selectLevel();
}
function selectLevel():void{
settings.clearEditor();
if (Campaign.island == Campaign.TUTORIAL_ISLAND){
levelMenu.startTutorial();
} else {
levelMenu.startMain();
};
}
function clickGlow(_arg1:int):void{
if (_arg1 == 0){
Sound.toggleMute();
if (menu.start.mute.currentFrame == 1){
menu.start.mute.gotoAndStop(2);
} else {
menu.start.mute.gotoAndStop(1);
};
Campaign.save();
} else {
if (_arg1 == 1){
navigateToURL(new URLRequest("http://jayisgames.com/cgdc8"));
} else {
if (_arg1 == 2){
navigateToURL(new URLRequest("http://armorgames.com"));
} else {
if (_arg1 == 3){
navigateToURL(new URLRequest("http://www.facebook.com/pages/Armor-Games/19522089061"));
} else {
if (_arg1 == 4){
navigateToURL(new URLRequest("http://twitter.com/armorgames"));
};
};
};
};
};
Sound.play(Sound.SELECT);
}
function moveArrows(_arg1:Event):void{
if (menu.start.arrows.y <= -600){
menu.start.arrows.y = 0;
};
menu.start.arrows.y = (menu.start.arrows.y - 0.5);
}
function clearLevelMenu():void{
levelMenu.cleanup();
levelMenu = new LevelMenu(parent, settings, beginGame, clearLevelMenu, changeIsland);
}
}
}//package
Section 146
//MainMenuClip (MainMenuClip)
package {
import flash.display.*;
public dynamic class MainMenuClip extends MovieClip {
public var start:StartMenuClip;
public var paste:PasteMenuClip;
public var credits:CreditsMenuClip;
}
}//package
Section 147
//MainState (MainState)
package {
public interface MainState {
function cleanup():void;
}
}//package
Section 148
//MemClip (MemClip)
package {
import flash.display.*;
public dynamic class MemClip extends MovieClip {
}
}//package
Section 149
//MixerClip (MixerClip)
package {
import flash.display.*;
public dynamic class MixerClip extends MovieClip {
}
}//package
Section 150
//MixerSound (MixerSound)
package {
import flash.media.*;
public dynamic class MixerSound extends Sound {
}
}//package
Section 151
//MouseOverSound (MouseOverSound)
package {
import flash.media.*;
public dynamic class MouseOverSound extends Sound {
}
}//package
Section 152
//MovieMenuClip (MovieMenuClip)
package {
import flash.display.*;
import ui.*;
import flash.text.*;
public dynamic class MovieMenuClip extends MovieClip {
public var arrow:TutorialArrowClip;
public var next:MovieClip;
public var message:TextField;
public var prev:MovieClip;
}
}//package
Section 153
//MusicClip (MusicClip)
package {
import flash.media.*;
public dynamic class MusicClip extends Sound {
}
}//package
Section 154
//NoneClip (NoneClip)
package {
import flash.display.*;
public dynamic class NoneClip extends MovieClip {
}
}//package
Section 155
//PartMenuClip (PartMenuClip)
package {
import flash.display.*;
public dynamic class PartMenuClip extends MovieClip {
public var mixer:MovieClip;
public var sprayer:MovieClip;
public var some:MovieClip;
public var tabButton:MovieClip;
public var none:MovieClip;
public var setButton:MovieClip;
public var rotater:MovieClip;
public var conveyer:ConveyerClip;
public var all:MovieClip;
public var clear:MovieClip;
public var barrier:MovieClip;
public var sensor:SensorClip;
public var copier:MovieClip;
public var mem:MovieClip;
public function PartMenuClip(){
addFrameScript(0, frame1);
}
function frame1(){
conveyer.gotoAndStop(2);
sensor.gotoAndStop(2);
}
}
}//package
Section 156
//PasteMenuClip (PasteMenuClip)
package {
import flash.display.*;
import flash.text.*;
public dynamic class PasteMenuClip extends MovieClip {
public var code:TextField;
public var back:MovieClip;
public var loadGame:MovieClip;
}
}//package
Section 157
//PlaceMenuClip (PlaceMenuClip)
package {
import flash.display.*;
public dynamic class PlaceMenuClip extends MovieClip {
public var power:MovieClip;
public var counter:MovieClip;
public var trash:MovieClip;
public var clockwise:MovieClip;
}
}//package
Section 158
//PlaceSound (PlaceSound)
package {
import flash.media.*;
public dynamic class PlaceSound extends Sound {
}
}//package
Section 159
//RectangleClip (RectangleClip)
package {
import flash.display.*;
public dynamic class RectangleClip extends MovieClip {
}
}//package
Section 160
//RectangleMakerClip (RectangleMakerClip)
package {
import flash.display.*;
public dynamic class RectangleMakerClip extends MovieClip {
}
}//package
Section 161
//RotaterClip (RotaterClip)
package {
import flash.display.*;
public dynamic class RotaterClip extends MovieClip {
public function RotaterClip(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 162
//SaveLoad (SaveLoad)
package {
import lib.*;
import logic.*;
import ui.*;
import flash.utils.*;
import lib.external.*;
public class SaveLoad {
public static var LOAD_ALL = 0;
public static var LOAD_LEVEL = 1;
static var CURRENT_VERSION = 1;
public static var LOAD_SAVE = 2;
static function loadGoals(_arg1:ByteArray, _arg2:Array, _arg3:int):void{
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
var _local10:*;
var _local11:*;
var _local12:*;
var _local13:*;
var _local14:*;
var _local15:*;
var _local16:*;
var _local17:*;
var _local18:*;
var _local19:*;
_local4 = _arg1.readUnsignedByte();
_local5 = 0;
while (_local5 < _local4) {
_local6 = loadPoint(_arg1);
_local7 = loadPoint(_arg1);
_local8 = new GoalSpec(new Box(_local6, _local7));
_local9 = _arg1.readUnsignedShort();
_local10 = new Array();
_local11 = new Array();
_local12 = 0;
_local12 = 0;
while (_local12 < _local9) {
_local13 = loadPoint(_arg1);
_local8.pos.push(_local13);
_local12++;
};
_local12 = 0;
while (_local12 < _local9) {
_local14 = _arg1.readUnsignedInt();
_local15 = _arg1.readUnsignedInt();
_local16 = _arg1.readUnsignedInt();
_local17 = _arg1.readUnsignedInt();
_local18 = _arg1.readUnsignedInt();
_local19 = new RegionList();
_local19.reset(_local14, _local15, _local16, _local17, _local18);
_local8.color.push(_local19);
_local12++;
};
if ((((_arg3 == LOAD_ALL)) || ((_arg3 == LOAD_LEVEL)))){
_arg2.push(_local8);
};
_local5++;
};
}
static function saveParts(_arg1:ByteArray, _arg2:Array):void{
var _local3:*;
_arg1.writeShort(_arg2.length);
for each (_local3 in _arg2) {
_local3.save(_arg1);
};
}
static function loadPoint(_arg1:ByteArray):Point{
var _local2:*;
_local2 = new Point(0, 0);
_local2.x = _arg1.readUnsignedByte();
_local2.y = _arg1.readUnsignedByte();
return (_local2);
}
static function loadWires(_arg1:ByteArray, _arg2:Array, _arg3:int):void{
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
_local4 = _arg1.readUnsignedShort();
_local5 = 0;
while (_local5 < _local4) {
_local6 = loadPoint(_arg1);
_local7 = loadPoint(_arg1);
if ((((_arg3 == LOAD_ALL)) || ((_arg3 == LOAD_SAVE)))){
_arg2.push(new WireSpec(_local6, _local7));
};
_local5++;
};
}
static function saveWires(_arg1:ByteArray, _arg2:Array):void{
var _local3:*;
_arg1.writeShort(_arg2.length);
for each (_local3 in _arg2) {
_local3.save(_arg1);
};
}
static function saveGoals(_arg1:ByteArray, _arg2:Array):void{
var _local3:*;
_arg1.writeByte(_arg2.length);
for each (_local3 in _arg2) {
_local3.save(_arg1);
};
}
public static function savePoint(_arg1:ByteArray, _arg2:Point):void{
_arg1.writeByte(_arg2.x);
_arg1.writeByte(_arg2.y);
}
static function partAllowed(_arg1:int, _arg2:ButtonStatus):Boolean{
return (_arg2.getStatus(_arg1));
}
public static function loadMap(_arg1:String, _arg2:Point, _arg3:Array, _arg4:Array, _arg5:Array, _arg6:ButtonStatus, _arg7:Function, _arg8:int):void{
var _local9:*;
var _local10:*;
var _local11:*;
var _local12:*;
var _local13:*;
var _local14:*;
var _local15:*;
var _local16:*;
if ((((_arg8 == LOAD_ALL)) || ((_arg8 == LOAD_LEVEL)))){
_arg3.splice(0, _arg3.length);
_arg5.splice(0, _arg5.length);
};
if ((((_arg8 == LOAD_ALL)) || ((_arg8 == LOAD_SAVE)))){
_arg4.splice(0, _arg4.length);
};
_local9 = new RegExp("\\s", "g");
_local10 = _arg1.replace(_local9, "");
_local11 = Base64.decodeToByteArray(_local10);
_local11.uncompress();
_local12 = _local11.readUnsignedByte();
if (_local12 > CURRENT_VERSION){
trace(("Unknown version: " + _local12));
throw (new Error(("Unknown version: " + _local12)));
};
_local13 = "";
if (_local12 > 0){
_local13 = _local11.readUTF();
};
_local14 = _local11.readUnsignedByte();
_local15 = _local11.readUnsignedByte();
if ((((_arg8 == LOAD_ALL)) || ((_arg8 == LOAD_LEVEL)))){
if (_local12 > 0){
_arg7(_local13);
};
_arg2.x = _local14;
_arg2.y = _local15;
};
loadParts(_local11, _arg3, _arg6, _arg8);
loadWires(_local11, _arg4, _arg8);
loadGoals(_local11, _arg5, _arg8);
if (_local12 > 0){
_local16 = _local11.readUnsignedInt();
if ((((_arg8 == LOAD_ALL)) || ((_arg8 == LOAD_LEVEL)))){
_arg6.setAllStatus(_local16);
};
};
}
static function partBlocked(_arg1:Point, _arg2:Array):Boolean{
var _local3:*;
var _local4:*;
_local3 = false;
for each (_local4 in _arg2) {
if (Point.isEqual(_arg1, _local4.pos)){
_local3 = true;
break;
};
};
return (_local3);
}
static function loadParts(_arg1:ByteArray, _arg2:Array, _arg3:ButtonStatus, _arg4:int):void{
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
var _local10:*;
var _local11:*;
var _local12:*;
var _local13:*;
var _local14:*;
_local5 = _arg1.readUnsignedShort();
_local6 = 0;
while (_local6 < _local5) {
_local7 = _arg1.readUnsignedByte();
_local8 = loadPoint(_arg1);
_local9 = _arg1.readUnsignedByte();
_local10 = Dir.dirs[(_local9 & 3)];
_local11 = true;
if ((_local9 & 4) == 0){
_local11 = false;
};
_local12 = true;
if ((_local9 & 8) == 0){
_local12 = false;
};
_local13 = (_arg4 == LOAD_ALL);
if (!_local13){
_local13 = (((_arg4 == LOAD_LEVEL)) && (_local12));
};
if (!_local13){
_local13 = ((((!(_local12)) && (partAllowed(_local7, _arg3)))) && (!(partBlocked(_local8, _arg2))));
};
if (_local13){
_local14 = new PartSpec(_local7, _local8, _local10, _local11);
_local14.fixed = _local12;
_arg2.push(_local14);
};
_local6++;
};
}
public static function saveMap(_arg1:Point, _arg2:Array, _arg3:Array, _arg4:Array, _arg5:ButtonStatus, _arg6:String):String{
var _local7:*;
var _local8:*;
var _local9:*;
var _local10:*;
var _local11:*;
var _local12:*;
_local7 = new ByteArray();
_local7.writeByte(CURRENT_VERSION);
_local7.writeUTF(_arg6);
savePoint(_local7, _arg1);
saveParts(_local7, _arg2);
saveWires(_local7, _arg3);
saveGoals(_local7, _arg4);
_local7.writeUnsignedInt(_arg5.getAllStatus());
_local7.compress();
_local8 = Base64.encodeByteArray(_local7);
_local9 = [];
_local10 = 0;
_local11 = 50;
while (_local10 < _local8.length) {
_local9.push(_local8.substr(_local10, _local11));
_local10 = (_local10 + _local11);
};
_local12 = _local9.join("\n");
return (_local12);
}
}
}//package
Section 163
//SaveMenuClip (SaveMenuClip)
package {
import flash.display.*;
import flash.text.*;
public dynamic class SaveMenuClip extends MovieClip {
public var copyButton:MovieClip;
public var code:TextField;
public var backButton:MovieClip;
}
}//package
Section 164
//ScrollMenuClip (ScrollMenuClip)
package {
import flash.display.*;
import ui.*;
public dynamic class ScrollMenuClip extends MovieClip {
public var north:ScrollArrowClip;
public var west:ScrollArrowClip;
public var south:ScrollArrowClip;
public var east:ScrollArrowClip;
}
}//package
Section 165
//SelectClip (SelectClip)
package {
import flash.display.*;
public dynamic class SelectClip extends MovieClip {
}
}//package
Section 166
//SelectSound (SelectSound)
package {
import flash.media.*;
public dynamic class SelectSound extends Sound {
}
}//package
Section 167
//SensorClip (SensorClip)
package {
import flash.display.*;
public dynamic class SensorClip extends MovieClip {
}
}//package
Section 168
//SetClip (SetClip)
package {
import flash.display.*;
public dynamic class SetClip extends MovieClip {
}
}//package
Section 169
//Slide (Slide)
package {
import lib.*;
public class Slide {
public var pos:Point;
public var align:String;
public var isPixel:Boolean;
public var text:String;
public function Slide(_arg1:String, _arg2:Point, _arg3:Boolean, _arg4:String):void{
text = _arg1;
pos = null;
if (_arg2 != null){
pos = _arg2.clone();
};
isPixel = _arg3;
align = _arg4;
}
}
}//package
Section 170
//SmallCircleClip (SmallCircleClip)
package {
import flash.display.*;
public dynamic class SmallCircleClip extends MovieClip {
}
}//package
Section 171
//SmallCircleMakerClip (SmallCircleMakerClip)
package {
import flash.display.*;
public dynamic class SmallCircleMakerClip extends MovieClip {
}
}//package
Section 172
//SolventClip (SolventClip)
package {
import flash.display.*;
public dynamic class SolventClip extends MovieClip {
}
}//package
Section 173
//SomeClip (SomeClip)
package {
import flash.display.*;
public dynamic class SomeClip extends MovieClip {
}
}//package
Section 174
//SprayerClip (SprayerClip)
package {
import flash.display.*;
public dynamic class SprayerClip extends MovieClip {
}
}//package
Section 175
//SpraySound (SpraySound)
package {
import flash.media.*;
public dynamic class SpraySound extends Sound {
}
}//package
Section 176
//StartMenuClip (StartMenuClip)
package {
import flash.display.*;
public dynamic class StartMenuClip extends MovieClip {
public var editorPaste:MovieClip;
public var mute:MovieClip;
public var armor:MovieClip;
public var editor:MovieClip;
public var moreGames:MovieClip;
public var playGame:MovieClip;
public var arrows:MovieClip;
public var credits:MovieClip;
public var compLink:MovieClip;
public var twitter:MovieClip;
public var facebook:MovieClip;
public var sandbox:MovieClip;
public var playSave:MovieClip;
public var community:MovieClip;
}
}//package
Section 177
//SuccessSound (SuccessSound)
package {
import flash.media.*;
public dynamic class SuccessSound extends Sound {
}
}//package
Section 178
//SystemMenuClip (SystemMenuClip)
package {
import flash.display.*;
public dynamic class SystemMenuClip extends MovieClip {
public var saveButton:MovieClip;
public var restartButton:MovieClip;
public var soundButton:MovieClip;
public var quitButton:MovieClip;
public var arrows:MovieClip;
public var skipButton:MovieClip;
public var resumeButton:MovieClip;
}
}//package
Section 179
//TestMenuClip (TestMenuClip)
package {
import flash.display.*;
import flash.text.*;
public dynamic class TestMenuClip extends MovieClip {
public var stepButton:MovieClip;
public var tabButton:MovieClip;
public var playButton:MovieClip;
public var fastButton:MovieClip;
public var pauseButton:MovieClip;
public var stopButton:MovieClip;
public var status:TextField;
}
}//package
Section 180
//TileClip (TileClip)
package {
import flash.display.*;
public dynamic class TileClip extends MovieClip {
}
}//package
Section 181
//TileMenuClip (TileMenuClip)
package {
import flash.display.*;
import flash.text.*;
public dynamic class TileMenuClip extends MovieClip {
public var message:TextField;
public var tabButton:MovieClip;
public var p:MovieClip;
}
}//package
Section 182
//TileMenuSide (TileMenuSide)
package {
import flash.display.*;
import flash.text.*;
public dynamic class TileMenuSide extends MovieClip {
public var paint:MovieClip;
public var testLabel:TextField;
public var test:TileZoomClip;
public var tile:TileZoomClip;
}
}//package
Section 183
//TileZoomClip (TileZoomClip)
package {
import flash.display.*;
public dynamic class TileZoomClip extends MovieClip {
public var draw:EmptyClip;
public var overlay:MovieClip;
public var stencil:MovieClip;
}
}//package
Section 184
//ToolTipClip (ToolTipClip)
package {
import flash.display.*;
import flash.text.*;
public dynamic class ToolTipClip extends MovieClip {
public var blurb:TextField;
public var barText:TextField;
}
}//package
Section 185
//TopMenuClip (TopMenuClip)
package {
import flash.display.*;
public dynamic class TopMenuClip extends MovieClip {
public var menuButton:MovieClip;
public var muteButton:MovieClip;
}
}//package
Section 186
//TrackClip (TrackClip)
package {
import flash.display.*;
public dynamic class TrackClip extends MovieClip {
}
}//package
Section 187
//TriangleClip (TriangleClip)
package {
import flash.display.*;
public dynamic class TriangleClip extends MovieClip {
}
}//package
Section 188
//TriangleMakerClip (TriangleMakerClip)
package {
import flash.display.*;
public dynamic class TriangleMakerClip extends MovieClip {
}
}//package
Section 189
//TutorialIslandClip (TutorialIslandClip)
package {
import flash.display.*;
public dynamic class TutorialIslandClip extends MovieClip {
public var l0:MovieClip;
public var l1:MovieClip;
public var l4:MovieClip;
public var l8:MovieClip;
public var l5:MovieClip;
public var l7:MovieClip;
public var l3:MovieClip;
public var l6:MovieClip;
public var l2:MovieClip;
public var l16:MovieClip;
public var l13:MovieClip;
public var bridge:MovieClip;
public var l15:MovieClip;
public var l9:MovieClip;
public var l14:MovieClip;
public var l22:MovieClip;
public var l10:MovieClip;
public var l12:MovieClip;
public var l20:MovieClip;
public var l18:MovieClip;
public var l11:MovieClip;
public var l21:MovieClip;
public var l19:MovieClip;
public var l17:MovieClip;
}
}//package
Section 190
//VictoryMenuClip (VictoryMenuClip)
package {
import flash.display.*;
import flash.text.*;
public dynamic class VictoryMenuClip extends MovieClip {
public var nextButton:MovieClip;
public var success:TextField;
public var tabButton:MovieClip;
public var time:TextField;
public var parts:TextField;
}
}//package
Section 191
//VictorySound (VictorySound)
package {
import flash.media.*;
public dynamic class VictorySound extends Sound {
}
}//package
Section 192
//WhiteClip (WhiteClip)
package {
import flash.display.*;
public dynamic class WhiteClip extends MovieClip {
}
}//package
Section 193
//WindowBackgroundClip (WindowBackgroundClip)
package {
import flash.display.*;
public dynamic class WindowBackgroundClip extends MovieClip {
}
}//package
Section 194
//WindowBorderClip (WindowBorderClip)
package {
import flash.display.*;
public dynamic class WindowBorderClip extends MovieClip {
}
}//package
Section 195
//WireMenuClip (WireMenuClip)
package {
import flash.display.*;
import flash.text.*;
public dynamic class WireMenuClip extends MovieClip {
public var tabButton:MovieClip;
public var wireText:TextField;
}
}//package
Section 196
//YellowClip (YellowClip)
package {
import flash.display.*;
public dynamic class YellowClip extends MovieClip {
}
}//package