initial commit, kind of working.

This commit is contained in:
2026-10-10 15:50:17 -06:00
commit 4db96b0bae
1041 changed files with 51423 additions and 0 deletions
@@ -0,0 +1,75 @@
package org.flixel.system.debug
{
import flash.geom.Rectangle;
import flash.text.TextField;
import flash.text.TextFormat;
import org.flixel.system.FlxWindow;
public class Log extends FlxWindow
{
protected static const MAX_LOG_LINES:uint = 200;
protected var _text:TextField;
protected var _lines:Array;
public function Log(param1:String, param2:Number, param3:Number, param4:Boolean = true, param5:Rectangle = null, param6:uint = 2139062143, param7:uint = 2130706432)
{
super(param1,param2,param3,param4,param5,param6,param7);
this._text = new TextField();
this._text.x = 2;
this._text.y = 15;
this._text.multiline = true;
this._text.wordWrap = true;
this._text.selectable = true;
this._text.defaultTextFormat = new TextFormat("Courier",12,16777215);
addChild(this._text);
this._lines = new Array();
}
override public function destroy() : void
{
removeChild(this._text);
this._text = null;
this._lines = null;
super.destroy();
}
public function add(param1:String) : void
{
var _loc2_:String = null;
var _loc3_:uint = 0;
if(this._lines.length <= 0)
{
this._text.text = "";
}
this._lines.push(param1);
if(this._lines.length > MAX_LOG_LINES)
{
this._lines.shift();
_loc2_ = "";
_loc3_ = 0;
while(_loc3_ < this._lines.length)
{
_loc2_ += this._lines[_loc3_] + "\n";
_loc3_++;
}
this._text.text = _loc2_;
}
else
{
this._text.appendText(param1 + "\n");
}
this._text.scrollV = this._text.height;
}
override protected function updateSize() : void
{
super.updateSize();
this._text.width = _width - 10;
this._text.height = _height - 15;
}
}
}
@@ -0,0 +1,176 @@
package org.flixel.system.debug
{
import flash.geom.Rectangle;
import flash.system.System;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.utils.getTimer;
import org.flixel.FlxG;
import org.flixel.system.FlxWindow;
public class Perf extends FlxWindow
{
protected var _text:TextField;
protected var _lastTime:int;
protected var _updateTimer:int;
protected var _flixelUpdate:Array;
protected var _flixelUpdateMarker:uint;
protected var _flixelDraw:Array;
protected var _flixelDrawMarker:uint;
protected var _flash:Array;
protected var _flashMarker:uint;
protected var _activeObject:Array;
protected var _objectMarker:uint;
protected var _visibleObject:Array;
protected var _visibleObjectMarker:uint;
public function Perf(param1:String, param2:Number, param3:Number, param4:Boolean = true, param5:Rectangle = null, param6:uint = 2139062143, param7:uint = 2130706432)
{
super(param1,param2,param3,param4,param5,param6,param7);
resize(90,66);
this._lastTime = 0;
this._updateTimer = 0;
this._text = new TextField();
this._text.width = _width;
this._text.x = 2;
this._text.y = 15;
this._text.multiline = true;
this._text.wordWrap = true;
this._text.selectable = true;
this._text.defaultTextFormat = new TextFormat("Courier",12,16777215);
addChild(this._text);
this._flixelUpdate = new Array(32);
this._flixelUpdateMarker = 0;
this._flixelDraw = new Array(32);
this._flixelDrawMarker = 0;
this._flash = new Array(32);
this._flashMarker = 0;
this._activeObject = new Array(32);
this._objectMarker = 0;
this._visibleObject = new Array(32);
this._visibleObjectMarker = 0;
}
override public function destroy() : void
{
removeChild(this._text);
this._text = null;
this._flixelUpdate = null;
this._flixelDraw = null;
this._flash = null;
this._activeObject = null;
this._visibleObject = null;
super.destroy();
}
public function update() : void
{
var _loc4_:uint = 0;
var _loc5_:String = null;
var _loc6_:Number = NaN;
var _loc7_:uint = 0;
var _loc8_:uint = 0;
var _loc9_:uint = 0;
var _loc10_:uint = 0;
var _loc11_:uint = 0;
var _loc1_:int = getTimer();
var _loc2_:int = _loc1_ - this._lastTime;
var _loc3_:uint = 500;
if(_loc2_ > _loc3_)
{
_loc2_ = int(_loc3_);
}
this._lastTime = _loc1_;
this._updateTimer += _loc2_;
if(this._updateTimer > _loc3_)
{
_loc5_ = "";
_loc6_ = 0;
_loc4_ = 0;
while(_loc4_ < this._flashMarker)
{
_loc6_ += this._flash[_loc4_++];
}
_loc6_ /= this._flashMarker;
_loc5_ += uint(1 / (_loc6_ / 1000)) + "/" + FlxG.flashFramerate + "fps\n";
_loc5_ = _loc5_ + (Number((System.totalMemory * 9.54e-7).toFixed(2)) + "MB\n");
_loc7_ = 0;
_loc4_ = 0;
while(_loc4_ < this._flixelUpdateMarker)
{
_loc7_ += this._flixelUpdate[_loc4_++];
}
_loc8_ = 0;
_loc9_ = 0;
_loc4_ = 0;
while(_loc4_ < this._objectMarker)
{
_loc8_ += this._activeObject[_loc4_];
_loc11_ += this._visibleObject[_loc4_++];
}
_loc8_ /= this._objectMarker;
_loc5_ += "U:" + _loc8_ + " " + uint(_loc7_ / this._flixelDrawMarker) + "ms\n";
_loc10_ = 0;
_loc4_ = 0;
while(_loc4_ < this._flixelDrawMarker)
{
_loc10_ += this._flixelDraw[_loc4_++];
}
_loc11_ = 0;
_loc4_ = 0;
while(_loc4_ < this._visibleObjectMarker)
{
_loc11_ += this._visibleObject[_loc4_++];
}
_loc11_ /= this._visibleObjectMarker;
_loc5_ += "D:" + _loc11_ + " " + uint(_loc10_ / this._flixelDrawMarker) + "ms";
this._text.text = _loc5_;
this._flixelUpdateMarker = 0;
this._flixelDrawMarker = 0;
this._flashMarker = 0;
this._objectMarker = 0;
this._visibleObjectMarker = 0;
this._updateTimer -= _loc3_;
}
}
public function flixelUpdate(param1:int) : void
{
this._flixelUpdate[this._flixelUpdateMarker++] = param1;
}
public function flixelDraw(param1:int) : void
{
this._flixelDraw[this._flixelDrawMarker++] = param1;
}
public function flash(param1:int) : void
{
this._flash[this._flashMarker++] = param1;
}
public function activeObjects(param1:int) : void
{
this._activeObject[this._objectMarker++] = param1;
}
public function visibleObjects(param1:int) : void
{
this._visibleObject[this._visibleObjectMarker++] = param1;
}
}
}
@@ -0,0 +1,490 @@
package org.flixel.system.debug
{
import flash.display.Bitmap;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.events.MouseEvent;
import flash.net.FileFilter;
import flash.net.FileReference;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.utils.ByteArray;
import org.flixel.FlxG;
import org.flixel.FlxU;
public class VCR extends Sprite
{
protected static const FILE_TYPES:Array = [new FileFilter("Flixel Game Recording","*.fgr")];
protected static const DEFAULT_FILE_NAME:String = "replay.fgr";
protected var ImgOpen:Class = VCR_ImgOpen;
protected var ImgRecordOff:Class = VCR_ImgRecordOff;
protected var ImgRecordOn:Class = VCR_ImgRecordOn;
protected var ImgStop:Class = VCR_ImgStop;
protected var ImgFlixel:Class = VCR_ImgFlixel;
protected var ImgRestart:Class = VCR_ImgRestart;
protected var ImgPause:Class = VCR_ImgPause;
protected var ImgPlay:Class = VCR_ImgPlay;
protected var ImgStep:Class = VCR_ImgStep;
public var paused:Boolean;
public var stepRequested:Boolean;
protected var _open:Bitmap;
protected var _recordOff:Bitmap;
protected var _recordOn:Bitmap;
protected var _stop:Bitmap;
protected var _flixel:Bitmap;
protected var _restart:Bitmap;
protected var _pause:Bitmap;
protected var _play:Bitmap;
protected var _step:Bitmap;
protected var _overOpen:Boolean;
protected var _overRecord:Boolean;
protected var _overRestart:Boolean;
protected var _overPause:Boolean;
protected var _overStep:Boolean;
protected var _pressingOpen:Boolean;
protected var _pressingRecord:Boolean;
protected var _pressingRestart:Boolean;
protected var _pressingPause:Boolean;
protected var _pressingStep:Boolean;
protected var _file:FileReference;
protected var _runtimeDisplay:TextField;
protected var _runtime:uint;
public function VCR()
{
super();
var _loc1_:uint = 7;
this._open = new this.ImgOpen();
addChild(this._open);
this._recordOff = new this.ImgRecordOff();
this._recordOff.x = this._open.x + this._open.width + _loc1_;
addChild(this._recordOff);
this._recordOn = new this.ImgRecordOn();
this._recordOn.x = this._recordOff.x;
this._recordOn.visible = false;
addChild(this._recordOn);
this._stop = new this.ImgStop();
this._stop.x = this._recordOff.x;
this._stop.visible = false;
addChild(this._stop);
this._flixel = new this.ImgFlixel();
this._flixel.x = this._recordOff.x + this._recordOff.width + _loc1_;
addChild(this._flixel);
this._restart = new this.ImgRestart();
this._restart.x = this._flixel.x + this._flixel.width + _loc1_;
addChild(this._restart);
this._pause = new this.ImgPause();
this._pause.x = this._restart.x + this._restart.width + _loc1_;
addChild(this._pause);
this._play = new this.ImgPlay();
this._play.x = this._pause.x;
this._play.visible = false;
addChild(this._play);
this._step = new this.ImgStep();
this._step.x = this._pause.x + this._pause.width + _loc1_;
addChild(this._step);
this._runtimeDisplay = new TextField();
this._runtimeDisplay.width = width;
this._runtimeDisplay.x = width;
this._runtimeDisplay.y = -2;
this._runtimeDisplay.multiline = false;
this._runtimeDisplay.wordWrap = false;
this._runtimeDisplay.selectable = false;
this._runtimeDisplay.defaultTextFormat = new TextFormat("Courier",12,16777215,null,null,null,null,null,"center");
this._runtimeDisplay.visible = false;
addChild(this._runtimeDisplay);
this._runtime = 0;
this.stepRequested = false;
this._file = null;
this.unpress();
this.checkOver();
this.updateGUI();
addEventListener(Event.ENTER_FRAME,this.init);
}
public function destroy() : void
{
this._file = null;
removeChild(this._open);
this._open = null;
removeChild(this._recordOff);
this._recordOff = null;
removeChild(this._recordOn);
this._recordOn = null;
removeChild(this._stop);
this._stop = null;
removeChild(this._flixel);
this._flixel = null;
removeChild(this._restart);
this._restart = null;
removeChild(this._pause);
this._pause = null;
removeChild(this._play);
this._play = null;
removeChild(this._step);
this._step = null;
stage.removeEventListener(MouseEvent.MOUSE_MOVE,this.onMouseMove);
stage.removeEventListener(MouseEvent.MOUSE_DOWN,this.onMouseDown);
stage.removeEventListener(MouseEvent.MOUSE_UP,this.onMouseUp);
}
public function recording() : void
{
this._stop.visible = false;
this._recordOff.visible = false;
this._recordOn.visible = true;
}
public function stopped() : void
{
this._stop.visible = false;
this._recordOn.visible = false;
this._recordOff.visible = true;
}
public function playing() : void
{
this._recordOff.visible = false;
this._recordOn.visible = false;
this._stop.visible = true;
}
public function updateRuntime(param1:uint) : void
{
this._runtime += param1;
this._runtimeDisplay.text = FlxU.formatTime(this._runtime / 1000,true);
if(!this._runtimeDisplay.visible)
{
this._runtimeDisplay.visible = true;
}
}
public function onOpen() : void
{
this._file = new FileReference();
this._file.addEventListener(Event.SELECT,this.onOpenSelect);
this._file.addEventListener(Event.CANCEL,this.onOpenCancel);
this._file.browse(FILE_TYPES);
}
protected function onOpenSelect(param1:Event = null) : void
{
this._file.removeEventListener(Event.SELECT,this.onOpenSelect);
this._file.removeEventListener(Event.CANCEL,this.onOpenCancel);
this._file.addEventListener(Event.COMPLETE,this.onOpenComplete);
this._file.addEventListener(IOErrorEvent.IO_ERROR,this.onOpenError);
this._file.load();
}
protected function onOpenComplete(param1:Event = null) : void
{
this._file.removeEventListener(Event.COMPLETE,this.onOpenComplete);
this._file.removeEventListener(IOErrorEvent.IO_ERROR,this.onOpenError);
var _loc2_:String = null;
var _loc3_:ByteArray = this._file.data;
if(_loc3_ != null)
{
_loc2_ = _loc3_.readUTFBytes(_loc3_.bytesAvailable);
}
this._file = null;
if(_loc2_ == null || _loc2_.length <= 0)
{
return FlxG.log("ERROR: Empty flixel gameplay record.");
}
FlxG.loadReplay(_loc2_);
}
protected function onOpenCancel(param1:Event = null) : void
{
this._file.removeEventListener(Event.SELECT,this.onOpenSelect);
this._file.removeEventListener(Event.CANCEL,this.onOpenCancel);
this._file = null;
}
protected function onOpenError(param1:Event = null) : void
{
this._file.removeEventListener(Event.COMPLETE,this.onOpenComplete);
this._file.removeEventListener(IOErrorEvent.IO_ERROR,this.onOpenError);
this._file = null;
FlxG.log("ERROR: Unable to open flixel gameplay record.");
}
public function onRecord(param1:Boolean = false) : void
{
if(this._play.visible)
{
this.onPlay();
}
FlxG.recordReplay(param1);
}
public function stopRecording() : void
{
var _loc1_:String = FlxG.stopRecording();
if(_loc1_ != null && _loc1_.length > 0)
{
this._file = new FileReference();
this._file.addEventListener(Event.COMPLETE,this.onSaveComplete);
this._file.addEventListener(Event.CANCEL,this.onSaveCancel);
this._file.addEventListener(IOErrorEvent.IO_ERROR,this.onSaveError);
this._file.save(_loc1_,DEFAULT_FILE_NAME);
}
}
protected function onSaveComplete(param1:Event = null) : void
{
this._file.removeEventListener(Event.COMPLETE,this.onSaveComplete);
this._file.removeEventListener(Event.CANCEL,this.onSaveCancel);
this._file.removeEventListener(IOErrorEvent.IO_ERROR,this.onSaveError);
this._file = null;
FlxG.log("FLIXEL: successfully saved flixel gameplay record.");
}
protected function onSaveCancel(param1:Event = null) : void
{
this._file.removeEventListener(Event.COMPLETE,this.onSaveComplete);
this._file.removeEventListener(Event.CANCEL,this.onSaveCancel);
this._file.removeEventListener(IOErrorEvent.IO_ERROR,this.onSaveError);
this._file = null;
}
protected function onSaveError(param1:Event = null) : void
{
this._file.removeEventListener(Event.COMPLETE,this.onSaveComplete);
this._file.removeEventListener(Event.CANCEL,this.onSaveCancel);
this._file.removeEventListener(IOErrorEvent.IO_ERROR,this.onSaveError);
this._file = null;
FlxG.log("ERROR: problem saving flixel gameplay record.");
}
public function onStop() : void
{
FlxG.stopReplay();
}
public function onRestart(param1:Boolean = false) : void
{
if(FlxG.reloadReplay(param1))
{
this._recordOff.visible = false;
this._recordOn.visible = false;
this._stop.visible = true;
}
}
public function onPause() : void
{
this.paused = true;
this._pause.visible = false;
this._play.visible = true;
}
public function onPlay() : void
{
this.paused = false;
this._play.visible = false;
this._pause.visible = true;
}
public function onStep() : void
{
if(!this.paused)
{
this.onPause();
}
this.stepRequested = true;
}
protected function init(param1:Event = null) : void
{
if(root == null)
{
return;
}
removeEventListener(Event.ENTER_FRAME,this.init);
stage.addEventListener(MouseEvent.MOUSE_MOVE,this.onMouseMove);
stage.addEventListener(MouseEvent.MOUSE_DOWN,this.onMouseDown);
stage.addEventListener(MouseEvent.MOUSE_UP,this.onMouseUp);
}
protected function onMouseMove(param1:MouseEvent = null) : void
{
if(!this.checkOver())
{
this.unpress();
}
this.updateGUI();
}
protected function onMouseDown(param1:MouseEvent = null) : void
{
this.unpress();
if(this._overOpen)
{
this._pressingOpen = true;
}
if(this._overRecord)
{
this._pressingRecord = true;
}
if(this._overRestart)
{
this._pressingRestart = true;
}
if(this._overPause)
{
this._pressingPause = true;
}
if(this._overStep)
{
this._pressingStep = true;
}
}
protected function onMouseUp(param1:MouseEvent = null) : void
{
if(this._overOpen && this._pressingOpen)
{
this.onOpen();
}
else if(this._overRecord && this._pressingRecord)
{
if(this._stop.visible)
{
this.onStop();
}
else if(this._recordOn.visible)
{
this.stopRecording();
}
else
{
this.onRecord(!param1.altKey);
}
}
else if(this._overRestart && this._pressingRestart)
{
this.onRestart(!param1.altKey);
}
else if(this._overPause && this._pressingPause)
{
if(this._play.visible)
{
this.onPlay();
}
else
{
this.onPause();
}
}
else if(this._overStep && this._pressingStep)
{
this.onStep();
}
this.unpress();
this.checkOver();
this.updateGUI();
}
protected function checkOver() : Boolean
{
return false;
}
protected function unpress() : void
{
this._pressingOpen = false;
this._pressingRecord = false;
this._pressingRestart = false;
this._pressingPause = false;
this._pressingStep = false;
}
protected function updateGUI() : void
{
if(this._recordOn.visible)
{
this._open.alpha = this._restart.alpha = this._pause.alpha = this._step.alpha = 0.35;
this._recordOn.alpha = 1;
return;
}
if(this._overOpen && this._open.alpha != 1)
{
this._open.alpha = 1;
}
else if(!this._overOpen && this._open.alpha != 0.8)
{
this._open.alpha = 0.8;
}
if(this._overRecord && this._recordOff.alpha != 1)
{
this._recordOff.alpha = this._recordOn.alpha = this._stop.alpha = 1;
}
else if(!this._overRecord && this._recordOff.alpha != 0.8)
{
this._recordOff.alpha = this._recordOn.alpha = this._stop.alpha = 0.8;
}
if(this._overRestart && this._restart.alpha != 1)
{
this._restart.alpha = 1;
}
else if(!this._overRestart && this._restart.alpha != 0.8)
{
this._restart.alpha = 0.8;
}
if(this._overPause && this._pause.alpha != 1)
{
this._pause.alpha = this._play.alpha = 1;
}
else if(!this._overPause && this._pause.alpha != 0.8)
{
this._pause.alpha = this._play.alpha = 0.8;
}
if(this._overStep && this._step.alpha != 1)
{
this._step.alpha = 1;
}
else if(!this._overStep && this._step.alpha != 0.8)
{
this._step.alpha = 0.8;
}
}
}
}
@@ -0,0 +1,15 @@
package org.flixel.system.debug
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/108_org.flixel.system.debug.VCR_ImgFlixel.png")]
public class VCR_ImgFlixel extends BitmapAsset
{
public function VCR_ImgFlixel()
{
super();
}
}
}
@@ -0,0 +1,15 @@
package org.flixel.system.debug
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/157_org.flixel.system.debug.VCR_ImgOpen.png")]
public class VCR_ImgOpen extends BitmapAsset
{
public function VCR_ImgOpen()
{
super();
}
}
}
@@ -0,0 +1,15 @@
package org.flixel.system.debug
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/251_org.flixel.system.debug.VCR_ImgPause.png")]
public class VCR_ImgPause extends BitmapAsset
{
public function VCR_ImgPause()
{
super();
}
}
}
@@ -0,0 +1,15 @@
package org.flixel.system.debug
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/86_org.flixel.system.debug.VCR_ImgPlay.png")]
public class VCR_ImgPlay extends BitmapAsset
{
public function VCR_ImgPlay()
{
super();
}
}
}
@@ -0,0 +1,15 @@
package org.flixel.system.debug
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/71_org.flixel.system.debug.VCR_ImgRecordOff.png")]
public class VCR_ImgRecordOff extends BitmapAsset
{
public function VCR_ImgRecordOff()
{
super();
}
}
}
@@ -0,0 +1,15 @@
package org.flixel.system.debug
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/286_org.flixel.system.debug.VCR_ImgRecordOn.png")]
public class VCR_ImgRecordOn extends BitmapAsset
{
public function VCR_ImgRecordOn()
{
super();
}
}
}
@@ -0,0 +1,15 @@
package org.flixel.system.debug
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/301_org.flixel.system.debug.VCR_ImgRestart.png")]
public class VCR_ImgRestart extends BitmapAsset
{
public function VCR_ImgRestart()
{
super();
}
}
}
@@ -0,0 +1,15 @@
package org.flixel.system.debug
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/113_org.flixel.system.debug.VCR_ImgStep.png")]
public class VCR_ImgStep extends BitmapAsset
{
public function VCR_ImgStep()
{
super();
}
}
}
@@ -0,0 +1,15 @@
package org.flixel.system.debug
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/272_org.flixel.system.debug.VCR_ImgStop.png")]
public class VCR_ImgStop extends BitmapAsset
{
public function VCR_ImgStop()
{
super();
}
}
}
@@ -0,0 +1,129 @@
package org.flixel.system.debug
{
import flash.display.Bitmap;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import org.flixel.FlxG;
public class Vis extends Sprite
{
protected var ImgBounds:Class = Vis_ImgBounds;
protected var _bounds:Bitmap;
protected var _overBounds:Boolean;
protected var _pressingBounds:Boolean;
public function Vis()
{
super();
var _loc1_:uint = 7;
this._bounds = new this.ImgBounds();
addChild(this._bounds);
this.unpress();
this.checkOver();
this.updateGUI();
addEventListener(Event.ENTER_FRAME,this.init);
}
public function destroy() : void
{
removeChild(this._bounds);
this._bounds = null;
stage.removeEventListener(MouseEvent.MOUSE_MOVE,this.onMouseMove);
stage.removeEventListener(MouseEvent.MOUSE_DOWN,this.onMouseDown);
stage.removeEventListener(MouseEvent.MOUSE_UP,this.onMouseUp);
}
public function onBounds() : void
{
}
protected function init(param1:Event = null) : void
{
if(root == null)
{
return;
}
removeEventListener(Event.ENTER_FRAME,this.init);
stage.addEventListener(MouseEvent.MOUSE_MOVE,this.onMouseMove);
stage.addEventListener(MouseEvent.MOUSE_DOWN,this.onMouseDown);
stage.addEventListener(MouseEvent.MOUSE_UP,this.onMouseUp);
}
protected function onMouseMove(param1:MouseEvent = null) : void
{
if(!this.checkOver())
{
this.unpress();
}
this.updateGUI();
}
protected function onMouseDown(param1:MouseEvent = null) : void
{
this.unpress();
if(this._overBounds)
{
this._pressingBounds = true;
}
}
protected function onMouseUp(param1:MouseEvent = null) : void
{
if(this._overBounds && this._pressingBounds)
{
this.onBounds();
}
this.unpress();
this.checkOver();
this.updateGUI();
}
protected function checkOver() : Boolean
{
this._overBounds = false;
if(mouseX < 0 || mouseX > width || mouseY < 0 || mouseY > height)
{
return false;
}
if(mouseX > this._bounds.x || mouseX < this._bounds.x + this._bounds.width)
{
this._overBounds = true;
}
return true;
}
protected function unpress() : void
{
this._pressingBounds = false;
}
protected function updateGUI() : void
{
if(FlxG.visualDebug)
{
if(this._overBounds && this._bounds.alpha != 1)
{
this._bounds.alpha = 1;
}
else if(!this._overBounds && this._bounds.alpha != 0.9)
{
this._bounds.alpha = 0.9;
}
}
else if(this._overBounds && this._bounds.alpha != 0.6)
{
this._bounds.alpha = 0.6;
}
else if(!this._overBounds && this._bounds.alpha != 0.5)
{
this._bounds.alpha = 0.5;
}
}
}
}
@@ -0,0 +1,15 @@
package org.flixel.system.debug
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/222_org.flixel.system.debug.Vis_ImgBounds.png")]
public class Vis_ImgBounds extends BitmapAsset
{
public function Vis_ImgBounds()
{
super();
}
}
}
@@ -0,0 +1,162 @@
package org.flixel.system.debug
{
import flash.display.Sprite;
import flash.geom.Rectangle;
import org.flixel.system.FlxWindow;
public class Watch extends FlxWindow
{
protected static const MAX_LOG_LINES:uint = 1024;
protected static const LINE_HEIGHT:uint = 15;
public var editing:Boolean;
protected var _names:Sprite;
protected var _values:Sprite;
protected var _watching:Array;
public function Watch(param1:String, param2:Number, param3:Number, param4:Boolean = true, param5:Rectangle = null, param6:uint = 2139062143, param7:uint = 2130706432)
{
super(param1,param2,param3,param4,param5,param6,param7);
this._names = new Sprite();
this._names.x = 2;
this._names.y = 15;
addChild(this._names);
this._values = new Sprite();
this._values.x = 2;
this._values.y = 15;
addChild(this._values);
this._watching = new Array();
this.editing = false;
this.removeAll();
}
override public function destroy() : void
{
removeChild(this._names);
this._names = null;
removeChild(this._values);
this._values = null;
var _loc1_:* = 0;
var _loc2_:uint = this._watching.length;
while(_loc1_ < _loc2_)
{
(this._watching[_loc1_++] as WatchEntry).destroy();
}
this._watching = null;
super.destroy();
}
public function add(param1:Object, param2:String, param3:String = null) : void
{
var _loc4_:WatchEntry = null;
var _loc5_:* = 0;
var _loc6_:uint = this._watching.length;
while(_loc5_ < _loc6_)
{
_loc4_ = this._watching[_loc5_++] as WatchEntry;
if(_loc4_.object == param1 && _loc4_.field == param2)
{
return;
}
}
_loc4_ = new WatchEntry(this._watching.length * LINE_HEIGHT,_width / 2,_width / 2 - 10,param1,param2,param3);
this._names.addChild(_loc4_.nameDisplay);
this._values.addChild(_loc4_.valueDisplay);
this._watching.push(_loc4_);
}
public function remove(param1:Object, param2:String = null) : void
{
var _loc3_:WatchEntry = null;
var _loc4_:* = int(this._watching.length - 1);
while(_loc4_ >= 0)
{
_loc3_ = this._watching[_loc4_];
if(_loc3_.object == param1 && (param2 == null || _loc3_.field == param2))
{
this._watching.splice(_loc4_,1);
this._names.removeChild(_loc3_.nameDisplay);
this._values.removeChild(_loc3_.valueDisplay);
_loc3_.destroy();
}
_loc4_--;
}
_loc3_ = null;
_loc4_ = 0;
var _loc5_:uint = this._watching.length;
while(_loc4_ < _loc5_)
{
(this._watching[_loc4_] as WatchEntry).setY(_loc4_ * LINE_HEIGHT);
_loc4_++;
}
}
public function removeAll() : void
{
var _loc1_:WatchEntry = null;
var _loc2_:int = 0;
var _loc3_:uint = this._watching.length;
while(_loc2_ < _loc3_)
{
_loc1_ = this._watching.pop();
this._names.removeChild(_loc1_.nameDisplay);
this._values.removeChild(_loc1_.valueDisplay);
_loc1_.destroy();
_loc2_++;
}
this._watching.length = 0;
}
public function update() : void
{
this.editing = false;
var _loc1_:uint = 0;
var _loc2_:uint = this._watching.length;
while(_loc1_ < _loc2_)
{
if(!(this._watching[_loc1_++] as WatchEntry).updateValue())
{
this.editing = true;
}
}
}
public function submit() : void
{
var _loc3_:WatchEntry = null;
var _loc1_:uint = 0;
var _loc2_:uint = this._watching.length;
while(_loc1_ < _loc2_)
{
_loc3_ = this._watching[_loc1_++] as WatchEntry;
if(_loc3_.editing)
{
_loc3_.submit();
}
}
this.editing = false;
}
override protected function updateSize() : void
{
if(_height < this._watching.length * LINE_HEIGHT + 17)
{
_height = this._watching.length * LINE_HEIGHT + 17;
}
super.updateSize();
this._values.x = _width / 2 + 2;
var _loc1_:* = 0;
var _loc2_:uint = this._watching.length;
while(_loc1_ < _loc2_)
{
(this._watching[_loc1_++] as WatchEntry).updateWidth(_width / 2,_width / 2 - 10);
}
}
}
}
@@ -0,0 +1,152 @@
package org.flixel.system.debug
{
import flash.events.KeyboardEvent;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.text.TextFieldType;
import flash.text.TextFormat;
import org.flixel.FlxU;
public class WatchEntry
{
public var object:Object;
public var field:String;
public var custom:String;
public var nameDisplay:TextField;
public var valueDisplay:TextField;
public var editing:Boolean;
public var oldValue:Object;
protected var _whiteText:TextFormat;
protected var _blackText:TextFormat;
public function WatchEntry(param1:Number, param2:Number, param3:Number, param4:Object, param5:String, param6:String = null)
{
super();
this.editing = false;
this.object = param4;
this.field = param5;
this.custom = param6;
this._whiteText = new TextFormat("Courier",12,16777215);
this._blackText = new TextFormat("Courier",12,0);
this.nameDisplay = new TextField();
this.nameDisplay.y = param1;
this.nameDisplay.multiline = false;
this.nameDisplay.selectable = true;
this.nameDisplay.defaultTextFormat = this._whiteText;
this.valueDisplay = new TextField();
this.valueDisplay.y = param1;
this.valueDisplay.height = 15;
this.valueDisplay.multiline = false;
this.valueDisplay.selectable = true;
this.valueDisplay.doubleClickEnabled = true;
this.valueDisplay.addEventListener(KeyboardEvent.KEY_UP,this.onKeyUp);
this.valueDisplay.addEventListener(MouseEvent.MOUSE_UP,this.onMouseUp);
this.valueDisplay.background = false;
this.valueDisplay.backgroundColor = 16777215;
this.valueDisplay.defaultTextFormat = this._whiteText;
this.updateWidth(param2,param3);
}
public function destroy() : void
{
this.object = null;
this.oldValue = null;
this.nameDisplay = null;
this.field = null;
this.custom = null;
this.valueDisplay.removeEventListener(MouseEvent.MOUSE_UP,this.onMouseUp);
this.valueDisplay.removeEventListener(KeyboardEvent.KEY_UP,this.onKeyUp);
this.valueDisplay = null;
}
public function setY(param1:Number) : void
{
this.nameDisplay.y = param1;
this.valueDisplay.y = param1;
}
public function updateWidth(param1:Number, param2:Number) : void
{
this.nameDisplay.width = param1;
this.valueDisplay.width = param2;
if(this.custom != null)
{
this.nameDisplay.text = this.custom;
}
else
{
this.nameDisplay.text = "";
if(param1 > 120)
{
this.nameDisplay.appendText(FlxU.getClassName(this.object,param1 < 240) + ".");
}
this.nameDisplay.appendText(this.field);
}
}
public function updateValue() : Boolean
{
if(this.editing)
{
return false;
}
this.valueDisplay.text = this.object[this.field].toString();
return true;
}
public function onMouseUp(param1:MouseEvent) : void
{
this.editing = true;
this.oldValue = this.object[this.field];
this.valueDisplay.type = TextFieldType.INPUT;
this.valueDisplay.setTextFormat(this._blackText);
this.valueDisplay.background = true;
}
public function onKeyUp(param1:KeyboardEvent) : void
{
if(param1.keyCode == 13 || param1.keyCode == 9 || param1.keyCode == 27)
{
if(param1.keyCode == 27)
{
this.cancel();
}
else
{
this.submit();
}
}
}
public function cancel() : void
{
this.valueDisplay.text = this.oldValue.toString();
this.doneEditing();
}
public function submit() : void
{
this.object[this.field] = this.valueDisplay.text;
this.doneEditing();
}
protected function doneEditing() : void
{
this.valueDisplay.type = TextFieldType.DYNAMIC;
this.valueDisplay.setTextFormat(this._whiteText);
this.valueDisplay.defaultTextFormat = this._whiteText;
this.valueDisplay.background = false;
this.editing = false;
}
}
}