1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-21 03:43:21 +08:00

Merge remote-tracking branch 'refs/remotes/ppy/master' into accuracy-bar

This commit is contained in:
Andrei Zavatski 2019-08-21 08:56:34 +03:00
commit ab1586ff33
23 changed files with 126 additions and 33 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

View File

@ -2,12 +2,12 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System; using System;
using System.IO; using System.Text.RegularExpressions;
using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Audio; using osu.Framework.Audio;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Textures;
using osu.Framework.IO.Stores; using osu.Framework.IO.Stores;
using osu.Game.Skinning; using osu.Game.Skinning;
using osu.Game.Tests.Visual; using osu.Game.Tests.Visual;
@ -28,11 +28,11 @@ namespace osu.Game.Rulesets.Osu.Tests
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(AudioManager audio) private void load(AudioManager audio)
{ {
var skins = new SkinManager(LocalStorage, ContextFactory, null, audio); var dllStore = new DllResourceStore("osu.Game.Rulesets.Osu.Tests.dll");
metricsSkin = getSkinFromResources(skins, "metrics_skin"); metricsSkin = new TestLegacySkin(new SkinInfo(), new NamespacedResourceStore<byte[]>(dllStore, "Resources/metrics_skin"), audio, true);
defaultSkin = getSkinFromResources(skins, "default_skin"); defaultSkin = new TestLegacySkin(new SkinInfo(), new NamespacedResourceStore<byte[]>(dllStore, "Resources/default_skin"), audio, false);
specialSkin = getSkinFromResources(skins, "special_skin"); specialSkin = new TestLegacySkin(new SkinInfo(), new NamespacedResourceStore<byte[]>(dllStore, "Resources/special_skin"), audio, true);
} }
public void SetContents(Func<Drawable> creationFunction) public void SetContents(Func<Drawable> creationFunction)
@ -43,23 +43,28 @@ namespace osu.Game.Rulesets.Osu.Tests
Cell(3).Child = new LocalSkinOverrideContainer(specialSkin) { RelativeSizeAxes = Axes.Both }.WithChild(creationFunction()); Cell(3).Child = new LocalSkinOverrideContainer(specialSkin) { RelativeSizeAxes = Axes.Both }.WithChild(creationFunction());
} }
private static Skin getSkinFromResources(SkinManager skins, string name) private class TestLegacySkin : LegacySkin
{ {
using (var storage = new DllResourceStore("osu.Game.Rulesets.Osu.Tests.dll")) private readonly bool extrapolateAnimations;
public TestLegacySkin(SkinInfo skin, IResourceStore<byte[]> storage, AudioManager audioManager, bool extrapolateAnimations)
: base(skin, storage, audioManager, "skin.ini")
{ {
var tempName = Path.GetTempFileName(); this.extrapolateAnimations = extrapolateAnimations;
}
File.Delete(tempName); public override Texture GetTexture(string componentName)
Directory.CreateDirectory(tempName); {
// extrapolate frames to test longer animations
if (extrapolateAnimations)
{
var match = Regex.Match(componentName, "-([0-9]*)");
var files = storage.GetAvailableResources().Where(f => f.StartsWith($"Resources/{name}")); if (match.Length > 0 && int.TryParse(match.Groups[1].Value, out var number) && number < 60)
return base.GetTexture(componentName.Replace($"-{number}", $"-{number % 2}"));
}
foreach (var file in files) return base.GetTexture(componentName);
using (var stream = storage.GetStream(file))
using (var newFile = File.Create(Path.Combine(tempName, Path.GetFileName(file))))
stream.CopyTo(newFile);
return skins.GetSkin(skins.Import(tempName).Result);
} }
} }
} }

View File

@ -0,0 +1,34 @@
// 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;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Osu.Tests
{
public class TestSceneDrawableJudgement : SkinnableTestScene
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(DrawableJudgement),
typeof(DrawableOsuJudgement)
};
public TestSceneDrawableJudgement()
{
foreach (HitResult result in Enum.GetValues(typeof(HitResult)).OfType<HitResult>().Skip(1))
AddStep("Show " + result.GetDescription(), () => SetContents(() =>
new DrawableOsuJudgement(new JudgementResult(null) { Type = result }, null)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
}));
}
}
}

View File

@ -325,9 +325,6 @@ namespace osu.Game.Rulesets.Scoring
JudgedHits++; JudgedHits++;
if (result.Type != HitResult.None)
scoreResultCounts[result.Type] = scoreResultCounts.GetOrDefault(result.Type) + 1;
if (result.Judgement.AffectsCombo) if (result.Judgement.AffectsCombo)
{ {
switch (result.Type) switch (result.Type)
@ -352,6 +349,9 @@ namespace osu.Game.Rulesets.Scoring
} }
else else
{ {
if (result.HasResult)
scoreResultCounts[result.Type] = scoreResultCounts.GetOrDefault(result.Type) + 1;
baseScore += result.Judgement.NumericResultFor(result); baseScore += result.Judgement.NumericResultFor(result);
rollingMaxBaseScore += result.Judgement.MaxNumericResult; rollingMaxBaseScore += result.Judgement.MaxNumericResult;
} }
@ -371,9 +371,6 @@ namespace osu.Game.Rulesets.Scoring
JudgedHits--; JudgedHits--;
if (result.Type != HitResult.None)
scoreResultCounts[result.Type] = scoreResultCounts.GetOrDefault(result.Type) - 1;
if (result.Judgement.IsBonus) if (result.Judgement.IsBonus)
{ {
if (result.IsHit) if (result.IsHit)
@ -381,6 +378,9 @@ namespace osu.Game.Rulesets.Scoring
} }
else else
{ {
if (result.HasResult)
scoreResultCounts[result.Type] = scoreResultCounts.GetOrDefault(result.Type) - 1;
baseScore -= result.Judgement.NumericResultFor(result); baseScore -= result.Judgement.NumericResultFor(result);
rollingMaxBaseScore -= result.Judgement.MaxNumericResult; rollingMaxBaseScore -= result.Judgement.MaxNumericResult;
} }

View File

@ -28,11 +28,18 @@ namespace osu.Game.Screens.Menu
private Bindable<bool> menuVoice; private Bindable<bool> menuVoice;
private LeasedBindable<WorkingBeatmap> beatmap;
public new Bindable<WorkingBeatmap> Beatmap => beatmap;
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBlack(); protected override BackgroundScreen CreateBackground() => new BackgroundScreenBlack();
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game) private void load(OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game)
{ {
// prevent user from changing beatmap while the intro is still runnning.
beatmap = base.Beatmap.BeginLease(false);
menuVoice = config.GetBindable<bool>(OsuSetting.MenuVoice); menuVoice = config.GetBindable<bool>(OsuSetting.MenuVoice);
seeya = audio.Samples.Get(@"seeya"); seeya = audio.Samples.Get(@"seeya");
} }
@ -107,6 +114,8 @@ namespace osu.Game.Screens.Menu
protected void LoadMenu() protected void LoadMenu()
{ {
beatmap.Return();
DidLoadMenu = true; DidLoadMenu = true;
this.Push(mainMenu); this.Push(mainMenu);
} }

View File

@ -1,4 +1,4 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using System; using System;
@ -11,6 +11,7 @@ using osu.Framework.Audio;
using osu.Framework.Audio.Sample; using osu.Framework.Audio.Sample;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Animations;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
@ -59,7 +60,7 @@ namespace osu.Game.Skinning
Samples = audioManager.GetSampleStore(storage); Samples = audioManager.GetSampleStore(storage);
Textures = new TextureStore(new TextureLoaderStore(storage)); Textures = new TextureStore(new TextureLoaderStore(storage));
using (var testStream = storage.GetStream("hitcircle")) using (var testStream = storage.GetStream("hitcircle@2x") ?? storage.GetStream("hitcircle"))
hasHitCircle |= testStream != null; hasHitCircle |= testStream != null;
if (hasHitCircle) if (hasHitCircle)
@ -75,8 +76,13 @@ namespace osu.Game.Skinning
Samples?.Dispose(); Samples?.Dispose();
} }
private const double default_frame_time = 1000 / 60d;
public override Drawable GetDrawableComponent(string componentName) public override Drawable GetDrawableComponent(string componentName)
{ {
bool animatable = false;
bool looping = true;
switch (componentName) switch (componentName)
{ {
case "Play/osu/cursor": case "Play/osu/cursor":
@ -97,20 +103,32 @@ namespace osu.Game.Skinning
return null; return null;
case "Play/osu/sliderfollowcircle":
animatable = true;
break;
case "Play/Miss": case "Play/Miss":
componentName = "hit0"; componentName = "hit0";
animatable = true;
looping = false;
break; break;
case "Play/Meh": case "Play/Meh":
componentName = "hit50"; componentName = "hit50";
animatable = true;
looping = false;
break; break;
case "Play/Good": case "Play/Good":
componentName = "hit100"; componentName = "hit100";
animatable = true;
looping = false;
break; break;
case "Play/Great": case "Play/Great":
componentName = "hit300"; componentName = "hit300";
animatable = true;
looping = false;
break; break;
case "Play/osu/number-text": case "Play/osu/number-text":
@ -124,15 +142,42 @@ namespace osu.Game.Skinning
}; };
} }
// temporary allowance is given for skins the fact that stable handles non-animatable items such as hitcircles (incorrectly) return getAnimation(componentName, animatable, looping);
// by (incorrectly) displaying the first frame of animation rather than the non-animated version. }
// users have used this to "hide" certain elements like hit300.
var texture = GetTexture($"{componentName}-0") ?? GetTexture(componentName);
if (texture == null) private Drawable getAnimation(string componentName, bool animatable, bool looping, string animationSeparator = "-")
return null; {
Texture texture;
return new Sprite { Texture = texture }; Texture getFrameTexture(int frame) => GetTexture($"{componentName}{animationSeparator}{frame}");
TextureAnimation animation = null;
if (animatable)
{
for (int i = 0;; i++)
{
if ((texture = getFrameTexture(i)) == null)
break;
if (animation == null)
animation = new TextureAnimation
{
DefaultFrameLength = default_frame_time,
Repeat = looping
};
animation.AddFrame(texture);
}
}
if (animation != null)
return animation;
if ((texture = GetTexture(componentName)) != null)
return new Sprite { Texture = texture };
return null;
} }
public class LegacySliderBall : Sprite public class LegacySliderBall : Sprite