2018-01-05 19:21:19 +08:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
2017-02-14 15:13:25 +08:00
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
2017-08-22 18:41:39 +08:00
|
|
|
|
using System.Diagnostics;
|
2017-02-14 15:13:25 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
2017-09-19 12:29:50 +08:00
|
|
|
|
using osu.Framework.Development;
|
2017-02-12 13:54:56 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2017-02-13 19:06:51 +08:00
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
|
using osu.Framework.Graphics.Textures;
|
2017-10-14 01:10:21 +08:00
|
|
|
|
using osu.Game;
|
2017-09-18 21:32:49 +08:00
|
|
|
|
using osu.Game.Configuration;
|
2017-02-13 19:06:51 +08:00
|
|
|
|
using osu.Game.Graphics;
|
2017-09-18 21:32:49 +08:00
|
|
|
|
using osu.Game.Graphics.Sprites;
|
2017-10-14 01:10:21 +08:00
|
|
|
|
using osu.Game.Overlays;
|
2017-09-18 21:32:49 +08:00
|
|
|
|
using osu.Game.Overlays.Notifications;
|
2017-02-13 19:06:51 +08:00
|
|
|
|
using OpenTK;
|
2017-02-15 12:40:13 +08:00
|
|
|
|
using OpenTK.Graphics;
|
2017-11-19 13:30:56 +08:00
|
|
|
|
|
2017-10-14 01:10:21 +08:00
|
|
|
|
namespace osu.Desktop.Overlays
|
2017-02-12 13:54:56 +08:00
|
|
|
|
{
|
|
|
|
|
public class VersionManager : OverlayContainer
|
|
|
|
|
{
|
2017-08-22 18:41:39 +08:00
|
|
|
|
private OsuConfigManager config;
|
|
|
|
|
private OsuGameBase game;
|
2018-03-27 17:57:20 +08:00
|
|
|
|
private NotificationOverlay notificationOverlay;
|
2017-02-12 13:54:56 +08:00
|
|
|
|
|
2018-01-08 04:40:00 +08:00
|
|
|
|
public override bool HandleKeyboardInput => false;
|
|
|
|
|
public override bool HandleMouseInput => false;
|
2017-02-13 19:06:51 +08:00
|
|
|
|
|
2017-02-12 13:54:56 +08:00
|
|
|
|
[BackgroundDependencyLoader]
|
2017-08-22 18:41:39 +08:00
|
|
|
|
private void load(NotificationOverlay notification, OsuColour colours, TextureStore textures, OsuGameBase game, OsuConfigManager config)
|
2017-02-12 13:54:56 +08:00
|
|
|
|
{
|
2017-07-28 13:51:49 +08:00
|
|
|
|
notificationOverlay = notification;
|
2017-08-22 18:41:39 +08:00
|
|
|
|
this.config = config;
|
|
|
|
|
this.game = game;
|
2017-02-12 13:54:56 +08:00
|
|
|
|
|
|
|
|
|
AutoSizeAxes = Axes.Both;
|
|
|
|
|
Anchor = Anchor.BottomCentre;
|
|
|
|
|
Origin = Anchor.BottomCentre;
|
2017-08-22 18:41:39 +08:00
|
|
|
|
|
2017-02-13 19:06:51 +08:00
|
|
|
|
Alpha = 0;
|
2017-02-12 13:54:56 +08:00
|
|
|
|
|
2017-02-13 19:06:51 +08:00
|
|
|
|
Children = new Drawable[]
|
2017-02-12 13:54:56 +08:00
|
|
|
|
{
|
2017-03-02 02:33:01 +08:00
|
|
|
|
new FillFlowContainer
|
2017-02-13 19:06:51 +08:00
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
2017-03-04 18:00:17 +08:00
|
|
|
|
Direction = FillDirection.Vertical,
|
2017-02-13 19:06:51 +08:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2017-03-02 02:33:01 +08:00
|
|
|
|
new FillFlowContainer
|
2017-02-13 19:06:51 +08:00
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
2017-03-04 18:00:17 +08:00
|
|
|
|
Direction = FillDirection.Horizontal,
|
2017-03-02 02:33:01 +08:00
|
|
|
|
Spacing = new Vector2(5),
|
2017-02-13 19:06:51 +08:00
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Font = @"Exo2.0-Bold",
|
2017-03-06 16:09:48 +08:00
|
|
|
|
Text = game.Name
|
2017-02-13 19:06:51 +08:00
|
|
|
|
},
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
2017-09-19 12:29:50 +08:00
|
|
|
|
Colour = DebugUtils.IsDebug ? colours.Red : Color4.White,
|
2017-03-06 16:09:48 +08:00
|
|
|
|
Text = game.Version
|
2017-02-13 19:06:51 +08:00
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
|
TextSize = 12,
|
|
|
|
|
Colour = colours.Yellow,
|
|
|
|
|
Font = @"Venera",
|
2017-03-07 09:59:19 +08:00
|
|
|
|
Text = @"Development Build"
|
2017-02-13 19:06:51 +08:00
|
|
|
|
},
|
|
|
|
|
new Sprite
|
|
|
|
|
{
|
2017-02-27 04:32:43 +08:00
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
|
Origin = Anchor.TopCentre,
|
2017-02-13 19:06:51 +08:00
|
|
|
|
Texture = textures.Get(@"Menu/dev-build-footer"),
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
2017-02-12 13:54:56 +08:00
|
|
|
|
|
2017-11-20 18:44:06 +08:00
|
|
|
|
#if NET_FRAMEWORK
|
2018-03-27 17:57:20 +08:00
|
|
|
|
Add(new SquirrelUpdateManager());
|
2017-11-20 17:55:48 +08:00
|
|
|
|
#endif
|
2017-02-12 13:54:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
2017-08-22 18:41:39 +08:00
|
|
|
|
protected override void LoadComplete()
|
|
|
|
|
{
|
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
|
|
|
|
var version = game.Version;
|
|
|
|
|
var lastVersion = config.Get<string>(OsuSetting.Version);
|
2017-08-22 21:48:50 +08:00
|
|
|
|
if (game.IsDeployedBuild && version != lastVersion)
|
2017-08-22 18:41:39 +08:00
|
|
|
|
{
|
|
|
|
|
config.Set(OsuSetting.Version, version);
|
|
|
|
|
|
|
|
|
|
// only show a notification if we've previously saved a version to the config file (ie. not the first run).
|
|
|
|
|
if (!string.IsNullOrEmpty(lastVersion))
|
2018-01-04 23:42:48 +08:00
|
|
|
|
notificationOverlay.Post(new UpdateCompleteNotification(version));
|
2017-08-22 18:41:39 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private class UpdateCompleteNotification : SimpleNotification
|
|
|
|
|
{
|
|
|
|
|
public UpdateCompleteNotification(string version)
|
|
|
|
|
{
|
|
|
|
|
Text = $"You are now running osu!lazer {version}.\nClick to see what's new!";
|
|
|
|
|
Icon = FontAwesome.fa_check_square;
|
|
|
|
|
Activated = delegate
|
|
|
|
|
{
|
|
|
|
|
Process.Start($"https://github.com/ppy/osu/releases/tag/v{version}");
|
|
|
|
|
return true;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(OsuColour colours)
|
|
|
|
|
{
|
|
|
|
|
IconBackgound.Colour = colours.BlueDark;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-12 13:54:56 +08:00
|
|
|
|
protected override void PopIn()
|
|
|
|
|
{
|
2017-07-15 00:18:12 +08:00
|
|
|
|
this.FadeIn(1000);
|
2017-02-12 13:54:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void PopOut()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|