Files

124 lines
4.4 KiB
ActionScript

package com.arc.dh.state
{
import com.arc.dh.util.Data;
import com.arc.dh.util.Fonts;
import com.arc.dh.util.SoundSystem;
import com.arc.flixel.ArcButton;
import com.arc.flixel.ArcButtonGroup;
import org.flixel.FlxBitmapText;
import org.flixel.FlxG;
public class BossScreen extends MenuScreen
{
private static const buttonBackSprite:Class = BossScreen_buttonBackSprite;
private static const buttonNormalSprite:Class = BossScreen_buttonNormalSprite;
private static const buttonHeroicSprite:Class = BossScreen_buttonHeroicSprite;
private static const buttonHeroicLockedSprite:Class = BossScreen_buttonHeroicLockedSprite;
private var _buttonBack:ArcButton;
private var _buttonNormal:ArcButton;
private var _buttonHeroic:ArcButton;
public var tooltip:BossModeTooltip;
public var hovering:Boolean = false;
public function BossScreen(param1:MainMenu)
{
var abg:ArcButtonGroup;
var i:int;
var heroicUnlocked:Boolean = false;
var bb:BossButton = null;
var M:MainMenu = param1;
super(M);
this.add(new InstructionWindow(0,100,FlxG.width,70));
this.add(new FlxBitmapText(10,104,Fonts.font(Fonts.OUTLINE_GRADIENT),"FACE OFF AGAINST ONE BOSS AFTER ANOTHER IN AN ATTEMPT TO TAKE DOWN THE PROFESSOR\'S MOST POWERFUL CONSTRUCTS. IF YOU MANAGE TO DEFEAT THEM ALL, YOU WILL EARN HEROIC BOSS RUSH, A CHANCE TO TAKE ON A MUCH STRONGER AND MORE ADVANCED VERSION OF EACH BOSS.","center",FlxG.width - 20));
this._buttonNormal = new ArcButton(85,141,87,26,buttonNormalSprite).callback(function():void
{
SoundSystem.fadeOutMusic();
FlxG.fade(4278190080,0.25,function():void
{
FlxG.mouse.hide();
FlxG.switchState(new BossMode(false));
});
}).selectable(false);
this.add(this._buttonNormal);
heroicUnlocked = Data.boss[0] > 0;
this._buttonHeroic = new ArcButton(185,141,87,26,heroicUnlocked ? buttonHeroicSprite : buttonHeroicLockedSprite).callback(function():void
{
SoundSystem.fadeOutMusic();
if(heroicUnlocked)
{
FlxG.fade(4278190080,0.25,function():void
{
FlxG.mouse.hide();
FlxG.switchState(new BossMode(true));
});
}
}).selectable(false);
this.add(this._buttonHeroic);
this._buttonBack = new ArcButton(135,213,87,26,buttonBackSprite).callback(function():void
{
menu.switchScreen(menu.mainScreen);
}).selectable(false);
this.add(this._buttonBack);
this.add(new InstructionWindow(0,180,FlxG.width,30));
this.add(new FlxBitmapText(9,183,Fonts.font(Fonts.OUTLINE_GRADIENT_S),"PRACTICE SINGLE BOSS:","left",150));
this.add(new FlxBitmapText(9,183,Fonts.font(Fonts.OUTLINE_BLACK_S),"SHIFT CLICK FOR HEROIC ONCE UNLOCKED","right",FlxG.width - 20));
abg = new ArcButtonGroup();
i = 0;
while(i < 7)
{
bb = new BossButton(8 + i * 50,191,i);
bb.setScreen(this);
this.add(bb);
i++;
}
}
override public function update() : void
{
var _loc2_:ArcButton = null;
super.update();
var _loc1_:Array = [this._buttonNormal,this._buttonHeroic];
for each(_loc2_ in _loc1_)
{
if(_loc2_.hover())
{
if(this.tooltip == null || this.tooltip.bsource != _loc2_)
{
this.tooltip = new BossModeTooltip(_loc2_.x + 43,_loc2_.y,_loc2_ == this._buttonNormal ? 0 : 1);
this.tooltip.bsource = _loc2_;
}
this.hovering = true;
}
}
if(FlxG.keys.justPressed("ESCAPE"))
{
menu.switchScreen(menu.mainScreen);
}
if(!this.hovering && this.tooltip != null)
{
this.tooltip = null;
}
this.hovering = false;
}
override public function draw() : void
{
super.draw();
if(this.tooltip != null)
{
this.tooltip.draw();
}
}
}
}