initial commit, kind of working.
This commit is contained in:
@@ -0,0 +1,129 @@
|
||||
package com.arc.flixel
|
||||
{
|
||||
import com.arc.dh.util.Sound;
|
||||
import com.arc.dh.util.SoundSystem;
|
||||
import org.flixel.FlxG;
|
||||
|
||||
public class ArcButton extends ArcSprite
|
||||
{
|
||||
|
||||
private var _state:String = "inactive";
|
||||
|
||||
private var _group:ArcButtonGroup;
|
||||
|
||||
private var _selectable:Boolean = true;
|
||||
|
||||
private var _callbackFunction:Function;
|
||||
|
||||
private var _updateFunction:Function;
|
||||
|
||||
private var _hoverable:Boolean = true;
|
||||
|
||||
public function ArcButton(param1:Number, param2:Number, param3:int, param4:int, param5:Class)
|
||||
{
|
||||
super(param1,param2);
|
||||
loadGraphic(param5,true,false,param3,param4);
|
||||
addAnimation("inactive",[0],0,false);
|
||||
addAnimation("hover",[1],0,false);
|
||||
addAnimation("selected",[2],0,false);
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
if(this._state != ButtonState.SELECTED)
|
||||
{
|
||||
if(hover() && exists && alive && visible)
|
||||
{
|
||||
if(FlxG.mouse.justPressed())
|
||||
{
|
||||
this.select(true,true);
|
||||
}
|
||||
else if(this._hoverable)
|
||||
{
|
||||
if(this._state != ButtonState.HOVER)
|
||||
{
|
||||
SoundSystem.play(Sound.MENU_SELECT);
|
||||
}
|
||||
this._state = ButtonState.HOVER;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this._state = ButtonState.INACTIVE;
|
||||
}
|
||||
}
|
||||
play(this._state);
|
||||
if(this._updateFunction != null)
|
||||
{
|
||||
this._updateFunction();
|
||||
}
|
||||
super.update();
|
||||
}
|
||||
|
||||
public function hoverable(param1:Boolean) : ArcButton
|
||||
{
|
||||
this._hoverable = param1;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function select(param1:Boolean = true, param2:Boolean = false) : ArcButton
|
||||
{
|
||||
if(!param1)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
if(this._group != null && this._selectable)
|
||||
{
|
||||
this._group.unselect();
|
||||
}
|
||||
if(this._callbackFunction != null && param2)
|
||||
{
|
||||
this._callbackFunction();
|
||||
}
|
||||
if(this._selectable)
|
||||
{
|
||||
this._state = ButtonState.SELECTED;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public function unselect() : void
|
||||
{
|
||||
this._state = ButtonState.INACTIVE;
|
||||
}
|
||||
|
||||
public function setGroup(param1:ArcButtonGroup, param2:Boolean = false) : ArcButton
|
||||
{
|
||||
this._group = param1;
|
||||
if(param2)
|
||||
{
|
||||
param1.addButton(this);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public function selectable(param1:Boolean) : ArcButton
|
||||
{
|
||||
this._selectable = param1;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function callback(param1:Function) : ArcButton
|
||||
{
|
||||
this._callbackFunction = param1;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function setUpdate(param1:Function) : ArcButton
|
||||
{
|
||||
this._updateFunction = param1;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function get selected() : Boolean
|
||||
{
|
||||
return this._state == ButtonState.SELECTED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.arc.flixel
|
||||
{
|
||||
import org.flixel.FlxPoint;
|
||||
|
||||
public class ArcButtonGroup extends ArcGroup
|
||||
{
|
||||
|
||||
public function ArcButtonGroup()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function addButton(param1:ArcButton) : void
|
||||
{
|
||||
param1.setGroup(this);
|
||||
this.add(param1);
|
||||
param1.scrollFactor = new FlxPoint(0,0);
|
||||
}
|
||||
|
||||
public function unselect() : void
|
||||
{
|
||||
var _loc1_:ArcButton = null;
|
||||
for each(_loc1_ in this.members)
|
||||
{
|
||||
_loc1_.unselect();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.arc.flixel
|
||||
{
|
||||
import org.flixel.FlxG;
|
||||
|
||||
public class ArcEmitter extends ArcSprite
|
||||
{
|
||||
|
||||
public static var interval:Number = 0.05;
|
||||
|
||||
private var key:Object = 0;
|
||||
|
||||
private var num:int = 0;
|
||||
|
||||
private var dur:int = 0;
|
||||
|
||||
private var timer:Number = interval;
|
||||
|
||||
private var minX:Number = -100;
|
||||
|
||||
private var maxX:Number = 100;
|
||||
|
||||
private var minY:Number = -100;
|
||||
|
||||
private var maxY:Number = 100;
|
||||
|
||||
private var grav:Number;
|
||||
|
||||
private var lifetime:Number;
|
||||
|
||||
public function ArcEmitter(param1:Object, param2:int, param3:int, param4:int, param5:int, param6:Number, param7:Number, param8:Number, param9:Number, param10:Number, param11:Number, param12:int = 0, param13:int = 0)
|
||||
{
|
||||
super();
|
||||
this.key = param1;
|
||||
this.x = param2;
|
||||
this.y = param3;
|
||||
this.num = param4;
|
||||
this.dur = param5;
|
||||
this.grav = param7;
|
||||
this.lifetime = param6;
|
||||
this.visible = false;
|
||||
this.minX = param8;
|
||||
this.maxX = param9;
|
||||
this.minY = param10;
|
||||
this.maxY = param11;
|
||||
this.width = param12;
|
||||
this.height = param13;
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
this.timer += FlxG.elapsed;
|
||||
while(this.timer > interval)
|
||||
{
|
||||
this.timer -= interval;
|
||||
--this.dur;
|
||||
ArcParticleSystem.emitterMap[this.key].setXSpeed(this.minX,this.maxX);
|
||||
ArcParticleSystem.emitterMap[this.key].setYSpeed(this.minY,this.maxY);
|
||||
ArcParticleSystem.emitterMap[this.key].gravity = this.grav;
|
||||
ArcParticleSystem.emitterMap[this.key].setSize(width,height);
|
||||
ArcParticleSystem.emitParticles(x,y,this.num,this.key,this.lifetime);
|
||||
}
|
||||
if(this.dur <= 0)
|
||||
{
|
||||
this.kill();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.arc.flixel
|
||||
{
|
||||
public class ArcEmitterGroup extends ArcGroup
|
||||
{
|
||||
|
||||
public function ArcEmitterGroup(param1:Number = 0, param2:Number = 0)
|
||||
{
|
||||
super();
|
||||
x = param1;
|
||||
y = param2;
|
||||
}
|
||||
|
||||
override public function destroy() : void
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.arc.flixel
|
||||
{
|
||||
import org.flixel.FlxBasic;
|
||||
import org.flixel.FlxBitmapText;
|
||||
import org.flixel.FlxGroup;
|
||||
import org.flixel.FlxObject;
|
||||
|
||||
public class ArcGroup extends FlxGroup
|
||||
{
|
||||
|
||||
protected var _alpha:Number = 1;
|
||||
|
||||
protected var x:Number = 0;
|
||||
|
||||
protected var y:Number = 0;
|
||||
|
||||
public function ArcGroup(param1:Number = 0, param2:Number = 0)
|
||||
{
|
||||
super();
|
||||
this.x = param1;
|
||||
this.y = param2;
|
||||
}
|
||||
|
||||
public static function shift(param1:FlxBasic, param2:Number, param3:Number) : void
|
||||
{
|
||||
var _loc4_:FlxBasic = null;
|
||||
if(param1 is FlxObject)
|
||||
{
|
||||
param1["x"] += param2;
|
||||
param1["y"] += param3;
|
||||
}
|
||||
else if(param1 is FlxGroup)
|
||||
{
|
||||
for each(_loc4_ in (param1 as FlxGroup).members)
|
||||
{
|
||||
shift(_loc4_,param2,param3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function set alpha(param1:Number) : void
|
||||
{
|
||||
var _loc2_:FlxBasic = null;
|
||||
this._alpha = param1;
|
||||
for each(_loc2_ in members)
|
||||
{
|
||||
if(_loc2_ is ArcGroup)
|
||||
{
|
||||
(_loc2_ as ArcGroup).alpha = param1;
|
||||
}
|
||||
else if(_loc2_ is ArcSprite)
|
||||
{
|
||||
(_loc2_ as ArcSprite).alpha = param1;
|
||||
}
|
||||
else if(_loc2_ is FlxBitmapText)
|
||||
{
|
||||
(_loc2_ as FlxBitmapText).alpha = param1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function get alpha() : Number
|
||||
{
|
||||
return this._alpha;
|
||||
}
|
||||
|
||||
override public function add(param1:FlxBasic) : FlxBasic
|
||||
{
|
||||
shift(param1,this.x,this.y);
|
||||
return super.add(param1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.arc.flixel
|
||||
{
|
||||
import org.flixel.FlxEmitter;
|
||||
|
||||
public class ArcParticleSystem
|
||||
{
|
||||
|
||||
public static var emitterMap:Object = new Object();
|
||||
|
||||
public static var emitterGroup:ArcEmitterGroup = new ArcEmitterGroup();
|
||||
|
||||
public function ArcParticleSystem()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function registerEmitter(param1:Object, param2:Class, param3:int = 100, param4:Boolean = false) : void
|
||||
{
|
||||
if(emitterMap[param1] != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var _loc5_:FlxEmitter = new FlxEmitter();
|
||||
_loc5_.makeParticles(param2,param3,0,param4);
|
||||
_loc5_.setRotation();
|
||||
emitterMap[param1] = _loc5_;
|
||||
emitterGroup.add(_loc5_);
|
||||
}
|
||||
|
||||
public static function emit(param1:ArcGroup, param2:Object, param3:int, param4:int, param5:int, param6:int, param7:Number = 1, param8:Number = 400, param9:Number = -100, param10:Number = 100, param11:Number = -100, param12:Number = 100, param13:int = 0, param14:int = 0) : void
|
||||
{
|
||||
var _loc15_:ArcEmitter = new ArcEmitter(param2,param3,param4,param5,param6,param7,param8,param9,param10,param11,param12,param13,param14);
|
||||
param1.add(_loc15_);
|
||||
}
|
||||
|
||||
public static function get emitters() : ArcGroup
|
||||
{
|
||||
return emitterGroup;
|
||||
}
|
||||
|
||||
public static function emitParticles(param1:int, param2:int, param3:int, param4:Object, param5:Number) : void
|
||||
{
|
||||
emitterMap[param4].x = param1;
|
||||
emitterMap[param4].y = param2;
|
||||
emitterMap[param4].lifespan = param5;
|
||||
while(param3-- > 0)
|
||||
{
|
||||
emitterMap[param4].emitParticle();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.arc.flixel
|
||||
{
|
||||
import org.flixel.FlxG;
|
||||
import org.flixel.FlxRect;
|
||||
|
||||
public class ArcRect extends FlxRect
|
||||
{
|
||||
|
||||
public function ArcRect(param1:Number = 0, param2:Number = 0, param3:Number = 0, param4:Number = 0)
|
||||
{
|
||||
super(param1,param2,param3,param4);
|
||||
}
|
||||
|
||||
public function hover() : Boolean
|
||||
{
|
||||
var _loc1_:int = FlxG.mouse.screenX;
|
||||
var _loc2_:int = FlxG.mouse.screenY;
|
||||
return _loc1_ > left && _loc1_ < right && (_loc2_ > top && _loc2_ < bottom);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.arc.flixel
|
||||
{
|
||||
import flash.geom.Rectangle;
|
||||
import org.flixel.FlxG;
|
||||
import org.flixel.FlxPoint;
|
||||
import org.flixel.FlxSprite;
|
||||
|
||||
public class ArcSprite extends FlxSprite
|
||||
{
|
||||
|
||||
protected var _colorRed:Number = 1;
|
||||
|
||||
protected var _colorGreen:Number = 1;
|
||||
|
||||
protected var _colorBlue:Number = 1;
|
||||
|
||||
protected var _deathTimer:Number = 0;
|
||||
|
||||
public function ArcSprite(param1:Number = 0, param2:Number = 0, param3:Class = null)
|
||||
{
|
||||
super(param1,param2,param3);
|
||||
}
|
||||
|
||||
public function hover() : Boolean
|
||||
{
|
||||
var _loc1_:FlxPoint = getScreenXY();
|
||||
return new ArcRect(_loc1_.x,_loc1_.y,width,height).hover();
|
||||
}
|
||||
|
||||
public function offScreen() : Boolean
|
||||
{
|
||||
var _loc1_:FlxPoint = getScreenXY();
|
||||
return _loc1_.x < -width || _loc1_.x > FlxG.width || _loc1_.y < -height || _loc1_.y > FlxG.height;
|
||||
}
|
||||
|
||||
public function get sourceRect() : Rectangle
|
||||
{
|
||||
return _flashRect;
|
||||
}
|
||||
|
||||
public function set sourceRect(param1:Rectangle) : void
|
||||
{
|
||||
_flashRect = param1;
|
||||
}
|
||||
|
||||
public function mark(param1:Number) : void
|
||||
{
|
||||
this._deathTimer = param1;
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
if(this._deathTimer > 0)
|
||||
{
|
||||
this._deathTimer -= FlxG.elapsed;
|
||||
if(this._deathTimer <= 0)
|
||||
{
|
||||
kill();
|
||||
}
|
||||
}
|
||||
super.update();
|
||||
}
|
||||
|
||||
public function get animation() : String
|
||||
{
|
||||
return _curAnim.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.arc.flixel
|
||||
{
|
||||
import flash.external.ExternalInterface;
|
||||
import flash.net.URLRequest;
|
||||
import flash.net.navigateToURL;
|
||||
import org.flixel.FlxG;
|
||||
|
||||
public final class ArcU
|
||||
{
|
||||
|
||||
public function ArcU()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function rand(param1:int, param2:int) : int
|
||||
{
|
||||
return Math.floor(Math.random() * (param2 - param1 + 1)) + param1;
|
||||
}
|
||||
|
||||
public static function abs(param1:Number) : Number
|
||||
{
|
||||
if(param1 < 0)
|
||||
{
|
||||
param1 = -param1;
|
||||
}
|
||||
return param1;
|
||||
}
|
||||
|
||||
public static function clamp(param1:Number, param2:Number, param3:Number) : Number
|
||||
{
|
||||
if(param1 > param3)
|
||||
{
|
||||
return param3;
|
||||
}
|
||||
if(param1 < param2)
|
||||
{
|
||||
return param2;
|
||||
}
|
||||
return param1;
|
||||
}
|
||||
|
||||
public static function link(param1:String) : void
|
||||
{
|
||||
var url:String = param1;
|
||||
try
|
||||
{
|
||||
ExternalInterface.call("(function (){var f = document.createElement(\"form\");document.body.appendChild(f);f.style.display=\"none\";f.setAttribute(\"target\",\"_blank\");f.setAttribute(\"method\",\"GET\");f.setAttribute(\"action\",\"" + FlxG.root.loaderInfo.parameters.clickTag + "\");f.submit(); })()");
|
||||
}
|
||||
catch(err:Error)
|
||||
{
|
||||
navigateToURL(new URLRequest(url),"_blank");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.arc.flixel
|
||||
{
|
||||
public class ButtonState
|
||||
{
|
||||
|
||||
public static const INACTIVE:String = "inactive";
|
||||
|
||||
public static const HOVER:String = "hover";
|
||||
|
||||
public static const SELECTED:String = "selected";
|
||||
|
||||
public function ButtonState()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.arc.flixel
|
||||
{
|
||||
import flash.utils.getTimer;
|
||||
|
||||
public class Profiler
|
||||
{
|
||||
|
||||
private static const ENABLED:Boolean = false;
|
||||
|
||||
private var name:String;
|
||||
|
||||
private var time:Number = 0;
|
||||
|
||||
public function Profiler(param1:String, param2:String = null)
|
||||
{
|
||||
super();
|
||||
this.name = "[" + param1 + "]";
|
||||
this.start(param2);
|
||||
}
|
||||
|
||||
public function start(param1:String = null) : void
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
param1 = "started";
|
||||
}
|
||||
if(ENABLED)
|
||||
{
|
||||
}
|
||||
this.time = getTimer();
|
||||
}
|
||||
|
||||
public function lap(param1:String = null) : void
|
||||
{
|
||||
this.end(param1);
|
||||
this.time = getTimer();
|
||||
}
|
||||
|
||||
public function end(param1:String = null) : int
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
param1 = "elapsed";
|
||||
}
|
||||
if(ENABLED)
|
||||
{
|
||||
}
|
||||
return getTimer() - this.time;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user