initial commit, kind of working.
This commit is contained in:
@@ -0,0 +1,123 @@
|
||||
package com.arc.dh.state
|
||||
{
|
||||
import com.arc.dh.util.Config;
|
||||
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 com.arc.flixel.ArcSprite;
|
||||
import org.flixel.FlxBitmapText;
|
||||
import org.flixel.FlxG;
|
||||
|
||||
public class EscapeScreen extends MenuScreen
|
||||
{
|
||||
|
||||
private static const buttonBackSprite:Class = EscapeScreen_buttonBackSprite;
|
||||
|
||||
private static const startBackSprite:Class = EscapeScreen_startBackSprite;
|
||||
|
||||
private static const escapeSprite:Class = EscapeScreen_escapeSprite;
|
||||
|
||||
public static const diamondsSprite:Class = EscapeScreen_diamondsSprite;
|
||||
|
||||
private var _escapeImage:ArcSprite;
|
||||
|
||||
private var _buttonBack:ArcButton;
|
||||
|
||||
private var _buttonStart:ArcButton;
|
||||
|
||||
public var tooltip:EscapeTooltip;
|
||||
|
||||
public var hovering:Boolean = false;
|
||||
|
||||
public var buttons:Array;
|
||||
|
||||
private var _diamondsText:FlxBitmapText;
|
||||
|
||||
public function EscapeScreen(param1:MainMenu)
|
||||
{
|
||||
var startHeight:FlxBitmapText;
|
||||
var abg:ArcButtonGroup;
|
||||
var i:int;
|
||||
var _diamonds:ArcSprite;
|
||||
var maxHeight:FlxBitmapText;
|
||||
var eb:EscapeButton = null;
|
||||
var M:MainMenu = param1;
|
||||
this.buttons = new Array();
|
||||
super(M);
|
||||
this._buttonBack = new ArcButton(185,208,87,26,buttonBackSprite).callback(function():void
|
||||
{
|
||||
menu.switchScreen(menu.mainScreen);
|
||||
}).selectable(false);
|
||||
this.add(this._buttonBack);
|
||||
this._buttonStart = new ArcButton(85,208,87,26,startBackSprite).callback(function():void
|
||||
{
|
||||
SoundSystem.fadeOutMusic();
|
||||
FlxG.fade(4278190080,0.25,function():void
|
||||
{
|
||||
var _loc2_:* = undefined;
|
||||
var _loc1_:* = 0;
|
||||
for each(_loc2_ in buttons)
|
||||
{
|
||||
if(_loc2_.selected)
|
||||
{
|
||||
_loc1_ = _loc2_.start;
|
||||
}
|
||||
}
|
||||
FlxG.mouse.hide();
|
||||
FlxG.switchState(new EscapeMode(_loc1_));
|
||||
});
|
||||
}).selectable(false);
|
||||
this.add(this._buttonStart);
|
||||
this._escapeImage = new ArcSprite(0,108,escapeSprite);
|
||||
this.add(this._escapeImage);
|
||||
this.add(new InstructionWindow(0,170,FlxG.width,30));
|
||||
startHeight = new FlxBitmapText(2,177,Fonts.font(Fonts.OUTLINE_BLACK_S),"STARTING HEIGHT:","center",77);
|
||||
this.add(startHeight);
|
||||
abg = new ArcButtonGroup();
|
||||
i = 0;
|
||||
while(i < 6)
|
||||
{
|
||||
eb = new EscapeButton(85 + i * 46,177,i * 100,abg);
|
||||
eb.setScreen(this);
|
||||
this.add(eb);
|
||||
this.buttons.push(eb);
|
||||
i++;
|
||||
}
|
||||
_diamonds = new ArcSprite(4,Config.HEIGHT - 14);
|
||||
_diamonds.loadGraphic(diamondsSprite,true,false,44,12);
|
||||
this.add(_diamonds);
|
||||
this._diamondsText = new FlxBitmapText(4,Config.HEIGHT - 11,Fonts.font(Fonts.SMALL_WHITE),Data.diamonds > 99999 ? "99999" : Data.diamonds.toString(),"right",40);
|
||||
this.add(this._diamondsText);
|
||||
maxHeight = new FlxBitmapText(2,186,Fonts.font(Fonts.OUTLINE_GRADIENT_S),"MAX: " + Data.maxheight + "M","center",77);
|
||||
this.add(maxHeight);
|
||||
this.update();
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
super.update();
|
||||
if(FlxG.keys.justPressed("ESCAPE"))
|
||||
{
|
||||
menu.switchScreen(menu.mainScreen);
|
||||
}
|
||||
this._diamondsText.text = Data.diamonds > 99999 ? "99999" : Data.diamonds.toString();
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user