1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-19 07:42:58 +08:00

Merge branch 'master' into fix-taiko-editor-type-stats

This commit is contained in:
Dean Herbert 2020-09-24 13:18:13 +09:00
commit 00b0228b61
13 changed files with 118 additions and 17 deletions

View File

@ -52,6 +52,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.904.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.911.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.923.1" />
</ItemGroup>
</Project>

View File

@ -46,7 +46,20 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
private void addConnection(FollowPointConnection connection)
{
// Groups are sorted by their start time when added such that the index can be used to post-process other surrounding connections
int index = connections.AddInPlace(connection, Comparer<FollowPointConnection>.Create((g1, g2) => g1.StartTime.Value.CompareTo(g2.StartTime.Value)));
int index = connections.AddInPlace(connection, Comparer<FollowPointConnection>.Create((g1, g2) =>
{
int comp = g1.StartTime.Value.CompareTo(g2.StartTime.Value);
if (comp != 0)
return comp;
// we always want to insert the new item after equal ones.
// this is important for beatmaps with multiple hitobjects at the same point in time.
// if we use standard comparison insert order, there will be a churn of connections getting re-updated to
// the next object at the point-in-time, adding a construction/disposal overhead (see FollowPointConnection.End implementation's ClearInternal).
// this is easily visible on https://osu.ppy.sh/beatmapsets/150945#osu/372245
return -1;
}));
if (index < connections.Count - 1)
{

View File

@ -22,6 +22,8 @@ namespace osu.Game.Rulesets.Taiko.Edit
yield return new TernaryStateMenuItem("Rim", action: state =>
{
ChangeHandler.BeginChange();
foreach (var h in hits)
{
switch (state)
@ -35,6 +37,8 @@ namespace osu.Game.Rulesets.Taiko.Edit
break;
}
}
ChangeHandler.EndChange();
})
{
State = { Value = getTernaryState(hits, h => h.Type == HitType.Rim) }
@ -47,6 +51,8 @@ namespace osu.Game.Rulesets.Taiko.Edit
yield return new TernaryStateMenuItem("Strong", action: state =>
{
ChangeHandler.BeginChange();
foreach (var h in hits)
{
switch (state)
@ -62,6 +68,8 @@ namespace osu.Game.Rulesets.Taiko.Edit
EditorBeatmap?.UpdateHitObject(h);
}
ChangeHandler.EndChange();
})
{
State = { Value = getTernaryState(hits, h => h.IsStrong) }

View File

@ -81,7 +81,7 @@ namespace osu.Game.Tests.Gameplay
private class TestHitObjectWithCombo : ConvertHitObject, IHasComboInformation
{
public bool NewCombo { get; } = false;
public bool NewCombo { get; set; } = false;
public int ComboOffset { get; } = 0;
public Bindable<int> IndexInCurrentComboBindable { get; } = new Bindable<int>();

View File

@ -68,7 +68,7 @@ namespace osu.Game.Tests.Visual.Online
public void TestMultipleLoads()
{
var comments = exampleComments;
int topLevelCommentCount = exampleComments.Comments.Count(comment => comment.IsTopLevel);
int topLevelCommentCount = exampleComments.Comments.Count;
AddStep("hide container", () => commentsContainer.Hide());
setUpCommentsResponse(comments);

View File

@ -78,7 +78,7 @@ namespace osu.Game.Rulesets.Edit
}
catch (Exception e)
{
Logger.Error(e, "Could not load beatmap sucessfully!");
Logger.Error(e, "Could not load beatmap successfully!");
return;
}

View File

@ -24,6 +24,11 @@ namespace osu.Game.Rulesets.Objects.Types
/// </summary>
int ComboIndex { get; set; }
/// <summary>
/// Whether the HitObject starts a new combo.
/// </summary>
new bool NewCombo { get; set; }
Bindable<bool> LastInComboBindable { get; }
/// <summary>

View File

@ -43,10 +43,20 @@ namespace osu.Game.Rulesets.UI
return true;
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
unbindStartTimeMap();
}
public virtual void Clear(bool disposeChildren = true)
{
ClearInternal(disposeChildren);
unbindStartTimeMap();
}
private void unbindStartTimeMap()
{
foreach (var kvp in startTimeMap)
kvp.Value.bindable.UnbindAll();
startTimeMap.Clear();

View File

@ -20,6 +20,7 @@ using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Objects.Types;
using osuTK;
namespace osu.Game.Screens.Edit.Compose.Components
@ -44,7 +45,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
protected EditorBeatmap EditorBeatmap { get; private set; }
[Resolved(CanBeNull = true)]
private IEditorChangeHandler changeHandler { get; set; }
protected IEditorChangeHandler ChangeHandler { get; private set; }
public SelectionHandler()
{
@ -193,12 +194,12 @@ namespace osu.Game.Screens.Edit.Compose.Components
private void deleteSelected()
{
changeHandler?.BeginChange();
ChangeHandler?.BeginChange();
foreach (var h in selectedBlueprints.ToList())
EditorBeatmap?.Remove(h.HitObject);
changeHandler?.EndChange();
ChangeHandler?.EndChange();
}
#endregion
@ -254,7 +255,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// <param name="sampleName">The name of the hit sample.</param>
public void AddHitSample(string sampleName)
{
changeHandler?.BeginChange();
ChangeHandler?.BeginChange();
foreach (var h in SelectedHitObjects)
{
@ -265,7 +266,30 @@ namespace osu.Game.Screens.Edit.Compose.Components
h.Samples.Add(new HitSampleInfo { Name = sampleName });
}
changeHandler?.EndChange();
ChangeHandler?.EndChange();
}
/// <summary>
/// Set the new combo state of all selected <see cref="HitObject"/>s.
/// </summary>
/// <param name="state">Whether to set or unset.</param>
/// <exception cref="InvalidOperationException">Throws if any selected object doesn't implement <see cref="IHasComboInformation"/></exception>
public void SetNewCombo(bool state)
{
ChangeHandler?.BeginChange();
foreach (var h in SelectedHitObjects)
{
var comboInfo = h as IHasComboInformation;
if (comboInfo == null)
throw new InvalidOperationException($"Tried to change combo state of a {h.GetType()}, which doesn't implement {nameof(IHasComboInformation)}");
comboInfo.NewCombo = state;
EditorBeatmap?.UpdateHitObject(h);
}
ChangeHandler?.EndChange();
}
/// <summary>
@ -274,12 +298,12 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// <param name="sampleName">The name of the hit sample.</param>
public void RemoveHitSample(string sampleName)
{
changeHandler?.BeginChange();
ChangeHandler?.BeginChange();
foreach (var h in SelectedHitObjects)
h.SamplesBindable.RemoveAll(s => s.Name == sampleName);
changeHandler?.EndChange();
ChangeHandler?.EndChange();
}
#endregion
@ -297,6 +321,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
items.AddRange(GetContextMenuItemsForSelection(selectedBlueprints));
if (selectedBlueprints.All(b => b.HitObject is IHasComboInformation))
items.Add(createNewComboMenuItem());
if (selectedBlueprints.Count == 1)
items.AddRange(selectedBlueprints[0].ContextMenuItems);
@ -326,6 +353,41 @@ namespace osu.Game.Screens.Edit.Compose.Components
protected virtual IEnumerable<MenuItem> GetContextMenuItemsForSelection(IEnumerable<SelectionBlueprint> selection)
=> Enumerable.Empty<MenuItem>();
private MenuItem createNewComboMenuItem()
{
return new TernaryStateMenuItem("New combo", MenuItemType.Standard, setNewComboState)
{
State = { Value = getHitSampleState() }
};
void setNewComboState(TernaryState state)
{
switch (state)
{
case TernaryState.False:
SetNewCombo(false);
break;
case TernaryState.True:
SetNewCombo(true);
break;
}
}
TernaryState getHitSampleState()
{
int countExisting = selectedBlueprints.Select(b => (IHasComboInformation)b.HitObject).Count(h => h.NewCombo);
if (countExisting == 0)
return TernaryState.False;
if (countExisting < SelectedHitObjects.Count())
return TernaryState.Indeterminate;
return TernaryState.True;
}
}
private MenuItem createHitSampleMenuItem(string name, string sampleName)
{
return new TernaryStateMenuItem(name, MenuItemType.Standard, setHitSampleState)

View File

@ -399,7 +399,7 @@ namespace osu.Game.Screens.Play
}
catch (Exception e)
{
Logger.Error(e, "Could not load beatmap sucessfully!");
Logger.Error(e, "Could not load beatmap successfully!");
//couldn't load, hard abort!
return null;
}

View File

@ -91,7 +91,10 @@ namespace osu.Game.Screens.Ranking.Statistics
{
var rows = new FillFlowContainer
{
RelativeSizeAxes = Axes.Both,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Direction = FillDirection.Vertical,
Spacing = new Vector2(30, 15),
Alpha = 0

View File

@ -24,7 +24,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="ppy.osu.Framework" Version="2020.911.0" />
<PackageReference Include="ppy.osu.Framework" Version="2020.923.1" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.904.0" />
<PackageReference Include="Sentry" Version="2.1.6" />
<PackageReference Include="SharpCompress" Version="0.26.0" />

View File

@ -70,7 +70,7 @@
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup Label="Package References">
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.911.0" />
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.923.1" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.904.0" />
</ItemGroup>
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->
@ -80,7 +80,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="ppy.osu.Framework" Version="2020.911.0" />
<PackageReference Include="ppy.osu.Framework" Version="2020.923.1" />
<PackageReference Include="SharpCompress" Version="0.26.0" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="SharpRaven" Version="2.4.0" />