mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 00:42:55 +08:00
Merge branch 'master' into fix-overlay-sound-on-disabled
This commit is contained in:
commit
fbbc3b4921
@ -5,6 +5,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Caching;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -38,6 +39,13 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
new SpinnerCompositionTool()
|
||||
};
|
||||
|
||||
private readonly BindableBool distanceSnapToggle = new BindableBool(true) { Description = "Distance Snap" };
|
||||
|
||||
protected override IEnumerable<BindableBool> Toggles => new[]
|
||||
{
|
||||
distanceSnapToggle
|
||||
};
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
@ -45,6 +53,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
|
||||
EditorBeatmap.SelectedHitObjects.CollectionChanged += (_, __) => updateDistanceSnapGrid();
|
||||
EditorBeatmap.PlacementObject.ValueChanged += _ => updateDistanceSnapGrid();
|
||||
distanceSnapToggle.ValueChanged += _ => updateDistanceSnapGrid();
|
||||
}
|
||||
|
||||
protected override ComposeBlueprintContainer CreateBlueprintContainer(IEnumerable<DrawableHitObject> hitObjects)
|
||||
@ -87,6 +96,10 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
{
|
||||
distanceSnapGridContainer.Clear();
|
||||
distanceSnapGridCache.Invalidate();
|
||||
distanceSnapGrid = null;
|
||||
|
||||
if (!distanceSnapToggle.Value)
|
||||
return;
|
||||
|
||||
switch (BlueprintContainer.CurrentTool)
|
||||
{
|
||||
|
@ -48,7 +48,10 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
private class ExampleContainer : PlayerSettingsGroup
|
||||
{
|
||||
protected override string Title => @"example";
|
||||
public ExampleContainer()
|
||||
: base("example")
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,8 +20,6 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
{
|
||||
private const int padding = 10;
|
||||
|
||||
protected override string Title => @"ladder";
|
||||
|
||||
private SettingsDropdown<TournamentRound> roundDropdown;
|
||||
private PlayerCheckbox losersCheckbox;
|
||||
private DateTextBox dateTimeBox;
|
||||
@ -34,6 +32,11 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
[Resolved]
|
||||
private LadderInfo ladderInfo { get; set; }
|
||||
|
||||
public LadderEditorSettings()
|
||||
: base("ladder")
|
||||
{
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
|
@ -66,12 +66,14 @@ namespace osu.Game.Beatmaps
|
||||
private readonly RulesetStore rulesets;
|
||||
private readonly BeatmapStore beatmaps;
|
||||
private readonly AudioManager audioManager;
|
||||
private readonly BeatmapOnlineLookupQueue onlineLookupQueue;
|
||||
private readonly TextureStore textureStore;
|
||||
private readonly ITrackStore trackStore;
|
||||
|
||||
[CanBeNull]
|
||||
private readonly BeatmapOnlineLookupQueue onlineLookupQueue;
|
||||
|
||||
public BeatmapManager(Storage storage, IDatabaseContextFactory contextFactory, RulesetStore rulesets, IAPIProvider api, [NotNull] AudioManager audioManager, GameHost host = null,
|
||||
WorkingBeatmap defaultBeatmap = null)
|
||||
WorkingBeatmap defaultBeatmap = null, bool performOnlineLookups = false)
|
||||
: base(storage, contextFactory, api, new BeatmapStore(contextFactory), host)
|
||||
{
|
||||
this.rulesets = rulesets;
|
||||
@ -85,7 +87,8 @@ namespace osu.Game.Beatmaps
|
||||
beatmaps.ItemRemoved += removeWorkingCache;
|
||||
beatmaps.ItemUpdated += removeWorkingCache;
|
||||
|
||||
onlineLookupQueue = new BeatmapOnlineLookupQueue(api, storage);
|
||||
if (performOnlineLookups)
|
||||
onlineLookupQueue = new BeatmapOnlineLookupQueue(api, storage);
|
||||
|
||||
textureStore = new LargeTextureStore(host?.CreateTextureLoaderStore(Files.Store));
|
||||
trackStore = audioManager.GetTrackStore(Files.Store);
|
||||
@ -142,7 +145,8 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
bool hadOnlineBeatmapIDs = beatmapSet.Beatmaps.Any(b => b.OnlineBeatmapID > 0);
|
||||
|
||||
await onlineLookupQueue.UpdateAsync(beatmapSet, cancellationToken);
|
||||
if (onlineLookupQueue != null)
|
||||
await onlineLookupQueue.UpdateAsync(beatmapSet, cancellationToken);
|
||||
|
||||
// ensure at least one beatmap was able to retrieve or keep an online ID, else drop the set ID.
|
||||
if (hadOnlineBeatmapIDs && !beatmapSet.Beatmaps.Any(b => b.OnlineBeatmapID > 0))
|
||||
@ -231,7 +235,7 @@ namespace osu.Game.Beatmaps
|
||||
/// <param name="beatmapSkin">The beatmap <see cref="ISkin"/> content to write, null if to be omitted.</param>
|
||||
public void Save(BeatmapInfo info, IBeatmap beatmapContent, ISkin beatmapSkin = null)
|
||||
{
|
||||
var setInfo = QueryBeatmapSet(s => s.Beatmaps.Any(b => b.ID == info.ID));
|
||||
var setInfo = info.BeatmapSet;
|
||||
|
||||
using (var stream = new MemoryStream())
|
||||
{
|
||||
|
@ -9,16 +9,20 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
public abstract class RollingCounter<T> : Container
|
||||
public abstract class RollingCounter<T> : Container, IHasCurrentValue<T>
|
||||
where T : struct, IEquatable<T>
|
||||
{
|
||||
/// <summary>
|
||||
/// The current value.
|
||||
/// </summary>
|
||||
public Bindable<T> Current = new Bindable<T>();
|
||||
private readonly BindableWithCurrent<T> current = new BindableWithCurrent<T>();
|
||||
|
||||
public Bindable<T> Current
|
||||
{
|
||||
get => current.Current;
|
||||
set => current.Current = value;
|
||||
}
|
||||
|
||||
private SpriteText displayedCountSpriteText;
|
||||
|
||||
|
@ -198,7 +198,7 @@ namespace osu.Game
|
||||
|
||||
// ordering is important here to ensure foreign keys rules are not broken in ModelStore.Cleanup()
|
||||
dependencies.Cache(ScoreManager = new ScoreManager(RulesetStore, () => BeatmapManager, Storage, API, contextFactory, Host));
|
||||
dependencies.Cache(BeatmapManager = new BeatmapManager(Storage, contextFactory, RulesetStore, API, Audio, Host, defaultBeatmap));
|
||||
dependencies.Cache(BeatmapManager = new BeatmapManager(Storage, contextFactory, RulesetStore, API, Audio, Host, defaultBeatmap, true));
|
||||
|
||||
// this should likely be moved to ArchiveModelManager when another case appers where it is necessary
|
||||
// to have inter-dependent model managers. this could be obtained with an IHasForeign<T> interface to
|
||||
|
@ -6,6 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input;
|
||||
@ -13,6 +14,7 @@ using osu.Framework.Input.Events;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Overlays.Settings;
|
||||
using osu.Game.Rulesets.Configuration;
|
||||
using osu.Game.Rulesets.Edit.Tools;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
@ -92,9 +94,18 @@ namespace osu.Game.Rulesets.Edit
|
||||
Name = "Sidebar",
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Right = 10 },
|
||||
Spacing = new Vector2(10),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new ToolboxGroup { Child = toolboxCollection = new RadioButtonCollection { RelativeSizeAxes = Axes.X } }
|
||||
new ToolboxGroup("toolbox") { Child = toolboxCollection = new RadioButtonCollection { RelativeSizeAxes = Axes.X } },
|
||||
new ToolboxGroup("toggles")
|
||||
{
|
||||
ChildrenEnumerable = Toggles.Select(b => new SettingsCheckbox
|
||||
{
|
||||
Bindable = b,
|
||||
LabelText = b?.Description ?? "unknown"
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
new Container
|
||||
@ -156,6 +167,12 @@ namespace osu.Game.Rulesets.Edit
|
||||
/// </remarks>
|
||||
protected abstract IReadOnlyList<HitObjectCompositionTool> CompositionTools { get; }
|
||||
|
||||
/// <summary>
|
||||
/// A collection of toggles which will be displayed to the user.
|
||||
/// The display name will be decided by <see cref="Bindable{T}.Description"/>.
|
||||
/// </summary>
|
||||
protected virtual IEnumerable<BindableBool> Toggles => Enumerable.Empty<BindableBool>();
|
||||
|
||||
/// <summary>
|
||||
/// Construct a relevant blueprint container. This will manage hitobject selection/placement input handling and display logic.
|
||||
/// </summary>
|
||||
|
@ -8,9 +8,8 @@ namespace osu.Game.Rulesets.Edit
|
||||
{
|
||||
public class ToolboxGroup : PlayerSettingsGroup
|
||||
{
|
||||
protected override string Title => "toolbox";
|
||||
|
||||
public ToolboxGroup()
|
||||
public ToolboxGroup(string title)
|
||||
: base(title)
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Width = 1;
|
||||
|
@ -10,7 +10,10 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
||||
{
|
||||
public class CollectionSettings : PlayerSettingsGroup
|
||||
{
|
||||
protected override string Title => @"collections";
|
||||
public CollectionSettings()
|
||||
: base("collections")
|
||||
{
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
|
@ -10,7 +10,10 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
||||
{
|
||||
public class DiscussionSettings : PlayerSettingsGroup
|
||||
{
|
||||
protected override string Title => @"discussions";
|
||||
public DiscussionSettings()
|
||||
: base("discussions")
|
||||
{
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
|
@ -9,11 +9,10 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
||||
{
|
||||
public class InputSettings : PlayerSettingsGroup
|
||||
{
|
||||
protected override string Title => "Input settings";
|
||||
|
||||
private readonly PlayerCheckbox mouseButtonsCheckbox;
|
||||
|
||||
public InputSettings()
|
||||
: base("Input Settings")
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
@ -13,8 +13,6 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
||||
{
|
||||
private const int padding = 10;
|
||||
|
||||
protected override string Title => @"playback";
|
||||
|
||||
public readonly Bindable<double> UserPlaybackRate = new BindableDouble(1)
|
||||
{
|
||||
Default = 1,
|
||||
@ -28,6 +26,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
||||
private readonly OsuSpriteText multiplierText;
|
||||
|
||||
public PlaybackSettings()
|
||||
: base("playback")
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
@ -17,11 +17,6 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
||||
{
|
||||
public abstract class PlayerSettingsGroup : Container
|
||||
{
|
||||
/// <summary>
|
||||
/// The title to be displayed in the header of this group.
|
||||
/// </summary>
|
||||
protected abstract string Title { get; }
|
||||
|
||||
private const float transition_duration = 250;
|
||||
private const int container_width = 270;
|
||||
private const int border_thickness = 2;
|
||||
@ -58,7 +53,11 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
||||
|
||||
private Color4 expandedColour;
|
||||
|
||||
protected PlayerSettingsGroup()
|
||||
/// <summary>
|
||||
/// Create a new instance.
|
||||
/// </summary>
|
||||
/// <param name="title">The title to be displayed in the header of this group.</param>
|
||||
protected PlayerSettingsGroup(string title)
|
||||
{
|
||||
AutoSizeAxes = Axes.Y;
|
||||
Width = container_width;
|
||||
@ -95,7 +94,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
||||
{
|
||||
Origin = Anchor.CentreLeft,
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Text = Title.ToUpperInvariant(),
|
||||
Text = title.ToUpperInvariant(),
|
||||
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 17),
|
||||
Margin = new MarginPadding { Left = 10 },
|
||||
},
|
||||
|
@ -10,8 +10,6 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
||||
{
|
||||
public class VisualSettings : PlayerSettingsGroup
|
||||
{
|
||||
protected override string Title => "Visual settings";
|
||||
|
||||
private readonly PlayerSliderBar<double> dimSliderBar;
|
||||
private readonly PlayerSliderBar<double> blurSliderBar;
|
||||
private readonly PlayerCheckbox showStoryboardToggle;
|
||||
@ -19,6 +17,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
||||
private readonly PlayerCheckbox beatmapHitsoundsToggle;
|
||||
|
||||
public VisualSettings()
|
||||
: base("Visual Settings")
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user