| 15 | import forge.toolbox.FOverlay; |
| 16 | |
| 17 | public class ClosingScreen extends FContainer { |
| 18 | private BGAnimation bgAnimation; |
| 19 | private StaticAnimation staticAnimation; |
| 20 | private boolean restart = false; |
| 21 | private boolean drawStatic = false; |
| 22 | private FileHandle adv_logo = getSkinFile("adv_logo.png"); |
| 23 | private FileHandle existingLogo = adv_logo.exists() ? adv_logo : getDefaultSkinFile("adv_logo.png"); |
| 24 | private Texture logo = existingLogo.exists() && Forge.advStartup ? Forge.getAssets().getTexture(existingLogo, true, false) : FSkin.getLogo(); |
| 25 | |
| 26 | public ClosingScreen(boolean restart0) { |
| 27 | bgAnimation = new BGAnimation(); |
| 28 | staticAnimation = new StaticAnimation(); |
| 29 | restart = restart0; |
| 30 | } |
| 31 | |
| 32 | @Override |
| 33 | protected void doLayout(float width, float height) { |
| 34 | |
| 35 | } |
| 36 | |
| 37 | private class StaticAnimation extends ForgeAnimation { |
| 38 | float DURATION = 0.8f; |
| 39 | private float progress = 0; |
| 40 | |
| 41 | public void drawBackgroud(Graphics g) { |
| 42 | float percentage = progress / DURATION; |
| 43 | float oldAlpha = g.getfloatAlphaComposite(); |
| 44 | if (percentage < 0) { |
| 45 | percentage = 0; |
| 46 | } else if (percentage > 1) { |
| 47 | percentage = 1; |
| 48 | } |
| 49 | try { |
| 50 | //fade out volume |
| 51 | SoundSystem.instance.fadeModifier(1-percentage); |
| 52 | } catch (Exception e) { |
| 53 | e.printStackTrace(); |
| 54 | } |
| 55 | g.fillRect(Color.BLACK, 0, 0, Forge.getScreenWidth(), Forge.getScreenHeight()); |
| 56 | g.setAlphaComposite(1-percentage); |
| 57 | g.drawImage(Forge.isMobileAdventureMode || Forge.advStartup ? FSkinTexture.ADV_BG_TEXTURE : FSkinTexture.BG_TEXTURE, 0, 0, Forge.getScreenWidth(), Forge.getScreenHeight()); |
| 58 | g.setAlphaComposite(oldAlpha); |
| 59 | float xmod = Forge.getScreenHeight() > 2000 ? 1.5f : 1f; |
| 60 | |
| 61 | if (logo != null) { |
| 62 | g.drawImage(logo, Forge.getScreenWidth()/2 - (logo.getWidth()*xmod)/2, Forge.getScreenHeight()/2 - (logo.getHeight()*xmod)/2, logo.getWidth()*xmod, logo.getHeight()*xmod); |
| 63 | } else { |
| 64 | g.drawImage(FSkinImage.LOGO, Forge.getScreenWidth()/2 - (FSkinImage.LOGO.getWidth()*xmod)/2, Forge.getScreenHeight()/2 - (FSkinImage.LOGO.getHeight()*xmod)/1.5f, FSkinImage.LOGO.getWidth()*xmod, FSkinImage.LOGO.getHeight()*xmod); |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | @Override |
| 69 | protected boolean advance(float dt) { |
| 70 | progress += dt; |
| 71 | return progress < DURATION; |
| 72 | } |
| 73 | |
| 74 | @Override |
nothing calls this directly
no test coverage detected