2019-03-27 07:55:46 +00:00
|
|
|
// 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.
|
|
|
|
|
2022-06-17 07:37:17 +00:00
|
|
|
#nullable disable
|
|
|
|
|
2019-03-27 07:55:46 +00:00
|
|
|
using osu.Game.Rulesets.Scoring;
|
|
|
|
|
|
|
|
namespace osu.Game.Scoring.Legacy
|
|
|
|
{
|
2019-12-03 06:38:57 +00:00
|
|
|
public static class ScoreInfoExtensions
|
2019-03-27 07:55:46 +00:00
|
|
|
{
|
2019-12-03 06:28:10 +00:00
|
|
|
public static int? GetCountGeki(this ScoreInfo scoreInfo)
|
2019-03-27 07:55:46 +00:00
|
|
|
{
|
2021-12-13 08:09:13 +00:00
|
|
|
switch (scoreInfo.Ruleset.OnlineID)
|
2019-03-27 07:55:46 +00:00
|
|
|
{
|
2019-12-03 06:28:10 +00:00
|
|
|
case 3:
|
2020-05-07 03:22:07 +00:00
|
|
|
return getCount(scoreInfo, HitResult.Perfect);
|
2019-03-27 07:55:46 +00:00
|
|
|
}
|
2019-12-03 06:28:10 +00:00
|
|
|
|
|
|
|
return null;
|
2019-03-27 07:55:46 +00:00
|
|
|
}
|
|
|
|
|
2019-12-03 06:28:10 +00:00
|
|
|
public static void SetCountGeki(this ScoreInfo scoreInfo, int value)
|
|
|
|
{
|
2021-12-13 08:09:13 +00:00
|
|
|
switch (scoreInfo.Ruleset.OnlineID)
|
2019-12-03 06:28:10 +00:00
|
|
|
{
|
|
|
|
case 3:
|
|
|
|
scoreInfo.Statistics[HitResult.Perfect] = value;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2019-03-27 07:55:46 +00:00
|
|
|
|
2020-09-29 08:16:55 +00:00
|
|
|
public static int? GetCount300(this ScoreInfo scoreInfo) => getCount(scoreInfo, HitResult.Great);
|
2019-12-03 06:28:10 +00:00
|
|
|
|
2020-09-29 08:16:55 +00:00
|
|
|
public static void SetCount300(this ScoreInfo scoreInfo, int value) => scoreInfo.Statistics[HitResult.Great] = value;
|
2019-03-27 07:55:46 +00:00
|
|
|
|
2019-12-03 06:28:10 +00:00
|
|
|
public static int? GetCountKatu(this ScoreInfo scoreInfo)
|
2019-03-27 07:55:46 +00:00
|
|
|
{
|
2021-12-13 08:09:13 +00:00
|
|
|
switch (scoreInfo.Ruleset.OnlineID)
|
2019-03-27 07:55:46 +00:00
|
|
|
{
|
2019-12-03 06:28:10 +00:00
|
|
|
case 3:
|
2020-05-07 03:22:07 +00:00
|
|
|
return getCount(scoreInfo, HitResult.Good);
|
2020-04-16 09:16:08 +00:00
|
|
|
|
|
|
|
case 2:
|
2020-05-07 03:22:07 +00:00
|
|
|
return getCount(scoreInfo, HitResult.SmallTickMiss);
|
2019-03-27 07:55:46 +00:00
|
|
|
}
|
2019-12-03 06:28:10 +00:00
|
|
|
|
|
|
|
return null;
|
2019-03-27 07:55:46 +00:00
|
|
|
}
|
|
|
|
|
2019-12-03 06:28:10 +00:00
|
|
|
public static void SetCountKatu(this ScoreInfo scoreInfo, int value)
|
|
|
|
{
|
2021-12-13 08:09:13 +00:00
|
|
|
switch (scoreInfo.Ruleset.OnlineID)
|
2019-12-03 06:28:10 +00:00
|
|
|
{
|
|
|
|
case 3:
|
|
|
|
scoreInfo.Statistics[HitResult.Good] = value;
|
|
|
|
break;
|
2020-04-16 09:16:08 +00:00
|
|
|
|
|
|
|
case 2:
|
|
|
|
scoreInfo.Statistics[HitResult.SmallTickMiss] = value;
|
|
|
|
break;
|
2019-12-03 06:28:10 +00:00
|
|
|
}
|
|
|
|
}
|
2019-03-27 07:55:46 +00:00
|
|
|
|
2019-12-03 06:28:10 +00:00
|
|
|
public static int? GetCount100(this ScoreInfo scoreInfo)
|
2019-03-27 07:55:46 +00:00
|
|
|
{
|
2021-12-13 08:09:13 +00:00
|
|
|
switch (scoreInfo.Ruleset.OnlineID)
|
2019-03-27 07:55:46 +00:00
|
|
|
{
|
2019-12-03 06:28:10 +00:00
|
|
|
case 0:
|
|
|
|
case 1:
|
|
|
|
case 3:
|
2020-05-07 03:22:07 +00:00
|
|
|
return getCount(scoreInfo, HitResult.Ok);
|
2020-04-16 09:16:08 +00:00
|
|
|
|
|
|
|
case 2:
|
2020-05-07 03:22:07 +00:00
|
|
|
return getCount(scoreInfo, HitResult.LargeTickHit);
|
2019-03-27 07:55:46 +00:00
|
|
|
}
|
2019-12-03 06:28:10 +00:00
|
|
|
|
|
|
|
return null;
|
2019-03-27 07:55:46 +00:00
|
|
|
}
|
|
|
|
|
2019-12-03 06:28:10 +00:00
|
|
|
public static void SetCount100(this ScoreInfo scoreInfo, int value)
|
|
|
|
{
|
2021-12-13 08:09:13 +00:00
|
|
|
switch (scoreInfo.Ruleset.OnlineID)
|
2019-12-03 06:28:10 +00:00
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
case 1:
|
|
|
|
case 3:
|
|
|
|
scoreInfo.Statistics[HitResult.Ok] = value;
|
|
|
|
break;
|
2020-04-16 09:16:08 +00:00
|
|
|
|
|
|
|
case 2:
|
|
|
|
scoreInfo.Statistics[HitResult.LargeTickHit] = value;
|
|
|
|
break;
|
2019-12-03 06:28:10 +00:00
|
|
|
}
|
|
|
|
}
|
2019-03-27 07:55:46 +00:00
|
|
|
|
2019-12-03 06:28:10 +00:00
|
|
|
public static int? GetCount50(this ScoreInfo scoreInfo)
|
2019-03-27 07:55:46 +00:00
|
|
|
{
|
2021-12-13 08:09:13 +00:00
|
|
|
switch (scoreInfo.Ruleset.OnlineID)
|
2019-03-27 07:55:46 +00:00
|
|
|
{
|
2019-12-03 06:28:10 +00:00
|
|
|
case 0:
|
|
|
|
case 3:
|
2020-05-07 03:22:07 +00:00
|
|
|
return getCount(scoreInfo, HitResult.Meh);
|
2020-04-16 09:16:08 +00:00
|
|
|
|
|
|
|
case 2:
|
2020-05-07 03:22:07 +00:00
|
|
|
return getCount(scoreInfo, HitResult.SmallTickHit);
|
2019-03-27 07:55:46 +00:00
|
|
|
}
|
2019-12-03 06:28:10 +00:00
|
|
|
|
|
|
|
return null;
|
2019-03-27 07:55:46 +00:00
|
|
|
}
|
|
|
|
|
2019-12-03 06:28:10 +00:00
|
|
|
public static void SetCount50(this ScoreInfo scoreInfo, int value)
|
2019-03-27 07:55:46 +00:00
|
|
|
{
|
2021-12-13 08:09:13 +00:00
|
|
|
switch (scoreInfo.Ruleset.OnlineID)
|
2019-12-03 06:28:10 +00:00
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
case 3:
|
|
|
|
scoreInfo.Statistics[HitResult.Meh] = value;
|
|
|
|
break;
|
2020-04-16 09:16:08 +00:00
|
|
|
|
|
|
|
case 2:
|
|
|
|
scoreInfo.Statistics[HitResult.SmallTickHit] = value;
|
|
|
|
break;
|
2019-12-03 06:28:10 +00:00
|
|
|
}
|
2019-03-27 07:55:46 +00:00
|
|
|
}
|
2019-12-03 06:28:10 +00:00
|
|
|
|
|
|
|
public static int? GetCountMiss(this ScoreInfo scoreInfo) =>
|
2020-05-07 03:22:07 +00:00
|
|
|
getCount(scoreInfo, HitResult.Miss);
|
2019-12-03 06:28:10 +00:00
|
|
|
|
|
|
|
public static void SetCountMiss(this ScoreInfo scoreInfo, int value) =>
|
|
|
|
scoreInfo.Statistics[HitResult.Miss] = value;
|
2020-05-07 03:22:07 +00:00
|
|
|
|
|
|
|
private static int? getCount(ScoreInfo scoreInfo, HitResult result)
|
|
|
|
{
|
2021-10-27 04:04:41 +00:00
|
|
|
if (scoreInfo.Statistics.TryGetValue(result, out int existing))
|
2020-05-07 03:22:07 +00:00
|
|
|
return existing;
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
2019-03-27 07:55:46 +00:00
|
|
|
}
|
|
|
|
}
|