mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 15:44:04 +09:00
Merge branch 'master' into delete-selection
This commit is contained in:
@ -29,7 +29,10 @@ namespace osu.Game.Screens.Edit
|
||||
set
|
||||
{
|
||||
if (!VALID_DIVISORS.Contains(value))
|
||||
throw new ArgumentOutOfRangeException($"Provided divisor is not in {nameof(VALID_DIVISORS)}");
|
||||
{
|
||||
// If it doesn't match, value will be 0, but will be clamped to the valid range via DefaultMinValue
|
||||
value = Array.FindLast(VALID_DIVISORS, d => d < value);
|
||||
}
|
||||
|
||||
base.Value = value;
|
||||
}
|
||||
|
@ -218,12 +218,17 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
}
|
||||
|
||||
AddInternal(marker = new Marker());
|
||||
}
|
||||
|
||||
CurrentNumber.ValueChanged += div =>
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
CurrentNumber.BindValueChanged(div =>
|
||||
{
|
||||
marker.MoveToX(getMappedPosition(div.NewValue), 100, Easing.OutQuint);
|
||||
marker.Flash();
|
||||
};
|
||||
}, true);
|
||||
}
|
||||
|
||||
protected override void UpdateValue(float value)
|
||||
|
@ -226,7 +226,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!SelectedBlueprints.Any())
|
||||
if (!selectedBlueprints.Any(b => b.IsHovered))
|
||||
return Array.Empty<MenuItem>();
|
||||
|
||||
return new MenuItem[]
|
||||
@ -247,36 +247,36 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
|
||||
private MenuItem createHitSampleMenuItem(string name, string sampleName)
|
||||
{
|
||||
return new ThreeStateMenuItem(name, MenuItemType.Standard, setHitSampleState)
|
||||
return new TernaryStateMenuItem(name, MenuItemType.Standard, setHitSampleState)
|
||||
{
|
||||
State = { Value = getHitSampleState() }
|
||||
};
|
||||
|
||||
void setHitSampleState(ThreeStates state)
|
||||
void setHitSampleState(TernaryState state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case ThreeStates.Disabled:
|
||||
case TernaryState.False:
|
||||
RemoveHitSample(sampleName);
|
||||
break;
|
||||
|
||||
case ThreeStates.Enabled:
|
||||
case TernaryState.True:
|
||||
AddHitSample(sampleName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ThreeStates getHitSampleState()
|
||||
TernaryState getHitSampleState()
|
||||
{
|
||||
int countExisting = SelectedHitObjects.Count(h => h.Samples.Any(s => s.Name == sampleName));
|
||||
|
||||
if (countExisting == 0)
|
||||
return ThreeStates.Disabled;
|
||||
return TernaryState.False;
|
||||
|
||||
if (countExisting < SelectedHitObjects.Count())
|
||||
return ThreeStates.Indeterminate;
|
||||
return TernaryState.Indeterminate;
|
||||
|
||||
return ThreeStates.Enabled;
|
||||
return TernaryState.True;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,8 @@ namespace osu.Game.Screens.Edit
|
||||
{
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4");
|
||||
|
||||
public override float BackgroundParallaxAmount => 0.1f;
|
||||
|
||||
public override bool AllowBackButton => false;
|
||||
|
||||
public override bool HideOverlaysOnEnter => true;
|
||||
@ -65,7 +67,10 @@ namespace osu.Game.Screens.Edit
|
||||
{
|
||||
this.host = host;
|
||||
|
||||
// TODO: should probably be done at a DrawableRuleset level to share logic with Player.
|
||||
beatDivisor.Value = Beatmap.Value.BeatmapInfo.BeatDivisor;
|
||||
beatDivisor.BindValueChanged(divisor => Beatmap.Value.BeatmapInfo.BeatDivisor = divisor.NewValue);
|
||||
|
||||
// Todo: should probably be done at a DrawableRuleset level to share logic with Player.
|
||||
var sourceClock = (IAdjustableClock)Beatmap.Value.Track ?? new StopwatchClock();
|
||||
clock = new EditorClock(Beatmap.Value, beatDivisor) { IsCoupled = false };
|
||||
clock.ChangeSource(sourceClock);
|
||||
@ -246,7 +251,8 @@ namespace osu.Game.Screens.Edit
|
||||
base.OnEntering(last);
|
||||
|
||||
Background.FadeColour(Color4.DarkGray, 500);
|
||||
resetTrack();
|
||||
|
||||
resetTrack(true);
|
||||
}
|
||||
|
||||
public override bool OnExiting(IScreen next)
|
||||
@ -257,10 +263,24 @@ namespace osu.Game.Screens.Edit
|
||||
return base.OnExiting(next);
|
||||
}
|
||||
|
||||
private void resetTrack()
|
||||
private void resetTrack(bool seekToStart = false)
|
||||
{
|
||||
Beatmap.Value.Track?.ResetSpeedAdjustments();
|
||||
Beatmap.Value.Track?.Stop();
|
||||
|
||||
if (seekToStart)
|
||||
{
|
||||
double targetTime = 0;
|
||||
|
||||
if (Beatmap.Value.Beatmap.HitObjects.Count > 0)
|
||||
{
|
||||
// seek to one beat length before the first hitobject
|
||||
targetTime = Beatmap.Value.Beatmap.HitObjects[0].StartTime;
|
||||
targetTime -= Beatmap.Value.Beatmap.ControlPointInfo.TimingPointAt(targetTime).BeatLength;
|
||||
}
|
||||
|
||||
clock.Seek(Math.Max(0, targetTime));
|
||||
}
|
||||
}
|
||||
|
||||
private void exportBeatmap() => host.OpenFileExternally(Beatmap.Value.Save());
|
||||
|
Reference in New Issue
Block a user