Move version-related properties to OsuGameBase.

This commit is contained in:
Dean Herbert 2017-03-06 17:09:48 +09:00
parent a7d7abe70e
commit 0ee38571a6
No known key found for this signature in database
GPG Key ID: 46D71BF4958ABB49
4 changed files with 44 additions and 25 deletions

View File

@ -17,8 +17,6 @@ namespace osu.Desktop
{
private VersionManager versionManager;
public override bool IsDeployedBuild => versionManager.IsDeployedBuild;
public OsuGameDesktop(string[] args = null)
: base(args)
{
@ -44,7 +42,7 @@ namespace osu.Desktop
if (desktopWindow != null)
{
desktopWindow.Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location);
desktopWindow.Title = @"osu!lazer";
desktopWindow.Title = Name;
desktopWindow.DragEnter += dragEnter;
desktopWindow.DragDrop += dragDrop;

View File

@ -19,6 +19,7 @@ using OpenTK;
using OpenTK.Graphics;
using System.Net.Http;
using osu.Framework.Logging;
using osu.Game;
namespace osu.Desktop.Overlays
{
@ -27,16 +28,12 @@ namespace osu.Desktop.Overlays
private UpdateManager updateManager;
private NotificationManager notificationManager;
AssemblyName assembly = Assembly.GetEntryAssembly().GetName();
public bool IsDeployedBuild => assembly.Version.Major > 0;
protected override bool HideOnEscape => false;
public override bool HandleInput => false;
[BackgroundDependencyLoader]
private void load(NotificationManager notification, OsuColour colours, TextureStore textures)
private void load(NotificationManager notification, OsuColour colours, TextureStore textures, OsuGameBase game)
{
notificationManager = notification;
@ -45,17 +42,6 @@ namespace osu.Desktop.Overlays
Origin = Anchor.BottomCentre;
Alpha = 0;
bool isDebug = false;
Debug.Assert(isDebug = true);
string version;
if (!IsDeployedBuild)
{
version = @"local " + (isDebug ? @"debug" : @"release");
}
else
version = $@"{assembly.Version.Major}.{assembly.Version.Minor}.{assembly.Version.Build}";
Children = new Drawable[]
{
new FillFlowContainer
@ -76,12 +62,12 @@ namespace osu.Desktop.Overlays
new OsuSpriteText
{
Font = @"Exo2.0-Bold",
Text = $@"osu!lazer"
Text = game.Name
},
new OsuSpriteText
{
Colour = isDebug ? colours.Red : Color4.White,
Text = version
Colour = game.IsDebug ? colours.Red : Color4.White,
Text = game.Version
},
}
},
@ -104,7 +90,7 @@ namespace osu.Desktop.Overlays
}
};
if (IsDeployedBuild)
if (game.IsDeployedBuild)
checkForUpdateAsync();
}
@ -228,6 +214,7 @@ namespace osu.Desktop.Overlays
new TextAwesome
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Icon = FontAwesome.fa_upload,
Colour = Color4.White,
}

View File

@ -32,8 +32,6 @@ namespace osu.Game
{
public class OsuGame : OsuGameBase
{
public virtual bool IsDeployedBuild => false;
public Toolbar Toolbar;
private ChatOverlay chat;

View File

@ -1,6 +1,8 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Diagnostics;
using System.Reflection;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
@ -37,6 +39,40 @@ namespace osu.Game
public readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
protected AssemblyName AssemblyName => Assembly.GetEntryAssembly().GetName();
public bool IsDeployedBuild => AssemblyName.Version.Major > 0;
public bool IsDebug
{
get
{
bool isDebug = false;
Debug.Assert(isDebug = true);
return isDebug;
}
}
public string Version
{
get
{
bool isDebug = false;
Debug.Assert(isDebug = true);
if (!IsDeployedBuild)
return @"local " + (isDebug ? @"debug" : @"release");
var assembly = AssemblyName;
return $@"{assembly.Version.Major}.{assembly.Version.Minor}.{assembly.Version.Build}";
}
}
public OsuGameBase()
{
Name = @"osu!lazer";
}
[BackgroundDependencyLoader]
private void load()
{