package com.arc.dh.menu { import Playtomic.Link; import com.arc.dh.state.Trophy; import com.arc.dh.util.AchievementSystem; import com.arc.dh.util.Config; import com.arc.dh.util.Data; import com.arc.dh.util.Fonts; import com.arc.flixel.ArcButton; import org.flixel.FlxBitmapText; import org.flixel.FlxPoint; public class StatisticsPane extends MenuPane { private static const sprite:Class = StatisticsPane_sprite; private static const refreshSprite:Class = StatisticsPane_refreshSprite; private static const pegasSprite:Class = StatisticsPane_pegasSprite; private var _chapters:Array; private var _tiptext:FlxBitmapText; private var _statistics:Array; private var _statisticsTexts:Array; private var _completion:FlxBitmapText; private var _trophies:Array; private var _buttonPegas:ArcButton; public function StatisticsPane() { var refresh:ArcButton; var i:int = 0; var rx:int = 0; var ry:int = 0; var chapter:StatisticsChapter = null; var t:Trophy = null; this._chapters = new Array(); this._statistics = new Array(); this._statisticsTexts = new Array(); this._trophies = new Array(); super(1,1,sprite); i = 0; while(i < 7) { rx = 14; ry = 21 + i * 13; chapter = new StatisticsChapter(rx,ry,i); this.add(chapter); this._chapters.push(chapter); i++; } i = 0; while(i < AchievementSystem.achievements.length) { t = new Trophy(249 + i % 5 * 20,24 + Math.floor(i / 5) * 20,i); this._trophies.push(t); this.add(t); i++; } this._tiptext = new FlxBitmapText(134,151,Fonts.font(Fonts.OUTLINE_BLACK),Tip.random(),"center",102); this.add(this._tiptext); refresh = new ArcButton(203,137,11,11,refreshSprite).selectable(false).callback(function():void { _tiptext.text = Tip.random(); }); this.add(refresh); this.addStatistic("total diamonds",function():int { return Data.totaldiamonds; }); this.addStatistic("escape height",function():int { return Data.maxheight; }); this.addStatistic("enemies killed",function():int { return Data.enemies; }); this.addStatistic("upgrades",function():String { return Data.upgrades + "/60"; }); this.addStatistic("deaths",function():int { return Data.deaths; }); this.addStatistic("playtime",function():String { return Data.duration(0,Data.time * 1000); }); this.addStatistic("bullets fired",function():int { return Data.bullets; }); this.addStatistic("achievements",function():String { return Data.getAchievementCount() + "/45"; }); this._completion = new FlxBitmapText(134,126,Fonts.font(Fonts.BEVEL_YELLOW),"","center",104); this.add(this._completion); if(Config.RELEASE == Config.PEGAS) { this._buttonPegas = new ArcButton(134,196,103,17,pegasSprite).callback(function():void { Link.Open("http://www.pegasgames.com/","StatisticsMenu","Sponsor"); }).selectable(false); this.add(this._buttonPegas); } this.sync(); setAll("scrollFactor",new FlxPoint(0,0)); } public function clickTryAgain() : void { } public function clickMenu() : void { } override public function sync(param1:Boolean = false) : void { var _loc2_:StatisticsChapter = null; var _loc3_:Array = null; var _loc4_:Trophy = null; var _loc5_:FlxBitmapText = null; var _loc6_:Function = null; for each(_loc2_ in this._chapters) { _loc2_.sync(); } this._tiptext.text = Tip.random(); this._completion.text = Data.completion + "% COMPLETE"; for each(_loc3_ in this._statistics) { _loc5_ = _loc3_[0] as FlxBitmapText; _loc6_ = _loc3_[1] as Function; _loc5_.text = _loc6_(); } for each(_loc4_ in this._trophies) { _loc4_.sync(); } } override public function update() : void { super.update(); } public function addStatistic(param1:String, param2:Function) : void { var _loc3_:int = int(this._statistics.length); var _loc4_:FlxBitmapText = new FlxBitmapText(14,126 + 10 * _loc3_,Fonts.font(Fonts.OUTLINE_BLACK_S),param1.toUpperCase(),"left",109); var _loc5_:FlxBitmapText = new FlxBitmapText(_loc4_.x,_loc4_.y,Fonts.font(Fonts.OUTLINE_GRADIENT_S),"","right",109); this.add(_loc4_); this.add(_loc5_); this._statistics.push([_loc5_,param2]); } } }