mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 22:56:36 +09:00
Merge branch 'master' into fix-spinner-rpm-user-rate-adjust
This commit is contained in:
@ -6,7 +6,6 @@ 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;
|
||||
@ -14,7 +13,6 @@ 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;
|
||||
@ -24,6 +22,7 @@ using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Rulesets.UI.Scrolling;
|
||||
using osu.Game.Screens.Edit;
|
||||
using osu.Game.Screens.Edit.Components.RadioButtons;
|
||||
using osu.Game.Screens.Edit.Components.TernaryButtons;
|
||||
using osu.Game.Screens.Edit.Compose;
|
||||
using osu.Game.Screens.Edit.Compose.Components;
|
||||
using osuTK;
|
||||
@ -31,6 +30,11 @@ using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Rulesets.Edit
|
||||
{
|
||||
/// <summary>
|
||||
/// Top level container for editor compose mode.
|
||||
/// Responsible for providing snapping and generally gluing components together.
|
||||
/// </summary>
|
||||
/// <typeparam name="TObject">The base type of supported objects.</typeparam>
|
||||
[Cached(Type = typeof(IPlacementHandler))]
|
||||
public abstract class HitObjectComposer<TObject> : HitObjectComposer, IPlacementHandler
|
||||
where TObject : HitObject
|
||||
@ -58,7 +62,7 @@ namespace osu.Game.Rulesets.Edit
|
||||
|
||||
private RadioButtonCollection toolboxCollection;
|
||||
|
||||
private ToolboxGroup togglesCollection;
|
||||
private FillFlowContainer togglesCollection;
|
||||
|
||||
protected HitObjectComposer(Ruleset ruleset)
|
||||
{
|
||||
@ -116,14 +120,19 @@ namespace osu.Game.Rulesets.Edit
|
||||
Spacing = new Vector2(10),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new ToolboxGroup("toolbox") { Child = toolboxCollection = new RadioButtonCollection { RelativeSizeAxes = Axes.X } },
|
||||
togglesCollection = new ToolboxGroup("toggles")
|
||||
new ToolboxGroup("toolbox (1-9)")
|
||||
{
|
||||
ChildrenEnumerable = Toggles.Select(b => new SettingsCheckbox
|
||||
Child = toolboxCollection = new RadioButtonCollection { RelativeSizeAxes = Axes.X }
|
||||
},
|
||||
new ToolboxGroup("toggles (Q~P)")
|
||||
{
|
||||
Child = togglesCollection = new FillFlowContainer
|
||||
{
|
||||
Bindable = b,
|
||||
LabelText = b?.Description ?? "unknown"
|
||||
})
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Spacing = new Vector2(0, 5),
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -134,6 +143,9 @@ namespace osu.Game.Rulesets.Edit
|
||||
.Select(t => new RadioButton(t.Name, () => toolSelected(t), t.CreateIcon))
|
||||
.ToList();
|
||||
|
||||
TernaryStates = CreateTernaryButtons().ToArray();
|
||||
togglesCollection.AddRange(TernaryStates.Select(b => new DrawableTernaryButton(b)));
|
||||
|
||||
setSelectTool();
|
||||
|
||||
EditorBeatmap.SelectedHitObjects.CollectionChanged += selectionChanged;
|
||||
@ -162,10 +174,14 @@ namespace osu.Game.Rulesets.Edit
|
||||
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"/>.
|
||||
/// A collection of states which will be displayed to the user in the toolbox.
|
||||
/// </summary>
|
||||
protected virtual IEnumerable<BindableBool> Toggles => Enumerable.Empty<BindableBool>();
|
||||
public TernaryButton[] TernaryStates { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Create all ternary states required to be displayed to the user.
|
||||
/// </summary>
|
||||
protected virtual IEnumerable<TernaryButton> CreateTernaryButtons() => BlueprintContainer.TernaryStates;
|
||||
|
||||
/// <summary>
|
||||
/// Construct a relevant blueprint container. This will manage hitobject selection/placement input handling and display logic.
|
||||
@ -192,6 +208,9 @@ namespace osu.Game.Rulesets.Edit
|
||||
|
||||
protected override bool OnKeyDown(KeyDownEvent e)
|
||||
{
|
||||
if (e.ControlPressed || e.AltPressed || e.SuperPressed)
|
||||
return false;
|
||||
|
||||
if (checkLeftToggleFromKey(e.Key, out var leftIndex))
|
||||
{
|
||||
var item = toolboxCollection.Items.ElementAtOrDefault(leftIndex);
|
||||
@ -205,11 +224,11 @@ namespace osu.Game.Rulesets.Edit
|
||||
|
||||
if (checkRightToggleFromKey(e.Key, out var rightIndex))
|
||||
{
|
||||
var item = togglesCollection.Children[rightIndex];
|
||||
var item = togglesCollection.ElementAtOrDefault(rightIndex);
|
||||
|
||||
if (item is SettingsCheckbox checkbox)
|
||||
if (item is DrawableTernaryButton button)
|
||||
{
|
||||
checkbox.Bindable.Value = !checkbox.Bindable.Value;
|
||||
button.Button.Toggle();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Edit
|
||||
/// <summary>
|
||||
/// The <see cref="HitObject"/> that is being placed.
|
||||
/// </summary>
|
||||
protected readonly HitObject HitObject;
|
||||
public readonly HitObject HitObject;
|
||||
|
||||
[Resolved(canBeNull: true)]
|
||||
protected EditorClock EditorClock { get; private set; }
|
||||
|
@ -157,6 +157,9 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
updateState(ArmedState.Idle, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invoked by the base <see cref="DrawableHitObject"/> to populate samples, once on initial load and potentially again on any change to the samples collection.
|
||||
/// </summary>
|
||||
protected virtual void LoadSamples()
|
||||
{
|
||||
if (Samples != null)
|
||||
@ -183,6 +186,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
private void onDefaultsApplied(HitObject hitObject)
|
||||
{
|
||||
apply(hitObject);
|
||||
updateState(state.Value, true);
|
||||
DefaultsApplied?.Invoke(this);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user