mirror of
https://github.com/osukey/osukey.git
synced 2025-08-06 16:13:57 +09:00
Merge branch 'master' into fix-taiko-editor-type-stats
This commit is contained in:
@ -0,0 +1,90 @@
|
|||||||
|
// 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.Testing;
|
||||||
|
using osu.Framework.Utils;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
using osu.Game.Rulesets.Osu.UI;
|
||||||
|
using osu.Game.Tests.Beatmaps;
|
||||||
|
using osuTK;
|
||||||
|
using osuTK.Input;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Tests.Editor
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class TestSceneObjectObjectSnap : TestSceneOsuEditor
|
||||||
|
{
|
||||||
|
private OsuPlayfield playfield;
|
||||||
|
|
||||||
|
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) => new TestBeatmap(Ruleset.Value, false);
|
||||||
|
|
||||||
|
public override void SetUpSteps()
|
||||||
|
{
|
||||||
|
base.SetUpSteps();
|
||||||
|
AddStep("get playfield", () => playfield = Editor.ChildrenOfType<OsuPlayfield>().First());
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestCase(true)]
|
||||||
|
[TestCase(false)]
|
||||||
|
public void TestHitCircleSnapsToOtherHitCircle(bool distanceSnapEnabled)
|
||||||
|
{
|
||||||
|
AddStep("move mouse to centre", () => InputManager.MoveMouseTo(playfield.ScreenSpaceDrawQuad.Centre));
|
||||||
|
|
||||||
|
if (!distanceSnapEnabled)
|
||||||
|
AddStep("disable distance snap", () => InputManager.Key(Key.Q));
|
||||||
|
|
||||||
|
AddStep("enter placement mode", () => InputManager.Key(Key.Number2));
|
||||||
|
|
||||||
|
AddStep("place first object", () => InputManager.Click(MouseButton.Left));
|
||||||
|
|
||||||
|
AddStep("move mouse slightly", () => InputManager.MoveMouseTo(playfield.ScreenSpaceDrawQuad.Centre + new Vector2(playfield.ScreenSpaceDrawQuad.Width * 0.02f, 0)));
|
||||||
|
|
||||||
|
AddStep("place second object", () => InputManager.Click(MouseButton.Left));
|
||||||
|
|
||||||
|
AddAssert("both objects at same location", () =>
|
||||||
|
{
|
||||||
|
var objects = EditorBeatmap.HitObjects;
|
||||||
|
|
||||||
|
var first = (OsuHitObject)objects.First();
|
||||||
|
var second = (OsuHitObject)objects.Last();
|
||||||
|
|
||||||
|
return first.Position == second.Position;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestHitCircleSnapsToSliderEnd()
|
||||||
|
{
|
||||||
|
AddStep("move mouse to centre", () => InputManager.MoveMouseTo(playfield.ScreenSpaceDrawQuad.Centre));
|
||||||
|
|
||||||
|
AddStep("disable distance snap", () => InputManager.Key(Key.Q));
|
||||||
|
|
||||||
|
AddStep("enter slider placement mode", () => InputManager.Key(Key.Number3));
|
||||||
|
|
||||||
|
AddStep("start slider placement", () => InputManager.Click(MouseButton.Left));
|
||||||
|
|
||||||
|
AddStep("move to place end", () => InputManager.MoveMouseTo(playfield.ScreenSpaceDrawQuad.Centre + new Vector2(playfield.ScreenSpaceDrawQuad.Width * 0.185f, 0)));
|
||||||
|
|
||||||
|
AddStep("end slider placement", () => InputManager.Click(MouseButton.Right));
|
||||||
|
|
||||||
|
AddStep("enter circle placement mode", () => InputManager.Key(Key.Number2));
|
||||||
|
|
||||||
|
AddStep("move mouse slightly", () => InputManager.MoveMouseTo(playfield.ScreenSpaceDrawQuad.Centre + new Vector2(playfield.ScreenSpaceDrawQuad.Width * 0.20f, 0)));
|
||||||
|
|
||||||
|
AddStep("place second object", () => InputManager.Click(MouseButton.Left));
|
||||||
|
|
||||||
|
AddAssert("circle is at slider's end", () =>
|
||||||
|
{
|
||||||
|
var objects = EditorBeatmap.HitObjects;
|
||||||
|
|
||||||
|
var first = (Slider)objects.First();
|
||||||
|
var second = (OsuHitObject)objects.Last();
|
||||||
|
|
||||||
|
return Precision.AlmostEquals(first.EndPosition, second.Position);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -4,10 +4,10 @@
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Game.Tests.Visual;
|
using osu.Game.Tests.Visual;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Tests
|
namespace osu.Game.Rulesets.Osu.Tests.Editor
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TestSceneEditor : EditorTestScene
|
public class TestSceneOsuEditor : EditorTestScene
|
||||||
{
|
{
|
||||||
protected override Ruleset CreateEditorRuleset() => new OsuRuleset();
|
protected override Ruleset CreateEditorRuleset() => new OsuRuleset();
|
||||||
}
|
}
|
@ -94,6 +94,10 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
|
|
||||||
public override SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition)
|
public override SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition)
|
||||||
{
|
{
|
||||||
|
if (snapToVisibleBlueprints(screenSpacePosition, out var snapResult))
|
||||||
|
return snapResult;
|
||||||
|
|
||||||
|
// will be null if distance snap is disabled or not feasible for the current time value.
|
||||||
if (distanceSnapGrid == null)
|
if (distanceSnapGrid == null)
|
||||||
return base.SnapScreenSpacePositionToValidTime(screenSpacePosition);
|
return base.SnapScreenSpacePositionToValidTime(screenSpacePosition);
|
||||||
|
|
||||||
@ -102,6 +106,50 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
return new SnapResult(distanceSnapGrid.ToScreenSpace(pos), time, PlayfieldAtScreenSpacePosition(screenSpacePosition));
|
return new SnapResult(distanceSnapGrid.ToScreenSpace(pos), time, PlayfieldAtScreenSpacePosition(screenSpacePosition));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool snapToVisibleBlueprints(Vector2 screenSpacePosition, out SnapResult snapResult)
|
||||||
|
{
|
||||||
|
// check other on-screen objects for snapping/stacking
|
||||||
|
var blueprints = BlueprintContainer.SelectionBlueprints.AliveChildren;
|
||||||
|
|
||||||
|
var playfield = PlayfieldAtScreenSpacePosition(screenSpacePosition);
|
||||||
|
|
||||||
|
float snapRadius =
|
||||||
|
playfield.GamefieldToScreenSpace(new Vector2(OsuHitObject.OBJECT_RADIUS / 5)).X -
|
||||||
|
playfield.GamefieldToScreenSpace(Vector2.Zero).X;
|
||||||
|
|
||||||
|
foreach (var b in blueprints)
|
||||||
|
{
|
||||||
|
if (b.IsSelected)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var hitObject = (OsuHitObject)b.HitObject;
|
||||||
|
|
||||||
|
Vector2? snap = checkSnap(hitObject.Position);
|
||||||
|
if (snap == null && hitObject.Position != hitObject.EndPosition)
|
||||||
|
snap = checkSnap(hitObject.EndPosition);
|
||||||
|
|
||||||
|
if (snap != null)
|
||||||
|
{
|
||||||
|
// only return distance portion, since time is not really valid
|
||||||
|
snapResult = new SnapResult(snap.Value, null, playfield);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector2? checkSnap(Vector2 checkPos)
|
||||||
|
{
|
||||||
|
Vector2 checkScreenPos = playfield.GamefieldToScreenSpace(checkPos);
|
||||||
|
|
||||||
|
if (Vector2.Distance(checkScreenPos, screenSpacePosition) < snapRadius)
|
||||||
|
return checkScreenPos;
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
snapResult = null;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private void updateDistanceSnapGrid()
|
private void updateDistanceSnapGrid()
|
||||||
{
|
{
|
||||||
distanceSnapGridContainer.Clear();
|
distanceSnapGridContainer.Clear();
|
||||||
|
136
osu.Game.Tests/Rulesets/TestSceneDrawableRulesetDependencies.cs
Normal file
136
osu.Game.Tests/Rulesets/TestSceneDrawableRulesetDependencies.cs
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
// 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.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio;
|
||||||
|
using osu.Framework.Audio.Sample;
|
||||||
|
using osu.Framework.Audio.Track;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.OpenGL.Textures;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using osu.Framework.Testing;
|
||||||
|
using osu.Game.Rulesets.Osu;
|
||||||
|
using osu.Game.Rulesets.UI;
|
||||||
|
using osu.Game.Tests.Visual;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Rulesets
|
||||||
|
{
|
||||||
|
[HeadlessTest]
|
||||||
|
public class TestSceneDrawableRulesetDependencies : OsuTestScene
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void TestDisposalDoesNotDisposeParentStores()
|
||||||
|
{
|
||||||
|
DrawableWithDependencies drawable = null;
|
||||||
|
TestTextureStore textureStore = null;
|
||||||
|
TestSampleStore sampleStore = null;
|
||||||
|
|
||||||
|
AddStep("add dependencies", () =>
|
||||||
|
{
|
||||||
|
Child = drawable = new DrawableWithDependencies();
|
||||||
|
textureStore = drawable.ParentTextureStore;
|
||||||
|
sampleStore = drawable.ParentSampleStore;
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("clear children", Clear);
|
||||||
|
AddUntilStep("wait for disposal", () => drawable.IsDisposed);
|
||||||
|
|
||||||
|
AddStep("GC", () =>
|
||||||
|
{
|
||||||
|
drawable = null;
|
||||||
|
|
||||||
|
GC.Collect();
|
||||||
|
GC.WaitForPendingFinalizers();
|
||||||
|
});
|
||||||
|
|
||||||
|
AddAssert("parent texture store not disposed", () => !textureStore.IsDisposed);
|
||||||
|
AddAssert("parent sample store not disposed", () => !sampleStore.IsDisposed);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class DrawableWithDependencies : CompositeDrawable
|
||||||
|
{
|
||||||
|
public TestTextureStore ParentTextureStore { get; private set; }
|
||||||
|
public TestSampleStore ParentSampleStore { get; private set; }
|
||||||
|
|
||||||
|
public DrawableWithDependencies()
|
||||||
|
{
|
||||||
|
InternalChild = new Box { RelativeSizeAxes = Axes.Both };
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||||
|
{
|
||||||
|
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
||||||
|
|
||||||
|
dependencies.CacheAs<TextureStore>(ParentTextureStore = new TestTextureStore());
|
||||||
|
dependencies.CacheAs<ISampleStore>(ParentSampleStore = new TestSampleStore());
|
||||||
|
|
||||||
|
return new DrawableRulesetDependencies(new OsuRuleset(), dependencies);
|
||||||
|
}
|
||||||
|
|
||||||
|
public new bool IsDisposed { get; private set; }
|
||||||
|
|
||||||
|
protected override void Dispose(bool isDisposing)
|
||||||
|
{
|
||||||
|
base.Dispose(isDisposing);
|
||||||
|
IsDisposed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestTextureStore : TextureStore
|
||||||
|
{
|
||||||
|
public override Texture Get(string name, WrapMode wrapModeS, WrapMode wrapModeT) => null;
|
||||||
|
|
||||||
|
public bool IsDisposed { get; private set; }
|
||||||
|
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
base.Dispose(disposing);
|
||||||
|
IsDisposed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestSampleStore : ISampleStore
|
||||||
|
{
|
||||||
|
public bool IsDisposed { get; private set; }
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
IsDisposed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SampleChannel Get(string name) => null;
|
||||||
|
|
||||||
|
public Task<SampleChannel> GetAsync(string name) => null;
|
||||||
|
|
||||||
|
public Stream GetStream(string name) => null;
|
||||||
|
|
||||||
|
public IEnumerable<string> GetAvailableResources() => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public BindableNumber<double> Volume => throw new NotImplementedException();
|
||||||
|
public BindableNumber<double> Balance => throw new NotImplementedException();
|
||||||
|
public BindableNumber<double> Frequency => throw new NotImplementedException();
|
||||||
|
public BindableNumber<double> Tempo => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public void AddAdjustment(AdjustableProperty type, BindableNumber<double> adjustBindable) => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public void RemoveAdjustment(AdjustableProperty type, BindableNumber<double> adjustBindable) => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public void RemoveAllAdjustments(AdjustableProperty type) => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public IBindable<double> AggregateVolume => throw new NotImplementedException();
|
||||||
|
public IBindable<double> AggregateBalance => throw new NotImplementedException();
|
||||||
|
public IBindable<double> AggregateFrequency => throw new NotImplementedException();
|
||||||
|
public IBindable<double> AggregateTempo => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public int PlaybackConcurrency { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -220,7 +220,7 @@ namespace osu.Game.Tests.Visual.Ranking
|
|||||||
|
|
||||||
AddStep("load results", () => Child = new TestResultsContainer(screen = createResultsScreen()));
|
AddStep("load results", () => Child = new TestResultsContainer(screen = createResultsScreen()));
|
||||||
|
|
||||||
AddAssert("download button is disabled", () => !screen.ChildrenOfType<DownloadButton>().Single().Enabled.Value);
|
AddAssert("download button is disabled", () => !screen.ChildrenOfType<DownloadButton>().Last().Enabled.Value);
|
||||||
|
|
||||||
AddStep("click contracted panel", () =>
|
AddStep("click contracted panel", () =>
|
||||||
{
|
{
|
||||||
@ -229,7 +229,7 @@ namespace osu.Game.Tests.Visual.Ranking
|
|||||||
InputManager.Click(MouseButton.Left);
|
InputManager.Click(MouseButton.Left);
|
||||||
});
|
});
|
||||||
|
|
||||||
AddAssert("download button is enabled", () => screen.ChildrenOfType<DownloadButton>().Single().Enabled.Value);
|
AddAssert("download button is enabled", () => screen.ChildrenOfType<DownloadButton>().Last().Enabled.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestResultsContainer : Container
|
private class TestResultsContainer : Container
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Platform;
|
|
||||||
using osu.Game.Graphics.UserInterfaceV2;
|
using osu.Game.Graphics.UserInterfaceV2;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Settings
|
namespace osu.Game.Tests.Visual.Settings
|
||||||
@ -11,7 +10,7 @@ namespace osu.Game.Tests.Visual.Settings
|
|||||||
public class TestSceneDirectorySelector : OsuTestScene
|
public class TestSceneDirectorySelector : OsuTestScene
|
||||||
{
|
{
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(GameHost host)
|
private void load()
|
||||||
{
|
{
|
||||||
Add(new DirectorySelector { RelativeSizeAxes = Axes.Both });
|
Add(new DirectorySelector { RelativeSizeAxes = Axes.Both });
|
||||||
}
|
}
|
||||||
|
24
osu.Game.Tests/Visual/Settings/TestSceneFileSelector.cs
Normal file
24
osu.Game.Tests/Visual/Settings/TestSceneFileSelector.cs
Normal file
@ -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 NUnit.Framework;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Graphics.UserInterfaceV2;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.Settings
|
||||||
|
{
|
||||||
|
public class TestSceneFileSelector : OsuTestScene
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void TestAllFiles()
|
||||||
|
{
|
||||||
|
AddStep("create", () => Child = new FileSelector { RelativeSizeAxes = Axes.Both });
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestJpgFilesOnly()
|
||||||
|
{
|
||||||
|
AddStep("create", () => Child = new FileSelector(validFileExtensions: new[] { ".jpg" }) { RelativeSizeAxes = Axes.Both });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -129,7 +129,7 @@ namespace osu.Game.Tournament.Screens
|
|||||||
|
|
||||||
protected virtual void ChangePath()
|
protected virtual void ChangePath()
|
||||||
{
|
{
|
||||||
var target = directorySelector.CurrentDirectory.Value.FullName;
|
var target = directorySelector.CurrentPath.Value.FullName;
|
||||||
var fileBasedIpc = ipc as FileBasedIPC;
|
var fileBasedIpc = ipc as FileBasedIPC;
|
||||||
Logger.Log($"Changing Stable CE location to {target}");
|
Logger.Log($"Changing Stable CE location to {target}");
|
||||||
|
|
||||||
|
@ -28,11 +28,11 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
private GameHost host { get; set; }
|
private GameHost host { get; set; }
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
public readonly Bindable<DirectoryInfo> CurrentDirectory = new Bindable<DirectoryInfo>();
|
public readonly Bindable<DirectoryInfo> CurrentPath = new Bindable<DirectoryInfo>();
|
||||||
|
|
||||||
public DirectorySelector(string initialPath = null)
|
public DirectorySelector(string initialPath = null)
|
||||||
{
|
{
|
||||||
CurrentDirectory.Value = new DirectoryInfo(initialPath ?? Environment.GetFolderPath(Environment.SpecialFolder.UserProfile));
|
CurrentPath.Value = new DirectoryInfo(initialPath ?? Environment.GetFolderPath(Environment.SpecialFolder.UserProfile));
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -74,7 +74,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
CurrentDirectory.BindValueChanged(updateDisplay, true);
|
CurrentPath.BindValueChanged(updateDisplay, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateDisplay(ValueChangedEvent<DirectoryInfo> directory)
|
private void updateDisplay(ValueChangedEvent<DirectoryInfo> directory)
|
||||||
@ -92,22 +92,27 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
directoryFlow.Add(new ParentDirectoryPiece(CurrentDirectory.Value.Parent));
|
directoryFlow.Add(new ParentDirectoryPiece(CurrentPath.Value.Parent));
|
||||||
|
|
||||||
foreach (var dir in CurrentDirectory.Value.GetDirectories().OrderBy(d => d.Name))
|
directoryFlow.AddRange(GetEntriesForPath(CurrentPath.Value));
|
||||||
{
|
|
||||||
if ((dir.Attributes & FileAttributes.Hidden) == 0)
|
|
||||||
directoryFlow.Add(new DirectoryPiece(dir));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
CurrentDirectory.Value = directory.OldValue;
|
CurrentPath.Value = directory.OldValue;
|
||||||
this.FlashColour(Color4.Red, 300);
|
this.FlashColour(Color4.Red, 300);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected virtual IEnumerable<DisplayPiece> GetEntriesForPath(DirectoryInfo path)
|
||||||
|
{
|
||||||
|
foreach (var dir in path.GetDirectories().OrderBy(d => d.Name))
|
||||||
|
{
|
||||||
|
if ((dir.Attributes & FileAttributes.Hidden) == 0)
|
||||||
|
yield return new DirectoryPiece(dir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class CurrentDirectoryDisplay : CompositeDrawable
|
private class CurrentDirectoryDisplay : CompositeDrawable
|
||||||
{
|
{
|
||||||
[Resolved]
|
[Resolved]
|
||||||
@ -126,7 +131,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Spacing = new Vector2(5),
|
Spacing = new Vector2(5),
|
||||||
Height = DirectoryPiece.HEIGHT,
|
Height = DisplayPiece.HEIGHT,
|
||||||
Direction = FillDirection.Horizontal,
|
Direction = FillDirection.Horizontal,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -150,7 +155,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
|
|
||||||
flow.ChildrenEnumerable = new Drawable[]
|
flow.ChildrenEnumerable = new Drawable[]
|
||||||
{
|
{
|
||||||
new OsuSpriteText { Text = "Current Directory: ", Font = OsuFont.Default.With(size: DirectoryPiece.HEIGHT), },
|
new OsuSpriteText { Text = "Current Directory: ", Font = OsuFont.Default.With(size: DisplayPiece.HEIGHT), },
|
||||||
new ComputerPiece(),
|
new ComputerPiece(),
|
||||||
}.Concat(pathPieces);
|
}.Concat(pathPieces);
|
||||||
}
|
}
|
||||||
@ -198,24 +203,44 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DirectoryPiece : CompositeDrawable
|
protected class DirectoryPiece : DisplayPiece
|
||||||
{
|
{
|
||||||
public const float HEIGHT = 20;
|
|
||||||
|
|
||||||
protected const float FONT_SIZE = 16;
|
|
||||||
|
|
||||||
protected readonly DirectoryInfo Directory;
|
protected readonly DirectoryInfo Directory;
|
||||||
|
|
||||||
private readonly string displayName;
|
|
||||||
|
|
||||||
protected FillFlowContainer Flow;
|
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private Bindable<DirectoryInfo> currentDirectory { get; set; }
|
private Bindable<DirectoryInfo> currentDirectory { get; set; }
|
||||||
|
|
||||||
public DirectoryPiece(DirectoryInfo directory, string displayName = null)
|
public DirectoryPiece(DirectoryInfo directory, string displayName = null)
|
||||||
|
: base(displayName)
|
||||||
{
|
{
|
||||||
Directory = directory;
|
Directory = directory;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnClick(ClickEvent e)
|
||||||
|
{
|
||||||
|
currentDirectory.Value = Directory;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override string FallbackName => Directory.Name;
|
||||||
|
|
||||||
|
protected override IconUsage? Icon => Directory.Name.Contains(Path.DirectorySeparatorChar)
|
||||||
|
? FontAwesome.Solid.Database
|
||||||
|
: FontAwesome.Regular.Folder;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract class DisplayPiece : CompositeDrawable
|
||||||
|
{
|
||||||
|
public const float HEIGHT = 20;
|
||||||
|
|
||||||
|
protected const float FONT_SIZE = 16;
|
||||||
|
|
||||||
|
private readonly string displayName;
|
||||||
|
|
||||||
|
protected FillFlowContainer Flow;
|
||||||
|
|
||||||
|
protected DisplayPiece(string displayName = null)
|
||||||
|
{
|
||||||
this.displayName = displayName;
|
this.displayName = displayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,20 +284,14 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
Text = displayName ?? Directory.Name,
|
Text = displayName ?? FallbackName,
|
||||||
Font = OsuFont.Default.With(size: FONT_SIZE)
|
Font = OsuFont.Default.With(size: FONT_SIZE)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnClick(ClickEvent e)
|
protected abstract string FallbackName { get; }
|
||||||
{
|
|
||||||
currentDirectory.Value = Directory;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual IconUsage? Icon => Directory.Name.Contains(Path.DirectorySeparatorChar)
|
protected abstract IconUsage? Icon { get; }
|
||||||
? FontAwesome.Solid.Database
|
|
||||||
: FontAwesome.Regular.Folder;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
94
osu.Game/Graphics/UserInterfaceV2/FileSelector.cs
Normal file
94
osu.Game/Graphics/UserInterfaceV2/FileSelector.cs
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
// 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.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
|
|
||||||
|
namespace osu.Game.Graphics.UserInterfaceV2
|
||||||
|
{
|
||||||
|
public class FileSelector : DirectorySelector
|
||||||
|
{
|
||||||
|
private readonly string[] validFileExtensions;
|
||||||
|
|
||||||
|
[Cached]
|
||||||
|
public readonly Bindable<FileInfo> CurrentFile = new Bindable<FileInfo>();
|
||||||
|
|
||||||
|
public FileSelector(string initialPath = null, string[] validFileExtensions = null)
|
||||||
|
: base(initialPath)
|
||||||
|
{
|
||||||
|
this.validFileExtensions = validFileExtensions ?? Array.Empty<string>();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override IEnumerable<DisplayPiece> GetEntriesForPath(DirectoryInfo path)
|
||||||
|
{
|
||||||
|
foreach (var dir in base.GetEntriesForPath(path))
|
||||||
|
yield return dir;
|
||||||
|
|
||||||
|
IEnumerable<FileInfo> files = path.GetFiles();
|
||||||
|
|
||||||
|
if (validFileExtensions.Length > 0)
|
||||||
|
files = files.Where(f => validFileExtensions.Contains(f.Extension));
|
||||||
|
|
||||||
|
foreach (var file in files.OrderBy(d => d.Name))
|
||||||
|
{
|
||||||
|
if ((file.Attributes & FileAttributes.Hidden) == 0)
|
||||||
|
yield return new FilePiece(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected class FilePiece : DisplayPiece
|
||||||
|
{
|
||||||
|
private readonly FileInfo file;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private Bindable<FileInfo> currentFile { get; set; }
|
||||||
|
|
||||||
|
public FilePiece(FileInfo file)
|
||||||
|
{
|
||||||
|
this.file = file;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnClick(ClickEvent e)
|
||||||
|
{
|
||||||
|
currentFile.Value = file;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override string FallbackName => file.Name;
|
||||||
|
|
||||||
|
protected override IconUsage? Icon
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
switch (file.Extension)
|
||||||
|
{
|
||||||
|
case ".ogg":
|
||||||
|
case ".mp3":
|
||||||
|
case ".wav":
|
||||||
|
return FontAwesome.Regular.FileAudio;
|
||||||
|
|
||||||
|
case ".jpg":
|
||||||
|
case ".jpeg":
|
||||||
|
case ".png":
|
||||||
|
return FontAwesome.Regular.FileImage;
|
||||||
|
|
||||||
|
case ".mp4":
|
||||||
|
case ".avi":
|
||||||
|
case ".mov":
|
||||||
|
case ".flv":
|
||||||
|
return FontAwesome.Regular.FileVideo;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return FontAwesome.Regular.File;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -106,7 +106,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
|
|||||||
|
|
||||||
private void start()
|
private void start()
|
||||||
{
|
{
|
||||||
var target = directorySelector.CurrentDirectory.Value;
|
var target = directorySelector.CurrentPath.Value;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -58,6 +58,8 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
|
|
||||||
private RadioButtonCollection toolboxCollection;
|
private RadioButtonCollection toolboxCollection;
|
||||||
|
|
||||||
|
private ToolboxGroup togglesCollection;
|
||||||
|
|
||||||
protected HitObjectComposer(Ruleset ruleset)
|
protected HitObjectComposer(Ruleset ruleset)
|
||||||
{
|
{
|
||||||
Ruleset = ruleset;
|
Ruleset = ruleset;
|
||||||
@ -115,7 +117,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new ToolboxGroup("toolbox") { Child = toolboxCollection = new RadioButtonCollection { RelativeSizeAxes = Axes.X } },
|
new ToolboxGroup("toolbox") { Child = toolboxCollection = new RadioButtonCollection { RelativeSizeAxes = Axes.X } },
|
||||||
new ToolboxGroup("toggles")
|
togglesCollection = new ToolboxGroup("toggles")
|
||||||
{
|
{
|
||||||
ChildrenEnumerable = Toggles.Select(b => new SettingsCheckbox
|
ChildrenEnumerable = Toggles.Select(b => new SettingsCheckbox
|
||||||
{
|
{
|
||||||
@ -190,9 +192,9 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
|
|
||||||
protected override bool OnKeyDown(KeyDownEvent e)
|
protected override bool OnKeyDown(KeyDownEvent e)
|
||||||
{
|
{
|
||||||
if (e.Key >= Key.Number1 && e.Key <= Key.Number9)
|
if (checkLeftToggleFromKey(e.Key, out var leftIndex))
|
||||||
{
|
{
|
||||||
var item = toolboxCollection.Items.ElementAtOrDefault(e.Key - Key.Number1);
|
var item = toolboxCollection.Items.ElementAtOrDefault(leftIndex);
|
||||||
|
|
||||||
if (item != null)
|
if (item != null)
|
||||||
{
|
{
|
||||||
@ -201,9 +203,84 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (checkRightToggleFromKey(e.Key, out var rightIndex))
|
||||||
|
{
|
||||||
|
var item = togglesCollection.ElementAtOrDefault(rightIndex);
|
||||||
|
|
||||||
|
if (item is SettingsCheckbox checkbox)
|
||||||
|
{
|
||||||
|
checkbox.Bindable.Value = !checkbox.Bindable.Value;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return base.OnKeyDown(e);
|
return base.OnKeyDown(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool checkLeftToggleFromKey(Key key, out int index)
|
||||||
|
{
|
||||||
|
if (key < Key.Number1 || key > Key.Number9)
|
||||||
|
{
|
||||||
|
index = -1;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
index = key - Key.Number1;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool checkRightToggleFromKey(Key key, out int index)
|
||||||
|
{
|
||||||
|
switch (key)
|
||||||
|
{
|
||||||
|
case Key.Q:
|
||||||
|
index = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Key.W:
|
||||||
|
index = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Key.E:
|
||||||
|
index = 2;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Key.R:
|
||||||
|
index = 3;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Key.T:
|
||||||
|
index = 4;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Key.Y:
|
||||||
|
index = 5;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Key.U:
|
||||||
|
index = 6;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Key.I:
|
||||||
|
index = 7;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Key.O:
|
||||||
|
index = 8;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Key.P:
|
||||||
|
index = 9;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
index = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return index >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
private void selectionChanged(object sender, NotifyCollectionChangedEventArgs changedArgs)
|
private void selectionChanged(object sender, NotifyCollectionChangedEventArgs changedArgs)
|
||||||
{
|
{
|
||||||
if (EditorBeatmap.SelectedHitObjects.Any())
|
if (EditorBeatmap.SelectedHitObjects.Any())
|
||||||
|
@ -10,6 +10,7 @@ using osu.Framework.Audio;
|
|||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Graphics.OpenGL.Textures;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.IO.Stores;
|
using osu.Framework.IO.Stores;
|
||||||
using osu.Game.Rulesets.Configuration;
|
using osu.Game.Rulesets.Configuration;
|
||||||
@ -46,12 +47,11 @@ namespace osu.Game.Rulesets.UI
|
|||||||
if (resources != null)
|
if (resources != null)
|
||||||
{
|
{
|
||||||
TextureStore = new TextureStore(new TextureLoaderStore(new NamespacedResourceStore<byte[]>(resources, @"Textures")));
|
TextureStore = new TextureStore(new TextureLoaderStore(new NamespacedResourceStore<byte[]>(resources, @"Textures")));
|
||||||
TextureStore.AddStore(parent.Get<TextureStore>());
|
CacheAs(TextureStore = new FallbackTextureStore(TextureStore, parent.Get<TextureStore>()));
|
||||||
Cache(TextureStore);
|
|
||||||
|
|
||||||
SampleStore = parent.Get<AudioManager>().GetSampleStore(new NamespacedResourceStore<byte[]>(resources, @"Samples"));
|
SampleStore = parent.Get<AudioManager>().GetSampleStore(new NamespacedResourceStore<byte[]>(resources, @"Samples"));
|
||||||
SampleStore.PlaybackConcurrency = OsuGameBase.SAMPLE_CONCURRENCY;
|
SampleStore.PlaybackConcurrency = OsuGameBase.SAMPLE_CONCURRENCY;
|
||||||
CacheAs<ISampleStore>(new FallbackSampleStore(SampleStore, parent.Get<ISampleStore>()));
|
CacheAs(SampleStore = new FallbackSampleStore(SampleStore, parent.Get<ISampleStore>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
RulesetConfigManager = parent.Get<RulesetConfigCache>().GetConfigFor(ruleset);
|
RulesetConfigManager = parent.Get<RulesetConfigCache>().GetConfigFor(ruleset);
|
||||||
@ -82,69 +82,92 @@ namespace osu.Game.Rulesets.UI
|
|||||||
isDisposed = true;
|
isDisposed = true;
|
||||||
|
|
||||||
SampleStore?.Dispose();
|
SampleStore?.Dispose();
|
||||||
|
TextureStore?.Dispose();
|
||||||
RulesetConfigManager = null;
|
RulesetConfigManager = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A sample store which adds a fallback source.
|
/// A sample store which adds a fallback source and prevents disposal of the fallback source.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
private class FallbackSampleStore : ISampleStore
|
||||||
/// This is a temporary implementation to workaround ISampleStore limitations.
|
|
||||||
/// </remarks>
|
|
||||||
public class FallbackSampleStore : ISampleStore
|
|
||||||
{
|
|
||||||
private readonly ISampleStore primary;
|
|
||||||
private readonly ISampleStore secondary;
|
|
||||||
|
|
||||||
public FallbackSampleStore(ISampleStore primary, ISampleStore secondary)
|
|
||||||
{
|
{
|
||||||
this.primary = primary;
|
private readonly ISampleStore primary;
|
||||||
this.secondary = secondary;
|
private readonly ISampleStore fallback;
|
||||||
|
|
||||||
|
public FallbackSampleStore(ISampleStore primary, ISampleStore fallback)
|
||||||
|
{
|
||||||
|
this.primary = primary;
|
||||||
|
this.fallback = fallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SampleChannel Get(string name) => primary.Get(name) ?? fallback.Get(name);
|
||||||
|
|
||||||
|
public Task<SampleChannel> GetAsync(string name) => primary.GetAsync(name) ?? fallback.GetAsync(name);
|
||||||
|
|
||||||
|
public Stream GetStream(string name) => primary.GetStream(name) ?? fallback.GetStream(name);
|
||||||
|
|
||||||
|
public IEnumerable<string> GetAvailableResources() => throw new NotSupportedException();
|
||||||
|
|
||||||
|
public void AddAdjustment(AdjustableProperty type, BindableNumber<double> adjustBindable) => throw new NotSupportedException();
|
||||||
|
|
||||||
|
public void RemoveAdjustment(AdjustableProperty type, BindableNumber<double> adjustBindable) => throw new NotSupportedException();
|
||||||
|
|
||||||
|
public void RemoveAllAdjustments(AdjustableProperty type) => throw new NotSupportedException();
|
||||||
|
|
||||||
|
public BindableNumber<double> Volume => throw new NotSupportedException();
|
||||||
|
|
||||||
|
public BindableNumber<double> Balance => throw new NotSupportedException();
|
||||||
|
|
||||||
|
public BindableNumber<double> Frequency => throw new NotSupportedException();
|
||||||
|
|
||||||
|
public BindableNumber<double> Tempo => throw new NotSupportedException();
|
||||||
|
|
||||||
|
public IBindable<double> GetAggregate(AdjustableProperty type) => throw new NotSupportedException();
|
||||||
|
|
||||||
|
public IBindable<double> AggregateVolume => throw new NotSupportedException();
|
||||||
|
|
||||||
|
public IBindable<double> AggregateBalance => throw new NotSupportedException();
|
||||||
|
|
||||||
|
public IBindable<double> AggregateFrequency => throw new NotSupportedException();
|
||||||
|
|
||||||
|
public IBindable<double> AggregateTempo => throw new NotSupportedException();
|
||||||
|
|
||||||
|
public int PlaybackConcurrency
|
||||||
|
{
|
||||||
|
get => throw new NotSupportedException();
|
||||||
|
set => throw new NotSupportedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
primary?.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public SampleChannel Get(string name) => primary.Get(name) ?? secondary.Get(name);
|
/// <summary>
|
||||||
|
/// A texture store which adds a fallback source and prevents disposal of the fallback source.
|
||||||
public Task<SampleChannel> GetAsync(string name) => primary.GetAsync(name) ?? secondary.GetAsync(name);
|
/// </summary>
|
||||||
|
private class FallbackTextureStore : TextureStore
|
||||||
public Stream GetStream(string name) => primary.GetStream(name) ?? secondary.GetStream(name);
|
|
||||||
|
|
||||||
public IEnumerable<string> GetAvailableResources() => throw new NotSupportedException();
|
|
||||||
|
|
||||||
public void AddAdjustment(AdjustableProperty type, BindableNumber<double> adjustBindable) => throw new NotSupportedException();
|
|
||||||
|
|
||||||
public void RemoveAdjustment(AdjustableProperty type, BindableNumber<double> adjustBindable) => throw new NotSupportedException();
|
|
||||||
|
|
||||||
public void RemoveAllAdjustments(AdjustableProperty type) => throw new NotSupportedException();
|
|
||||||
|
|
||||||
public BindableNumber<double> Volume => throw new NotSupportedException();
|
|
||||||
|
|
||||||
public BindableNumber<double> Balance => throw new NotSupportedException();
|
|
||||||
|
|
||||||
public BindableNumber<double> Frequency => throw new NotSupportedException();
|
|
||||||
|
|
||||||
public BindableNumber<double> Tempo => throw new NotSupportedException();
|
|
||||||
|
|
||||||
public IBindable<double> GetAggregate(AdjustableProperty type) => throw new NotSupportedException();
|
|
||||||
|
|
||||||
public IBindable<double> AggregateVolume => throw new NotSupportedException();
|
|
||||||
|
|
||||||
public IBindable<double> AggregateBalance => throw new NotSupportedException();
|
|
||||||
|
|
||||||
public IBindable<double> AggregateFrequency => throw new NotSupportedException();
|
|
||||||
|
|
||||||
public IBindable<double> AggregateTempo => throw new NotSupportedException();
|
|
||||||
|
|
||||||
public int PlaybackConcurrency
|
|
||||||
{
|
{
|
||||||
get => throw new NotSupportedException();
|
private readonly TextureStore primary;
|
||||||
set => throw new NotSupportedException();
|
private readonly TextureStore fallback;
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
public FallbackTextureStore(TextureStore primary, TextureStore fallback)
|
||||||
{
|
{
|
||||||
|
this.primary = primary;
|
||||||
|
this.fallback = fallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Texture Get(string name, WrapMode wrapModeS, WrapMode wrapModeT)
|
||||||
|
=> primary.Get(name, wrapModeS, wrapModeT) ?? fallback.Get(name, wrapModeS, wrapModeT);
|
||||||
|
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
base.Dispose(disposing);
|
||||||
|
primary?.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,10 +22,12 @@ namespace osu.Game.Screens.Edit.Components
|
|||||||
{
|
{
|
||||||
trackTimer = new OsuSpriteText
|
trackTimer = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Origin = Anchor.BottomLeft,
|
Anchor = Anchor.CentreRight,
|
||||||
RelativePositionAxes = Axes.Y,
|
Origin = Anchor.CentreRight,
|
||||||
Font = OsuFont.GetFont(size: 22, fixedWidth: true),
|
// intentionally fudged centre to avoid movement of the number portion when
|
||||||
Y = 0.5f,
|
// going negative.
|
||||||
|
X = -35,
|
||||||
|
Font = OsuFont.GetFont(size: 25, fixedWidth: true),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -34,7 +36,8 @@ namespace osu.Game.Screens.Edit.Components
|
|||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
trackTimer.Text = TimeSpan.FromMilliseconds(editorClock.CurrentTime).ToString(@"mm\:ss\:fff");
|
var timespan = TimeSpan.FromMilliseconds(editorClock.CurrentTime);
|
||||||
|
trackTimer.Text = $"{(timespan < TimeSpan.Zero ? "-" : string.Empty)}{timespan:mm\\:ss\\:fff}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
{
|
{
|
||||||
protected DragBox DragBox { get; private set; }
|
protected DragBox DragBox { get; private set; }
|
||||||
|
|
||||||
protected Container<SelectionBlueprint> SelectionBlueprints { get; private set; }
|
public Container<SelectionBlueprint> SelectionBlueprints { get; private set; }
|
||||||
|
|
||||||
private SelectionHandler selectionHandler;
|
private SelectionHandler selectionHandler;
|
||||||
|
|
||||||
|
@ -13,6 +13,11 @@ namespace osu.Game.Screens.Edit.Compose
|
|||||||
{
|
{
|
||||||
private HitObjectComposer composer;
|
private HitObjectComposer composer;
|
||||||
|
|
||||||
|
public ComposeScreen()
|
||||||
|
: base(EditorScreenMode.Compose)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
protected override Drawable CreateMainContent()
|
protected override Drawable CreateMainContent()
|
||||||
{
|
{
|
||||||
var ruleset = Beatmap.Value.BeatmapInfo.Ruleset?.CreateInstance();
|
var ruleset = Beatmap.Value.BeatmapInfo.Ruleset?.CreateInstance();
|
||||||
|
@ -6,6 +6,7 @@ namespace osu.Game.Screens.Edit.Design
|
|||||||
public class DesignScreen : EditorScreen
|
public class DesignScreen : EditorScreen
|
||||||
{
|
{
|
||||||
public DesignScreen()
|
public DesignScreen()
|
||||||
|
: base(EditorScreenMode.Design)
|
||||||
{
|
{
|
||||||
Child = new ScreenWhiteBox.UnderConstructionMessage("Design mode");
|
Child = new ScreenWhiteBox.UnderConstructionMessage("Design mode");
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
private string lastSavedHash;
|
private string lastSavedHash;
|
||||||
|
|
||||||
private Box bottomBackground;
|
private Box bottomBackground;
|
||||||
private Container screenContainer;
|
private Container<EditorScreen> screenContainer;
|
||||||
|
|
||||||
private EditorScreen currentScreen;
|
private EditorScreen currentScreen;
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
Name = "Screen container",
|
Name = "Screen container",
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Padding = new MarginPadding { Top = 40, Bottom = 60 },
|
Padding = new MarginPadding { Top = 40, Bottom = 60 },
|
||||||
Child = screenContainer = new Container
|
Child = screenContainer = new Container<EditorScreen>
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Masking = true
|
Masking = true
|
||||||
@ -512,7 +512,21 @@ namespace osu.Game.Screens.Edit
|
|||||||
|
|
||||||
private void onModeChanged(ValueChangedEvent<EditorScreenMode> e)
|
private void onModeChanged(ValueChangedEvent<EditorScreenMode> e)
|
||||||
{
|
{
|
||||||
currentScreen?.Exit();
|
var lastScreen = currentScreen;
|
||||||
|
|
||||||
|
lastScreen?
|
||||||
|
.ScaleTo(0.98f, 200, Easing.OutQuint)
|
||||||
|
.FadeOut(200, Easing.OutQuint);
|
||||||
|
|
||||||
|
if ((currentScreen = screenContainer.SingleOrDefault(s => s.Type == e.NewValue)) != null)
|
||||||
|
{
|
||||||
|
screenContainer.ChangeChildDepth(currentScreen, lastScreen?.Depth + 1 ?? 0);
|
||||||
|
|
||||||
|
currentScreen
|
||||||
|
.ScaleTo(1, 200, Easing.OutQuint)
|
||||||
|
.FadeIn(200, Easing.OutQuint);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (e.NewValue)
|
switch (e.NewValue)
|
||||||
{
|
{
|
||||||
|
@ -23,8 +23,12 @@ namespace osu.Game.Screens.Edit
|
|||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
private readonly Container content;
|
private readonly Container content;
|
||||||
|
|
||||||
protected EditorScreen()
|
public readonly EditorScreenMode Type;
|
||||||
|
|
||||||
|
protected EditorScreen(EditorScreenMode type)
|
||||||
{
|
{
|
||||||
|
Type = type;
|
||||||
|
|
||||||
Anchor = Anchor.Centre;
|
Anchor = Anchor.Centre;
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
@ -25,6 +25,11 @@ namespace osu.Game.Screens.Edit
|
|||||||
|
|
||||||
private Container timelineContainer;
|
private Container timelineContainer;
|
||||||
|
|
||||||
|
protected EditorScreenWithTimeline(EditorScreenMode type)
|
||||||
|
: base(type)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load([CanBeNull] BindableBeatDivisor beatDivisor)
|
private void load([CanBeNull] BindableBeatDivisor beatDivisor)
|
||||||
{
|
{
|
||||||
|
@ -24,6 +24,11 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
private LabelledTextBox creatorTextBox;
|
private LabelledTextBox creatorTextBox;
|
||||||
private LabelledTextBox difficultyTextBox;
|
private LabelledTextBox difficultyTextBox;
|
||||||
|
|
||||||
|
public SetupScreen()
|
||||||
|
: base(EditorScreenMode.SongSetup)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
|
@ -24,6 +24,11 @@ namespace osu.Game.Screens.Edit.Timing
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private EditorClock clock { get; set; }
|
private EditorClock clock { get; set; }
|
||||||
|
|
||||||
|
public TimingScreen()
|
||||||
|
: base(EditorScreenMode.Timing)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
protected override Drawable CreateMainContent() => new GridContainer
|
protected override Drawable CreateMainContent() => new GridContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
@ -273,10 +273,10 @@ namespace osu.Game.Screens.Ranking
|
|||||||
detachedPanelContainer.Add(expandedPanel);
|
detachedPanelContainer.Add(expandedPanel);
|
||||||
|
|
||||||
// Move into its original location in the local container first, then to the final location.
|
// Move into its original location in the local container first, then to the final location.
|
||||||
var origLocation = detachedPanelContainer.ToLocalSpace(screenSpacePos);
|
var origLocation = detachedPanelContainer.ToLocalSpace(screenSpacePos).X;
|
||||||
expandedPanel.MoveTo(origLocation)
|
expandedPanel.MoveToX(origLocation)
|
||||||
.Then()
|
.Then()
|
||||||
.MoveTo(new Vector2(StatisticsPanel.SIDE_PADDING, origLocation.Y), 150, Easing.OutQuint);
|
.MoveToX(StatisticsPanel.SIDE_PADDING, 150, Easing.OutQuint);
|
||||||
|
|
||||||
// Hide contracted panels.
|
// Hide contracted panels.
|
||||||
foreach (var contracted in ScorePanelList.GetScorePanels().Where(p => p.State == PanelState.Contracted))
|
foreach (var contracted in ScorePanelList.GetScorePanels().Where(p => p.State == PanelState.Contracted))
|
||||||
|
@ -99,6 +99,8 @@ namespace osu.Game.Screens.Ranking
|
|||||||
{
|
{
|
||||||
var panel = new ScorePanel(score)
|
var panel = new ScorePanel(score)
|
||||||
{
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
PostExpandAction = () => PostExpandAction?.Invoke()
|
PostExpandAction = () => PostExpandAction?.Invoke()
|
||||||
}.With(p =>
|
}.With(p =>
|
||||||
{
|
{
|
||||||
|
@ -75,7 +75,23 @@ namespace osu.Game.Screens.Ranking.Statistics
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (newScore.HitEvents == null || newScore.HitEvents.Count == 0)
|
if (newScore.HitEvents == null || newScore.HitEvents.Count == 0)
|
||||||
content.Add(new MessagePlaceholder("Score has no statistics :("));
|
{
|
||||||
|
content.Add(new FillFlowContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new MessagePlaceholder("Extended statistics are only available after watching a replay!"),
|
||||||
|
new ReplayDownloadButton(newScore)
|
||||||
|
{
|
||||||
|
Scale = new Vector2(1.5f),
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
spinner.Show();
|
spinner.Show();
|
||||||
|
Reference in New Issue
Block a user