mirror of
https://github.com/ppy/osu
synced 2025-02-17 10:57:03 +00:00
General function reorganisation
This commit is contained in:
parent
4e49fbf7fb
commit
b8edca59eb
@ -57,8 +57,34 @@ namespace osu.Game
|
|||||||
|
|
||||||
public const int SAMPLE_CONCURRENCY = 6;
|
public const int SAMPLE_CONCURRENCY = 6;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The maximum volume at which audio tracks should playback. This can be set lower than 1 to create some head-room for sound effects.
|
||||||
|
/// </summary>
|
||||||
|
internal const double GLOBAL_TRACK_VOLUME_ADJUST = 0.5;
|
||||||
|
|
||||||
public bool UseDevelopmentServer { get; }
|
public bool UseDevelopmentServer { get; }
|
||||||
|
|
||||||
|
public virtual Version AssemblyVersion => Assembly.GetEntryAssembly()?.GetName().Version ?? new Version();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// MD5 representation of the game executable.
|
||||||
|
/// </summary>
|
||||||
|
public string VersionHash { get; private set; }
|
||||||
|
|
||||||
|
public bool IsDeployedBuild => AssemblyVersion.Major > 0;
|
||||||
|
|
||||||
|
public virtual string Version
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (!IsDeployedBuild)
|
||||||
|
return @"local " + (DebugUtils.IsDebugBuild ? @"debug" : @"release");
|
||||||
|
|
||||||
|
var version = AssemblyVersion;
|
||||||
|
return $@"{version.Major}.{version.Minor}.{version.Build}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected OsuConfigManager LocalConfig { get; private set; }
|
protected OsuConfigManager LocalConfig { get; private set; }
|
||||||
|
|
||||||
protected SessionStatics SessionStatics { get; private set; }
|
protected SessionStatics SessionStatics { get; private set; }
|
||||||
@ -118,32 +144,17 @@ namespace osu.Game
|
|||||||
|
|
||||||
private MultiplayerClient multiplayerClient;
|
private MultiplayerClient multiplayerClient;
|
||||||
|
|
||||||
|
private DatabaseContextFactory contextFactory;
|
||||||
|
|
||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
|
|
||||||
private Container content;
|
private Container content;
|
||||||
|
|
||||||
|
private DependencyContainer dependencies;
|
||||||
|
|
||||||
private Bindable<bool> fpsDisplayVisible;
|
private Bindable<bool> fpsDisplayVisible;
|
||||||
|
|
||||||
public virtual Version AssemblyVersion => Assembly.GetEntryAssembly()?.GetName().Version ?? new Version();
|
private readonly BindableNumber<double> globalTrackVolumeAdjust = new BindableNumber<double>(GLOBAL_TRACK_VOLUME_ADJUST);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// MD5 representation of the game executable.
|
|
||||||
/// </summary>
|
|
||||||
public string VersionHash { get; private set; }
|
|
||||||
|
|
||||||
public bool IsDeployedBuild => AssemblyVersion.Major > 0;
|
|
||||||
|
|
||||||
public virtual string Version
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (!IsDeployedBuild)
|
|
||||||
return @"local " + (DebugUtils.IsDebugBuild ? @"debug" : @"release");
|
|
||||||
|
|
||||||
var version = AssemblyVersion;
|
|
||||||
return $@"{version.Major}.{version.Minor}.{version.Build}";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public OsuGameBase()
|
public OsuGameBase()
|
||||||
{
|
{
|
||||||
@ -151,23 +162,14 @@ namespace osu.Game
|
|||||||
Name = @"osu!lazer";
|
Name = @"osu!lazer";
|
||||||
}
|
}
|
||||||
|
|
||||||
private DependencyContainer dependencies;
|
|
||||||
|
|
||||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) =>
|
|
||||||
dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
|
||||||
|
|
||||||
private DatabaseContextFactory contextFactory;
|
|
||||||
|
|
||||||
protected override UserInputManager CreateUserInputManager() => new OsuUserInputManager();
|
protected override UserInputManager CreateUserInputManager() => new OsuUserInputManager();
|
||||||
|
|
||||||
protected virtual BatteryInfo CreateBatteryInfo() => null;
|
protected virtual BatteryInfo CreateBatteryInfo() => null;
|
||||||
|
|
||||||
/// <summary>
|
protected virtual Container CreateScalingContainer() => new DrawSizePreservingFillContainer();
|
||||||
/// The maximum volume at which audio tracks should playback. This can be set lower than 1 to create some head-room for sound effects.
|
|
||||||
/// </summary>
|
|
||||||
internal const double GLOBAL_TRACK_VOLUME_ADJUST = 0.5;
|
|
||||||
|
|
||||||
private readonly BindableNumber<double> globalTrackVolumeAdjust = new BindableNumber<double>(GLOBAL_TRACK_VOLUME_ADJUST);
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) =>
|
||||||
|
dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
@ -345,6 +347,19 @@ namespace osu.Game
|
|||||||
Ruleset.BindValueChanged(onRulesetChanged);
|
Ruleset.BindValueChanged(onRulesetChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
// TODO: This is temporary until we reimplement the local FPS display.
|
||||||
|
// It's just to allow end-users to access the framework FPS display without knowing the shortcut key.
|
||||||
|
fpsDisplayVisible = LocalConfig.GetBindable<bool>(OsuSetting.ShowFpsDisplay);
|
||||||
|
fpsDisplayVisible.ValueChanged += visible => { FrameStatistics.Value = visible.NewValue ? FrameStatisticsMode.Minimal : FrameStatisticsMode.None; };
|
||||||
|
fpsDisplayVisible.TriggerChange();
|
||||||
|
|
||||||
|
FrameStatistics.ValueChanged += e => fpsDisplayVisible.Value = e.NewValue != FrameStatisticsMode.None;
|
||||||
|
}
|
||||||
|
|
||||||
private void onRulesetChanged(ValueChangedEvent<RulesetInfo> r)
|
private void onRulesetChanged(ValueChangedEvent<RulesetInfo> r)
|
||||||
{
|
{
|
||||||
var dict = new Dictionary<ModType, IReadOnlyList<Mod>>();
|
var dict = new Dictionary<ModType, IReadOnlyList<Mod>>();
|
||||||
@ -361,21 +376,6 @@ namespace osu.Game
|
|||||||
AvailableMods.Value = dict;
|
AvailableMods.Value = dict;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual Container CreateScalingContainer() => new DrawSizePreservingFillContainer();
|
|
||||||
|
|
||||||
protected override void LoadComplete()
|
|
||||||
{
|
|
||||||
base.LoadComplete();
|
|
||||||
|
|
||||||
// TODO: This is temporary until we reimplement the local FPS display.
|
|
||||||
// It's just to allow end-users to access the framework FPS display without knowing the shortcut key.
|
|
||||||
fpsDisplayVisible = LocalConfig.GetBindable<bool>(OsuSetting.ShowFpsDisplay);
|
|
||||||
fpsDisplayVisible.ValueChanged += visible => { FrameStatistics.Value = visible.NewValue ? FrameStatisticsMode.Minimal : FrameStatisticsMode.None; };
|
|
||||||
fpsDisplayVisible.TriggerChange();
|
|
||||||
|
|
||||||
FrameStatistics.ValueChanged += e => fpsDisplayVisible.Value = e.NewValue != FrameStatisticsMode.None;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void runMigrations()
|
private void runMigrations()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
Loading…
Reference in New Issue
Block a user