mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 02:02:53 +08:00
Merge branch 'master' into simplify-user-graph-tooltips
This commit is contained in:
commit
cb66ecdbeb
100
osu.Game.Tests/Visual/Editing/TestSceneDesignSection.cs
Normal file
100
osu.Game.Tests/Visual/Editing/TestSceneDesignSection.cs
Normal file
@ -0,0 +1,100 @@
|
||||
// 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.Globalization;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics.UserInterfaceV2;
|
||||
using osu.Game.Screens.Edit;
|
||||
using osu.Game.Screens.Edit.Setup;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Editing
|
||||
{
|
||||
public class TestSceneDesignSection : OsuManualInputManagerTestScene
|
||||
{
|
||||
private TestDesignSection designSection;
|
||||
private EditorBeatmap editorBeatmap { get; set; }
|
||||
|
||||
[SetUpSteps]
|
||||
public void SetUp()
|
||||
{
|
||||
AddStep("create blank beatmap", () => editorBeatmap = new EditorBeatmap(new Beatmap()));
|
||||
AddStep("create section", () => Child = new DependencyProvidingContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
CachedDependencies = new (Type, object)[]
|
||||
{
|
||||
(typeof(EditorBeatmap), editorBeatmap)
|
||||
},
|
||||
Child = designSection = new TestDesignSection()
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCountdownOff()
|
||||
{
|
||||
AddStep("turn countdown off", () => designSection.EnableCountdown.Current.Value = false);
|
||||
|
||||
AddAssert("beatmap has correct type", () => editorBeatmap.BeatmapInfo.Countdown == CountdownType.None);
|
||||
AddUntilStep("other controls hidden", () => !designSection.CountdownSettings.IsPresent);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCountdownOn()
|
||||
{
|
||||
AddStep("turn countdown on", () => designSection.EnableCountdown.Current.Value = true);
|
||||
|
||||
AddAssert("beatmap has correct type", () => editorBeatmap.BeatmapInfo.Countdown == CountdownType.Normal);
|
||||
AddUntilStep("other controls shown", () => designSection.CountdownSettings.IsPresent);
|
||||
|
||||
AddStep("change countdown speed", () => designSection.CountdownSpeed.Current.Value = CountdownType.DoubleSpeed);
|
||||
|
||||
AddAssert("beatmap has correct type", () => editorBeatmap.BeatmapInfo.Countdown == CountdownType.DoubleSpeed);
|
||||
AddUntilStep("other controls still shown", () => designSection.CountdownSettings.IsPresent);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCountdownOffset()
|
||||
{
|
||||
AddStep("turn countdown on", () => designSection.EnableCountdown.Current.Value = true);
|
||||
|
||||
AddAssert("beatmap has correct type", () => editorBeatmap.BeatmapInfo.Countdown == CountdownType.Normal);
|
||||
|
||||
checkOffsetAfter("1", 1);
|
||||
checkOffsetAfter(string.Empty, 0);
|
||||
checkOffsetAfter("123", 123);
|
||||
checkOffsetAfter("0", 0);
|
||||
}
|
||||
|
||||
private void checkOffsetAfter(string userInput, int expectedFinalValue)
|
||||
{
|
||||
AddStep("click text box", () =>
|
||||
{
|
||||
var textBox = designSection.CountdownOffset.ChildrenOfType<TextBox>().Single();
|
||||
InputManager.MoveMouseTo(textBox);
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
AddStep("set offset text", () => designSection.CountdownOffset.Current.Value = userInput);
|
||||
AddStep("commit text", () => InputManager.Key(Key.Enter));
|
||||
|
||||
AddAssert($"displayed value is {expectedFinalValue}", () => designSection.CountdownOffset.Current.Value == expectedFinalValue.ToString(CultureInfo.InvariantCulture));
|
||||
AddAssert($"beatmap value is {expectedFinalValue}", () => editorBeatmap.BeatmapInfo.CountdownOffset == expectedFinalValue);
|
||||
}
|
||||
|
||||
private class TestDesignSection : DesignSection
|
||||
{
|
||||
public new LabelledSwitchButton EnableCountdown => base.EnableCountdown;
|
||||
|
||||
public new FillFlowContainer CountdownSettings => base.CountdownSettings;
|
||||
public new LabelledEnumDropdown<CountdownType> CountdownSpeed => base.CountdownSpeed;
|
||||
public new LabelledNumberBox CountdownOffset => base.CountdownOffset;
|
||||
}
|
||||
}
|
||||
}
|
@ -323,6 +323,71 @@ namespace osu.Game.Tests.Visual.Navigation
|
||||
AddWaitStep("wait two frames", 2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestOverlayClosing()
|
||||
{
|
||||
// use now playing overlay for "overlay -> background" drag case
|
||||
// since most overlays use a scroll container that absorbs on mouse down
|
||||
NowPlayingOverlay nowPlayingOverlay = null;
|
||||
|
||||
AddStep("enter menu", () => InputManager.Key(Key.Enter));
|
||||
|
||||
AddStep("get and press now playing hotkey", () =>
|
||||
{
|
||||
nowPlayingOverlay = Game.ChildrenOfType<NowPlayingOverlay>().Single();
|
||||
InputManager.Key(Key.F6);
|
||||
});
|
||||
|
||||
// drag tests
|
||||
|
||||
// background -> toolbar
|
||||
AddStep("move cursor to background", () => InputManager.MoveMouseTo(Game.ScreenSpaceDrawQuad.BottomRight));
|
||||
AddStep("press left mouse button", () => InputManager.PressButton(MouseButton.Left));
|
||||
AddStep("move cursor to toolbar", () => InputManager.MoveMouseTo(Game.Toolbar.ScreenSpaceDrawQuad.Centre));
|
||||
AddStep("release left mouse button", () => InputManager.ReleaseButton(MouseButton.Left));
|
||||
AddAssert("now playing is hidden", () => nowPlayingOverlay.State.Value == Visibility.Hidden);
|
||||
|
||||
AddStep("press now playing hotkey", () => InputManager.Key(Key.F6));
|
||||
|
||||
// toolbar -> background
|
||||
AddStep("press left mouse button", () => InputManager.PressButton(MouseButton.Left));
|
||||
AddStep("move cursor to background", () => InputManager.MoveMouseTo(Game.ScreenSpaceDrawQuad.BottomRight));
|
||||
AddStep("release left mouse button", () => InputManager.ReleaseButton(MouseButton.Left));
|
||||
AddAssert("now playing is still visible", () => nowPlayingOverlay.State.Value == Visibility.Visible);
|
||||
|
||||
// background -> overlay
|
||||
AddStep("press left mouse button", () => InputManager.PressButton(MouseButton.Left));
|
||||
AddStep("move cursor to now playing overlay", () => InputManager.MoveMouseTo(nowPlayingOverlay.ScreenSpaceDrawQuad.Centre));
|
||||
AddStep("release left mouse button", () => InputManager.ReleaseButton(MouseButton.Left));
|
||||
AddAssert("now playing is still visible", () => nowPlayingOverlay.State.Value == Visibility.Visible);
|
||||
|
||||
// overlay -> background
|
||||
AddStep("press left mouse button", () => InputManager.PressButton(MouseButton.Left));
|
||||
AddStep("move cursor to background", () => InputManager.MoveMouseTo(Game.ScreenSpaceDrawQuad.BottomRight));
|
||||
AddStep("release left mouse button", () => InputManager.ReleaseButton(MouseButton.Left));
|
||||
AddAssert("now playing is still visible", () => nowPlayingOverlay.State.Value == Visibility.Visible);
|
||||
|
||||
// background -> background
|
||||
AddStep("press left mouse button", () => InputManager.PressButton(MouseButton.Left));
|
||||
AddStep("move cursor to left", () => InputManager.MoveMouseTo(Game.ScreenSpaceDrawQuad.BottomLeft));
|
||||
AddStep("release left mouse button", () => InputManager.ReleaseButton(MouseButton.Left));
|
||||
AddAssert("now playing is hidden", () => nowPlayingOverlay.State.Value == Visibility.Hidden);
|
||||
|
||||
AddStep("press now playing hotkey", () => InputManager.Key(Key.F6));
|
||||
|
||||
// click tests
|
||||
|
||||
// toolbar
|
||||
AddStep("move cursor to toolbar", () => InputManager.MoveMouseTo(Game.Toolbar.ScreenSpaceDrawQuad.Centre));
|
||||
AddStep("click left mouse button", () => InputManager.Click(MouseButton.Left));
|
||||
AddAssert("now playing is still visible", () => nowPlayingOverlay.State.Value == Visibility.Visible);
|
||||
|
||||
// background
|
||||
AddStep("move cursor to background", () => InputManager.MoveMouseTo(Game.ScreenSpaceDrawQuad.BottomRight));
|
||||
AddStep("click left mouse button", () => InputManager.Click(MouseButton.Left));
|
||||
AddAssert("now playing is hidden", () => nowPlayingOverlay.State.Value == Visibility.Hidden);
|
||||
}
|
||||
|
||||
private void pushEscape() =>
|
||||
AddStep("Press escape", () => InputManager.Key(Key.Escape));
|
||||
|
||||
|
25
osu.Game.Tests/Visual/UserInterface/TestSceneOsuLogo.cs
Normal file
25
osu.Game.Tests/Visual/UserInterface/TestSceneOsuLogo.cs
Normal file
@ -0,0 +1,25 @@
|
||||
// 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.Screens.Menu;
|
||||
|
||||
namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
public class TestSceneOsuLogo : OsuTestScene
|
||||
{
|
||||
[Test]
|
||||
public void TestBasic()
|
||||
{
|
||||
AddStep("Add logo", () =>
|
||||
{
|
||||
Child = new OsuLogo
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -10,7 +10,6 @@ using Newtonsoft.Json;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.IO.Serialization;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Scoring;
|
||||
|
||||
@ -18,7 +17,7 @@ namespace osu.Game.Beatmaps
|
||||
{
|
||||
[ExcludeFromDynamicCompile]
|
||||
[Serializable]
|
||||
public class BeatmapInfo : IEquatable<BeatmapInfo>, IJsonSerializable, IHasPrimaryKey
|
||||
public class BeatmapInfo : IEquatable<BeatmapInfo>, IHasPrimaryKey
|
||||
{
|
||||
public int ID { get; set; }
|
||||
|
||||
|
@ -153,6 +153,11 @@ namespace osu.Game.Beatmaps
|
||||
if (!storage.Exists(cache_database_name))
|
||||
return false;
|
||||
|
||||
if (string.IsNullOrEmpty(beatmap.MD5Hash)
|
||||
&& string.IsNullOrEmpty(beatmap.Path)
|
||||
&& beatmap.OnlineBeatmapID == null)
|
||||
return false;
|
||||
|
||||
try
|
||||
{
|
||||
using (var db = new SqliteConnection(storage.GetDatabaseConnectionString("online")))
|
||||
|
@ -1,6 +1,8 @@
|
||||
// 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
|
||||
{
|
||||
/// <summary>
|
||||
@ -9,8 +11,14 @@ namespace osu.Game.Beatmaps
|
||||
public enum CountdownType
|
||||
{
|
||||
None = 0,
|
||||
|
||||
[Description("Normal")]
|
||||
Normal = 1,
|
||||
|
||||
[Description("Half speed")]
|
||||
HalfSpeed = 2,
|
||||
|
||||
[Description("Double speed")]
|
||||
DoubleSpeed = 3
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,6 @@ using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osuTK;
|
||||
@ -24,7 +23,7 @@ using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Beatmaps.Drawables
|
||||
{
|
||||
public class DifficultyIcon : CompositeDrawable, IHasCustomTooltip
|
||||
public class DifficultyIcon : CompositeDrawable, IHasCustomTooltip<DifficultyIconTooltipContent>
|
||||
{
|
||||
private readonly Container iconContainer;
|
||||
|
||||
@ -127,9 +126,9 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
difficultyBindable.BindValueChanged(difficulty => background.Colour = colours.ForStarDifficulty(difficulty.NewValue.Stars));
|
||||
}
|
||||
|
||||
public ITooltip GetCustomTooltip() => new DifficultyIconTooltip();
|
||||
ITooltip<DifficultyIconTooltipContent> IHasCustomTooltip<DifficultyIconTooltipContent>.GetCustomTooltip() => new DifficultyIconTooltip();
|
||||
|
||||
public object TooltipContent => shouldShowTooltip ? new DifficultyIconTooltipContent(beatmap, difficultyBindable) : null;
|
||||
DifficultyIconTooltipContent IHasCustomTooltip<DifficultyIconTooltipContent>.TooltipContent => shouldShowTooltip ? new DifficultyIconTooltipContent(beatmap, difficultyBindable) : null;
|
||||
|
||||
private class DifficultyRetriever : Component
|
||||
{
|
||||
@ -173,113 +172,5 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
difficultyCancellation?.Cancel();
|
||||
}
|
||||
}
|
||||
|
||||
private class DifficultyIconTooltipContent
|
||||
{
|
||||
public readonly BeatmapInfo Beatmap;
|
||||
public readonly IBindable<StarDifficulty> Difficulty;
|
||||
|
||||
public DifficultyIconTooltipContent(BeatmapInfo beatmap, IBindable<StarDifficulty> difficulty)
|
||||
{
|
||||
Beatmap = beatmap;
|
||||
Difficulty = difficulty;
|
||||
}
|
||||
}
|
||||
|
||||
private class DifficultyIconTooltip : VisibilityContainer, ITooltip
|
||||
{
|
||||
private readonly OsuSpriteText difficultyName, starRating;
|
||||
private readonly Box background;
|
||||
private readonly FillFlowContainer difficultyFlow;
|
||||
|
||||
public DifficultyIconTooltip()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Masking = true;
|
||||
CornerRadius = 5;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
background = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
AutoSizeDuration = 200,
|
||||
AutoSizeEasing = Easing.OutQuint,
|
||||
Direction = FillDirection.Vertical,
|
||||
Padding = new MarginPadding(10),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
difficultyName = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Font = OsuFont.GetFont(size: 16, weight: FontWeight.Bold),
|
||||
},
|
||||
difficultyFlow = new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
starRating = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Font = OsuFont.GetFont(size: 16, weight: FontWeight.Regular),
|
||||
},
|
||||
new SpriteIcon
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Margin = new MarginPadding { Left = 4 },
|
||||
Icon = FontAwesome.Solid.Star,
|
||||
Size = new Vector2(12),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
[Resolved]
|
||||
private OsuColour colours { get; set; }
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
background.Colour = colours.Gray3;
|
||||
}
|
||||
|
||||
private readonly IBindable<StarDifficulty> starDifficulty = new Bindable<StarDifficulty>();
|
||||
|
||||
public void SetContent(object content)
|
||||
{
|
||||
if (!(content is DifficultyIconTooltipContent iconContent))
|
||||
return;
|
||||
|
||||
difficultyName.Text = iconContent.Beatmap.Version;
|
||||
|
||||
starDifficulty.UnbindAll();
|
||||
starDifficulty.BindTo(iconContent.Difficulty);
|
||||
starDifficulty.BindValueChanged(difficulty =>
|
||||
{
|
||||
starRating.Text = $"{difficulty.NewValue.Stars:0.##}";
|
||||
difficultyFlow.Colour = colours.ForStarDifficulty(difficulty.NewValue.Stars);
|
||||
}, true);
|
||||
}
|
||||
|
||||
public void Move(Vector2 pos) => Position = pos;
|
||||
|
||||
protected override void PopIn() => this.FadeIn(200, Easing.OutQuint);
|
||||
|
||||
protected override void PopOut() => this.FadeOut(200, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
121
osu.Game/Beatmaps/Drawables/DifficultyIconTooltip.cs
Normal file
121
osu.Game/Beatmaps/Drawables/DifficultyIconTooltip.cs
Normal file
@ -0,0 +1,121 @@
|
||||
// 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.Cursor;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Beatmaps.Drawables
|
||||
{
|
||||
internal class DifficultyIconTooltip : VisibilityContainer, ITooltip<DifficultyIconTooltipContent>
|
||||
{
|
||||
private readonly OsuSpriteText difficultyName, starRating;
|
||||
private readonly Box background;
|
||||
private readonly FillFlowContainer difficultyFlow;
|
||||
|
||||
public DifficultyIconTooltip()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Masking = true;
|
||||
CornerRadius = 5;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
background = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
AutoSizeDuration = 200,
|
||||
AutoSizeEasing = Easing.OutQuint,
|
||||
Direction = FillDirection.Vertical,
|
||||
Padding = new MarginPadding(10),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
difficultyName = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Font = OsuFont.GetFont(size: 16, weight: FontWeight.Bold),
|
||||
},
|
||||
difficultyFlow = new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
starRating = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Font = OsuFont.GetFont(size: 16, weight: FontWeight.Regular),
|
||||
},
|
||||
new SpriteIcon
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Margin = new MarginPadding { Left = 4 },
|
||||
Icon = FontAwesome.Solid.Star,
|
||||
Size = new Vector2(12),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
[Resolved]
|
||||
private OsuColour colours { get; set; }
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
background.Colour = colours.Gray3;
|
||||
}
|
||||
|
||||
private readonly IBindable<StarDifficulty> starDifficulty = new Bindable<StarDifficulty>();
|
||||
|
||||
public void SetContent(DifficultyIconTooltipContent content)
|
||||
{
|
||||
difficultyName.Text = content.Beatmap.Version;
|
||||
|
||||
starDifficulty.UnbindAll();
|
||||
starDifficulty.BindTo(content.Difficulty);
|
||||
starDifficulty.BindValueChanged(difficulty =>
|
||||
{
|
||||
starRating.Text = $"{difficulty.NewValue.Stars:0.##}";
|
||||
difficultyFlow.Colour = colours.ForStarDifficulty(difficulty.NewValue.Stars);
|
||||
}, true);
|
||||
}
|
||||
|
||||
public void Move(Vector2 pos) => Position = pos;
|
||||
|
||||
protected override void PopIn() => this.FadeIn(200, Easing.OutQuint);
|
||||
|
||||
protected override void PopOut() => this.FadeOut(200, Easing.OutQuint);
|
||||
}
|
||||
|
||||
internal class DifficultyIconTooltipContent
|
||||
{
|
||||
public readonly BeatmapInfo Beatmap;
|
||||
public readonly IBindable<StarDifficulty> Difficulty;
|
||||
|
||||
public DifficultyIconTooltipContent(BeatmapInfo beatmap, IBindable<StarDifficulty> difficulty)
|
||||
{
|
||||
Beatmap = beatmap;
|
||||
Difficulty = difficulty;
|
||||
}
|
||||
}
|
||||
}
|
@ -4,12 +4,11 @@
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Beatmaps.Timing;
|
||||
using osu.Game.IO.Serialization;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
|
||||
namespace osu.Game.Beatmaps
|
||||
{
|
||||
public interface IBeatmap : IJsonSerializable
|
||||
public interface IBeatmap
|
||||
{
|
||||
/// <summary>
|
||||
/// This beatmap's info.
|
||||
|
@ -153,7 +153,7 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
TriangleParticle newParticle = parts[i];
|
||||
|
||||
// Scale moved distance by the size of the triangle. Smaller triangles should move more slowly.
|
||||
newParticle.Position.Y += parts[i].Scale * movedDistance;
|
||||
newParticle.Position.Y += Math.Max(0.5f, parts[i].Scale) * movedDistance;
|
||||
newParticle.Colour.A = adjustedAlpha;
|
||||
|
||||
parts[i] = newParticle;
|
||||
|
@ -10,7 +10,7 @@ using osu.Game.Utils;
|
||||
|
||||
namespace osu.Game.Graphics
|
||||
{
|
||||
public class DrawableDate : OsuSpriteText, IHasCustomTooltip
|
||||
public class DrawableDate : OsuSpriteText, IHasCustomTooltip<DateTimeOffset>
|
||||
{
|
||||
private DateTimeOffset date;
|
||||
|
||||
@ -75,8 +75,8 @@ namespace osu.Game.Graphics
|
||||
|
||||
private void updateTime() => Text = Format();
|
||||
|
||||
public ITooltip GetCustomTooltip() => new DateTooltip();
|
||||
public ITooltip<DateTimeOffset> GetCustomTooltip() => new DateTooltip();
|
||||
|
||||
public object TooltipContent => Date;
|
||||
public DateTimeOffset TooltipContent => Date;
|
||||
}
|
||||
}
|
||||
|
12
osu.Game/Graphics/UserInterfaceV2/LabelledNumberBox.cs
Normal file
12
osu.Game/Graphics/UserInterfaceV2/LabelledNumberBox.cs
Normal file
@ -0,0 +1,12 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Graphics.UserInterfaceV2
|
||||
{
|
||||
public class LabelledNumberBox : LabelledTextBox
|
||||
{
|
||||
protected override OsuTextBox CreateTextBox() => new OsuNumberBox();
|
||||
}
|
||||
}
|
@ -7,21 +7,14 @@ using osu.Framework.IO.Serialization;
|
||||
|
||||
namespace osu.Game.IO.Serialization
|
||||
{
|
||||
public interface IJsonSerializable
|
||||
{
|
||||
}
|
||||
|
||||
public static class JsonSerializableExtensions
|
||||
{
|
||||
public static string Serialize(this IJsonSerializable obj) => JsonConvert.SerializeObject(obj, CreateGlobalSettings());
|
||||
public static string Serialize(this object obj) => JsonConvert.SerializeObject(obj, CreateGlobalSettings());
|
||||
|
||||
public static T Deserialize<T>(this string objString) => JsonConvert.DeserializeObject<T>(objString, CreateGlobalSettings());
|
||||
|
||||
public static void DeserializeInto<T>(this string objString, T target) => JsonConvert.PopulateObject(objString, target, CreateGlobalSettings());
|
||||
|
||||
/// <summary>
|
||||
/// Creates the default <see cref="JsonSerializerSettings"/> that should be used for all <see cref="IJsonSerializable"/>s.
|
||||
/// </summary>
|
||||
public static JsonSerializerSettings CreateGlobalSettings() => new JsonSerializerSettings
|
||||
{
|
||||
ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
|
@ -104,6 +104,8 @@ namespace osu.Game
|
||||
|
||||
protected Container ScreenOffsetContainer { get; private set; }
|
||||
|
||||
private Container overlayOffsetContainer;
|
||||
|
||||
[Resolved]
|
||||
private FrameworkConfigManager frameworkConfig { get; set; }
|
||||
|
||||
@ -120,7 +122,7 @@ namespace osu.Game
|
||||
|
||||
public virtual StableStorage GetStorageForStableInstall() => null;
|
||||
|
||||
public float ToolbarOffset => (Toolbar?.Position.Y ?? 0) + (Toolbar?.DrawHeight ?? 0);
|
||||
private float toolbarOffset => (Toolbar?.Position.Y ?? 0) + (Toolbar?.DrawHeight ?? 0);
|
||||
|
||||
private IdleTracker idleTracker;
|
||||
|
||||
@ -158,7 +160,7 @@ namespace osu.Game
|
||||
|
||||
private readonly string[] args;
|
||||
|
||||
private readonly List<OverlayContainer> overlays = new List<OverlayContainer>();
|
||||
private readonly List<OsuFocusedOverlayContainer> focusedOverlays = new List<OsuFocusedOverlayContainer>();
|
||||
|
||||
private readonly List<OverlayContainer> visibleBlockingOverlays = new List<OverlayContainer>();
|
||||
|
||||
@ -193,7 +195,7 @@ namespace osu.Game
|
||||
/// <param name="hideToolbar">Whether the toolbar should also be hidden.</param>
|
||||
public void CloseAllOverlays(bool hideToolbar = true)
|
||||
{
|
||||
foreach (var overlay in overlays)
|
||||
foreach (var overlay in focusedOverlays)
|
||||
overlay.Hide();
|
||||
|
||||
if (hideToolbar) Toolbar.Hide();
|
||||
@ -692,9 +694,16 @@ namespace osu.Game
|
||||
},
|
||||
}
|
||||
},
|
||||
overlayContent = new Container { RelativeSizeAxes = Axes.Both },
|
||||
rightFloatingOverlayContent = new Container { RelativeSizeAxes = Axes.Both },
|
||||
leftFloatingOverlayContent = new Container { RelativeSizeAxes = Axes.Both },
|
||||
overlayOffsetContainer = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
overlayContent = new Container { RelativeSizeAxes = Axes.Both },
|
||||
rightFloatingOverlayContent = new Container { RelativeSizeAxes = Axes.Both },
|
||||
leftFloatingOverlayContent = new Container { RelativeSizeAxes = Axes.Both },
|
||||
}
|
||||
},
|
||||
topMostOverlayContent = new Container { RelativeSizeAxes = Axes.Both },
|
||||
idleTracker,
|
||||
new ConfineMouseTracker()
|
||||
@ -731,7 +740,6 @@ namespace osu.Game
|
||||
|
||||
loadComponentSingleFile(Notifications.With(d =>
|
||||
{
|
||||
d.GetToolbarHeight = () => ToolbarOffset;
|
||||
d.Anchor = Anchor.TopRight;
|
||||
d.Origin = Anchor.TopRight;
|
||||
}), rightFloatingOverlayContent.Add, true);
|
||||
@ -757,7 +765,7 @@ namespace osu.Game
|
||||
loadComponentSingleFile(channelManager = new ChannelManager(), AddInternal, true);
|
||||
loadComponentSingleFile(chatOverlay = new ChatOverlay(), overlayContent.Add, true);
|
||||
loadComponentSingleFile(new MessageNotifier(), AddInternal, true);
|
||||
loadComponentSingleFile(Settings = new SettingsOverlay { GetToolbarHeight = () => ToolbarOffset }, leftFloatingOverlayContent.Add, true);
|
||||
loadComponentSingleFile(Settings = new SettingsOverlay(), leftFloatingOverlayContent.Add, true);
|
||||
var changelogOverlay = loadComponentSingleFile(new ChangelogOverlay(), overlayContent.Add, true);
|
||||
loadComponentSingleFile(userProfile = new UserProfileOverlay(), overlayContent.Add, true);
|
||||
loadComponentSingleFile(beatmapSetOverlay = new BeatmapSetOverlay(), overlayContent.Add, true);
|
||||
@ -766,14 +774,12 @@ namespace osu.Game
|
||||
|
||||
loadComponentSingleFile(new LoginOverlay
|
||||
{
|
||||
GetToolbarHeight = () => ToolbarOffset,
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
}, rightFloatingOverlayContent.Add, true);
|
||||
|
||||
loadComponentSingleFile(new NowPlayingOverlay
|
||||
{
|
||||
GetToolbarHeight = () => ToolbarOffset,
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
}, rightFloatingOverlayContent.Add, true);
|
||||
@ -904,8 +910,8 @@ namespace osu.Game
|
||||
if (cache)
|
||||
dependencies.CacheAs(component);
|
||||
|
||||
if (component is OverlayContainer overlay)
|
||||
overlays.Add(overlay);
|
||||
if (component is OsuFocusedOverlayContainer overlay)
|
||||
focusedOverlays.Add(overlay);
|
||||
|
||||
// schedule is here to ensure that all component loads are done after LoadComplete is run (and thus all dependencies are cached).
|
||||
// with some better organisation of LoadComplete to do construction and dependency caching in one step, followed by calls to loadComponentSingleFile,
|
||||
@ -1013,8 +1019,8 @@ namespace osu.Game
|
||||
{
|
||||
base.UpdateAfterChildren();
|
||||
|
||||
ScreenOffsetContainer.Padding = new MarginPadding { Top = ToolbarOffset };
|
||||
overlayContent.Padding = new MarginPadding { Top = ToolbarOffset };
|
||||
ScreenOffsetContainer.Padding = new MarginPadding { Top = toolbarOffset };
|
||||
overlayOffsetContainer.Padding = new MarginPadding { Top = toolbarOffset };
|
||||
|
||||
var horizontalOffset = 0f;
|
||||
|
||||
|
@ -140,12 +140,8 @@ namespace osu.Game.Overlays.Dashboard.Home.News
|
||||
}
|
||||
}
|
||||
|
||||
private class Date : CompositeDrawable, IHasCustomTooltip
|
||||
private class Date : CompositeDrawable, IHasCustomTooltip<DateTimeOffset>
|
||||
{
|
||||
public ITooltip GetCustomTooltip() => new DateTooltip();
|
||||
|
||||
public object TooltipContent => date;
|
||||
|
||||
private readonly DateTimeOffset date;
|
||||
|
||||
public Date(DateTimeOffset date)
|
||||
@ -190,6 +186,10 @@ namespace osu.Game.Overlays.Dashboard.Home.News
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
ITooltip<DateTimeOffset> IHasCustomTooltip<DateTimeOffset>.GetCustomTooltip() => new DateTooltip();
|
||||
|
||||
DateTimeOffset IHasCustomTooltip<DateTimeOffset>.TooltipContent => date;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -67,12 +67,8 @@ namespace osu.Game.Overlays.Dashboard.Home.News
|
||||
};
|
||||
}
|
||||
|
||||
private class Date : CompositeDrawable, IHasCustomTooltip
|
||||
private class Date : CompositeDrawable, IHasCustomTooltip<DateTimeOffset>
|
||||
{
|
||||
public ITooltip GetCustomTooltip() => new DateTooltip();
|
||||
|
||||
public object TooltipContent => date;
|
||||
|
||||
private readonly DateTimeOffset date;
|
||||
|
||||
public Date(DateTimeOffset date)
|
||||
@ -110,6 +106,10 @@ namespace osu.Game.Overlays.Dashboard.Home.News
|
||||
t.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Regular);
|
||||
});
|
||||
}
|
||||
|
||||
ITooltip<DateTimeOffset> IHasCustomTooltip<DateTimeOffset>.GetCustomTooltip() => new DateTooltip();
|
||||
|
||||
DateTimeOffset IHasCustomTooltip<DateTimeOffset>.TooltipContent => date;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ using osuTK.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Cursor;
|
||||
using System;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
@ -20,11 +19,6 @@ namespace osu.Game.Overlays
|
||||
|
||||
private const float transition_time = 400;
|
||||
|
||||
/// <summary>
|
||||
/// Provide a source for the toolbar height.
|
||||
/// </summary>
|
||||
public Func<float> GetToolbarHeight;
|
||||
|
||||
public LoginOverlay()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
@ -94,12 +88,5 @@ namespace osu.Game.Overlays
|
||||
settingsSection.Bounding = false;
|
||||
this.FadeOut(transition_time);
|
||||
}
|
||||
|
||||
protected override void UpdateAfterChildren()
|
||||
{
|
||||
base.UpdateAfterChildren();
|
||||
|
||||
Padding = new MarginPadding { Top = GetToolbarHeight?.Invoke() ?? 0 };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -123,12 +123,8 @@ namespace osu.Game.Overlays.News
|
||||
main.AddText(post.Author, t => t.Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold));
|
||||
}
|
||||
|
||||
private class DateContainer : CircularContainer, IHasCustomTooltip
|
||||
private class DateContainer : CircularContainer, IHasCustomTooltip<DateTimeOffset>
|
||||
{
|
||||
public ITooltip GetCustomTooltip() => new DateTooltip();
|
||||
|
||||
public object TooltipContent => date;
|
||||
|
||||
private readonly DateTimeOffset date;
|
||||
|
||||
public DateContainer(DateTimeOffset date)
|
||||
@ -162,6 +158,10 @@ namespace osu.Game.Overlays.News
|
||||
}
|
||||
|
||||
protected override bool OnClick(ClickEvent e) => true; // Protects the NewsCard from clicks while hovering DateContainer
|
||||
|
||||
ITooltip<DateTimeOffset> IHasCustomTooltip<DateTimeOffset>.GetCustomTooltip() => new DateTooltip();
|
||||
|
||||
DateTimeOffset IHasCustomTooltip<DateTimeOffset>.TooltipContent => date;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Overlays.Notifications;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Localisation;
|
||||
@ -30,11 +29,6 @@ namespace osu.Game.Overlays
|
||||
|
||||
private FlowContainer<NotificationSection> sections;
|
||||
|
||||
/// <summary>
|
||||
/// Provide a source for the toolbar height.
|
||||
/// </summary>
|
||||
public Func<float> GetToolbarHeight;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
@ -168,12 +162,5 @@ namespace osu.Game.Overlays
|
||||
|
||||
updateCounts();
|
||||
}
|
||||
|
||||
protected override void UpdateAfterChildren()
|
||||
{
|
||||
base.UpdateAfterChildren();
|
||||
|
||||
Padding = new MarginPadding { Top = GetToolbarHeight?.Invoke() ?? 0 };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -55,11 +55,6 @@ namespace osu.Game.Overlays
|
||||
protected override string PopInSampleName => "UI/now-playing-pop-in";
|
||||
protected override string PopOutSampleName => "UI/now-playing-pop-out";
|
||||
|
||||
/// <summary>
|
||||
/// Provide a source for the toolbar height.
|
||||
/// </summary>
|
||||
public Func<float> GetToolbarHeight;
|
||||
|
||||
[Resolved]
|
||||
private MusicController musicController { get; set; }
|
||||
|
||||
@ -246,7 +241,6 @@ namespace osu.Game.Overlays
|
||||
base.UpdateAfterChildren();
|
||||
|
||||
Height = dragContainer.Height;
|
||||
dragContainer.Padding = new MarginPadding { Top = GetToolbarHeight?.Invoke() ?? 0 };
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
|
@ -54,11 +54,6 @@ namespace osu.Game.Overlays
|
||||
|
||||
protected override string PopInSampleName => "UI/settings-pop-in";
|
||||
|
||||
/// <summary>
|
||||
/// Provide a source for the toolbar height.
|
||||
/// </summary>
|
||||
public Func<float> GetToolbarHeight;
|
||||
|
||||
private readonly bool showSidebar;
|
||||
|
||||
private LoadingLayer loading;
|
||||
@ -193,7 +188,6 @@ namespace osu.Game.Overlays
|
||||
base.UpdateAfterChildren();
|
||||
|
||||
ContentContainer.Margin = new MarginPadding { Left = Sidebar?.DrawWidth ?? 0 };
|
||||
Padding = new MarginPadding { Top = GetToolbarHeight?.Invoke() ?? 0 };
|
||||
}
|
||||
|
||||
private const double fade_in_duration = 1000;
|
||||
|
@ -18,7 +18,7 @@ using osu.Game.Input.Bindings;
|
||||
|
||||
namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
public class Toolbar : VisibilityContainer, IKeyBindingHandler<GlobalAction>
|
||||
public class Toolbar : OverlayContainer, IKeyBindingHandler<GlobalAction>
|
||||
{
|
||||
public const float HEIGHT = 40;
|
||||
public const float TOOLTIP_HEIGHT = 30;
|
||||
@ -41,6 +41,8 @@ namespace osu.Game.Overlays.Toolbar
|
||||
// Toolbar and its components need keyboard input even when hidden.
|
||||
public override bool PropagateNonPositionalInputSubTree => true;
|
||||
|
||||
protected override bool BlockScrollInput => false;
|
||||
|
||||
public Toolbar()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
|
@ -11,7 +11,6 @@ using osu.Framework.Extensions.TypeExtensions;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.IO.Serialization;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Utils;
|
||||
|
||||
@ -21,7 +20,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
/// The base class for gameplay modifiers.
|
||||
/// </summary>
|
||||
[ExcludeFromDynamicCompile]
|
||||
public abstract class Mod : IMod, IEquatable<Mod>, IJsonSerializable, IDeepCloneable<Mod>
|
||||
public abstract class Mod : IMod, IEquatable<Mod>, IDeepCloneable<Mod>
|
||||
{
|
||||
/// <summary>
|
||||
/// The name of this mod.
|
||||
|
@ -3,14 +3,13 @@
|
||||
|
||||
using System;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.IO.Serialization;
|
||||
|
||||
namespace osu.Game.Rulesets.Timing
|
||||
{
|
||||
/// <summary>
|
||||
/// A control point which adds an aggregated multiplier based on the provided <see cref="TimingPoint"/>'s BeatLength and <see cref="DifficultyPoint"/>'s SpeedMultiplier.
|
||||
/// </summary>
|
||||
public class MultiplierControlPoint : IJsonSerializable, IComparable<MultiplierControlPoint>
|
||||
public class MultiplierControlPoint : IComparable<MultiplierControlPoint>
|
||||
{
|
||||
/// <summary>
|
||||
/// The time in milliseconds at which this <see cref="MultiplierControlPoint"/> starts.
|
||||
|
@ -4,13 +4,12 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Game.IO.Serialization;
|
||||
using osu.Game.IO.Serialization.Converters;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
|
||||
namespace osu.Game.Screens.Edit
|
||||
{
|
||||
public class ClipboardContent : IJsonSerializable
|
||||
public class ClipboardContent
|
||||
{
|
||||
[JsonConverter(typeof(TypedListConverter<HitObject>))]
|
||||
public IList<HitObject> HitObjects;
|
||||
|
@ -1,14 +1,27 @@
|
||||
// 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.Globalization;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics.UserInterfaceV2;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.Edit.Setup
|
||||
{
|
||||
internal class DesignSection : SetupSection
|
||||
{
|
||||
protected LabelledSwitchButton EnableCountdown;
|
||||
|
||||
protected FillFlowContainer CountdownSettings;
|
||||
protected LabelledEnumDropdown<CountdownType> CountdownSpeed;
|
||||
protected LabelledNumberBox CountdownOffset;
|
||||
|
||||
private LabelledSwitchButton widescreenSupport;
|
||||
private LabelledSwitchButton epilepsyWarning;
|
||||
private LabelledSwitchButton letterboxDuringBreaks;
|
||||
@ -20,6 +33,35 @@ namespace osu.Game.Screens.Edit.Setup
|
||||
{
|
||||
Children = new[]
|
||||
{
|
||||
EnableCountdown = new LabelledSwitchButton
|
||||
{
|
||||
Label = "Enable countdown",
|
||||
Current = { Value = Beatmap.BeatmapInfo.Countdown != CountdownType.None },
|
||||
Description = "If enabled, an \"Are you ready? 3, 2, 1, GO!\" countdown will be inserted at the beginning of the beatmap, assuming there is enough time to do so."
|
||||
},
|
||||
CountdownSettings = new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Spacing = new Vector2(10),
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
CountdownSpeed = new LabelledEnumDropdown<CountdownType>
|
||||
{
|
||||
Label = "Countdown speed",
|
||||
Current = { Value = Beatmap.BeatmapInfo.Countdown != CountdownType.None ? Beatmap.BeatmapInfo.Countdown : CountdownType.Normal },
|
||||
Items = Enum.GetValues(typeof(CountdownType)).Cast<CountdownType>().Where(type => type != CountdownType.None)
|
||||
},
|
||||
CountdownOffset = new LabelledNumberBox
|
||||
{
|
||||
Label = "Countdown offset",
|
||||
Current = { Value = Beatmap.BeatmapInfo.CountdownOffset.ToString() },
|
||||
Description = "If the countdown sounds off-time, use this to make it appear one or more beats early.",
|
||||
}
|
||||
}
|
||||
},
|
||||
Empty(),
|
||||
widescreenSupport = new LabelledSwitchButton
|
||||
{
|
||||
Label = "Widescreen support",
|
||||
@ -45,13 +87,31 @@ namespace osu.Game.Screens.Edit.Setup
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
EnableCountdown.Current.BindValueChanged(_ => updateCountdownSettingsVisibility(), true);
|
||||
|
||||
EnableCountdown.Current.BindValueChanged(_ => updateBeatmap());
|
||||
CountdownSpeed.Current.BindValueChanged(_ => updateBeatmap());
|
||||
CountdownOffset.OnCommit += (_, __) => onOffsetCommitted();
|
||||
|
||||
widescreenSupport.Current.BindValueChanged(_ => updateBeatmap());
|
||||
epilepsyWarning.Current.BindValueChanged(_ => updateBeatmap());
|
||||
letterboxDuringBreaks.Current.BindValueChanged(_ => updateBeatmap());
|
||||
}
|
||||
|
||||
private void updateCountdownSettingsVisibility() => CountdownSettings.FadeTo(EnableCountdown.Current.Value ? 1 : 0);
|
||||
|
||||
private void onOffsetCommitted()
|
||||
{
|
||||
updateBeatmap();
|
||||
// update displayed text to ensure parsed value matches display (i.e. if empty string was provided).
|
||||
CountdownOffset.Current.Value = Beatmap.BeatmapInfo.CountdownOffset.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
private void updateBeatmap()
|
||||
{
|
||||
Beatmap.BeatmapInfo.Countdown = EnableCountdown.Current.Value ? CountdownSpeed.Current.Value : CountdownType.None;
|
||||
Beatmap.BeatmapInfo.CountdownOffset = int.TryParse(CountdownOffset.Current.Value, NumberStyles.None, CultureInfo.InvariantCulture, out int offset) ? offset : 0;
|
||||
|
||||
Beatmap.BeatmapInfo.WidescreenStoryboard = widescreenSupport.Current.Value;
|
||||
Beatmap.BeatmapInfo.EpilepsyWarning = epilepsyWarning.Current.Value;
|
||||
Beatmap.BeatmapInfo.LetterboxInBreaks = letterboxDuringBreaks.Current.Value;
|
||||
|
@ -8,7 +8,6 @@ using Newtonsoft.Json;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.IO.Serialization;
|
||||
using osu.Game.Skinning;
|
||||
using osuTK;
|
||||
|
||||
@ -18,7 +17,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
/// Serialised information governing custom changes to an <see cref="ISkinnableDrawable"/>.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class SkinnableInfo : IJsonSerializable
|
||||
public class SkinnableInfo
|
||||
{
|
||||
public Type Type { get; set; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user