mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 06:03:08 +08:00
Merge branch 'master' into unfocused-notifications
This commit is contained in:
commit
de5917b645
@ -8,7 +8,6 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -44,7 +43,7 @@ namespace osu.Game.Rulesets.Pippidon.Objects.Drawables
|
|||||||
|
|
||||||
public override IEnumerable<HitSampleInfo> GetSamples() => new[]
|
public override IEnumerable<HitSampleInfo> GetSamples() => new[]
|
||||||
{
|
{
|
||||||
new HitSampleInfo(HitSampleInfo.HIT_NORMAL, SampleControlPoint.DEFAULT_BANK)
|
new HitSampleInfo(HitSampleInfo.HIT_NORMAL)
|
||||||
};
|
};
|
||||||
|
|
||||||
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
||||||
|
@ -8,7 +8,6 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Pippidon.UI;
|
using osu.Game.Rulesets.Pippidon.UI;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
@ -44,7 +43,7 @@ namespace osu.Game.Rulesets.Pippidon.Objects.Drawables
|
|||||||
|
|
||||||
public override IEnumerable<HitSampleInfo> GetSamples() => new[]
|
public override IEnumerable<HitSampleInfo> GetSamples() => new[]
|
||||||
{
|
{
|
||||||
new HitSampleInfo(HitSampleInfo.HIT_NORMAL, SampleControlPoint.DEFAULT_BANK)
|
new HitSampleInfo(HitSampleInfo.HIT_NORMAL)
|
||||||
};
|
};
|
||||||
|
|
||||||
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
||||||
|
7
global.json
Normal file
7
global.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"sdk": {
|
||||||
|
"version": "6.0.100",
|
||||||
|
"rollForward": "latestFeature"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -45,7 +45,7 @@ namespace osu.Game.Rulesets.Catch.Tests
|
|||||||
NewCombo = i % 8 == 0,
|
NewCombo = i % 8 == 0,
|
||||||
Samples = new List<HitSampleInfo>(new[]
|
Samples = new List<HitSampleInfo>(new[]
|
||||||
{
|
{
|
||||||
new HitSampleInfo(HitSampleInfo.HIT_NORMAL, "normal", volume: 100)
|
new HitSampleInfo(HitSampleInfo.HIT_NORMAL)
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ namespace osu.Game.Rulesets.Catch.Objects
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed override HitSampleInfo With(Optional<string> newName = default, Optional<string?> newBank = default, Optional<string?> newSuffix = default, Optional<int> newVolume = default)
|
public sealed override HitSampleInfo With(Optional<string> newName = default, Optional<string> newBank = default, Optional<string?> newSuffix = default, Optional<int> newVolume = default)
|
||||||
=> new BananaHitSampleInfo(newVolume.GetOr(Volume));
|
=> new BananaHitSampleInfo(newVolume.GetOr(Volume));
|
||||||
|
|
||||||
public bool Equals(BananaHitSampleInfo? other)
|
public bool Equals(BananaHitSampleInfo? other)
|
||||||
|
@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Catch.Objects
|
|||||||
{
|
{
|
||||||
StartTime = time,
|
StartTime = time,
|
||||||
BananaIndex = i,
|
BananaIndex = i,
|
||||||
Samples = new List<HitSampleInfo> { new Banana.BananaHitSampleInfo(GetSampleInfo().Volume) }
|
Samples = new List<HitSampleInfo> { new Banana.BananaHitSampleInfo(CreateHitSampleInfo().Volume) }
|
||||||
});
|
});
|
||||||
|
|
||||||
time += spacing;
|
time += spacing;
|
||||||
|
@ -74,7 +74,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
EndTime = Time.Current + delay + length,
|
EndTime = Time.Current + delay + length,
|
||||||
Samples = new List<HitSampleInfo>
|
Samples = new List<HitSampleInfo>
|
||||||
{
|
{
|
||||||
new HitSampleInfo("hitnormal")
|
new HitSampleInfo(HitSampleInfo.HIT_NORMAL)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using JetBrains.Annotations;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
@ -24,9 +21,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners
|
|||||||
|
|
||||||
private bool isPlacingEnd;
|
private bool isPlacingEnd;
|
||||||
|
|
||||||
[Resolved(CanBeNull = true)]
|
[Resolved]
|
||||||
[CanBeNull]
|
private IBeatSnapProvider? beatSnapProvider { get; set; }
|
||||||
private IBeatSnapProvider beatSnapProvider { get; set; }
|
|
||||||
|
|
||||||
public SpinnerPlacementBlueprint()
|
public SpinnerPlacementBlueprint()
|
||||||
: base(new Spinner { Position = OsuPlayfield.BASE_SIZE / 2 })
|
: base(new Spinner { Position = OsuPlayfield.BASE_SIZE / 2 })
|
||||||
|
@ -72,7 +72,7 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
|
|
||||||
AddNested(i < SpinsRequired
|
AddNested(i < SpinsRequired
|
||||||
? new SpinnerTick { StartTime = startTime, SpinnerDuration = Duration }
|
? new SpinnerTick { StartTime = startTime, SpinnerDuration = Duration }
|
||||||
: new SpinnerBonusTick { StartTime = startTime, SpinnerDuration = Duration, Samples = new[] { GetSampleInfo("spinnerbonus") } });
|
: new SpinnerBonusTick { StartTime = startTime, SpinnerDuration = Duration, Samples = new[] { CreateHitSampleInfo("spinnerbonus") } });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ namespace osu.Game.Rulesets.Taiko.Objects
|
|||||||
if (isRimType != rimSamples.Any())
|
if (isRimType != rimSamples.Any())
|
||||||
{
|
{
|
||||||
if (isRimType)
|
if (isRimType)
|
||||||
Samples.Add(new HitSampleInfo(HitSampleInfo.HIT_CLAP));
|
Samples.Add(CreateHitSampleInfo(HitSampleInfo.HIT_CLAP));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (var sample in rimSamples)
|
foreach (var sample in rimSamples)
|
||||||
|
@ -56,7 +56,7 @@ namespace osu.Game.Rulesets.Taiko.Objects
|
|||||||
if (IsStrongBindable.Value != strongSamples.Any())
|
if (IsStrongBindable.Value != strongSamples.Any())
|
||||||
{
|
{
|
||||||
if (IsStrongBindable.Value)
|
if (IsStrongBindable.Value)
|
||||||
Samples.Add(GetSampleInfo(HitSampleInfo.HIT_FINISH));
|
Samples.Add(CreateHitSampleInfo(HitSampleInfo.HIT_FINISH));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (var sample in strongSamples)
|
foreach (var sample in strongSamples)
|
||||||
|
@ -24,7 +24,7 @@ using osuTK.Input;
|
|||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Editing
|
namespace osu.Game.Tests.Visual.Editing
|
||||||
{
|
{
|
||||||
public partial class TestSceneHitObjectSamplePointAdjustments : EditorTestScene
|
public partial class TestSceneHitObjectSampleAdjustments : EditorTestScene
|
||||||
{
|
{
|
||||||
protected override Ruleset CreateEditorRuleset() => new OsuRuleset();
|
protected override Ruleset CreateEditorRuleset() => new OsuRuleset();
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
Position = (OsuPlayfield.BASE_SIZE - new Vector2(100, 0)) / 2,
|
Position = (OsuPlayfield.BASE_SIZE - new Vector2(100, 0)) / 2,
|
||||||
Samples = new List<HitSampleInfo>
|
Samples = new List<HitSampleInfo>
|
||||||
{
|
{
|
||||||
new HitSampleInfo(HitSampleInfo.HIT_NORMAL, "normal", volume: 80)
|
new HitSampleInfo(HitSampleInfo.HIT_NORMAL, volume: 80)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -58,6 +58,26 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestAddSampleAddition()
|
||||||
|
{
|
||||||
|
AddStep("select both objects", () => EditorBeatmap.SelectedHitObjects.AddRange(EditorBeatmap.HitObjects));
|
||||||
|
|
||||||
|
AddStep("add clap addition", () => InputManager.Key(Key.R));
|
||||||
|
|
||||||
|
hitObjectHasSampleBank(0, "normal");
|
||||||
|
hitObjectHasSamples(0, HitSampleInfo.HIT_NORMAL, HitSampleInfo.HIT_CLAP);
|
||||||
|
hitObjectHasSampleBank(1, "soft");
|
||||||
|
hitObjectHasSamples(1, HitSampleInfo.HIT_NORMAL, HitSampleInfo.HIT_CLAP);
|
||||||
|
|
||||||
|
AddStep("remove clap addition", () => InputManager.Key(Key.R));
|
||||||
|
|
||||||
|
hitObjectHasSampleBank(0, "normal");
|
||||||
|
hitObjectHasSamples(0, HitSampleInfo.HIT_NORMAL);
|
||||||
|
hitObjectHasSampleBank(1, "soft");
|
||||||
|
hitObjectHasSamples(1, HitSampleInfo.HIT_NORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestPopoverHasFocus()
|
public void TestPopoverHasFocus()
|
||||||
{
|
{
|
||||||
@ -271,6 +291,12 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
InputManager.Key(Key.Enter);
|
InputManager.Key(Key.Enter);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
private void hitObjectHasSamples(int objectIndex, params string[] samples) => AddAssert($"{objectIndex.ToOrdinalWords()} has samples {string.Join(',', samples)}", () =>
|
||||||
|
{
|
||||||
|
var h = EditorBeatmap.HitObjects.ElementAt(objectIndex);
|
||||||
|
return h.Samples.Select(s => s.Name).SequenceEqual(samples);
|
||||||
|
});
|
||||||
|
|
||||||
private void hitObjectHasSampleBank(int objectIndex, string bank) => AddAssert($"{objectIndex.ToOrdinalWords()} has bank {bank}", () =>
|
private void hitObjectHasSampleBank(int objectIndex, string bank) => AddAssert($"{objectIndex.ToOrdinalWords()} has bank {bank}", () =>
|
||||||
{
|
{
|
||||||
var h = EditorBeatmap.HitObjects.ElementAt(objectIndex);
|
var h = EditorBeatmap.HitObjects.ElementAt(objectIndex);
|
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Utils;
|
using osu.Game.Utils;
|
||||||
|
|
||||||
namespace osu.Game.Audio
|
namespace osu.Game.Audio
|
||||||
@ -32,7 +33,7 @@ namespace osu.Game.Audio
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The bank to load the sample from.
|
/// The bank to load the sample from.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly string? Bank;
|
public readonly string Bank;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An optional suffix to provide priority lookup. Falls back to non-suffixed <see cref="Name"/>.
|
/// An optional suffix to provide priority lookup. Falls back to non-suffixed <see cref="Name"/>.
|
||||||
@ -44,7 +45,7 @@ namespace osu.Game.Audio
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int Volume { get; }
|
public int Volume { get; }
|
||||||
|
|
||||||
public HitSampleInfo(string name, string? bank = null, string? suffix = null, int volume = 0)
|
public HitSampleInfo(string name, string bank = SampleControlPoint.DEFAULT_BANK, string? suffix = null, int volume = 100)
|
||||||
{
|
{
|
||||||
Name = name;
|
Name = name;
|
||||||
Bank = bank;
|
Bank = bank;
|
||||||
@ -75,7 +76,7 @@ namespace osu.Game.Audio
|
|||||||
/// <param name="newSuffix">An optional new lookup suffix.</param>
|
/// <param name="newSuffix">An optional new lookup suffix.</param>
|
||||||
/// <param name="newVolume">An optional new volume.</param>
|
/// <param name="newVolume">An optional new volume.</param>
|
||||||
/// <returns>The new <see cref="HitSampleInfo"/>.</returns>
|
/// <returns>The new <see cref="HitSampleInfo"/>.</returns>
|
||||||
public virtual HitSampleInfo With(Optional<string> newName = default, Optional<string?> newBank = default, Optional<string?> newSuffix = default, Optional<int> newVolume = default)
|
public virtual HitSampleInfo With(Optional<string> newName = default, Optional<string> newBank = default, Optional<string?> newSuffix = default, Optional<int> newVolume = default)
|
||||||
=> new HitSampleInfo(newName.GetOr(Name), newBank.GetOr(Bank), newSuffix.GetOr(Suffix), newVolume.GetOr(Volume));
|
=> new HitSampleInfo(newName.GetOr(Name), newBank.GetOr(Bank), newSuffix.GetOr(Suffix), newVolume.GetOr(Volume));
|
||||||
|
|
||||||
public bool Equals(HitSampleInfo? other)
|
public bool Equals(HitSampleInfo? other)
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
|
|
||||||
@ -22,34 +20,17 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
public virtual void PreProcess()
|
public virtual void PreProcess()
|
||||||
{
|
{
|
||||||
IHasComboInformation lastObj = null;
|
IHasComboInformation? lastObj = null;
|
||||||
|
|
||||||
bool isFirst = true;
|
|
||||||
|
|
||||||
foreach (var obj in Beatmap.HitObjects.OfType<IHasComboInformation>())
|
foreach (var obj in Beatmap.HitObjects.OfType<IHasComboInformation>())
|
||||||
{
|
{
|
||||||
if (isFirst)
|
if (lastObj == null)
|
||||||
{
|
{
|
||||||
obj.NewCombo = true;
|
|
||||||
|
|
||||||
// first hitobject should always be marked as a new combo for sanity.
|
// first hitobject should always be marked as a new combo for sanity.
|
||||||
isFirst = false;
|
obj.NewCombo = true;
|
||||||
}
|
|
||||||
|
|
||||||
obj.ComboIndex = lastObj?.ComboIndex ?? 0;
|
|
||||||
obj.ComboIndexWithOffsets = lastObj?.ComboIndexWithOffsets ?? 0;
|
|
||||||
obj.IndexInCurrentCombo = (lastObj?.IndexInCurrentCombo + 1) ?? 0;
|
|
||||||
|
|
||||||
if (obj.NewCombo)
|
|
||||||
{
|
|
||||||
obj.IndexInCurrentCombo = 0;
|
|
||||||
obj.ComboIndex++;
|
|
||||||
obj.ComboIndexWithOffsets += obj.ComboOffset + 1;
|
|
||||||
|
|
||||||
if (lastObj != null)
|
|
||||||
lastObj.LastInCombo = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
obj.UpdateComboInformation(lastObj);
|
||||||
lastObj = obj;
|
lastObj = obj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
/// <param name="hitSampleInfo">The <see cref="HitSampleInfo"/>. This will not be modified.</param>
|
/// <param name="hitSampleInfo">The <see cref="HitSampleInfo"/>. This will not be modified.</param>
|
||||||
/// <returns>The modified <see cref="HitSampleInfo"/>. This does not share a reference with <paramref name="hitSampleInfo"/>.</returns>
|
/// <returns>The modified <see cref="HitSampleInfo"/>. This does not share a reference with <paramref name="hitSampleInfo"/>.</returns>
|
||||||
public virtual HitSampleInfo ApplyTo(HitSampleInfo hitSampleInfo)
|
public virtual HitSampleInfo ApplyTo(HitSampleInfo hitSampleInfo)
|
||||||
=> hitSampleInfo.With(newBank: hitSampleInfo.Bank ?? SampleBank, newVolume: hitSampleInfo.Volume > 0 ? hitSampleInfo.Volume : SampleVolume);
|
=> hitSampleInfo.With(newBank: hitSampleInfo.Bank, newVolume: hitSampleInfo.Volume > 0 ? hitSampleInfo.Volume : SampleVolume);
|
||||||
|
|
||||||
public override bool IsRedundant(ControlPoint? existing)
|
public override bool IsRedundant(ControlPoint? existing)
|
||||||
=> existing is SampleControlPoint existingSample
|
=> existing is SampleControlPoint existingSample
|
||||||
|
@ -226,12 +226,16 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
|
|
||||||
public override HitSampleInfo ApplyTo(HitSampleInfo hitSampleInfo)
|
public override HitSampleInfo ApplyTo(HitSampleInfo hitSampleInfo)
|
||||||
{
|
{
|
||||||
var baseInfo = base.ApplyTo(hitSampleInfo);
|
if (hitSampleInfo is ConvertHitObjectParser.LegacyHitSampleInfo legacy)
|
||||||
|
{
|
||||||
|
return legacy.With(
|
||||||
|
newCustomSampleBank: legacy.CustomSampleBank > 0 ? legacy.CustomSampleBank : CustomSampleBank,
|
||||||
|
newVolume: hitSampleInfo.Volume > 0 ? hitSampleInfo.Volume : SampleVolume,
|
||||||
|
newBank: legacy.BankSpecified ? legacy.Bank : SampleBank
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (baseInfo is ConvertHitObjectParser.LegacyHitSampleInfo legacy && legacy.CustomSampleBank == 0)
|
return base.ApplyTo(hitSampleInfo);
|
||||||
return legacy.With(newCustomSampleBank: CustomSampleBank);
|
|
||||||
|
|
||||||
return baseInfo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool IsRedundant(ControlPoint? existing)
|
public override bool IsRedundant(ControlPoint? existing)
|
||||||
|
@ -77,10 +77,10 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
private void updateState()
|
private void updateState()
|
||||||
{
|
{
|
||||||
hoverClickSounds.Enabled.Value = !Item.Action.Disabled;
|
hoverClickSounds.Enabled.Value = IsActionable;
|
||||||
Alpha = Item.Action.Disabled ? 0.2f : 1;
|
Alpha = IsActionable ? 1 : 0.2f;
|
||||||
|
|
||||||
if (IsHovered && !Item.Action.Disabled)
|
if (IsHovered && IsActionable)
|
||||||
{
|
{
|
||||||
text.BoldText.FadeIn(transition_length, Easing.OutQuint);
|
text.BoldText.FadeIn(transition_length, Easing.OutQuint);
|
||||||
text.NormalText.FadeOut(transition_length, Easing.OutQuint);
|
text.NormalText.FadeOut(transition_length, Easing.OutQuint);
|
||||||
|
@ -77,6 +77,14 @@ namespace osu.Game.Overlays
|
|||||||
base.Content.Add(mainContent);
|
base.Content.Add(mainContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
// Ensure the scroll-to-top button is displayed above the fixed header.
|
||||||
|
AddInternal(ScrollFlow.Button.CreateProxy());
|
||||||
|
}
|
||||||
|
|
||||||
protected override void UpdateAfterChildren()
|
protected override void UpdateAfterChildren()
|
||||||
{
|
{
|
||||||
base.UpdateAfterChildren();
|
base.UpdateAfterChildren();
|
||||||
|
@ -31,7 +31,7 @@ namespace osu.Game.Overlays
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private const int button_scroll_position = 200;
|
private const int button_scroll_position = 200;
|
||||||
|
|
||||||
protected ScrollBackButton Button;
|
public ScrollBackButton Button { get; private set; }
|
||||||
|
|
||||||
private readonly Bindable<float?> lastScrollTarget = new Bindable<float?>();
|
private readonly Bindable<float?> lastScrollTarget = new Bindable<float?>();
|
||||||
|
|
||||||
|
@ -249,12 +249,14 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private partial class ProfileSectionsContainer : SectionsContainer<ProfileSection>
|
private partial class ProfileSectionsContainer : SectionsContainer<ProfileSection>
|
||||||
{
|
{
|
||||||
|
private OverlayScrollContainer scroll = null!;
|
||||||
|
|
||||||
public ProfileSectionsContainer()
|
public ProfileSectionsContainer()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override UserTrackingScrollContainer CreateScrollContainer() => new OverlayScrollContainer();
|
protected override UserTrackingScrollContainer CreateScrollContainer() => scroll = new OverlayScrollContainer();
|
||||||
|
|
||||||
// Reverse child ID is required so expanding beatmap panels can appear above sections below them.
|
// Reverse child ID is required so expanding beatmap panels can appear above sections below them.
|
||||||
// This can also be done by setting Depth when adding new sections above if using ReverseChildID turns out to have any issues.
|
// This can also be done by setting Depth when adding new sections above if using ReverseChildID turns out to have any issues.
|
||||||
@ -267,6 +269,14 @@ namespace osu.Game.Overlays
|
|||||||
Padding = new MarginPadding { Horizontal = 10 },
|
Padding = new MarginPadding { Horizontal = 10 },
|
||||||
Margin = new MarginPadding { Bottom = 10 },
|
Margin = new MarginPadding { Bottom = 10 },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
// Ensure the scroll-to-top button is displayed above the fixed header.
|
||||||
|
AddInternal(scroll.Button.CreateProxy());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
@ -16,6 +14,7 @@ using osu.Game.Beatmaps;
|
|||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Screens.Edit;
|
using osu.Game.Screens.Edit;
|
||||||
using osu.Game.Screens.Edit.Compose;
|
using osu.Game.Screens.Edit.Compose;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -38,16 +37,18 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly HitObject HitObject;
|
public readonly HitObject HitObject;
|
||||||
|
|
||||||
[Resolved(canBeNull: true)]
|
[Resolved]
|
||||||
protected EditorClock EditorClock { get; private set; }
|
protected EditorClock EditorClock { get; private set; } = null!;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private EditorBeatmap beatmap { get; set; }
|
private EditorBeatmap beatmap { get; set; } = null!;
|
||||||
|
|
||||||
private Bindable<double> startTimeBindable;
|
private Bindable<double> startTimeBindable = null!;
|
||||||
|
|
||||||
|
private HitObject? getPreviousHitObject() => beatmap.HitObjects.TakeWhile(h => h.StartTime <= startTimeBindable.Value).LastOrDefault();
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IPlacementHandler placementHandler { get; set; }
|
private IPlacementHandler placementHandler { get; set; } = null!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether this blueprint is currently in a state that can be committed.
|
/// Whether this blueprint is currently in a state that can be committed.
|
||||||
@ -63,7 +64,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
HitObject = hitObject;
|
HitObject = hitObject;
|
||||||
|
|
||||||
// adding the default hit sample should be the case regardless of the ruleset.
|
// adding the default hit sample should be the case regardless of the ruleset.
|
||||||
HitObject.Samples.Add(new HitSampleInfo(HitSampleInfo.HIT_NORMAL, SampleControlPoint.DEFAULT_BANK, volume: 100));
|
HitObject.Samples.Add(new HitSampleInfo(HitSampleInfo.HIT_NORMAL));
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
@ -86,7 +87,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
protected void BeginPlacement(bool commitStart = false)
|
protected void BeginPlacement(bool commitStart = false)
|
||||||
{
|
{
|
||||||
// Take the hitnormal sample of the last hit object
|
// Take the hitnormal sample of the last hit object
|
||||||
var lastHitNormal = beatmap.HitObjects.LastOrDefault(h => h.GetEndTime() < HitObject.StartTime)?.Samples?.FirstOrDefault(o => o.Name == HitSampleInfo.HIT_NORMAL);
|
var lastHitNormal = getPreviousHitObject()?.Samples?.FirstOrDefault(o => o.Name == HitSampleInfo.HIT_NORMAL);
|
||||||
if (lastHitNormal != null)
|
if (lastHitNormal != null)
|
||||||
HitObject.Samples[0] = lastHitNormal;
|
HitObject.Samples[0] = lastHitNormal;
|
||||||
|
|
||||||
@ -148,7 +149,12 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
public virtual void UpdateTimeAndPosition(SnapResult result)
|
public virtual void UpdateTimeAndPosition(SnapResult result)
|
||||||
{
|
{
|
||||||
if (PlacementActive == PlacementState.Waiting)
|
if (PlacementActive == PlacementState.Waiting)
|
||||||
HitObject.StartTime = result.Time ?? EditorClock?.CurrentTime ?? Time.Current;
|
{
|
||||||
|
HitObject.StartTime = result.Time ?? EditorClock.CurrentTime;
|
||||||
|
|
||||||
|
if (HitObject is IHasComboInformation comboInformation)
|
||||||
|
comboInformation.UpdateComboInformation(getPreviousHitObject() as IHasComboInformation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -206,14 +206,20 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a SampleInfo based on the sample settings of the hit normal sample in <see cref="Samples"/>.
|
/// Create a <see cref="HitSampleInfo"/> based on the sample settings of the first <see cref="HitSampleInfo.HIT_NORMAL"/> sample in <see cref="Samples"/>.
|
||||||
|
/// If no sample is available, sane default settings will be used instead.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// In the case an existing sample exists, all settings apart from the sample name will be inherited. This includes volume, bank and suffix.
|
||||||
|
/// </remarks>
|
||||||
/// <param name="sampleName">The name of the sample.</param>
|
/// <param name="sampleName">The name of the sample.</param>
|
||||||
/// <returns>A populated <see cref="HitSampleInfo"/>.</returns>
|
/// <returns>A populated <see cref="HitSampleInfo"/>.</returns>
|
||||||
protected HitSampleInfo GetSampleInfo(string sampleName = HitSampleInfo.HIT_NORMAL)
|
public HitSampleInfo CreateHitSampleInfo(string sampleName = HitSampleInfo.HIT_NORMAL)
|
||||||
{
|
{
|
||||||
var hitnormalSample = Samples.FirstOrDefault(s => s.Name == HitSampleInfo.HIT_NORMAL);
|
if (Samples.FirstOrDefault(s => s.Name == HitSampleInfo.HIT_NORMAL) is HitSampleInfo existingSample)
|
||||||
return hitnormalSample == null ? new HitSampleInfo(sampleName) : hitnormalSample.With(newName: sampleName);
|
return existingSample.With(newName: sampleName);
|
||||||
|
|
||||||
|
return new HitSampleInfo(sampleName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ using System.Linq;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Extensions.EnumExtensions;
|
using osu.Framework.Extensions.EnumExtensions;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Beatmaps.Legacy;
|
using osu.Game.Beatmaps.Legacy;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osu.Game.Utils;
|
using osu.Game.Utils;
|
||||||
@ -479,12 +480,14 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
/// The bank identifier to use for the base ("hitnormal") sample.
|
/// The bank identifier to use for the base ("hitnormal") sample.
|
||||||
/// Transferred to <see cref="HitSampleInfo.Bank"/> when appropriate.
|
/// Transferred to <see cref="HitSampleInfo.Bank"/> when appropriate.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[CanBeNull]
|
||||||
public string BankForNormal;
|
public string BankForNormal;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The bank identifier to use for additions ("hitwhistle", "hitfinish", "hitclap").
|
/// The bank identifier to use for additions ("hitwhistle", "hitfinish", "hitclap").
|
||||||
/// Transferred to <see cref="HitSampleInfo.Bank"/> when appropriate.
|
/// Transferred to <see cref="HitSampleInfo.Bank"/> when appropriate.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[CanBeNull]
|
||||||
public string BankForAdditions;
|
public string BankForAdditions;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -518,17 +521,24 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
public readonly bool IsLayered;
|
public readonly bool IsLayered;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether a bank was specified locally to the relevant hitobject.
|
||||||
|
/// If <c>false</c>, a bank will be retrieved from the closest control point.
|
||||||
|
/// </summary>
|
||||||
|
public bool BankSpecified;
|
||||||
|
|
||||||
public LegacyHitSampleInfo(string name, string? bank = null, int volume = 0, int customSampleBank = 0, bool isLayered = false)
|
public LegacyHitSampleInfo(string name, string? bank = null, int volume = 0, int customSampleBank = 0, bool isLayered = false)
|
||||||
: base(name, bank, customSampleBank >= 2 ? customSampleBank.ToString() : null, volume)
|
: base(name, bank ?? SampleControlPoint.DEFAULT_BANK, customSampleBank >= 2 ? customSampleBank.ToString() : null, volume)
|
||||||
{
|
{
|
||||||
CustomSampleBank = customSampleBank;
|
CustomSampleBank = customSampleBank;
|
||||||
|
BankSpecified = !string.IsNullOrEmpty(bank);
|
||||||
IsLayered = isLayered;
|
IsLayered = isLayered;
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed override HitSampleInfo With(Optional<string> newName = default, Optional<string?> newBank = default, Optional<string?> newSuffix = default, Optional<int> newVolume = default)
|
public sealed override HitSampleInfo With(Optional<string> newName = default, Optional<string> newBank = default, Optional<string?> newSuffix = default, Optional<int> newVolume = default)
|
||||||
=> With(newName, newBank, newVolume);
|
=> With(newName, newBank, newVolume);
|
||||||
|
|
||||||
public virtual LegacyHitSampleInfo With(Optional<string> newName = default, Optional<string?> newBank = default, Optional<int> newVolume = default,
|
public virtual LegacyHitSampleInfo With(Optional<string> newName = default, Optional<string> newBank = default, Optional<int> newVolume = default,
|
||||||
Optional<int> newCustomSampleBank = default,
|
Optional<int> newCustomSampleBank = default,
|
||||||
Optional<bool> newIsLayered = default)
|
Optional<bool> newIsLayered = default)
|
||||||
=> new LegacyHitSampleInfo(newName.GetOr(Name), newBank.GetOr(Bank), newVolume.GetOr(Volume), newCustomSampleBank.GetOr(CustomSampleBank), newIsLayered.GetOr(IsLayered));
|
=> new LegacyHitSampleInfo(newName.GetOr(Name), newBank.GetOr(Bank), newVolume.GetOr(Volume), newCustomSampleBank.GetOr(CustomSampleBank), newIsLayered.GetOr(IsLayered));
|
||||||
@ -563,7 +573,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
Path.ChangeExtension(Filename, null)
|
Path.ChangeExtension(Filename, null)
|
||||||
};
|
};
|
||||||
|
|
||||||
public sealed override LegacyHitSampleInfo With(Optional<string> newName = default, Optional<string?> newBank = default, Optional<int> newVolume = default,
|
public sealed override LegacyHitSampleInfo With(Optional<string> newName = default, Optional<string> newBank = default, Optional<int> newVolume = default,
|
||||||
Optional<int> newCustomSampleBank = default,
|
Optional<int> newCustomSampleBank = default,
|
||||||
Optional<bool> newIsLayered = default)
|
Optional<bool> newIsLayered = default)
|
||||||
=> new FileHitSampleInfo(Filename, newVolume.GetOr(Volume));
|
=> new FileHitSampleInfo(Filename, newVolume.GetOr(Volume));
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
@ -65,5 +63,26 @@ namespace osu.Game.Rulesets.Objects.Types
|
|||||||
{
|
{
|
||||||
return skin.GetConfig<SkinComboColourLookup, Color4>(new SkinComboColourLookup(comboIndex, combo))?.Value ?? Color4.White;
|
return skin.GetConfig<SkinComboColourLookup, Color4>(new SkinComboColourLookup(comboIndex, combo))?.Value ?? Color4.White;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Given the previous object in the beatmap, update relevant combo information.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="lastObj">The previous hitobject, or null if this is the first object in the beatmap.</param>
|
||||||
|
void UpdateComboInformation(IHasComboInformation? lastObj)
|
||||||
|
{
|
||||||
|
ComboIndex = lastObj?.ComboIndex ?? 0;
|
||||||
|
ComboIndexWithOffsets = lastObj?.ComboIndexWithOffsets ?? 0;
|
||||||
|
IndexInCurrentCombo = (lastObj?.IndexInCurrentCombo + 1) ?? 0;
|
||||||
|
|
||||||
|
if (NewCombo || lastObj == null)
|
||||||
|
{
|
||||||
|
IndexInCurrentCombo = 0;
|
||||||
|
ComboIndex++;
|
||||||
|
ComboIndexWithOffsets += ComboOffset + 1;
|
||||||
|
|
||||||
|
if (lastObj != null)
|
||||||
|
lastObj.LastInCombo = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
|
|
||||||
case TernaryState.True:
|
case TernaryState.True:
|
||||||
if (existingSample == null)
|
if (existingSample == null)
|
||||||
samples.Add(new HitSampleInfo(sampleName));
|
samples.Add(CurrentPlacement.HitObject.CreateHitSampleInfo(sampleName));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
if (h.Samples.Any(s => s.Name == sampleName))
|
if (h.Samples.Any(s => s.Name == sampleName))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
h.Samples.Add(new HitSampleInfo(sampleName));
|
h.Samples.Add(h.CreateHitSampleInfo(sampleName));
|
||||||
EditorBeatmap.Update(h);
|
EditorBeatmap.Update(h);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -83,8 +83,9 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
{
|
{
|
||||||
placementBlueprint = CreateBlueprintFor(obj.NewValue).AsNonNull();
|
placementBlueprint = CreateBlueprintFor(obj.NewValue).AsNonNull();
|
||||||
|
|
||||||
placementBlueprint.Colour = Color4.MediumPurple;
|
placementBlueprint.Colour = OsuColour.Gray(0.9f);
|
||||||
|
|
||||||
|
// TODO: this is out of order, causing incorrect stacking height.
|
||||||
SelectionBlueprints.Add(placementBlueprint);
|
SelectionBlueprints.Add(placementBlueprint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,16 +93,22 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
protected override bool OnKeyDown(KeyDownEvent e)
|
protected override bool OnKeyDown(KeyDownEvent e)
|
||||||
{
|
{
|
||||||
updateText(e.ShiftPressed);
|
updateText(e);
|
||||||
return base.OnKeyDown(e);
|
return base.OnKeyDown(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnKeyUp(KeyUpEvent e)
|
protected override void OnKeyUp(KeyUpEvent e)
|
||||||
{
|
{
|
||||||
updateText(e.ShiftPressed);
|
updateText(e);
|
||||||
base.OnKeyUp(e);
|
base.OnKeyUp(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool OnMouseDown(MouseDownEvent e)
|
||||||
|
{
|
||||||
|
updateText(e);
|
||||||
|
return base.OnMouseDown(e);
|
||||||
|
}
|
||||||
|
|
||||||
protected override bool OnClick(ClickEvent e)
|
protected override bool OnClick(ClickEvent e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -119,14 +125,15 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
protected override void OnMouseUp(MouseUpEvent e)
|
protected override void OnMouseUp(MouseUpEvent e)
|
||||||
{
|
{
|
||||||
|
base.OnMouseUp(e);
|
||||||
|
|
||||||
if (e.Button == MouseButton.Right && IsHovered)
|
if (e.Button == MouseButton.Right && IsHovered)
|
||||||
{
|
{
|
||||||
rewindSearch = true;
|
rewindSearch = true;
|
||||||
TriggerClick();
|
TriggerClick();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
base.OnMouseUp(e);
|
updateText(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
|
public override bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
|
||||||
@ -151,10 +158,12 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateText(bool rewind = false)
|
private void updateText(UIEvent e)
|
||||||
{
|
{
|
||||||
randomSpriteText.Alpha = rewind ? 0 : 1;
|
bool aboutToRewind = e.ShiftPressed || e.CurrentState.Mouse.IsPressed(MouseButton.Right);
|
||||||
rewindSpriteText.Alpha = rewind ? 1 : 0;
|
|
||||||
|
randomSpriteText.Alpha = aboutToRewind ? 0 : 1;
|
||||||
|
rewindSpriteText.Alpha = aboutToRewind ? 1 : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user