125 lines
4.2 KiB
ActionScript
125 lines
4.2 KiB
ActionScript
package com.arc.dh.menu
|
|
{
|
|
import com.arc.dh.util.Data;
|
|
import com.arc.dh.util.Fonts;
|
|
import com.arc.flixel.ArcGroup;
|
|
import com.arc.flixel.ArcSprite;
|
|
import org.flixel.FlxBitmapText;
|
|
import org.flixel.FlxPoint;
|
|
|
|
public class GunComponent extends ArcGroup
|
|
{
|
|
|
|
private static const sprite:Class = GunComponent_sprite;
|
|
|
|
private static const COSTS:Array = [25,40,75,125,200,300,450,700,1000,1500,-1];
|
|
|
|
private var _bg:ArcSprite;
|
|
|
|
private var _skill:String;
|
|
|
|
private var _barPower:GunComponentBar;
|
|
|
|
private var _barSpeed:GunComponentBar;
|
|
|
|
private var _barSpecial:GunComponentBar;
|
|
|
|
private var _barSpecial2:GunComponentBar;
|
|
|
|
private var _name:FlxBitmapText;
|
|
|
|
private var _frame:int = 0;
|
|
|
|
private var _obtained:Boolean;
|
|
|
|
private var _obtainedSkill:String;
|
|
|
|
public function GunComponent(param1:Number, param2:Number, param3:String, param4:String)
|
|
{
|
|
var _loc5_:String = null;
|
|
super(param1,param2);
|
|
this._skill = param3;
|
|
this._obtainedSkill = param4;
|
|
this._bg = new ArcSprite(-1,0);
|
|
this._bg.loadGraphic(sprite,true,false,97,90);
|
|
this.add(this._bg);
|
|
this._obtained = Data[param4] == 1;
|
|
this._bg.frame = this._frame = this._obtained ? 0 : 1;
|
|
switch(param3)
|
|
{
|
|
case "primegun":
|
|
_loc5_ = "Prime Gun";
|
|
break;
|
|
case "spreadergun":
|
|
_loc5_ = "Spreader Gun";
|
|
break;
|
|
case "missilegun":
|
|
_loc5_ = "Missile Gun";
|
|
break;
|
|
case "reboundgun":
|
|
_loc5_ = "Rebound Gun";
|
|
}
|
|
if(!this._obtained)
|
|
{
|
|
_loc5_ = "Unknown";
|
|
}
|
|
this._name = new FlxBitmapText(3,4,Fonts.font(this._obtained ? Fonts.BEVEL_BLUE : Fonts.BEVEL_GRAY),_loc5_.toUpperCase(),"center",89,true);
|
|
this.add(this._name);
|
|
this._barPower = new GunComponentBar(6,12,param3,0,"Main Gun",this._obtained);
|
|
this.add(this._barPower);
|
|
this._barSpeed = new GunComponentBar(6,29,param3,1,"Main Gun",this._obtained);
|
|
this.add(this._barSpeed);
|
|
this._barSpecial = new GunComponentBar(6,47,param3,2,"Main Gun",this._obtained);
|
|
this.add(this._barSpecial);
|
|
this._barSpecial2 = new GunComponentBar(6,65,param3,3,"Main Gun",this._obtained);
|
|
this.add(this._barSpecial2);
|
|
setAll("scrollFactor",new FlxPoint(0,0));
|
|
this.sync();
|
|
}
|
|
|
|
override public function update() : void
|
|
{
|
|
this._bg.frame = this._frame == 0 && this._bg.hover() ? 2 : uint(this._frame);
|
|
super.update();
|
|
}
|
|
|
|
public function sync() : void
|
|
{
|
|
var _loc2_:String = null;
|
|
var _loc1_:Boolean = Data[this._obtainedSkill] == 1;
|
|
if(_loc1_ != this._obtained)
|
|
{
|
|
this._obtained = _loc1_;
|
|
switch(this._skill)
|
|
{
|
|
case "primegun":
|
|
_loc2_ = "Prime Gun";
|
|
break;
|
|
case "spreadergun":
|
|
_loc2_ = "Spreader Gun";
|
|
break;
|
|
case "missilegun":
|
|
_loc2_ = "Missile Gun";
|
|
break;
|
|
case "reboundgun":
|
|
_loc2_ = "Rebound Gun";
|
|
}
|
|
this.remove(this._name);
|
|
this._name = new FlxBitmapText(3,4,Fonts.font(Fonts.BEVEL_BLUE),_loc2_.toUpperCase(),"center",89,true);
|
|
this._name.scrollFactor = new FlxPoint(0,0);
|
|
this.add(this._name);
|
|
this._bg.frame = this._frame = 0;
|
|
this._barPower.motherfuckingSync();
|
|
this._barSpeed.motherfuckingSync();
|
|
this._barSpecial.motherfuckingSync();
|
|
this._barSpecial2.motherfuckingSync();
|
|
}
|
|
this._barPower.sync();
|
|
this._barSpeed.sync();
|
|
this._barSpecial.sync();
|
|
this._barSpecial2.sync();
|
|
}
|
|
}
|
|
}
|
|
|