mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 12:33:01 +08:00
Merge branch 'master' into fix-results-exit-transition
This commit is contained in:
commit
89cdea8123
@ -52,6 +52,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.525.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.525.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.608.0" />
|
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.609.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -15,8 +15,6 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
|||||||
{
|
{
|
||||||
public class MainCirclePiece : CompositeDrawable
|
public class MainCirclePiece : CompositeDrawable
|
||||||
{
|
{
|
||||||
public override bool RemoveCompletedTransforms => false;
|
|
||||||
|
|
||||||
private readonly CirclePiece circle;
|
private readonly CirclePiece circle;
|
||||||
private readonly RingPiece ring;
|
private readonly RingPiece ring;
|
||||||
private readonly FlashPiece flash;
|
private readonly FlashPiece flash;
|
||||||
@ -44,7 +42,6 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
|||||||
|
|
||||||
private readonly IBindable<Color4> accentColour = new Bindable<Color4>();
|
private readonly IBindable<Color4> accentColour = new Bindable<Color4>();
|
||||||
private readonly IBindable<int> indexInCurrentCombo = new Bindable<int>();
|
private readonly IBindable<int> indexInCurrentCombo = new Bindable<int>();
|
||||||
private readonly IBindable<ArmedState> armedState = new Bindable<ArmedState>();
|
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private DrawableHitObject drawableObject { get; set; }
|
private DrawableHitObject drawableObject { get; set; }
|
||||||
@ -56,7 +53,6 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
|||||||
|
|
||||||
accentColour.BindTo(drawableObject.AccentColour);
|
accentColour.BindTo(drawableObject.AccentColour);
|
||||||
indexInCurrentCombo.BindTo(drawableOsuObject.IndexInCurrentComboBindable);
|
indexInCurrentCombo.BindTo(drawableOsuObject.IndexInCurrentComboBindable);
|
||||||
armedState.BindTo(drawableObject.State);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -72,19 +68,18 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
|||||||
|
|
||||||
indexInCurrentCombo.BindValueChanged(index => number.Text = (index.NewValue + 1).ToString(), true);
|
indexInCurrentCombo.BindValueChanged(index => number.Text = (index.NewValue + 1).ToString(), true);
|
||||||
|
|
||||||
armedState.BindValueChanged(animate, true);
|
drawableObject.ApplyCustomUpdateState += updateStateTransforms;
|
||||||
|
updateStateTransforms(drawableObject, drawableObject.State.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void animate(ValueChangedEvent<ArmedState> state)
|
private void updateStateTransforms(DrawableHitObject drawableHitObject, ArmedState state)
|
||||||
{
|
{
|
||||||
ClearTransforms(true);
|
|
||||||
|
|
||||||
using (BeginAbsoluteSequence(drawableObject.StateUpdateTime))
|
using (BeginAbsoluteSequence(drawableObject.StateUpdateTime))
|
||||||
glow.FadeOut(400);
|
glow.FadeOut(400);
|
||||||
|
|
||||||
using (BeginAbsoluteSequence(drawableObject.HitStateUpdateTime))
|
using (BeginAbsoluteSequence(drawableObject.HitStateUpdateTime))
|
||||||
{
|
{
|
||||||
switch (state.NewValue)
|
switch (state)
|
||||||
{
|
{
|
||||||
case ArmedState.Hit:
|
case ArmedState.Hit:
|
||||||
const double flash_in = 40;
|
const double flash_in = 40;
|
||||||
@ -111,5 +106,13 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool isDisposing)
|
||||||
|
{
|
||||||
|
base.Dispose(isDisposing);
|
||||||
|
|
||||||
|
if (drawableObject != null)
|
||||||
|
drawableObject.ApplyCustomUpdateState -= updateStateTransforms;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,6 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
|
|
||||||
private readonly Bindable<Color4> accentColour = new Bindable<Color4>();
|
private readonly Bindable<Color4> accentColour = new Bindable<Color4>();
|
||||||
private readonly IBindable<int> indexInCurrentCombo = new Bindable<int>();
|
private readonly IBindable<int> indexInCurrentCombo = new Bindable<int>();
|
||||||
private readonly IBindable<ArmedState> armedState = new Bindable<ArmedState>();
|
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private DrawableHitObject drawableObject { get; set; }
|
private DrawableHitObject drawableObject { get; set; }
|
||||||
@ -116,7 +115,6 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
|
|
||||||
accentColour.BindTo(drawableObject.AccentColour);
|
accentColour.BindTo(drawableObject.AccentColour);
|
||||||
indexInCurrentCombo.BindTo(drawableOsuObject.IndexInCurrentComboBindable);
|
indexInCurrentCombo.BindTo(drawableOsuObject.IndexInCurrentComboBindable);
|
||||||
armedState.BindTo(drawableObject.State);
|
|
||||||
|
|
||||||
Texture getTextureWithFallback(string name)
|
Texture getTextureWithFallback(string name)
|
||||||
{
|
{
|
||||||
@ -142,18 +140,17 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
if (hasNumber)
|
if (hasNumber)
|
||||||
indexInCurrentCombo.BindValueChanged(index => hitCircleText.Text = (index.NewValue + 1).ToString(), true);
|
indexInCurrentCombo.BindValueChanged(index => hitCircleText.Text = (index.NewValue + 1).ToString(), true);
|
||||||
|
|
||||||
armedState.BindValueChanged(animate, true);
|
drawableObject.ApplyCustomUpdateState += updateStateTransforms;
|
||||||
|
updateStateTransforms(drawableObject, drawableObject.State.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void animate(ValueChangedEvent<ArmedState> state)
|
private void updateStateTransforms(DrawableHitObject drawableHitObject, ArmedState state)
|
||||||
{
|
{
|
||||||
const double legacy_fade_duration = 240;
|
const double legacy_fade_duration = 240;
|
||||||
|
|
||||||
ClearTransforms(true);
|
|
||||||
|
|
||||||
using (BeginAbsoluteSequence(drawableObject.HitStateUpdateTime))
|
using (BeginAbsoluteSequence(drawableObject.HitStateUpdateTime))
|
||||||
{
|
{
|
||||||
switch (state.NewValue)
|
switch (state)
|
||||||
{
|
{
|
||||||
case ArmedState.Hit:
|
case ArmedState.Hit:
|
||||||
circleSprites.FadeOut(legacy_fade_duration, Easing.Out);
|
circleSprites.FadeOut(legacy_fade_duration, Easing.Out);
|
||||||
@ -178,5 +175,13 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool isDisposing)
|
||||||
|
{
|
||||||
|
base.Dispose(isDisposing);
|
||||||
|
|
||||||
|
if (drawableObject != null)
|
||||||
|
drawableObject.ApplyCustomUpdateState -= updateStateTransforms;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,6 +109,34 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
meter => meter.ChildrenOfType<ColourHitErrorMeter.HitErrorCircle>().Count() == 2));
|
meter => meter.ChildrenOfType<ColourHitErrorMeter.HitErrorCircle>().Count() == 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestBonus()
|
||||||
|
{
|
||||||
|
AddStep("OD 1", () => recreateDisplay(new OsuHitWindows(), 1));
|
||||||
|
|
||||||
|
AddStep("small bonus", () => newJudgement(result: HitResult.SmallBonus));
|
||||||
|
AddAssert("no bars added", () => !this.ChildrenOfType<BarHitErrorMeter.JudgementLine>().Any());
|
||||||
|
AddAssert("no circle added", () => !this.ChildrenOfType<ColourHitErrorMeter.HitErrorCircle>().Any());
|
||||||
|
|
||||||
|
AddStep("large bonus", () => newJudgement(result: HitResult.LargeBonus));
|
||||||
|
AddAssert("no bars added", () => !this.ChildrenOfType<BarHitErrorMeter.JudgementLine>().Any());
|
||||||
|
AddAssert("no circle added", () => !this.ChildrenOfType<ColourHitErrorMeter.HitErrorCircle>().Any());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestIgnore()
|
||||||
|
{
|
||||||
|
AddStep("OD 1", () => recreateDisplay(new OsuHitWindows(), 1));
|
||||||
|
|
||||||
|
AddStep("ignore hit", () => newJudgement(result: HitResult.IgnoreHit));
|
||||||
|
AddAssert("no bars added", () => !this.ChildrenOfType<BarHitErrorMeter.JudgementLine>().Any());
|
||||||
|
AddAssert("no circle added", () => !this.ChildrenOfType<ColourHitErrorMeter.HitErrorCircle>().Any());
|
||||||
|
|
||||||
|
AddStep("ignore miss", () => newJudgement(result: HitResult.IgnoreMiss));
|
||||||
|
AddAssert("no bars added", () => !this.ChildrenOfType<BarHitErrorMeter.JudgementLine>().Any());
|
||||||
|
AddAssert("no circle added", () => !this.ChildrenOfType<ColourHitErrorMeter.HitErrorCircle>().Any());
|
||||||
|
}
|
||||||
|
|
||||||
private void recreateDisplay(HitWindows hitWindows, float overallDifficulty)
|
private void recreateDisplay(HitWindows hitWindows, float overallDifficulty)
|
||||||
{
|
{
|
||||||
hitWindows?.SetDifficulty(overallDifficulty);
|
hitWindows?.SetDifficulty(overallDifficulty);
|
||||||
|
File diff suppressed because one or more lines are too long
65
osu.Game.Tests/Visual/Online/TestSceneWikiSidebar.cs
Normal file
65
osu.Game.Tests/Visual/Online/TestSceneWikiSidebar.cs
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
// 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 Markdig.Parsers;
|
||||||
|
using Markdig.Syntax;
|
||||||
|
using Markdig.Syntax.Inlines;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Game.Graphics.Containers.Markdown;
|
||||||
|
using osu.Game.Overlays;
|
||||||
|
using osu.Game.Overlays.Wiki;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.Online
|
||||||
|
{
|
||||||
|
public class TestSceneWikiSidebar : OsuTestScene
|
||||||
|
{
|
||||||
|
[Cached]
|
||||||
|
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Orange);
|
||||||
|
|
||||||
|
[Cached]
|
||||||
|
private readonly OverlayScrollContainer scrollContainer = new OverlayScrollContainer();
|
||||||
|
|
||||||
|
private WikiSidebar sidebar;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void SetUp() => Schedule(() => Child = sidebar = new WikiSidebar());
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestNoContent()
|
||||||
|
{
|
||||||
|
AddStep("No Content", () => { });
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestOnlyMainTitle()
|
||||||
|
{
|
||||||
|
AddStep("Add TOC", () =>
|
||||||
|
{
|
||||||
|
for (var i = 0; i < 10; i++)
|
||||||
|
addTitle($"This is a very long title {i + 1}");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestWithSubtitle()
|
||||||
|
{
|
||||||
|
AddStep("Add TOC", () =>
|
||||||
|
{
|
||||||
|
for (var i = 0; i < 10; i++)
|
||||||
|
addTitle($"This is a very long title {i + 1}", i % 4 != 0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addTitle(string text, bool subtitle = false)
|
||||||
|
{
|
||||||
|
var headingBlock = new HeadingBlock(new HeadingBlockParser())
|
||||||
|
{
|
||||||
|
Inline = new ContainerInline().AppendChild(new LiteralInline(text)),
|
||||||
|
Level = subtitle ? 3 : 2,
|
||||||
|
};
|
||||||
|
var heading = new OsuMarkdownHeading(headingBlock);
|
||||||
|
sidebar.AddEntry(headingBlock, heading);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
// 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 osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
@ -13,7 +14,9 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
|
|
||||||
|
[Cached]
|
||||||
protected readonly OverlayScrollContainer ScrollFlow;
|
protected readonly OverlayScrollContainer ScrollFlow;
|
||||||
|
|
||||||
protected readonly LoadingLayer Loading;
|
protected readonly LoadingLayer Loading;
|
||||||
private readonly Container content;
|
private readonly Container content;
|
||||||
|
|
||||||
|
80
osu.Game/Overlays/Wiki/WikiArticlePage.cs
Normal file
80
osu.Game/Overlays/Wiki/WikiArticlePage.cs
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
// 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 Markdig.Syntax;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Containers.Markdown;
|
||||||
|
using osu.Game.Overlays.Wiki.Markdown;
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays.Wiki
|
||||||
|
{
|
||||||
|
public class WikiArticlePage : CompositeDrawable
|
||||||
|
{
|
||||||
|
public Container SidebarContainer { get; }
|
||||||
|
|
||||||
|
public WikiArticlePage(string currentPath, string markdown)
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X;
|
||||||
|
AutoSizeAxes = Axes.Y;
|
||||||
|
|
||||||
|
WikiSidebar sidebar;
|
||||||
|
|
||||||
|
InternalChild = new GridContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
RowDimensions = new[]
|
||||||
|
{
|
||||||
|
new Dimension(GridSizeMode.AutoSize),
|
||||||
|
},
|
||||||
|
ColumnDimensions = new[]
|
||||||
|
{
|
||||||
|
new Dimension(GridSizeMode.AutoSize),
|
||||||
|
new Dimension(),
|
||||||
|
},
|
||||||
|
Content = new[]
|
||||||
|
{
|
||||||
|
new Drawable[]
|
||||||
|
{
|
||||||
|
SidebarContainer = new Container
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.X,
|
||||||
|
Child = sidebar = new WikiSidebar(),
|
||||||
|
},
|
||||||
|
new ArticleMarkdownContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
CurrentPath = currentPath,
|
||||||
|
Text = markdown,
|
||||||
|
DocumentMargin = new MarginPadding(0),
|
||||||
|
DocumentPadding = new MarginPadding
|
||||||
|
{
|
||||||
|
Vertical = 20,
|
||||||
|
Left = 30,
|
||||||
|
Right = 50,
|
||||||
|
},
|
||||||
|
OnAddHeading = sidebar.AddEntry,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ArticleMarkdownContainer : WikiMarkdownContainer
|
||||||
|
{
|
||||||
|
public Action<HeadingBlock, MarkdownHeading> OnAddHeading;
|
||||||
|
|
||||||
|
protected override MarkdownHeading CreateHeading(HeadingBlock headingBlock)
|
||||||
|
{
|
||||||
|
var heading = base.CreateHeading(headingBlock);
|
||||||
|
|
||||||
|
OnAddHeading(headingBlock, heading);
|
||||||
|
|
||||||
|
return heading;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
66
osu.Game/Overlays/Wiki/WikiSidebar.cs
Normal file
66
osu.Game/Overlays/Wiki/WikiSidebar.cs
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
// 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 Markdig.Syntax;
|
||||||
|
using Markdig.Syntax.Inlines;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Containers.Markdown;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays.Wiki
|
||||||
|
{
|
||||||
|
public class WikiSidebar : OverlaySidebar
|
||||||
|
{
|
||||||
|
private WikiTableOfContents tableOfContents;
|
||||||
|
|
||||||
|
protected override Drawable CreateContent() => new FillFlowContainer
|
||||||
|
{
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new OsuSpriteText
|
||||||
|
{
|
||||||
|
Text = "CONTENTS",
|
||||||
|
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
|
||||||
|
Margin = new MarginPadding { Bottom = 5 },
|
||||||
|
},
|
||||||
|
tableOfContents = new WikiTableOfContents(),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
public void AddEntry(HeadingBlock headingBlock, MarkdownHeading heading)
|
||||||
|
{
|
||||||
|
switch (headingBlock.Level)
|
||||||
|
{
|
||||||
|
case 2:
|
||||||
|
case 3:
|
||||||
|
tableOfContents.AddEntry(getTitle(headingBlock.Inline), heading, headingBlock.Level == 3);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string getTitle(ContainerInline containerInline)
|
||||||
|
{
|
||||||
|
foreach (var inline in containerInline)
|
||||||
|
{
|
||||||
|
switch (inline)
|
||||||
|
{
|
||||||
|
case LiteralInline literalInline:
|
||||||
|
return literalInline.Content.ToString();
|
||||||
|
|
||||||
|
case LinkInline linkInline:
|
||||||
|
if (!linkInline.IsImage)
|
||||||
|
return getTitle(linkInline);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
91
osu.Game/Overlays/Wiki/WikiTableOfContents.cs
Normal file
91
osu.Game/Overlays/Wiki/WikiTableOfContents.cs
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
// 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.Collections.Generic;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Containers.Markdown;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays.Wiki
|
||||||
|
{
|
||||||
|
public class WikiTableOfContents : CompositeDrawable
|
||||||
|
{
|
||||||
|
private readonly FillFlowContainer content;
|
||||||
|
|
||||||
|
private TableOfContentsEntry lastMainTitle;
|
||||||
|
|
||||||
|
private TableOfContentsEntry lastSubTitle;
|
||||||
|
|
||||||
|
public WikiTableOfContents()
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X;
|
||||||
|
AutoSizeAxes = Axes.Y;
|
||||||
|
InternalChild = content = new FillFlowContainer
|
||||||
|
{
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddEntry(string title, MarkdownHeading target, bool subtitle = false)
|
||||||
|
{
|
||||||
|
var entry = new TableOfContentsEntry(title, target, subtitle);
|
||||||
|
|
||||||
|
if (subtitle)
|
||||||
|
{
|
||||||
|
lastMainTitle.Margin = new MarginPadding(0);
|
||||||
|
|
||||||
|
if (lastSubTitle != null)
|
||||||
|
lastSubTitle.Margin = new MarginPadding(0);
|
||||||
|
|
||||||
|
content.Add(lastSubTitle = entry.With(d => d.Margin = new MarginPadding { Bottom = 10 }));
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
lastSubTitle = null;
|
||||||
|
|
||||||
|
content.Add(lastMainTitle = entry.With(d => d.Margin = new MarginPadding { Bottom = 5 }));
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TableOfContentsEntry : OsuHoverContainer
|
||||||
|
{
|
||||||
|
private readonly MarkdownHeading target;
|
||||||
|
|
||||||
|
private readonly OsuTextFlowContainer textFlow;
|
||||||
|
|
||||||
|
public TableOfContentsEntry(string text, MarkdownHeading target, bool subtitle = false)
|
||||||
|
{
|
||||||
|
this.target = target;
|
||||||
|
|
||||||
|
RelativeSizeAxes = Axes.X;
|
||||||
|
AutoSizeAxes = Axes.Y;
|
||||||
|
Child = textFlow = new OsuTextFlowContainer(t =>
|
||||||
|
{
|
||||||
|
t.Font = OsuFont.GetFont(size: subtitle ? 12 : 15);
|
||||||
|
}).With(f =>
|
||||||
|
{
|
||||||
|
f.AddText(text);
|
||||||
|
f.RelativeSizeAxes = Axes.X;
|
||||||
|
f.AutoSizeAxes = Axes.Y;
|
||||||
|
f.Margin = new MarginPadding { Bottom = 2 };
|
||||||
|
});
|
||||||
|
Padding = new MarginPadding { Left = subtitle ? 10 : 0 };
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override IEnumerable<Drawable> EffectTargets => new Drawable[] { textFlow };
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OverlayColourProvider colourProvider, OverlayScrollContainer scrollContainer)
|
||||||
|
{
|
||||||
|
IdleColour = colourProvider.Light2;
|
||||||
|
HoverColour = colourProvider.Light1;
|
||||||
|
Action = () => scrollContainer.ScrollTo(target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
// 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.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
@ -10,7 +11,6 @@ using osu.Game.Online.API;
|
|||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Overlays.Wiki;
|
using osu.Game.Overlays.Wiki;
|
||||||
using osu.Game.Overlays.Wiki.Markdown;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
@ -31,6 +31,8 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private bool displayUpdateRequired = true;
|
private bool displayUpdateRequired = true;
|
||||||
|
|
||||||
|
private WikiArticlePage articlePage;
|
||||||
|
|
||||||
public WikiOverlay()
|
public WikiOverlay()
|
||||||
: base(OverlayColourScheme.Orange, false)
|
: base(OverlayColourScheme.Orange, false)
|
||||||
{
|
{
|
||||||
@ -82,6 +84,17 @@ namespace osu.Game.Overlays
|
|||||||
}, (cancellationToken = new CancellationTokenSource()).Token);
|
}, (cancellationToken = new CancellationTokenSource()).Token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void UpdateAfterChildren()
|
||||||
|
{
|
||||||
|
base.UpdateAfterChildren();
|
||||||
|
|
||||||
|
if (articlePage != null)
|
||||||
|
{
|
||||||
|
articlePage.SidebarContainer.Height = DrawHeight;
|
||||||
|
articlePage.SidebarContainer.Y = Math.Clamp(ScrollFlow.Current - Header.DrawHeight, 0, Math.Max(ScrollFlow.ScrollContent.DrawHeight - DrawHeight - Header.DrawHeight, 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void onPathChanged(ValueChangedEvent<string> e)
|
private void onPathChanged(ValueChangedEvent<string> e)
|
||||||
{
|
{
|
||||||
cancellationToken?.Cancel();
|
cancellationToken?.Cancel();
|
||||||
@ -115,39 +128,14 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LoadDisplay(new WikiMarkdownContainer
|
LoadDisplay(articlePage = new WikiArticlePage($@"{api.WebsiteRootUrl}/wiki/{path.Value}/", response.Markdown));
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
AutoSizeAxes = Axes.Y,
|
|
||||||
CurrentPath = $@"{api.WebsiteRootUrl}/wiki/{path.Value}/",
|
|
||||||
Text = response.Markdown,
|
|
||||||
DocumentMargin = new MarginPadding(0),
|
|
||||||
DocumentPadding = new MarginPadding
|
|
||||||
{
|
|
||||||
Vertical = 20,
|
|
||||||
Left = 30,
|
|
||||||
Right = 50,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onFail()
|
private void onFail()
|
||||||
{
|
{
|
||||||
LoadDisplay(new WikiMarkdownContainer
|
LoadDisplay(articlePage = new WikiArticlePage($@"{api.WebsiteRootUrl}/wiki/",
|
||||||
{
|
$"Something went wrong when trying to fetch page \"{path.Value}\".\n\n[Return to the main page](Main_Page)."));
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
AutoSizeAxes = Axes.Y,
|
|
||||||
CurrentPath = $@"{api.WebsiteRootUrl}/wiki/",
|
|
||||||
Text = $"Something went wrong when trying to fetch page \"{path.Value}\".\n\n[Return to the main page](Main_Page).",
|
|
||||||
DocumentMargin = new MarginPadding(0),
|
|
||||||
DocumentPadding = new MarginPadding
|
|
||||||
{
|
|
||||||
Vertical = 20,
|
|
||||||
Left = 30,
|
|
||||||
Right = 50,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showParentPage()
|
private void showParentPage()
|
||||||
|
@ -217,6 +217,9 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
|
|||||||
if (!judgement.IsHit || judgement.HitObject.HitWindows?.WindowFor(HitResult.Miss) == 0)
|
if (!judgement.IsHit || judgement.HitObject.HitWindows?.WindowFor(HitResult.Miss) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!judgement.Type.IsScorable() || judgement.Type.IsBonus())
|
||||||
|
return;
|
||||||
|
|
||||||
if (judgementsContainer.Count > max_concurrent_judgements)
|
if (judgementsContainer.Count > max_concurrent_judgements)
|
||||||
{
|
{
|
||||||
const double quick_fade_time = 100;
|
const double quick_fade_time = 100;
|
||||||
|
@ -7,6 +7,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
@ -24,7 +25,13 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
|
|||||||
InternalChild = judgementsFlow = new JudgementFlow();
|
InternalChild = judgementsFlow = new JudgementFlow();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnNewJudgement(JudgementResult judgement) => judgementsFlow.Push(GetColourForHitResult(judgement.Type));
|
protected override void OnNewJudgement(JudgementResult judgement)
|
||||||
|
{
|
||||||
|
if (!judgement.Type.IsScorable() || judgement.Type.IsBonus())
|
||||||
|
return;
|
||||||
|
|
||||||
|
judgementsFlow.Push(GetColourForHitResult(judgement.Type));
|
||||||
|
}
|
||||||
|
|
||||||
private class JudgementFlow : FillFlowContainer<HitErrorCircle>
|
private class JudgementFlow : FillFlowContainer<HitErrorCircle>
|
||||||
{
|
{
|
||||||
|
@ -41,6 +41,8 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
|
|||||||
{
|
{
|
||||||
switch (result)
|
switch (result)
|
||||||
{
|
{
|
||||||
|
case HitResult.SmallTickMiss:
|
||||||
|
case HitResult.LargeTickMiss:
|
||||||
case HitResult.Miss:
|
case HitResult.Miss:
|
||||||
return colours.Red;
|
return colours.Red;
|
||||||
|
|
||||||
@ -53,6 +55,8 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
|
|||||||
case HitResult.Good:
|
case HitResult.Good:
|
||||||
return colours.GreenLight;
|
return colours.GreenLight;
|
||||||
|
|
||||||
|
case HitResult.SmallTickHit:
|
||||||
|
case HitResult.LargeTickHit:
|
||||||
case HitResult.Great:
|
case HitResult.Great:
|
||||||
return colours.Blue;
|
return colours.Blue;
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2021.608.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2021.609.0" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.525.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.525.0" />
|
||||||
<PackageReference Include="Sentry" Version="3.4.0" />
|
<PackageReference Include="Sentry" Version="3.4.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.28.2" />
|
<PackageReference Include="SharpCompress" Version="0.28.2" />
|
||||||
|
@ -70,7 +70,7 @@
|
|||||||
<Reference Include="System.Net.Http" />
|
<Reference Include="System.Net.Http" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2021.608.0" />
|
<PackageReference Include="ppy.osu.Framework.iOS" Version="2021.609.0" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.525.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.525.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net5.0 / net6.0) -->
|
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net5.0 / net6.0) -->
|
||||||
@ -93,7 +93,7 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2021.608.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2021.609.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.28.2" />
|
<PackageReference Include="SharpCompress" Version="0.28.2" />
|
||||||
<PackageReference Include="NUnit" Version="3.13.2" />
|
<PackageReference Include="NUnit" Version="3.13.2" />
|
||||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||||
|
Loading…
Reference in New Issue
Block a user