Skip to content

Commit

Permalink
Merge branch 'master' into sharpen
Browse files Browse the repository at this point in the history
  • Loading branch information
huoyaoyuan committed Nov 26, 2019
2 parents 8239c2d + 3fb2f6e commit c0fe91a
Show file tree
Hide file tree
Showing 113 changed files with 1,111 additions and 283 deletions.
1 change: 1 addition & 0 deletions CodeAnalysis/BannedSymbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"msbuild-sdks": {
"Microsoft.Build.Traversal": "2.0.19"
"Microsoft.Build.Traversal": "2.0.24"
}
}
4 changes: 1 addition & 3 deletions osu.Android.props
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,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>
Expand Down Expand Up @@ -56,6 +54,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.1010.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2019.1121.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2019.1122.0" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions osu.Game.Rulesets.Catch.Tests/TestSceneCatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
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
{
Expand Down Expand Up @@ -66,7 +66,7 @@ public CatcherCustomSkin()
RelativeSizeAxes = Axes.Both,
Colour = Color4.Blue
},
new SpriteText
new OsuSpriteText
{
Text = "custom"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public override double Calculate(Dictionary<string, double> categoryDifficulty =
// 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -68,7 +68,7 @@ protected override void CheckForResult(bool userTriggered, double timeOffset)

protected override void UpdateStateTransforms(ArmedState state)
{
var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime;
var endTime = HitObject.GetEndTime();

using (BeginAbsoluteSequence(endTime, true))
{
Expand Down
4 changes: 2 additions & 2 deletions osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ private Framework.Graphics.Drawable createPulp(FruitVisualRepresentation represe
const float small_pulp = large_pulp_3 / 2;

static 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)
{
Expand Down
3 changes: 1 addition & 2 deletions osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
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
Expand All @@ -27,7 +26,7 @@ protected override IEnumerable<ConvertValue> CreateConvertValue(HitObject hitObj
yield return new ConvertValue
{
StartTime = hitObject.StartTime,
EndTime = (hitObject as IHasEndTime)?.EndTime ?? hitObject.StartTime,
EndTime = hitObject.GetEndTime(),
Column = ((ManiaHitObject)hitObject).Column
};
}
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ protected override Beatmap<ManiaHitObject> ConvertBeatmap(IBeatmap original)
{
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public override IEnumerable<Pattern> Generate()

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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ protected int GetColumn(float position, bool allowSpecial = false)
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>
Expand Down
3 changes: 1 addition & 2 deletions osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
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
Expand Down Expand Up @@ -84,7 +83,7 @@ private IEnumerable<IActionPoint> generateActionPoints()
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;
Expand Down
3 changes: 1 addition & 2 deletions osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
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;

Expand Down Expand Up @@ -44,7 +43,7 @@ protected override IEnumerable<ConvertValue> CreateConvertValue(HitObject hitObj
static 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
};
Expand Down
10 changes: 6 additions & 4 deletions osu.Game.Rulesets.Osu.Tests/TestSceneSkinFallbacks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
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;
using osu.Game.Storyboards;
using osu.Game.Tests.Visual;

namespace osu.Game.Rulesets.Osu.Tests
Expand Down Expand Up @@ -75,14 +77,14 @@ private void checkNextHitObject(string skin) =>

protected override Player CreatePlayer(Ruleset ruleset) => new SkinProvidingPlayer(testUserSkin);

protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap) => new CustomSkinWorkingBeatmap(beatmap, Clock, audio, testBeatmapSkin);
protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard = null) => new CustomSkinWorkingBeatmap(beatmap, storyboard, Clock, audio, testBeatmapSkin);

public class CustomSkinWorkingBeatmap : ClockBackedTestWorkingBeatmap
{
private readonly ISkinSource skin;

public CustomSkinWorkingBeatmap(IBeatmap beatmap, IFrameBasedClock frameBasedClock, AudioManager audio, ISkinSource skin)
: base(beatmap, frameBasedClock, audio)
public CustomSkinWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard, IFrameBasedClock frameBasedClock, AudioManager audio, ISkinSource skin)
: base(beatmap, storyboard, frameBasedClock, audio)
{
this.skin = skin;
}
Expand Down Expand Up @@ -124,7 +126,7 @@ public Drawable GetDrawableComponent(ISkinComponent component)
{
if (!enabled) return null;

return new SpriteText
return new OsuSpriteText
{
Text = identifier,
Font = OsuFont.Default.With(size: 30),
Expand Down
5 changes: 3 additions & 2 deletions osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerRotation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using osuTK;
using System.Collections.Generic;
using System.Linq;
using osu.Game.Storyboards;
using static osu.Game.Tests.Visual.OsuTestScene.ClockBackedTestWorkingBeatmap;

namespace osu.Game.Rulesets.Osu.Tests
Expand All @@ -28,9 +29,9 @@ public class TestSceneSpinnerRotation : TestSceneOsuPlayer

protected override bool Autoplay => true;

protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap)
protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard = null)
{
var working = new ClockBackedTestWorkingBeatmap(beatmap, new FramedClock(new ManualClock { Rate = 1 }), audioManager);
var working = new ClockBackedTestWorkingBeatmap(beatmap, storyboard, new FramedClock(new ManualClock { Rate = 1 }), audioManager);
track = (TrackVirtualManual)working.Track;
return working;
}
Expand Down
12 changes: 6 additions & 6 deletions osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -62,7 +62,7 @@ private void applyStacking(Beatmap<OsuHitObject> beatmap, int startIndex, int en
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)
Expand Down Expand Up @@ -121,7 +121,7 @@ private void applyStacking(Beatmap<OsuHitObject> beatmap, int startIndex, int en
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.
Expand Down Expand Up @@ -199,7 +199,7 @@ private void applyStackingOld(Beatmap<OsuHitObject> beatmap)
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++)
Expand All @@ -217,14 +217,14 @@ private void applyStackingOld(Beatmap<OsuHitObject> beatmap)
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();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ public HitCirclePiece()
Origin = Anchor.Centre;

Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);

CornerRadius = Size.X / 2;
CornerExponent = 2;

InternalChild = new RingPiece();
}
Expand Down
4 changes: 2 additions & 2 deletions osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
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
Expand Down Expand Up @@ -48,7 +48,7 @@ protected override void ApplyHiddenState(DrawableHitObject drawable, ArmedState
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)
{
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@ public FollowPoint()
{
Origin = Anchor.Centre;

Child = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.FollowPoint), _ => new Container
Child = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.FollowPoint), _ => new CircularContainer
{
Masking = true,
AutoSizeAxes = Axes.Both,
CornerRadius = width / 2,
EdgeEffect = new EdgeEffectParameters
{
Type = EdgeEffectType.Glow,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
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
Expand Down Expand Up @@ -99,7 +99,7 @@ private void refresh()

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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public void UpdateSnakingPosition(Vector2 start, Vector2 end)
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;

Expand Down
2 changes: 2 additions & 0 deletions osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/CirclePiece.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ public CirclePiece()
{
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
Masking = true;

CornerRadius = Size.X / 2;
CornerExponent = 2;

Anchor = Anchor.Centre;
Origin = Anchor.Centre;
Expand Down
3 changes: 1 addition & 2 deletions osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/RingPiece.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ public RingPiece()
Anchor = Anchor.Centre;
Origin = Anchor.Centre;

InternalChild = new Container
InternalChild = new CircularContainer
{
Masking = true,
CornerRadius = Size.X / 2,
BorderThickness = 10,
BorderColour = Color4.White,
RelativeSizeAxes = Axes.Both,
Expand Down
Loading

0 comments on commit c0fe91a

Please sign in to comment.