mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 08:52:55 +08:00
Merge branch 'master' into lounge-leaderboard
This commit is contained in:
commit
0bf9e9b86b
@ -2,6 +2,7 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -9,6 +10,7 @@ using Newtonsoft.Json;
|
|||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.IO.Serialization;
|
using osu.Game.IO.Serialization;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps
|
namespace osu.Game.Beatmaps
|
||||||
{
|
{
|
||||||
@ -112,6 +114,11 @@ namespace osu.Game.Beatmaps
|
|||||||
[JsonProperty("difficulty_rating")]
|
[JsonProperty("difficulty_rating")]
|
||||||
public double StarDifficulty { get; set; }
|
public double StarDifficulty { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Currently only populated for beatmap deletion. Use <see cref="ScoreManager"/> to query scores.
|
||||||
|
/// </summary>
|
||||||
|
public List<ScoreInfo> Scores { get; set; }
|
||||||
|
|
||||||
public override string ToString() => $"{Metadata} [{Version}]";
|
public override string ToString() => $"{Metadata} [{Version}]";
|
||||||
|
|
||||||
public bool Equals(BeatmapInfo other)
|
public bool Equals(BeatmapInfo other)
|
||||||
|
@ -64,7 +64,8 @@ namespace osu.Game.Beatmaps
|
|||||||
base.AddIncludesForDeletion(query)
|
base.AddIncludesForDeletion(query)
|
||||||
.Include(s => s.Beatmaps).ThenInclude(b => b.Metadata)
|
.Include(s => s.Beatmaps).ThenInclude(b => b.Metadata)
|
||||||
.Include(s => s.Beatmaps).ThenInclude(b => b.BaseDifficulty)
|
.Include(s => s.Beatmaps).ThenInclude(b => b.BaseDifficulty)
|
||||||
.Include(s => s.Metadata);
|
.Include(s => s.Metadata)
|
||||||
|
.Include(s => s.Beatmaps).ThenInclude(b => b.Scores);
|
||||||
|
|
||||||
protected override IQueryable<BeatmapSetInfo> AddIncludesForConsumption(IQueryable<BeatmapSetInfo> query) =>
|
protected override IQueryable<BeatmapSetInfo> AddIncludesForConsumption(IQueryable<BeatmapSetInfo> query) =>
|
||||||
base.AddIncludesForConsumption(query)
|
base.AddIncludesForConsumption(query)
|
||||||
|
@ -8,7 +8,6 @@ using osuTK.Graphics;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
using osu.Framework.Configuration;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Framework.Graphics.Cursor;
|
using osu.Framework.Graphics.Cursor;
|
||||||
@ -33,38 +32,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
private readonly Box leftBox;
|
private readonly Box leftBox;
|
||||||
private readonly Box rightBox;
|
private readonly Box rightBox;
|
||||||
|
|
||||||
public virtual string TooltipText
|
public virtual string TooltipText { get; private set; }
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
var bindableDouble = CurrentNumber as BindableNumber<double>;
|
|
||||||
var bindableFloat = CurrentNumber as BindableNumber<float>;
|
|
||||||
var floatValue = bindableDouble?.Value ?? bindableFloat?.Value;
|
|
||||||
var floatPrecision = bindableDouble?.Precision ?? bindableFloat?.Precision;
|
|
||||||
|
|
||||||
if (floatValue != null)
|
|
||||||
{
|
|
||||||
var floatMinValue = bindableDouble?.MinValue ?? bindableFloat.MinValue;
|
|
||||||
var floatMaxValue = bindableDouble?.MaxValue ?? bindableFloat.MaxValue;
|
|
||||||
|
|
||||||
if (floatMaxValue == 1 && floatMinValue >= -1)
|
|
||||||
return floatValue.Value.ToString("P0");
|
|
||||||
|
|
||||||
var decimalPrecision = normalise((decimal)floatPrecision, max_decimal_digits);
|
|
||||||
|
|
||||||
// Find the number of significant digits (we could have less than 5 after normalize())
|
|
||||||
var significantDigits = findPrecision(decimalPrecision);
|
|
||||||
|
|
||||||
return floatValue.Value.ToString($"N{significantDigits}");
|
|
||||||
}
|
|
||||||
|
|
||||||
var bindableInt = CurrentNumber as BindableNumber<int>;
|
|
||||||
if (bindableInt != null)
|
|
||||||
return bindableInt.Value.ToString("N0");
|
|
||||||
|
|
||||||
return Current.Value.ToString(CultureInfo.InvariantCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Color4 accentColour;
|
private Color4 accentColour;
|
||||||
public Color4 AccentColour
|
public Color4 AccentColour
|
||||||
@ -136,21 +104,34 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
base.OnHoverLost(e);
|
base.OnHoverLost(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnUserChange()
|
protected override bool OnMouseDown(MouseDownEvent e)
|
||||||
{
|
{
|
||||||
base.OnUserChange();
|
Nub.Current.Value = true;
|
||||||
playSample();
|
return base.OnMouseDown(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void playSample()
|
protected override bool OnMouseUp(MouseUpEvent e)
|
||||||
|
{
|
||||||
|
Nub.Current.Value = false;
|
||||||
|
return base.OnMouseUp(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnUserChange(T value)
|
||||||
|
{
|
||||||
|
base.OnUserChange(value);
|
||||||
|
playSample(value);
|
||||||
|
updateTooltipText(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void playSample(T value)
|
||||||
{
|
{
|
||||||
if (Clock == null || Clock.CurrentTime - lastSampleTime <= 50)
|
if (Clock == null || Clock.CurrentTime - lastSampleTime <= 50)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Current.Value.Equals(lastSampleValue))
|
if (value.Equals(lastSampleValue))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lastSampleValue = Current.Value;
|
lastSampleValue = value;
|
||||||
|
|
||||||
lastSampleTime = Clock.CurrentTime;
|
lastSampleTime = Clock.CurrentTime;
|
||||||
sample.Frequency.Value = 1 + NormalizedValue * 0.2f;
|
sample.Frequency.Value = 1 + NormalizedValue * 0.2f;
|
||||||
@ -163,16 +144,28 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
sample.Play();
|
sample.Play();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseDown(MouseDownEvent e)
|
private void updateTooltipText(T value)
|
||||||
{
|
{
|
||||||
Nub.Current.Value = true;
|
if (CurrentNumber.IsInteger)
|
||||||
return base.OnMouseDown(e);
|
TooltipText = ((int)Convert.ChangeType(value, typeof(int))).ToString("N0");
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
double floatValue = (double)Convert.ChangeType(value, typeof(double));
|
||||||
|
double floatMinValue = (double)Convert.ChangeType(CurrentNumber.MinValue, typeof(double));
|
||||||
|
double floatMaxValue = (double)Convert.ChangeType(CurrentNumber.MaxValue, typeof(double));
|
||||||
|
|
||||||
protected override bool OnMouseUp(MouseUpEvent e)
|
if (floatMaxValue == 1 && floatMinValue >= -1)
|
||||||
{
|
TooltipText = floatValue.ToString("P0");
|
||||||
Nub.Current.Value = false;
|
else
|
||||||
return base.OnMouseUp(e);
|
{
|
||||||
|
var decimalPrecision = normalise((decimal)Convert.ChangeType(CurrentNumber.Precision, typeof(decimal)), max_decimal_digits);
|
||||||
|
|
||||||
|
// Find the number of significant digits (we could have less than 5 after normalize())
|
||||||
|
var significantDigits = findPrecision(decimalPrecision);
|
||||||
|
|
||||||
|
TooltipText = floatValue.ToString($"N{significantDigits}");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateAfterChildren()
|
protected override void UpdateAfterChildren()
|
||||||
|
@ -62,6 +62,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
fill.Width = value * UsableWidth;
|
fill.Width = value * UsableWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnUserChange() => OnSeek?.Invoke(Current);
|
protected override void OnUserChange(double value) => OnSeek?.Invoke(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ namespace osu.Game.Migrations
|
|||||||
{
|
{
|
||||||
#pragma warning disable 612, 618
|
#pragma warning disable 612, 618
|
||||||
modelBuilder
|
modelBuilder
|
||||||
.HasAnnotation("ProductVersion", "2.1.4-rtm-31024");
|
.HasAnnotation("ProductVersion", "2.2.0-rtm-35687");
|
||||||
|
|
||||||
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b =>
|
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b =>
|
||||||
{
|
{
|
||||||
@ -215,6 +215,25 @@ namespace osu.Game.Migrations
|
|||||||
b.ToTable("Settings");
|
b.ToTable("Settings");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("osu.Game.IO.FileInfo", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("ID")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<string>("Hash");
|
||||||
|
|
||||||
|
b.Property<int>("ReferenceCount");
|
||||||
|
|
||||||
|
b.HasKey("ID");
|
||||||
|
|
||||||
|
b.HasIndex("Hash")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.HasIndex("ReferenceCount");
|
||||||
|
|
||||||
|
b.ToTable("FileInfo");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("osu.Game.Input.Bindings.DatabasedKeyBinding", b =>
|
modelBuilder.Entity("osu.Game.Input.Bindings.DatabasedKeyBinding", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("ID")
|
b.Property<int>("ID")
|
||||||
@ -239,25 +258,6 @@ namespace osu.Game.Migrations
|
|||||||
b.ToTable("KeyBinding");
|
b.ToTable("KeyBinding");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("osu.Game.IO.FileInfo", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd();
|
|
||||||
|
|
||||||
b.Property<string>("Hash");
|
|
||||||
|
|
||||||
b.Property<int>("ReferenceCount");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.HasIndex("Hash")
|
|
||||||
.IsUnique();
|
|
||||||
|
|
||||||
b.HasIndex("ReferenceCount");
|
|
||||||
|
|
||||||
b.ToTable("FileInfo");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("osu.Game.Rulesets.RulesetInfo", b =>
|
modelBuilder.Entity("osu.Game.Rulesets.RulesetInfo", b =>
|
||||||
{
|
{
|
||||||
b.Property<int?>("ID")
|
b.Property<int?>("ID")
|
||||||
@ -454,7 +454,7 @@ namespace osu.Game.Migrations
|
|||||||
modelBuilder.Entity("osu.Game.Scoring.ScoreInfo", b =>
|
modelBuilder.Entity("osu.Game.Scoring.ScoreInfo", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("osu.Game.Beatmaps.BeatmapInfo", "Beatmap")
|
b.HasOne("osu.Game.Beatmaps.BeatmapInfo", "Beatmap")
|
||||||
.WithMany()
|
.WithMany("Scores")
|
||||||
.HasForeignKey("BeatmapInfoID")
|
.HasForeignKey("BeatmapInfoID")
|
||||||
.OnDelete(DeleteBehavior.Cascade);
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -18,7 +19,7 @@ namespace osu.Game.Overlays.Chat.Selection
|
|||||||
public readonly FillFlowContainer<ChannelListItem> ChannelFlow;
|
public readonly FillFlowContainer<ChannelListItem> ChannelFlow;
|
||||||
|
|
||||||
public IEnumerable<IFilterable> FilterableChildren => ChannelFlow.Children;
|
public IEnumerable<IFilterable> FilterableChildren => ChannelFlow.Children;
|
||||||
public IEnumerable<string> FilterTerms => new[] { Header };
|
public IEnumerable<string> FilterTerms => Array.Empty<string>();
|
||||||
public bool MatchingFilter
|
public bool MatchingFilter
|
||||||
{
|
{
|
||||||
set
|
set
|
||||||
|
@ -238,11 +238,11 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
{
|
{
|
||||||
case Key.Right:
|
case Key.Right:
|
||||||
beatDivisor.Next();
|
beatDivisor.Next();
|
||||||
OnUserChange();
|
OnUserChange(Current);
|
||||||
return true;
|
return true;
|
||||||
case Key.Left:
|
case Key.Left:
|
||||||
beatDivisor.Previous();
|
beatDivisor.Previous();
|
||||||
OnUserChange();
|
OnUserChange(Current);
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
@ -279,7 +279,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
var xPosition = (ToLocalSpace(screenSpaceMousePosition).X - RangePadding) / UsableWidth;
|
var xPosition = (ToLocalSpace(screenSpaceMousePosition).X - RangePadding) / UsableWidth;
|
||||||
|
|
||||||
CurrentNumber.Value = availableDivisors.OrderBy(d => Math.Abs(getMappedPosition(d) - xPosition)).First();
|
CurrentNumber.Value = availableDivisors.OrderBy(d => Math.Abs(getMappedPosition(d) - xPosition)).First();
|
||||||
OnUserChange();
|
OnUserChange(Current);
|
||||||
}
|
}
|
||||||
|
|
||||||
private float getMappedPosition(float divisor) => (float)Math.Pow((divisor - 1) / (availableDivisors.Last() - 1), 0.90f);
|
private float getMappedPosition(float divisor) => (float)Math.Pow((divisor - 1) / (availableDivisors.Last() - 1), 0.90f);
|
||||||
|
@ -112,6 +112,6 @@ namespace osu.Game.Screens.Play
|
|||||||
handleBase.X = xFill;
|
handleBase.X = xFill;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnUserChange() => OnSeek?.Invoke(Current);
|
protected override void OnUserChange(double value) => OnSeek?.Invoke(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.0" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2019.107.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2019.108.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.11.0" />
|
<PackageReference Include="NUnit" Version="3.11.0" />
|
||||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||||
|
Loading…
Reference in New Issue
Block a user