mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 15:12:57 +08:00
Merge remote-tracking branch 'refs/remotes/ppy/master' into no-control-overlay-headers
This commit is contained in:
commit
2b941a0d52
@ -54,6 +54,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.1230.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.1230.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.118.0" />
|
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.122.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -36,7 +36,10 @@ namespace osu.Game.Rulesets.Catch.Mods
|
|||||||
|
|
||||||
//disable keyboard controls
|
//disable keyboard controls
|
||||||
public bool OnPressed(CatchAction action) => true;
|
public bool OnPressed(CatchAction action) => true;
|
||||||
public bool OnReleased(CatchAction action) => true;
|
|
||||||
|
public void OnReleased(CatchAction action)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
protected override bool OnMouseMove(MouseMoveEvent e)
|
protected override bool OnMouseMove(MouseMoveEvent e)
|
||||||
{
|
{
|
||||||
|
@ -103,7 +103,9 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
MovableCatcher.X = state.CatcherX.Value;
|
MovableCatcher.X = state.CatcherX.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnReleased(CatchAction action) => false;
|
public void OnReleased(CatchAction action)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public bool AttemptCatch(CatchHitObject obj) => MovableCatcher.AttemptCatch(obj);
|
public bool AttemptCatch(CatchHitObject obj) => MovableCatcher.AttemptCatch(obj);
|
||||||
|
|
||||||
@ -341,24 +343,22 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnReleased(CatchAction action)
|
public void OnReleased(CatchAction action)
|
||||||
{
|
{
|
||||||
switch (action)
|
switch (action)
|
||||||
{
|
{
|
||||||
case CatchAction.MoveLeft:
|
case CatchAction.MoveLeft:
|
||||||
currentDirection++;
|
currentDirection++;
|
||||||
return true;
|
break;
|
||||||
|
|
||||||
case CatchAction.MoveRight:
|
case CatchAction.MoveRight:
|
||||||
currentDirection--;
|
currentDirection--;
|
||||||
return true;
|
break;
|
||||||
|
|
||||||
case CatchAction.Dash:
|
case CatchAction.Dash:
|
||||||
Dashing = false;
|
Dashing = false;
|
||||||
return true;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -54,10 +54,10 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseUp(MouseUpEvent e)
|
protected override void OnMouseUp(MouseUpEvent e)
|
||||||
{
|
{
|
||||||
EndPlacement();
|
EndPlacement();
|
||||||
return base.OnMouseUp(e);
|
base.OnMouseUp(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void UpdatePosition(Vector2 screenSpacePosition)
|
public override void UpdatePosition(Vector2 screenSpacePosition)
|
||||||
|
@ -55,14 +55,12 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
|||||||
return base.OnMouseDown(e);
|
return base.OnMouseDown(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnDrag(DragEvent e)
|
protected override void OnDrag(DragEvent e)
|
||||||
{
|
{
|
||||||
var result = base.OnDrag(e);
|
base.OnDrag(e);
|
||||||
|
|
||||||
ScreenSpaceDragPosition = e.ScreenSpaceMousePosition;
|
ScreenSpaceDragPosition = e.ScreenSpaceMousePosition;
|
||||||
DragPosition = DrawableObject.ToLocalSpace(e.ScreenSpaceMousePosition);
|
DragPosition = DrawableObject.ToLocalSpace(e.ScreenSpaceMousePosition);
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Show()
|
public override void Show()
|
||||||
|
34
osu.Game.Rulesets.Mania/Edit/ManiaBlueprintContainer.cs
Normal file
34
osu.Game.Rulesets.Mania/Edit/ManiaBlueprintContainer.cs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
// 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.Collections.Generic;
|
||||||
|
using osu.Game.Rulesets.Edit;
|
||||||
|
using osu.Game.Rulesets.Mania.Edit.Blueprints;
|
||||||
|
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osu.Game.Screens.Edit.Compose.Components;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mania.Edit
|
||||||
|
{
|
||||||
|
public class ManiaBlueprintContainer : ComposeBlueprintContainer
|
||||||
|
{
|
||||||
|
public ManiaBlueprintContainer(IEnumerable<DrawableHitObject> drawableHitObjects)
|
||||||
|
: base(drawableHitObjects)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override SelectionBlueprint CreateBlueprintFor(DrawableHitObject hitObject)
|
||||||
|
{
|
||||||
|
switch (hitObject)
|
||||||
|
{
|
||||||
|
case DrawableNote note:
|
||||||
|
return new NoteSelectionBlueprint(note);
|
||||||
|
|
||||||
|
case DrawableHoldNote holdNote:
|
||||||
|
return new HoldNoteSelectionBlueprint(holdNote);
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.CreateBlueprintFor(hitObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -5,11 +5,8 @@ using osu.Game.Beatmaps;
|
|||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Edit.Tools;
|
using osu.Game.Rulesets.Edit.Tools;
|
||||||
using osu.Game.Rulesets.Mania.Objects;
|
using osu.Game.Rulesets.Mania.Objects;
|
||||||
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Rulesets.Mania.Edit.Blueprints;
|
|
||||||
using osu.Game.Rulesets.Mania.UI;
|
using osu.Game.Rulesets.Mania.UI;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
@ -52,26 +49,12 @@ namespace osu.Game.Rulesets.Mania.Edit
|
|||||||
return drawableRuleset;
|
return drawableRuleset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override ComposeBlueprintContainer CreateBlueprintContainer() => new ManiaBlueprintContainer(drawableRuleset.Playfield.AllHitObjects);
|
||||||
|
|
||||||
protected override IReadOnlyList<HitObjectCompositionTool> CompositionTools => new HitObjectCompositionTool[]
|
protected override IReadOnlyList<HitObjectCompositionTool> CompositionTools => new HitObjectCompositionTool[]
|
||||||
{
|
{
|
||||||
new NoteCompositionTool(),
|
new NoteCompositionTool(),
|
||||||
new HoldNoteCompositionTool()
|
new HoldNoteCompositionTool()
|
||||||
};
|
};
|
||||||
|
|
||||||
public override SelectionHandler CreateSelectionHandler() => new ManiaSelectionHandler();
|
|
||||||
|
|
||||||
public override SelectionBlueprint CreateBlueprintFor(DrawableHitObject hitObject)
|
|
||||||
{
|
|
||||||
switch (hitObject)
|
|
||||||
{
|
|
||||||
case DrawableNote note:
|
|
||||||
return new NoteSelectionBlueprint(note);
|
|
||||||
|
|
||||||
case DrawableHoldNote holdNote:
|
|
||||||
return new HoldNoteSelectionBlueprint(holdNote);
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.CreateBlueprintFor(hitObject);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -171,17 +171,17 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
bodyPiece.Hitting = true;
|
bodyPiece.Hitting = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnReleased(ManiaAction action)
|
public void OnReleased(ManiaAction action)
|
||||||
{
|
{
|
||||||
if (AllJudged)
|
if (AllJudged)
|
||||||
return false;
|
return;
|
||||||
|
|
||||||
if (action != Action.Value)
|
if (action != Action.Value)
|
||||||
return false;
|
return;
|
||||||
|
|
||||||
// Make sure a hold was started
|
// Make sure a hold was started
|
||||||
if (HoldStartTime == null)
|
if (HoldStartTime == null)
|
||||||
return false;
|
return;
|
||||||
|
|
||||||
Tail.UpdateResult();
|
Tail.UpdateResult();
|
||||||
endHold();
|
endHold();
|
||||||
@ -189,8 +189,6 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
// If the key has been released too early, the user should not receive full score for the release
|
// If the key has been released too early, the user should not receive full score for the release
|
||||||
if (!Tail.IsHit)
|
if (!Tail.IsHit)
|
||||||
HasBroken = true;
|
HasBroken = true;
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void endHold()
|
private void endHold()
|
||||||
|
@ -17,6 +17,8 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
|
|
||||||
public override bool OnPressed(ManiaAction action) => false; // Handled by the hold note
|
public override bool OnPressed(ManiaAction action) => false; // Handled by the hold note
|
||||||
|
|
||||||
public override bool OnReleased(ManiaAction action) => false; // Handled by the hold note
|
public override void OnReleased(ManiaAction action)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,8 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
|
|
||||||
public override bool OnPressed(ManiaAction action) => false; // Handled by the hold note
|
public override bool OnPressed(ManiaAction action) => false; // Handled by the hold note
|
||||||
|
|
||||||
public override bool OnReleased(ManiaAction action) => false; // Handled by the hold note
|
public override void OnReleased(ManiaAction action)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,6 +77,8 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
return UpdateResult(true);
|
return UpdateResult(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool OnReleased(ManiaAction action) => false;
|
public virtual void OnReleased(ManiaAction action)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,9 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnReleased(ManiaAction action) => false;
|
public void OnReleased(ManiaAction action)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos)
|
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos)
|
||||||
// This probably shouldn't exist as is, but the columns in the stage are separated by a 1px border
|
// This probably shouldn't exist as is, but the columns in the stage are separated by a 1px border
|
||||||
|
@ -98,11 +98,10 @@ namespace osu.Game.Rulesets.Mania.UI.Components
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnReleased(ManiaAction action)
|
public void OnReleased(ManiaAction action)
|
||||||
{
|
{
|
||||||
if (action == this.action.Value)
|
if (action == this.action.Value)
|
||||||
backgroundOverlay.FadeTo(0, 250, Easing.OutQuint);
|
backgroundOverlay.FadeTo(0, 250, Easing.OutQuint);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -115,11 +115,10 @@ namespace osu.Game.Rulesets.Mania.UI.Components
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnReleased(ManiaAction action)
|
public void OnReleased(ManiaAction action)
|
||||||
{
|
{
|
||||||
if (action == this.action.Value)
|
if (action == this.action.Value)
|
||||||
keyIcon.ScaleTo(1f, 125, Easing.OutQuint);
|
keyIcon.ScaleTo(1f, 125, Easing.OutQuint);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,13 +135,11 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseUp(MouseUpEvent e) => RequestSelection != null;
|
|
||||||
|
|
||||||
protected override bool OnClick(ClickEvent e) => RequestSelection != null;
|
protected override bool OnClick(ClickEvent e) => RequestSelection != null;
|
||||||
|
|
||||||
protected override bool OnDragStart(DragStartEvent e) => e.Button == MouseButton.Left;
|
protected override bool OnDragStart(DragStartEvent e) => e.Button == MouseButton.Left;
|
||||||
|
|
||||||
protected override bool OnDrag(DragEvent e)
|
protected override void OnDrag(DragEvent e)
|
||||||
{
|
{
|
||||||
if (ControlPoint == slider.Path.ControlPoints[0])
|
if (ControlPoint == slider.Path.ControlPoints[0])
|
||||||
{
|
{
|
||||||
@ -158,12 +156,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
ControlPoint.Position.Value += e.Delta;
|
ControlPoint.Position.Value += e.Delta;
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnDragEnd(DragEndEvent e) => true;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates the state of the circular control point marker.
|
/// Updates the state of the circular control point marker.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -108,7 +108,9 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnReleased(PlatformAction action) => action.ActionMethod == PlatformActionMethod.Delete;
|
public void OnReleased(PlatformAction action)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
private void selectPiece(PathControlPointPiece piece, MouseButtonEvent e)
|
private void selectPiece(PathControlPointPiece piece, MouseButtonEvent e)
|
||||||
{
|
{
|
||||||
|
@ -106,11 +106,11 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseUp(MouseUpEvent e)
|
protected override void OnMouseUp(MouseUpEvent e)
|
||||||
{
|
{
|
||||||
if (state == PlacementState.Body && e.Button == MouseButton.Right)
|
if (state == PlacementState.Body && e.Button == MouseButton.Right)
|
||||||
endCurve();
|
endCurve();
|
||||||
return base.OnMouseUp(e);
|
base.OnMouseUp(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnDoubleClick(DoubleClickEvent e)
|
protected override bool OnDoubleClick(DoubleClickEvent e)
|
||||||
|
@ -90,19 +90,16 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
|||||||
|
|
||||||
protected override bool OnDragStart(DragStartEvent e) => placementControlPointIndex != null;
|
protected override bool OnDragStart(DragStartEvent e) => placementControlPointIndex != null;
|
||||||
|
|
||||||
protected override bool OnDrag(DragEvent e)
|
protected override void OnDrag(DragEvent e)
|
||||||
{
|
{
|
||||||
Debug.Assert(placementControlPointIndex != null);
|
Debug.Assert(placementControlPointIndex != null);
|
||||||
|
|
||||||
HitObject.Path.ControlPoints[placementControlPointIndex.Value].Position.Value = e.MousePosition - HitObject.Position;
|
HitObject.Path.ControlPoints[placementControlPointIndex.Value].Position.Value = e.MousePosition - HitObject.Position;
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnDragEnd(DragEndEvent e)
|
protected override void OnDragEnd(DragEndEvent e)
|
||||||
{
|
{
|
||||||
placementControlPointIndex = null;
|
placementControlPointIndex = null;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private BindableList<PathControlPoint> controlPoints => HitObject.Path.ControlPoints;
|
private BindableList<PathControlPoint> controlPoints => HitObject.Path.ControlPoints;
|
||||||
|
41
osu.Game.Rulesets.Osu/Edit/OsuBlueprintContainer.cs
Normal file
41
osu.Game.Rulesets.Osu/Edit/OsuBlueprintContainer.cs
Normal 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 System.Collections.Generic;
|
||||||
|
using osu.Game.Rulesets.Edit;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles;
|
||||||
|
using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders;
|
||||||
|
using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
|
using osu.Game.Screens.Edit.Compose.Components;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Edit
|
||||||
|
{
|
||||||
|
public class OsuBlueprintContainer : ComposeBlueprintContainer
|
||||||
|
{
|
||||||
|
public OsuBlueprintContainer(IEnumerable<DrawableHitObject> drawableHitObjects)
|
||||||
|
: base(drawableHitObjects)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override SelectionHandler CreateSelectionHandler() => new OsuSelectionHandler();
|
||||||
|
|
||||||
|
public override SelectionBlueprint CreateBlueprintFor(DrawableHitObject hitObject)
|
||||||
|
{
|
||||||
|
switch (hitObject)
|
||||||
|
{
|
||||||
|
case DrawableHitCircle circle:
|
||||||
|
return new HitCircleSelectionBlueprint(circle);
|
||||||
|
|
||||||
|
case DrawableSlider slider:
|
||||||
|
return new SliderSelectionBlueprint(slider);
|
||||||
|
|
||||||
|
case DrawableSpinner spinner:
|
||||||
|
return new SpinnerSelectionBlueprint(spinner);
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.CreateBlueprintFor(hitObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -9,12 +9,7 @@ using osu.Game.Rulesets.Edit;
|
|||||||
using osu.Game.Rulesets.Edit.Tools;
|
using osu.Game.Rulesets.Edit.Tools;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
|
||||||
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles;
|
|
||||||
using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders;
|
|
||||||
using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners;
|
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Screens.Edit.Compose.Components;
|
using osu.Game.Screens.Edit.Compose.Components;
|
||||||
|
|
||||||
@ -37,24 +32,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
new SpinnerCompositionTool()
|
new SpinnerCompositionTool()
|
||||||
};
|
};
|
||||||
|
|
||||||
public override SelectionHandler CreateSelectionHandler() => new OsuSelectionHandler();
|
protected override ComposeBlueprintContainer CreateBlueprintContainer() => new OsuBlueprintContainer(HitObjects);
|
||||||
|
|
||||||
public override SelectionBlueprint CreateBlueprintFor(DrawableHitObject hitObject)
|
|
||||||
{
|
|
||||||
switch (hitObject)
|
|
||||||
{
|
|
||||||
case DrawableHitCircle circle:
|
|
||||||
return new HitCircleSelectionBlueprint(circle);
|
|
||||||
|
|
||||||
case DrawableSlider slider:
|
|
||||||
return new SliderSelectionBlueprint(slider);
|
|
||||||
|
|
||||||
case DrawableSpinner spinner:
|
|
||||||
return new SpinnerSelectionBlueprint(spinner);
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.CreateBlueprintFor(hitObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override DistanceSnapGrid CreateDistanceSnapGrid(IEnumerable<HitObject> selectedHitObjects)
|
protected override DistanceSnapGrid CreateDistanceSnapGrid(IEnumerable<HitObject> selectedHitObjects)
|
||||||
{
|
{
|
||||||
|
@ -205,7 +205,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnReleased(OsuAction action) => false;
|
public void OnReleased(OsuAction action)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnReleased(OsuAction action)
|
public void OnReleased(OsuAction action)
|
||||||
{
|
{
|
||||||
switch (action)
|
switch (action)
|
||||||
{
|
{
|
||||||
@ -120,8 +120,6 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
|||||||
updateExpandedState();
|
updateExpandedState();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool HandlePositionalInput => true; // OverlayContainer will set this false when we go hidden, but we always want to receive input.
|
public override bool HandlePositionalInput => true; // OverlayContainer will set this false when we go hidden, but we always want to receive input.
|
||||||
|
@ -107,7 +107,9 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnReleased(OsuAction action) => false;
|
public void OnReleased(OsuAction action)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public void Appear() => Schedule(() =>
|
public void Appear() => Schedule(() =>
|
||||||
{
|
{
|
||||||
|
@ -77,11 +77,12 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool OnReleased(TaikoAction action)
|
public override void OnReleased(TaikoAction action)
|
||||||
{
|
{
|
||||||
if (action == HitAction)
|
if (action == HitAction)
|
||||||
HitAction = null;
|
HitAction = null;
|
||||||
return base.OnReleased(action);
|
|
||||||
|
base.OnReleased(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
|
@ -77,7 +77,10 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
public Drawable CreateProxiedContent() => proxiedContent.CreateProxy();
|
public Drawable CreateProxiedContent() => proxiedContent.CreateProxy();
|
||||||
|
|
||||||
public abstract bool OnPressed(TaikoAction action);
|
public abstract bool OnPressed(TaikoAction action);
|
||||||
public virtual bool OnReleased(TaikoAction action) => false;
|
|
||||||
|
public virtual void OnReleased(TaikoAction action)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public override double LifetimeStart
|
public override double LifetimeStart
|
||||||
{
|
{
|
||||||
|
@ -187,7 +187,9 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnReleased(TaikoAction action) => false;
|
public void OnReleased(TaikoAction action)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ using NUnit.Framework;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Rulesets.Osu.Beatmaps;
|
using osu.Game.Rulesets.Osu.Beatmaps;
|
||||||
using osu.Game.Rulesets.Osu.Edit;
|
using osu.Game.Rulesets.Osu.Edit;
|
||||||
@ -19,7 +20,13 @@ namespace osu.Game.Tests.Editor
|
|||||||
private TestHitObjectComposer composer;
|
private TestHitObjectComposer composer;
|
||||||
|
|
||||||
[Cached(typeof(EditorBeatmap))]
|
[Cached(typeof(EditorBeatmap))]
|
||||||
private readonly EditorBeatmap editorBeatmap = new EditorBeatmap(new OsuBeatmap());
|
[Cached(typeof(IBeatSnapProvider))]
|
||||||
|
private readonly EditorBeatmap editorBeatmap;
|
||||||
|
|
||||||
|
public TestSceneHitObjectComposerDistanceSnapping()
|
||||||
|
{
|
||||||
|
editorBeatmap = new EditorBeatmap(new OsuBeatmap(), BeatDivisor);
|
||||||
|
}
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup() => Schedule(() =>
|
public void Setup() => Schedule(() =>
|
||||||
|
82
osu.Game.Tests/Online/TestAPIModSerialization.cs
Normal file
82
osu.Game.Tests/Online/TestAPIModSerialization.cs
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
// 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.Collections.Generic;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Online.API;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Rulesets.Difficulty;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Rulesets.UI;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Online
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class TestAPIModSerialization
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void TestAcronymIsPreserved()
|
||||||
|
{
|
||||||
|
var apiMod = new APIMod(new TestMod());
|
||||||
|
|
||||||
|
var deserialized = JsonConvert.DeserializeObject<APIMod>(JsonConvert.SerializeObject(apiMod));
|
||||||
|
|
||||||
|
Assert.That(deserialized.Acronym, Is.EqualTo(apiMod.Acronym));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestRawSettingIsPreserved()
|
||||||
|
{
|
||||||
|
var apiMod = new APIMod(new TestMod { TestSetting = { Value = 2 } });
|
||||||
|
|
||||||
|
var deserialized = JsonConvert.DeserializeObject<APIMod>(JsonConvert.SerializeObject(apiMod));
|
||||||
|
|
||||||
|
Assert.That(deserialized.Settings, Contains.Key("test_setting").With.ContainValue(2.0));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestConvertedModHasCorrectSetting()
|
||||||
|
{
|
||||||
|
var apiMod = new APIMod(new TestMod { TestSetting = { Value = 2 } });
|
||||||
|
|
||||||
|
var deserialized = JsonConvert.DeserializeObject<APIMod>(JsonConvert.SerializeObject(apiMod));
|
||||||
|
var converted = (TestMod)deserialized.ToMod(new TestRuleset());
|
||||||
|
|
||||||
|
Assert.That(converted.TestSetting.Value, Is.EqualTo(2));
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestRuleset : Ruleset
|
||||||
|
{
|
||||||
|
public override IEnumerable<Mod> GetModsFor(ModType type) => new[] { new TestMod() };
|
||||||
|
|
||||||
|
public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList<Mod> mods = null) => throw new System.NotImplementedException();
|
||||||
|
|
||||||
|
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => throw new System.NotImplementedException();
|
||||||
|
|
||||||
|
public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => throw new System.NotImplementedException();
|
||||||
|
|
||||||
|
public override string Description { get; } = string.Empty;
|
||||||
|
public override string ShortName { get; } = string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestMod : Mod
|
||||||
|
{
|
||||||
|
public override string Name => "Test Mod";
|
||||||
|
public override string Acronym => "TM";
|
||||||
|
public override double ScoreMultiplier => 1;
|
||||||
|
|
||||||
|
[SettingSource("Test")]
|
||||||
|
public BindableNumber<double> TestSetting { get; } = new BindableDouble
|
||||||
|
{
|
||||||
|
MinValue = 0,
|
||||||
|
MaxValue = 10,
|
||||||
|
Default = 5,
|
||||||
|
Precision = 0.01,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Rulesets.Osu.Beatmaps;
|
using osu.Game.Rulesets.Osu.Beatmaps;
|
||||||
using osu.Game.Screens.Edit;
|
using osu.Game.Screens.Edit;
|
||||||
@ -14,6 +15,7 @@ namespace osu.Game.Tests.Visual.Editor
|
|||||||
public class TestSceneComposeScreen : EditorClockTestScene
|
public class TestSceneComposeScreen : EditorClockTestScene
|
||||||
{
|
{
|
||||||
[Cached(typeof(EditorBeatmap))]
|
[Cached(typeof(EditorBeatmap))]
|
||||||
|
[Cached(typeof(IBeatSnapProvider))]
|
||||||
private readonly EditorBeatmap editorBeatmap =
|
private readonly EditorBeatmap editorBeatmap =
|
||||||
new EditorBeatmap(new OsuBeatmap
|
new EditorBeatmap(new OsuBeatmap
|
||||||
{
|
{
|
||||||
|
@ -40,6 +40,8 @@ namespace osu.Game.Tests.Visual.Editor
|
|||||||
|
|
||||||
var editorBeatmap = new EditorBeatmap((Beatmap<HitObject>)Beatmap.Value.Beatmap);
|
var editorBeatmap = new EditorBeatmap((Beatmap<HitObject>)Beatmap.Value.Beatmap);
|
||||||
|
|
||||||
|
Dependencies.Cache(editorBeatmap);
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new FillFlowContainer
|
new FillFlowContainer
|
||||||
|
@ -66,6 +66,7 @@ namespace osu.Game.Tests.Visual.Editor
|
|||||||
Dependencies.CacheAs<IAdjustableClock>(clock);
|
Dependencies.CacheAs<IAdjustableClock>(clock);
|
||||||
Dependencies.CacheAs<IFrameBasedClock>(clock);
|
Dependencies.CacheAs<IFrameBasedClock>(clock);
|
||||||
Dependencies.CacheAs(editorBeatmap);
|
Dependencies.CacheAs(editorBeatmap);
|
||||||
|
Dependencies.CacheAs<IBeatSnapProvider>(editorBeatmap);
|
||||||
|
|
||||||
Child = new OsuHitObjectComposer(new OsuRuleset());
|
Child = new OsuHitObjectComposer(new OsuRuleset());
|
||||||
}
|
}
|
||||||
|
@ -19,18 +19,22 @@ using osu.Game.Screens.Play.HUD.HitErrorMeters;
|
|||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Gameplay
|
namespace osu.Game.Tests.Visual.Gameplay
|
||||||
{
|
{
|
||||||
public class TestSceneBarHitErrorMeter : OsuTestScene
|
public class TestSceneHitErrorMeter : OsuTestScene
|
||||||
{
|
{
|
||||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
{
|
{
|
||||||
typeof(HitErrorMeter),
|
typeof(HitErrorMeter),
|
||||||
|
typeof(BarHitErrorMeter),
|
||||||
|
typeof(ColourHitErrorMeter)
|
||||||
};
|
};
|
||||||
|
|
||||||
private HitErrorMeter meter;
|
private BarHitErrorMeter barMeter;
|
||||||
private HitErrorMeter meter2;
|
private BarHitErrorMeter barMeter2;
|
||||||
|
private ColourHitErrorMeter colourMeter;
|
||||||
|
private ColourHitErrorMeter colourMeter2;
|
||||||
private HitWindows hitWindows;
|
private HitWindows hitWindows;
|
||||||
|
|
||||||
public TestSceneBarHitErrorMeter()
|
public TestSceneHitErrorMeter()
|
||||||
{
|
{
|
||||||
recreateDisplay(new OsuHitWindows(), 5);
|
recreateDisplay(new OsuHitWindows(), 5);
|
||||||
|
|
||||||
@ -91,17 +95,31 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Add(meter = new BarHitErrorMeter(hitWindows, true)
|
Add(barMeter = new BarHitErrorMeter(hitWindows, true)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreRight,
|
Anchor = Anchor.CentreRight,
|
||||||
Origin = Anchor.CentreRight,
|
Origin = Anchor.CentreRight,
|
||||||
});
|
});
|
||||||
|
|
||||||
Add(meter2 = new BarHitErrorMeter(hitWindows, false)
|
Add(barMeter2 = new BarHitErrorMeter(hitWindows, false)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Add(colourMeter = new ColourHitErrorMeter(hitWindows)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreRight,
|
||||||
|
Origin = Anchor.CentreRight,
|
||||||
|
Margin = new MarginPadding { Right = 50 }
|
||||||
|
});
|
||||||
|
|
||||||
|
Add(colourMeter2 = new ColourHitErrorMeter(hitWindows)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
Margin = new MarginPadding { Left = 50 }
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void newJudgement(double offset = 0)
|
private void newJudgement(double offset = 0)
|
||||||
@ -112,8 +130,10 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
Type = HitResult.Perfect,
|
Type = HitResult.Perfect,
|
||||||
};
|
};
|
||||||
|
|
||||||
meter.OnNewJudgement(judgement);
|
barMeter.OnNewJudgement(judgement);
|
||||||
meter2.OnNewJudgement(judgement);
|
barMeter2.OnNewJudgement(judgement);
|
||||||
|
colourMeter.OnNewJudgement(judgement);
|
||||||
|
colourMeter2.OnNewJudgement(judgement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,12 +1,17 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Testing;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
|
|
||||||
@ -15,63 +20,125 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TestSceneSongProgress : OsuTestScene
|
public class TestSceneSongProgress : OsuTestScene
|
||||||
{
|
{
|
||||||
private readonly SongProgress progress;
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
private readonly TestSongProgressGraph graph;
|
{
|
||||||
|
typeof(SongProgressBar),
|
||||||
|
};
|
||||||
|
|
||||||
|
private SongProgress progress;
|
||||||
|
private TestSongProgressGraph graph;
|
||||||
|
private readonly Container progressContainer;
|
||||||
|
|
||||||
private readonly StopwatchClock clock;
|
private readonly StopwatchClock clock;
|
||||||
|
private readonly FramedClock framedClock;
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
private readonly GameplayClock gameplayClock;
|
private readonly GameplayClock gameplayClock;
|
||||||
|
|
||||||
private readonly FramedClock framedClock;
|
|
||||||
|
|
||||||
public TestSceneSongProgress()
|
public TestSceneSongProgress()
|
||||||
{
|
{
|
||||||
clock = new StopwatchClock(true);
|
clock = new StopwatchClock();
|
||||||
|
|
||||||
gameplayClock = new GameplayClock(framedClock = new FramedClock(clock));
|
gameplayClock = new GameplayClock(framedClock = new FramedClock(clock));
|
||||||
|
|
||||||
Add(progress = new SongProgress
|
Add(progressContainer = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomCentre,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomCentre,
|
||||||
|
Height = 100,
|
||||||
|
Y = -100,
|
||||||
|
Child = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = OsuColour.Gray(1),
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Add(graph = new TestSongProgressGraph
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
Height = 200,
|
|
||||||
Anchor = Anchor.TopLeft,
|
|
||||||
Origin = Anchor.TopLeft,
|
|
||||||
});
|
|
||||||
|
|
||||||
AddWaitStep("wait some", 5);
|
|
||||||
AddAssert("ensure not created", () => graph.CreationCount == 0);
|
|
||||||
|
|
||||||
AddStep("display values", displayNewValues);
|
|
||||||
AddWaitStep("wait some", 5);
|
|
||||||
AddUntilStep("wait for creation count", () => graph.CreationCount == 1);
|
|
||||||
|
|
||||||
AddStep("Toggle Bar", () => progress.AllowSeeking = !progress.AllowSeeking);
|
|
||||||
AddWaitStep("wait some", 5);
|
|
||||||
AddUntilStep("wait for creation count", () => graph.CreationCount == 1);
|
|
||||||
|
|
||||||
AddStep("Toggle Bar", () => progress.AllowSeeking = !progress.AllowSeeking);
|
|
||||||
AddWaitStep("wait some", 5);
|
|
||||||
AddUntilStep("wait for creation count", () => graph.CreationCount == 1);
|
|
||||||
AddRepeatStep("New Values", displayNewValues, 5);
|
|
||||||
|
|
||||||
AddWaitStep("wait some", 5);
|
|
||||||
AddAssert("ensure debounced", () => graph.CreationCount == 2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayNewValues()
|
[SetUpSteps]
|
||||||
|
public void SetupSteps()
|
||||||
{
|
{
|
||||||
List<HitObject> objects = new List<HitObject>();
|
AddStep("add new song progress", () =>
|
||||||
|
{
|
||||||
|
if (progress != null)
|
||||||
|
{
|
||||||
|
progress.Expire();
|
||||||
|
progress = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
progressContainer.Add(progress = new SongProgress
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Anchor = Anchor.BottomLeft,
|
||||||
|
Origin = Anchor.BottomLeft,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("add new big graph", () =>
|
||||||
|
{
|
||||||
|
if (graph != null)
|
||||||
|
{
|
||||||
|
graph.Expire();
|
||||||
|
graph = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Add(graph = new TestSongProgressGraph
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Height = 200,
|
||||||
|
Anchor = Anchor.TopLeft,
|
||||||
|
Origin = Anchor.TopLeft,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("reset clock", clock.Reset);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestGraphRecreation()
|
||||||
|
{
|
||||||
|
AddAssert("ensure not created", () => graph.CreationCount == 0);
|
||||||
|
AddStep("display values", displayRandomValues);
|
||||||
|
AddUntilStep("wait for creation count", () => graph.CreationCount == 1);
|
||||||
|
AddRepeatStep("new values", displayRandomValues, 5);
|
||||||
|
AddWaitStep("wait some", 5);
|
||||||
|
AddAssert("ensure recreation debounced", () => graph.CreationCount == 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestDisplay()
|
||||||
|
{
|
||||||
|
AddStep("display max values", displayMaxValues);
|
||||||
|
AddUntilStep("wait for graph", () => graph.CreationCount == 1);
|
||||||
|
AddStep("start", clock.Start);
|
||||||
|
AddStep("allow seeking", () => progress.AllowSeeking.Value = true);
|
||||||
|
AddStep("hide graph", () => progress.ShowGraph.Value = false);
|
||||||
|
AddStep("disallow seeking", () => progress.AllowSeeking.Value = false);
|
||||||
|
AddStep("allow seeking", () => progress.AllowSeeking.Value = true);
|
||||||
|
AddStep("show graph", () => progress.ShowGraph.Value = true);
|
||||||
|
AddStep("stop", clock.Stop);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void displayRandomValues()
|
||||||
|
{
|
||||||
|
var objects = new List<HitObject>();
|
||||||
for (double i = 0; i < 5000; i += RNG.NextDouble() * 10 + i / 1000)
|
for (double i = 0; i < 5000; i += RNG.NextDouble() * 10 + i / 1000)
|
||||||
objects.Add(new HitObject { StartTime = i });
|
objects.Add(new HitObject { StartTime = i });
|
||||||
|
|
||||||
|
replaceObjects(objects);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void displayMaxValues()
|
||||||
|
{
|
||||||
|
var objects = new List<HitObject>();
|
||||||
|
for (double i = 0; i < 5000; i++)
|
||||||
|
objects.Add(new HitObject { StartTime = i });
|
||||||
|
|
||||||
|
replaceObjects(objects);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void replaceObjects(List<HitObject> objects)
|
||||||
|
{
|
||||||
progress.Objects = objects;
|
progress.Objects = objects;
|
||||||
graph.Objects = objects;
|
graph.Objects = objects;
|
||||||
|
|
||||||
|
@ -30,29 +30,23 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
|
|
||||||
public TestSceneCommentsContainer()
|
public TestSceneCommentsContainer()
|
||||||
{
|
{
|
||||||
BasicScrollContainer scrollFlow;
|
BasicScrollContainer scroll;
|
||||||
|
CommentsContainer comments;
|
||||||
|
|
||||||
Add(scrollFlow = new BasicScrollContainer
|
Add(scroll = new BasicScrollContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Child = comments = new CommentsContainer()
|
||||||
});
|
});
|
||||||
|
|
||||||
AddStep("Big Black comments", () =>
|
AddStep("Big Black comments", () => comments.ShowComments(CommentableType.Beatmapset, 41823));
|
||||||
|
AddStep("Airman comments", () => comments.ShowComments(CommentableType.Beatmapset, 24313));
|
||||||
|
AddStep("Lazer build comments", () => comments.ShowComments(CommentableType.Build, 4772));
|
||||||
|
AddStep("News comments", () => comments.ShowComments(CommentableType.NewsPost, 715));
|
||||||
|
AddStep("Idle state", () =>
|
||||||
{
|
{
|
||||||
scrollFlow.Clear();
|
scroll.Clear();
|
||||||
scrollFlow.Add(new CommentsContainer(CommentableType.Beatmapset, 41823));
|
scroll.Add(comments = new CommentsContainer());
|
||||||
});
|
|
||||||
|
|
||||||
AddStep("Airman comments", () =>
|
|
||||||
{
|
|
||||||
scrollFlow.Clear();
|
|
||||||
scrollFlow.Add(new CommentsContainer(CommentableType.Beatmapset, 24313));
|
|
||||||
});
|
|
||||||
|
|
||||||
AddStep("lazer build comments", () =>
|
|
||||||
{
|
|
||||||
scrollFlow.Clear();
|
|
||||||
scrollFlow.Add(new CommentsContainer(CommentableType.Build, 4772));
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,8 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
|
|
||||||
private readonly Mod testCustomisableMod = new TestModCustomisable1();
|
private readonly Mod testCustomisableMod = new TestModCustomisable1();
|
||||||
|
|
||||||
|
private readonly Mod testCustomisableAutoOpenMod = new TestModCustomisable2();
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestButtonShowsOnCustomisableMod()
|
public void TestButtonShowsOnCustomisableMod()
|
||||||
{
|
{
|
||||||
@ -53,6 +55,17 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
AddAssert("button enabled", () => modSelect.CustomiseButton.Enabled.Value);
|
AddAssert("button enabled", () => modSelect.CustomiseButton.Enabled.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestCustomisationOpensOnModSelect()
|
||||||
|
{
|
||||||
|
createModSelect();
|
||||||
|
|
||||||
|
AddStep("open", () => modSelect.Show());
|
||||||
|
AddAssert("Customisation closed", () => modSelect.ModSettingsContainer.Alpha == 0);
|
||||||
|
AddStep("select mod", () => modSelect.SelectMod(testCustomisableAutoOpenMod));
|
||||||
|
AddAssert("Customisation opened", () => modSelect.ModSettingsContainer.Alpha == 1);
|
||||||
|
}
|
||||||
|
|
||||||
private void createModSelect()
|
private void createModSelect()
|
||||||
{
|
{
|
||||||
AddStep("create mod select", () =>
|
AddStep("create mod select", () =>
|
||||||
@ -128,6 +141,8 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
public override string Name => "Customisable Mod 2";
|
public override string Name => "Customisable Mod 2";
|
||||||
|
|
||||||
public override string Acronym => "CM2";
|
public override string Acronym => "CM2";
|
||||||
|
|
||||||
|
public override bool RequiresConfiguration => true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private abstract class TestModCustomisable : Mod, IApplicableMod
|
private abstract class TestModCustomisable : Mod, IApplicableMod
|
||||||
|
@ -541,7 +541,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"FlagName": "MK",
|
"FlagName": "MK",
|
||||||
"FullName": "Macedonia",
|
"FullName": "North Macedonia",
|
||||||
"Acronym": "MKD"
|
"Acronym": "MKD"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -811,7 +811,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"FlagName": "CV",
|
"FlagName": "CV",
|
||||||
"FullName": "Cape Verde",
|
"FullName": "Cabo Verde",
|
||||||
"Acronym": "CPV"
|
"Acronym": "CPV"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -821,7 +821,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"FlagName": "SZ",
|
"FlagName": "SZ",
|
||||||
"FullName": "Swaziland",
|
"FullName": "Eswatini",
|
||||||
"Acronym": "SWZ"
|
"Acronym": "SWZ"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -289,16 +289,15 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnDrag(DragEvent e)
|
protected override void OnDrag(DragEvent e)
|
||||||
{
|
{
|
||||||
if (base.OnDrag(e)) return true;
|
base.OnDrag(e);
|
||||||
|
|
||||||
Selected = true;
|
Selected = true;
|
||||||
this.MoveToOffset(e.Delta);
|
this.MoveToOffset(e.Delta);
|
||||||
|
|
||||||
var pos = Position;
|
var pos = Position;
|
||||||
Match.Position.Value = new Point((int)pos.X, (int)pos.Y);
|
Match.Position.Value = new Point((int)pos.X, (int)pos.Y);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Remove()
|
public void Remove()
|
||||||
|
@ -10,8 +10,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
|||||||
{
|
{
|
||||||
public class ProgressionPath : Path
|
public class ProgressionPath : Path
|
||||||
{
|
{
|
||||||
public DrawableTournamentMatch Source { get; private set; }
|
public DrawableTournamentMatch Source { get; }
|
||||||
public DrawableTournamentMatch Destination { get; private set; }
|
public DrawableTournamentMatch Destination { get; }
|
||||||
|
|
||||||
public ProgressionPath(DrawableTournamentMatch source, DrawableTournamentMatch destination)
|
public ProgressionPath(DrawableTournamentMatch source, DrawableTournamentMatch destination)
|
||||||
{
|
{
|
||||||
|
@ -22,10 +22,9 @@ namespace osu.Game.Tournament.Screens.Ladder
|
|||||||
|
|
||||||
protected override bool ComputeIsMaskedAway(RectangleF maskingBounds) => false;
|
protected override bool ComputeIsMaskedAway(RectangleF maskingBounds) => false;
|
||||||
|
|
||||||
protected override bool OnDrag(DragEvent e)
|
protected override void OnDrag(DragEvent e)
|
||||||
{
|
{
|
||||||
this.MoveTo(target += e.Delta, 1000, Easing.OutQuint);
|
this.MoveTo(target += e.Delta, 1000, Easing.OutQuint);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private const float min_scale = 0.6f;
|
private const float min_scale = 0.6f;
|
||||||
|
@ -303,7 +303,7 @@ namespace osu.Game.Tournament
|
|||||||
|
|
||||||
private class TournamentInputManager : UserInputManager
|
private class TournamentInputManager : UserInputManager
|
||||||
{
|
{
|
||||||
protected override MouseButtonEventManager CreateButtonManagerFor(MouseButton button)
|
protected override MouseButtonEventManager CreateButtonEventManagerFor(MouseButton button)
|
||||||
{
|
{
|
||||||
switch (button)
|
switch (button)
|
||||||
{
|
{
|
||||||
@ -311,7 +311,7 @@ namespace osu.Game.Tournament
|
|||||||
return new RightMouseManager(button);
|
return new RightMouseManager(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.CreateButtonManagerFor(button);
|
return base.CreateButtonEventManagerFor(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class RightMouseManager : MouseButtonEventManager
|
private class RightMouseManager : MouseButtonEventManager
|
||||||
|
@ -19,6 +19,6 @@ namespace osu.Game.Audio
|
|||||||
|
|
||||||
public IEnumerable<string> LookupNames => new[] { sampleName };
|
public IEnumerable<string> LookupNames => new[] { sampleName };
|
||||||
|
|
||||||
public int Volume { get; set; } = 100;
|
public int Volume { get; } = 100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,6 +85,7 @@ namespace osu.Game.Configuration
|
|||||||
Set(OsuSetting.HitLighting, true);
|
Set(OsuSetting.HitLighting, true);
|
||||||
|
|
||||||
Set(OsuSetting.ShowInterface, true);
|
Set(OsuSetting.ShowInterface, true);
|
||||||
|
Set(OsuSetting.ShowProgressGraph, true);
|
||||||
Set(OsuSetting.ShowHealthDisplayWhenCantFail, true);
|
Set(OsuSetting.ShowHealthDisplayWhenCantFail, true);
|
||||||
Set(OsuSetting.KeyOverlay, false);
|
Set(OsuSetting.KeyOverlay, false);
|
||||||
Set(OsuSetting.ScoreMeter, ScoreMeterType.HitErrorBoth);
|
Set(OsuSetting.ScoreMeter, ScoreMeterType.HitErrorBoth);
|
||||||
@ -150,6 +151,7 @@ namespace osu.Game.Configuration
|
|||||||
ScoreMeter,
|
ScoreMeter,
|
||||||
FloatingComments,
|
FloatingComments,
|
||||||
ShowInterface,
|
ShowInterface,
|
||||||
|
ShowProgressGraph,
|
||||||
ShowHealthDisplayWhenCantFail,
|
ShowHealthDisplayWhenCantFail,
|
||||||
MouseDisableButtons,
|
MouseDisableButtons,
|
||||||
MouseDisableWheel,
|
MouseDisableWheel,
|
||||||
|
@ -18,5 +18,14 @@ namespace osu.Game.Configuration
|
|||||||
|
|
||||||
[Description("Hit Error (both)")]
|
[Description("Hit Error (both)")]
|
||||||
HitErrorBoth,
|
HitErrorBoth,
|
||||||
|
|
||||||
|
[Description("Colour (left)")]
|
||||||
|
ColourLeft,
|
||||||
|
|
||||||
|
[Description("Colour (right)")]
|
||||||
|
ColourRight,
|
||||||
|
|
||||||
|
[Description("Colour (both)")]
|
||||||
|
ColourBoth,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,16 +35,11 @@ namespace osu.Game.Configuration
|
|||||||
{
|
{
|
||||||
public static IEnumerable<Drawable> CreateSettingsControls(this object obj)
|
public static IEnumerable<Drawable> CreateSettingsControls(this object obj)
|
||||||
{
|
{
|
||||||
foreach (var property in obj.GetType().GetProperties(BindingFlags.GetProperty | BindingFlags.Public | BindingFlags.Instance))
|
foreach (var (attr, property) in obj.GetSettingsSourceProperties())
|
||||||
{
|
{
|
||||||
var attr = property.GetCustomAttribute<SettingSourceAttribute>(true);
|
object value = property.GetValue(obj);
|
||||||
|
|
||||||
if (attr == null)
|
switch (value)
|
||||||
continue;
|
|
||||||
|
|
||||||
var prop = property.GetValue(obj);
|
|
||||||
|
|
||||||
switch (prop)
|
|
||||||
{
|
{
|
||||||
case BindableNumber<float> bNumber:
|
case BindableNumber<float> bNumber:
|
||||||
yield return new SettingsSlider<float>
|
yield return new SettingsSlider<float>
|
||||||
@ -102,9 +97,22 @@ namespace osu.Game.Configuration
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new InvalidOperationException($"{nameof(SettingSourceAttribute)} was attached to an unsupported type ({prop})");
|
throw new InvalidOperationException($"{nameof(SettingSourceAttribute)} was attached to an unsupported type ({value})");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IEnumerable<(SettingSourceAttribute, PropertyInfo)> GetSettingsSourceProperties(this object obj)
|
||||||
|
{
|
||||||
|
foreach (var property in obj.GetType().GetProperties(BindingFlags.GetProperty | BindingFlags.Public | BindingFlags.Instance))
|
||||||
|
{
|
||||||
|
var attr = property.GetCustomAttribute<SettingSourceAttribute>(true);
|
||||||
|
|
||||||
|
if (attr == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
yield return (attr, property);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,12 +76,12 @@ namespace osu.Game.Graphics.Containers
|
|||||||
return base.OnMouseDown(e);
|
return base.OnMouseDown(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseUp(MouseUpEvent e)
|
protected override void OnMouseUp(MouseUpEvent e)
|
||||||
{
|
{
|
||||||
if (closeOnMouseUp && !base.ReceivePositionalInputAt(e.ScreenSpaceMousePosition))
|
if (closeOnMouseUp && !base.ReceivePositionalInputAt(e.ScreenSpaceMousePosition))
|
||||||
Hide();
|
Hide();
|
||||||
|
|
||||||
return base.OnMouseUp(e);
|
base.OnMouseUp(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool OnPressed(GlobalAction action)
|
public virtual bool OnPressed(GlobalAction action)
|
||||||
@ -99,7 +99,9 @@ namespace osu.Game.Graphics.Containers
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnReleased(GlobalAction action) => false;
|
public void OnReleased(GlobalAction action)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
protected override void UpdateState(ValueChangedEvent<Visibility> state)
|
protected override void UpdateState(ValueChangedEvent<Visibility> state)
|
||||||
{
|
{
|
||||||
|
@ -50,15 +50,15 @@ namespace osu.Game.Graphics.Containers
|
|||||||
return base.OnMouseDown(e);
|
return base.OnMouseDown(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnDrag(DragEvent e)
|
protected override void OnDrag(DragEvent e)
|
||||||
{
|
{
|
||||||
if (rightMouseDragging)
|
if (rightMouseDragging)
|
||||||
{
|
{
|
||||||
scrollFromMouseEvent(e);
|
scrollFromMouseEvent(e);
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.OnDrag(e);
|
base.OnDrag(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnDragStart(DragStartEvent e)
|
protected override bool OnDragStart(DragStartEvent e)
|
||||||
@ -72,15 +72,15 @@ namespace osu.Game.Graphics.Containers
|
|||||||
return base.OnDragStart(e);
|
return base.OnDragStart(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnDragEnd(DragEndEvent e)
|
protected override void OnDragEnd(DragEndEvent e)
|
||||||
{
|
{
|
||||||
if (rightMouseDragging)
|
if (rightMouseDragging)
|
||||||
{
|
{
|
||||||
rightMouseDragging = false;
|
rightMouseDragging = false;
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.OnDragEnd(e);
|
base.OnDragEnd(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnScroll(ScrollEvent e)
|
protected override bool OnScroll(ScrollEvent e)
|
||||||
@ -162,13 +162,13 @@ namespace osu.Game.Graphics.Containers
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseUp(MouseUpEvent e)
|
protected override void OnMouseUp(MouseUpEvent e)
|
||||||
{
|
{
|
||||||
if (e.Button != MouseButton.Left) return false;
|
if (e.Button != MouseButton.Left) return;
|
||||||
|
|
||||||
box.FadeColour(Color4.White, 100);
|
box.FadeColour(Color4.White, 100);
|
||||||
|
|
||||||
return base.OnMouseUp(e);
|
base.OnMouseUp(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
return base.OnMouseDown(e);
|
return base.OnMouseDown(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseUp(MouseUpEvent e)
|
protected override void OnMouseUp(MouseUpEvent e)
|
||||||
{
|
{
|
||||||
if (!e.IsPressed(MouseButton.Left) && !e.IsPressed(MouseButton.Right))
|
if (!e.IsPressed(MouseButton.Left) && !e.IsPressed(MouseButton.Right))
|
||||||
{
|
{
|
||||||
@ -107,7 +107,7 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
dragRotationState = DragRotationState.NotDragging;
|
dragRotationState = DragRotationState.NotDragging;
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.OnMouseUp(e);
|
base.OnMouseUp(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void PopIn()
|
protected override void PopIn()
|
||||||
|
@ -67,7 +67,9 @@ namespace osu.Game.Graphics
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnReleased(GlobalAction action) => false;
|
public void OnReleased(GlobalAction action)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
private volatile int screenShotTasks;
|
private volatile int screenShotTasks;
|
||||||
|
|
||||||
|
@ -67,7 +67,9 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnReleased(GlobalAction action) => action == GlobalAction.Back;
|
public void OnReleased(GlobalAction action)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -232,11 +232,11 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
return base.OnMouseDown(e);
|
return base.OnMouseDown(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseUp(MouseUpEvent e)
|
protected override void OnMouseUp(MouseUpEvent e)
|
||||||
{
|
{
|
||||||
if (Selected.Value)
|
if (Selected.Value)
|
||||||
colourContainer.ResizeWidthTo(hover_width, click_duration, Easing.In);
|
colourContainer.ResizeWidthTo(hover_width, click_duration, Easing.In);
|
||||||
return base.OnMouseUp(e);
|
base.OnMouseUp(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e)
|
||||||
|
@ -80,7 +80,9 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnReleased(GlobalAction action) => false;
|
public void OnReleased(GlobalAction action)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public override bool RequestsFocus => HoldFocus;
|
public override bool RequestsFocus => HoldFocus;
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Length of debounce for hover sound playback, in milliseconds. Default is 50ms.
|
/// Length of debounce for hover sound playback, in milliseconds. Default is 50ms.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double HoverDebounceTime { get; set; } = 50;
|
public double HoverDebounceTime { get; } = 50;
|
||||||
|
|
||||||
protected readonly HoverSampleSet SampleSet;
|
protected readonly HoverSampleSet SampleSet;
|
||||||
|
|
||||||
|
@ -107,10 +107,10 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
return base.OnMouseDown(e);
|
return base.OnMouseDown(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseUp(MouseUpEvent e)
|
protected override void OnMouseUp(MouseUpEvent e)
|
||||||
{
|
{
|
||||||
Content.ScaleTo(1, 1000, Easing.OutElastic);
|
Content.ScaleTo(1, 1000, Easing.OutElastic);
|
||||||
return base.OnMouseUp(e);
|
base.OnMouseUp(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,10 +129,10 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
return base.OnMouseDown(e);
|
return base.OnMouseDown(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseUp(MouseUpEvent e)
|
protected override void OnMouseUp(MouseUpEvent e)
|
||||||
{
|
{
|
||||||
Content.ScaleTo(1, 1000, Easing.OutElastic);
|
Content.ScaleTo(1, 1000, Easing.OutElastic);
|
||||||
return base.OnMouseUp(e);
|
base.OnMouseUp(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual SpriteText CreateText() => new OsuSpriteText
|
protected virtual SpriteText CreateText() => new OsuSpriteText
|
||||||
|
@ -128,10 +128,10 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
return base.OnMouseDown(e);
|
return base.OnMouseDown(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseUp(MouseUpEvent e)
|
protected override void OnMouseUp(MouseUpEvent e)
|
||||||
{
|
{
|
||||||
Nub.Current.Value = false;
|
Nub.Current.Value = false;
|
||||||
return base.OnMouseUp(e);
|
base.OnMouseUp(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnUserChange(T value)
|
protected override void OnUserChange(T value)
|
||||||
|
@ -16,11 +16,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// How many leading zeroes the counter has.
|
/// How many leading zeroes the counter has.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public uint LeadingZeroes
|
public uint LeadingZeroes { get; }
|
||||||
{
|
|
||||||
get;
|
|
||||||
protected set;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Displays score.
|
/// Displays score.
|
||||||
|
@ -50,7 +50,7 @@ namespace osu.Game.Input
|
|||||||
|
|
||||||
public bool OnPressed(PlatformAction action) => updateLastInteractionTime();
|
public bool OnPressed(PlatformAction action) => updateLastInteractionTime();
|
||||||
|
|
||||||
public bool OnReleased(PlatformAction action) => updateLastInteractionTime();
|
public void OnReleased(PlatformAction action) => updateLastInteractionTime();
|
||||||
|
|
||||||
protected override bool Handle(UIEvent e)
|
protected override bool Handle(UIEvent e)
|
||||||
{
|
{
|
||||||
|
57
osu.Game/Online/API/APIMod.cs
Normal file
57
osu.Game/Online/API/APIMod.cs
Normal 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 System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using Humanizer;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
|
|
||||||
|
namespace osu.Game.Online.API
|
||||||
|
{
|
||||||
|
public class APIMod : IMod
|
||||||
|
{
|
||||||
|
[JsonProperty("acronym")]
|
||||||
|
public string Acronym { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("settings")]
|
||||||
|
public Dictionary<string, object> Settings { get; set; } = new Dictionary<string, object>();
|
||||||
|
|
||||||
|
[JsonConstructor]
|
||||||
|
private APIMod()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public APIMod(Mod mod)
|
||||||
|
{
|
||||||
|
Acronym = mod.Acronym;
|
||||||
|
|
||||||
|
foreach (var (_, property) in mod.GetSettingsSourceProperties())
|
||||||
|
Settings.Add(property.Name.Underscore(), property.GetValue(mod));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Mod ToMod(Ruleset ruleset)
|
||||||
|
{
|
||||||
|
Mod resultMod = ruleset.GetAllMods().FirstOrDefault(m => m.Acronym == Acronym);
|
||||||
|
|
||||||
|
if (resultMod == null)
|
||||||
|
throw new InvalidOperationException($"There is no mod in the ruleset ({ruleset.ShortName}) matching the acronym {Acronym}.");
|
||||||
|
|
||||||
|
foreach (var (_, property) in resultMod.GetSettingsSourceProperties())
|
||||||
|
{
|
||||||
|
if (!Settings.TryGetValue(property.Name.Underscore(), out object settingValue))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
((IBindable)property.GetValue(resultMod)).Parse(settingValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
return resultMod;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Equals(IMod other) => Acronym == other?.Acronym;
|
||||||
|
}
|
||||||
|
}
|
@ -1,14 +0,0 @@
|
|||||||
// 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.Rulesets.Mods;
|
|
||||||
|
|
||||||
namespace osu.Game.Online.API.Requests.Responses
|
|
||||||
{
|
|
||||||
public class APIMod : IMod
|
|
||||||
{
|
|
||||||
public string Acronym { get; set; }
|
|
||||||
|
|
||||||
public bool Equals(IMod other) => Acronym == other?.Acronym;
|
|
||||||
}
|
|
||||||
}
|
|
@ -55,10 +55,10 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
return base.OnMouseDown(e);
|
return base.OnMouseDown(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseUp(MouseUpEvent e)
|
protected override void OnMouseUp(MouseUpEvent e)
|
||||||
{
|
{
|
||||||
icon.ScaleTo(1, 1000, Easing.OutElastic);
|
icon.ScaleTo(1, 1000, Easing.OutElastic);
|
||||||
return base.OnMouseUp(e);
|
base.OnMouseUp(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
@ -50,7 +51,7 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
[JsonProperty("allowed_mods")]
|
[JsonProperty("allowed_mods")]
|
||||||
private APIMod[] allowedMods
|
private APIMod[] allowedMods
|
||||||
{
|
{
|
||||||
get => AllowedMods.Select(m => new APIMod { Acronym = m.Acronym }).ToArray();
|
get => AllowedMods.Select(m => new APIMod(m)).ToArray();
|
||||||
set => allowedModsBacking = value;
|
set => allowedModsBacking = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +60,7 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
[JsonProperty("required_mods")]
|
[JsonProperty("required_mods")]
|
||||||
private APIMod[] requiredMods
|
private APIMod[] requiredMods
|
||||||
{
|
{
|
||||||
get => RequiredMods.Select(m => new APIMod { Acronym = m.Acronym }).ToArray();
|
get => RequiredMods.Select(m => new APIMod(m)).ToArray();
|
||||||
set => requiredModsBacking = value;
|
set => requiredModsBacking = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,10 +73,12 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
Beatmap = apiBeatmap == null ? beatmaps.QueryBeatmap(b => b.OnlineBeatmapID == BeatmapID) : apiBeatmap.ToBeatmap(rulesets);
|
Beatmap = apiBeatmap == null ? beatmaps.QueryBeatmap(b => b.OnlineBeatmapID == BeatmapID) : apiBeatmap.ToBeatmap(rulesets);
|
||||||
Ruleset = rulesets.GetRuleset(RulesetID);
|
Ruleset = rulesets.GetRuleset(RulesetID);
|
||||||
|
|
||||||
|
Ruleset rulesetInstance = Ruleset.CreateInstance();
|
||||||
|
|
||||||
if (allowedModsBacking != null)
|
if (allowedModsBacking != null)
|
||||||
{
|
{
|
||||||
AllowedMods.Clear();
|
AllowedMods.Clear();
|
||||||
AllowedMods.AddRange(Ruleset.CreateInstance().GetAllMods().Where(mod => allowedModsBacking.Any(m => m.Acronym == mod.Acronym)));
|
AllowedMods.AddRange(allowedModsBacking.Select(m => m.ToMod(rulesetInstance)));
|
||||||
|
|
||||||
allowedModsBacking = null;
|
allowedModsBacking = null;
|
||||||
}
|
}
|
||||||
@ -83,7 +86,7 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
if (requiredModsBacking != null)
|
if (requiredModsBacking != null)
|
||||||
{
|
{
|
||||||
RequiredMods.Clear();
|
RequiredMods.Clear();
|
||||||
RequiredMods.AddRange(Ruleset.CreateInstance().GetAllMods().Where(mod => requiredModsBacking.Any(m => m.Acronym == mod.Acronym)));
|
RequiredMods.AddRange(requiredModsBacking.Select(m => m.ToMod(rulesetInstance)));
|
||||||
|
|
||||||
requiredModsBacking = null;
|
requiredModsBacking = null;
|
||||||
}
|
}
|
||||||
|
@ -31,10 +31,10 @@ namespace osu.Game.Online.Placeholders
|
|||||||
return base.OnMouseDown(e);
|
return base.OnMouseDown(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseUp(MouseUpEvent e)
|
protected override void OnMouseUp(MouseUpEvent e)
|
||||||
{
|
{
|
||||||
this.ScaleTo(1, 1000, Easing.OutElastic);
|
this.ScaleTo(1, 1000, Easing.OutElastic);
|
||||||
return base.OnMouseUp(e);
|
base.OnMouseUp(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnClick(ClickEvent e)
|
protected override bool OnClick(ClickEvent e)
|
||||||
|
@ -881,7 +881,9 @@ namespace osu.Game
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public bool OnReleased(GlobalAction action) => false;
|
public void OnReleased(GlobalAction action)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
private Container overlayContent;
|
private Container overlayContent;
|
||||||
|
|
||||||
|
@ -330,7 +330,7 @@ namespace osu.Game
|
|||||||
|
|
||||||
private class OsuUserInputManager : UserInputManager
|
private class OsuUserInputManager : UserInputManager
|
||||||
{
|
{
|
||||||
protected override MouseButtonEventManager CreateButtonManagerFor(MouseButton button)
|
protected override MouseButtonEventManager CreateButtonEventManagerFor(MouseButton button)
|
||||||
{
|
{
|
||||||
switch (button)
|
switch (button)
|
||||||
{
|
{
|
||||||
@ -338,7 +338,7 @@ namespace osu.Game
|
|||||||
return new RightMouseManager(button);
|
return new RightMouseManager(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.CreateButtonManagerFor(button);
|
return base.CreateButtonEventManagerFor(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class RightMouseManager : MouseButtonEventManager
|
private class RightMouseManager : MouseButtonEventManager
|
||||||
|
@ -141,16 +141,13 @@ namespace osu.Game.Overlays.Chat.Tabs
|
|||||||
updateState();
|
updateState();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseUp(MouseUpEvent e)
|
protected override void OnMouseUp(MouseUpEvent e)
|
||||||
{
|
{
|
||||||
switch (e.Button)
|
switch (e.Button)
|
||||||
{
|
{
|
||||||
case MouseButton.Middle:
|
case MouseButton.Middle:
|
||||||
CloseButton.Click();
|
CloseButton.Click();
|
||||||
return true;
|
break;
|
||||||
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,10 +34,10 @@ namespace osu.Game.Overlays.Chat.Tabs
|
|||||||
return base.OnMouseDown(e);
|
return base.OnMouseDown(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseUp(MouseUpEvent e)
|
protected override void OnMouseUp(MouseUpEvent e)
|
||||||
{
|
{
|
||||||
icon.ScaleTo(0.75f, 1000, Easing.OutElastic);
|
icon.ScaleTo(0.75f, 1000, Easing.OutElastic);
|
||||||
return base.OnMouseUp(e);
|
base.OnMouseUp(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e)
|
||||||
|
@ -299,7 +299,7 @@ namespace osu.Game.Overlays
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnDrag(DragEvent e)
|
protected override void OnDrag(DragEvent e)
|
||||||
{
|
{
|
||||||
if (isDragging)
|
if (isDragging)
|
||||||
{
|
{
|
||||||
@ -311,14 +311,12 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
ChatHeight.Value = targetChatHeight;
|
ChatHeight.Value = targetChatHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnDragEnd(DragEndEvent e)
|
protected override void OnDragEnd(DragEndEvent e)
|
||||||
{
|
{
|
||||||
isDragging = false;
|
isDragging = false;
|
||||||
return base.OnDragEnd(e);
|
base.OnDragEnd(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void selectTab(int index)
|
private void selectTab(int index)
|
||||||
|
@ -18,8 +18,8 @@ namespace osu.Game.Overlays.Comments
|
|||||||
{
|
{
|
||||||
public class CommentsContainer : CompositeDrawable
|
public class CommentsContainer : CompositeDrawable
|
||||||
{
|
{
|
||||||
private readonly CommentableType type;
|
private CommentableType type;
|
||||||
private readonly long id;
|
private long? id;
|
||||||
|
|
||||||
public readonly Bindable<CommentsSortCriteria> Sort = new Bindable<CommentsSortCriteria>();
|
public readonly Bindable<CommentsSortCriteria> Sort = new Bindable<CommentsSortCriteria>();
|
||||||
public readonly BindableBool ShowDeleted = new BindableBool();
|
public readonly BindableBool ShowDeleted = new BindableBool();
|
||||||
@ -38,12 +38,10 @@ namespace osu.Game.Overlays.Comments
|
|||||||
private readonly FillFlowContainer content;
|
private readonly FillFlowContainer content;
|
||||||
private readonly DeletedChildrenPlaceholder deletedChildrenPlaceholder;
|
private readonly DeletedChildrenPlaceholder deletedChildrenPlaceholder;
|
||||||
private readonly CommentsShowMoreButton moreButton;
|
private readonly CommentsShowMoreButton moreButton;
|
||||||
|
private readonly TotalCommentsCounter commentCounter;
|
||||||
|
|
||||||
public CommentsContainer(CommentableType type, long id)
|
public CommentsContainer()
|
||||||
{
|
{
|
||||||
this.type = type;
|
|
||||||
this.id = id;
|
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
AddRangeInternal(new Drawable[]
|
AddRangeInternal(new Drawable[]
|
||||||
@ -59,6 +57,7 @@ namespace osu.Game.Overlays.Comments
|
|||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
commentCounter = new TotalCommentsCounter(),
|
||||||
new CommentsHeader
|
new CommentsHeader
|
||||||
{
|
{
|
||||||
Sort = { BindTarget = Sort },
|
Sort = { BindTarget = Sort },
|
||||||
@ -101,7 +100,8 @@ namespace osu.Game.Overlays.Comments
|
|||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Margin = new MarginPadding(5),
|
Margin = new MarginPadding(5),
|
||||||
Action = getComments
|
Action = getComments,
|
||||||
|
IsLoading = true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -121,11 +121,27 @@ namespace osu.Game.Overlays.Comments
|
|||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
Sort.BindValueChanged(onSortChanged, true);
|
Sort.BindValueChanged(_ => refetchComments(), true);
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onSortChanged(ValueChangedEvent<CommentsSortCriteria> sort)
|
/// <param name="type">The type of resource to get comments for.</param>
|
||||||
|
/// <param name="id">The id of the resource to get comments for.</param>
|
||||||
|
public void ShowComments(CommentableType type, long id)
|
||||||
|
{
|
||||||
|
this.type = type;
|
||||||
|
this.id = id;
|
||||||
|
|
||||||
|
if (!IsLoaded)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// only reset when changing ID/type. other refetch ops are generally just changing sort order.
|
||||||
|
commentCounter.Current.Value = 0;
|
||||||
|
|
||||||
|
refetchComments();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refetchComments()
|
||||||
{
|
{
|
||||||
clearComments();
|
clearComments();
|
||||||
getComments();
|
getComments();
|
||||||
@ -133,9 +149,12 @@ namespace osu.Game.Overlays.Comments
|
|||||||
|
|
||||||
private void getComments()
|
private void getComments()
|
||||||
{
|
{
|
||||||
|
if (!id.HasValue)
|
||||||
|
return;
|
||||||
|
|
||||||
request?.Cancel();
|
request?.Cancel();
|
||||||
loadCancellation?.Cancel();
|
loadCancellation?.Cancel();
|
||||||
request = new GetCommentsRequest(type, id, Sort.Value, currentPage++);
|
request = new GetCommentsRequest(type, id.Value, Sort.Value, currentPage++);
|
||||||
request.Success += onSuccess;
|
request.Success += onSuccess;
|
||||||
api.Queue(request);
|
api.Queue(request);
|
||||||
}
|
}
|
||||||
@ -152,7 +171,7 @@ namespace osu.Game.Overlays.Comments
|
|||||||
{
|
{
|
||||||
loadCancellation = new CancellationTokenSource();
|
loadCancellation = new CancellationTokenSource();
|
||||||
|
|
||||||
FillFlowContainer page = new FillFlowContainer
|
var page = new FillFlowContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
@ -185,6 +204,8 @@ namespace osu.Game.Overlays.Comments
|
|||||||
moreButton.IsLoading = false;
|
moreButton.IsLoading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
commentCounter.Current.Value = response.Total;
|
||||||
|
|
||||||
moreButton.FadeTo(response.HasMore ? 1 : 0);
|
moreButton.FadeTo(response.HasMore ? 1 : 0);
|
||||||
}, loadCancellation.Token);
|
}, loadCancellation.Token);
|
||||||
}
|
}
|
||||||
|
@ -177,17 +177,19 @@ namespace osu.Game.Overlays.KeyBinding
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseUp(MouseUpEvent e)
|
protected override void OnMouseUp(MouseUpEvent e)
|
||||||
{
|
{
|
||||||
// don't do anything until the last button is released.
|
// don't do anything until the last button is released.
|
||||||
if (!HasFocus || e.HasAnyButtonPressed)
|
if (!HasFocus || e.HasAnyButtonPressed)
|
||||||
return base.OnMouseUp(e);
|
{
|
||||||
|
base.OnMouseUp(e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (bindTarget.IsHovered)
|
if (bindTarget.IsHovered)
|
||||||
finalise();
|
finalise();
|
||||||
else
|
else
|
||||||
updateBindTarget();
|
updateBindTarget();
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnScroll(ScrollEvent e)
|
protected override bool OnScroll(ScrollEvent e)
|
||||||
@ -216,12 +218,15 @@ namespace osu.Game.Overlays.KeyBinding
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnKeyUp(KeyUpEvent e)
|
protected override void OnKeyUp(KeyUpEvent e)
|
||||||
{
|
{
|
||||||
if (!HasFocus) return base.OnKeyUp(e);
|
if (!HasFocus)
|
||||||
|
{
|
||||||
|
base.OnKeyUp(e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
finalise();
|
finalise();
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnJoystickPress(JoystickPressEvent e)
|
protected override bool OnJoystickPress(JoystickPressEvent e)
|
||||||
@ -235,13 +240,15 @@ namespace osu.Game.Overlays.KeyBinding
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnJoystickRelease(JoystickReleaseEvent e)
|
protected override void OnJoystickRelease(JoystickReleaseEvent e)
|
||||||
{
|
{
|
||||||
if (!HasFocus)
|
if (!HasFocus)
|
||||||
return base.OnJoystickRelease(e);
|
{
|
||||||
|
base.OnJoystickRelease(e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
finalise();
|
finalise();
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clear()
|
private void clear()
|
||||||
@ -313,14 +320,6 @@ namespace osu.Game.Overlays.KeyBinding
|
|||||||
Size = new Vector2(80, 20);
|
Size = new Vector2(80, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseUp(MouseUpEvent e)
|
|
||||||
{
|
|
||||||
base.OnMouseUp(e);
|
|
||||||
|
|
||||||
// without this, the mouse up triggers a finalise (and deselection) of the current binding target.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
|
@ -158,7 +158,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
return base.OnMouseDown(e);
|
return base.OnMouseDown(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseUp(MouseUpEvent e)
|
protected override void OnMouseUp(MouseUpEvent e)
|
||||||
{
|
{
|
||||||
scaleContainer.ScaleTo(1, 500, Easing.OutElastic);
|
scaleContainer.ScaleTo(1, 500, Easing.OutElastic);
|
||||||
|
|
||||||
@ -172,8 +172,6 @@ namespace osu.Game.Overlays.Mods
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnClick(ClickEvent e)
|
protected override bool OnClick(ClickEvent e)
|
||||||
|
@ -473,7 +473,10 @@ namespace osu.Game.Overlays.Mods
|
|||||||
if (selectedMod != null)
|
if (selectedMod != null)
|
||||||
{
|
{
|
||||||
if (State.Value == Visibility.Visible) sampleOn?.Play();
|
if (State.Value == Visibility.Visible) sampleOn?.Play();
|
||||||
|
|
||||||
DeselectTypes(selectedMod.IncompatibleMods, true);
|
DeselectTypes(selectedMod.IncompatibleMods, true);
|
||||||
|
|
||||||
|
if (selectedMod.RequiresConfiguration) ModSettingsContainer.Alpha = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -43,10 +43,10 @@ namespace osu.Game.Overlays.Music
|
|||||||
return base.OnMouseDown(e);
|
return base.OnMouseDown(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseUp(MouseUpEvent e)
|
protected override void OnMouseUp(MouseUpEvent e)
|
||||||
{
|
{
|
||||||
IsDraggable = false;
|
IsDraggable = false;
|
||||||
return base.OnMouseUp(e);
|
base.OnMouseUp(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool selected;
|
private bool selected;
|
||||||
|
@ -136,29 +136,29 @@ namespace osu.Game.Overlays.Music
|
|||||||
return draggedItem != null || base.OnDragStart(e);
|
return draggedItem != null || base.OnDragStart(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnDrag(DragEvent e)
|
protected override void OnDrag(DragEvent e)
|
||||||
{
|
{
|
||||||
nativeDragPosition = e.ScreenSpaceMousePosition;
|
nativeDragPosition = e.ScreenSpaceMousePosition;
|
||||||
if (draggedItem == null)
|
|
||||||
return base.OnDrag(e);
|
|
||||||
|
|
||||||
return true;
|
if (draggedItem == null)
|
||||||
|
base.OnDrag(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnDragEnd(DragEndEvent e)
|
protected override void OnDragEnd(DragEndEvent e)
|
||||||
{
|
{
|
||||||
nativeDragPosition = e.ScreenSpaceMousePosition;
|
nativeDragPosition = e.ScreenSpaceMousePosition;
|
||||||
|
|
||||||
if (draggedItem == null)
|
if (draggedItem == null)
|
||||||
return base.OnDragEnd(e);
|
{
|
||||||
|
base.OnDragEnd(e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (dragDestination != null)
|
if (dragDestination != null)
|
||||||
musicController.ChangeBeatmapSetPosition(draggedItem.BeatmapSetInfo, dragDestination.Value);
|
musicController.ChangeBeatmapSetPosition(draggedItem.BeatmapSetInfo, dragDestination.Value);
|
||||||
|
|
||||||
draggedItem = null;
|
draggedItem = null;
|
||||||
dragDestination = null;
|
dragDestination = null;
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
|
@ -326,7 +326,9 @@ namespace osu.Game.Overlays
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnReleased(GlobalAction action) => false;
|
public void OnReleased(GlobalAction action)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public class MusicControllerToast : Toast
|
public class MusicControllerToast : Toast
|
||||||
{
|
{
|
||||||
|
@ -385,7 +385,7 @@ namespace osu.Game.Overlays
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnDrag(DragEvent e)
|
protected override void OnDrag(DragEvent e)
|
||||||
{
|
{
|
||||||
Vector2 change = e.MousePosition - e.MouseDownPosition;
|
Vector2 change = e.MousePosition - e.MouseDownPosition;
|
||||||
|
|
||||||
@ -393,13 +393,12 @@ namespace osu.Game.Overlays
|
|||||||
change *= change.Length <= 0 ? 0 : MathF.Pow(change.Length, 0.7f) / change.Length;
|
change *= change.Length <= 0 ? 0 : MathF.Pow(change.Length, 0.7f) / change.Length;
|
||||||
|
|
||||||
this.MoveTo(change);
|
this.MoveTo(change);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnDragEnd(DragEndEvent e)
|
protected override void OnDragEnd(DragEndEvent e)
|
||||||
{
|
{
|
||||||
this.MoveTo(Vector2.Zero, 800, Easing.OutElastic);
|
this.MoveTo(Vector2.Zero, 800, Easing.OutElastic);
|
||||||
return base.OnDragEnd(e);
|
base.OnDragEnd(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,6 +40,11 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
|
|||||||
Bindable = config.GetBindable<bool>(OsuSetting.ShowInterface)
|
Bindable = config.GetBindable<bool>(OsuSetting.ShowInterface)
|
||||||
},
|
},
|
||||||
new SettingsCheckbox
|
new SettingsCheckbox
|
||||||
|
{
|
||||||
|
LabelText = "Show difficulty graph on progress bar",
|
||||||
|
Bindable = config.GetBindable<bool>(OsuSetting.ShowProgressGraph)
|
||||||
|
},
|
||||||
|
new SettingsCheckbox
|
||||||
{
|
{
|
||||||
LabelText = "Show health display even when you can't fail",
|
LabelText = "Show health display even when you can't fail",
|
||||||
Bindable = config.GetBindable<bool>(OsuSetting.ShowHealthDisplayWhenCantFail),
|
Bindable = config.GetBindable<bool>(OsuSetting.ShowHealthDisplayWhenCantFail),
|
||||||
|
@ -16,6 +16,9 @@ namespace osu.Game.Overlays.Volume
|
|||||||
|
|
||||||
public bool OnPressed(GlobalAction action) => ActionRequested?.Invoke(action) ?? false;
|
public bool OnPressed(GlobalAction action) => ActionRequested?.Invoke(action) ?? false;
|
||||||
public bool OnScroll(GlobalAction action, float amount, bool isPrecise) => ScrollActionRequested?.Invoke(action, amount, isPrecise) ?? false;
|
public bool OnScroll(GlobalAction action, float amount, bool isPrecise) => ScrollActionRequested?.Invoke(action, amount, isPrecise) ?? false;
|
||||||
public bool OnReleased(GlobalAction action) => false;
|
|
||||||
|
public void OnReleased(GlobalAction action)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,12 +46,12 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
private IAdjustableClock adjustableClock { get; set; }
|
private IAdjustableClock adjustableClock { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private BindableBeatDivisor beatDivisor { get; set; }
|
private IBeatSnapProvider beatSnapProvider { get; set; }
|
||||||
|
|
||||||
private IBeatmapProcessor beatmapProcessor;
|
private IBeatmapProcessor beatmapProcessor;
|
||||||
|
|
||||||
private DrawableEditRulesetWrapper<TObject> drawableRulesetWrapper;
|
private DrawableEditRulesetWrapper<TObject> drawableRulesetWrapper;
|
||||||
private BlueprintContainer blueprintContainer;
|
private ComposeBlueprintContainer blueprintContainer;
|
||||||
private Container distanceSnapGridContainer;
|
private Container distanceSnapGridContainer;
|
||||||
private DistanceSnapGrid distanceSnapGrid;
|
private DistanceSnapGrid distanceSnapGrid;
|
||||||
private readonly List<Container> layerContainers = new List<Container>();
|
private readonly List<Container> layerContainers = new List<Container>();
|
||||||
@ -95,7 +95,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
new EditorPlayfieldBorder { RelativeSizeAxes = Axes.Both }
|
new EditorPlayfieldBorder { RelativeSizeAxes = Axes.Both }
|
||||||
});
|
});
|
||||||
|
|
||||||
var layerAboveRuleset = drawableRulesetWrapper.CreatePlayfieldAdjustmentContainer().WithChild(blueprintContainer = new BlueprintContainer());
|
var layerAboveRuleset = drawableRulesetWrapper.CreatePlayfieldAdjustmentContainer().WithChild(blueprintContainer = CreateBlueprintContainer());
|
||||||
|
|
||||||
layerContainers.Add(layerBelowRuleset);
|
layerContainers.Add(layerBelowRuleset);
|
||||||
layerContainers.Add(layerAboveRuleset);
|
layerContainers.Add(layerAboveRuleset);
|
||||||
@ -233,6 +233,8 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
|
|
||||||
protected abstract IReadOnlyList<HitObjectCompositionTool> CompositionTools { get; }
|
protected abstract IReadOnlyList<HitObjectCompositionTool> CompositionTools { get; }
|
||||||
|
|
||||||
|
protected abstract ComposeBlueprintContainer CreateBlueprintContainer();
|
||||||
|
|
||||||
protected abstract DrawableRuleset<TObject> CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods = null);
|
protected abstract DrawableRuleset<TObject> CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods = null);
|
||||||
|
|
||||||
public void BeginPlacement(HitObject hitObject)
|
public void BeginPlacement(HitObject hitObject)
|
||||||
@ -257,40 +259,26 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
public override float GetBeatSnapDistanceAt(double referenceTime)
|
public override float GetBeatSnapDistanceAt(double referenceTime)
|
||||||
{
|
{
|
||||||
DifficultyControlPoint difficultyPoint = EditorBeatmap.ControlPointInfo.DifficultyPointAt(referenceTime);
|
DifficultyControlPoint difficultyPoint = EditorBeatmap.ControlPointInfo.DifficultyPointAt(referenceTime);
|
||||||
return (float)(100 * EditorBeatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier * difficultyPoint.SpeedMultiplier / beatDivisor.Value);
|
return (float)(100 * EditorBeatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier * difficultyPoint.SpeedMultiplier / beatSnapProvider.BeatDivisor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override float DurationToDistance(double referenceTime, double duration)
|
public override float DurationToDistance(double referenceTime, double duration)
|
||||||
{
|
{
|
||||||
double beatLength = EditorBeatmap.ControlPointInfo.TimingPointAt(referenceTime).BeatLength / beatDivisor.Value;
|
double beatLength = beatSnapProvider.GetBeatLengthAtTime(referenceTime);
|
||||||
return (float)(duration / beatLength * GetBeatSnapDistanceAt(referenceTime));
|
return (float)(duration / beatLength * GetBeatSnapDistanceAt(referenceTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override double DistanceToDuration(double referenceTime, float distance)
|
public override double DistanceToDuration(double referenceTime, float distance)
|
||||||
{
|
{
|
||||||
double beatLength = EditorBeatmap.ControlPointInfo.TimingPointAt(referenceTime).BeatLength / beatDivisor.Value;
|
double beatLength = beatSnapProvider.GetBeatLengthAtTime(referenceTime);
|
||||||
return distance / GetBeatSnapDistanceAt(referenceTime) * beatLength;
|
return distance / GetBeatSnapDistanceAt(referenceTime) * beatLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override double GetSnappedDurationFromDistance(double referenceTime, float distance)
|
public override double GetSnappedDurationFromDistance(double referenceTime, float distance)
|
||||||
=> beatSnap(referenceTime, DistanceToDuration(referenceTime, distance));
|
=> beatSnapProvider.SnapTime(referenceTime, DistanceToDuration(referenceTime, distance));
|
||||||
|
|
||||||
public override float GetSnappedDistanceFromDistance(double referenceTime, float distance)
|
public override float GetSnappedDistanceFromDistance(double referenceTime, float distance)
|
||||||
=> DurationToDistance(referenceTime, beatSnap(referenceTime, DistanceToDuration(referenceTime, distance)));
|
=> DurationToDistance(referenceTime, beatSnapProvider.SnapTime(referenceTime, DistanceToDuration(referenceTime, distance)));
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Snaps a duration to the closest beat of a timing point applicable at the reference time.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="referenceTime">The time of the timing point which <paramref name="duration"/> resides in.</param>
|
|
||||||
/// <param name="duration">The duration to snap.</param>
|
|
||||||
/// <returns>A value that represents <paramref name="duration"/> snapped to the closest beat of the timing point.</returns>
|
|
||||||
private double beatSnap(double referenceTime, double duration)
|
|
||||||
{
|
|
||||||
double beatLength = EditorBeatmap.ControlPointInfo.TimingPointAt(referenceTime).BeatLength / beatDivisor.Value;
|
|
||||||
|
|
||||||
// A 1ms offset prevents rounding errors due to minute variations in duration
|
|
||||||
return (int)((duration + 1) / beatLength) * beatLength;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
{
|
{
|
||||||
@ -323,17 +311,6 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract bool CursorInPlacementArea { get; }
|
public abstract bool CursorInPlacementArea { get; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a <see cref="SelectionBlueprint"/> for a specific <see cref="DrawableHitObject"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="hitObject">The <see cref="DrawableHitObject"/> to create the overlay for.</param>
|
|
||||||
public virtual SelectionBlueprint CreateBlueprintFor(DrawableHitObject hitObject) => null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a <see cref="SelectionHandler"/> which outlines <see cref="DrawableHitObject"/>s and handles movement of selections.
|
|
||||||
/// </summary>
|
|
||||||
public virtual SelectionHandler CreateSelectionHandler() => new SelectionHandler();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates the <see cref="DistanceSnapGrid"/> applicable for a <see cref="HitObject"/> selection.
|
/// Creates the <see cref="DistanceSnapGrid"/> applicable for a <see cref="HitObject"/> selection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
28
osu.Game/Rulesets/Edit/IBeatSnapProvider.cs
Normal file
28
osu.Game/Rulesets/Edit/IBeatSnapProvider.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Edit
|
||||||
|
{
|
||||||
|
public interface IBeatSnapProvider
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Snaps a duration to the closest beat of a timing point applicable at the reference time.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="referenceTime">The time of the timing point which <paramref name="duration"/> resides in.</param>
|
||||||
|
/// <param name="duration">The duration to snap.</param>
|
||||||
|
/// <returns>A value that represents <paramref name="duration"/> snapped to the closest beat of the timing point.</returns>
|
||||||
|
double SnapTime(double referenceTime, double duration);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the most appropriate beat length at a given time.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="referenceTime">A reference time used for lookup.</param>
|
||||||
|
/// <returns>The most appropriate beat length.</returns>
|
||||||
|
double GetBeatLengthAtTime(double referenceTime);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the current beat divisor.
|
||||||
|
/// </summary>
|
||||||
|
int BeatDivisor { get; }
|
||||||
|
}
|
||||||
|
}
|
@ -60,6 +60,12 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public virtual bool Ranked => false;
|
public virtual bool Ranked => false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether this mod requires configuration to apply changes to the game.
|
||||||
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
|
public virtual bool RequiresConfiguration => false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The mods this mod cannot be enabled with.
|
/// The mods this mod cannot be enabled with.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -24,6 +24,8 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
|
|
||||||
public override double ScoreMultiplier => 1.0;
|
public override double ScoreMultiplier => 1.0;
|
||||||
|
|
||||||
|
public override bool RequiresConfiguration => true;
|
||||||
|
|
||||||
public override Type[] IncompatibleMods => new[] { typeof(ModEasy), typeof(ModHardRock) };
|
public override Type[] IncompatibleMods => new[] { typeof(ModEasy), typeof(ModHardRock) };
|
||||||
|
|
||||||
[SettingSource("Drain Rate", "Override a beatmap's set HP.")]
|
[SettingSource("Drain Rate", "Override a beatmap's set HP.")]
|
||||||
|
@ -139,7 +139,11 @@ namespace osu.Game.Rulesets.UI
|
|||||||
|
|
||||||
public bool OnPressed(T action) => Target.Children.OfType<KeyCounterAction<T>>().Any(c => c.OnPressed(action, Clock.Rate >= 0));
|
public bool OnPressed(T action) => Target.Children.OfType<KeyCounterAction<T>>().Any(c => c.OnPressed(action, Clock.Rate >= 0));
|
||||||
|
|
||||||
public bool OnReleased(T action) => Target.Children.OfType<KeyCounterAction<T>>().Any(c => c.OnReleased(action, Clock.Rate >= 0));
|
public void OnReleased(T action)
|
||||||
|
{
|
||||||
|
foreach (var c in Target.Children.OfType<KeyCounterAction<T>>())
|
||||||
|
c.OnReleased(action, Clock.Rate >= 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -201,7 +201,9 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
|||||||
throw new ArgumentException($"{nameof(Playfield)} must be a {nameof(ScrollingPlayfield)} when using {nameof(DrawableScrollingRuleset<TObject>)}.");
|
throw new ArgumentException($"{nameof(Playfield)} must be a {nameof(ScrollingPlayfield)} when using {nameof(DrawableScrollingRuleset<TObject>)}.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnReleased(GlobalAction action) => false;
|
public void OnReleased(GlobalAction action)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
private class LocalScrollingInfo : IScrollingInfo
|
private class LocalScrollingInfo : IScrollingInfo
|
||||||
{
|
{
|
||||||
|
@ -5,6 +5,8 @@ using System.Linq;
|
|||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -25,13 +27,13 @@ namespace osu.Game.Screens.Edit.Components
|
|||||||
|
|
||||||
private IAdjustableClock adjustableClock;
|
private IAdjustableClock adjustableClock;
|
||||||
|
|
||||||
|
private readonly BindableNumber<double> tempo = new BindableDouble(1);
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(IAdjustableClock adjustableClock)
|
private void load(IAdjustableClock adjustableClock)
|
||||||
{
|
{
|
||||||
this.adjustableClock = adjustableClock;
|
this.adjustableClock = adjustableClock;
|
||||||
|
|
||||||
PlaybackTabControl tabs;
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
playButton = new IconButton
|
playButton = new IconButton
|
||||||
@ -58,11 +60,18 @@ namespace osu.Game.Screens.Edit.Components
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Height = 0.5f,
|
Height = 0.5f,
|
||||||
Padding = new MarginPadding { Left = 45 },
|
Padding = new MarginPadding { Left = 45 },
|
||||||
Child = tabs = new PlaybackTabControl(),
|
Child = new PlaybackTabControl { Current = tempo },
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
tabs.Current.ValueChanged += tempo => Beatmap.Value.Track.Tempo.Value = tempo.NewValue;
|
Track?.AddAdjustment(AdjustableProperty.Tempo, tempo);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool isDisposing)
|
||||||
|
{
|
||||||
|
Track?.RemoveAdjustment(AdjustableProperty.Tempo, tempo);
|
||||||
|
|
||||||
|
base.Dispose(isDisposing);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnKeyDown(KeyDownEvent e)
|
protected override bool OnKeyDown(KeyDownEvent e)
|
||||||
|
@ -32,12 +32,10 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnDragStart(DragStartEvent e) => true;
|
protected override bool OnDragStart(DragStartEvent e) => true;
|
||||||
protected override bool OnDragEnd(DragEndEvent e) => true;
|
|
||||||
|
|
||||||
protected override bool OnDrag(DragEvent e)
|
protected override void OnDrag(DragEvent e)
|
||||||
{
|
{
|
||||||
seekToPosition(e.ScreenSpaceMousePosition);
|
seekToPosition(e.ScreenSpaceMousePosition);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseDown(MouseDownEvent e)
|
protected override bool OnMouseDown(MouseDownEvent e)
|
||||||
|
@ -14,7 +14,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a part of the summary timeline..
|
/// Represents a part of the summary timeline..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class TimelinePart : Container
|
public class TimelinePart : Container
|
||||||
{
|
{
|
||||||
protected readonly IBindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
protected readonly IBindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
|||||||
|
|
||||||
protected override Container<Drawable> Content => timeline;
|
protected override Container<Drawable> Content => timeline;
|
||||||
|
|
||||||
protected TimelinePart()
|
public TimelinePart()
|
||||||
{
|
{
|
||||||
AddInternal(timeline = new Container { RelativeSizeAxes = Axes.Both });
|
AddInternal(timeline = new Container { RelativeSizeAxes = Axes.Both });
|
||||||
|
|
||||||
|
@ -262,10 +262,10 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
return base.OnMouseDown(e);
|
return base.OnMouseDown(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseUp(MouseUpEvent e)
|
protected override void OnMouseUp(MouseUpEvent e)
|
||||||
{
|
{
|
||||||
marker.Active = false;
|
marker.Active = false;
|
||||||
return base.OnMouseUp(e);
|
base.OnMouseUp(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnClick(ClickEvent e)
|
protected override bool OnClick(ClickEvent e)
|
||||||
@ -274,10 +274,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnDrag(DragEvent e)
|
protected override void OnDrag(DragEvent e)
|
||||||
{
|
{
|
||||||
handleMouseInput(e.ScreenSpaceMousePosition);
|
handleMouseInput(e.ScreenSpaceMousePosition);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleMouseInput(Vector2 screenSpaceMousePosition)
|
private void handleMouseInput(Vector2 screenSpaceMousePosition)
|
||||||
|
@ -14,7 +14,6 @@ using osu.Framework.Input.Bindings;
|
|||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Edit.Tools;
|
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -22,27 +21,30 @@ using osuTK.Input;
|
|||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Compose.Components
|
namespace osu.Game.Screens.Edit.Compose.Components
|
||||||
{
|
{
|
||||||
public class BlueprintContainer : CompositeDrawable, IKeyBindingHandler<PlatformAction>
|
/// <summary>
|
||||||
|
/// A container which provides a "blueprint" display of hitobjects.
|
||||||
|
/// Includes selection and manipulation support via a <see cref="SelectionHandler"/>.
|
||||||
|
/// </summary>
|
||||||
|
public abstract class BlueprintContainer : CompositeDrawable, IKeyBindingHandler<PlatformAction>
|
||||||
{
|
{
|
||||||
public event Action<IEnumerable<HitObject>> SelectionChanged;
|
public event Action<IEnumerable<HitObject>> SelectionChanged;
|
||||||
|
|
||||||
private DragBox dragBox;
|
protected DragBox DragBox { get; private set; }
|
||||||
|
|
||||||
private SelectionBlueprintContainer selectionBlueprints;
|
private SelectionBlueprintContainer selectionBlueprints;
|
||||||
private Container<PlacementBlueprint> placementBlueprintContainer;
|
|
||||||
private PlacementBlueprint currentPlacement;
|
|
||||||
private SelectionHandler selectionHandler;
|
private SelectionHandler selectionHandler;
|
||||||
private InputManager inputManager;
|
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IAdjustableClock adjustableClock { get; set; }
|
private IAdjustableClock adjustableClock { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
|
||||||
private HitObjectComposer composer { get; set; }
|
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private EditorBeatmap beatmap { get; set; }
|
private EditorBeatmap beatmap { get; set; }
|
||||||
|
|
||||||
public BlueprintContainer()
|
[Resolved(canBeNull: true)]
|
||||||
|
private IDistanceSnapProvider snapProvider { get; set; }
|
||||||
|
|
||||||
|
protected BlueprintContainer()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
}
|
}
|
||||||
@ -50,50 +52,41 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
selectionHandler = composer.CreateSelectionHandler();
|
selectionHandler = CreateSelectionHandler();
|
||||||
selectionHandler.DeselectAll = deselectAll;
|
selectionHandler.DeselectAll = deselectAll;
|
||||||
|
|
||||||
InternalChildren = new[]
|
AddRangeInternal(new[]
|
||||||
{
|
{
|
||||||
dragBox = new DragBox(select),
|
DragBox = CreateDragBox(select),
|
||||||
selectionHandler,
|
selectionHandler,
|
||||||
selectionBlueprints = new SelectionBlueprintContainer { RelativeSizeAxes = Axes.Both },
|
selectionBlueprints = new SelectionBlueprintContainer { RelativeSizeAxes = Axes.Both },
|
||||||
placementBlueprintContainer = new Container<PlacementBlueprint> { RelativeSizeAxes = Axes.Both },
|
DragBox.CreateProxy().With(p => p.Depth = float.MinValue)
|
||||||
dragBox.CreateProxy()
|
});
|
||||||
};
|
|
||||||
|
|
||||||
foreach (var obj in composer.HitObjects)
|
foreach (var obj in beatmap.HitObjects)
|
||||||
addBlueprintFor(obj);
|
AddBlueprintFor(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
beatmap.HitObjectAdded += addBlueprintFor;
|
beatmap.HitObjectAdded += AddBlueprintFor;
|
||||||
beatmap.HitObjectRemoved += removeBlueprintFor;
|
beatmap.HitObjectRemoved += removeBlueprintFor;
|
||||||
|
|
||||||
inputManager = GetContainingInputManager();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private HitObjectCompositionTool currentTool;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The current placement tool.
|
/// Creates a <see cref="SelectionHandler"/> which outlines <see cref="DrawableHitObject"/>s and handles movement of selections.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public HitObjectCompositionTool CurrentTool
|
protected virtual SelectionHandler CreateSelectionHandler() => new SelectionHandler();
|
||||||
{
|
|
||||||
get => currentTool;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (currentTool == value)
|
|
||||||
return;
|
|
||||||
|
|
||||||
currentTool = value;
|
/// <summary>
|
||||||
|
/// Creates a <see cref="SelectionBlueprint"/> for a specific <see cref="DrawableHitObject"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hitObject">The <see cref="DrawableHitObject"/> to create the overlay for.</param>
|
||||||
|
protected virtual SelectionBlueprint CreateBlueprintFor(HitObject hitObject) => null;
|
||||||
|
|
||||||
refreshTool();
|
protected virtual DragBox CreateDragBox(Action<RectangleF> performSelect) => new DragBox(performSelect);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnMouseDown(MouseDownEvent e)
|
protected override bool OnMouseDown(MouseDownEvent e)
|
||||||
{
|
{
|
||||||
@ -129,22 +122,10 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseUp(MouseUpEvent e)
|
protected override void OnMouseUp(MouseUpEvent e)
|
||||||
{
|
{
|
||||||
// Special case for when a drag happened instead of a click
|
// Special case for when a drag happened instead of a click
|
||||||
Schedule(() => endClickSelection());
|
Schedule(() => endClickSelection());
|
||||||
return e.Button == MouseButton.Left;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnMouseMove(MouseMoveEvent e)
|
|
||||||
{
|
|
||||||
if (currentPlacement != null)
|
|
||||||
{
|
|
||||||
updatePlacementPosition(e.ScreenSpaceMousePosition);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.OnMouseMove(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnDragStart(DragStartEvent e)
|
protected override bool OnDragStart(DragStartEvent e)
|
||||||
@ -154,36 +135,34 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
|
|
||||||
if (!beginSelectionMovement())
|
if (!beginSelectionMovement())
|
||||||
{
|
{
|
||||||
dragBox.UpdateDrag(e);
|
if (!DragBox.UpdateDrag(e))
|
||||||
dragBox.FadeIn(250, Easing.OutQuint);
|
return false;
|
||||||
|
|
||||||
|
DragBox.FadeIn(250, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnDrag(DragEvent e)
|
protected override void OnDrag(DragEvent e)
|
||||||
{
|
{
|
||||||
if (e.Button == MouseButton.Right)
|
if (e.Button == MouseButton.Right)
|
||||||
return false;
|
return;
|
||||||
|
|
||||||
if (!moveCurrentSelection(e))
|
if (!moveCurrentSelection(e))
|
||||||
dragBox.UpdateDrag(e);
|
DragBox.UpdateDrag(e);
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnDragEnd(DragEndEvent e)
|
protected override void OnDragEnd(DragEndEvent e)
|
||||||
{
|
{
|
||||||
if (e.Button == MouseButton.Right)
|
if (e.Button == MouseButton.Right)
|
||||||
return false;
|
return;
|
||||||
|
|
||||||
if (!finishSelectionMovement())
|
if (!finishSelectionMovement())
|
||||||
{
|
{
|
||||||
dragBox.FadeOut(250, Easing.OutQuint);
|
DragBox.FadeOut(250, Easing.OutQuint);
|
||||||
selectionHandler.UpdateVisibility();
|
selectionHandler.UpdateVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnKeyDown(KeyDownEvent e)
|
protected override bool OnKeyDown(KeyDownEvent e)
|
||||||
@ -201,8 +180,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnKeyUp(KeyUpEvent e) => false;
|
|
||||||
|
|
||||||
public bool OnPressed(PlatformAction action)
|
public bool OnPressed(PlatformAction action)
|
||||||
{
|
{
|
||||||
switch (action.ActionType)
|
switch (action.ActionType)
|
||||||
@ -215,35 +192,15 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnReleased(PlatformAction action) => false;
|
public void OnReleased(PlatformAction action)
|
||||||
|
|
||||||
protected override void Update()
|
|
||||||
{
|
{
|
||||||
base.Update();
|
|
||||||
|
|
||||||
if (currentPlacement != null)
|
|
||||||
{
|
|
||||||
if (composer.CursorInPlacementArea)
|
|
||||||
currentPlacement.State = PlacementState.Shown;
|
|
||||||
else if (currentPlacement?.PlacementBegun == false)
|
|
||||||
currentPlacement.State = PlacementState.Hidden;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Blueprint Addition/Removal
|
#region Blueprint Addition/Removal
|
||||||
|
|
||||||
private void addBlueprintFor(HitObject hitObject)
|
|
||||||
{
|
|
||||||
var drawable = composer.HitObjects.FirstOrDefault(d => d.HitObject == hitObject);
|
|
||||||
if (drawable == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
addBlueprintFor(drawable);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void removeBlueprintFor(HitObject hitObject)
|
private void removeBlueprintFor(HitObject hitObject)
|
||||||
{
|
{
|
||||||
var blueprint = selectionBlueprints.Single(m => m.DrawableObject.HitObject == hitObject);
|
var blueprint = selectionBlueprints.SingleOrDefault(m => m.DrawableObject.HitObject == hitObject);
|
||||||
if (blueprint == null)
|
if (blueprint == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -255,11 +212,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
selectionBlueprints.Remove(blueprint);
|
selectionBlueprints.Remove(blueprint);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addBlueprintFor(DrawableHitObject hitObject)
|
protected virtual void AddBlueprintFor(HitObject hitObject)
|
||||||
{
|
{
|
||||||
refreshTool();
|
var blueprint = CreateBlueprintFor(hitObject);
|
||||||
|
|
||||||
var blueprint = composer.CreateBlueprintFor(hitObject);
|
|
||||||
if (blueprint == null)
|
if (blueprint == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -271,37 +226,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Placement
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Refreshes the current placement tool.
|
|
||||||
/// </summary>
|
|
||||||
private void refreshTool()
|
|
||||||
{
|
|
||||||
placementBlueprintContainer.Clear();
|
|
||||||
currentPlacement = null;
|
|
||||||
|
|
||||||
var blueprint = CurrentTool?.CreatePlacementBlueprint();
|
|
||||||
|
|
||||||
if (blueprint != null)
|
|
||||||
{
|
|
||||||
placementBlueprintContainer.Child = currentPlacement = blueprint;
|
|
||||||
|
|
||||||
// Fixes a 1-frame position discrepancy due to the first mouse move event happening in the next frame
|
|
||||||
updatePlacementPosition(inputManager.CurrentState.Mouse.Position);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updatePlacementPosition(Vector2 screenSpacePosition)
|
|
||||||
{
|
|
||||||
Vector2 snappedGridPosition = composer.GetSnappedPosition(ToLocalSpace(screenSpacePosition), 0).position;
|
|
||||||
Vector2 snappedScreenSpacePosition = ToScreenSpace(snappedGridPosition);
|
|
||||||
|
|
||||||
currentPlacement.UpdatePosition(snappedScreenSpacePosition);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Selection
|
#region Selection
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -437,7 +361,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
|
|
||||||
// The final movement position, relative to screenSpaceMovementStartPosition
|
// The final movement position, relative to screenSpaceMovementStartPosition
|
||||||
Vector2 movePosition = startPosition + e.ScreenSpaceMousePosition - e.ScreenSpaceMouseDownPosition;
|
Vector2 movePosition = startPosition + e.ScreenSpaceMousePosition - e.ScreenSpaceMouseDownPosition;
|
||||||
(Vector2 snappedPosition, double snappedTime) = composer.GetSnappedPosition(ToLocalSpace(movePosition), draggedObject.StartTime);
|
(Vector2 snappedPosition, double snappedTime) = snapProvider.GetSnappedPosition(ToLocalSpace(movePosition), draggedObject.StartTime);
|
||||||
|
|
||||||
// Move the hitobjects
|
// Move the hitobjects
|
||||||
if (!selectionHandler.HandleMovement(new MoveSelectionEvent(movementBlueprint, startPosition, ToScreenSpace(snappedPosition))))
|
if (!selectionHandler.HandleMovement(new MoveSelectionEvent(movementBlueprint, startPosition, ToScreenSpace(snappedPosition))))
|
||||||
@ -474,7 +398,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
|
|
||||||
if (beatmap != null)
|
if (beatmap != null)
|
||||||
{
|
{
|
||||||
beatmap.HitObjectAdded -= addBlueprintFor;
|
beatmap.HitObjectAdded -= AddBlueprintFor;
|
||||||
beatmap.HitObjectRemoved -= removeBlueprintFor;
|
beatmap.HitObjectRemoved -= removeBlueprintFor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,149 @@
|
|||||||
|
// 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.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Input;
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Game.Rulesets.Edit;
|
||||||
|
using osu.Game.Rulesets.Edit.Tools;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Edit.Compose.Components
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A blueprint container generally displayed as an overlay to a ruleset's playfield.
|
||||||
|
/// </summary>
|
||||||
|
public class ComposeBlueprintContainer : BlueprintContainer
|
||||||
|
{
|
||||||
|
[Resolved]
|
||||||
|
private HitObjectComposer composer { get; set; }
|
||||||
|
|
||||||
|
private PlacementBlueprint currentPlacement;
|
||||||
|
|
||||||
|
private readonly Container<PlacementBlueprint> placementBlueprintContainer;
|
||||||
|
|
||||||
|
private InputManager inputManager;
|
||||||
|
|
||||||
|
private readonly IEnumerable<DrawableHitObject> drawableHitObjects;
|
||||||
|
|
||||||
|
public ComposeBlueprintContainer(IEnumerable<DrawableHitObject> drawableHitObjects)
|
||||||
|
{
|
||||||
|
this.drawableHitObjects = drawableHitObjects;
|
||||||
|
|
||||||
|
placementBlueprintContainer = new Container<PlacementBlueprint>
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
AddInternal(placementBlueprintContainer);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
inputManager = GetContainingInputManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Placement
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Refreshes the current placement tool.
|
||||||
|
/// </summary>
|
||||||
|
private void refreshTool()
|
||||||
|
{
|
||||||
|
placementBlueprintContainer.Clear();
|
||||||
|
currentPlacement = null;
|
||||||
|
|
||||||
|
var blueprint = CurrentTool?.CreatePlacementBlueprint();
|
||||||
|
|
||||||
|
if (blueprint != null)
|
||||||
|
{
|
||||||
|
placementBlueprintContainer.Child = currentPlacement = blueprint;
|
||||||
|
|
||||||
|
// Fixes a 1-frame position discrepancy due to the first mouse move event happening in the next frame
|
||||||
|
updatePlacementPosition(inputManager.CurrentState.Mouse.Position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updatePlacementPosition(Vector2 screenSpacePosition)
|
||||||
|
{
|
||||||
|
Vector2 snappedGridPosition = composer.GetSnappedPosition(ToLocalSpace(screenSpacePosition), 0).position;
|
||||||
|
Vector2 snappedScreenSpacePosition = ToScreenSpace(snappedGridPosition);
|
||||||
|
|
||||||
|
currentPlacement.UpdatePosition(snappedScreenSpacePosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
protected override bool OnMouseMove(MouseMoveEvent e)
|
||||||
|
{
|
||||||
|
if (currentPlacement != null)
|
||||||
|
{
|
||||||
|
updatePlacementPosition(e.ScreenSpaceMousePosition);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.OnMouseMove(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
base.Update();
|
||||||
|
|
||||||
|
if (currentPlacement != null)
|
||||||
|
{
|
||||||
|
if (composer.CursorInPlacementArea)
|
||||||
|
currentPlacement.State = PlacementState.Shown;
|
||||||
|
else if (currentPlacement?.PlacementBegun == false)
|
||||||
|
currentPlacement.State = PlacementState.Hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected sealed override SelectionBlueprint CreateBlueprintFor(HitObject hitObject)
|
||||||
|
{
|
||||||
|
var drawable = drawableHitObjects.FirstOrDefault(d => d.HitObject == hitObject);
|
||||||
|
if (drawable == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return CreateBlueprintFor(drawable);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual SelectionBlueprint CreateBlueprintFor(DrawableHitObject hitObject) => null;
|
||||||
|
|
||||||
|
protected override void AddBlueprintFor(HitObject hitObject)
|
||||||
|
{
|
||||||
|
refreshTool();
|
||||||
|
base.AddBlueprintFor(hitObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
private HitObjectCompositionTool currentTool;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The current placement tool.
|
||||||
|
/// </summary>
|
||||||
|
public HitObjectCompositionTool CurrentTool
|
||||||
|
{
|
||||||
|
get => currentTool;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (currentTool == value)
|
||||||
|
return;
|
||||||
|
|
||||||
|
currentTool = value;
|
||||||
|
|
||||||
|
refreshTool();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -50,7 +50,12 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateDrag(MouseButtonEvent e)
|
/// <summary>
|
||||||
|
/// Handle a forwarded mouse event.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e">The mouse event.</param>
|
||||||
|
/// <returns>Whether the event should be handled and blocking.</returns>
|
||||||
|
public virtual bool UpdateDrag(MouseButtonEvent e)
|
||||||
{
|
{
|
||||||
var dragPosition = e.ScreenSpaceMousePosition;
|
var dragPosition = e.ScreenSpaceMousePosition;
|
||||||
var dragStartPosition = e.ScreenSpaceMouseDownPosition;
|
var dragStartPosition = e.ScreenSpaceMouseDownPosition;
|
||||||
@ -67,6 +72,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
box.Size = bottomRight - topLeft;
|
box.Size = bottomRight - topLeft;
|
||||||
|
|
||||||
performSelection?.Invoke(dragRectangle);
|
performSelection?.Invoke(dragRectangle);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
|
|
||||||
private Drawable outline;
|
private Drawable outline;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved(CanBeNull = true)]
|
||||||
private IPlacementHandler placementHandler { get; set; }
|
private IPlacementHandler placementHandler { get; set; }
|
||||||
|
|
||||||
public SelectionHandler()
|
public SelectionHandler()
|
||||||
@ -87,7 +87,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnReleased(PlatformAction action) => action.ActionMethod == PlatformActionMethod.Delete;
|
public void OnReleased(PlatformAction action)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -143,10 +143,10 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseUp(MouseUpEvent e)
|
protected override void OnMouseUp(MouseUpEvent e)
|
||||||
{
|
{
|
||||||
endUserDrag();
|
endUserDrag();
|
||||||
return base.OnMouseUp(e);
|
base.OnMouseUp(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void beginUserDrag()
|
private void beginUserDrag()
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Screens.Edit.Components.Timelines.Summary.Parts;
|
using osu.Game.Screens.Edit.Components.Timelines.Summary.Parts;
|
||||||
@ -14,15 +17,19 @@ using osuTK.Graphics;
|
|||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||||
{
|
{
|
||||||
internal class TimelineHitObjectDisplay : TimelinePart
|
internal class TimelineHitObjectDisplay : BlueprintContainer
|
||||||
{
|
{
|
||||||
private EditorBeatmap beatmap { get; }
|
private EditorBeatmap beatmap { get; }
|
||||||
|
|
||||||
|
private readonly TimelinePart content;
|
||||||
|
|
||||||
public TimelineHitObjectDisplay(EditorBeatmap beatmap)
|
public TimelineHitObjectDisplay(EditorBeatmap beatmap)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
this.beatmap = beatmap;
|
this.beatmap = beatmap;
|
||||||
|
|
||||||
|
AddInternal(content = new TimelinePart { RelativeSizeAxes = Axes.Both });
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -40,17 +47,42 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
DragBox.Alpha = 0;
|
||||||
|
}
|
||||||
|
|
||||||
private void remove(HitObject h)
|
private void remove(HitObject h)
|
||||||
{
|
{
|
||||||
foreach (var d in Children.OfType<TimelineHitObjectRepresentation>().Where(c => c.HitObject == h))
|
foreach (var d in content.OfType<TimelineHitObjectRepresentation>().Where(c => c.HitObject == h))
|
||||||
d.Expire();
|
d.Expire();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void add(HitObject h)
|
private void add(HitObject h)
|
||||||
{
|
{
|
||||||
var yOffset = Children.Count(d => d.X == h.StartTime);
|
var yOffset = content.Count(d => d.X == h.StartTime);
|
||||||
|
|
||||||
Add(new TimelineHitObjectRepresentation(h) { Y = -yOffset * TimelineHitObjectRepresentation.THICKNESS });
|
content.Add(new TimelineHitObjectRepresentation(h) { Y = -yOffset * TimelineHitObjectRepresentation.THICKNESS });
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnMouseDown(MouseDownEvent e)
|
||||||
|
{
|
||||||
|
base.OnMouseDown(e);
|
||||||
|
|
||||||
|
return false; // tempoerary until we correctly handle selections.
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override DragBox CreateDragBox(Action<RectangleF> performSelect) => new NoDragDragBox(performSelect);
|
||||||
|
|
||||||
|
internal class NoDragDragBox : DragBox
|
||||||
|
{
|
||||||
|
public NoDragDragBox(Action<RectangleF> performSelect)
|
||||||
|
: base(performSelect)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool UpdateDrag(MouseButtonEvent e) => false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TimelineHitObjectRepresentation : CompositeDrawable
|
private class TimelineHitObjectRepresentation : CompositeDrawable
|
||||||
|
@ -26,6 +26,7 @@ using osu.Framework.Input.Bindings;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics.Cursor;
|
using osu.Game.Graphics.Cursor;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Screens.Edit.Compose;
|
using osu.Game.Screens.Edit.Compose;
|
||||||
using osu.Game.Screens.Edit.Setup;
|
using osu.Game.Screens.Edit.Setup;
|
||||||
using osu.Game.Screens.Edit.Timing;
|
using osu.Game.Screens.Edit.Timing;
|
||||||
@ -34,7 +35,8 @@ using osu.Game.Users;
|
|||||||
|
|
||||||
namespace osu.Game.Screens.Edit
|
namespace osu.Game.Screens.Edit
|
||||||
{
|
{
|
||||||
public class Editor : ScreenWithBeatmapBackground, IKeyBindingHandler<GlobalAction>
|
[Cached(typeof(IBeatSnapProvider))]
|
||||||
|
public class Editor : ScreenWithBeatmapBackground, IKeyBindingHandler<GlobalAction>, IBeatSnapProvider
|
||||||
{
|
{
|
||||||
public override float BackgroundParallaxAmount => 0.1f;
|
public override float BackgroundParallaxAmount => 0.1f;
|
||||||
|
|
||||||
@ -44,6 +46,8 @@ namespace osu.Game.Screens.Edit
|
|||||||
|
|
||||||
public override bool DisallowExternalBeatmapRulesetChanges => true;
|
public override bool DisallowExternalBeatmapRulesetChanges => true;
|
||||||
|
|
||||||
|
public override bool AllowRateAdjustments => false;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private BeatmapManager beatmapManager { get; set; }
|
private BeatmapManager beatmapManager { get; set; }
|
||||||
|
|
||||||
@ -77,11 +81,14 @@ namespace osu.Game.Screens.Edit
|
|||||||
clock.ChangeSource(sourceClock);
|
clock.ChangeSource(sourceClock);
|
||||||
|
|
||||||
playableBeatmap = Beatmap.Value.GetPlayableBeatmap(Beatmap.Value.BeatmapInfo.Ruleset);
|
playableBeatmap = Beatmap.Value.GetPlayableBeatmap(Beatmap.Value.BeatmapInfo.Ruleset);
|
||||||
editorBeatmap = new EditorBeatmap(playableBeatmap);
|
editorBeatmap = new EditorBeatmap(playableBeatmap, beatDivisor);
|
||||||
|
|
||||||
dependencies.CacheAs<IFrameBasedClock>(clock);
|
dependencies.CacheAs<IFrameBasedClock>(clock);
|
||||||
dependencies.CacheAs<IAdjustableClock>(clock);
|
dependencies.CacheAs<IAdjustableClock>(clock);
|
||||||
|
|
||||||
|
// todo: remove caching of this and consume via editorBeatmap?
|
||||||
dependencies.Cache(beatDivisor);
|
dependencies.Cache(beatDivisor);
|
||||||
|
|
||||||
dependencies.CacheAs(editorBeatmap);
|
dependencies.CacheAs(editorBeatmap);
|
||||||
|
|
||||||
EditorMenuBar menuBar;
|
EditorMenuBar menuBar;
|
||||||
@ -253,12 +260,8 @@ namespace osu.Game.Screens.Edit
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnReleased(GlobalAction action) => action == GlobalAction.Back;
|
public void OnReleased(GlobalAction action)
|
||||||
|
|
||||||
public override void OnResuming(IScreen last)
|
|
||||||
{
|
{
|
||||||
base.OnResuming(last);
|
|
||||||
Beatmap.Value.Track?.Stop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnEntering(IScreen last)
|
public override void OnEntering(IScreen last)
|
||||||
@ -284,7 +287,6 @@ namespace osu.Game.Screens.Edit
|
|||||||
|
|
||||||
private void resetTrack(bool seekToStart = false)
|
private void resetTrack(bool seekToStart = false)
|
||||||
{
|
{
|
||||||
Beatmap.Value.Track?.ResetSpeedAdjustments();
|
|
||||||
Beatmap.Value.Track?.Stop();
|
Beatmap.Value.Track?.Stop();
|
||||||
|
|
||||||
if (seekToStart)
|
if (seekToStart)
|
||||||
@ -345,5 +347,11 @@ namespace osu.Game.Screens.Edit
|
|||||||
saveBeatmap();
|
saveBeatmap();
|
||||||
beatmapManager.Export(Beatmap.Value.BeatmapSetInfo);
|
beatmapManager.Export(Beatmap.Value.BeatmapSetInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double SnapTime(double referenceTime, double duration) => editorBeatmap.SnapTime(referenceTime, duration);
|
||||||
|
|
||||||
|
public double GetBeatLengthAtTime(double referenceTime) => editorBeatmap.GetBeatLengthAtTime(referenceTime);
|
||||||
|
|
||||||
|
public int BeatDivisor => beatDivisor.Value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,11 +8,12 @@ using osu.Framework.Bindables;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Beatmaps.Timing;
|
using osu.Game.Beatmaps.Timing;
|
||||||
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit
|
namespace osu.Game.Screens.Edit
|
||||||
{
|
{
|
||||||
public class EditorBeatmap : IBeatmap
|
public class EditorBeatmap : IBeatmap, IBeatSnapProvider
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked when a <see cref="HitObject"/> is added to this <see cref="EditorBeatmap"/>.
|
/// Invoked when a <see cref="HitObject"/> is added to this <see cref="EditorBeatmap"/>.
|
||||||
@ -31,11 +32,14 @@ namespace osu.Game.Screens.Edit
|
|||||||
|
|
||||||
public readonly IBeatmap PlayableBeatmap;
|
public readonly IBeatmap PlayableBeatmap;
|
||||||
|
|
||||||
|
private readonly BindableBeatDivisor beatDivisor;
|
||||||
|
|
||||||
private readonly Dictionary<HitObject, Bindable<double>> startTimeBindables = new Dictionary<HitObject, Bindable<double>>();
|
private readonly Dictionary<HitObject, Bindable<double>> startTimeBindables = new Dictionary<HitObject, Bindable<double>>();
|
||||||
|
|
||||||
public EditorBeatmap(IBeatmap playableBeatmap)
|
public EditorBeatmap(IBeatmap playableBeatmap, BindableBeatDivisor beatDivisor = null)
|
||||||
{
|
{
|
||||||
PlayableBeatmap = playableBeatmap;
|
PlayableBeatmap = playableBeatmap;
|
||||||
|
this.beatDivisor = beatDivisor;
|
||||||
|
|
||||||
foreach (var obj in HitObjects)
|
foreach (var obj in HitObjects)
|
||||||
trackStartTime(obj);
|
trackStartTime(obj);
|
||||||
@ -121,5 +125,17 @@ namespace osu.Game.Screens.Edit
|
|||||||
|
|
||||||
return list.Count - 1;
|
return list.Count - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double SnapTime(double referenceTime, double duration)
|
||||||
|
{
|
||||||
|
double beatLength = GetBeatLengthAtTime(referenceTime);
|
||||||
|
|
||||||
|
// A 1ms offset prevents rounding errors due to minute variations in duration
|
||||||
|
return (int)((duration + 1) / beatLength) * beatLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double GetBeatLengthAtTime(double referenceTime) => ControlPointInfo.TimingPointAt(referenceTime).BeatLength / BeatDivisor;
|
||||||
|
|
||||||
|
public int BeatDivisor => beatDivisor?.Value ?? 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -194,10 +194,10 @@ namespace osu.Game.Screens.Menu
|
|||||||
return base.OnMouseDown(e);
|
return base.OnMouseDown(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseUp(MouseUpEvent e)
|
protected override void OnMouseUp(MouseUpEvent e)
|
||||||
{
|
{
|
||||||
boxHoverLayer.FadeTo(0, 1000, Easing.OutQuint);
|
boxHoverLayer.FadeTo(0, 1000, Easing.OutQuint);
|
||||||
return base.OnMouseUp(e);
|
base.OnMouseUp(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnClick(ClickEvent e)
|
protected override bool OnClick(ClickEvent e)
|
||||||
|
@ -211,7 +211,9 @@ namespace osu.Game.Screens.Menu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnReleased(GlobalAction action) => false;
|
public void OnReleased(GlobalAction action)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
private bool goBack()
|
private bool goBack()
|
||||||
{
|
{
|
||||||
|
@ -24,16 +24,13 @@ namespace osu.Game.Screens.Menu
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnReleased(GlobalAction action)
|
public void OnReleased(GlobalAction action)
|
||||||
{
|
{
|
||||||
if (action == GlobalAction.Back)
|
if (action == GlobalAction.Back)
|
||||||
{
|
{
|
||||||
if (!Fired)
|
if (!Fired)
|
||||||
AbortConfirm();
|
AbortConfirm();
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -353,12 +353,11 @@ namespace osu.Game.Screens.Menu
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseUp(MouseUpEvent e)
|
protected override void OnMouseUp(MouseUpEvent e)
|
||||||
{
|
{
|
||||||
if (e.Button != MouseButton.Left) return false;
|
if (e.Button != MouseButton.Left) return;
|
||||||
|
|
||||||
logoBounceContainer.ScaleTo(1f, 500, Easing.OutElastic);
|
logoBounceContainer.ScaleTo(1f, 500, Easing.OutElastic);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnClick(ClickEvent e)
|
protected override bool OnClick(ClickEvent e)
|
||||||
|
@ -163,8 +163,6 @@ namespace osu.Game.Screens.Play
|
|||||||
// Don't let mouse down events through the overlay or people can click circles while paused.
|
// Don't let mouse down events through the overlay or people can click circles while paused.
|
||||||
protected override bool OnMouseDown(MouseDownEvent e) => true;
|
protected override bool OnMouseDown(MouseDownEvent e) => true;
|
||||||
|
|
||||||
protected override bool OnMouseUp(MouseUpEvent e) => true;
|
|
||||||
|
|
||||||
protected override bool OnMouseMove(MouseMoveEvent e) => true;
|
protected override bool OnMouseMove(MouseMoveEvent e) => true;
|
||||||
|
|
||||||
protected void AddButton(string text, Color4 colour, Action action)
|
protected void AddButton(string text, Color4 colour, Action action)
|
||||||
@ -247,16 +245,8 @@ namespace osu.Game.Screens.Play
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnReleased(GlobalAction action)
|
public void OnReleased(GlobalAction action)
|
||||||
{
|
{
|
||||||
switch (action)
|
|
||||||
{
|
|
||||||
case GlobalAction.Back:
|
|
||||||
case GlobalAction.Select:
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonSelectionChanged(DialogButton button, bool isSelected)
|
private void buttonSelectionChanged(DialogButton button, bool isSelected)
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user