mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 15:52:54 +08:00
Merge branch 'master' into judgement-pooling
This commit is contained in:
commit
3138cc455c
@ -52,6 +52,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.622.1" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.701.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.710.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
@ -9,7 +9,7 @@ using osu.Framework.Android;
|
||||
|
||||
namespace osu.Android
|
||||
{
|
||||
[Activity(Theme = "@android:style/Theme.NoTitleBar", MainLauncher = true, ScreenOrientation = ScreenOrientation.FullSensor, SupportsPictureInPicture = false, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize, HardwareAccelerated = true)]
|
||||
[Activity(Theme = "@android:style/Theme.NoTitleBar", MainLauncher = true, ScreenOrientation = ScreenOrientation.FullSensor, SupportsPictureInPicture = false, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize, HardwareAccelerated = false)]
|
||||
public class OsuGameActivity : AndroidGameActivity
|
||||
{
|
||||
protected override Framework.Game CreateGame() => new OsuGameAndroid();
|
||||
|
@ -21,11 +21,13 @@ using osu.Game.Rulesets.Difficulty;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Scoring;
|
||||
using System;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Rulesets.Catch.Skinning;
|
||||
using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch
|
||||
{
|
||||
[ExcludeFromDynamicCompile]
|
||||
public class CatchRuleset : Ruleset, ILegacyRuleset
|
||||
{
|
||||
public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList<Mod> mods = null) => new DrawableCatchRuleset(this, beatmap, mods);
|
||||
|
Before Width: | Height: | Size: 165 B After Width: | Height: | Size: 165 B |
Before Width: | Height: | Size: 899 B After Width: | Height: | Size: 899 B |
@ -9,4 +9,6 @@ Hit50: mania/hit50
|
||||
Hit100: mania/hit100
|
||||
Hit200: mania/hit200
|
||||
Hit300: mania/hit300
|
||||
Hit300g: mania/hit300g
|
||||
Hit300g: mania/hit300g
|
||||
StageLeft: mania/stage-left
|
||||
StageRight: mania/stage-right
|
@ -12,6 +12,7 @@ using System.Linq;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Rulesets.Mania.Replays;
|
||||
using osu.Game.Rulesets.Replays.Types;
|
||||
@ -34,6 +35,7 @@ using osu.Game.Screens.Ranking.Statistics;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania
|
||||
{
|
||||
[ExcludeFromDynamicCompile]
|
||||
public class ManiaRuleset : Ruleset, ILegacyRuleset
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -67,7 +67,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
if (auto && !userTriggered && Time.Current > Spinner.StartTime + Spinner.Duration / 2 && Progress < 1)
|
||||
{
|
||||
// force completion only once to not break human interaction
|
||||
Disc.RotationAbsolute = Spinner.SpinsRequired * 360;
|
||||
Disc.CumulativeRotation = Spinner.SpinsRequired * 360;
|
||||
auto = false;
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,12 @@ using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||
using osuTK;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Replays;
|
||||
using osu.Game.Rulesets.Osu.Replays;
|
||||
using osu.Game.Rulesets.Osu.UI;
|
||||
using osu.Game.Rulesets.Replays;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Storyboards;
|
||||
using static osu.Game.Tests.Visual.OsuTestScene.ClockBackedTestWorkingBeatmap;
|
||||
|
||||
@ -36,6 +42,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
}
|
||||
|
||||
private DrawableSpinner drawableSpinner;
|
||||
private SpriteIcon spinnerSymbol => drawableSpinner.ChildrenOfType<SpriteIcon>().Single();
|
||||
|
||||
[SetUpSteps]
|
||||
public override void SetUpSteps()
|
||||
@ -50,25 +57,78 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
public void TestSpinnerRewindingRotation()
|
||||
{
|
||||
addSeekStep(5000);
|
||||
AddAssert("is rotation absolute not almost 0", () => !Precision.AlmostEquals(drawableSpinner.Disc.RotationAbsolute, 0, 100));
|
||||
AddAssert("is disc rotation not almost 0", () => !Precision.AlmostEquals(drawableSpinner.Disc.Rotation, 0, 100));
|
||||
AddAssert("is disc rotation absolute not almost 0", () => !Precision.AlmostEquals(drawableSpinner.Disc.CumulativeRotation, 0, 100));
|
||||
|
||||
addSeekStep(0);
|
||||
AddAssert("is rotation absolute almost 0", () => Precision.AlmostEquals(drawableSpinner.Disc.RotationAbsolute, 0, 100));
|
||||
AddAssert("is disc rotation almost 0", () => Precision.AlmostEquals(drawableSpinner.Disc.Rotation, 0, 100));
|
||||
AddAssert("is disc rotation absolute almost 0", () => Precision.AlmostEquals(drawableSpinner.Disc.CumulativeRotation, 0, 100));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSpinnerMiddleRewindingRotation()
|
||||
{
|
||||
double estimatedRotation = 0;
|
||||
double finalAbsoluteDiscRotation = 0, finalRelativeDiscRotation = 0, finalSpinnerSymbolRotation = 0;
|
||||
|
||||
addSeekStep(5000);
|
||||
AddStep("retrieve rotation", () => estimatedRotation = drawableSpinner.Disc.RotationAbsolute);
|
||||
AddStep("retrieve disc relative rotation", () => finalRelativeDiscRotation = drawableSpinner.Disc.Rotation);
|
||||
AddStep("retrieve disc absolute rotation", () => finalAbsoluteDiscRotation = drawableSpinner.Disc.CumulativeRotation);
|
||||
AddStep("retrieve spinner symbol rotation", () => finalSpinnerSymbolRotation = spinnerSymbol.Rotation);
|
||||
|
||||
addSeekStep(2500);
|
||||
AddUntilStep("disc rotation rewound",
|
||||
// we want to make sure that the rotation at time 2500 is in the same direction as at time 5000, but about half-way in.
|
||||
() => Precision.AlmostEquals(drawableSpinner.Disc.Rotation, finalRelativeDiscRotation / 2, 100));
|
||||
AddUntilStep("symbol rotation rewound",
|
||||
() => Precision.AlmostEquals(spinnerSymbol.Rotation, finalSpinnerSymbolRotation / 2, 100));
|
||||
|
||||
addSeekStep(5000);
|
||||
AddAssert("is rotation absolute almost same", () => Precision.AlmostEquals(drawableSpinner.Disc.RotationAbsolute, estimatedRotation, 100));
|
||||
AddAssert("is disc rotation almost same",
|
||||
() => Precision.AlmostEquals(drawableSpinner.Disc.Rotation, finalRelativeDiscRotation, 100));
|
||||
AddAssert("is symbol rotation almost same",
|
||||
() => Precision.AlmostEquals(spinnerSymbol.Rotation, finalSpinnerSymbolRotation, 100));
|
||||
AddAssert("is disc rotation absolute almost same",
|
||||
() => Precision.AlmostEquals(drawableSpinner.Disc.CumulativeRotation, finalAbsoluteDiscRotation, 100));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRotationDirection([Values(true, false)] bool clockwise)
|
||||
{
|
||||
if (clockwise)
|
||||
{
|
||||
AddStep("flip replay", () =>
|
||||
{
|
||||
var drawableRuleset = this.ChildrenOfType<DrawableOsuRuleset>().Single();
|
||||
var score = drawableRuleset.ReplayScore;
|
||||
var scoreWithFlippedReplay = new Score
|
||||
{
|
||||
ScoreInfo = score.ScoreInfo,
|
||||
Replay = flipReplay(score.Replay)
|
||||
};
|
||||
drawableRuleset.SetReplayScore(scoreWithFlippedReplay);
|
||||
});
|
||||
}
|
||||
|
||||
addSeekStep(5000);
|
||||
|
||||
AddAssert("disc spin direction correct", () => clockwise ? drawableSpinner.Disc.Rotation > 0 : drawableSpinner.Disc.Rotation < 0);
|
||||
AddAssert("spinner symbol direction correct", () => clockwise ? spinnerSymbol.Rotation > 0 : spinnerSymbol.Rotation < 0);
|
||||
}
|
||||
|
||||
private Replay flipReplay(Replay scoreReplay) => new Replay
|
||||
{
|
||||
Frames = scoreReplay
|
||||
.Frames
|
||||
.Cast<OsuReplayFrame>()
|
||||
.Select(replayFrame =>
|
||||
{
|
||||
var flippedPosition = new Vector2(OsuPlayfield.BASE_SIZE.X - replayFrame.Position.X, replayFrame.Position.Y);
|
||||
return new OsuReplayFrame(replayFrame.Time, flippedPosition, replayFrame.Actions.ToArray());
|
||||
})
|
||||
.Cast<ReplayFrame>()
|
||||
.ToList()
|
||||
};
|
||||
|
||||
[Test]
|
||||
public void TestSpinPerMinuteOnRewind()
|
||||
{
|
||||
|
@ -14,6 +14,7 @@ using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Screens.Ranking;
|
||||
|
||||
@ -137,7 +138,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
positionBindable.BindTo(HitObject.PositionBindable);
|
||||
}
|
||||
|
||||
public float Progress => Math.Clamp(Disc.RotationAbsolute / 360 / Spinner.SpinsRequired, 0, 1);
|
||||
public float Progress => Math.Clamp(Disc.CumulativeRotation / 360 / Spinner.SpinsRequired, 0, 1);
|
||||
|
||||
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
||||
{
|
||||
@ -190,12 +191,13 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
|
||||
circle.Rotation = Disc.Rotation;
|
||||
Ticks.Rotation = Disc.Rotation;
|
||||
SpmCounter.SetRotation(Disc.RotationAbsolute);
|
||||
SpmCounter.SetRotation(Disc.CumulativeRotation);
|
||||
|
||||
float relativeCircleScale = Spinner.Scale * circle.DrawHeight / mainContainer.DrawHeight;
|
||||
Disc.ScaleTo(relativeCircleScale + (1 - relativeCircleScale) * Progress, 200, Easing.OutQuint);
|
||||
float targetScale = relativeCircleScale + (1 - relativeCircleScale) * Progress;
|
||||
Disc.Scale = new Vector2((float)Interpolation.Lerp(Disc.Scale.X, targetScale, Math.Clamp(Math.Abs(Time.Elapsed) / 100, 0, 1)));
|
||||
|
||||
symbol.RotateTo(Disc.Rotation / 2, 500, Easing.OutQuint);
|
||||
symbol.Rotation = (float)Interpolation.Lerp(symbol.Rotation, Disc.Rotation / 2, Math.Clamp(Math.Abs(Time.Elapsed) / 40, 0, 1));
|
||||
}
|
||||
|
||||
protected override void UpdateInitialTransforms()
|
||||
@ -205,9 +207,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
circleContainer.ScaleTo(Spinner.Scale * 0.3f);
|
||||
circleContainer.ScaleTo(Spinner.Scale, HitObject.TimePreempt / 1.4f, Easing.OutQuint);
|
||||
|
||||
Disc.RotateTo(-720);
|
||||
symbol.RotateTo(-720);
|
||||
|
||||
mainContainer
|
||||
.ScaleTo(0)
|
||||
.ScaleTo(Spinner.Scale * circle.DrawHeight / DrawHeight * 1.4f, HitObject.TimePreempt - 150, Easing.OutQuint)
|
||||
|
@ -73,6 +73,19 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The total rotation performed on the spinner disc, disregarding the spin direction.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This value is always non-negative and is monotonically increasing with time
|
||||
/// (i.e. will only increase if time is passing forward, but can decrease during rewind).
|
||||
/// </remarks>
|
||||
/// <example>
|
||||
/// If the spinner is spun 360 degrees clockwise and then 360 degrees counter-clockwise,
|
||||
/// this property will return the value of 720 (as opposed to 0 for <see cref="Drawable.Rotation"/>).
|
||||
/// </example>
|
||||
public float CumulativeRotation;
|
||||
|
||||
/// <summary>
|
||||
/// Whether currently in the correct time range to allow spinning.
|
||||
/// </summary>
|
||||
@ -88,10 +101,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
|
||||
private float lastAngle;
|
||||
private float currentRotation;
|
||||
public float RotationAbsolute;
|
||||
private int completeTick;
|
||||
|
||||
private bool updateCompleteTick() => completeTick != (completeTick = (int)(RotationAbsolute / 360));
|
||||
private bool updateCompleteTick() => completeTick != (completeTick = (int)(CumulativeRotation / 360));
|
||||
|
||||
private bool rotationTransferred;
|
||||
|
||||
@ -149,7 +161,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
}
|
||||
|
||||
currentRotation += angle;
|
||||
RotationAbsolute += Math.Abs(angle) * Math.Sign(Clock.ElapsedFrameTime);
|
||||
CumulativeRotation += Math.Abs(angle) * Math.Sign(Clock.ElapsedFrameTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Osu.Judgements;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Objects
|
||||
@ -24,6 +25,13 @@ namespace osu.Game.Rulesets.Osu.Objects
|
||||
|
||||
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
||||
|
||||
public override Judgement CreateJudgement() => new SliderRepeat.SliderRepeatJudgement();
|
||||
public override Judgement CreateJudgement() => new SliderTailJudgement();
|
||||
|
||||
public class SliderTailJudgement : OsuJudgement
|
||||
{
|
||||
protected override int NumericResultFor(HitResult result) => 0;
|
||||
|
||||
public override bool AffectsCombo => false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,12 +30,14 @@ using osu.Game.Scoring;
|
||||
using osu.Game.Skinning;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Rulesets.Osu.Statistics;
|
||||
using osu.Game.Screens.Ranking.Statistics;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu
|
||||
{
|
||||
[ExcludeFromDynamicCompile]
|
||||
public class OsuRuleset : Ruleset, ILegacyRuleset
|
||||
{
|
||||
public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList<Mod> mods = null) => new DrawableOsuRuleset(this, beatmap, mods);
|
||||
|
@ -22,6 +22,7 @@ using osu.Game.Rulesets.Taiko.Scoring;
|
||||
using osu.Game.Scoring;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Taiko.Edit;
|
||||
using osu.Game.Rulesets.Taiko.Objects;
|
||||
@ -31,6 +32,7 @@ using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko
|
||||
{
|
||||
[ExcludeFromDynamicCompile]
|
||||
public class TaikoRuleset : Ruleset, ILegacyRuleset
|
||||
{
|
||||
public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList<Mod> mods = null) => new DrawableTaikoRuleset(this, beatmap, mods);
|
||||
|
@ -19,24 +19,18 @@ namespace osu.Game.Tests.NonVisual
|
||||
[TestFixture]
|
||||
public class CustomDataDirectoryTest
|
||||
{
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
if (Directory.Exists(customPath))
|
||||
Directory.Delete(customPath, true);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDefaultDirectory()
|
||||
{
|
||||
using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestDefaultDirectory)))
|
||||
using (HeadlessGameHost host = new CustomTestHeadlessGameHost(nameof(TestDefaultDirectory)))
|
||||
{
|
||||
try
|
||||
{
|
||||
string defaultStorageLocation = getDefaultLocationFor(nameof(TestDefaultDirectory));
|
||||
|
||||
var osu = loadOsu(host);
|
||||
var storage = osu.Dependencies.Get<Storage>();
|
||||
|
||||
string defaultStorageLocation = Path.Combine(RuntimeInfo.StartupDirectory, "headless", nameof(TestDefaultDirectory));
|
||||
Assert.That(storage.GetFullPath("."), Is.EqualTo(defaultStorageLocation));
|
||||
}
|
||||
finally
|
||||
@ -46,21 +40,14 @@ namespace osu.Game.Tests.NonVisual
|
||||
}
|
||||
}
|
||||
|
||||
private string customPath => Path.Combine(RuntimeInfo.StartupDirectory, "custom-path");
|
||||
|
||||
[Test]
|
||||
public void TestCustomDirectory()
|
||||
{
|
||||
using (var host = new HeadlessGameHost(nameof(TestCustomDirectory)))
|
||||
string customPath = prepareCustomPath();
|
||||
|
||||
using (var host = new CustomTestHeadlessGameHost(nameof(TestCustomDirectory)))
|
||||
{
|
||||
string defaultStorageLocation = Path.Combine(RuntimeInfo.StartupDirectory, "headless", nameof(TestCustomDirectory));
|
||||
|
||||
// need access before the game has constructed its own storage yet.
|
||||
Storage storage = new DesktopStorage(defaultStorageLocation, host);
|
||||
// manual cleaning so we can prepare a config file.
|
||||
storage.DeleteDirectory(string.Empty);
|
||||
|
||||
using (var storageConfig = new StorageConfigManager(storage))
|
||||
using (var storageConfig = new StorageConfigManager(host.InitialStorage))
|
||||
storageConfig.Set(StorageConfig.FullPath, customPath);
|
||||
|
||||
try
|
||||
@ -68,7 +55,7 @@ namespace osu.Game.Tests.NonVisual
|
||||
var osu = loadOsu(host);
|
||||
|
||||
// switch to DI'd storage
|
||||
storage = osu.Dependencies.Get<Storage>();
|
||||
var storage = osu.Dependencies.Get<Storage>();
|
||||
|
||||
Assert.That(storage.GetFullPath("."), Is.EqualTo(customPath));
|
||||
}
|
||||
@ -82,16 +69,11 @@ namespace osu.Game.Tests.NonVisual
|
||||
[Test]
|
||||
public void TestSubDirectoryLookup()
|
||||
{
|
||||
using (var host = new HeadlessGameHost(nameof(TestSubDirectoryLookup)))
|
||||
string customPath = prepareCustomPath();
|
||||
|
||||
using (var host = new CustomTestHeadlessGameHost(nameof(TestSubDirectoryLookup)))
|
||||
{
|
||||
string defaultStorageLocation = Path.Combine(RuntimeInfo.StartupDirectory, "headless", nameof(TestSubDirectoryLookup));
|
||||
|
||||
// need access before the game has constructed its own storage yet.
|
||||
Storage storage = new DesktopStorage(defaultStorageLocation, host);
|
||||
// manual cleaning so we can prepare a config file.
|
||||
storage.DeleteDirectory(string.Empty);
|
||||
|
||||
using (var storageConfig = new StorageConfigManager(storage))
|
||||
using (var storageConfig = new StorageConfigManager(host.InitialStorage))
|
||||
storageConfig.Set(StorageConfig.FullPath, customPath);
|
||||
|
||||
try
|
||||
@ -99,7 +81,7 @@ namespace osu.Game.Tests.NonVisual
|
||||
var osu = loadOsu(host);
|
||||
|
||||
// switch to DI'd storage
|
||||
storage = osu.Dependencies.Get<Storage>();
|
||||
var storage = osu.Dependencies.Get<Storage>();
|
||||
|
||||
string actualTestFile = Path.Combine(customPath, "rulesets", "test");
|
||||
|
||||
@ -120,10 +102,14 @@ namespace osu.Game.Tests.NonVisual
|
||||
[Test]
|
||||
public void TestMigration()
|
||||
{
|
||||
using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestMigration)))
|
||||
string customPath = prepareCustomPath();
|
||||
|
||||
using (HeadlessGameHost host = new CustomTestHeadlessGameHost(nameof(TestMigration)))
|
||||
{
|
||||
try
|
||||
{
|
||||
string defaultStorageLocation = getDefaultLocationFor(nameof(TestMigration));
|
||||
|
||||
var osu = loadOsu(host);
|
||||
var storage = osu.Dependencies.Get<Storage>();
|
||||
|
||||
@ -139,8 +125,6 @@ namespace osu.Game.Tests.NonVisual
|
||||
// for testing nested files are not ignored (only top level)
|
||||
host.Storage.GetStorageForDirectory("test-nested").GetStorageForDirectory("cache");
|
||||
|
||||
string defaultStorageLocation = Path.Combine(RuntimeInfo.StartupDirectory, "headless", nameof(TestMigration));
|
||||
|
||||
Assert.That(storage.GetFullPath("."), Is.EqualTo(defaultStorageLocation));
|
||||
|
||||
osu.Migrate(customPath);
|
||||
@ -178,14 +162,15 @@ namespace osu.Game.Tests.NonVisual
|
||||
[Test]
|
||||
public void TestMigrationBetweenTwoTargets()
|
||||
{
|
||||
using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestMigrationBetweenTwoTargets)))
|
||||
string customPath = prepareCustomPath();
|
||||
string customPath2 = prepareCustomPath("-2");
|
||||
|
||||
using (HeadlessGameHost host = new CustomTestHeadlessGameHost(nameof(TestMigrationBetweenTwoTargets)))
|
||||
{
|
||||
try
|
||||
{
|
||||
var osu = loadOsu(host);
|
||||
|
||||
string customPath2 = $"{customPath}-2";
|
||||
|
||||
const string database_filename = "client.db";
|
||||
|
||||
Assert.DoesNotThrow(() => osu.Migrate(customPath));
|
||||
@ -207,7 +192,9 @@ namespace osu.Game.Tests.NonVisual
|
||||
[Test]
|
||||
public void TestMigrationToSameTargetFails()
|
||||
{
|
||||
using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestMigrationToSameTargetFails)))
|
||||
string customPath = prepareCustomPath();
|
||||
|
||||
using (HeadlessGameHost host = new CustomTestHeadlessGameHost(nameof(TestMigrationToSameTargetFails)))
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -226,7 +213,9 @@ namespace osu.Game.Tests.NonVisual
|
||||
[Test]
|
||||
public void TestMigrationToNestedTargetFails()
|
||||
{
|
||||
using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestMigrationToNestedTargetFails)))
|
||||
string customPath = prepareCustomPath();
|
||||
|
||||
using (HeadlessGameHost host = new CustomTestHeadlessGameHost(nameof(TestMigrationToNestedTargetFails)))
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -253,7 +242,9 @@ namespace osu.Game.Tests.NonVisual
|
||||
[Test]
|
||||
public void TestMigrationToSeeminglyNestedTarget()
|
||||
{
|
||||
using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestMigrationToSeeminglyNestedTarget)))
|
||||
string customPath = prepareCustomPath();
|
||||
|
||||
using (HeadlessGameHost host = new CustomTestHeadlessGameHost(nameof(TestMigrationToSeeminglyNestedTarget)))
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -282,6 +273,7 @@ namespace osu.Game.Tests.NonVisual
|
||||
var osu = new OsuGameBase();
|
||||
Task.Run(() => host.Run(osu));
|
||||
waitForOrAssert(() => osu.IsLoaded, @"osu! failed to start in a reasonable amount of time");
|
||||
|
||||
return osu;
|
||||
}
|
||||
|
||||
@ -294,5 +286,39 @@ namespace osu.Game.Tests.NonVisual
|
||||
|
||||
Assert.IsTrue(task.Wait(timeout), failureMessage);
|
||||
}
|
||||
|
||||
private static string getDefaultLocationFor(string testTypeName)
|
||||
{
|
||||
string path = Path.Combine(RuntimeInfo.StartupDirectory, "headless", testTypeName);
|
||||
|
||||
if (Directory.Exists(path))
|
||||
Directory.Delete(path, true);
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
private string prepareCustomPath(string suffix = "")
|
||||
{
|
||||
string path = Path.Combine(RuntimeInfo.StartupDirectory, $"custom-path{suffix}");
|
||||
|
||||
if (Directory.Exists(path))
|
||||
Directory.Delete(path, true);
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
public class CustomTestHeadlessGameHost : HeadlessGameHost
|
||||
{
|
||||
public Storage InitialStorage { get; }
|
||||
|
||||
public CustomTestHeadlessGameHost(string name)
|
||||
: base(name)
|
||||
{
|
||||
string defaultStorageLocation = getDefaultLocationFor(name);
|
||||
|
||||
InitialStorage = new DesktopStorage(defaultStorageLocation, this);
|
||||
InitialStorage.DeleteDirectory(string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
60
osu.Game.Tests/Visual/Multiplayer/RoomManagerTestScene.cs
Normal file
60
osu.Game.Tests/Visual/Multiplayer/RoomManagerTestScene.cs
Normal file
@ -0,0 +1,60 @@
|
||||
// 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 osu.Framework.Allocation;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Screens.Multi;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Multiplayer
|
||||
{
|
||||
public abstract class RoomManagerTestScene : MultiplayerTestScene
|
||||
{
|
||||
[Cached(Type = typeof(IRoomManager))]
|
||||
protected TestRoomManager RoomManager { get; } = new TestRoomManager();
|
||||
|
||||
public override void SetUpSteps()
|
||||
{
|
||||
base.SetUpSteps();
|
||||
|
||||
AddStep("clear rooms", () => RoomManager.Rooms.Clear());
|
||||
}
|
||||
|
||||
protected void AddRooms(int count, RulesetInfo ruleset = null)
|
||||
{
|
||||
AddStep("add rooms", () =>
|
||||
{
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
var room = new Room
|
||||
{
|
||||
RoomID = { Value = i },
|
||||
Name = { Value = $"Room {i}" },
|
||||
Host = { Value = new User { Username = "Host" } },
|
||||
EndDate = { Value = DateTimeOffset.Now + TimeSpan.FromSeconds(10) }
|
||||
};
|
||||
|
||||
if (ruleset != null)
|
||||
{
|
||||
room.Playlist.Add(new PlaylistItem
|
||||
{
|
||||
Ruleset = { Value = ruleset },
|
||||
Beatmap =
|
||||
{
|
||||
Value = new BeatmapInfo
|
||||
{
|
||||
Metadata = new BeatmapMetadata()
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
RoomManager.Rooms.Add(room);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
35
osu.Game.Tests/Visual/Multiplayer/TestRoomManager.cs
Normal file
35
osu.Game.Tests/Visual/Multiplayer/TestRoomManager.cs
Normal file
@ -0,0 +1,35 @@
|
||||
// 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 osu.Framework.Bindables;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Screens.Multi;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Multiplayer
|
||||
{
|
||||
public class TestRoomManager : IRoomManager
|
||||
{
|
||||
public event Action RoomsUpdated
|
||||
{
|
||||
add { }
|
||||
remove { }
|
||||
}
|
||||
|
||||
public readonly BindableList<Room> Rooms = new BindableList<Room>();
|
||||
|
||||
public Bindable<bool> InitialRoomsReceived { get; } = new Bindable<bool>(true);
|
||||
|
||||
IBindableList<Room> IRoomManager.Rooms => Rooms;
|
||||
|
||||
public void CreateRoom(Room room, Action<Room> onSuccess = null, Action<string> onError = null) => Rooms.Add(room);
|
||||
|
||||
public void JoinRoom(Room room, Action<Room> onSuccess = null, Action<string> onError = null)
|
||||
{
|
||||
}
|
||||
|
||||
public void PartRoom()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -16,7 +16,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
[SetUp]
|
||||
public void Setup() => Schedule(() =>
|
||||
{
|
||||
Room.CopyFrom(new Room());
|
||||
Room = new Room();
|
||||
|
||||
Child = new RoomInfo
|
||||
{
|
||||
|
@ -1,30 +1,22 @@
|
||||
// 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.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Catch;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Screens.Multi;
|
||||
using osu.Game.Screens.Multi.Lounge.Components;
|
||||
using osu.Game.Users;
|
||||
using osuTK.Graphics;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Multiplayer
|
||||
{
|
||||
public class TestSceneLoungeRoomsContainer : MultiplayerTestScene
|
||||
public class TestSceneLoungeRoomsContainer : RoomManagerTestScene
|
||||
{
|
||||
[Cached(Type = typeof(IRoomManager))]
|
||||
private TestRoomManager roomManager = new TestRoomManager();
|
||||
|
||||
private RoomsContainer container;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -39,34 +31,57 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
};
|
||||
}
|
||||
|
||||
public override void SetUpSteps()
|
||||
{
|
||||
base.SetUpSteps();
|
||||
|
||||
AddStep("clear rooms", () => roomManager.Rooms.Clear());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestBasicListChanges()
|
||||
{
|
||||
addRooms(3);
|
||||
AddRooms(3);
|
||||
|
||||
AddAssert("has 3 rooms", () => container.Rooms.Count == 3);
|
||||
AddStep("remove first room", () => roomManager.Rooms.Remove(roomManager.Rooms.FirstOrDefault()));
|
||||
AddStep("remove first room", () => RoomManager.Rooms.Remove(RoomManager.Rooms.FirstOrDefault()));
|
||||
AddAssert("has 2 rooms", () => container.Rooms.Count == 2);
|
||||
AddAssert("first room removed", () => container.Rooms.All(r => r.Room.RoomID.Value != 0));
|
||||
|
||||
AddStep("select first room", () => container.Rooms.First().Action?.Invoke());
|
||||
AddAssert("first room selected", () => Room == roomManager.Rooms.First());
|
||||
AddAssert("first room selected", () => checkRoomSelected(RoomManager.Rooms.First()));
|
||||
|
||||
AddStep("join first room", () => container.Rooms.First().Action?.Invoke());
|
||||
AddAssert("first room joined", () => roomManager.Rooms.First().Status.Value is JoinedRoomStatus);
|
||||
AddAssert("first room joined", () => RoomManager.Rooms.First().Status.Value is JoinedRoomStatus);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestKeyboardNavigation()
|
||||
{
|
||||
AddRooms(3);
|
||||
|
||||
AddAssert("no selection", () => checkRoomSelected(null));
|
||||
|
||||
press(Key.Down);
|
||||
AddAssert("first room selected", () => checkRoomSelected(RoomManager.Rooms.First()));
|
||||
|
||||
press(Key.Up);
|
||||
AddAssert("first room selected", () => checkRoomSelected(RoomManager.Rooms.First()));
|
||||
|
||||
press(Key.Down);
|
||||
press(Key.Down);
|
||||
AddAssert("last room selected", () => checkRoomSelected(RoomManager.Rooms.Last()));
|
||||
|
||||
press(Key.Enter);
|
||||
AddAssert("last room joined", () => RoomManager.Rooms.Last().Status.Value is JoinedRoomStatus);
|
||||
}
|
||||
|
||||
private void press(Key down)
|
||||
{
|
||||
AddStep($"press {down}", () =>
|
||||
{
|
||||
InputManager.PressKey(down);
|
||||
InputManager.ReleaseKey(down);
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestStringFiltering()
|
||||
{
|
||||
addRooms(4);
|
||||
AddRooms(4);
|
||||
|
||||
AddUntilStep("4 rooms visible", () => container.Rooms.Count(r => r.IsPresent) == 4);
|
||||
|
||||
@ -82,8 +97,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
[Test]
|
||||
public void TestRulesetFiltering()
|
||||
{
|
||||
addRooms(2, new OsuRuleset().RulesetInfo);
|
||||
addRooms(3, new CatchRuleset().RulesetInfo);
|
||||
AddRooms(2, new OsuRuleset().RulesetInfo);
|
||||
AddRooms(3, new CatchRuleset().RulesetInfo);
|
||||
|
||||
AddUntilStep("5 rooms visible", () => container.Rooms.Count(r => r.IsPresent) == 5);
|
||||
|
||||
@ -96,67 +111,10 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
AddUntilStep("3 rooms visible", () => container.Rooms.Count(r => r.IsPresent) == 3);
|
||||
}
|
||||
|
||||
private void addRooms(int count, RulesetInfo ruleset = null)
|
||||
{
|
||||
AddStep("add rooms", () =>
|
||||
{
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
var room = new Room
|
||||
{
|
||||
RoomID = { Value = i },
|
||||
Name = { Value = $"Room {i}" },
|
||||
Host = { Value = new User { Username = "Host" } },
|
||||
EndDate = { Value = DateTimeOffset.Now + TimeSpan.FromSeconds(10) }
|
||||
};
|
||||
|
||||
if (ruleset != null)
|
||||
{
|
||||
room.Playlist.Add(new PlaylistItem
|
||||
{
|
||||
Ruleset = { Value = ruleset },
|
||||
Beatmap =
|
||||
{
|
||||
Value = new BeatmapInfo
|
||||
{
|
||||
Metadata = new BeatmapMetadata()
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
roomManager.Rooms.Add(room);
|
||||
}
|
||||
});
|
||||
}
|
||||
private bool checkRoomSelected(Room room) => Room == room;
|
||||
|
||||
private void joinRequested(Room room) => room.Status.Value = new JoinedRoomStatus();
|
||||
|
||||
private class TestRoomManager : IRoomManager
|
||||
{
|
||||
public event Action RoomsUpdated
|
||||
{
|
||||
add { }
|
||||
remove { }
|
||||
}
|
||||
|
||||
public readonly BindableList<Room> Rooms = new BindableList<Room>();
|
||||
|
||||
public Bindable<bool> InitialRoomsReceived { get; } = new Bindable<bool>(true);
|
||||
|
||||
IBindableList<Room> IRoomManager.Rooms => Rooms;
|
||||
|
||||
public void CreateRoom(Room room, Action<Room> onSuccess = null, Action<string> onError = null) => Rooms.Add(room);
|
||||
|
||||
public void JoinRoom(Room room, Action<Room> onSuccess = null, Action<string> onError = null)
|
||||
{
|
||||
}
|
||||
|
||||
public void PartRoom()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private class JoinedRoomStatus : RoomStatus
|
||||
{
|
||||
public override string Message => "Joined";
|
||||
|
@ -0,0 +1,58 @@
|
||||
// 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.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Screens.Multi.Lounge;
|
||||
using osu.Game.Screens.Multi.Lounge.Components;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Multiplayer
|
||||
{
|
||||
public class TestSceneLoungeSubScreen : RoomManagerTestScene
|
||||
{
|
||||
private LoungeSubScreen loungeScreen;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
}
|
||||
|
||||
public override void SetUpSteps()
|
||||
{
|
||||
base.SetUpSteps();
|
||||
|
||||
AddStep("push screen", () => LoadScreen(loungeScreen = new LoungeSubScreen
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Width = 0.5f,
|
||||
}));
|
||||
|
||||
AddUntilStep("wait for present", () => loungeScreen.IsCurrentScreen());
|
||||
}
|
||||
|
||||
private RoomsContainer roomsContainer => loungeScreen.ChildrenOfType<RoomsContainer>().First();
|
||||
|
||||
[Test]
|
||||
public void TestScrollSelectedIntoView()
|
||||
{
|
||||
AddRooms(30);
|
||||
|
||||
AddUntilStep("first room is not masked", () => checkRoomVisible(roomsContainer.Rooms.First()));
|
||||
|
||||
AddStep("select last room", () => roomsContainer.Rooms.Last().Action?.Invoke());
|
||||
|
||||
AddUntilStep("first room is masked", () => !checkRoomVisible(roomsContainer.Rooms.First()));
|
||||
AddUntilStep("last room is not masked", () => checkRoomVisible(roomsContainer.Rooms.Last()));
|
||||
}
|
||||
|
||||
private bool checkRoomVisible(DrawableRoom room) =>
|
||||
loungeScreen.ChildrenOfType<OsuScrollContainer>().First().ScreenSpaceDrawQuad
|
||||
.Contains(room.ScreenSpaceDrawQuad.Centre);
|
||||
}
|
||||
}
|
@ -26,7 +26,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
[SetUp]
|
||||
public void Setup() => Schedule(() =>
|
||||
{
|
||||
Room.Playlist.Clear();
|
||||
Room = new Room();
|
||||
|
||||
Child = new MatchBeatmapDetailArea
|
||||
{
|
||||
|
@ -14,6 +14,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
{
|
||||
public TestSceneMatchHeader()
|
||||
{
|
||||
Room = new Room();
|
||||
Room.Playlist.Add(new PlaylistItem
|
||||
{
|
||||
Beatmap =
|
||||
|
@ -6,6 +6,7 @@ using Newtonsoft.Json;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Screens.Multi.Match.Components;
|
||||
using osu.Game.Users;
|
||||
using osuTK;
|
||||
@ -18,7 +19,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
public TestSceneMatchLeaderboard()
|
||||
{
|
||||
Room.RoomID.Value = 3;
|
||||
Room = new Room { RoomID = { Value = 3 } };
|
||||
|
||||
Add(new MatchLeaderboard
|
||||
{
|
||||
|
@ -1,32 +0,0 @@
|
||||
// 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;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Screens.Multi.Match.Components;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Multiplayer
|
||||
{
|
||||
public class TestSceneMatchLeaderboardChatDisplay : MultiplayerTestScene
|
||||
{
|
||||
protected override bool UseOnlineAPI => true;
|
||||
|
||||
public TestSceneMatchLeaderboardChatDisplay()
|
||||
{
|
||||
Room.RoomID.Value = 7;
|
||||
|
||||
Add(new Container
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(500),
|
||||
Child = new LeaderboardChatDisplay
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -14,6 +14,7 @@ using osu.Framework.Platform;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Screens.Multi.Components;
|
||||
@ -95,7 +96,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
[SetUp]
|
||||
public void Setup() => Schedule(() =>
|
||||
{
|
||||
Room.Playlist.Clear();
|
||||
Room = new Room();
|
||||
});
|
||||
|
||||
[Test]
|
||||
|
@ -48,7 +48,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
[SetUp]
|
||||
public void Setup() => Schedule(() =>
|
||||
{
|
||||
Room.CopyFrom(new Room());
|
||||
Room = new Room();
|
||||
});
|
||||
|
||||
[SetUpSteps]
|
||||
@ -58,6 +58,23 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
AddUntilStep("wait for load", () => match.IsCurrentScreen());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestLoadSimpleMatch()
|
||||
{
|
||||
AddStep("set room properties", () =>
|
||||
{
|
||||
Room.RoomID.Value = 1;
|
||||
Room.Name.Value = "my awesome room";
|
||||
Room.Host.Value = new User { Id = 2, Username = "peppy" };
|
||||
Room.RecentParticipants.Add(Room.Host.Value);
|
||||
Room.Playlist.Add(new PlaylistItem
|
||||
{
|
||||
Beatmap = { Value = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo },
|
||||
Ruleset = { Value = new OsuRuleset().RulesetInfo }
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestPlaylistItemSelectedOnCreate()
|
||||
{
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Screens.Multi.Components;
|
||||
using osuTK;
|
||||
|
||||
@ -12,10 +13,11 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
{
|
||||
protected override bool UseOnlineAPI => true;
|
||||
|
||||
public TestSceneOverlinedParticipants()
|
||||
[SetUp]
|
||||
public void Setup() => Schedule(() =>
|
||||
{
|
||||
Room.RoomID.Value = 7;
|
||||
}
|
||||
Room = new Room { RoomID = { Value = 7 } };
|
||||
});
|
||||
|
||||
[Test]
|
||||
public void TestHorizontalLayout()
|
||||
|
@ -16,6 +16,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
public TestSceneOverlinedPlaylist()
|
||||
{
|
||||
Room = new Room { RoomID = { Value = 7 } };
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
Room.Playlist.Add(new PlaylistItem
|
||||
|
@ -1,7 +1,9 @@
|
||||
// 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.Graphics;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Screens.Multi.Components;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Multiplayer
|
||||
@ -10,10 +12,14 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
{
|
||||
protected override bool UseOnlineAPI => true;
|
||||
|
||||
[SetUp]
|
||||
public void Setup() => Schedule(() =>
|
||||
{
|
||||
Room = new Room { RoomID = { Value = 7 } };
|
||||
});
|
||||
|
||||
public TestSceneParticipantsList()
|
||||
{
|
||||
Room.RoomID.Value = 7;
|
||||
|
||||
Add(new ParticipantsList { RelativeSizeAxes = Axes.Both });
|
||||
}
|
||||
}
|
||||
|
52
osu.Game.Tests/Visual/Online/TestSceneNewsCard.cs
Normal file
52
osu.Game.Tests/Visual/Online/TestSceneNewsCard.cs
Normal file
@ -0,0 +1,52 @@
|
||||
// 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.Containers;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Overlays.News;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Overlays;
|
||||
using osuTK;
|
||||
using System;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
public class TestSceneNewsCard : OsuTestScene
|
||||
{
|
||||
[Cached]
|
||||
private readonly OverlayColourProvider overlayColour = new OverlayColourProvider(OverlayColourScheme.Purple);
|
||||
|
||||
public TestSceneNewsCard()
|
||||
{
|
||||
Add(new FillFlowContainer<NewsCard>
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Direction = FillDirection.Vertical,
|
||||
Width = 500,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Spacing = new Vector2(0, 20),
|
||||
Children = new[]
|
||||
{
|
||||
new NewsCard(new APINewsPost
|
||||
{
|
||||
Title = "This post has an image which starts with \"/\" and has many authors!",
|
||||
Preview = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
||||
Author = "someone, someone1, someone2, someone3, someone4",
|
||||
FirstImage = "/help/wiki/shared/news/banners/monthly-beatmapping-contest.png",
|
||||
PublishedAt = DateTimeOffset.Now
|
||||
}),
|
||||
new NewsCard(new APINewsPost
|
||||
{
|
||||
Title = "This post has a full-url image! (HTML entity: &)",
|
||||
Preview = "boom (HTML entity: &)",
|
||||
Author = "user (HTML entity: &)",
|
||||
FirstImage = "https://assets.ppy.sh/artists/88/header.jpg",
|
||||
PublishedAt = DateTimeOffset.Now
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -203,13 +203,14 @@ namespace osu.Game.Tournament.Screens.TeamIntro
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = TournamentGame.TEXT_COLOUR,
|
||||
Colour = TournamentGame.ELEMENT_BACKGROUND_COLOUR,
|
||||
},
|
||||
new TournamentSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Text = seeding.ToString("#,0"),
|
||||
Colour = TournamentGame.ELEMENT_FOREGROUND_COLOUR
|
||||
},
|
||||
}
|
||||
},
|
||||
|
@ -183,6 +183,7 @@ namespace osu.Game.Beatmaps
|
||||
public void Dispose()
|
||||
{
|
||||
cacheDownloadRequest?.Dispose();
|
||||
updateScheduler?.Dispose();
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
|
78
osu.Game/Graphics/DateTooltip.cs
Normal file
78
osu.Game/Graphics/DateTooltip.cs
Normal file
@ -0,0 +1,78 @@
|
||||
// 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 osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Graphics
|
||||
{
|
||||
public class DateTooltip : VisibilityContainer, ITooltip
|
||||
{
|
||||
private readonly OsuSpriteText dateText, timeText;
|
||||
private readonly Box background;
|
||||
|
||||
public DateTooltip()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Masking = true;
|
||||
CornerRadius = 5;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
background = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Padding = new MarginPadding(10),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
dateText = new OsuSpriteText
|
||||
{
|
||||
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
},
|
||||
timeText = new OsuSpriteText
|
||||
{
|
||||
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular),
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
background.Colour = colours.GreySeafoamDarker;
|
||||
timeText.Colour = colours.BlueLighter;
|
||||
}
|
||||
|
||||
protected override void PopIn() => this.FadeIn(200, Easing.OutQuint);
|
||||
protected override void PopOut() => this.FadeOut(200, Easing.OutQuint);
|
||||
|
||||
public bool SetContent(object content)
|
||||
{
|
||||
if (!(content is DateTimeOffset date))
|
||||
return false;
|
||||
|
||||
dateText.Text = $"{date:d MMMM yyyy} ";
|
||||
timeText.Text = $"{date:HH:mm:ss \"UTC\"z}";
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Move(Vector2 pos) => Position = pos;
|
||||
}
|
||||
}
|
@ -4,12 +4,9 @@
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Utils;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Graphics
|
||||
{
|
||||
@ -81,69 +78,5 @@ namespace osu.Game.Graphics
|
||||
public ITooltip GetCustomTooltip() => new DateTooltip();
|
||||
|
||||
public object TooltipContent => Date;
|
||||
|
||||
private class DateTooltip : VisibilityContainer, ITooltip
|
||||
{
|
||||
private readonly OsuSpriteText dateText, timeText;
|
||||
private readonly Box background;
|
||||
|
||||
public DateTooltip()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Masking = true;
|
||||
CornerRadius = 5;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
background = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Padding = new MarginPadding(10),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
dateText = new OsuSpriteText
|
||||
{
|
||||
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
},
|
||||
timeText = new OsuSpriteText
|
||||
{
|
||||
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular),
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
background.Colour = colours.GreySeafoamDarker;
|
||||
timeText.Colour = colours.BlueLighter;
|
||||
}
|
||||
|
||||
protected override void PopIn() => this.FadeIn(200, Easing.OutQuint);
|
||||
protected override void PopOut() => this.FadeOut(200, Easing.OutQuint);
|
||||
|
||||
public bool SetContent(object content)
|
||||
{
|
||||
if (!(content is DateTimeOffset date))
|
||||
return false;
|
||||
|
||||
dateText.Text = $"{date:d MMMM yyyy} ";
|
||||
timeText.Text = $"{date:HH:mm:ss \"UTC\"z}";
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Move(Vector2 pos) => Position = pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
Height = 32;
|
||||
TabContainer.Spacing = new Vector2(padding, 0f);
|
||||
SwitchTabOnRemove = false;
|
||||
|
||||
Current.ValueChanged += index =>
|
||||
{
|
||||
foreach (var t in TabContainer.Children.OfType<BreadcrumbTabItem>())
|
||||
|
@ -23,6 +23,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
private Color4 accentColour;
|
||||
|
||||
public const float HORIZONTAL_SPACING = 10;
|
||||
|
||||
public virtual Color4 AccentColour
|
||||
{
|
||||
get => accentColour;
|
||||
@ -54,7 +56,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
public OsuTabControl()
|
||||
{
|
||||
TabContainer.Spacing = new Vector2(10f, 0f);
|
||||
TabContainer.Spacing = new Vector2(HORIZONTAL_SPACING, 0f);
|
||||
|
||||
AddInternal(strip = new Box
|
||||
{
|
||||
|
@ -2,9 +2,11 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Configuration;
|
||||
@ -13,12 +15,30 @@ namespace osu.Game.IO
|
||||
{
|
||||
public class OsuStorage : WrappedStorage
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates the error (if any) that occurred when initialising the custom storage during initial startup.
|
||||
/// </summary>
|
||||
public readonly OsuStorageError Error;
|
||||
|
||||
/// <summary>
|
||||
/// The custom storage path as selected by the user.
|
||||
/// </summary>
|
||||
[CanBeNull]
|
||||
public string CustomStoragePath => storageConfig.Get<string>(StorageConfig.FullPath);
|
||||
|
||||
/// <summary>
|
||||
/// The default storage path to be used if a custom storage path hasn't been selected or is not accessible.
|
||||
/// </summary>
|
||||
[NotNull]
|
||||
public string DefaultStoragePath => defaultStorage.GetFullPath(".");
|
||||
|
||||
private readonly GameHost host;
|
||||
private readonly StorageConfigManager storageConfig;
|
||||
private readonly Storage defaultStorage;
|
||||
|
||||
internal static readonly string[] IGNORE_DIRECTORIES = { "cache" };
|
||||
public static readonly string[] IGNORE_DIRECTORIES = { "cache" };
|
||||
|
||||
internal static readonly string[] IGNORE_FILES =
|
||||
public static readonly string[] IGNORE_FILES =
|
||||
{
|
||||
"framework.ini",
|
||||
"storage.ini"
|
||||
@ -28,13 +48,53 @@ namespace osu.Game.IO
|
||||
: base(defaultStorage, string.Empty)
|
||||
{
|
||||
this.host = host;
|
||||
this.defaultStorage = defaultStorage;
|
||||
|
||||
storageConfig = new StorageConfigManager(defaultStorage);
|
||||
|
||||
var customStoragePath = storageConfig.Get<string>(StorageConfig.FullPath);
|
||||
if (!string.IsNullOrEmpty(CustomStoragePath))
|
||||
TryChangeToCustomStorage(out Error);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(customStoragePath))
|
||||
ChangeTargetStorage(host.GetStorage(customStoragePath));
|
||||
/// <summary>
|
||||
/// Resets the custom storage path, changing the target storage to the default location.
|
||||
/// </summary>
|
||||
public void ResetCustomStoragePath()
|
||||
{
|
||||
storageConfig.Set(StorageConfig.FullPath, string.Empty);
|
||||
storageConfig.Save();
|
||||
|
||||
ChangeTargetStorage(defaultStorage);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to change to the user's custom storage path.
|
||||
/// </summary>
|
||||
/// <param name="error">The error that occurred.</param>
|
||||
/// <returns>Whether the custom storage path was used successfully. If not, <paramref name="error"/> will be populated with the reason.</returns>
|
||||
public bool TryChangeToCustomStorage(out OsuStorageError error)
|
||||
{
|
||||
Debug.Assert(!string.IsNullOrEmpty(CustomStoragePath));
|
||||
|
||||
error = OsuStorageError.None;
|
||||
Storage lastStorage = UnderlyingStorage;
|
||||
|
||||
try
|
||||
{
|
||||
Storage userStorage = host.GetStorage(CustomStoragePath);
|
||||
|
||||
if (!userStorage.ExistsDirectory(".") || !userStorage.GetFiles(".").Any())
|
||||
error = OsuStorageError.AccessibleButEmpty;
|
||||
|
||||
ChangeTargetStorage(userStorage);
|
||||
}
|
||||
catch
|
||||
{
|
||||
error = OsuStorageError.NotAccessible;
|
||||
ChangeTargetStorage(lastStorage);
|
||||
}
|
||||
|
||||
return error == OsuStorageError.None;
|
||||
}
|
||||
|
||||
protected override void ChangeTargetStorage(Storage newStorage)
|
||||
@ -145,4 +205,23 @@ namespace osu.Game.IO
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum OsuStorageError
|
||||
{
|
||||
/// <summary>
|
||||
/// No error.
|
||||
/// </summary>
|
||||
None,
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the target storage directory is accessible but does not already contain game files.
|
||||
/// Only happens when the user changes the storage directory and then moves the files manually or mounts a different device to the same path.
|
||||
/// </summary>
|
||||
AccessibleButEmpty,
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the target storage directory cannot be accessed at all.
|
||||
/// </summary>
|
||||
NotAccessible,
|
||||
}
|
||||
}
|
||||
|
@ -55,6 +55,9 @@ namespace osu.Game.Input
|
||||
RulesetID = rulesetId,
|
||||
Variant = variant
|
||||
});
|
||||
|
||||
// required to ensure stable insert order (https://github.com/dotnet/efcore/issues/11686)
|
||||
usage.Context.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
57
osu.Game/Online/API/Requests/Responses/APINewsPost.cs
Normal file
57
osu.Game/Online/API/Requests/Responses/APINewsPost.cs
Normal file
@ -0,0 +1,57 @@
|
||||
// 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 Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Net;
|
||||
|
||||
namespace osu.Game.Online.API.Requests.Responses
|
||||
{
|
||||
public class APINewsPost
|
||||
{
|
||||
[JsonProperty("id")]
|
||||
public long Id { get; set; }
|
||||
|
||||
private string author;
|
||||
|
||||
[JsonProperty("author")]
|
||||
public string Author
|
||||
{
|
||||
get => author;
|
||||
set => author = WebUtility.HtmlDecode(value);
|
||||
}
|
||||
|
||||
[JsonProperty("edit_url")]
|
||||
public string EditUrl { get; set; }
|
||||
|
||||
[JsonProperty("first_image")]
|
||||
public string FirstImage { get; set; }
|
||||
|
||||
[JsonProperty("published_at")]
|
||||
public DateTimeOffset PublishedAt { get; set; }
|
||||
|
||||
[JsonProperty("updated_at")]
|
||||
public DateTimeOffset UpdatedAt { get; set; }
|
||||
|
||||
[JsonProperty("slug")]
|
||||
public string Slug { get; set; }
|
||||
|
||||
private string title;
|
||||
|
||||
[JsonProperty("title")]
|
||||
public string Title
|
||||
{
|
||||
get => title;
|
||||
set => title = WebUtility.HtmlDecode(value);
|
||||
}
|
||||
|
||||
private string preview;
|
||||
|
||||
[JsonProperty("preview")]
|
||||
public string Preview
|
||||
{
|
||||
get => preview;
|
||||
set => preview = WebUtility.HtmlDecode(value);
|
||||
}
|
||||
}
|
||||
}
|
@ -16,54 +16,54 @@ namespace osu.Game.Online.Multiplayer
|
||||
{
|
||||
[Cached]
|
||||
[JsonProperty("id")]
|
||||
public Bindable<int?> RoomID { get; private set; } = new Bindable<int?>();
|
||||
public readonly Bindable<int?> RoomID = new Bindable<int?>();
|
||||
|
||||
[Cached]
|
||||
[JsonProperty("name")]
|
||||
public Bindable<string> Name { get; private set; } = new Bindable<string>();
|
||||
public readonly Bindable<string> Name = new Bindable<string>();
|
||||
|
||||
[Cached]
|
||||
[JsonProperty("host")]
|
||||
public Bindable<User> Host { get; private set; } = new Bindable<User>();
|
||||
public readonly Bindable<User> Host = new Bindable<User>();
|
||||
|
||||
[Cached]
|
||||
[JsonProperty("playlist")]
|
||||
public BindableList<PlaylistItem> Playlist { get; private set; } = new BindableList<PlaylistItem>();
|
||||
public readonly BindableList<PlaylistItem> Playlist = new BindableList<PlaylistItem>();
|
||||
|
||||
[Cached]
|
||||
[JsonProperty("channel_id")]
|
||||
public Bindable<int> ChannelId { get; private set; } = new Bindable<int>();
|
||||
public readonly Bindable<int> ChannelId = new Bindable<int>();
|
||||
|
||||
[Cached]
|
||||
[JsonIgnore]
|
||||
public Bindable<TimeSpan> Duration { get; private set; } = new Bindable<TimeSpan>(TimeSpan.FromMinutes(30));
|
||||
public readonly Bindable<TimeSpan> Duration = new Bindable<TimeSpan>(TimeSpan.FromMinutes(30));
|
||||
|
||||
[Cached]
|
||||
[JsonIgnore]
|
||||
public Bindable<int?> MaxAttempts { get; private set; } = new Bindable<int?>();
|
||||
public readonly Bindable<int?> MaxAttempts = new Bindable<int?>();
|
||||
|
||||
[Cached]
|
||||
[JsonIgnore]
|
||||
public Bindable<RoomStatus> Status { get; private set; } = new Bindable<RoomStatus>(new RoomStatusOpen());
|
||||
public readonly Bindable<RoomStatus> Status = new Bindable<RoomStatus>(new RoomStatusOpen());
|
||||
|
||||
[Cached]
|
||||
[JsonIgnore]
|
||||
public Bindable<RoomAvailability> Availability { get; private set; } = new Bindable<RoomAvailability>();
|
||||
public readonly Bindable<RoomAvailability> Availability = new Bindable<RoomAvailability>();
|
||||
|
||||
[Cached]
|
||||
[JsonIgnore]
|
||||
public Bindable<GameType> Type { get; private set; } = new Bindable<GameType>(new GameTypeTimeshift());
|
||||
public readonly Bindable<GameType> Type = new Bindable<GameType>(new GameTypeTimeshift());
|
||||
|
||||
[Cached]
|
||||
[JsonIgnore]
|
||||
public Bindable<int?> MaxParticipants { get; private set; } = new Bindable<int?>();
|
||||
public readonly Bindable<int?> MaxParticipants = new Bindable<int?>();
|
||||
|
||||
[Cached]
|
||||
[JsonProperty("recent_participants")]
|
||||
public BindableList<User> RecentParticipants { get; private set; } = new BindableList<User>();
|
||||
public readonly BindableList<User> RecentParticipants = new BindableList<User>();
|
||||
|
||||
[Cached]
|
||||
public Bindable<int> ParticipantCount { get; private set; } = new Bindable<int>();
|
||||
public readonly Bindable<int> ParticipantCount = new Bindable<int>();
|
||||
|
||||
// todo: TEMPORARY
|
||||
[JsonProperty("participant_count")]
|
||||
@ -83,7 +83,7 @@ namespace osu.Game.Online.Multiplayer
|
||||
// Only supports retrieval for now
|
||||
[Cached]
|
||||
[JsonProperty("ends_at")]
|
||||
public Bindable<DateTimeOffset> EndDate { get; private set; } = new Bindable<DateTimeOffset>();
|
||||
public readonly Bindable<DateTimeOffset> EndDate = new Bindable<DateTimeOffset>();
|
||||
|
||||
// Todo: Find a better way to do this (https://github.com/ppy/osu-framework/issues/1930)
|
||||
[JsonProperty("max_attempts", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
@ -97,7 +97,7 @@ namespace osu.Game.Online.Multiplayer
|
||||
/// The position of this <see cref="Room"/> in the list. This is not read from or written to the API.
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public Bindable<int> Position { get; private set; } = new Bindable<int>(-1);
|
||||
public readonly Bindable<int> Position = new Bindable<int>(-1);
|
||||
|
||||
public void CopyFrom(Room other)
|
||||
{
|
||||
@ -130,7 +130,7 @@ namespace osu.Game.Online.Multiplayer
|
||||
RecentParticipants.AddRange(other.RecentParticipants);
|
||||
}
|
||||
|
||||
Position = other.Position;
|
||||
Position.Value = other.Position.Value;
|
||||
}
|
||||
|
||||
public bool ShouldSerializeRoomID() => false;
|
||||
|
@ -91,7 +91,8 @@ namespace osu.Game.Overlays.BeatmapListing
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OverlayColourProvider colourProvider)
|
||||
{
|
||||
((FilterDropdown)Dropdown).AccentColour = colourProvider.Light2;
|
||||
if (Dropdown is FilterDropdown fd)
|
||||
fd.AccentColour = colourProvider.Light2;
|
||||
}
|
||||
|
||||
protected override Dropdown<T> CreateDropdown() => new FilterDropdown();
|
||||
|
@ -42,25 +42,34 @@ namespace osu.Game.Overlays.Dialog
|
||||
set => icon.Icon = value;
|
||||
}
|
||||
|
||||
private string text;
|
||||
private string headerText;
|
||||
|
||||
public string HeaderText
|
||||
{
|
||||
get => text;
|
||||
get => headerText;
|
||||
set
|
||||
{
|
||||
if (text == value)
|
||||
if (headerText == value)
|
||||
return;
|
||||
|
||||
text = value;
|
||||
|
||||
headerText = value;
|
||||
header.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
private string bodyText;
|
||||
|
||||
public string BodyText
|
||||
{
|
||||
set => body.Text = value;
|
||||
get => bodyText;
|
||||
set
|
||||
{
|
||||
if (bodyText == value)
|
||||
return;
|
||||
|
||||
bodyText = value;
|
||||
body.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<PopupDialogButton> Buttons
|
||||
|
198
osu.Game/Overlays/News/NewsCard.cs
Normal file
198
osu.Game/Overlays/News/NewsCard.cs
Normal file
@ -0,0 +1,198 @@
|
||||
// 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 osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
|
||||
namespace osu.Game.Overlays.News
|
||||
{
|
||||
public class NewsCard : CompositeDrawable
|
||||
{
|
||||
[Resolved]
|
||||
private OverlayColourProvider colourProvider { get; set; }
|
||||
|
||||
private readonly APINewsPost post;
|
||||
|
||||
private Box background;
|
||||
private TextFlowContainer main;
|
||||
|
||||
public NewsCard(APINewsPost post)
|
||||
{
|
||||
this.post = post;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
Masking = true;
|
||||
CornerRadius = 6;
|
||||
|
||||
NewsBackground bg;
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
background = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = colourProvider.Background4
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 160,
|
||||
Masking = true,
|
||||
CornerRadius = 6,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new DelayedLoadWrapper(bg = new NewsBackground(post.FirstImage)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
FillMode = FillMode.Fill,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Alpha = 0
|
||||
})
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both
|
||||
},
|
||||
new DateContainer(post.PublishedAt)
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
Margin = new MarginPadding
|
||||
{
|
||||
Top = 10,
|
||||
Right = 15
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Padding = new MarginPadding
|
||||
{
|
||||
Horizontal = 15,
|
||||
Vertical = 10
|
||||
},
|
||||
Child = main = new TextFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
new HoverClickSounds()
|
||||
};
|
||||
|
||||
bg.OnLoadComplete += d => d.FadeIn(250, Easing.In);
|
||||
|
||||
main.AddParagraph(post.Title, t => t.Font = OsuFont.GetFont(size: 20, weight: FontWeight.SemiBold));
|
||||
main.AddParagraph(post.Preview, t => t.Font = OsuFont.GetFont(size: 12)); // Should use sans-serif font
|
||||
main.AddParagraph("by ", t => t.Font = OsuFont.GetFont(size: 12));
|
||||
main.AddText(post.Author, t => t.Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold));
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
{
|
||||
background.FadeColour(colourProvider.Background3, 200, Easing.OutQuint);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void OnHoverLost(HoverLostEvent e)
|
||||
{
|
||||
background.FadeColour(colourProvider.Background4, 200, Easing.OutQuint);
|
||||
base.OnHoverLost(e);
|
||||
}
|
||||
|
||||
[LongRunningLoad]
|
||||
private class NewsBackground : Sprite
|
||||
{
|
||||
private readonly string sourceUrl;
|
||||
|
||||
public NewsBackground(string sourceUrl)
|
||||
{
|
||||
this.sourceUrl = sourceUrl;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(LargeTextureStore store)
|
||||
{
|
||||
Texture = store.Get(createUrl(sourceUrl));
|
||||
}
|
||||
|
||||
private string createUrl(string source)
|
||||
{
|
||||
if (string.IsNullOrEmpty(source))
|
||||
return "Headers/news";
|
||||
|
||||
if (source.StartsWith('/'))
|
||||
return "https://osu.ppy.sh" + source;
|
||||
|
||||
return source;
|
||||
}
|
||||
}
|
||||
|
||||
private class DateContainer : CircularContainer, IHasCustomTooltip
|
||||
{
|
||||
public ITooltip GetCustomTooltip() => new DateTooltip();
|
||||
|
||||
public object TooltipContent => date;
|
||||
|
||||
private readonly DateTimeOffset date;
|
||||
|
||||
public DateContainer(DateTimeOffset date)
|
||||
{
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OverlayColourProvider colourProvider)
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Masking = true;
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = colourProvider.Background6.Opacity(0.5f)
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = date.ToString("d MMM yyyy").ToUpper(),
|
||||
Font = OsuFont.GetFont(size: 10, weight: FontWeight.SemiBold),
|
||||
Margin = new MarginPadding
|
||||
{
|
||||
Horizontal = 20,
|
||||
Vertical = 5
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -136,8 +136,6 @@ namespace osu.Game.Overlays.SearchableList
|
||||
|
||||
private class FilterSearchTextBox : SearchTextBox
|
||||
{
|
||||
protected override bool AllowCommit => true;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
|
@ -28,9 +28,6 @@ namespace osu.Game.Overlays.Toolbar
|
||||
|
||||
private const double transition_time = 500;
|
||||
|
||||
private const float alpha_hovering = 0.8f;
|
||||
private const float alpha_normal = 0.6f;
|
||||
|
||||
private readonly Bindable<OverlayActivation> overlayActivationMode = new Bindable<OverlayActivation>(OverlayActivation.All);
|
||||
|
||||
// Toolbar components like RulesetSelector should receive keyboard input events even when the toolbar is hidden.
|
||||
@ -103,7 +100,6 @@ namespace osu.Game.Overlays.Toolbar
|
||||
|
||||
public class ToolbarBackground : Container
|
||||
{
|
||||
private readonly Box solidBackground;
|
||||
private readonly Box gradientBackground;
|
||||
|
||||
public ToolbarBackground()
|
||||
@ -111,11 +107,10 @@ namespace osu.Game.Overlays.Toolbar
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
Children = new Drawable[]
|
||||
{
|
||||
solidBackground = new Box
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = OsuColour.Gray(0.1f),
|
||||
Alpha = alpha_normal,
|
||||
},
|
||||
gradientBackground = new Box
|
||||
{
|
||||
@ -131,14 +126,12 @@ namespace osu.Game.Overlays.Toolbar
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
{
|
||||
solidBackground.FadeTo(alpha_hovering, transition_time, Easing.OutQuint);
|
||||
gradientBackground.FadeIn(transition_time, Easing.OutQuint);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void OnHoverLost(HoverLostEvent e)
|
||||
{
|
||||
solidBackground.FadeTo(alpha_normal, transition_time, Easing.OutQuint);
|
||||
gradientBackground.FadeOut(transition_time, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
@ -146,7 +139,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
protected override void PopIn()
|
||||
{
|
||||
this.MoveToY(0, transition_time, Easing.OutQuint);
|
||||
this.FadeIn(transition_time / 2, Easing.OutQuint);
|
||||
this.FadeIn(transition_time / 4, Easing.OutQuint);
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
@ -154,7 +147,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
userButton.StateContainer?.Hide();
|
||||
|
||||
this.MoveToY(-DrawSize.Y, transition_time, Easing.OutQuint);
|
||||
this.FadeOut(transition_time);
|
||||
this.FadeOut(transition_time, Easing.InQuint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
34
osu.Game/Screens/Menu/ConfirmExitDialog.cs
Normal file
34
osu.Game/Screens/Menu/ConfirmExitDialog.cs
Normal file
@ -0,0 +1,34 @@
|
||||
// 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 osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Overlays.Dialog;
|
||||
|
||||
namespace osu.Game.Screens.Menu
|
||||
{
|
||||
public class ConfirmExitDialog : PopupDialog
|
||||
{
|
||||
public ConfirmExitDialog(Action confirm, Action cancel)
|
||||
{
|
||||
HeaderText = "Are you sure you want to exit?";
|
||||
BodyText = "Last chance to back out.";
|
||||
|
||||
Icon = FontAwesome.Solid.ExclamationTriangle;
|
||||
|
||||
Buttons = new PopupDialogButton[]
|
||||
{
|
||||
new PopupDialogOkButton
|
||||
{
|
||||
Text = @"Goodbye",
|
||||
Action = confirm
|
||||
},
|
||||
new PopupDialogCancelButton
|
||||
{
|
||||
Text = @"Just a little more",
|
||||
Action = cancel
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -51,7 +51,7 @@ namespace osu.Game.Screens.Menu
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Icon = FontAwesome.Solid.Poo,
|
||||
Icon = FontAwesome.Solid.Flask,
|
||||
Size = new Vector2(icon_size),
|
||||
Y = icon_y,
|
||||
},
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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.Linq;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
@ -9,15 +8,14 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.IO;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Dialog;
|
||||
using osu.Game.Screens.Backgrounds;
|
||||
using osu.Game.Screens.Edit;
|
||||
using osu.Game.Screens.Multi;
|
||||
@ -171,6 +169,9 @@ namespace osu.Game.Screens.Menu
|
||||
return s;
|
||||
}
|
||||
|
||||
[Resolved]
|
||||
private Storage storage { get; set; }
|
||||
|
||||
public override void OnEntering(IScreen last)
|
||||
{
|
||||
base.OnEntering(last);
|
||||
@ -187,6 +188,9 @@ namespace osu.Game.Screens.Menu
|
||||
Track.Start();
|
||||
}
|
||||
}
|
||||
|
||||
if (storage is OsuStorage osuStorage && osuStorage.Error != OsuStorageError.None)
|
||||
dialogOverlay?.Push(new StorageErrorDialog(osuStorage, osuStorage.Error));
|
||||
}
|
||||
|
||||
private bool exitConfirmed;
|
||||
@ -283,30 +287,5 @@ namespace osu.Game.Screens.Menu
|
||||
this.FadeOut(3000);
|
||||
return base.OnExiting(next);
|
||||
}
|
||||
|
||||
private class ConfirmExitDialog : PopupDialog
|
||||
{
|
||||
public ConfirmExitDialog(Action confirm, Action cancel)
|
||||
{
|
||||
HeaderText = "Are you sure you want to exit?";
|
||||
BodyText = "Last chance to back out.";
|
||||
|
||||
Icon = FontAwesome.Solid.ExclamationTriangle;
|
||||
|
||||
Buttons = new PopupDialogButton[]
|
||||
{
|
||||
new PopupDialogOkButton
|
||||
{
|
||||
Text = @"Goodbye",
|
||||
Action = confirm
|
||||
},
|
||||
new PopupDialogCancelButton
|
||||
{
|
||||
Text = @"Just a little more",
|
||||
Action = cancel
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
79
osu.Game/Screens/Menu/StorageErrorDialog.cs
Normal file
79
osu.Game/Screens/Menu/StorageErrorDialog.cs
Normal file
@ -0,0 +1,79 @@
|
||||
// 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.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.IO;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Dialog;
|
||||
|
||||
namespace osu.Game.Screens.Menu
|
||||
{
|
||||
public class StorageErrorDialog : PopupDialog
|
||||
{
|
||||
[Resolved]
|
||||
private DialogOverlay dialogOverlay { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private OsuGameBase osuGame { get; set; }
|
||||
|
||||
public StorageErrorDialog(OsuStorage storage, OsuStorageError error)
|
||||
{
|
||||
HeaderText = "osu! storage error";
|
||||
Icon = FontAwesome.Solid.ExclamationTriangle;
|
||||
|
||||
var buttons = new List<PopupDialogButton>();
|
||||
|
||||
switch (error)
|
||||
{
|
||||
case OsuStorageError.NotAccessible:
|
||||
BodyText = $"The specified osu! data location (\"{storage.CustomStoragePath}\") is not accessible. If it is on external storage, please reconnect the device and try again.";
|
||||
|
||||
buttons.AddRange(new PopupDialogButton[]
|
||||
{
|
||||
new PopupDialogCancelButton
|
||||
{
|
||||
Text = "Try again",
|
||||
Action = () =>
|
||||
{
|
||||
if (!storage.TryChangeToCustomStorage(out var nextError))
|
||||
dialogOverlay.Push(new StorageErrorDialog(storage, nextError));
|
||||
}
|
||||
},
|
||||
new PopupDialogCancelButton
|
||||
{
|
||||
Text = "Use default location until restart",
|
||||
},
|
||||
new PopupDialogOkButton
|
||||
{
|
||||
Text = "Reset to default location",
|
||||
Action = storage.ResetCustomStoragePath
|
||||
},
|
||||
});
|
||||
break;
|
||||
|
||||
case OsuStorageError.AccessibleButEmpty:
|
||||
BodyText = $"The specified osu! data location (\"{storage.CustomStoragePath}\") is empty. If you have moved the files, please close osu! and move them back.";
|
||||
|
||||
// Todo: Provide the option to search for the files similar to migration.
|
||||
buttons.AddRange(new PopupDialogButton[]
|
||||
{
|
||||
new PopupDialogCancelButton
|
||||
{
|
||||
Text = "Start fresh at specified location"
|
||||
},
|
||||
new PopupDialogOkButton
|
||||
{
|
||||
Text = "Reset to default location",
|
||||
Action = storage.ResetCustomStoragePath
|
||||
},
|
||||
});
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
Buttons = buttons;
|
||||
}
|
||||
}
|
||||
}
|
@ -35,6 +35,18 @@ namespace osu.Game.Screens.Multi.Components
|
||||
}
|
||||
}
|
||||
|
||||
private bool showLine = true;
|
||||
|
||||
public bool ShowLine
|
||||
{
|
||||
get => showLine;
|
||||
set
|
||||
{
|
||||
showLine = value;
|
||||
line.Alpha = value ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
protected string Details
|
||||
{
|
||||
set => details.Text = value;
|
||||
@ -72,9 +84,12 @@ namespace osu.Game.Screens.Multi.Components
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = title,
|
||||
Font = OsuFont.GetFont(size: 14)
|
||||
Font = OsuFont.GetFont(size: 14, weight: FontWeight.SemiBold)
|
||||
},
|
||||
details = new OsuSpriteText
|
||||
{
|
||||
Font = OsuFont.GetFont(size: 14, weight: FontWeight.SemiBold)
|
||||
},
|
||||
details = new OsuSpriteText { Font = OsuFont.GetFont(size: 14) },
|
||||
}
|
||||
},
|
||||
},
|
||||
|
@ -79,7 +79,7 @@ namespace osu.Game.Screens.Multi.Components
|
||||
Direction = Direction,
|
||||
AutoSizeAxes = AutoSizeAxes,
|
||||
RelativeSizeAxes = RelativeSizeAxes,
|
||||
Spacing = new Vector2(10)
|
||||
Spacing = Vector2.One
|
||||
};
|
||||
|
||||
for (int i = 0; i < RecentParticipants.Count; i++)
|
||||
|
@ -1,12 +1,13 @@
|
||||
// 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 Humanizer;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
@ -19,41 +20,41 @@ namespace osu.Game.Screens.Multi
|
||||
{
|
||||
public class Header : Container
|
||||
{
|
||||
public const float HEIGHT = 121;
|
||||
|
||||
private readonly HeaderBreadcrumbControl breadcrumbs;
|
||||
public const float HEIGHT = 80;
|
||||
|
||||
public Header(ScreenStack stack)
|
||||
{
|
||||
MultiHeaderTitle title;
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Height = HEIGHT;
|
||||
|
||||
HeaderBreadcrumbControl breadcrumbs;
|
||||
MultiHeaderTitle title;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4Extensions.FromHex(@"2f2043"),
|
||||
Colour = Color4Extensions.FromHex(@"#1f1921"),
|
||||
},
|
||||
new Container
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING + OsuScreen.HORIZONTAL_OVERFLOW_PADDING },
|
||||
Padding = new MarginPadding { Left = SearchableListOverlay.WIDTH_PADDING + OsuScreen.HORIZONTAL_OVERFLOW_PADDING },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
title = new MultiHeaderTitle
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
X = -MultiHeaderTitle.ICON_WIDTH,
|
||||
},
|
||||
breadcrumbs = new HeaderBreadcrumbControl(stack)
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
},
|
||||
Origin = Anchor.BottomLeft
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
@ -67,32 +68,16 @@ namespace osu.Game.Screens.Multi
|
||||
breadcrumbs.Current.TriggerChange();
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
private class MultiHeaderTitle : CompositeDrawable
|
||||
{
|
||||
breadcrumbs.StripColour = colours.Green;
|
||||
}
|
||||
|
||||
private class MultiHeaderTitle : CompositeDrawable, IHasAccentColour
|
||||
{
|
||||
public const float ICON_WIDTH = icon_size + spacing;
|
||||
|
||||
private const float icon_size = 25;
|
||||
private const float spacing = 6;
|
||||
private const int text_offset = 2;
|
||||
|
||||
private readonly SpriteIcon iconSprite;
|
||||
private readonly OsuSpriteText title, pageText;
|
||||
private readonly OsuSpriteText dot;
|
||||
private readonly OsuSpriteText pageTitle;
|
||||
|
||||
public IMultiplayerSubScreen Screen
|
||||
{
|
||||
set => pageText.Text = value.ShortTitle.ToLowerInvariant();
|
||||
}
|
||||
|
||||
public Color4 AccentColour
|
||||
{
|
||||
get => pageText.Colour;
|
||||
set => pageText.Colour = value;
|
||||
set => pageTitle.Text = value.ShortTitle.Titleize();
|
||||
}
|
||||
|
||||
public MultiHeaderTitle()
|
||||
@ -108,32 +93,26 @@ namespace osu.Game.Screens.Multi
|
||||
Direction = FillDirection.Horizontal,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
iconSprite = new SpriteIcon
|
||||
new OsuSpriteText
|
||||
{
|
||||
Size = new Vector2(icon_size),
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Font = OsuFont.GetFont(size: 24),
|
||||
Text = "Multiplayer"
|
||||
},
|
||||
title = new OsuSpriteText
|
||||
dot = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Font = OsuFont.GetFont(size: 20, weight: FontWeight.Bold),
|
||||
Margin = new MarginPadding { Bottom = text_offset }
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Font = OsuFont.GetFont(size: 24),
|
||||
Text = "·"
|
||||
},
|
||||
new Circle
|
||||
pageTitle = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(4),
|
||||
Colour = Color4.Gray,
|
||||
},
|
||||
pageText = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Font = OsuFont.GetFont(size: 20),
|
||||
Margin = new MarginPadding { Bottom = text_offset }
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Font = OsuFont.GetFont(size: 24),
|
||||
Text = "Lounge"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -143,9 +122,7 @@ namespace osu.Game.Screens.Multi
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
title.Text = "multi";
|
||||
iconSprite.Icon = OsuIcon.Multi;
|
||||
AccentColour = colours.Yellow;
|
||||
pageTitle.Colour = dot.Colour = colours.Yellow;
|
||||
}
|
||||
}
|
||||
|
||||
@ -154,12 +131,28 @@ namespace osu.Game.Screens.Multi
|
||||
public HeaderBreadcrumbControl(ScreenStack stack)
|
||||
: base(stack)
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
StripColour = Color4.Transparent;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
AccentColour = Color4.White;
|
||||
AccentColour = Color4Extensions.FromHex("#e35c99");
|
||||
}
|
||||
|
||||
protected override TabItem<IScreen> CreateTabItem(IScreen value) => new HeaderBreadcrumbTabItem(value)
|
||||
{
|
||||
AccentColour = AccentColour
|
||||
};
|
||||
|
||||
private class HeaderBreadcrumbTabItem : BreadcrumbTabItem
|
||||
{
|
||||
public HeaderBreadcrumbTabItem(IScreen value)
|
||||
: base(value)
|
||||
{
|
||||
Bar.Colour = Color4.Transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,13 +9,17 @@ using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.Multi.Lounge.Components
|
||||
{
|
||||
public class RoomsContainer : CompositeDrawable
|
||||
public class RoomsContainer : CompositeDrawable, IKeyBindingHandler<GlobalAction>
|
||||
{
|
||||
public Action<Room> JoinRequested;
|
||||
|
||||
@ -88,8 +92,22 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
||||
|
||||
private void addRooms(IEnumerable<Room> rooms)
|
||||
{
|
||||
foreach (var r in rooms)
|
||||
roomFlow.Add(new DrawableRoom(r) { Action = () => selectRoom(r) });
|
||||
foreach (var room in rooms)
|
||||
{
|
||||
roomFlow.Add(new DrawableRoom(room)
|
||||
{
|
||||
Action = () =>
|
||||
{
|
||||
if (room == selectedRoom.Value)
|
||||
{
|
||||
joinSelected();
|
||||
return;
|
||||
}
|
||||
|
||||
selectRoom(room);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Filter(filter?.Value);
|
||||
}
|
||||
@ -115,16 +133,100 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
||||
|
||||
private void selectRoom(Room room)
|
||||
{
|
||||
var drawable = roomFlow.FirstOrDefault(r => r.Room == room);
|
||||
|
||||
if (drawable != null && drawable.State == SelectionState.Selected)
|
||||
JoinRequested?.Invoke(room);
|
||||
else
|
||||
roomFlow.Children.ForEach(r => r.State = r.Room == room ? SelectionState.Selected : SelectionState.NotSelected);
|
||||
|
||||
roomFlow.Children.ForEach(r => r.State = r.Room == room ? SelectionState.Selected : SelectionState.NotSelected);
|
||||
selectedRoom.Value = room;
|
||||
}
|
||||
|
||||
private void joinSelected()
|
||||
{
|
||||
if (selectedRoom.Value == null) return;
|
||||
|
||||
JoinRequested?.Invoke(selectedRoom.Value);
|
||||
}
|
||||
|
||||
#region Key selection logic (shared with BeatmapCarousel)
|
||||
|
||||
public bool OnPressed(GlobalAction action)
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case GlobalAction.Select:
|
||||
joinSelected();
|
||||
return true;
|
||||
|
||||
case GlobalAction.SelectNext:
|
||||
beginRepeatSelection(() => selectNext(1), action);
|
||||
return true;
|
||||
|
||||
case GlobalAction.SelectPrevious:
|
||||
beginRepeatSelection(() => selectNext(-1), action);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void OnReleased(GlobalAction action)
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case GlobalAction.SelectNext:
|
||||
case GlobalAction.SelectPrevious:
|
||||
endRepeatSelection(action);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private ScheduledDelegate repeatDelegate;
|
||||
private object lastRepeatSource;
|
||||
|
||||
/// <summary>
|
||||
/// Begin repeating the specified selection action.
|
||||
/// </summary>
|
||||
/// <param name="action">The action to perform.</param>
|
||||
/// <param name="source">The source of the action. Used in conjunction with <see cref="endRepeatSelection"/> to only cancel the correct action (most recently pressed key).</param>
|
||||
private void beginRepeatSelection(Action action, object source)
|
||||
{
|
||||
endRepeatSelection();
|
||||
|
||||
lastRepeatSource = source;
|
||||
repeatDelegate = this.BeginKeyRepeat(Scheduler, action);
|
||||
}
|
||||
|
||||
private void endRepeatSelection(object source = null)
|
||||
{
|
||||
// only the most recent source should be able to cancel the current action.
|
||||
if (source != null && !EqualityComparer<object>.Default.Equals(lastRepeatSource, source))
|
||||
return;
|
||||
|
||||
repeatDelegate?.Cancel();
|
||||
repeatDelegate = null;
|
||||
lastRepeatSource = null;
|
||||
}
|
||||
|
||||
private void selectNext(int direction)
|
||||
{
|
||||
var visibleRooms = Rooms.AsEnumerable().Where(r => r.IsPresent);
|
||||
|
||||
Room room;
|
||||
|
||||
if (selectedRoom.Value == null)
|
||||
room = visibleRooms.FirstOrDefault()?.Room;
|
||||
else
|
||||
{
|
||||
if (direction < 0)
|
||||
visibleRooms = visibleRooms.Reverse();
|
||||
|
||||
room = visibleRooms.SkipWhile(r => r.Room != selectedRoom.Value).Skip(1).FirstOrDefault()?.Room;
|
||||
}
|
||||
|
||||
// we already have a valid selection only change selection if we still have a room to switch to.
|
||||
if (room != null)
|
||||
selectRoom(room);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
@ -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 System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
@ -20,21 +21,23 @@ namespace osu.Game.Screens.Multi.Lounge
|
||||
{
|
||||
public override string Title => "Lounge";
|
||||
|
||||
protected readonly FilterControl Filter;
|
||||
protected FilterControl Filter;
|
||||
|
||||
private readonly Bindable<bool> initialRoomsReceived = new Bindable<bool>();
|
||||
|
||||
private readonly Container content;
|
||||
private readonly LoadingLayer loadingLayer;
|
||||
private Container content;
|
||||
private LoadingLayer loadingLayer;
|
||||
|
||||
[Resolved]
|
||||
private Bindable<Room> selectedRoom { get; set; }
|
||||
|
||||
private bool joiningRoom;
|
||||
|
||||
public LoungeSubScreen()
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
SearchContainer searchContainer;
|
||||
RoomsContainer roomsContainer;
|
||||
OsuScrollContainer scrollContainer;
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
@ -50,19 +53,14 @@ namespace osu.Game.Screens.Multi.Lounge
|
||||
Width = 0.55f,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OsuScrollContainer
|
||||
scrollContainer = new OsuScrollContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
ScrollbarOverlapsContent = false,
|
||||
Padding = new MarginPadding(10),
|
||||
Child = searchContainer = new SearchContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Child = new RoomsContainer { JoinRequested = joinRequested }
|
||||
},
|
||||
Child = roomsContainer = new RoomsContainer { JoinRequested = joinRequested }
|
||||
},
|
||||
loadingLayer = new LoadingLayer(searchContainer),
|
||||
loadingLayer = new LoadingLayer(roomsContainer),
|
||||
}
|
||||
},
|
||||
new RoomInspector
|
||||
@ -75,6 +73,14 @@ namespace osu.Game.Screens.Multi.Lounge
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
// scroll selected room into view on selection.
|
||||
selectedRoom.BindValueChanged(val =>
|
||||
{
|
||||
var drawable = roomsContainer.Rooms.FirstOrDefault(r => r.Room == val.NewValue);
|
||||
if (drawable != null)
|
||||
scrollContainer.ScrollIntoView(drawable);
|
||||
});
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
|
@ -16,7 +16,7 @@ namespace osu.Game.Screens.Multi.Match.Components
|
||||
{
|
||||
public class Footer : CompositeDrawable
|
||||
{
|
||||
public const float HEIGHT = 100;
|
||||
public const float HEIGHT = 50;
|
||||
|
||||
public Action OnStart;
|
||||
public readonly Bindable<PlaylistItem> SelectedItem = new Bindable<PlaylistItem>();
|
||||
|
@ -52,7 +52,7 @@ namespace osu.Game.Screens.Multi.Match.Components
|
||||
Font = OsuFont.GetFont(size: 30),
|
||||
Current = { BindTarget = RoomName }
|
||||
},
|
||||
hostText = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 20, weight: FontWeight.SemiBold))
|
||||
hostText = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 20))
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
@ -71,7 +71,7 @@ namespace osu.Game.Screens.Multi.Match.Components
|
||||
if (host.NewValue != null)
|
||||
{
|
||||
hostText.AddText("hosted by ");
|
||||
hostText.AddUserLink(host.NewValue);
|
||||
hostText.AddUserLink(host.NewValue, s => s.Font = s.Font.With(weight: FontWeight.SemiBold));
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
@ -1,100 +0,0 @@
|
||||
// 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.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Screens.Multi.Match.Components
|
||||
{
|
||||
public class LeaderboardChatDisplay : MultiplayerComposite
|
||||
{
|
||||
private const double fade_duration = 100;
|
||||
|
||||
private readonly OsuTabControl<DisplayMode> tabControl;
|
||||
private readonly MatchLeaderboard leaderboard;
|
||||
private readonly MatchChatDisplay chat;
|
||||
|
||||
public LeaderboardChatDisplay()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
|
||||
InternalChild = new GridContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Content = new[]
|
||||
{
|
||||
new Drawable[]
|
||||
{
|
||||
tabControl = new DisplayModeTabControl
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 24,
|
||||
}
|
||||
},
|
||||
new Drawable[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Top = 10 },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
leaderboard = new MatchLeaderboard { RelativeSizeAxes = Axes.Both },
|
||||
chat = new MatchChatDisplay
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
RowDimensions = new[]
|
||||
{
|
||||
new Dimension(GridSizeMode.AutoSize),
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
tabControl.AccentColour = colours.Yellow;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
tabControl.Current.BindValueChanged(changeTab);
|
||||
}
|
||||
|
||||
public void RefreshScores() => leaderboard.RefreshScores();
|
||||
|
||||
private void changeTab(ValueChangedEvent<DisplayMode> mode)
|
||||
{
|
||||
chat.FadeTo(mode.NewValue == DisplayMode.Chat ? 1 : 0, fade_duration);
|
||||
leaderboard.FadeTo(mode.NewValue == DisplayMode.Leaderboard ? 1 : 0, fade_duration);
|
||||
}
|
||||
|
||||
private class DisplayModeTabControl : OsuTabControl<DisplayMode>
|
||||
{
|
||||
protected override TabItem<DisplayMode> CreateTabItem(DisplayMode value) => base.CreateTabItem(value).With(d =>
|
||||
{
|
||||
d.Anchor = Anchor.Centre;
|
||||
d.Origin = Anchor.Centre;
|
||||
});
|
||||
}
|
||||
|
||||
private enum DisplayMode
|
||||
{
|
||||
Leaderboard,
|
||||
Chat,
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
// 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;
|
||||
using osu.Game.Screens.Multi.Components;
|
||||
|
||||
namespace osu.Game.Screens.Multi.Match.Components
|
||||
{
|
||||
public class OverlinedChatDisplay : OverlinedDisplay
|
||||
{
|
||||
public OverlinedChatDisplay()
|
||||
: base("Chat")
|
||||
{
|
||||
Content.Add(new MatchChatDisplay
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
// 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;
|
||||
using osu.Game.Screens.Multi.Components;
|
||||
|
||||
namespace osu.Game.Screens.Multi.Match.Components
|
||||
{
|
||||
public class OverlinedLeaderboard : OverlinedDisplay
|
||||
{
|
||||
private readonly MatchLeaderboard leaderboard;
|
||||
|
||||
public OverlinedLeaderboard()
|
||||
: base("Leaderboard")
|
||||
{
|
||||
Content.Add(leaderboard = new MatchLeaderboard
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both
|
||||
});
|
||||
}
|
||||
|
||||
public void RefreshScores() => leaderboard.RefreshScores();
|
||||
}
|
||||
}
|
@ -52,8 +52,8 @@ namespace osu.Game.Screens.Multi.Match
|
||||
|
||||
protected readonly Bindable<PlaylistItem> SelectedItem = new Bindable<PlaylistItem>();
|
||||
|
||||
private LeaderboardChatDisplay leaderboardChatDisplay;
|
||||
private MatchSettingsOverlay settingsOverlay;
|
||||
private OverlinedLeaderboard leaderboard;
|
||||
|
||||
private IBindable<WeakReference<BeatmapSetInfo>> managerUpdated;
|
||||
|
||||
@ -87,82 +87,107 @@ namespace osu.Game.Screens.Multi.Match
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Content = new[]
|
||||
{
|
||||
new Drawable[] { new Components.Header() },
|
||||
new Drawable[]
|
||||
{
|
||||
new Components.Header()
|
||||
},
|
||||
new Drawable[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Top = 65 },
|
||||
Child = new GridContainer
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Margin = new MarginPadding { Top = 10 },
|
||||
Child = new OverlinedParticipants(Direction.Horizontal)
|
||||
{
|
||||
ColumnDimensions = new[]
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
ShowLine = false
|
||||
}
|
||||
}
|
||||
},
|
||||
new Drawable[]
|
||||
{
|
||||
new GridContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Content = new[]
|
||||
{
|
||||
new Drawable[]
|
||||
{
|
||||
new Dimension(minSize: 160),
|
||||
new Dimension(minSize: 360),
|
||||
new Dimension(minSize: 400),
|
||||
},
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Content = new[]
|
||||
{
|
||||
new Drawable[]
|
||||
new Container
|
||||
{
|
||||
new Container
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Right = 5 },
|
||||
Child = new GridContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Right = 5 },
|
||||
Child = new OverlinedParticipants(Direction.Vertical) { RelativeSizeAxes = Axes.Both }
|
||||
},
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Horizontal = 5 },
|
||||
Child = new GridContainer
|
||||
Content = new[]
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Content = new[]
|
||||
new Drawable[]
|
||||
{
|
||||
new Drawable[]
|
||||
new OverlinedPlaylist(true) // Temporarily always allow selection
|
||||
{
|
||||
new OverlinedPlaylist(true) // Temporarily always allow selection
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
SelectedItem = { BindTarget = SelectedItem }
|
||||
}
|
||||
},
|
||||
null,
|
||||
new Drawable[]
|
||||
{
|
||||
new TriangleButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Text = "Show beatmap results",
|
||||
Action = showBeatmapResults
|
||||
}
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
SelectedItem = { BindTarget = SelectedItem }
|
||||
}
|
||||
},
|
||||
RowDimensions = new[]
|
||||
null,
|
||||
new Drawable[]
|
||||
{
|
||||
new Dimension(),
|
||||
new Dimension(GridSizeMode.Absolute, 5),
|
||||
new Dimension(GridSizeMode.AutoSize)
|
||||
new TriangleButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Text = "Show beatmap results",
|
||||
Action = showBeatmapResults
|
||||
}
|
||||
}
|
||||
},
|
||||
RowDimensions = new[]
|
||||
{
|
||||
new Dimension(),
|
||||
new Dimension(GridSizeMode.Absolute, 5),
|
||||
new Dimension(GridSizeMode.AutoSize)
|
||||
}
|
||||
},
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Left = 5 },
|
||||
Child = leaderboardChatDisplay = new LeaderboardChatDisplay()
|
||||
}
|
||||
},
|
||||
}
|
||||
null,
|
||||
new GridContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Content = new[]
|
||||
{
|
||||
new Drawable[]
|
||||
{
|
||||
leaderboard = new OverlinedLeaderboard { RelativeSizeAxes = Axes.Both },
|
||||
},
|
||||
new Drawable[]
|
||||
{
|
||||
new OverlinedChatDisplay { RelativeSizeAxes = Axes.Both }
|
||||
}
|
||||
},
|
||||
RowDimensions = new[]
|
||||
{
|
||||
new Dimension(),
|
||||
new Dimension(GridSizeMode.Relative, size: 0.4f, minSize: 240),
|
||||
}
|
||||
},
|
||||
null
|
||||
},
|
||||
},
|
||||
ColumnDimensions = new[]
|
||||
{
|
||||
new Dimension(GridSizeMode.Relative, size: 0.5f, maxSize: 400),
|
||||
new Dimension(),
|
||||
new Dimension(GridSizeMode.Relative, size: 0.5f, maxSize: 600),
|
||||
new Dimension(),
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
RowDimensions = new[]
|
||||
{
|
||||
new Dimension(GridSizeMode.AutoSize),
|
||||
new Dimension(GridSizeMode.AutoSize),
|
||||
new Dimension(),
|
||||
}
|
||||
@ -261,7 +286,7 @@ namespace osu.Game.Screens.Multi.Match
|
||||
case GameTypeTimeshift _:
|
||||
multiplayer?.Push(new PlayerLoader(() => new TimeshiftPlayer(SelectedItem.Value)
|
||||
{
|
||||
Exited = () => leaderboardChatDisplay.RefreshScores()
|
||||
Exited = () => leaderboard.RefreshScores()
|
||||
}));
|
||||
break;
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ namespace osu.Game.Screens.Multi
|
||||
Child = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = ColourInfo.GradientVertical(backgroundColour.Opacity(0.7f), backgroundColour)
|
||||
Colour = ColourInfo.GradientVertical(backgroundColour.Opacity(0.5f), backgroundColour)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -2,21 +2,20 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Screens.Select.Filter;
|
||||
using Container = osu.Framework.Graphics.Containers.Container;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Screens.Select.Filter;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
{
|
||||
@ -26,9 +25,7 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
public Action<FilterCriteria> FilterChanged;
|
||||
|
||||
private readonly OsuTabControl<SortMode> sortTabs;
|
||||
|
||||
private readonly TabControl<GroupMode> groupTabs;
|
||||
private OsuTabControl<SortMode> sortTabs;
|
||||
|
||||
private Bindable<SortMode> sortMode;
|
||||
|
||||
@ -56,19 +53,39 @@ namespace osu.Game.Screens.Select
|
||||
return criteria;
|
||||
}
|
||||
|
||||
private readonly SeekLimitedSearchTextBox searchTextBox;
|
||||
private SeekLimitedSearchTextBox searchTextBox;
|
||||
|
||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) =>
|
||||
base.ReceivePositionalInputAt(screenSpacePos) || groupTabs.ReceivePositionalInputAt(screenSpacePos) || sortTabs.ReceivePositionalInputAt(screenSpacePos);
|
||||
base.ReceivePositionalInputAt(screenSpacePos) || sortTabs.ReceivePositionalInputAt(screenSpacePos);
|
||||
|
||||
public FilterControl()
|
||||
[BackgroundDependencyLoader(permitNulls: true)]
|
||||
private void load(OsuColour colours, IBindable<RulesetInfo> parentRuleset, OsuConfigManager config)
|
||||
{
|
||||
config.BindWith(OsuSetting.ShowConvertedBeatmaps, showConverted);
|
||||
showConverted.ValueChanged += _ => updateCriteria();
|
||||
|
||||
config.BindWith(OsuSetting.DisplayStarsMinimum, minimumStars);
|
||||
minimumStars.ValueChanged += _ => updateCriteria();
|
||||
|
||||
config.BindWith(OsuSetting.DisplayStarsMaximum, maximumStars);
|
||||
maximumStars.ValueChanged += _ => updateCriteria();
|
||||
|
||||
ruleset.BindTo(parentRuleset);
|
||||
ruleset.BindValueChanged(_ => updateCriteria());
|
||||
|
||||
sortMode = config.GetBindable<SortMode>(OsuSetting.SongSelectSortingMode);
|
||||
groupMode = config.GetBindable<GroupMode>(OsuSetting.SongSelectGroupingMode);
|
||||
|
||||
groupMode.BindValueChanged(_ => updateCriteria());
|
||||
sortMode.BindValueChanged(_ => updateCriteria());
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
Background = new Box
|
||||
new Box
|
||||
{
|
||||
Colour = Color4.Black,
|
||||
Alpha = 0.8f,
|
||||
Width = 2,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
new Container
|
||||
@ -96,33 +113,35 @@ namespace osu.Game.Screens.Select
|
||||
Direction = FillDirection.Horizontal,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Spacing = new Vector2(OsuTabControl<SortMode>.HORIZONTAL_SPACING, 0),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
groupTabs = new OsuTabControl<GroupMode>
|
||||
new OsuTabControlCheckbox
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 24,
|
||||
Width = 0.5f,
|
||||
AutoSort = true,
|
||||
Text = "Show converted",
|
||||
Current = config.GetBindable<bool>(OsuSetting.ShowConvertedBeatmaps),
|
||||
Anchor = Anchor.BottomRight,
|
||||
Origin = Anchor.BottomRight,
|
||||
},
|
||||
//spriteText = new OsuSpriteText
|
||||
//{
|
||||
// Font = @"Exo2.0-Bold",
|
||||
// Text = "Sort results by",
|
||||
// Size = 14,
|
||||
// Margin = new MarginPadding
|
||||
// {
|
||||
// Top = 5,
|
||||
// Bottom = 5
|
||||
// },
|
||||
//},
|
||||
sortTabs = new OsuTabControl<SortMode>
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Width = 0.5f,
|
||||
Height = 24,
|
||||
AutoSort = true,
|
||||
}
|
||||
Anchor = Anchor.BottomRight,
|
||||
Origin = Anchor.BottomRight,
|
||||
AccentColour = colours.GreenLight,
|
||||
Current = { BindTarget = sortMode }
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = "Sort by",
|
||||
Font = OsuFont.GetFont(size: 14),
|
||||
Margin = new MarginPadding(5),
|
||||
Anchor = Anchor.BottomRight,
|
||||
Origin = Anchor.BottomRight,
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
@ -131,8 +150,7 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
searchTextBox.Current.ValueChanged += _ => FilterChanged?.Invoke(CreateCriteria());
|
||||
|
||||
groupTabs.PinItem(GroupMode.All);
|
||||
groupTabs.PinItem(GroupMode.RecentlyPlayed);
|
||||
updateCriteria();
|
||||
}
|
||||
|
||||
public void Deactivate()
|
||||
@ -156,37 +174,6 @@ namespace osu.Game.Screens.Select
|
||||
private readonly Bindable<double> minimumStars = new BindableDouble();
|
||||
private readonly Bindable<double> maximumStars = new BindableDouble();
|
||||
|
||||
public readonly Box Background;
|
||||
|
||||
[BackgroundDependencyLoader(permitNulls: true)]
|
||||
private void load(OsuColour colours, IBindable<RulesetInfo> parentRuleset, OsuConfigManager config)
|
||||
{
|
||||
sortTabs.AccentColour = colours.GreenLight;
|
||||
|
||||
config.BindWith(OsuSetting.ShowConvertedBeatmaps, showConverted);
|
||||
showConverted.ValueChanged += _ => updateCriteria();
|
||||
|
||||
config.BindWith(OsuSetting.DisplayStarsMinimum, minimumStars);
|
||||
minimumStars.ValueChanged += _ => updateCriteria();
|
||||
|
||||
config.BindWith(OsuSetting.DisplayStarsMaximum, maximumStars);
|
||||
maximumStars.ValueChanged += _ => updateCriteria();
|
||||
|
||||
ruleset.BindTo(parentRuleset);
|
||||
ruleset.BindValueChanged(_ => updateCriteria());
|
||||
|
||||
sortMode = config.GetBindable<SortMode>(OsuSetting.SongSelectSortingMode);
|
||||
groupMode = config.GetBindable<GroupMode>(OsuSetting.SongSelectGroupingMode);
|
||||
|
||||
sortTabs.Current.BindTo(sortMode);
|
||||
groupTabs.Current.BindTo(groupMode);
|
||||
|
||||
groupMode.BindValueChanged(_ => updateCriteria());
|
||||
sortMode.BindValueChanged(_ => updateCriteria());
|
||||
|
||||
updateCriteria();
|
||||
}
|
||||
|
||||
private void updateCriteria() => FilterChanged?.Invoke(CreateCriteria());
|
||||
|
||||
protected override bool OnClick(ClickEvent e) => true;
|
||||
|
@ -173,7 +173,6 @@ namespace osu.Game.Screens.Select
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = FilterControl.HEIGHT,
|
||||
FilterChanged = ApplyFilterToCarousel,
|
||||
Background = { Width = 2 },
|
||||
},
|
||||
new GridContainer // used for max width implementation
|
||||
{
|
||||
|
@ -115,6 +115,7 @@ namespace osu.Game.Skinning
|
||||
case string _ when pair.Key.StartsWith("NoteImage"):
|
||||
case string _ when pair.Key.StartsWith("KeyImage"):
|
||||
case string _ when pair.Key.StartsWith("Hit"):
|
||||
case string _ when pair.Key.StartsWith("Stage"):
|
||||
currentConfig.ImageLookups[pair.Key] = pair.Value;
|
||||
break;
|
||||
}
|
||||
|
@ -250,6 +250,15 @@ namespace osu.Game.Skinning
|
||||
case LegacyManiaSkinConfigurationLookups.RightStageImage:
|
||||
return SkinUtils.As<TValue>(getManiaImage(existing, "StageRight"));
|
||||
|
||||
case LegacyManiaSkinConfigurationLookups.BottomStageImage:
|
||||
return SkinUtils.As<TValue>(getManiaImage(existing, "StageBottom"));
|
||||
|
||||
case LegacyManiaSkinConfigurationLookups.LightImage:
|
||||
return SkinUtils.As<TValue>(getManiaImage(existing, "StageLight"));
|
||||
|
||||
case LegacyManiaSkinConfigurationLookups.HitTargetImage:
|
||||
return SkinUtils.As<TValue>(getManiaImage(existing, "StageHint"));
|
||||
|
||||
case LegacyManiaSkinConfigurationLookups.LeftLineWidth:
|
||||
Debug.Assert(maniaLookup.TargetColumn != null);
|
||||
return SkinUtils.As<TValue>(new Bindable<float>(existing.ColumnLineWidth[maniaLookup.TargetColumn.Value]));
|
||||
|
@ -10,7 +10,7 @@ namespace osu.Game.Tests.Visual
|
||||
public abstract class MultiplayerTestScene : ScreenTestScene
|
||||
{
|
||||
[Cached]
|
||||
private readonly Bindable<Room> currentRoom = new Bindable<Room>(new Room());
|
||||
private readonly Bindable<Room> currentRoom = new Bindable<Room>();
|
||||
|
||||
protected Room Room
|
||||
{
|
||||
|
@ -24,7 +24,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.701.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2020.710.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.622.1" />
|
||||
<PackageReference Include="Sentry" Version="2.1.4" />
|
||||
<PackageReference Include="SharpCompress" Version="0.25.1" />
|
||||
|
@ -70,7 +70,7 @@
|
||||
<Reference Include="System.Net.Http" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Label="Package References">
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.701.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.710.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.622.1" />
|
||||
</ItemGroup>
|
||||
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->
|
||||
@ -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.701.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2020.710.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.25.1" />
|
||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||
|
Loading…
Reference in New Issue
Block a user