1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 03:25:11 +08:00

Merge branch 'master' into results-screen-statistics-overlapping-transition

This commit is contained in:
Dean Herbert 2020-06-24 18:22:51 +09:00
commit 9119f41604
46 changed files with 726 additions and 172 deletions

View File

@ -1,8 +1,8 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="CatchRuleset (Tests)" type="DotNetProject" factoryName=".NET Project" folderName="Ruleset">
<configuration default="false" name="CatchRuleset (Tests)" type="DotNetProject" factoryName=".NET Project" folderName="Ruleset" activateToolWindowBeforeRun="false">
<option name="EXE_PATH" value="$PROJECT_DIR$/osu.Game.Rulesets.Catch.Tests/bin/Debug/netcoreapp3.1/osu.Game.Rulesets.Catch.Tests.dll" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/osu.Game.Rulesets.Catch.Tests" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/osu.Game.Rulesets.Catch.Tests/bin/Debug/netcoreapp3.1" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
@ -15,7 +15,7 @@
<option name="PROJECT_TFM" value=".NETCoreApp,Version=v3.1" />
<browser url="http://localhost:5000" />
<method v="2">
<option name="Build" enabled="true" />
<option name="Build" />
</method>
</configuration>
</component>

View File

@ -1,8 +1,8 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="ManiaRuleset (Tests)" type="DotNetProject" factoryName=".NET Project" folderName="Ruleset">
<configuration default="false" name="ManiaRuleset (Tests)" type="DotNetProject" factoryName=".NET Project" folderName="Ruleset" activateToolWindowBeforeRun="false">
<option name="EXE_PATH" value="$PROJECT_DIR$/osu.Game.Rulesets.Mania.Tests/bin/Debug/netcoreapp3.1/osu.Game.Rulesets.Mania.Tests.dll" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/osu.Game.Rulesets.Mania.Tests" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/osu.Game.Rulesets.Mania.Tests/bin/Debug/netcoreapp3.1" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
@ -15,7 +15,7 @@
<option name="PROJECT_TFM" value=".NETCoreApp,Version=v3.1" />
<browser url="http://localhost:5000" />
<method v="2">
<option name="Build" enabled="true" />
<option name="Build" />
</method>
</configuration>
</component>

View File

@ -1,8 +1,8 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="OsuRuleset (Tests)" type="DotNetProject" factoryName=".NET Project" folderName="Ruleset">
<configuration default="false" name="OsuRuleset (Tests)" type="DotNetProject" factoryName=".NET Project" folderName="Ruleset" activateToolWindowBeforeRun="false">
<option name="EXE_PATH" value="$PROJECT_DIR$/osu.Game.Rulesets.Osu.Tests/bin/Debug/netcoreapp3.1/osu.Game.Rulesets.Osu.Tests.dll" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/osu.Game.Rulesets.Osu.Tests" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/osu.Game.Rulesets.Osu.Tests/bin/Debug/netcoreapp3.1" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
@ -15,7 +15,7 @@
<option name="PROJECT_TFM" value=".NETCoreApp,Version=v3.1" />
<browser url="http://localhost:5000" />
<method v="2">
<option name="Build" enabled="true" />
<option name="Build" />
</method>
</configuration>
</component>

View File

@ -1,8 +1,8 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="TaikoRuleset (Tests)" type="DotNetProject" factoryName=".NET Project" folderName="Ruleset">
<configuration default="false" name="TaikoRuleset (Tests)" type="DotNetProject" factoryName=".NET Project" folderName="Ruleset" activateToolWindowBeforeRun="false">
<option name="EXE_PATH" value="$PROJECT_DIR$/osu.Game.Rulesets.Taiko.Tests/bin/Debug/netcoreapp3.1/osu.Game.Rulesets.Taiko.Tests.dll" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/osu.Game.Rulesets.Taiko.Tests" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/osu.Game.Rulesets.Taiko.Tests/bin/Debug/netcoreapp3.1" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
@ -15,7 +15,7 @@
<option name="PROJECT_TFM" value=".NETCoreApp,Version=v3.1" />
<browser url="http://localhost:5000" />
<method v="2">
<option name="Build" enabled="true" />
<option name="Build" />
</method>
</configuration>
</component>

View File

@ -1,8 +1,8 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Tournament" type="DotNetProject" factoryName=".NET Project" folderName="Tournament">
<configuration default="false" name="Tournament" type="DotNetProject" factoryName=".NET Project" folderName="Tournament" activateToolWindowBeforeRun="false">
<option name="EXE_PATH" value="$PROJECT_DIR$/osu.Desktop/bin/Debug/netcoreapp3.1/osu!.dll" />
<option name="PROGRAM_PARAMETERS" value="--tournament" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/osu.Desktop" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/osu.Desktop/bin/Debug/netcoreapp3.1" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
@ -14,7 +14,7 @@
<option name="PROJECT_KIND" value="DotNetCore" />
<option name="PROJECT_TFM" value=".NETCoreApp,Version=v3.1" />
<method v="2">
<option name="Build" enabled="true" />
<option name="Build" />
</method>
</configuration>
</component>

View File

@ -1,8 +1,8 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Tournament (Tests)" type="DotNetProject" factoryName=".NET Project" folderName="Tournament">
<configuration default="false" name="Tournament (Tests)" type="DotNetProject" factoryName=".NET Project" folderName="Tournament" activateToolWindowBeforeRun="false">
<option name="EXE_PATH" value="$PROJECT_DIR$/osu.Game.Tournament.Tests/bin/Debug/netcoreapp3.1/osu.Game.Tournament.Tests.dll" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/osu.Game.Tournament.Tests" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/osu.Game.Tournament.Tests/bin/Debug/netcoreapp3.1" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
@ -15,7 +15,7 @@
<option name="PROJECT_TFM" value=".NETCoreApp,Version=v3.1" />
<browser url="http://localhost:5000" />
<method v="2">
<option name="Build" enabled="true" />
<option name="Build" />
</method>
</configuration>
</component>

View File

@ -1,8 +1,8 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="osu!" type="DotNetProject" factoryName=".NET Project" folderName="osu!">
<configuration default="false" name="osu!" type="DotNetProject" factoryName=".NET Project" folderName="osu!" activateToolWindowBeforeRun="false">
<option name="EXE_PATH" value="$PROJECT_DIR$/osu.Desktop/bin/Debug/netcoreapp3.1/osu!.dll" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/osu.Desktop" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/osu.Desktop/bin/Debug/netcoreapp3.1" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
@ -14,7 +14,7 @@
<option name="PROJECT_KIND" value="DotNetCore" />
<option name="PROJECT_TFM" value=".NETCoreApp,Version=v3.1" />
<method v="2">
<option name="Build" enabled="true" />
<option name="Build" />
</method>
</configuration>
</component>

View File

@ -1,8 +1,8 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="osu! SDL" type="DotNetProject" factoryName=".NET Project" folderName="osu!">
<configuration default="false" name="osu! SDL" type="DotNetProject" factoryName=".NET Project" folderName="osu!" activateToolWindowBeforeRun="false">
<option name="EXE_PATH" value="$PROJECT_DIR$/osu.Desktop/bin/Debug/netcoreapp3.1/osu!.dll" />
<option name="PROGRAM_PARAMETERS" value="--sdl" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/osu.Desktop" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/osu.Desktop/bin/Debug/netcoreapp3.1" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
@ -12,9 +12,9 @@
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="1" />
<option name="PROJECT_KIND" value="DotNetCore" />
<option name="PROJECT_TFM" value=".NETCoreApp,Version=v3.0" />
<option name="PROJECT_TFM" value=".NETCoreApp,Version=v3.1" />
<method v="2">
<option name="Build" enabled="true" />
<option name="Build" />
</method>
</configuration>
</component>

View File

@ -1,8 +1,8 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="osu! (Tests)" type="DotNetProject" factoryName=".NET Project" folderName="osu!">
<configuration default="false" name="osu! (Tests)" type="DotNetProject" factoryName=".NET Project" folderName="osu!" activateToolWindowBeforeRun="false">
<option name="EXE_PATH" value="$PROJECT_DIR$/osu.Game.Tests/bin/Debug/netcoreapp3.1/osu.Game.Tests.dll" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/osu.Game.Tests" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/osu.Game.Tests/bin/Debug/netcoreapp3.1" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
@ -14,7 +14,7 @@
<option name="PROJECT_KIND" value="DotNetCore" />
<option name="PROJECT_TFM" value=".NETCoreApp,Version=v3.1" />
<method v="2">
<option name="Build" enabled="true" />
<option name="Build" />
</method>
</configuration>
</component>

View File

@ -51,7 +51,7 @@
<Reference Include="Java.Interop" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.602.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.619.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.622.1" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.623.0" />
</ItemGroup>
</Project>

View File

@ -25,8 +25,10 @@ namespace osu.Game.Rulesets.Mania.Judgements
return 200;
case HitResult.Great:
case HitResult.Perfect:
return 300;
case HitResult.Perfect:
return 320;
}
}
}

View File

@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
};
}
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
{
if (!drawableRepeat.IsHit)
Child.ScaleTo(1.3f).ScaleTo(1f, timingPoint.BeatLength, Easing.Out);

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Audio.Track;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -8,7 +9,6 @@ using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.Backgrounds;
using osuTK.Graphics;
using osu.Game.Beatmaps.ControlPoints;
using osu.Framework.Audio.Track;
using osu.Framework.Graphics.Effects;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
@ -148,7 +148,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces
};
}
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
{
if (!effectPoint.KiaiMode)
return;

View File

@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning
};
}
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
{
base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes);

View File

@ -83,7 +83,7 @@ namespace osu.Game.Rulesets.Taiko.UI
lastObjectHit = result.IsHit;
}
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
{
kiaiMode = effectPoint.KiaiMode;
}

View File

@ -46,7 +46,7 @@ namespace osu.Game.Rulesets.Taiko.UI
textureAnimation.Seek(0);
}
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
{
// assume that if the animation is playing on its own, it's independent from the beat and doesn't need to be touched.
if (textureAnimation.FrameCount == 0 || textureAnimation.IsPlaying)

View File

@ -174,9 +174,7 @@ namespace osu.Game.Tests.Visual.Gameplay
[Test]
public void TestExitFromGameplay()
{
AddStep("exit", () => Player.Exit());
confirmPaused();
// an externally triggered exit should immediately exit, skipping all pause logic.
AddStep("exit", () => Player.Exit());
confirmExited();
}

View File

@ -0,0 +1,15 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using NUnit.Framework;
using osu.Framework.Screens;
using osu.Game.Screens.Menu;
namespace osu.Game.Tests.Visual.Menus
{
[TestFixture]
public class TestSceneIntroWelcome : IntroTestScene
{
protected override IScreen CreateScreen() => new IntroWelcome();
}
}

View File

@ -177,7 +177,7 @@ namespace osu.Game.Tests.Visual.UserInterface
timeSinceLastBeat.Value = TimeSinceLastBeat;
}
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
{
base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes);

View File

@ -0,0 +1,28 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Tournament.Screens;
namespace osu.Game.Tournament.Tests.Screens
{
public class TestSceneStablePathSelectScreen : TournamentTestScene
{
public TestSceneStablePathSelectScreen()
{
AddStep("Add screen", () => Add(new StablePathSelectTestScreen()));
}
private class StablePathSelectTestScreen : StablePathSelectScreen
{
protected override void ChangePath()
{
Expire();
}
protected override void AutoDetect()
{
Expire();
}
}
}
}

View File

@ -0,0 +1,26 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics.Sprites;
using osu.Game.Overlays.Dialog;
namespace osu.Game.Tournament.Components
{
public class IPCErrorDialog : PopupDialog
{
public IPCErrorDialog(string headerText, string bodyText)
{
Icon = FontAwesome.Regular.SadTear;
HeaderText = headerText;
BodyText = bodyText;
Buttons = new PopupDialogButton[]
{
new PopupDialogOkButton
{
Text = @"Alright.",
Action = () => Expire()
}
};
}
}
}

View File

@ -4,6 +4,7 @@
using System;
using System.IO;
using System.Linq;
using JetBrains.Annotations;
using Microsoft.Win32;
using osu.Framework.Allocation;
using osu.Framework.Logging;
@ -20,6 +21,8 @@ namespace osu.Game.Tournament.IPC
{
public class FileBasedIPC : MatchIPCInfo
{
public Storage IPCStorage { get; private set; }
[Resolved]
protected IAPIProvider API { get; private set; }
@ -32,45 +35,46 @@ namespace osu.Game.Tournament.IPC
[Resolved]
private LadderInfo ladder { get; set; }
[Resolved]
private StableInfo stableInfo { get; set; }
private int lastBeatmapId;
private ScheduledDelegate scheduled;
private GetBeatmapRequest beatmapLookupRequest;
public Storage Storage { get; private set; }
[BackgroundDependencyLoader]
private void load()
{
LocateStableStorage();
var stablePath = stableInfo.StablePath ?? findStablePath();
initialiseIPCStorage(stablePath);
}
public Storage LocateStableStorage()
[CanBeNull]
private Storage initialiseIPCStorage(string path)
{
scheduled?.Cancel();
Storage = null;
IPCStorage = null;
try
{
var path = findStablePath();
if (string.IsNullOrEmpty(path))
return null;
Storage = new DesktopStorage(path, host as DesktopGameHost);
IPCStorage = new DesktopStorage(path, host as DesktopGameHost);
const string file_ipc_filename = "ipc.txt";
const string file_ipc_state_filename = "ipc-state.txt";
const string file_ipc_scores_filename = "ipc-scores.txt";
const string file_ipc_channel_filename = "ipc-channel.txt";
if (Storage.Exists(file_ipc_filename))
if (IPCStorage.Exists(file_ipc_filename))
{
scheduled = Scheduler.AddDelayed(delegate
{
try
{
using (var stream = Storage.GetStream(file_ipc_filename))
using (var stream = IPCStorage.GetStream(file_ipc_filename))
using (var sr = new StreamReader(stream))
{
var beatmapId = int.Parse(sr.ReadLine());
@ -104,7 +108,7 @@ namespace osu.Game.Tournament.IPC
try
{
using (var stream = Storage.GetStream(file_ipc_channel_filename))
using (var stream = IPCStorage.GetStream(file_ipc_channel_filename))
using (var sr = new StreamReader(stream))
{
ChatChannel.Value = sr.ReadLine();
@ -117,7 +121,7 @@ namespace osu.Game.Tournament.IPC
try
{
using (var stream = Storage.GetStream(file_ipc_state_filename))
using (var stream = IPCStorage.GetStream(file_ipc_state_filename))
using (var sr = new StreamReader(stream))
{
State.Value = (TourneyState)Enum.Parse(typeof(TourneyState), sr.ReadLine());
@ -130,7 +134,7 @@ namespace osu.Game.Tournament.IPC
try
{
using (var stream = Storage.GetStream(file_ipc_scores_filename))
using (var stream = IPCStorage.GetStream(file_ipc_scores_filename))
using (var sr = new StreamReader(stream))
{
Score1.Value = int.Parse(sr.ReadLine());
@ -149,54 +153,106 @@ namespace osu.Game.Tournament.IPC
Logger.Error(e, "Stable installation could not be found; disabling file based IPC");
}
return Storage;
return IPCStorage;
}
/// <summary>
/// Manually sets the path to the directory used for inter-process communication with a cutting-edge install.
/// </summary>
/// <param name="path">Path to the IPC directory</param>
/// <returns>Whether the supplied path was a valid IPC directory.</returns>
public bool SetIPCLocation(string path)
{
if (path == null || !ipcFileExistsInDirectory(path))
return false;
var newStorage = initialiseIPCStorage(stableInfo.StablePath = path);
if (newStorage == null)
return false;
stableInfo.SaveChanges();
return true;
}
/// <summary>
/// Tries to automatically detect the path to the directory used for inter-process communication
/// with a cutting-edge install.
/// </summary>
/// <returns>Whether an IPC directory was successfully auto-detected.</returns>
public bool AutoDetectIPCLocation() => SetIPCLocation(findStablePath());
private static bool ipcFileExistsInDirectory(string p) => p != null && File.Exists(Path.Combine(p, "ipc.txt"));
[CanBeNull]
private string findStablePath()
{
static bool checkExists(string p) => File.Exists(Path.Combine(p, "ipc.txt"));
var stableInstallPath = findFromEnvVar() ??
findFromRegistry() ??
findFromLocalAppData() ??
findFromDotFolder();
string stableInstallPath = string.Empty;
Logger.Log($"Stable path for tourney usage: {stableInstallPath}");
return stableInstallPath;
}
private string findFromEnvVar()
{
try
{
Logger.Log("Trying to find stable with environment variables");
string stableInstallPath = Environment.GetEnvironmentVariable("OSU_STABLE_PATH");
if (ipcFileExistsInDirectory(stableInstallPath))
return stableInstallPath;
}
catch
{
}
return null;
}
private string findFromLocalAppData()
{
Logger.Log("Trying to find stable in %LOCALAPPDATA%");
string stableInstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"osu!");
if (ipcFileExistsInDirectory(stableInstallPath))
return stableInstallPath;
return null;
}
private string findFromDotFolder()
{
Logger.Log("Trying to find stable in dotfolders");
string stableInstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".osu");
if (ipcFileExistsInDirectory(stableInstallPath))
return stableInstallPath;
return null;
}
private string findFromRegistry()
{
Logger.Log("Trying to find stable in registry");
try
{
try
{
stableInstallPath = Environment.GetEnvironmentVariable("OSU_STABLE_PATH");
string stableInstallPath;
if (checkExists(stableInstallPath))
return stableInstallPath;
}
catch
{
}
using (RegistryKey key = Registry.ClassesRoot.OpenSubKey("osu"))
stableInstallPath = key?.OpenSubKey(@"shell\open\command")?.GetValue(string.Empty).ToString().Split('"')[1].Replace("osu!.exe", "");
try
{
using (RegistryKey key = Registry.ClassesRoot.OpenSubKey("osu"))
stableInstallPath = key?.OpenSubKey(@"shell\open\command")?.GetValue(string.Empty).ToString().Split('"')[1].Replace("osu!.exe", "");
if (checkExists(stableInstallPath))
return stableInstallPath;
}
catch
{
}
stableInstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"osu!");
if (checkExists(stableInstallPath))
if (ipcFileExistsInDirectory(stableInstallPath))
return stableInstallPath;
stableInstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".osu");
if (checkExists(stableInstallPath))
return stableInstallPath;
return null;
}
finally
catch
{
Logger.Log($"Stable path for tourney usage: {stableInstallPath}");
}
return null;
}
}
}

View File

@ -0,0 +1,62 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.IO;
using Newtonsoft.Json;
using osu.Framework.Platform;
namespace osu.Game.Tournament.Models
{
/// <summary>
/// Holds the path to locate the osu! stable cutting-edge installation.
/// </summary>
[Serializable]
public class StableInfo
{
/// <summary>
/// Path to the IPC directory used by the stable (cutting-edge) install.
/// </summary>
public string StablePath { get; set; }
/// <summary>
/// Fired whenever stable info is successfully saved to file.
/// </summary>
public event Action OnStableInfoSaved;
private const string config_path = "tournament/stable.json";
private readonly Storage storage;
public StableInfo(Storage storage)
{
this.storage = storage;
if (!storage.Exists(config_path))
return;
using (Stream stream = storage.GetStream(config_path, FileAccess.Read, FileMode.Open))
using (var sr = new StreamReader(stream))
{
JsonConvert.PopulateObject(sr.ReadToEnd(), this);
}
}
public void SaveChanges()
{
using (var stream = storage.GetStream(config_path, FileAccess.Write, FileMode.Create))
using (var sw = new StreamWriter(stream))
{
sw.Write(JsonConvert.SerializeObject(this,
new JsonSerializerSettings
{
Formatting = Formatting.Indented,
NullValueHandling = NullValueHandling.Ignore,
DefaultValueHandling = DefaultValueHandling.Ignore,
}));
}
OnStableInfoSaved?.Invoke();
}
}
}

View File

@ -15,6 +15,7 @@ using osu.Game.Online.API;
using osu.Game.Overlays;
using osu.Game.Rulesets;
using osu.Game.Tournament.IPC;
using osu.Game.Tournament.Models;
using osuTK;
using osuTK.Graphics;
@ -30,12 +31,18 @@ namespace osu.Game.Tournament.Screens
[Resolved]
private MatchIPCInfo ipc { get; set; }
[Resolved]
private StableInfo stableInfo { get; set; }
[Resolved]
private IAPIProvider api { get; set; }
[Resolved]
private RulesetStore rulesets { get; set; }
[Resolved(canBeNull: true)]
private TournamentSceneManager sceneManager { get; set; }
private Bindable<Size> windowSize;
[BackgroundDependencyLoader]
@ -53,6 +60,7 @@ namespace osu.Game.Tournament.Screens
};
api.LocalUser.BindValueChanged(_ => Schedule(reload));
stableInfo.OnStableInfoSaved += () => Schedule(reload);
reload();
}
@ -62,21 +70,16 @@ namespace osu.Game.Tournament.Screens
private void reload()
{
var fileBasedIpc = ipc as FileBasedIPC;
fillFlow.Children = new Drawable[]
{
new ActionableInfo
{
Label = "Current IPC source",
ButtonText = "Refresh",
Action = () =>
{
fileBasedIpc?.LocateStableStorage();
reload();
},
Value = fileBasedIpc?.Storage?.GetFullPath(string.Empty) ?? "Not found",
Failing = fileBasedIpc?.Storage == null,
Description = "The osu!stable installation which is currently being used as a data source. If a source is not found, make sure you have created an empty ipc.txt in your stable cutting-edge installation, and that it is registered as the default osu! install."
ButtonText = "Change source",
Action = () => sceneManager?.SetScreen(new StablePathSelectScreen()),
Value = fileBasedIpc?.IPCStorage?.GetFullPath(string.Empty) ?? "Not found",
Failing = fileBasedIpc?.IPCStorage == null,
Description = "The osu!stable installation which is currently being used as a data source. If a source is not found, make sure you have created an empty ipc.txt in your stable cutting-edge installation."
},
new ActionableInfo
{

View File

@ -0,0 +1,164 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.IO;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Logging;
using osu.Framework.Platform;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Overlays;
using osu.Game.Tournament.IPC;
using osu.Game.Tournament.Components;
using osuTK;
namespace osu.Game.Tournament.Screens
{
public class StablePathSelectScreen : TournamentScreen
{
[Resolved]
private GameHost host { get; set; }
[Resolved(canBeNull: true)]
private TournamentSceneManager sceneManager { get; set; }
[Resolved]
private MatchIPCInfo ipc { get; set; }
private DirectorySelector directorySelector;
private DialogOverlay overlay;
[BackgroundDependencyLoader(true)]
private void load(Storage storage, OsuColour colours)
{
var initialStorage = (ipc as FileBasedIPC)?.IPCStorage ?? storage;
var initialPath = new DirectoryInfo(initialStorage.GetFullPath(string.Empty)).Parent?.FullName;
AddRangeInternal(new Drawable[]
{
new Container
{
Masking = true,
CornerRadius = 10,
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(0.5f, 0.8f),
Children = new Drawable[]
{
new Box
{
Colour = colours.GreySeafoamDark,
RelativeSizeAxes = Axes.Both,
},
new GridContainer
{
RelativeSizeAxes = Axes.Both,
RowDimensions = new[]
{
new Dimension(),
new Dimension(GridSizeMode.Relative, 0.8f),
new Dimension(),
},
Content = new[]
{
new Drawable[]
{
new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Text = "Please select a new location",
Font = OsuFont.Default.With(size: 40)
},
},
new Drawable[]
{
directorySelector = new DirectorySelector(initialPath)
{
RelativeSizeAxes = Axes.Both,
}
},
new Drawable[]
{
new FillFlowContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(20),
Children = new Drawable[]
{
new TriangleButton
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Width = 300,
Text = "Select stable path",
Action = ChangePath
},
new TriangleButton
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Width = 300,
Text = "Auto detect",
Action = AutoDetect
},
}
}
}
}
}
},
},
new BackButton
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
State = { Value = Visibility.Visible },
Action = () => sceneManager?.SetScreen(typeof(SetupScreen))
}
});
}
protected virtual void ChangePath()
{
var target = directorySelector.CurrentDirectory.Value.FullName;
var fileBasedIpc = ipc as FileBasedIPC;
Logger.Log($"Changing Stable CE location to {target}");
if (!fileBasedIpc?.SetIPCLocation(target) ?? true)
{
overlay = new DialogOverlay();
overlay.Push(new IPCErrorDialog("This is an invalid IPC Directory", "Select a directory that contains an osu! stable cutting edge installation and make sure it has an empty ipc.txt file in it."));
AddInternal(overlay);
Logger.Log("Folder is not an osu! stable CE directory");
return;
}
sceneManager?.SetScreen(typeof(SetupScreen));
}
protected virtual void AutoDetect()
{
var fileBasedIpc = ipc as FileBasedIPC;
if (!fileBasedIpc?.AutoDetectIPCLocation() ?? true)
{
overlay = new DialogOverlay();
overlay.Push(new IPCErrorDialog("Failed to auto detect", "An osu! stable cutting-edge installation could not be auto detected.\nPlease try and manually point to the directory."));
AddInternal(overlay);
}
else
{
sceneManager?.SetScreen(typeof(SetupScreen));
}
}
}
}

View File

@ -53,6 +53,8 @@ namespace osu.Game.Tournament
ladder.CurrentMatch.Value = ladder.Matches.FirstOrDefault(p => p.Current.Value);
dependencies.CacheAs(new StableInfo(storage));
dependencies.CacheAs<MatchIPCInfo>(ipc = new FileBasedIPC());
Add(ipc);
}

View File

@ -6,6 +6,7 @@ namespace osu.Game.Configuration
public enum IntroSequence
{
Circles,
Welcome,
Triangles,
Random
}

View File

@ -18,7 +18,7 @@ namespace osu.Game.Graphics.Containers
private TimingControlPoint lastTimingPoint;
/// <summary>
/// The amount of time before a beat we should fire <see cref="OnNewBeat(int, TimingControlPoint, EffectControlPoint, TrackAmplitudes)"/>.
/// The amount of time before a beat we should fire <see cref="OnNewBeat(int, TimingControlPoint, EffectControlPoint, ChannelAmplitudes)"/>.
/// This allows for adding easing to animations that may be synchronised to the beat.
/// </summary>
protected double EarlyActivationMilliseconds;
@ -50,7 +50,6 @@ namespace osu.Game.Graphics.Containers
private TimingControlPoint defaultTiming;
private EffectControlPoint defaultEffect;
private TrackAmplitudes defaultAmplitudes;
protected bool IsBeatSyncedWithTrack { get; private set; }
@ -107,7 +106,7 @@ namespace osu.Game.Graphics.Containers
return;
using (BeginDelayedSequence(-TimeSinceLastBeat, true))
OnNewBeat(beatIndex, timingPoint, effectPoint, track?.CurrentAmplitudes ?? defaultAmplitudes);
OnNewBeat(beatIndex, timingPoint, effectPoint, track?.CurrentAmplitudes ?? ChannelAmplitudes.Empty);
lastBeat = beatIndex;
lastTimingPoint = timingPoint;
@ -128,16 +127,9 @@ namespace osu.Game.Graphics.Containers
KiaiMode = false,
OmitFirstBarLine = false
};
defaultAmplitudes = new TrackAmplitudes
{
FrequencyAmplitudes = new float[256],
LeftChannel = 0,
RightChannel = 0
};
}
protected virtual void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)
protected virtual void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
{
}
}

View File

@ -13,7 +13,6 @@ using JetBrains.Annotations;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Textures;
using osu.Framework.Input.Events;
using osuTK.Input;
using osu.Framework.Utils;
namespace osu.Game.Graphics.Cursor
@ -74,17 +73,15 @@ namespace osu.Game.Graphics.Cursor
protected override bool OnMouseDown(MouseDownEvent e)
{
// only trigger animation for main mouse buttons
if (e.Button <= MouseButton.Right)
{
activeCursor.Scale = new Vector2(1);
activeCursor.ScaleTo(0.90f, 800, Easing.OutQuint);
activeCursor.Scale = new Vector2(1);
activeCursor.ScaleTo(0.90f, 800, Easing.OutQuint);
activeCursor.AdditiveLayer.Alpha = 0;
activeCursor.AdditiveLayer.FadeInFromZero(800, Easing.OutQuint);
}
activeCursor.AdditiveLayer.Alpha = 0;
activeCursor.AdditiveLayer.FadeInFromZero(800, Easing.OutQuint);
if (e.Button == MouseButton.Left && cursorRotate.Value)
if (cursorRotate.Value && dragRotationState != DragRotationState.Rotating)
{
// if cursor is already rotating don't reset its rotate origin
dragRotationState = DragRotationState.DragStarted;
positionMouseDown = e.MousePosition;
}
@ -94,17 +91,16 @@ namespace osu.Game.Graphics.Cursor
protected override void OnMouseUp(MouseUpEvent e)
{
if (!e.IsPressed(MouseButton.Left) && !e.IsPressed(MouseButton.Right))
if (!e.HasAnyButtonPressed)
{
activeCursor.AdditiveLayer.FadeOutFromOne(500, Easing.OutQuint);
activeCursor.ScaleTo(1, 500, Easing.OutElastic);
}
if (e.Button == MouseButton.Left)
{
if (dragRotationState == DragRotationState.Rotating)
if (dragRotationState != DragRotationState.NotDragging)
{
activeCursor.RotateTo(0, 600 * (1 + Math.Abs(activeCursor.Rotation / 720)), Easing.OutElasticHalf);
dragRotationState = DragRotationState.NotDragging;
dragRotationState = DragRotationState.NotDragging;
}
}
base.OnMouseUp(e);

View File

@ -147,7 +147,7 @@ namespace osu.Game.Graphics.UserInterface
};
}
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
{
if (!hasSelection)
this.FadeTo(0.7f).FadeTo(0.4f, timingPoint.BeatLength, Easing.InOutSine);

View File

@ -230,7 +230,7 @@ namespace osu.Game.Graphics.UserInterface
};
}
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
{
base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes);

View File

@ -78,7 +78,7 @@ namespace osu.Game.Rulesets.Mods
private const int bars_per_segment = 4;
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
{
base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes);

View File

@ -13,6 +13,7 @@ using osu.Framework.Graphics.Primitives;
using osu.Framework.Input;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
@ -82,6 +83,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
case NotifyCollectionChangedAction.Remove:
foreach (var o in args.OldItems)
SelectionBlueprints.FirstOrDefault(b => b.HitObject == o)?.Deselect();
break;
}
};
@ -250,6 +252,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
blueprint.Deselected -= onBlueprintDeselected;
SelectionBlueprints.Remove(blueprint);
if (movementBlueprint == blueprint)
finishSelectionMovement();
}
protected virtual void AddBlueprintFor(HitObject hitObject)
@ -320,10 +325,22 @@ namespace osu.Game.Screens.Edit.Compose.Components
{
foreach (var blueprint in SelectionBlueprints)
{
if (blueprint.IsAlive && blueprint.IsPresent && rect.Contains(blueprint.ScreenSpaceSelectionPoint))
blueprint.Select();
else
blueprint.Deselect();
// only run when utmost necessary to avoid unnecessary rect computations.
bool isValidForSelection() => blueprint.IsAlive && blueprint.IsPresent && rect.Contains(blueprint.ScreenSpaceSelectionPoint);
switch (blueprint.State)
{
case SelectionState.NotSelected:
if (isValidForSelection())
blueprint.Select();
break;
case SelectionState.Selected:
// if the editor is playing, we generally don't want to deselect objects even if outside the selection area.
if (!editorClock.IsRunning && !isValidForSelection())
blueprint.Deselect();
break;
}
}
}

View File

@ -53,6 +53,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
}
};
private RectangleF? dragRectangle;
/// <summary>
/// Handle a forwarded mouse event.
/// </summary>
@ -66,15 +68,14 @@ namespace osu.Game.Screens.Edit.Compose.Components
var dragQuad = new Quad(dragStartPosition.X, dragStartPosition.Y, dragPosition.X - dragStartPosition.X, dragPosition.Y - dragStartPosition.Y);
// We use AABBFloat instead of RectangleF since it handles negative sizes for us
var dragRectangle = dragQuad.AABBFloat;
var rec = dragQuad.AABBFloat;
dragRectangle = rec;
var topLeft = ToLocalSpace(dragRectangle.TopLeft);
var bottomRight = ToLocalSpace(dragRectangle.BottomRight);
var topLeft = ToLocalSpace(rec.TopLeft);
var bottomRight = ToLocalSpace(rec.BottomRight);
Box.Position = topLeft;
Box.Size = bottomRight - topLeft;
PerformSelection?.Invoke(dragRectangle);
return true;
}
@ -93,7 +94,19 @@ namespace osu.Game.Screens.Edit.Compose.Components
}
}
public override void Hide() => State = Visibility.Hidden;
protected override void Update()
{
base.Update();
if (dragRectangle != null)
PerformSelection?.Invoke(dragRectangle.Value);
}
public override void Hide()
{
State = Visibility.Hidden;
dragRectangle = null;
}
public override void Show() => State = Visibility.Visible;

View File

@ -51,6 +51,9 @@ namespace osu.Game.Screens
case IntroSequence.Circles:
return new IntroCircles();
case IntroSequence.Welcome:
return new IntroWelcome();
default:
return new IntroTriangles();
}

View File

@ -6,6 +6,7 @@ using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Audio.Track;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
@ -15,7 +16,6 @@ using osuTK.Graphics;
using osuTK.Input;
using osu.Framework.Extensions.Color4Extensions;
using osu.Game.Graphics.Containers;
using osu.Framework.Audio.Track;
using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Events;
@ -132,7 +132,7 @@ namespace osu.Game.Screens.Menu
private bool rightward;
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
{
base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes);

View File

@ -24,7 +24,7 @@ namespace osu.Game.Screens.Menu
private void load(AudioManager audio)
{
if (MenuVoice.Value)
welcome = audio.Samples.Get(@"welcome");
welcome = audio.Samples.Get(@"Intro/welcome");
}
protected override void LogoArriving(OsuLogo logo, bool resuming)

View File

@ -51,6 +51,8 @@ namespace osu.Game.Screens.Menu
private SampleChannel seeya;
protected virtual string SeeyaSampleName => "Intro/seeya";
private LeasedBindable<WorkingBeatmap> beatmap;
private MainMenu mainMenu;
@ -72,7 +74,7 @@ namespace osu.Game.Screens.Menu
MenuVoice = config.GetBindable<bool>(OsuSetting.MenuVoice);
MenuMusic = config.GetBindable<bool>(OsuSetting.MenuMusic);
seeya = audio.Samples.Get(@"seeya");
seeya = audio.Samples.Get(SeeyaSampleName);
BeatmapSetInfo setInfo = null;

View File

@ -47,7 +47,7 @@ namespace osu.Game.Screens.Menu
private void load()
{
if (MenuVoice.Value && !UsingThemedIntro)
welcome = audio.Samples.Get(@"welcome");
welcome = audio.Samples.Get(@"Intro/welcome");
}
protected override void LogoArriving(OsuLogo logo, bool resuming)

View File

@ -0,0 +1,150 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osuTK;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Screens;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Game.Screens.Backgrounds;
using osuTK.Graphics;
namespace osu.Game.Screens.Menu
{
public class IntroWelcome : IntroScreen
{
protected override string BeatmapHash => "64e00d7022195959bfa3109d09c2e2276c8f12f486b91fcf6175583e973b48f2";
protected override string BeatmapFile => "welcome.osz";
private const double delay_step_two = 2142;
private SampleChannel welcome;
private SampleChannel pianoReverb;
protected override string SeeyaSampleName => "Intro/Welcome/seeya";
protected override BackgroundScreen CreateBackground() => background = new BackgroundScreenDefault(false)
{
Alpha = 0,
};
private BackgroundScreenDefault background;
[BackgroundDependencyLoader]
private void load(AudioManager audio)
{
if (MenuVoice.Value)
welcome = audio.Samples.Get(@"Intro/Welcome/welcome");
pianoReverb = audio.Samples.Get(@"Intro/Welcome/welcome_piano");
}
protected override void LogoArriving(OsuLogo logo, bool resuming)
{
base.LogoArriving(logo, resuming);
if (!resuming)
{
LoadComponentAsync(new WelcomeIntroSequence
{
RelativeSizeAxes = Axes.Both
}, intro =>
{
PrepareMenuLoad();
intro.LogoVisualisation.AddAmplitudeSource(pianoReverb);
AddInternal(intro);
welcome?.Play();
pianoReverb?.Play();
Scheduler.AddDelayed(() =>
{
StartTrack();
const float fade_in_time = 200;
logo.ScaleTo(1);
logo.FadeIn(fade_in_time);
background.FadeIn(fade_in_time);
LoadMenu();
}, delay_step_two);
});
}
}
public override void OnResuming(IScreen last)
{
base.OnResuming(last);
background.FadeOut(100);
}
private class WelcomeIntroSequence : Container
{
private Sprite welcomeText;
private Container scaleContainer;
public LogoVisualisation LogoVisualisation { get; private set; }
[BackgroundDependencyLoader]
private void load(TextureStore textures)
{
Origin = Anchor.Centre;
Anchor = Anchor.Centre;
Children = new Drawable[]
{
scaleContainer = new Container
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Children = new Drawable[]
{
LogoVisualisation = new LogoVisualisation
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Alpha = 0.5f,
AccentColour = Color4.DarkBlue,
Size = new Vector2(0.96f)
},
new Circle
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(480),
Colour = Color4.Black
},
welcomeText = new Sprite
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Texture = textures.Get(@"Intro/Welcome/welcome_text")
},
}
},
};
}
protected override void LoadComplete()
{
base.LoadComplete();
using (BeginDelayedSequence(0, true))
{
scaleContainer.ScaleTo(0.9f).ScaleTo(1, delay_step_two).OnComplete(_ => Expire());
scaleContainer.FadeInFromZero(1800);
welcomeText.ScaleTo(new Vector2(1, 0)).ScaleTo(Vector2.One, 400, Easing.Out);
}
}
}
}
}

View File

@ -13,7 +13,11 @@ using osu.Framework.Graphics.Textures;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using System;
using System.Collections.Generic;
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Track;
using osu.Framework.Bindables;
using osu.Framework.Utils;
@ -65,6 +69,11 @@ namespace osu.Game.Screens.Menu
public Color4 AccentColour { get; set; }
/// <summary>
/// The relative movement of bars based on input amplification. Defaults to 1.
/// </summary>
public float Magnitude { get; set; } = 1;
private readonly float[] frequencyAmplitudes = new float[256];
private IShader shader;
@ -76,6 +85,13 @@ namespace osu.Game.Screens.Menu
Blending = BlendingParameters.Additive;
}
private readonly List<IHasAmplitudes> amplitudeSources = new List<IHasAmplitudes>();
public void AddAmplitudeSource(IHasAmplitudes amplitudeSource)
{
amplitudeSources.Add(amplitudeSource);
}
[BackgroundDependencyLoader]
private void load(ShaderManager shaders, IBindable<WorkingBeatmap> beatmap)
{
@ -83,27 +99,28 @@ namespace osu.Game.Screens.Menu
shader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, FragmentShaderDescriptor.TEXTURE_ROUNDED);
}
private readonly float[] temporalAmplitudes = new float[ChannelAmplitudes.AMPLITUDES_SIZE];
private void updateAmplitudes()
{
var track = beatmap.Value.TrackLoaded ? beatmap.Value.Track : null;
var effect = beatmap.Value.BeatmapLoaded ? beatmap.Value.Beatmap?.ControlPointInfo.EffectPointAt(track?.CurrentTime ?? Time.Current) : null;
var effect = beatmap.Value.BeatmapLoaded && beatmap.Value.TrackLoaded
? beatmap.Value.Beatmap?.ControlPointInfo.EffectPointAt(beatmap.Value.Track.CurrentTime)
: null;
float[] temporalAmplitudes = track?.CurrentAmplitudes.FrequencyAmplitudes;
for (int i = 0; i < temporalAmplitudes.Length; i++)
temporalAmplitudes[i] = 0;
if (beatmap.Value.TrackLoaded)
addAmplitudesFromSource(beatmap.Value.Track);
foreach (var source in amplitudeSources)
addAmplitudesFromSource(source);
for (int i = 0; i < bars_per_visualiser; i++)
{
if (track?.IsRunning ?? false)
{
float targetAmplitude = (temporalAmplitudes?[(i + indexOffset) % bars_per_visualiser] ?? 0) * (effect?.KiaiMode == true ? 1 : 0.5f);
if (targetAmplitude > frequencyAmplitudes[i])
frequencyAmplitudes[i] = targetAmplitude;
}
else
{
int index = (i + index_change) % bars_per_visualiser;
if (frequencyAmplitudes[index] > frequencyAmplitudes[i])
frequencyAmplitudes[i] = frequencyAmplitudes[index];
}
float targetAmplitude = (temporalAmplitudes[(i + indexOffset) % bars_per_visualiser]) * (effect?.KiaiMode == true ? 1 : 0.5f);
if (targetAmplitude > frequencyAmplitudes[i])
frequencyAmplitudes[i] = targetAmplitude;
}
indexOffset = (indexOffset + index_change) % bars_per_visualiser;
@ -136,6 +153,19 @@ namespace osu.Game.Screens.Menu
protected override DrawNode CreateDrawNode() => new VisualisationDrawNode(this);
private void addAmplitudesFromSource([NotNull] IHasAmplitudes source)
{
if (source == null) throw new ArgumentNullException(nameof(source));
var amplitudes = source.CurrentAmplitudes.FrequencyAmplitudes.Span;
for (int i = 0; i < amplitudes.Length; i++)
{
if (i < temporalAmplitudes.Length)
temporalAmplitudes[i] += amplitudes[i];
}
}
private class VisualisationDrawNode : DrawNode
{
protected new LogoVisualisation Source => (LogoVisualisation)base.Source;

View File

@ -3,7 +3,6 @@
using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Audio.Track;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
@ -16,6 +15,7 @@ using osu.Game.Skinning;
using osu.Game.Online.API;
using osu.Game.Users;
using System;
using osu.Framework.Audio.Track;
using osu.Framework.Bindables;
namespace osu.Game.Screens.Menu
@ -89,7 +89,7 @@ namespace osu.Game.Screens.Menu
skin.BindValueChanged(_ => updateColour(), true);
}
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
{
if (beatIndex < 0)
return;
@ -100,7 +100,7 @@ namespace osu.Game.Screens.Menu
flash(rightBox, timingPoint.BeatLength, effectPoint.KiaiMode, amplitudes);
}
private void flash(Drawable d, double beatLength, bool kiai, TrackAmplitudes amplitudes)
private void flash(Drawable d, double beatLength, bool kiai, ChannelAmplitudes amplitudes)
{
d.FadeTo(Math.Max(0, ((ReferenceEquals(d, leftBox) ? amplitudes.LeftChannel : amplitudes.RightChannel) - amplitude_dead_zone) / (kiai ? kiai_multiplier : alpha_multiplier)), box_fade_in_time)
.Then()

View File

@ -264,7 +264,7 @@ namespace osu.Game.Screens.Menu
private int lastBeatIndex;
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
{
base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes);

View File

@ -656,12 +656,6 @@ namespace osu.Game.Screens.Play
return true;
}
if (canPause)
{
Pause();
return true;
}
// GameplayClockContainer performs seeks / start / stop operations on the beatmap's track.
// as we are no longer the current screen, we cannot guarantee the track is still usable.
GameplayClockContainer?.StopUsingBeatmapClock();

View File

@ -24,8 +24,8 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="ppy.osu.Framework" Version="2020.619.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.602.0" />
<PackageReference Include="ppy.osu.Framework" Version="2020.623.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.622.1" />
<PackageReference Include="Sentry" Version="2.1.3" />
<PackageReference Include="SharpCompress" Version="0.25.1" />
<PackageReference Include="NUnit" Version="3.12.0" />

View File

@ -70,8 +70,8 @@
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup Label="Package References">
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.619.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.602.0" />
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.623.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.622.1" />
</ItemGroup>
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->
<ItemGroup Label="Transitive Dependencies">
@ -80,7 +80,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="ppy.osu.Framework" Version="2020.619.0" />
<PackageReference Include="ppy.osu.Framework" Version="2020.623.0" />
<PackageReference Include="SharpCompress" Version="0.25.1" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="SharpRaven" Version="2.4.0" />