1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +08:00

Merge branch 'master' into song-bar-stats

This commit is contained in:
Dan Balasescu 2019-11-26 13:27:01 +09:00 committed by GitHub
commit 2aa13370df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
74 changed files with 306 additions and 129 deletions

View File

@ -2,3 +2,4 @@ M:System.Object.Equals(System.Object,System.Object)~System.Boolean;Don't use obj
M:System.Object.Equals(System.Object)~System.Boolean;Don't use object.Equals. Use IEquatable<T> or EqualityComparer<T>.Default instead.
M:System.ValueType.Equals(System.Object)~System.Boolean;Don't use object.Equals(Fallbacks to ValueType). Use IEquatable<T> or EqualityComparer<T>.Default instead.
T:System.IComparable;Don't use non-generic IComparable. Use generic version instead.
M:osu.Framework.Graphics.Sprites.SpriteText.#ctor;Use OsuSpriteText.

View File

@ -1,5 +1,5 @@
{
"msbuild-sdks": {
"Microsoft.Build.Traversal": "2.0.19"
"Microsoft.Build.Traversal": "2.0.24"
}
}

View File

@ -16,8 +16,6 @@
<AndroidSupportedAbis>armeabi-v7a;x86;arm64-v8a</AndroidSupportedAbis>
<AndroidEnableSGenConcurrent>true</AndroidEnableSGenConcurrent>
<MandroidI18n>cjk,mideast,other,rare,west</MandroidI18n>
<AndroidHttpClientHandlerType>System.Net.Http.HttpClientHandler</AndroidHttpClientHandlerType>
<AndroidTlsProvider>legacy</AndroidTlsProvider>
<AndroidLinkMode>SdkOnly</AndroidLinkMode>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>

View File

@ -11,12 +11,12 @@ using System;
using System.Collections.Generic;
using osu.Game.Skinning;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osuTK.Graphics;
using osu.Framework.Audio.Sample;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Textures;
using osu.Game.Audio;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Rulesets.Catch.Tests
{
@ -66,7 +66,7 @@ namespace osu.Game.Rulesets.Catch.Tests
RelativeSizeAxes = Axes.Both,
Colour = Color4.Blue
},
new SpriteText
new OsuSpriteText
{
Text = "custom"
}

View File

@ -55,7 +55,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty
// Longer maps are worth more
float lengthBonus =
0.95f + 0.4f * Math.Min(1.0f, numTotalHits / 3000.0f) +
(numTotalHits > 3000 ? (float)Math.Log10(numTotalHits / 3000.0f) * 0.5f : 0.0f);
(numTotalHits > 3000 ? MathF.Log10(numTotalHits / 3000.0f) * 0.5f : 0.0f);
// Longer maps are worth more
value *= lengthBonus;

View File

@ -4,8 +4,8 @@
using System;
using osuTK;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Catch.Objects.Drawable
@ -68,7 +68,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
protected override void UpdateStateTransforms(ArmedState state)
{
var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime;
var endTime = HitObject.GetEndTime();
using (BeginAbsoluteSequence(endTime, true))
{

View File

@ -99,8 +99,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
const float small_pulp = large_pulp_3 / 2;
Vector2 positionAt(float angle, float distance) => new Vector2(
distance * (float)Math.Sin(angle * Math.PI / 180),
distance * (float)Math.Cos(angle * Math.PI / 180));
distance * MathF.Sin(angle * MathF.PI / 180),
distance * MathF.Cos(angle * MathF.PI / 180));
switch (representation)
{

View File

@ -9,7 +9,6 @@ using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Tests.Beatmaps;
namespace osu.Game.Rulesets.Mania.Tests
@ -27,7 +26,7 @@ namespace osu.Game.Rulesets.Mania.Tests
yield return new ConvertValue
{
StartTime = hitObject.StartTime,
EndTime = (hitObject as IHasEndTime)?.EndTime ?? hitObject.StartTime,
EndTime = hitObject.GetEndTime(),
Column = ((ManiaHitObject)hitObject).Column
};
}

View File

@ -73,7 +73,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
{
BeatmapDifficulty difficulty = original.BeatmapInfo.BaseDifficulty;
int seed = (int)Math.Round(difficulty.DrainRate + difficulty.CircleSize) * 20 + (int)(difficulty.OverallDifficulty * 41.2) + (int)Math.Round(difficulty.ApproachRate);
int seed = (int)MathF.Round(difficulty.DrainRate + difficulty.CircleSize) * 20 + (int)(difficulty.OverallDifficulty * 41.2) + (int)MathF.Round(difficulty.ApproachRate);
Random = new FastRandom(seed);
return base.ConvertBeatmap(original);

View File

@ -77,7 +77,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
foreach (var obj in originalPattern.HitObjects)
{
if (!Precision.AlmostEquals(EndTime, (obj as IHasEndTime)?.EndTime ?? obj.StartTime))
if (!Precision.AlmostEquals(EndTime, obj.GetEndTime()))
intermediatePattern.Add(obj);
else
endTimePattern.Add(obj);

View File

@ -53,11 +53,11 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
if (allowSpecial && TotalColumns == 8)
{
const float local_x_divisor = 512f / 7;
return Math.Clamp((int)Math.Floor(position / local_x_divisor), 0, 6) + 1;
return Math.Clamp((int)MathF.Floor(position / local_x_divisor), 0, 6) + 1;
}
float localXDivisor = 512f / TotalColumns;
return Math.Clamp((int)Math.Floor(position / localXDivisor), 0, TotalColumns - 1);
return Math.Clamp((int)MathF.Floor(position / localXDivisor), 0, TotalColumns - 1);
}
/// <summary>

View File

@ -6,7 +6,6 @@ using System.Linq;
using osu.Game.Replays;
using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Replays;
namespace osu.Game.Rulesets.Mania.Replays
@ -84,7 +83,7 @@ namespace osu.Game.Rulesets.Mania.Replays
var currentObject = Beatmap.HitObjects[i];
var nextObjectInColumn = GetNextObject(i); // Get the next object that requires pressing the same button
double endTime = (currentObject as IHasEndTime)?.EndTime ?? currentObject.StartTime;
double endTime = currentObject.GetEndTime();
bool canDelayKeyUp = nextObjectInColumn == null ||
nextObjectInColumn.StartTime > endTime + RELEASE_DELAY;

View File

@ -6,7 +6,6 @@ using System.Collections.Generic;
using NUnit.Framework;
using osu.Framework.MathUtils;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Tests.Beatmaps;
@ -44,7 +43,7 @@ namespace osu.Game.Rulesets.Osu.Tests
ConvertValue createConvertValue(OsuHitObject obj) => new ConvertValue
{
StartTime = obj.StartTime,
EndTime = (obj as IHasEndTime)?.EndTime ?? obj.StartTime,
EndTime = obj.GetEndTime(),
X = obj.StackedPosition.X,
Y = obj.StackedPosition.Y
};

View File

@ -16,6 +16,7 @@ using osu.Game.Audio;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Screens.Play;
using osu.Game.Skinning;
@ -125,7 +126,7 @@ namespace osu.Game.Rulesets.Osu.Tests
{
if (!enabled) return null;
return new SpriteText
return new OsuSpriteText
{
Text = identifier,
Font = OsuFont.Default.With(size: 30),

View File

@ -4,7 +4,7 @@
using System;
using osu.Framework.Graphics;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Osu.Objects;
using osuTK;
@ -62,7 +62,7 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
if (objectN is Spinner)
continue;
double endTime = (stackBaseObject as IHasEndTime)?.EndTime ?? stackBaseObject.StartTime;
double endTime = stackBaseObject.GetEndTime();
double stackThreshold = objectN.TimePreempt * beatmap.BeatmapInfo.StackLeniency;
if (objectN.StartTime - endTime > stackThreshold)
@ -121,7 +121,7 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
OsuHitObject objectN = beatmap.HitObjects[n];
if (objectN is Spinner) continue;
double endTime = (objectN as IHasEndTime)?.EndTime ?? objectN.StartTime;
double endTime = objectN.GetEndTime();
if (objectI.StartTime - endTime > stackThreshold)
//We are no longer within stacking range of the previous object.
@ -199,7 +199,7 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
if (currHitObject.StackHeight != 0 && !(currHitObject is Slider))
continue;
double startTime = (currHitObject as IHasEndTime)?.EndTime ?? currHitObject.StartTime;
double startTime = currHitObject.GetEndTime();
int sliderStack = 0;
for (int j = i + 1; j < beatmap.HitObjects.Count; j++)
@ -217,14 +217,14 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
if (Vector2Extensions.Distance(beatmap.HitObjects[j].Position, currHitObject.Position) < stack_distance)
{
currHitObject.StackHeight++;
startTime = (beatmap.HitObjects[j] as IHasEndTime)?.EndTime ?? beatmap.HitObjects[j].StartTime;
startTime = beatmap.HitObjects[j].GetEndTime();
}
else if (Vector2Extensions.Distance(beatmap.HitObjects[j].Position, position2) < stack_distance)
{
//Case for sliders - bump notes down and right, rather than up and left.
sliderStack++;
beatmap.HitObjects[j].StackHeight -= sliderStack;
startTime = (beatmap.HitObjects[j] as IHasEndTime)?.EndTime ?? beatmap.HitObjects[j].StartTime;
startTime = beatmap.HitObjects[j].GetEndTime();
}
}
}

View File

@ -6,9 +6,9 @@ using System.Collections.Generic;
using System.Linq;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu.Objects;
namespace osu.Game.Rulesets.Osu.Mods
@ -48,7 +48,7 @@ namespace osu.Game.Rulesets.Osu.Mods
var fadeOutDuration = h.TimePreempt * fade_out_duration_multiplier;
// new duration from completed fade in to end (before fading out)
var longFadeDuration = ((h as IHasEndTime)?.EndTime ?? h.StartTime) - fadeOutStartTime;
var longFadeDuration = h.GetEndTime() - fadeOutStartTime;
switch (drawable)
{

View File

@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Osu.Mods
float appearDistance = (float)(hitObject.TimePreempt - hitObject.TimeFadeIn) / 2;
Vector2 originalPosition = drawable.Position;
Vector2 appearOffset = new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appearDistance;
Vector2 appearOffset = new Vector2(MathF.Cos(theta), MathF.Sin(theta)) * appearDistance;
//the - 1 and + 1 prevents the hit objects to appear in the wrong position.
double appearTime = hitObject.StartTime - hitObject.TimePreempt - 1;

View File

@ -6,7 +6,7 @@ using JetBrains.Annotations;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Objects;
using osuTK;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
@ -99,7 +99,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
Vector2 startPosition = osuStart.EndPosition;
Vector2 endPosition = osuEnd.Position;
double startTime = (osuStart as IHasEndTime)?.EndTime ?? osuStart.StartTime;
double startTime = osuStart.GetEndTime();
double endTime = osuEnd.StartTime;
Vector2 distanceVector = endPosition - startPosition;

View File

@ -120,7 +120,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
break;
}
float aimRotation = MathHelper.RadiansToDegrees((float)Math.Atan2(aimRotationVector.Y - Position.Y, aimRotationVector.X - Position.X));
float aimRotation = MathHelper.RadiansToDegrees(MathF.Atan2(aimRotationVector.Y - Position.Y, aimRotationVector.X - Position.X));
while (Math.Abs(aimRotation - Rotation) > 180)
aimRotation += aimRotation < Rotation ? 360 : -360;

View File

@ -20,9 +20,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
Anchor = Anchor.Centre;
RelativeSizeAxes = Axes.Both;
const int count = 18;
const float count = 18;
for (int i = 0; i < count; i++)
for (float i = 0; i < count; i++)
{
Add(new Container
{
@ -40,10 +40,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
Size = new Vector2(60, 10),
Origin = Anchor.Centre,
Position = new Vector2(
0.5f + (float)Math.Sin((float)i / count * 2 * MathHelper.Pi) / 2 * 0.86f,
0.5f + (float)Math.Cos((float)i / count * 2 * MathHelper.Pi) / 2 * 0.86f
0.5f + MathF.Sin(i / count * 2 * MathF.PI) / 2 * 0.86f,
0.5f + MathF.Cos(i / count * 2 * MathF.PI) / 2 * 0.86f
),
Rotation = -(float)i / count * 360 + 90,
Rotation = -i / count * 360 + 90,
Children = new[]
{
new Box

View File

@ -10,7 +10,7 @@ using System.Diagnostics;
using System.Linq;
using osu.Framework.Graphics;
using osu.Game.Replays;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Osu.Beatmaps;
using osu.Game.Rulesets.Osu.Scoring;
using osu.Game.Rulesets.Scoring;
@ -96,7 +96,7 @@ namespace osu.Game.Rulesets.Osu.Replays
private void addDelayedMovements(OsuHitObject h, OsuHitObject prev)
{
double endTime = (prev as IHasEndTime)?.EndTime ?? prev.StartTime;
double endTime = prev.GetEndTime();
HitWindows hitWindows = null;
@ -185,14 +185,14 @@ namespace osu.Game.Rulesets.Osu.Replays
{
Vector2 spinCentreOffset = SPINNER_CENTRE - prevPos;
float distFromCentre = spinCentreOffset.Length;
float distToTangentPoint = (float)Math.Sqrt(distFromCentre * distFromCentre - SPIN_RADIUS * SPIN_RADIUS);
float distToTangentPoint = MathF.Sqrt(distFromCentre * distFromCentre - SPIN_RADIUS * SPIN_RADIUS);
if (distFromCentre > SPIN_RADIUS)
{
// Previous cursor position was outside spin circle, set startPosition to the tangent point.
// Angle between centre offset and tangent point offset.
float angle = (float)Math.Asin(SPIN_RADIUS / distFromCentre);
float angle = MathF.Asin(SPIN_RADIUS / distFromCentre);
if (angle > 0)
{
@ -204,8 +204,8 @@ namespace osu.Game.Rulesets.Osu.Replays
}
// Rotate by angle so it's parallel to tangent line
spinCentreOffset.X = spinCentreOffset.X * (float)Math.Cos(angle) - spinCentreOffset.Y * (float)Math.Sin(angle);
spinCentreOffset.Y = spinCentreOffset.X * (float)Math.Sin(angle) + spinCentreOffset.Y * (float)Math.Cos(angle);
spinCentreOffset.X = spinCentreOffset.X * MathF.Cos(angle) - spinCentreOffset.Y * MathF.Sin(angle);
spinCentreOffset.Y = spinCentreOffset.X * MathF.Sin(angle) + spinCentreOffset.Y * MathF.Cos(angle);
// Set length to distToTangentPoint
spinCentreOffset.Normalize();
@ -275,7 +275,7 @@ namespace osu.Game.Rulesets.Osu.Replays
var startFrame = new OsuReplayFrame(h.StartTime, new Vector2(startPosition.X, startPosition.Y), action);
// TODO: Why do we delay 1 ms if the object is a spinner? There already is KEY_UP_DELAY from hEndTime.
double hEndTime = ((h as IHasEndTime)?.EndTime ?? h.StartTime) + KEY_UP_DELAY;
double hEndTime = h.GetEndTime() + KEY_UP_DELAY;
int endDelay = h is Spinner ? 1 : 0;
var endFrame = new OsuReplayFrame(hEndTime + endDelay, new Vector2(h.StackedEndPosition.X, h.StackedEndPosition.Y));
@ -331,7 +331,7 @@ namespace osu.Game.Rulesets.Osu.Replays
Vector2 difference = startPosition - SPINNER_CENTRE;
float radius = difference.Length;
float angle = radius == 0 ? 0 : (float)Math.Atan2(difference.Y, difference.X);
float angle = radius == 0 ? 0 : MathF.Atan2(difference.Y, difference.X);
double t;

View File

@ -6,7 +6,6 @@ using System.Collections.Generic;
using NUnit.Framework;
using osu.Framework.MathUtils;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Taiko.Objects;
using osu.Game.Tests.Beatmaps;
@ -27,7 +26,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
yield return new ConvertValue
{
StartTime = hitObject.StartTime,
EndTime = (hitObject as IHasEndTime)?.EndTime ?? hitObject.StartTime,
EndTime = hitObject.GetEndTime(),
IsRim = hitObject is RimHit,
IsCentre = hitObject is CentreHit,
IsDrumRoll = hitObject is DrumRoll,

View File

@ -0,0 +1,2 @@
[General]
Version: 2

View File

@ -0,0 +1,2 @@
[General]
Version: latest

View File

@ -59,5 +59,32 @@ namespace osu.Game.Tests.Skins
Assert.AreEqual("TestValue", config.ConfigDictionary["TestLookup"]);
}
}
[Test]
public void TestDecodeSpecifiedVersion()
{
var decoder = new LegacySkinDecoder();
using (var resStream = TestResources.OpenResource("skin-20.ini"))
using (var stream = new LineBufferedReader(resStream))
Assert.AreEqual(2.0m, decoder.Decode(stream).LegacyVersion);
}
[Test]
public void TestDecodeLatestVersion()
{
var decoder = new LegacySkinDecoder();
using (var resStream = TestResources.OpenResource("skin-latest.ini"))
using (var stream = new LineBufferedReader(resStream))
Assert.AreEqual(LegacySkinConfiguration.LATEST_VERSION, decoder.Decode(stream).LegacyVersion);
}
[Test]
public void TestDecodeNoVersion()
{
var decoder = new LegacySkinDecoder();
using (var resStream = TestResources.OpenResource("skin-empty.ini"))
using (var stream = new LineBufferedReader(resStream))
Assert.IsNull(decoder.Decode(stream).LegacyVersion);
}
}
}

View File

@ -116,6 +116,14 @@ namespace osu.Game.Tests.Skins
});
}
[Test]
public void TestLegacyVersionLookup()
{
AddStep("Set source1 version 2.3", () => source1.Configuration.LegacyVersion = 2.3m);
AddStep("Set source2 version null", () => source2.Configuration.LegacyVersion = null);
AddAssert("Check legacy version lookup", () => requester.GetConfig<LegacySkinConfiguration.LegacySetting, decimal>(LegacySkinConfiguration.LegacySetting.Version)?.Value == 2.3m);
}
public enum LookupType
{
Test

View File

@ -9,7 +9,7 @@ using osu.Game.Rulesets.Judgements;
using osu.Framework.MathUtils;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets.Catch.Scoring;
using osu.Game.Rulesets.Mania.Scoring;
using osu.Game.Rulesets.Osu.Scoring;
@ -85,9 +85,9 @@ namespace osu.Game.Tests.Visual.Gameplay
AutoSizeAxes = Axes.Both,
Children = new[]
{
new SpriteText { Text = $@"Great: {hitWindows?.WindowFor(HitResult.Great)}" },
new SpriteText { Text = $@"Good: {hitWindows?.WindowFor(HitResult.Good)}" },
new SpriteText { Text = $@"Meh: {hitWindows?.WindowFor(HitResult.Meh)}" },
new OsuSpriteText { Text = $@"Great: {hitWindows?.WindowFor(HitResult.Great)}" },
new OsuSpriteText { Text = $@"Good: {hitWindows?.WindowFor(HitResult.Good)}" },
new OsuSpriteText { Text = $@"Meh: {hitWindows?.WindowFor(HitResult.Meh)}" },
}
});

View File

@ -42,6 +42,7 @@ namespace osu.Game.Tests.Visual.Online
typeof(BeatmapAvailability),
typeof(BeatmapRulesetSelector),
typeof(BeatmapRulesetTabItem),
typeof(NotSupporterPlaceholder)
};
protected override bool UseOnlineAPI => true;

View File

@ -13,6 +13,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Bindables;
using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets;
namespace osu.Game.Tests.Visual.Online
@ -45,7 +46,7 @@ namespace osu.Game.Tests.Visual.Online
modSelector.SelectedMods.ItemsAdded += mods =>
{
mods.ForEach(mod => selectedMods.Add(new SpriteText
mods.ForEach(mod => selectedMods.Add(new OsuSpriteText
{
Text = mod.Acronym,
}));

View File

@ -6,6 +6,7 @@ using System.Collections.Generic;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Overlays.Rankings;
using osu.Game.Users;
using osuTK;
@ -45,7 +46,7 @@ namespace osu.Game.Tests.Visual.Online
Size = new Vector2(30, 20),
Country = countryA,
},
text = new SpriteText
text = new OsuSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,

View File

@ -11,7 +11,7 @@ using osu.Game.Rulesets;
using osu.Game.Rulesets.Mania;
using osu.Game.Users;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets.Taiko;
using osu.Game.Graphics.UserInterface;
@ -94,11 +94,11 @@ namespace osu.Game.Tests.Visual.Online
AddRange(new Drawable[]
{
new SpriteText
new OsuSpriteText
{
Text = $@"Username: {user.NewValue?.Username}"
},
new SpriteText
new OsuSpriteText
{
Text = $@"RankedScore: {user.NewValue?.Statistics.RankedScore}"
},

View File

@ -57,7 +57,7 @@ namespace osu.Game.Tournament.Screens.Drawings.Components
groups.Add(g);
nextGroupName++;
if (i < (int)Math.Ceiling(numGroups / 2f))
if (i < (int)MathF.Ceiling(numGroups / 2f))
topGroups.Add(g);
else
bottomGroups.Add(g);

View File

@ -100,7 +100,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
var diff = Math.Max(score1.Value, score2.Value) - Math.Min(score1.Value, score2.Value);
losingBar.ResizeWidthTo(0, 400, Easing.OutQuint);
winningBar.ResizeWidthTo(Math.Min(0.4f, (float)Math.Pow(diff / 1500000f, 0.5) / 2), 400, Easing.OutQuint);
winningBar.ResizeWidthTo(Math.Min(0.4f, MathF.Pow(diff / 1500000f, 0.5f) / 2), 400, Easing.OutQuint);
}
protected override void Update()

View File

@ -12,13 +12,13 @@ using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Framework.Input;
using osu.Framework.IO.Stores;
using osu.Framework.Platform;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Online.API.Requests;
using osu.Game.Tournament.IPC;
using osu.Game.Tournament.Models;
@ -104,7 +104,7 @@ namespace osu.Game.Tournament
Colour = Color4.Red,
RelativeSizeAxes = Axes.Both,
},
new SpriteText
new OsuSpriteText
{
Text = "Please make the window wider",
Font = OsuFont.Default.With(weight: "bold"),
@ -202,7 +202,8 @@ namespace osu.Game.Tournament
{
foreach (var p in t.Players)
{
PopulateUser(p);
if (p.Username == null || p.Statistics == null)
PopulateUser(p);
addedInfo = true;
}
}
@ -243,7 +244,6 @@ namespace osu.Game.Tournament
{
user.Username = res.Username;
user.Statistics = res.Statistics;
user.Username = res.Username;
user.Country = res.Country;
user.Cover = res.Cover;

View File

@ -25,7 +25,7 @@ using osu.Game.IO.Archives;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Objects;
namespace osu.Game.Beatmaps
{
@ -334,7 +334,8 @@ namespace osu.Game.Beatmaps
var lastObject = b.HitObjects.Last();
double endTime = (lastObject as IHasEndTime)?.EndTime ?? lastObject.StartTime;
//TODO: this isn't always correct (consider mania where a non-last object may last for longer than the last in the list).
double endTime = lastObject.GetEndTime();
double startTime = b.HitObjects.First().StartTime;
return endTime - startTime;

View File

@ -111,7 +111,7 @@ namespace osu.Game.Graphics.Backgrounds
float adjustedAlpha = HideAlphaDiscrepancies
// Cubically scale alpha to make it drop off more sharply.
? (float)Math.Pow(DrawColourInfo.Colour.AverageColour.Linear.A, 3)
? MathF.Pow(DrawColourInfo.Colour.AverageColour.Linear.A, 3)
: 1;
float elapsedSeconds = (float)Time.Elapsed / 1000;

View File

@ -10,7 +10,7 @@ using osuTK;
namespace osu.Game.Graphics.UserInterface
{
public class DimmedLoadingLayer : VisibilityContainer
public class DimmedLoadingLayer : OverlayContainer
{
private const float transition_duration = 250;

View File

@ -150,7 +150,7 @@ namespace osu.Game.Online.API
private class DisplayableError
{
[JsonProperty("error")]
public string ErrorMessage;
public string ErrorMessage { get; set; }
}
}

View File

@ -15,6 +15,6 @@ namespace osu.Game.Online.API.Requests
this.beatmap = beatmap;
}
protected override string Target => $@"beatmaps/lookup?id={beatmap.OnlineBeatmapID}&checksum={beatmap.MD5Hash}&filename={System.Uri.EscapeUriString(beatmap.Path)}";
protected override string Target => $@"beatmaps/lookup?id={beatmap.OnlineBeatmapID}&checksum={beatmap.MD5Hash}&filename={System.Uri.EscapeUriString(beatmap.Path ?? string.Empty)}";
}
}

View File

@ -0,0 +1,49 @@
// 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.
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osuTK;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
namespace osu.Game.Overlays.BeatmapSet.Scores
{
public class NotSupporterPlaceholder : Container
{
public NotSupporterPlaceholder()
{
LinkFlowContainer text;
AutoSizeAxes = Axes.Both;
Child = new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 10),
Children = new Drawable[]
{
new OsuSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Text = @"You need to be an osu!supporter to access the friend and country rankings!",
Font = OsuFont.GetFont(weight: FontWeight.Bold),
},
text = new LinkFlowContainer(t => t.Font = t.Font.With(size: 12))
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Direction = FillDirection.Horizontal,
AutoSizeAxes = Axes.Both,
}
}
};
text.AddText("Click ");
text.AddLink("here", "/home/support");
text.AddText(" to see all the fancy features that you can get!");
}
}
}

View File

@ -26,17 +26,17 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
public readonly Bindable<BeatmapInfo> Beatmap = new Bindable<BeatmapInfo>();
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
private readonly Bindable<BeatmapLeaderboardScope> scope = new Bindable<BeatmapLeaderboardScope>();
private readonly Bindable<BeatmapLeaderboardScope> scope = new Bindable<BeatmapLeaderboardScope>(BeatmapLeaderboardScope.Global);
private readonly Bindable<User> user = new Bindable<User>();
private readonly Box background;
private readonly ScoreTable scoreTable;
private readonly FillFlowContainer topScoresContainer;
private readonly DimmedLoadingLayer loading;
private readonly FillFlowContainer filterControls;
private readonly LeaderboardModSelector modSelector;
private readonly NoScoresPlaceholder noScoresPlaceholder;
private readonly FillFlowContainer content;
private readonly NotSupporterPlaceholder notSupporterPlaceholder;
[Resolved]
private IAPIProvider api { get; set; }
@ -93,21 +93,24 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
Margin = new MarginPadding { Vertical = spacing },
Children = new Drawable[]
{
filterControls = new FillFlowContainer
new FillFlowContainer
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
AutoSizeAxes = Axes.Both,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, spacing),
Children = new Drawable[]
{
new LeaderboardScopeSelector
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Current = { BindTarget = scope }
},
modSelector = new LeaderboardModSelector
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Ruleset = { BindTarget = ruleset }
}
}
@ -127,6 +130,12 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
AlwaysPresent = true,
Margin = new MarginPadding { Vertical = 10 }
},
notSupporterPlaceholder = new NotSupporterPlaceholder
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Alpha = 0,
},
new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
@ -204,9 +213,12 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
private void onUserChanged(ValueChangedEvent<User> user)
{
scope.Value = BeatmapLeaderboardScope.Global;
modSelector.DeselectAll();
filterControls.FadeTo(api.IsLoggedIn && api.LocalUser.Value.IsSupporter ? 1 : 0);
if (modSelector.SelectedMods.Any())
modSelector.DeselectAll();
else
getScores();
modSelector.FadeTo(userIsSupporter ? 1 : 0);
}
private void getScores()
@ -223,6 +235,16 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
return;
}
if (scope.Value != BeatmapLeaderboardScope.Global && !userIsSupporter)
{
Scores = null;
notSupporterPlaceholder.Show();
loading.Hide();
return;
}
notSupporterPlaceholder.Hide();
content.Show();
loading.Show();
@ -238,5 +260,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
api.Queue(getScoresRequest);
}
private bool userIsSupporter => api.IsLoggedIn && api.LocalUser.Value.IsSupporter;
}
}

View File

@ -16,6 +16,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Overlays.Chat
{
@ -202,7 +203,7 @@ namespace osu.Game.Overlays.Chat
RelativeSizeAxes = Axes.X,
Height = lineHeight,
},
text = new SpriteText
text = new OsuSpriteText
{
Margin = new MarginPadding { Horizontal = 10 },
Text = time.ToLocalTime().ToString("dd MMM yyyy"),

View File

@ -10,6 +10,7 @@ using osu.Game.Graphics;
using osu.Framework.Graphics.Sprites;
using osuTK;
using osu.Framework.Input.Events;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Overlays.Comments
{
@ -48,7 +49,7 @@ namespace osu.Game.Overlays.Comments
Origin = Anchor.CentreLeft,
Children = new Drawable[]
{
new SpriteText
new OsuSpriteText
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
@ -101,7 +102,7 @@ namespace osu.Game.Overlays.Comments
Origin = Anchor.CentreLeft,
Size = new Vector2(10),
},
new SpriteText
new OsuSpriteText
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,

View File

@ -8,6 +8,7 @@ using osu.Framework.Graphics.Sprites;
using osuTK;
using osu.Framework.Bindables;
using Humanizer;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Overlays.Comments
{
@ -31,7 +32,7 @@ namespace osu.Game.Overlays.Comments
Icon = FontAwesome.Solid.Trash,
Size = new Vector2(14),
},
countText = new SpriteText
countText = new OsuSpriteText
{
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true),
}

View File

@ -14,6 +14,7 @@ using osu.Framework.Graphics.Cursor;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Shapes;
using System.Linq;
using osu.Game.Graphics.Sprites;
using osu.Game.Online.Chat;
namespace osu.Game.Overlays.Comments
@ -123,7 +124,7 @@ namespace osu.Game.Overlays.Comments
AutoSizeAxes = Axes.Both,
},
new ParentUsername(comment),
new SpriteText
new OsuSpriteText
{
Alpha = comment.IsDeleted ? 1 : 0,
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true),
@ -145,7 +146,7 @@ namespace osu.Game.Overlays.Comments
Colour = OsuColour.Gray(0.7f),
Children = new Drawable[]
{
new SpriteText
new OsuSpriteText
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
@ -196,7 +197,7 @@ namespace osu.Game.Overlays.Comments
if (comment.EditedAt.HasValue)
{
info.Add(new SpriteText
info.Add(new OsuSpriteText
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
@ -291,7 +292,7 @@ namespace osu.Game.Overlays.Comments
this.count = count;
Alpha = count == 0 ? 0 : 1;
Child = text = new SpriteText
Child = text = new OsuSpriteText
{
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
};
@ -324,7 +325,7 @@ namespace osu.Game.Overlays.Comments
Icon = FontAwesome.Solid.Reply,
Size = new Vector2(14),
},
new SpriteText
new OsuSpriteText
{
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true),
Text = parentComment?.User?.Username ?? parentComment?.LegacyName

View File

@ -11,6 +11,7 @@ using osu.Game.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Framework.Bindables;
using osu.Framework.Allocation;
using osu.Game.Graphics.Sprites;
using osuTK.Graphics;
namespace osu.Game.Overlays.Comments
@ -61,7 +62,7 @@ namespace osu.Game.Overlays.Comments
public TabButton(CommentsSortCriteria value)
{
Add(text = new SpriteText
Add(text = new OsuSpriteText
{
Font = OsuFont.GetFont(size: 14),
Text = value.ToString()

View File

@ -9,6 +9,7 @@ using osu.Framework.Graphics.Sprites;
using osuTK;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Overlays.Comments
{
@ -32,7 +33,7 @@ namespace osu.Game.Overlays.Comments
Spacing = new Vector2(5, 0),
Children = new Drawable[]
{
new SpriteText
new OsuSpriteText
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
@ -52,7 +53,7 @@ namespace osu.Game.Overlays.Comments
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.Gray(0.05f)
},
counter = new SpriteText
counter = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,

View File

@ -110,7 +110,7 @@ namespace osu.Game.Overlays.Comments
}
}
},
sideNumber = new SpriteText
sideNumber = new OsuSpriteText
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreRight,

View File

@ -167,7 +167,7 @@ namespace osu.Game.Overlays.Mods
Spacing = new Vector2(50f, 0f),
Margin = new MarginPadding
{
Top = 6,
Top = 20,
},
AlwaysPresent = true
},

View File

@ -390,7 +390,7 @@ namespace osu.Game.Overlays
Vector2 change = e.MousePosition - e.MouseDownPosition;
// Diminish the drag distance as we go further to simulate "rubber band" feeling.
change *= change.Length <= 0 ? 0 : (float)Math.Pow(change.Length, 0.7f) / change.Length;
change *= change.Length <= 0 ? 0 : MathF.Pow(change.Length, 0.7f) / change.Length;
this.MoveTo(change);
return true;

View File

@ -11,6 +11,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Events;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Users;
using osuTK;
@ -63,7 +64,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
new Drawable[]
{
hoverIcon = new HoverIconContainer(),
header = new SpriteText
header = new OsuSpriteText
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,

View File

@ -90,7 +90,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
placeholder.FadeOut(fade_duration, Easing.Out);
graph.DefaultValueCount = ranks.Length;
graph.Values = ranks.Select(x => -(float)Math.Log(x.Value));
graph.Values = ranks.Select(x => -MathF.Log(x.Value));
}
graph.FadeTo(ranks.Length > 1 ? 1 : 0, fade_duration, Easing.Out);
@ -187,7 +187,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
public void HideBar() => bar.FadeOut(fade_duration);
private int calculateIndex(float mouseXPosition) => (int)Math.Round(mouseXPosition / DrawWidth * (DefaultValueCount - 1));
private int calculateIndex(float mouseXPosition) => (int)MathF.Round(mouseXPosition / DrawWidth * (DefaultValueCount - 1));
private Vector2 calculateBallPosition(int index)
{

View File

@ -9,6 +9,7 @@ using osu.Framework.Graphics;
using osuTK;
using osu.Game.Graphics;
using osu.Framework.Allocation;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Overlays.Rankings
{
@ -41,13 +42,13 @@ namespace osu.Game.Overlays.Rankings
Margin = new MarginPadding { Bottom = flag_margin },
Size = new Vector2(30, 20),
},
scopeText = new SpriteText
scopeText = new OsuSpriteText
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Light)
},
new SpriteText
new OsuSpriteText
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,

View File

@ -225,7 +225,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
{
username = new OsuTextBox
{
PlaceholderText = "email address",
PlaceholderText = "username",
RelativeSizeAxes = Axes.X,
Text = api?.ProvidedUsername ?? string.Empty,
TabbableContentContainer = this
@ -239,7 +239,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
},
new SettingsCheckbox
{
LabelText = "Remember email address",
LabelText = "Remember username",
Bindable = config.GetBindable<bool>(OsuSetting.SaveUsername),
},
new SettingsCheckbox

View File

@ -8,7 +8,6 @@ using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.UI;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
namespace osu.Game.Rulesets.Mods
{
@ -42,7 +41,7 @@ namespace osu.Game.Rulesets.Mods
HitObject lastObject = beatmap.HitObjects.LastOrDefault();
beginRampTime = beatmap.HitObjects.FirstOrDefault()?.StartTime ?? 0;
finalRateTime = final_rate_progress * ((lastObject as IHasEndTime)?.EndTime ?? lastObject?.StartTime ?? 0);
finalRateTime = final_rate_progress * (lastObject?.GetEndTime() ?? 0);
}
public virtual void Update(Playfield playfield)

View File

@ -6,7 +6,6 @@ using System.Linq;
using osu.Framework.MathUtils;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Objects.Types;
namespace osu.Game.Rulesets.Objects
{
@ -28,7 +27,7 @@ namespace osu.Game.Rulesets.Objects
return;
HitObject lastObject = beatmap.HitObjects.Last();
double lastHitTime = 1 + ((lastObject as IHasEndTime)?.EndTime ?? lastObject.StartTime);
double lastHitTime = 1 + lastObject.GetEndTime();
var timingPoints = beatmap.ControlPointInfo.TimingPoints;

View File

@ -382,7 +382,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
if (Result != null && Result.HasResult)
{
var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime;
var endTime = HitObject.GetEndTime();
if (Result.TimeOffset + endTime > Time.Current)
{
@ -460,7 +460,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
throw new InvalidOperationException($"{GetType().ReadableName()} applied a {nameof(JudgementResult)} but did not update {nameof(JudgementResult.Type)}.");
// Ensure that the judgement is given a valid time offset, because this may not get set by the caller
var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime;
var endTime = HitObject.GetEndTime();
Result.TimeOffset = Math.Min(HitObject.HitWindows.WindowFor(HitResult.Miss), Time.Current - endTime);
@ -495,7 +495,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
if (Judged)
return false;
var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime;
var endTime = HitObject.GetEndTime();
CheckForResult(userTriggered, Time.Current - endTime);
return Judged;

View File

@ -158,4 +158,17 @@ namespace osu.Game.Rulesets.Objects
[NotNull]
protected virtual HitWindows CreateHitWindows() => new HitWindows();
}
public static class HitObjectExtensions
{
/// <summary>
/// Returns the end time of this object.
/// </summary>
/// <remarks>
/// This returns the <see cref="IHasEndTime.EndTime"/> where available, falling back to <see cref="HitObject.StartTime"/> otherwise.
/// </remarks>
/// <param name="hitObject">The object.</param>
/// <returns>The end time of this object.</returns>
public static double GetEndTime(this HitObject hitObject) => (hitObject as IHasEndTime)?.EndTime ?? hitObject.StartTime;
}
}

View File

@ -224,7 +224,7 @@ namespace osu.Game.Rulesets.UI
Playfield.PostProcess();
foreach (var mod in mods.OfType<IApplicableToDrawableHitObjects>())
mod.ApplyToDrawableHitObjects(Playfield.HitObjectContainer.Objects);
mod.ApplyToDrawableHitObjects(Playfield.AllHitObjects);
}
public override void RequestResume(Action continueResume)

View File

@ -15,7 +15,6 @@ using osu.Game.Configuration;
using osu.Game.Input.Bindings;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Timing;
using osu.Game.Rulesets.UI.Scrolling.Algorithms;
@ -112,7 +111,7 @@ namespace osu.Game.Rulesets.UI.Scrolling
[BackgroundDependencyLoader]
private void load()
{
double lastObjectTime = (Objects.LastOrDefault() as IHasEndTime)?.EndTime ?? Objects.LastOrDefault()?.StartTime ?? double.MaxValue;
double lastObjectTime = Objects.LastOrDefault()?.GetEndTime() ?? double.MaxValue;
double baseBeatLength = TimingControlPoint.DEFAULT_BEAT_LENGTH;
if (RelativeScaleBeatLengths)

View File

@ -73,7 +73,7 @@ namespace osu.Game.Screens.Backgrounds
Schedule(() =>
{
if ((Background as BeatmapBackground)?.Beatmap == beatmap)
if ((Background as BeatmapBackground)?.Beatmap.BeatmapInfo.BackgroundEquals(beatmap?.BeatmapInfo) ?? false)
return;
cancellationSource?.Cancel();

View File

@ -289,7 +289,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
OnUserChange(Current.Value);
}
private float getMappedPosition(float divisor) => (float)Math.Pow((divisor - 1) / (availableDivisors.Last() - 1), 0.90f);
private float getMappedPosition(float divisor) => MathF.Pow((divisor - 1) / (availableDivisors.Last() - 1), 0.90f);
private class Tick : CompositeDrawable
{

View File

@ -75,7 +75,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
float distance = direction.Length;
float radius = DistanceSpacing;
int radialCount = Math.Clamp((int)Math.Round(distance / radius), 1, MaxIntervals);
int radialCount = Math.Clamp((int)MathF.Round(distance / radius), 1, MaxIntervals);
Vector2 normalisedDirection = direction * new Vector2(1f / distance);
Vector2 snappedPosition = CentrePosition + normalisedDirection * radialCount * radius;

View File

@ -10,7 +10,6 @@ using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osuTK;
namespace osu.Game.Screens.Edit.Compose.Components
@ -70,7 +69,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
[BackgroundDependencyLoader]
private void load()
{
StartTime = (hitObject as IHasEndTime)?.EndTime ?? hitObject.StartTime;
StartTime = hitObject.GetEndTime();
}
protected override void LoadComplete()

View File

@ -206,8 +206,8 @@ namespace osu.Game.Screens.Menu
continue;
float rotation = MathHelper.DegreesToRadians(i / (float)bars_per_visualiser * 360 + j * 360 / visualiser_rounds);
float rotationCos = (float)Math.Cos(rotation);
float rotationSin = (float)Math.Sin(rotation);
float rotationCos = MathF.Cos(rotation);
float rotationSin = MathF.Sin(rotation);
//taking the cos and sin to the 0..1 range
var barPosition = new Vector2(rotationCos / 2 + 0.5f, rotationSin / 2 + 0.5f) * size;

View File

@ -12,7 +12,6 @@ using System.Linq;
using osu.Framework.Bindables;
using osu.Framework.Timing;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.UI;
namespace osu.Game.Screens.Play
@ -34,7 +33,8 @@ namespace osu.Game.Screens.Play
public override bool HandleNonPositionalInput => AllowSeeking;
public override bool HandlePositionalInput => AllowSeeking;
private double lastHitTime => ((objects.Last() as IHasEndTime)?.EndTime ?? objects.Last().StartTime) + 1;
//TODO: this isn't always correct (consider mania where a non-last object may last for longer than the last in the list).
private double lastHitTime => objects.Last().GetEndTime() + 1;
private double firstHitTime => objects.First().StartTime;

View File

@ -4,7 +4,6 @@
using System.Linq;
using System.Collections.Generic;
using System.Diagnostics;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Objects;
namespace osu.Game.Screens.Play
@ -26,7 +25,7 @@ namespace osu.Game.Screens.Play
return;
var firstHit = objects.First().StartTime;
var lastHit = objects.Max(o => (o as IHasEndTime)?.EndTime ?? o.StartTime);
var lastHit = objects.Max(o => o.GetEndTime());
if (lastHit == 0)
lastHit = objects.Last().StartTime;
@ -35,7 +34,7 @@ namespace osu.Game.Screens.Play
foreach (var h in objects)
{
var endTime = (h as IHasEndTime)?.EndTime ?? h.StartTime;
var endTime = h.GetEndTime();
Debug.Assert(endTime >= h.StartTime);

View File

@ -670,8 +670,8 @@ namespace osu.Game.Screens.Select
{
// The radius of the circle the carousel moves on.
const float circle_radius = 3;
double discriminant = Math.Max(0, circle_radius * circle_radius - dist * dist);
float x = (circle_radius - (float)Math.Sqrt(discriminant)) * halfHeight;
float discriminant = MathF.Max(0, circle_radius * circle_radius - dist * dist);
float x = (circle_radius - MathF.Sqrt(discriminant)) * halfHeight;
return 125 + x;
}

View File

@ -34,7 +34,7 @@ namespace osu.Game.Screens.Select.Details
if ((Beatmap?.Ruleset?.ID ?? 0) == 3)
{
firstValue.Title = "Key Amount";
firstValue.Value = (int)Math.Round(Beatmap?.BaseDifficulty?.CircleSize ?? 0);
firstValue.Value = (int)MathF.Round(Beatmap?.BaseDifficulty?.CircleSize ?? 0);
}
else
{

View File

@ -20,6 +20,8 @@ namespace osu.Game.Skinning
new Color4(18, 124, 255, 255),
new Color4(242, 24, 57, 255),
});
Configuration.LegacyVersion = 2.0m;
}
public static SkinInfo Info { get; } = new SkinInfo

View File

@ -26,6 +26,12 @@ namespace osu.Game.Skinning
[CanBeNull]
protected IResourceStore<SampleChannel> Samples;
public new LegacySkinConfiguration Configuration
{
get => base.Configuration as LegacySkinConfiguration;
set => base.Configuration = value;
}
public LegacySkin(SkinInfo skin, IResourceStore<byte[]> storage, AudioManager audioManager)
: this(skin, new LegacySkinResourceStore<SkinFileInfo>(skin, storage), audioManager, "skin.ini")
{
@ -42,7 +48,7 @@ namespace osu.Game.Skinning
Configuration = new LegacySkinDecoder().Decode(reader);
}
else
Configuration = new DefaultSkinConfiguration();
Configuration = new LegacySkinConfiguration { LegacyVersion = LegacySkinConfiguration.LATEST_VERSION };
if (storage != null)
{
@ -74,6 +80,18 @@ namespace osu.Game.Skinning
case GlobalSkinColour colour:
return SkinUtils.As<TValue>(getCustomColour(colour.ToString()));
case LegacySkinConfiguration.LegacySetting legacy:
switch (legacy)
{
case LegacySkinConfiguration.LegacySetting.Version:
if (Configuration.LegacyVersion is decimal version)
return SkinUtils.As<TValue>(new Bindable<decimal>(version));
break;
}
break;
case SkinCustomColourLookup customColour:
return SkinUtils.As<TValue>(getCustomColour(customColour.Lookup.ToString()));

View File

@ -0,0 +1,20 @@
// 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.
namespace osu.Game.Skinning
{
public class LegacySkinConfiguration : DefaultSkinConfiguration
{
public const decimal LATEST_VERSION = 2.7m;
/// <summary>
/// Legacy version of this skin.
/// </summary>
public decimal? LegacyVersion { get; internal set; }
public enum LegacySetting
{
Version,
}
}
}

View File

@ -1,18 +1,19 @@
// 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.
using System.Globalization;
using osu.Game.Beatmaps.Formats;
namespace osu.Game.Skinning
{
public class LegacySkinDecoder : LegacyDecoder<DefaultSkinConfiguration>
public class LegacySkinDecoder : LegacyDecoder<LegacySkinConfiguration>
{
public LegacySkinDecoder()
: base(1)
{
}
protected override void ParseLine(DefaultSkinConfiguration skin, Section section, string line)
protected override void ParseLine(LegacySkinConfiguration skin, Section section, string line)
{
if (section != Section.Colours)
{
@ -32,6 +33,14 @@ namespace osu.Game.Skinning
case @"Author":
skin.SkinInfo.Creator = pair.Value;
return;
case @"Version":
if (pair.Value == "latest")
skin.LegacyVersion = LegacySkinConfiguration.LATEST_VERSION;
else if (decimal.TryParse(pair.Value, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out var version))
skin.LegacyVersion = version;
return;
}
break;

View File

@ -86,6 +86,6 @@
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="SharpRaven" Version="2.4.0" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.6.0" />
<PackageReference Include="ppy.osu.Framework.NativeLibs" Version="2019.1112.0" ExcludeAssets="all" />
<PackageReference Include="ppy.osu.Framework.NativeLibs" Version="2019.1104.0" ExcludeAssets="all" />
</ItemGroup>
</Project>