package;

import flixel.FlxG;
import flixel.FlxSprite;
import flixel.FlxState;
import flixel.text.FlxText;
import flixel.text.FlxTextField;
import flixel.util.FlxColor;
import flixel.ui.FlxButton;
import flixel.util.FlxMath;
import flixel.tweens.FlxTween;
import flixel.tweens.FlxEase;
import flixel.ui.FlxButton;
import flixel.util.FlxSave;



/**
 * A FlxState which can be used for the game's menu.
 */
class EndMenuState extends FlxState
{
	public var numBirdsKilled:Int = 0;
	private var _gameSave:FlxSave;
	private var birdText:String;

	private var shareText:String;
	private var bestScore = false;

	private var trophyLeft:FlxSprite;
	private var trophyRight:FlxSprite;	

	override public function create():Void
	{		
		// Camera bg colour
		FlxG.camera.bgColor = 0x5b103c;		

		// Back button
		var backBtn:FcButton = new FcButton( Reg.margin , Reg.margin, Reg.assets_dir + "btn_back.png", onBack );
		add(backBtn);

		// Play button
		var playBtn:FcButton = new FcButton(FlxG.width / 2, FlxG.height / 2, Reg.assets_dir + "btn_play.png", replay, FcButton.CENTER_TOP);
		add(playBtn);

		// Fade in
		FlxG.camera.fade(FlxColor.WHITE, 0.2, true);

		super.create();
	}


	private function onBack():Void
	{
    	FlxG.camera.fade(0xFF5b103c, .2, false, function() {
        	FlxG.switchState(new MainMenuState());
		});
    }

    private function replay():Void
    {
    	FlxG.camera.fade(0xFF5b103c, .2, false, function() {
        	FlxG.switchState(new PlayState());
		});
    }
	
	/**
	 * Function that is called when this state is destroyed - you might want to 
	 * consider setting all objects this state uses to null to help garbage collection.
	 */
	override public function destroy():Void
	{
		super.destroy();
	}

	/**
	 * Function that is called once every frame.
	 */
	override public function update():Void
	{
		super.update();

		// if (FlxG.mouse.justPressed)
	 //    {
	    	
	 //    }
	}	
}