mirror of
https://github.com/ppy/osu.git
synced 2025-02-22 03:02:55 +08:00
Merge remote-tracking branch 'refs/remotes/ppy/master' into overlay-scroll-container
This commit is contained in:
commit
fd8d4cf23b
@ -5,6 +5,6 @@
|
||||
"version": "3.1.100"
|
||||
},
|
||||
"msbuild-sdks": {
|
||||
"Microsoft.Build.Traversal": "2.0.24"
|
||||
"Microsoft.Build.Traversal": "2.0.32"
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
@ -0,0 +1,38 @@
|
||||
// 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.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Rulesets.Mania.UI;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Tests.Skinning
|
||||
{
|
||||
/// <summary>
|
||||
/// A container to be used in a <see cref="ManiaSkinnableTestScene"/> to provide a resolvable <see cref="Column"/> dependency.
|
||||
/// </summary>
|
||||
public class ColumnTestContainer : Container
|
||||
{
|
||||
protected override Container<Drawable> Content => content;
|
||||
|
||||
private readonly Container content;
|
||||
|
||||
[Cached]
|
||||
private readonly Column column;
|
||||
|
||||
public ColumnTestContainer(int column, ManiaAction action)
|
||||
{
|
||||
this.column = new Column(column)
|
||||
{
|
||||
Action = { Value = action },
|
||||
AccentColour = Color4.Orange
|
||||
};
|
||||
|
||||
InternalChild = content = new ManiaInputManager(new ManiaRuleset().RulesetInfo, 4)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
// 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.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
||||
using osu.Game.Rulesets.UI.Scrolling;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Tests.Skinning
|
||||
{
|
||||
/// <summary>
|
||||
/// A test scene for a mania hitobject.
|
||||
/// </summary>
|
||||
public abstract class ManiaHitObjectTestScene : ManiaSkinnableTestScene
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
SetContents(() => new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Height = 0.7f,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new ColumnTestContainer(0, ManiaAction.Key1)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Width = 80,
|
||||
Child = new ScrollingHitObjectContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Clock = new FramedClock(new StopwatchClock()),
|
||||
}.With(c =>
|
||||
{
|
||||
c.Add(CreateHitObject().With(h => h.AccentColour.Value = Color4.Orange));
|
||||
})
|
||||
},
|
||||
new ColumnTestContainer(1, ManiaAction.Key2)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Width = 80,
|
||||
Child = new ScrollingHitObjectContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Clock = new FramedClock(new StopwatchClock()),
|
||||
}.With(c =>
|
||||
{
|
||||
c.Add(CreateHitObject().With(h => h.AccentColour.Value = Color4.Orange));
|
||||
})
|
||||
},
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected abstract DrawableManiaHitObject CreateHitObject();
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
// 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 NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Rulesets.UI.Scrolling;
|
||||
using osu.Game.Rulesets.UI.Scrolling.Algorithms;
|
||||
using osu.Game.Tests.Visual;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Tests.Skinning
|
||||
{
|
||||
/// <summary>
|
||||
/// A test scene for skinnable mania components.
|
||||
/// </summary>
|
||||
public abstract class ManiaSkinnableTestScene : SkinnableTestScene
|
||||
{
|
||||
[Cached(Type = typeof(IScrollingInfo))]
|
||||
private readonly TestScrollingInfo scrollingInfo = new TestScrollingInfo();
|
||||
|
||||
protected ManiaSkinnableTestScene()
|
||||
{
|
||||
scrollingInfo.Direction.Value = ScrollingDirection.Down;
|
||||
|
||||
Add(new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.SlateGray.Opacity(0.2f),
|
||||
Depth = 1
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestScrollingDown()
|
||||
{
|
||||
AddStep("change direction to down", () => scrollingInfo.Direction.Value = ScrollingDirection.Down);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestScrollingUp()
|
||||
{
|
||||
AddStep("change direction to up", () => scrollingInfo.Direction.Value = ScrollingDirection.Up);
|
||||
}
|
||||
|
||||
private class TestScrollingInfo : IScrollingInfo
|
||||
{
|
||||
public readonly Bindable<ScrollingDirection> Direction = new Bindable<ScrollingDirection>();
|
||||
|
||||
IBindable<ScrollingDirection> IScrollingInfo.Direction => Direction;
|
||||
IBindable<double> IScrollingInfo.TimeRange { get; } = new Bindable<double>(1000);
|
||||
IScrollAlgorithm IScrollingInfo.Algorithm { get; } = new ConstantScrollAlgorithm();
|
||||
}
|
||||
}
|
||||
}
|
@ -6,13 +6,13 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Tests.Visual;
|
||||
using osu.Game.Rulesets.Mania.UI;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Mania.UI;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Tests.Visual;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Tests
|
||||
namespace osu.Game.Rulesets.Mania.Tests.Skinning
|
||||
{
|
||||
public class TestSceneDrawableJudgement : SkinnableTestScene
|
||||
{
|
@ -16,4 +16,8 @@ namespace osu.Game.Rulesets.Mania
|
||||
|
||||
protected override string ComponentName => Component.ToString().ToLower();
|
||||
}
|
||||
|
||||
public enum ManiaSkinComponents
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +0,0 @@
|
||||
// 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.Rulesets.Mania
|
||||
{
|
||||
public enum ManiaSkinComponents
|
||||
{
|
||||
}
|
||||
}
|
41
osu.Game.Rulesets.Mania/Skinning/LegacyManiaColumnElement.cs
Normal file
41
osu.Game.Rulesets.Mania/Skinning/LegacyManiaColumnElement.cs
Normal file
@ -0,0 +1,41 @@
|
||||
// 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 JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Rulesets.Mania.UI;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Skinning
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see cref="CompositeDrawable"/> which is placed somewhere within a <see cref="Column"/>.
|
||||
/// </summary>
|
||||
public class LegacyManiaColumnElement : CompositeDrawable
|
||||
{
|
||||
[Resolved(CanBeNull = true)]
|
||||
[CanBeNull]
|
||||
protected ManiaStage Stage { get; private set; }
|
||||
|
||||
[Resolved]
|
||||
protected Column Column { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The column index to use for texture lookups, in the case of no user-provided configuration.
|
||||
/// </summary>
|
||||
protected int FallbackColumnIndex { get; private set; }
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
if (Stage == null)
|
||||
FallbackColumnIndex = Column.Index % 2 + 1;
|
||||
else
|
||||
{
|
||||
int dist = Math.Min(Column.Index, Stage.Columns.Count - Column.Index - 1);
|
||||
FallbackColumnIndex = dist % 2 + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
// 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 osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Audio.Sample;
|
||||
@ -15,9 +16,19 @@ namespace osu.Game.Rulesets.Mania.Skinning
|
||||
{
|
||||
private readonly ISkin source;
|
||||
|
||||
public ManiaLegacySkinTransformer(ISkin source)
|
||||
private Lazy<bool> isLegacySkin;
|
||||
|
||||
public ManiaLegacySkinTransformer(ISkinSource source)
|
||||
{
|
||||
this.source = source;
|
||||
|
||||
source.SourceChanged += sourceChanged;
|
||||
sourceChanged();
|
||||
}
|
||||
|
||||
private void sourceChanged()
|
||||
{
|
||||
isLegacySkin = new Lazy<bool>(() => source.GetConfig<LegacySkinConfiguration.LegacySetting, decimal>(LegacySkinConfiguration.LegacySetting.Version) != null);
|
||||
}
|
||||
|
||||
public Drawable GetDrawableComponent(ISkinComponent component)
|
||||
@ -26,6 +37,12 @@ namespace osu.Game.Rulesets.Mania.Skinning
|
||||
{
|
||||
case GameplaySkinComponent<HitResult> resultComponent:
|
||||
return getResult(resultComponent);
|
||||
|
||||
case ManiaSkinComponent _:
|
||||
if (!isLegacySkin.Value)
|
||||
return null;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -19,6 +19,7 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.UI
|
||||
{
|
||||
[Cached]
|
||||
public class Column : ScrollingPlayfield, IKeyBindingHandler<ManiaAction>, IHasAccentColour
|
||||
{
|
||||
public const float COLUMN_WIDTH = 80;
|
||||
|
@ -23,6 +23,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
/// <summary>
|
||||
/// A collection of <see cref="Column"/>s.
|
||||
/// </summary>
|
||||
[Cached]
|
||||
public class ManiaStage : ScrollingPlayfield
|
||||
{
|
||||
public const float COLUMN_SPACING = 1;
|
||||
|
@ -90,7 +90,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
|
||||
void handleHitCircle(DrawableHitCircle circle)
|
||||
{
|
||||
if (!circle.IsHovered)
|
||||
if (!circle.HitArea.IsHovered)
|
||||
return;
|
||||
|
||||
Debug.Assert(circle.HitObject.HitWindows != null);
|
||||
|
@ -62,6 +62,11 @@ namespace osu.Game.Rulesets.Osu.Skinning
|
||||
}
|
||||
};
|
||||
|
||||
bool overlayAboveNumber = skin.GetConfig<OsuSkinConfiguration, bool>(OsuSkinConfiguration.HitCircleOverlayAboveNumber)?.Value ?? true;
|
||||
|
||||
if (!overlayAboveNumber)
|
||||
ChangeInternalChildDepth(hitCircleText, -float.MaxValue);
|
||||
|
||||
state.BindTo(drawableObject.State);
|
||||
state.BindValueChanged(updateState, true);
|
||||
|
||||
|
@ -11,6 +11,7 @@ namespace osu.Game.Rulesets.Osu.Skinning
|
||||
SliderPathRadius,
|
||||
AllowSliderBallTint,
|
||||
CursorExpand,
|
||||
CursorRotate
|
||||
CursorRotate,
|
||||
HitCircleOverlayAboveNumber
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
protected override bool ShouldDeleteArchive(string path) => Path.GetExtension(path)?.ToLowerInvariant() == ".osz";
|
||||
|
||||
protected override Task Populate(BeatmapSetInfo beatmapSet, ArchiveReader archive, CancellationToken cancellationToken = default)
|
||||
protected override async Task Populate(BeatmapSetInfo beatmapSet, ArchiveReader archive, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (archive != null)
|
||||
beatmapSet.Beatmaps = createBeatmapDifficulties(beatmapSet.Files);
|
||||
@ -103,7 +103,19 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
validateOnlineIds(beatmapSet);
|
||||
|
||||
return updateQueue.UpdateAsync(beatmapSet, cancellationToken);
|
||||
bool hadOnlineBeatmapIDs = beatmapSet.Beatmaps.Any(b => b.OnlineBeatmapID > 0);
|
||||
|
||||
await updateQueue.UpdateAsync(beatmapSet, cancellationToken);
|
||||
|
||||
// ensure at least one beatmap was able to retrieve or keep an online ID, else drop the set ID.
|
||||
if (hadOnlineBeatmapIDs && !beatmapSet.Beatmaps.Any(b => b.OnlineBeatmapID > 0))
|
||||
{
|
||||
if (beatmapSet.OnlineBeatmapSetID != null)
|
||||
{
|
||||
beatmapSet.OnlineBeatmapSetID = null;
|
||||
LogForModel(beatmapSet, "Disassociating beatmap set ID due to loss of all beatmap IDs");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void PreImport(BeatmapSetInfo beatmapSet)
|
||||
@ -447,12 +459,15 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
var res = req.Result;
|
||||
|
||||
beatmap.Status = res.Status;
|
||||
beatmap.BeatmapSet.Status = res.BeatmapSet.Status;
|
||||
beatmap.BeatmapSet.OnlineBeatmapSetID = res.OnlineBeatmapSetID;
|
||||
beatmap.OnlineBeatmapID = res.OnlineBeatmapID;
|
||||
if (res != null)
|
||||
{
|
||||
beatmap.Status = res.Status;
|
||||
beatmap.BeatmapSet.Status = res.BeatmapSet.Status;
|
||||
beatmap.BeatmapSet.OnlineBeatmapSetID = res.OnlineBeatmapSetID;
|
||||
beatmap.OnlineBeatmapID = res.OnlineBeatmapID;
|
||||
|
||||
LogForModel(set, $"Online retrieval mapped {beatmap} to {res.OnlineBeatmapSetID} / {res.OnlineBeatmapID}.");
|
||||
LogForModel(set, $"Online retrieval mapped {beatmap} to {res.OnlineBeatmapSetID} / {res.OnlineBeatmapID}.");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -17,9 +17,9 @@ namespace osu.Game.IO
|
||||
private readonly StreamReader streamReader;
|
||||
private readonly Queue<string> lineBuffer;
|
||||
|
||||
public LineBufferedReader(Stream stream)
|
||||
public LineBufferedReader(Stream stream, bool leaveOpen = false)
|
||||
{
|
||||
streamReader = new StreamReader(stream);
|
||||
streamReader = new StreamReader(stream, Encoding.UTF8, true, 1024, leaveOpen);
|
||||
lineBuffer = new Queue<string>();
|
||||
}
|
||||
|
||||
|
@ -12,11 +12,11 @@ namespace osu.Game.Online.API
|
||||
/// An API request with a well-defined response type.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of the response (used for deserialisation).</typeparam>
|
||||
public abstract class APIRequest<T> : APIRequest
|
||||
public abstract class APIRequest<T> : APIRequest where T : class
|
||||
{
|
||||
protected override WebRequest CreateWebRequest() => new OsuJsonWebRequest<T>(Uri);
|
||||
|
||||
public T Result => ((OsuJsonWebRequest<T>)WebRequest).ResponseObject;
|
||||
public T Result => ((OsuJsonWebRequest<T>)WebRequest)?.ResponseObject;
|
||||
|
||||
protected APIRequest()
|
||||
{
|
||||
|
@ -6,7 +6,7 @@ using osu.Game.Rulesets;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public abstract class GetRankingsRequest<TModel> : APIRequest<TModel>
|
||||
public abstract class GetRankingsRequest<TModel> : APIRequest<TModel> where TModel : class
|
||||
{
|
||||
private readonly RulesetInfo ruleset;
|
||||
private readonly int page;
|
||||
|
@ -6,7 +6,7 @@ using osu.Framework.IO.Network;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public abstract class PaginatedAPIRequest<T> : APIRequest<T>
|
||||
public abstract class PaginatedAPIRequest<T> : APIRequest<T> where T : class
|
||||
{
|
||||
private readonly int page;
|
||||
private readonly int itemsPerPage;
|
||||
|
@ -28,10 +28,11 @@ namespace osu.Game.Scoring.Legacy
|
||||
{
|
||||
var score = new Score
|
||||
{
|
||||
ScoreInfo = new ScoreInfo(),
|
||||
Replay = new Replay()
|
||||
};
|
||||
|
||||
WorkingBeatmap workingBeatmap;
|
||||
|
||||
using (SerializationReader sr = new SerializationReader(stream))
|
||||
{
|
||||
currentRuleset = GetRuleset(sr.ReadByte());
|
||||
@ -41,7 +42,7 @@ namespace osu.Game.Scoring.Legacy
|
||||
|
||||
var version = sr.ReadInt32();
|
||||
|
||||
var workingBeatmap = GetBeatmap(sr.ReadString());
|
||||
workingBeatmap = GetBeatmap(sr.ReadString());
|
||||
if (workingBeatmap is DummyWorkingBeatmap)
|
||||
throw new BeatmapNotFoundException();
|
||||
|
||||
@ -113,6 +114,10 @@ namespace osu.Game.Scoring.Legacy
|
||||
|
||||
CalculateAccuracy(score.ScoreInfo);
|
||||
|
||||
// before returning for database import, we must restore the database-sourced BeatmapInfo.
|
||||
// if not, the clone operation in GetPlayableBeatmap will cause a dereference and subsequent database exception.
|
||||
score.ScoreInfo.Beatmap = workingBeatmap.BeatmapInfo;
|
||||
|
||||
return score;
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Ranking;
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
{
|
||||
@ -29,6 +30,8 @@ namespace osu.Game.Screens.Play
|
||||
this.Push(CreateResults(DrawableRuleset.ReplayScore.ScoreInfo));
|
||||
}
|
||||
|
||||
protected override ResultsScreen CreateResults(ScoreInfo score) => new ResultsScreen(score, false);
|
||||
|
||||
protected override ScoreInfo CreateScore() => score.ScoreInfo;
|
||||
}
|
||||
}
|
||||
|
@ -33,16 +33,21 @@ namespace osu.Game.Screens.Ranking
|
||||
|
||||
public readonly ScoreInfo Score;
|
||||
|
||||
private readonly bool allowRetry;
|
||||
|
||||
private Drawable bottomPanel;
|
||||
|
||||
public ResultsScreen(ScoreInfo score)
|
||||
public ResultsScreen(ScoreInfo score, bool allowRetry = true)
|
||||
{
|
||||
Score = score;
|
||||
this.allowRetry = allowRetry;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
FillFlowContainer buttons;
|
||||
|
||||
InternalChildren = new[]
|
||||
{
|
||||
new ResultsScrollContainer
|
||||
@ -68,7 +73,7 @@ namespace osu.Game.Screens.Ranking
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4Extensions.FromHex("#333")
|
||||
},
|
||||
new FillFlowContainer
|
||||
buttons = new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
@ -78,15 +83,16 @@ namespace osu.Game.Screens.Ranking
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new ReplayDownloadButton(Score) { Width = 300 },
|
||||
new RetryButton { Width = 300 },
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (player != null)
|
||||
if (player != null && allowRetry)
|
||||
{
|
||||
buttons.Add(new RetryButton { Width = 300 });
|
||||
|
||||
AddInternal(new HotkeyRetryOverlay
|
||||
{
|
||||
Action = () =>
|
||||
|
@ -9,6 +9,8 @@ namespace osu.Game.Skinning
|
||||
{
|
||||
public class LegacyBeatmapSkin : LegacySkin
|
||||
{
|
||||
protected override bool AllowManiaSkin => false;
|
||||
|
||||
public LegacyBeatmapSkin(BeatmapInfo beatmap, IResourceStore<byte[]> storage, AudioManager audioManager)
|
||||
: base(createSkinInfo(beatmap), new LegacySkinResourceStore<BeatmapSetFileInfo>(beatmap.BeatmapSet, storage), audioManager, beatmap.Path)
|
||||
{
|
||||
|
23
osu.Game/Skinning/LegacyManiaSkinConfigurationLookup.cs
Normal file
23
osu.Game/Skinning/LegacyManiaSkinConfigurationLookup.cs
Normal file
@ -0,0 +1,23 @@
|
||||
// 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 LegacyManiaSkinConfigurationLookup
|
||||
{
|
||||
public readonly int Keys;
|
||||
public readonly LegacyManiaSkinConfigurationLookups Lookup;
|
||||
public readonly int? TargetColumn;
|
||||
|
||||
public LegacyManiaSkinConfigurationLookup(int keys, LegacyManiaSkinConfigurationLookups lookup, int? targetColumn = null)
|
||||
{
|
||||
Keys = keys;
|
||||
Lookup = lookup;
|
||||
TargetColumn = targetColumn;
|
||||
}
|
||||
}
|
||||
|
||||
public enum LegacyManiaSkinConfigurationLookups
|
||||
{
|
||||
}
|
||||
}
|
@ -26,12 +26,16 @@ namespace osu.Game.Skinning
|
||||
[CanBeNull]
|
||||
protected IResourceStore<SampleChannel> Samples;
|
||||
|
||||
protected virtual bool AllowManiaSkin => true;
|
||||
|
||||
public new LegacySkinConfiguration Configuration
|
||||
{
|
||||
get => base.Configuration as LegacySkinConfiguration;
|
||||
set => base.Configuration = value;
|
||||
}
|
||||
|
||||
private readonly Dictionary<int, LegacyManiaSkinConfiguration> maniaConfigurations = new Dictionary<int, LegacyManiaSkinConfiguration>();
|
||||
|
||||
public LegacySkin(SkinInfo skin, IResourceStore<byte[]> storage, AudioManager audioManager)
|
||||
: this(skin, new LegacySkinResourceStore<SkinFileInfo>(skin, storage), audioManager, "skin.ini")
|
||||
{
|
||||
@ -40,15 +44,26 @@ namespace osu.Game.Skinning
|
||||
protected LegacySkin(SkinInfo skin, IResourceStore<byte[]> storage, AudioManager audioManager, string filename)
|
||||
: base(skin)
|
||||
{
|
||||
Stream stream = storage?.GetStream(filename);
|
||||
|
||||
if (stream != null)
|
||||
using (var stream = storage?.GetStream(filename))
|
||||
{
|
||||
using (LineBufferedReader reader = new LineBufferedReader(stream))
|
||||
Configuration = new LegacySkinDecoder().Decode(reader);
|
||||
if (stream != null)
|
||||
{
|
||||
using (LineBufferedReader reader = new LineBufferedReader(stream, true))
|
||||
Configuration = new LegacySkinDecoder().Decode(reader);
|
||||
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
using (LineBufferedReader reader = new LineBufferedReader(stream))
|
||||
{
|
||||
var maniaList = new LegacyManiaSkinDecoder().Decode(reader);
|
||||
|
||||
foreach (var config in maniaList)
|
||||
maniaConfigurations[config.Keys] = config;
|
||||
}
|
||||
}
|
||||
else
|
||||
Configuration = new LegacySkinConfiguration { LegacyVersion = LegacySkinConfiguration.LATEST_VERSION };
|
||||
}
|
||||
else
|
||||
Configuration = new LegacySkinConfiguration { LegacyVersion = LegacySkinConfiguration.LATEST_VERSION };
|
||||
|
||||
if (storage != null)
|
||||
{
|
||||
@ -105,6 +120,15 @@ namespace osu.Game.Skinning
|
||||
case SkinCustomColourLookup customColour:
|
||||
return SkinUtils.As<TValue>(getCustomColour(customColour.Lookup.ToString()));
|
||||
|
||||
case LegacyManiaSkinConfigurationLookup legacy:
|
||||
if (!AllowManiaSkin)
|
||||
return null;
|
||||
|
||||
if (!maniaConfigurations.TryGetValue(legacy.Keys, out _))
|
||||
maniaConfigurations[legacy.Keys] = new LegacyManiaSkinConfiguration(legacy.Keys);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
// handles lookups like GlobalSkinConfiguration
|
||||
|
||||
|
@ -50,7 +50,7 @@ namespace osu.Game.Storyboards.Drawables
|
||||
|
||||
AddInternal(Content = new Container<DrawableStoryboardLayer>
|
||||
{
|
||||
Size = new Vector2(640, 480),
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
});
|
||||
|
@ -8,7 +8,7 @@ using osu.Framework.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Storyboards.Drawables
|
||||
{
|
||||
public class DrawableStoryboardLayer : LifetimeManagementContainer
|
||||
public class DrawableStoryboardLayer : CompositeDrawable
|
||||
{
|
||||
public StoryboardLayer Layer { get; }
|
||||
public bool Enabled;
|
||||
@ -23,17 +23,34 @@ namespace osu.Game.Storyboards.Drawables
|
||||
Origin = Anchor.Centre;
|
||||
Enabled = layer.VisibleWhenPassing;
|
||||
Masking = layer.Masking;
|
||||
|
||||
InternalChild = new LayerElementContainer(layer);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(CancellationToken? cancellationToken)
|
||||
private class LayerElementContainer : LifetimeManagementContainer
|
||||
{
|
||||
foreach (var element in Layer.Elements)
|
||||
{
|
||||
cancellationToken?.ThrowIfCancellationRequested();
|
||||
private readonly StoryboardLayer storyboardLayer;
|
||||
|
||||
if (element.IsDrawable)
|
||||
AddInternal(element.CreateDrawable());
|
||||
public LayerElementContainer(StoryboardLayer layer)
|
||||
{
|
||||
storyboardLayer = layer;
|
||||
|
||||
Width = 640;
|
||||
Height = 480;
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(CancellationToken? cancellationToken)
|
||||
{
|
||||
foreach (var element in storyboardLayer.Elements)
|
||||
{
|
||||
cancellationToken?.ThrowIfCancellationRequested();
|
||||
|
||||
if (element.IsDrawable)
|
||||
AddInternal(element.CreateDrawable());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,16 +26,16 @@ namespace osu.Game.Tests.Visual
|
||||
|
||||
protected OsuManualInputManagerTestScene()
|
||||
{
|
||||
MenuCursorContainer cursorContainer;
|
||||
|
||||
base.Content.AddRange(new Drawable[]
|
||||
{
|
||||
InputManager = new ManualInputManager
|
||||
{
|
||||
UseParentInput = true,
|
||||
Child = new GlobalActionContainer(null)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = content = new MenuCursorContainer { RelativeSizeAxes = Axes.Both }
|
||||
},
|
||||
.WithChild((cursorContainer = new MenuCursorContainer { RelativeSizeAxes = Axes.Both })
|
||||
.WithChild(content = new OsuTooltipContainer(cursorContainer.Cursor) { RelativeSizeAxes = Axes.Both }))
|
||||
},
|
||||
new Container
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user