mirror of https://github.com/ppy/osu
Move version-related properties to OsuGameBase.
This commit is contained in:
parent
a7d7abe70e
commit
0ee38571a6
|
@ -17,8 +17,6 @@ class OsuGameDesktop : OsuGame
|
|||
{
|
||||
private VersionManager versionManager;
|
||||
|
||||
public override bool IsDeployedBuild => versionManager.IsDeployedBuild;
|
||||
|
||||
public OsuGameDesktop(string[] args = null)
|
||||
: base(args)
|
||||
{
|
||||
|
@ -44,7 +42,7 @@ public override void SetHost(GameHost host)
|
|||
if (desktopWindow != null)
|
||||
{
|
||||
desktopWindow.Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location);
|
||||
desktopWindow.Title = @"osu!lazer";
|
||||
desktopWindow.Title = Name;
|
||||
|
||||
desktopWindow.DragEnter += dragEnter;
|
||||
desktopWindow.DragDrop += dragDrop;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
using OpenTK.Graphics;
|
||||
using System.Net.Http;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Game;
|
||||
|
||||
namespace osu.Desktop.Overlays
|
||||
{
|
||||
|
@ -27,16 +28,12 @@ public class VersionManager : OverlayContainer
|
|||
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 @@ private void load(NotificationManager notification, OsuColour colours, TextureSt
|
|||
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 @@ private void load(NotificationManager notification, OsuColour colours, TextureSt
|
|||
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 @@ private void load(NotificationManager notification, OsuColour colours, TextureSt
|
|||
}
|
||||
};
|
||||
|
||||
if (IsDeployedBuild)
|
||||
if (game.IsDeployedBuild)
|
||||
checkForUpdateAsync();
|
||||
}
|
||||
|
||||
|
@ -228,6 +214,7 @@ private void load(OsuColour colours)
|
|||
new TextAwesome
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Icon = FontAwesome.fa_upload,
|
||||
Colour = Color4.White,
|
||||
}
|
||||
|
|
|
@ -32,8 +32,6 @@ namespace osu.Game
|
|||
{
|
||||
public class OsuGame : OsuGameBase
|
||||
{
|
||||
public virtual bool IsDeployedBuild => false;
|
||||
|
||||
public Toolbar Toolbar;
|
||||
|
||||
private ChatOverlay chat;
|
||||
|
|
|
@ -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 @@ public class OsuGameBase : Framework.Game, IOnlineComponent
|
|||
|
||||
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()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue