1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 05:02:55 +08:00

Merge branch 'master' into bg-audio-quality-checks

This commit is contained in:
Naxess 2021-04-20 02:36:13 +02:00 committed by GitHub
commit 0e6b66f457
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
34 changed files with 596 additions and 168 deletions

View File

@ -52,6 +52,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.412.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.416.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.419.0" />
</ItemGroup>
</Project>

View File

@ -35,7 +35,7 @@ namespace osu.Game.Rulesets.Osu.Mods
public void Update(Playfield playfield)
{
playfield.Rotation = (Direction.Value == RotationDirection.CounterClockwise ? -1 : 1) * 360 * (float)(playfield.Time.Current / 60000 * SpinSpeed.Value);
playfield.Rotation = (Direction.Value == RotationDirection.Counterclockwise ? -1 : 1) * 360 * (float)(playfield.Time.Current / 60000 * SpinSpeed.Value);
}
public void ApplyToDrawableRuleset(DrawableRuleset<OsuHitObject> drawableRuleset)

View File

@ -0,0 +1,47 @@
// 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.Game.Configuration;
using osu.Game.Input;
namespace osu.Game.Tests.NonVisual
{
[TestFixture]
public class SessionStaticsTest
{
private SessionStatics sessionStatics;
private IdleTracker sessionIdleTracker;
[SetUp]
public void SetUp()
{
sessionStatics = new SessionStatics();
sessionIdleTracker = new GameIdleTracker(1000);
sessionStatics.SetValue(Static.LoginOverlayDisplayed, true);
sessionStatics.SetValue(Static.MutedAudioNotificationShownOnce, true);
sessionStatics.SetValue(Static.LowBatteryNotificationShownOnce, true);
sessionStatics.SetValue(Static.LastHoverSoundPlaybackTime, (double?)1d);
sessionIdleTracker.IsIdle.BindValueChanged(e =>
{
if (e.NewValue)
sessionStatics.ResetValues();
});
}
[Test]
[Timeout(2000)]
public void TestSessionStaticsReset()
{
sessionIdleTracker.IsIdle.BindValueChanged(e =>
{
Assert.IsTrue(sessionStatics.GetBindable<bool>(Static.LoginOverlayDisplayed).IsDefault);
Assert.IsTrue(sessionStatics.GetBindable<bool>(Static.MutedAudioNotificationShownOnce).IsDefault);
Assert.IsTrue(sessionStatics.GetBindable<bool>(Static.LowBatteryNotificationShownOnce).IsDefault);
Assert.IsTrue(sessionStatics.GetBindable<double?>(Static.LastHoverSoundPlaybackTime).IsDefault);
});
}
}
}

View File

@ -149,7 +149,7 @@ namespace osu.Game.Tests.Visual.Components
private void waitForAllIdle()
{
AddUntilStep("Wait for all idle", () => box1.IsIdle && box2.IsIdle && box3.IsIdle && box4.IsIdle);
AddUntilStep("wait for all idle", () => box1.IsIdle && box2.IsIdle && box3.IsIdle && box4.IsIdle);
}
private class IdleTrackingBox : CompositeDrawable
@ -158,7 +158,7 @@ namespace osu.Game.Tests.Visual.Components
public bool IsIdle => idleTracker.IsIdle.Value;
public IdleTrackingBox(double timeToIdle)
public IdleTrackingBox(int timeToIdle)
{
Box box;
@ -167,7 +167,7 @@ namespace osu.Game.Tests.Visual.Components
InternalChildren = new Drawable[]
{
idleTracker = new IdleTracker(timeToIdle),
idleTracker = new GameIdleTracker(timeToIdle),
box = new Box
{
Colour = Color4.White,

View File

@ -3,12 +3,16 @@
using System.Linq;
using NUnit.Framework;
using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Screens.Edit.Compose.Components;
using osu.Game.Screens.Edit.Compose.Components.Timeline;
using osu.Game.Tests.Beatmaps;
using osuTK;
@ -110,8 +114,9 @@ namespace osu.Game.Tests.Visual.Editing
AddAssert("duration matches", () => ((Spinner)EditorBeatmap.HitObjects.Single()).Duration == 5000);
}
[Test]
public void TestCopyPaste()
[TestCase(false)]
[TestCase(true)]
public void TestCopyPaste(bool deselectAfterCopy)
{
var addedObject = new HitCircle { StartTime = 1000 };
@ -123,11 +128,22 @@ namespace osu.Game.Tests.Visual.Editing
AddStep("move forward in time", () => EditorClock.Seek(2000));
if (deselectAfterCopy)
{
AddStep("deselect", () => EditorBeatmap.SelectedHitObjects.Clear());
AddUntilStep("timeline selection box is not visible", () => Editor.ChildrenOfType<Timeline>().First().ChildrenOfType<SelectionHandler>().First().Alpha == 0);
AddUntilStep("composer selection box is not visible", () => Editor.ChildrenOfType<HitObjectComposer>().First().ChildrenOfType<SelectionHandler>().First().Alpha == 0);
}
AddStep("paste hitobject", () => Editor.Paste());
AddAssert("are two objects", () => EditorBeatmap.HitObjects.Count == 2);
AddAssert("new object selected", () => EditorBeatmap.SelectedHitObjects.Single().StartTime == 2000);
AddUntilStep("timeline selection box is visible", () => Editor.ChildrenOfType<Timeline>().First().ChildrenOfType<SelectionHandler>().First().Alpha > 0);
AddUntilStep("composer selection box is visible", () => Editor.ChildrenOfType<HitObjectComposer>().First().ChildrenOfType<SelectionHandler>().First().Alpha > 0);
}
[Test]

View File

@ -118,8 +118,8 @@ namespace osu.Game.Tests.Visual.Gameplay
public void TestBasic()
{
AddStep("move to center", () => InputManager.MoveMouseTo(recordingManager.ScreenSpaceDrawQuad.Centre));
AddUntilStep("one frame recorded", () => replay.Frames.Count == 1);
AddAssert("position matches", () => playbackManager.ChildrenOfType<Box>().First().Position == recordingManager.ChildrenOfType<Box>().First().Position);
AddUntilStep("at least one frame recorded", () => replay.Frames.Count > 0);
AddUntilStep("position matches", () => playbackManager.ChildrenOfType<Box>().First().Position == recordingManager.ChildrenOfType<Box>().First().Position);
}
[Test]
@ -139,14 +139,16 @@ namespace osu.Game.Tests.Visual.Gameplay
public void TestLimitedFrameRate()
{
ScheduledDelegate moveFunction = null;
int initialFrameCount = 0;
AddStep("lower rate", () => recorder.RecordFrameRate = 2);
AddStep("count frames", () => initialFrameCount = replay.Frames.Count);
AddStep("move to center", () => InputManager.MoveMouseTo(recordingManager.ScreenSpaceDrawQuad.Centre));
AddStep("much move", () => moveFunction = Scheduler.AddDelayed(() =>
InputManager.MoveMouseTo(InputManager.CurrentState.Mouse.Position + new Vector2(-1, 0)), 10, true));
AddWaitStep("move", 10);
AddStep("stop move", () => moveFunction.Cancel());
AddAssert("less than 10 frames recorded", () => replay.Frames.Count < 10);
AddAssert("less than 10 frames recorded", () => replay.Frames.Count - initialFrameCount < 10);
}
[Test]

View File

@ -1,11 +1,16 @@
// 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.ComponentModel;
namespace osu.Game.Beatmaps.Timing
{
public enum TimeSignatures
{
[Description("4/4")]
SimpleQuadruple = 4,
[Description("3/4")]
SimpleTriple = 3
}
}

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Bindables;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays;
@ -12,14 +13,18 @@ namespace osu.Game.Configuration
/// </summary>
public class SessionStatics : InMemoryConfigManager<Static>
{
protected override void InitialiseDefaults()
protected override void InitialiseDefaults() => ResetValues();
public void ResetValues()
{
SetDefault(Static.LoginOverlayDisplayed, false);
SetDefault(Static.MutedAudioNotificationShownOnce, false);
SetDefault(Static.LowBatteryNotificationShownOnce, false);
SetDefault(Static.LastHoverSoundPlaybackTime, (double?)null);
SetDefault<APISeasonalBackgrounds>(Static.SeasonalBackgrounds, null);
ensureDefault(SetDefault(Static.LoginOverlayDisplayed, false));
ensureDefault(SetDefault(Static.MutedAudioNotificationShownOnce, false));
ensureDefault(SetDefault(Static.LowBatteryNotificationShownOnce, false));
ensureDefault(SetDefault(Static.LastHoverSoundPlaybackTime, (double?)null));
ensureDefault(SetDefault<APISeasonalBackgrounds>(Static.SeasonalBackgrounds, null));
}
private void ensureDefault<T>(Bindable<T> bindable) => bindable.SetDefault();
}
public enum Static

View File

@ -27,7 +27,7 @@ namespace osu.Game.Graphics.UserInterface
[BackgroundDependencyLoader]
private void load()
{
AddInternal(checkmark = new SpriteIcon
Add(checkmark = new SpriteIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,

View File

@ -577,6 +577,15 @@ namespace osu.Game
dependencies.CacheAs(idleTracker = new GameIdleTracker(6000));
var sessionIdleTracker = new GameIdleTracker(300000);
sessionIdleTracker.IsIdle.BindValueChanged(idle =>
{
if (idle.NewValue)
SessionStatics.ResetValues();
});
Add(sessionIdleTracker);
AddRange(new Drawable[]
{
new VolumeControlReceptor

View File

@ -61,6 +61,8 @@ namespace osu.Game
protected OsuConfigManager LocalConfig;
protected SessionStatics SessionStatics { get; private set; }
protected BeatmapManager BeatmapManager;
protected ScoreManager ScoreManager;
@ -289,7 +291,7 @@ namespace osu.Game
if (powerStatus != null)
dependencies.CacheAs(powerStatus);
dependencies.Cache(new SessionStatics());
dependencies.Cache(SessionStatics = new SessionStatics());
dependencies.Cache(new OsuColour());
RegisterImportHandler(BeatmapManager);

View File

@ -44,6 +44,9 @@ namespace osu.Game.Overlays.Volume
protected override bool OnScroll(ScrollEvent e)
{
if (e.ScrollDelta.Y == 0)
return false;
// forward any unhandled mouse scroll events to the volume control.
ScrollActionRequested?.Invoke(GlobalAction.IncreaseVolume, e.ScrollDelta.Y, e.IsPrecise);
return true;

View File

@ -245,6 +245,9 @@ namespace osu.Game.Overlays.Volume
private void adjust(double delta, bool isPrecise)
{
if (delta == 0)
return;
// every adjust increment increases the rate at which adjustments happen up to a cutoff.
// this debounce will reset on inactivity.
accelerationDebounce?.Cancel();

View File

@ -58,6 +58,12 @@ namespace osu.Game.Rulesets.UI
spectatorStreaming?.EndPlaying();
}
protected override void Update()
{
base.Update();
recordFrame(false);
}
protected override bool OnMouseMove(MouseMoveEvent e)
{
recordFrame(false);

View File

@ -33,10 +33,14 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// </summary>
public class SelectionHandler : CompositeDrawable, IKeyBindingHandler<PlatformAction>, IHasContextMenu
{
/// <summary>
/// The currently selected blueprints.
/// Should be used when operations are dealing directly with the visible blueprints.
/// For more general selection operations, use <see cref="osu.Game.Screens.Edit.EditorBeatmap.SelectedHitObjects"/> instead.
/// </summary>
public IEnumerable<SelectionBlueprint> SelectedBlueprints => selectedBlueprints;
private readonly List<SelectionBlueprint> selectedBlueprints;
public int SelectedCount => selectedBlueprints.Count;
private readonly List<SelectionBlueprint> selectedBlueprints;
private Drawable content;
@ -295,7 +299,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// </summary>
private void updateVisibility()
{
int count = selectedBlueprints.Count;
int count = EditorBeatmap.SelectedHitObjects.Count;
selectionDetailsText.Text = count > 0 ? count.ToString() : string.Empty;

View File

@ -9,6 +9,7 @@ using osu.Framework.Input.Events;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Overlays;
using osuTK.Graphics;
namespace osu.Game.Screens.Edit
@ -19,7 +20,7 @@ namespace osu.Game.Screens.Edit
protected const float ROW_HEIGHT = 25;
protected const int TEXT_SIZE = 14;
public const int TEXT_SIZE = 14;
protected readonly FillFlowContainer<RowBackground> BackgroundFlow;
@ -93,10 +94,10 @@ namespace osu.Game.Screens.Edit
private Color4 colourSelected;
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load(OverlayColourProvider colours)
{
hoveredBackground.Colour = colourHover = colours.BlueDarker;
colourSelected = colours.YellowDarker;
hoveredBackground.Colour = colourHover = colours.Background1;
colourSelected = colours.Colour3;
}
private bool selected;

View File

@ -0,0 +1,61 @@
// 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.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Overlays;
namespace osu.Game.Screens.Edit
{
public class RoundedContentEditorScreen : EditorScreen
{
public const int HORIZONTAL_PADDING = 100;
[Resolved]
private OsuColour colours { get; set; }
[Cached]
protected readonly OverlayColourProvider ColourProvider;
private Container roundedContent;
protected override Container<Drawable> Content => roundedContent;
public RoundedContentEditorScreen(EditorScreenMode mode)
: base(mode)
{
ColourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
}
[BackgroundDependencyLoader]
private void load()
{
base.Content.Add(new Container
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding(50),
Child = new Container
{
RelativeSizeAxes = Axes.Both,
Masking = true,
CornerRadius = 10,
Children = new Drawable[]
{
new Box
{
Colour = ColourProvider.Dark4,
RelativeSizeAxes = Axes.Both,
},
roundedContent = new Container
{
RelativeSizeAxes = Axes.Both,
},
}
}
});
}
}
}

View File

@ -3,24 +3,12 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Overlays;
namespace osu.Game.Screens.Edit.Setup
{
public class SetupScreen : EditorScreen
public class SetupScreen : RoundedContentEditorScreen
{
public const int HORIZONTAL_PADDING = 100;
[Resolved]
private OsuColour colours { get; set; }
[Cached]
protected readonly OverlayColourProvider ColourProvider;
[Cached]
private SectionsContainer<SetupSection> sections = new SectionsContainer<SetupSection>();
@ -30,42 +18,25 @@ namespace osu.Game.Screens.Edit.Setup
public SetupScreen()
: base(EditorScreenMode.SongSetup)
{
ColourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
}
[BackgroundDependencyLoader]
private void load()
{
Child = new Container
AddRange(new Drawable[]
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding(50),
Child = new Container
sections = new SectionsContainer<SetupSection>
{
FixedHeader = header,
RelativeSizeAxes = Axes.Both,
Masking = true,
CornerRadius = 10,
Children = new Drawable[]
Children = new SetupSection[]
{
new Box
{
Colour = ColourProvider.Dark4,
RelativeSizeAxes = Axes.Both,
},
sections = new SectionsContainer<SetupSection>
{
FixedHeader = header,
RelativeSizeAxes = Axes.Both,
Children = new SetupSection[]
{
new ResourcesSection(),
new MetadataSection(),
new DifficultySection(),
}
},
new ResourcesSection(),
new MetadataSection(),
new DifficultySection(),
}
}
};
},
});
}
}
}

View File

@ -93,7 +93,7 @@ namespace osu.Game.Screens.Edit.Setup
public SetupScreenTabControl()
{
TabContainer.Margin = new MarginPadding { Horizontal = SetupScreen.HORIZONTAL_PADDING };
TabContainer.Margin = new MarginPadding { Horizontal = RoundedContentEditorScreen.HORIZONTAL_PADDING };
AddInternal(background = new Box
{

View File

@ -33,7 +33,7 @@ namespace osu.Game.Screens.Edit.Setup
Padding = new MarginPadding
{
Vertical = 10,
Horizontal = SetupScreen.HORIZONTAL_PADDING
Horizontal = RoundedContentEditorScreen.HORIZONTAL_PADDING
};
InternalChild = new FillFlowContainer

View File

@ -6,15 +6,15 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Overlays;
namespace osu.Game.Screens.Edit.Timing
{
public class ControlPointSettings : CompositeDrawable
{
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load(OverlayColourProvider colours)
{
RelativeSizeAxes = Axes.Both;
@ -22,7 +22,7 @@ namespace osu.Game.Screens.Edit.Timing
{
new Box
{
Colour = colours.Gray3,
Colour = colours.Background4,
RelativeSizeAxes = Axes.Both,
},
new OsuScrollContainer

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
@ -12,8 +13,8 @@ using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Extensions;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Screens.Edit.Timing.RowAttributes;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Screens.Edit.Timing
{
@ -25,6 +26,8 @@ namespace osu.Game.Screens.Edit.Timing
[Resolved]
private EditorClock clock { get; set; }
public const float TIMING_COLUMN_WIDTH = 220;
public IEnumerable<ControlPointGroup> ControlGroups
{
set
@ -66,44 +69,62 @@ namespace osu.Game.Screens.Edit.Timing
{
var columns = new List<TableColumn>
{
new TableColumn(string.Empty, Anchor.Centre, new Dimension(GridSizeMode.AutoSize)),
new TableColumn("Time", Anchor.Centre, new Dimension(GridSizeMode.AutoSize)),
new TableColumn(),
new TableColumn("Time", Anchor.CentreLeft, new Dimension(GridSizeMode.Absolute, TIMING_COLUMN_WIDTH)),
new TableColumn("Attributes", Anchor.CentreLeft),
};
return columns.ToArray();
}
private Drawable[] createContent(int index, ControlPointGroup group) => new Drawable[]
private Drawable[] createContent(int index, ControlPointGroup group)
{
new OsuSpriteText
return new Drawable[]
{
Text = $"#{index + 1}",
Font = OsuFont.GetFont(size: TEXT_SIZE, weight: FontWeight.Bold),
Margin = new MarginPadding(10)
},
new OsuSpriteText
{
Text = group.Time.ToEditorFormattedString(),
Font = OsuFont.GetFont(size: TEXT_SIZE, weight: FontWeight.Bold)
},
null,
new ControlGroupAttributes(group),
};
new FillFlowContainer
{
RelativeSizeAxes = Axes.Y,
Width = TIMING_COLUMN_WIDTH,
Spacing = new Vector2(5),
Children = new Drawable[]
{
new OsuSpriteText
{
Text = group.Time.ToEditorFormattedString(),
Font = OsuFont.GetFont(size: TEXT_SIZE, weight: FontWeight.Bold),
Width = 60,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
},
new ControlGroupAttributes(group, c => c is TimingControlPoint)
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
}
}
},
new ControlGroupAttributes(group, c => !(c is TimingControlPoint))
};
}
private class ControlGroupAttributes : CompositeDrawable
{
private readonly Func<ControlPoint, bool> matchFunction;
private readonly IBindableList<ControlPoint> controlPoints = new BindableList<ControlPoint>();
private readonly FillFlowContainer fill;
public ControlGroupAttributes(ControlPointGroup group)
public ControlGroupAttributes(ControlPointGroup group, Func<ControlPoint, bool> matchFunction)
{
RelativeSizeAxes = Axes.Both;
this.matchFunction = matchFunction;
AutoSizeAxes = Axes.X;
RelativeSizeAxes = Axes.Y;
InternalChild = fill = new FillFlowContainer
{
RelativeSizeAxes = Axes.Both,
AutoSizeAxes = Axes.X,
RelativeSizeAxes = Axes.Y,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(2)
};
@ -128,30 +149,30 @@ namespace osu.Game.Screens.Edit.Timing
private void createChildren()
{
fill.ChildrenEnumerable = controlPoints.Select(createAttribute).Where(c => c != null);
fill.ChildrenEnumerable = controlPoints
.Where(matchFunction)
.Select(createAttribute)
.Where(c => c != null)
// arbitrary ordering to make timing points first.
// probably want to explicitly define order in the future.
.OrderByDescending(c => c.GetType().Name);
}
private Drawable createAttribute(ControlPoint controlPoint)
{
Color4 colour = controlPoint.GetRepresentingColour(colours);
switch (controlPoint)
{
case TimingControlPoint timing:
return new RowAttribute("timing", () => $"{60000 / timing.BeatLength:n1}bpm {timing.TimeSignature}", colour);
return new TimingRowAttribute(timing);
case DifficultyControlPoint difficulty:
return new RowAttribute("difficulty", () => $"{difficulty.SpeedMultiplier:n2}x", colour);
return new DifficultyRowAttribute(difficulty);
case EffectControlPoint effect:
return new RowAttribute("effect", () => string.Join(" ",
effect.KiaiMode ? "Kiai" : string.Empty,
effect.OmitFirstBarLine ? "NoBarLine" : string.Empty
).Trim(), colour);
return new EffectRowAttribute(effect);
case SampleControlPoint sample:
return new RowAttribute("sample", () => $"{sample.SampleBank} {sample.SampleVolume}%", colour);
return new SampleRowAttribute(sample);
}
return null;

View File

@ -1,33 +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.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osuTK.Graphics;
using osu.Game.Overlays;
using osuTK;
namespace osu.Game.Screens.Edit.Timing
{
public class RowAttribute : CompositeDrawable, IHasTooltip
public class RowAttribute : CompositeDrawable
{
private readonly string header;
private readonly Func<string> content;
private readonly Color4 colour;
protected readonly ControlPoint Point;
public RowAttribute(string header, Func<string> content, Color4 colour)
private readonly string label;
protected FillFlowContainer Content { get; private set; }
public RowAttribute(ControlPoint point, string label)
{
this.header = header;
this.content = content;
this.colour = colour;
Point = point;
this.label = label;
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load(OsuColour colours, OverlayColourProvider overlayColours)
{
AutoSizeAxes = Axes.X;
@ -37,27 +39,43 @@ namespace osu.Game.Screens.Edit.Timing
Origin = Anchor.CentreLeft;
Masking = true;
CornerRadius = 5;
CornerRadius = 3;
InternalChildren = new Drawable[]
{
new Box
{
Colour = colour,
Colour = overlayColours.Background4,
RelativeSizeAxes = Axes.Both,
},
new OsuSpriteText
Content = new FillFlowContainer
{
Padding = new MarginPadding(2),
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = OsuFont.Default.With(weight: FontWeight.SemiBold, size: 12),
Text = header,
Colour = colours.Gray0
},
RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X,
Direction = FillDirection.Horizontal,
Margin = new MarginPadding { Horizontal = 5 },
Spacing = new Vector2(5),
Children = new Drawable[]
{
new Circle
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Colour = Point.GetRepresentingColour(colours),
RelativeSizeAxes = Axes.Y,
Size = new Vector2(4, 0.6f),
},
new OsuSpriteText
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Padding = new MarginPadding(3),
Font = OsuFont.Default.With(weight: FontWeight.Bold, size: 12),
Text = label,
},
},
}
};
}
public string TooltipText => content();
}
}

View File

@ -0,0 +1,41 @@
// 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.Graphics;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
using osuTK;
namespace osu.Game.Screens.Edit.Timing.RowAttributes
{
public class AttributeProgressBar : ProgressBar
{
private readonly ControlPoint controlPoint;
public AttributeProgressBar(ControlPoint controlPoint)
: base(false)
{
this.controlPoint = controlPoint;
}
[BackgroundDependencyLoader]
private void load(OsuColour colours, OverlayColourProvider overlayColours)
{
Anchor = Anchor.CentreLeft;
Origin = Anchor.CentreLeft;
Masking = true;
RelativeSizeAxes = Axes.None;
Size = new Vector2(80, 8);
CornerRadius = Height / 2;
BackgroundColour = overlayColours.Background6;
FillColour = controlPoint.GetRepresentingColour(colours);
}
}
}

View File

@ -0,0 +1,32 @@
// 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.Graphics;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Screens.Edit.Timing.RowAttributes
{
public class AttributeText : OsuSpriteText
{
private readonly ControlPoint controlPoint;
public AttributeText(ControlPoint controlPoint)
{
this.controlPoint = controlPoint;
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
Anchor = Anchor.CentreLeft;
Origin = Anchor.CentreLeft;
Padding = new MarginPadding(6);
Font = OsuFont.Default.With(weight: FontWeight.Bold, size: 12);
Colour = controlPoint.GetRepresentingColour(colours);
}
}
}

View File

@ -0,0 +1,44 @@
// 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.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Screens.Edit.Timing.RowAttributes
{
public class DifficultyRowAttribute : RowAttribute
{
private readonly BindableNumber<double> speedMultiplier;
private OsuSpriteText text;
public DifficultyRowAttribute(DifficultyControlPoint difficulty)
: base(difficulty, "difficulty")
{
speedMultiplier = difficulty.SpeedMultiplierBindable.GetBoundCopy();
}
[BackgroundDependencyLoader]
private void load()
{
Content.AddRange(new Drawable[]
{
new AttributeProgressBar(Point)
{
Current = speedMultiplier,
},
text = new AttributeText(Point)
{
Width = 40,
},
});
speedMultiplier.BindValueChanged(_ => updateText(), true);
}
private void updateText() => text.Text = $"{speedMultiplier.Value:n2}x";
}
}

View File

@ -0,0 +1,38 @@
// 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.Game.Beatmaps.ControlPoints;
namespace osu.Game.Screens.Edit.Timing.RowAttributes
{
public class EffectRowAttribute : RowAttribute
{
private readonly Bindable<bool> kiaiMode;
private readonly Bindable<bool> omitBarLine;
private AttributeText kiaiModeBubble;
private AttributeText omitBarLineBubble;
public EffectRowAttribute(EffectControlPoint effect)
: base(effect, "effect")
{
kiaiMode = effect.KiaiModeBindable.GetBoundCopy();
omitBarLine = effect.OmitFirstBarLineBindable.GetBoundCopy();
}
[BackgroundDependencyLoader]
private void load()
{
Content.AddRange(new Drawable[]
{
kiaiModeBubble = new AttributeText(Point) { Text = "kiai" },
omitBarLineBubble = new AttributeText(Point) { Text = "no barline" },
});
kiaiMode.BindValueChanged(enabled => kiaiModeBubble.FadeTo(enabled.NewValue ? 1 : 0), true);
omitBarLine.BindValueChanged(enabled => omitBarLineBubble.FadeTo(enabled.NewValue ? 1 : 0), true);
}
}
}

View 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 osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Screens.Edit.Timing.RowAttributes
{
public class SampleRowAttribute : RowAttribute
{
private AttributeText sampleText;
private OsuSpriteText volumeText;
private readonly Bindable<string> sampleBank;
private readonly BindableNumber<int> volume;
public SampleRowAttribute(SampleControlPoint sample)
: base(sample, "sample")
{
sampleBank = sample.SampleBankBindable.GetBoundCopy();
volume = sample.SampleVolumeBindable.GetBoundCopy();
}
[BackgroundDependencyLoader]
private void load()
{
AttributeProgressBar progress;
Content.AddRange(new Drawable[]
{
sampleText = new AttributeText(Point),
progress = new AttributeProgressBar(Point),
volumeText = new AttributeText(Point)
{
Width = 40,
},
});
volume.BindValueChanged(vol =>
{
progress.Current.Value = vol.NewValue / 100f;
updateText();
}, true);
sampleBank.BindValueChanged(_ => updateText(), true);
}
private void updateText()
{
volumeText.Text = $"{volume.Value}%";
sampleText.Text = $"{sampleBank.Value}";
}
}
}

View File

@ -0,0 +1,38 @@
// 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.Extensions;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Beatmaps.Timing;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Screens.Edit.Timing.RowAttributes
{
public class TimingRowAttribute : RowAttribute
{
private readonly BindableNumber<double> beatLength;
private readonly Bindable<TimeSignatures> timeSignature;
private OsuSpriteText text;
public TimingRowAttribute(TimingControlPoint timing)
: base(timing, "timing")
{
timeSignature = timing.TimeSignatureBindable.GetBoundCopy();
beatLength = timing.BeatLengthBindable.GetBoundCopy();
}
[BackgroundDependencyLoader]
private void load()
{
Content.Add(text = new AttributeText(Point));
timeSignature.BindValueChanged(_ => updateText());
beatLength.BindValueChanged(_ => updateText(), true);
}
private void updateText() =>
text.Text = $"{60000 / beatLength.Value:n1}bpm {timeSignature.Value.GetDescription()}";
}
}

View File

@ -8,8 +8,9 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
using osuTK;
namespace osu.Game.Screens.Edit.Timing
{
@ -23,7 +24,7 @@ namespace osu.Game.Screens.Edit.Timing
protected Bindable<T> ControlPoint { get; } = new Bindable<T>();
private const float header_height = 20;
private const float header_height = 50;
[Resolved]
protected EditorBeatmap Beatmap { get; private set; }
@ -35,7 +36,7 @@ namespace osu.Game.Screens.Edit.Timing
protected IEditorChangeHandler ChangeHandler { get; private set; }
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load(OverlayColourProvider colours)
{
RelativeSizeAxes = Axes.X;
AutoSizeDuration = 200;
@ -46,19 +47,17 @@ namespace osu.Game.Screens.Edit.Timing
InternalChildren = new Drawable[]
{
new Box
{
Colour = colours.Gray1,
RelativeSizeAxes = Axes.Both,
},
new Container
{
RelativeSizeAxes = Axes.X,
Height = header_height,
Padding = new MarginPadding { Horizontal = 10 },
Children = new Drawable[]
{
checkbox = new OsuCheckbox
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
LabelText = typeof(T).Name.Replace(nameof(Beatmaps.ControlPoints.ControlPoint), string.Empty)
}
}
@ -72,12 +71,13 @@ namespace osu.Game.Screens.Edit.Timing
{
new Box
{
Colour = colours.Gray2,
Colour = colours.Background3,
RelativeSizeAxes = Axes.Both,
},
Flow = new FillFlowContainer
{
Padding = new MarginPadding(10),
Padding = new MarginPadding(20),
Spacing = new Vector2(20),
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,

View File

@ -8,15 +8,14 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Game.Screens.Edit.Compose.Components.Timeline;
using osu.Game.Overlays;
using osuTK;
namespace osu.Game.Screens.Edit.Timing
{
public class TimingScreen : EditorScreenWithTimeline
public class TimingScreen : RoundedContentEditorScreen
{
[Cached]
private Bindable<ControlPointGroup> selectedGroup = new Bindable<ControlPointGroup>();
@ -26,28 +25,26 @@ namespace osu.Game.Screens.Edit.Timing
{
}
protected override Drawable CreateMainContent() => new GridContainer
[BackgroundDependencyLoader]
private void load()
{
RelativeSizeAxes = Axes.Both,
ColumnDimensions = new[]
Add(new GridContainer
{
new Dimension(),
new Dimension(GridSizeMode.Absolute, 200),
},
Content = new[]
{
new Drawable[]
RelativeSizeAxes = Axes.Both,
ColumnDimensions = new[]
{
new ControlPointList(),
new ControlPointSettings(),
new Dimension(),
new Dimension(GridSizeMode.Absolute, 350),
},
}
};
protected override void OnTimelineLoaded(TimelineArea timelineArea)
{
base.OnTimelineLoaded(timelineArea);
timelineArea.Timeline.Zoom = timelineArea.Timeline.MinZoom;
Content = new[]
{
new Drawable[]
{
new ControlPointList(),
new ControlPointSettings(),
},
}
});
}
public class ControlPointList : CompositeDrawable
@ -70,17 +67,24 @@ namespace osu.Game.Screens.Edit.Timing
private IEditorChangeHandler changeHandler { get; set; }
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load(OverlayColourProvider colours)
{
RelativeSizeAxes = Axes.Both;
const float margins = 10;
InternalChildren = new Drawable[]
{
new Box
{
Colour = colours.Gray0,
Colour = colours.Background3,
RelativeSizeAxes = Axes.Both,
},
new Box
{
Colour = colours.Background2,
RelativeSizeAxes = Axes.Y,
Width = ControlPointTable.TIMING_COLUMN_WIDTH + margins,
},
new OsuScrollContainer
{
RelativeSizeAxes = Axes.Both,
@ -92,7 +96,7 @@ namespace osu.Game.Screens.Edit.Timing
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
Direction = FillDirection.Horizontal,
Margin = new MarginPadding(10),
Margin = new MarginPadding(margins),
Spacing = new Vector2(5),
Children = new Drawable[]
{
@ -106,9 +110,9 @@ namespace osu.Game.Screens.Edit.Timing
},
new OsuButton
{
Text = "+",
Text = "+ Add at current time",
Action = addNew,
Size = new Vector2(30, 30),
Size = new Vector2(160, 30),
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
},

View File

@ -11,13 +11,14 @@ using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Edit.Checks.Components;
using osuTK;
namespace osu.Game.Screens.Edit.Verify
{
public class VerifyScreen : EditorScreen
public class VerifyScreen : RoundedContentEditorScreen
{
[Cached]
private Bindable<Issue> selectedIssue = new Bindable<Issue>();
@ -33,7 +34,6 @@ namespace osu.Game.Screens.Edit.Verify
Child = new Container
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding(20),
Child = new GridContainer
{
RelativeSizeAxes = Axes.Both,
@ -74,7 +74,7 @@ namespace osu.Game.Screens.Edit.Verify
private BeatmapVerifier generalVerifier;
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load(OverlayColourProvider colours)
{
generalVerifier = new BeatmapVerifier();
rulesetVerifier = beatmap.BeatmapInfo.Ruleset?.CreateInstance()?.CreateBeatmapVerifier();
@ -85,7 +85,7 @@ namespace osu.Game.Screens.Edit.Verify
{
new Box
{
Colour = colours.Gray0,
Colour = colours.Background2,
RelativeSizeAxes = Axes.Both,
},
new OsuScrollContainer

View File

@ -29,7 +29,7 @@
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="5.0.0" />
<PackageReference Include="Microsoft.NETCore.Targets" Version="3.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="ppy.osu.Framework" Version="2021.416.0" />
<PackageReference Include="ppy.osu.Framework" Version="2021.419.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.412.0" />
<PackageReference Include="Sentry" Version="3.2.0" />
<PackageReference Include="SharpCompress" Version="0.28.1" />

View File

@ -70,7 +70,7 @@
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup Label="Package References">
<PackageReference Include="ppy.osu.Framework.iOS" Version="2021.416.0" />
<PackageReference Include="ppy.osu.Framework.iOS" Version="2021.419.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.412.0" />
</ItemGroup>
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net5.0 / net6.0) -->
@ -93,7 +93,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="2021.416.0" />
<PackageReference Include="ppy.osu.Framework" Version="2021.419.0" />
<PackageReference Include="SharpCompress" Version="0.28.1" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="SharpRaven" Version="2.4.0" />