package gui; import modes.GameMode.ScoreType; import mis.MisParser; import hxd.BitmapData; import h2d.Tile; import src.MarbleGame; import src.Settings.Score; import src.Settings.Settings; import src.Mission; import h2d.filter.DropShadow; import hxd.res.BitmapFont; import h3d.Vector; import src.ResourceLoader; import src.TimeState; import src.Util; class EndGameGui extends GuiImage { var mission:Mission; var innerCtrl:GuiControl; var endGameWnd:GuiImage; var scoreSubmitted:Bool = false; public function new(continueFunc:GuiControl->Void, restartFunc:GuiControl->Void, nextLevelFunc:GuiControl->Void, mission:Mission, score:Float, scoreType:ScoreType) { var res = ResourceLoader.getImage("data/ui/xbox/BG_fadeOutSoftEdge.png").resource.toTile(); super(res); this.horizSizing = Width; this.vertSizing = Height; this.position = new Vector(0, 0); this.extent = new Vector(640, 480); this.mission = mission; function loadButtonImages(path:String) { var normal = ResourceLoader.getResource('${path}_n.png', ResourceLoader.getImage, this.imageResources).toTile(); var hover = ResourceLoader.getResource('${path}_h.png', ResourceLoader.getImage, this.imageResources).toTile(); var pressed = ResourceLoader.getResource('${path}_d.png', ResourceLoader.getImage, this.imageResources).toTile(); return [normal, hover, pressed]; } var scene2d = MarbleGame.canvas.scene2d; var offsetX = (scene2d.width - 1280) / 2; var offsetY = (scene2d.height - 720) / 2; var subX = 640 - (scene2d.width - offsetX) * 640 / scene2d.width; var subY = 480 - (scene2d.height - offsetY) * 480 / scene2d.height; innerCtrl = new GuiControl(); innerCtrl.position = new Vector(offsetX, offsetY); innerCtrl.extent = new Vector(640 - subX, 480 - subY); innerCtrl.horizSizing = Width; innerCtrl.vertSizing = Height; this.addChild(innerCtrl); var coliseumfontdata = ResourceLoader.getFileEntry("data/font/ColiseumRR.fnt"); var coliseumb = new BitmapFont(coliseumfontdata.entry); @:privateAccess coliseumb.loader = ResourceLoader.loader; var coliseum = coliseumb.toSdfFont(cast 44 * Settings.uiScale, MultiChannel); var rootTitle = new GuiText(coliseum); rootTitle.position = new Vector(100, 30); rootTitle.extent = new Vector(1120, 80); rootTitle.text.textColor = 0xFFFFFF; rootTitle.text.text = "LEVEL COMPLETE!"; rootTitle.text.alpha = 0.5; innerCtrl.addChild(rootTitle); endGameWnd = new GuiImage(ResourceLoader.getResource("data/ui/xbox/endGameWindow.png", ResourceLoader.getImage, this.imageResources).toTile()); endGameWnd.horizSizing = Left; endGameWnd.vertSizing = Top; endGameWnd.position = new Vector(80 - offsetX, 150 - offsetY); endGameWnd.extent = new Vector(336, 150); innerCtrl.addChild(endGameWnd); var arial14fontdata = ResourceLoader.getFileEntry("data/font/Arial Bold.fnt"); var arial14b = new BitmapFont(arial14fontdata.entry); @:privateAccess arial14b.loader = ResourceLoader.loader; var arial14 = arial14b.toSdfFont(cast 22 * Settings.uiScale, h2d.Font.SDFChannel.MultiChannel); var statIcon = new GuiImage(ResourceLoader.getResource("data/ui/xbox/statIcon.png", ResourceLoader.getImage, this.imageResources).toTile()); statIcon.position = new Vector(38, 27); statIcon.extent = new Vector(20, 20); endGameWnd.addChild(statIcon); function mlFontLoader(text:String) { return arial14; } var beatPar = score < mission.qualifyTime; var egResultLeft = new GuiMLText(arial14, mlFontLoader); egResultLeft.position = new Vector(28, 26); egResultLeft.extent = new Vector(180, 100); if (scoreType == Time) egResultLeft.text.text = '
Time:
Par Time:
Rating:
My Best Time:
Score:
My Best Score: