Skip to content

Commit

Permalink
Merge branch 'master' into wrap-beatmap-listing-filters
Browse files Browse the repository at this point in the history
  • Loading branch information
bdach committed Mar 11, 2024
2 parents e5e7c8f + 1ae8d34 commit 09179f9
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 33 deletions.
2 changes: 1 addition & 1 deletion osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableSound.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public partial class TestSceneSkinnableSound : OsuTestScene
private TestSkinSourceContainer skinSource = null!;
private PausableSkinnableSound skinnableSound = null!;

private const string sample_lookup = "Gameplay/normal-sliderslide";
private const string sample_lookup = "Gameplay/Argon/normal-sliderslide";

[SetUpSteps]
public void SetUpSteps()
Expand Down
68 changes: 43 additions & 25 deletions osu.Game/Overlays/Wiki/WikiPanelContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#nullable disable

using System;
using Markdig.Syntax;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
Expand All @@ -22,29 +21,61 @@

namespace osu.Game.Overlays.Wiki
{
public partial class WikiPanelContainer : Container
public partial class WikiPanelContainer : CompositeDrawable
{
private WikiPanelMarkdownContainer panelContainer;
private const float padding = 3;

private readonly string text;

private readonly bool isFullWidth;

public WikiPanelContainer(string text, bool isFullWidth = false)
{
this.text = text;
this.isFullWidth = isFullWidth;

RelativeSizeAxes = Axes.X;
Padding = new MarginPadding(3);
}

private PanelBackground background;

[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider, IAPIProvider api)
private void load(IAPIProvider api)
{
Children = new Drawable[]
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
InternalChildren = new Drawable[]
{
background = new PanelBackground
{
BypassAutoSizeAxes = Axes.Both
},
new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding(padding),
Child = new WikiPanelMarkdownContainer(isFullWidth)
{
CurrentPath = $@"{api.WebsiteRootUrl}/wiki/",
Text = text,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y
}
}
};
}

protected override void Update()
{
base.Update();
background.Size = Parent!.DrawSize * new Vector2(Size.X, 1);
}

private partial class PanelBackground : CompositeDrawable
{
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
Padding = new MarginPadding(padding);
InternalChild = new Container
{
RelativeSizeAxes = Axes.Both,
Masking = true,
Expand All @@ -60,22 +91,9 @@ private void load(OverlayColourProvider colourProvider, IAPIProvider api)
{
Colour = colourProvider.Background4,
RelativeSizeAxes = Axes.Both,
},
},
panelContainer = new WikiPanelMarkdownContainer(isFullWidth)
{
CurrentPath = $@"{api.WebsiteRootUrl}/wiki/",
Text = text,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
}
};
}

protected override void Update()
{
base.Update();
Height = Math.Max(panelContainer.Height, Parent!.DrawHeight);
}
};
}
}

private partial class WikiPanelMarkdownContainer : WikiMarkdownContainer
Expand Down
27 changes: 22 additions & 5 deletions osu.Game/Screens/Edit/Timing/ControlPointList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,26 +162,43 @@ private void trackActivePoint()

// If the selected group only has one control point, update the tracking type.
case 1:
trackedType = selectedGroup.Value?.ControlPoints.Single().GetType();
trackedType = selectedGroup.Value?.ControlPoints[0].GetType();
break;

// If the selected group has more than one control point, choose the first as the tracking type
// if we don't already have a singular tracked type.
default:
trackedType ??= selectedGroup.Value?.ControlPoints.FirstOrDefault()?.GetType();
trackedType ??= selectedGroup.Value?.ControlPoints[0].GetType();
break;
}
}

if (trackedType != null)
{
double accurateTime = clock.CurrentTimeAccurate;

// We don't have an efficient way of looking up groups currently, only individual point types.
// To improve the efficiency of this in the future, we should reconsider the overall structure of ControlPointInfo.

// Find the next group which has the same type as the selected one.
var found = Beatmap.ControlPointInfo.Groups
.Where(g => g.ControlPoints.Any(cp => cp.GetType() == trackedType))
.LastOrDefault(g => g.Time <= clock.CurrentTimeAccurate);
ControlPointGroup? found = null;

for (int i = 0; i < Beatmap.ControlPointInfo.Groups.Count; i++)
{
var g = Beatmap.ControlPointInfo.Groups[i];

if (g.Time > accurateTime)
continue;

for (int j = 0; j < g.ControlPoints.Count; j++)
{
if (g.ControlPoints[j].GetType() == trackedType)
{
found = g;
break;
}
}
}

if (found != null)
selectedGroup.Value = found;
Expand Down
3 changes: 2 additions & 1 deletion osu.Game/Users/Drawables/DrawableFlag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ public partial class DrawableFlag : Sprite, IHasTooltip
{
private readonly CountryCode countryCode;

public LocalisableString TooltipText => countryCode == CountryCode.Unknown ? string.Empty : countryCode.GetDescription();
public LocalisableString TooltipText { get; }

public DrawableFlag(CountryCode countryCode)
{
this.countryCode = countryCode;
TooltipText = countryCode == CountryCode.Unknown ? string.Empty : countryCode.GetDescription();
}

[BackgroundDependencyLoader]
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/osu.Game.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
</PackageReference>
<PackageReference Include="Realm" Version="11.7.0" />
<PackageReference Include="ppy.osu.Framework" Version="2024.306.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2024.207.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2024.309.0" />
<PackageReference Include="Sentry" Version="3.41.3" />
<!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. -->
<PackageReference Include="SharpCompress" Version="0.36.0" />
Expand Down

0 comments on commit 09179f9

Please sign in to comment.