Make spinner blueprint update values more frequently. Also handle right-click

This commit is contained in:
Dean Herbert 2020-02-07 19:09:47 +09:00
parent a6531bf73e
commit 830afe5209

View File

@ -1,13 +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 osu.Framework.Graphics; using System;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components; using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components;
using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.UI; using osu.Game.Rulesets.Osu.UI;
using osuTK; using osuTK;
using osuTK.Input;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners
{ {
@ -29,22 +30,29 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners
{ {
base.Update(); base.Update();
if (isPlacingEnd)
HitObject.EndTime = Math.Max(HitObject.StartTime, EditorClock.CurrentTime);
piece.UpdateFrom(HitObject); piece.UpdateFrom(HitObject);
} }
protected override bool OnClick(ClickEvent e) protected override bool OnMouseDown(MouseDownEvent e)
{ {
if (isPlacingEnd) if (isPlacingEnd)
{ {
if (e.Button != MouseButton.Right)
return false;
HitObject.EndTime = EditorClock.CurrentTime; HitObject.EndTime = EditorClock.CurrentTime;
EndPlacement(); EndPlacement();
} }
else else
{ {
isPlacingEnd = true; if (e.Button != MouseButton.Left)
piece.FadeTo(1f, 150, Easing.OutQuint); return false;
BeginPlacement(); BeginPlacement();
isPlacingEnd = true;
} }
return true; return true;