mirror of
https://github.com/ppy/osu.git
synced 2024-11-14 15:57:24 +08:00
Merge branch 'master' into hp-drain
This commit is contained in:
commit
aa97487f8e
@ -53,7 +53,7 @@
|
|||||||
<Reference Include="Java.Interop" />
|
<Reference Include="Java.Interop" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.1215.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.1227.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2019.1225.0" />
|
<PackageReference Include="ppy.osu.Framework.Android" Version="2019.1227.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
46
osu.Game.Rulesets.Mania.Tests/SkinnableTestScene.cs
Normal file
46
osu.Game.Rulesets.Mania.Tests/SkinnableTestScene.cs
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
// 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.Allocation;
|
||||||
|
using osu.Framework.Audio;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
using osu.Game.Tests.Visual;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mania.Tests
|
||||||
|
{
|
||||||
|
public abstract class SkinnableTestScene : OsuGridTestScene
|
||||||
|
{
|
||||||
|
private Skin defaultSkin;
|
||||||
|
|
||||||
|
protected SkinnableTestScene()
|
||||||
|
: base(1, 2)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(AudioManager audio, SkinManager skinManager)
|
||||||
|
{
|
||||||
|
defaultSkin = skinManager.GetSkin(DefaultLegacySkin.Info);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetContents(Func<Drawable> creationFunction)
|
||||||
|
{
|
||||||
|
Cell(0).Child = createProvider(null, creationFunction);
|
||||||
|
Cell(1).Child = createProvider(defaultSkin, creationFunction);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Drawable createProvider(Skin skin, Func<Drawable> creationFunction)
|
||||||
|
{
|
||||||
|
var mainProvider = new SkinProvidingContainer(skin);
|
||||||
|
|
||||||
|
return mainProvider
|
||||||
|
.WithChild(new SkinProvidingContainer(Ruleset.Value.CreateInstance().CreateLegacySkinProvider(mainProvider))
|
||||||
|
{
|
||||||
|
Child = creationFunction()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
37
osu.Game.Rulesets.Mania.Tests/TestSceneDrawableJudgement.cs
Normal file
37
osu.Game.Rulesets.Mania.Tests/TestSceneDrawableJudgement.cs
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// 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.Mania.UI;
|
||||||
|
using osu.Game.Rulesets.Judgements;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mania.Tests
|
||||||
|
{
|
||||||
|
public class TestSceneDrawableJudgement : SkinnableTestScene
|
||||||
|
{
|
||||||
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
|
{
|
||||||
|
typeof(DrawableJudgement),
|
||||||
|
typeof(DrawableManiaJudgement)
|
||||||
|
};
|
||||||
|
|
||||||
|
public TestSceneDrawableJudgement()
|
||||||
|
{
|
||||||
|
foreach (HitResult result in Enum.GetValues(typeof(HitResult)).OfType<HitResult>().Skip(1))
|
||||||
|
{
|
||||||
|
AddStep("Show " + result.GetDescription(), () => SetContents(() =>
|
||||||
|
new DrawableManiaJudgement(new JudgementResult(new HitObject(), new Judgement()) { Type = result }, null)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -26,7 +26,9 @@ using osu.Game.Rulesets.Mania.Configuration;
|
|||||||
using osu.Game.Rulesets.Mania.Difficulty;
|
using osu.Game.Rulesets.Mania.Difficulty;
|
||||||
using osu.Game.Rulesets.Mania.Edit;
|
using osu.Game.Rulesets.Mania.Edit;
|
||||||
using osu.Game.Rulesets.Mania.Scoring;
|
using osu.Game.Rulesets.Mania.Scoring;
|
||||||
|
using osu.Game.Rulesets.Mania.Skinning;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osu.Game.Skinning;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania
|
namespace osu.Game.Rulesets.Mania
|
||||||
@ -45,6 +47,8 @@ namespace osu.Game.Rulesets.Mania
|
|||||||
|
|
||||||
public override HitObjectComposer CreateHitObjectComposer() => new ManiaHitObjectComposer(this);
|
public override HitObjectComposer CreateHitObjectComposer() => new ManiaHitObjectComposer(this);
|
||||||
|
|
||||||
|
public override ISkin CreateLegacySkinProvider(ISkinSource source) => new ManiaLegacySkinTransformer(source);
|
||||||
|
|
||||||
public override IEnumerable<Mod> ConvertLegacyMods(LegacyMods mods)
|
public override IEnumerable<Mod> ConvertLegacyMods(LegacyMods mods)
|
||||||
{
|
{
|
||||||
if (mods.HasFlag(LegacyMods.Nightcore))
|
if (mods.HasFlag(LegacyMods.Nightcore))
|
||||||
|
@ -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.Graphics;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using osu.Framework.Audio.Sample;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osu.Game.Audio;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mania.Skinning
|
||||||
|
{
|
||||||
|
public class ManiaLegacySkinTransformer : ISkin
|
||||||
|
{
|
||||||
|
private readonly ISkin source;
|
||||||
|
|
||||||
|
public ManiaLegacySkinTransformer(ISkin source)
|
||||||
|
{
|
||||||
|
this.source = source;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Drawable GetDrawableComponent(ISkinComponent component)
|
||||||
|
{
|
||||||
|
switch (component)
|
||||||
|
{
|
||||||
|
case GameplaySkinComponent<HitResult> resultComponent:
|
||||||
|
return getResult(resultComponent);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Drawable getResult(GameplaySkinComponent<HitResult> resultComponent)
|
||||||
|
{
|
||||||
|
switch (resultComponent.Component)
|
||||||
|
{
|
||||||
|
case HitResult.Miss:
|
||||||
|
return this.GetAnimation("mania-hit0", true, true);
|
||||||
|
|
||||||
|
case HitResult.Meh:
|
||||||
|
return this.GetAnimation("mania-hit50", true, true);
|
||||||
|
|
||||||
|
case HitResult.Ok:
|
||||||
|
return this.GetAnimation("mania-hit100", true, true);
|
||||||
|
|
||||||
|
case HitResult.Good:
|
||||||
|
return this.GetAnimation("mania-hit200", true, true);
|
||||||
|
|
||||||
|
case HitResult.Great:
|
||||||
|
return this.GetAnimation("mania-hit300", true, true);
|
||||||
|
|
||||||
|
case HitResult.Perfect:
|
||||||
|
return this.GetAnimation("mania-hit300g", true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Texture GetTexture(string componentName) => source.GetTexture(componentName);
|
||||||
|
|
||||||
|
public SampleChannel GetSample(ISampleInfo sample) => source.GetSample(sample);
|
||||||
|
|
||||||
|
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) =>
|
||||||
|
source.GetConfig<TLookup, TValue>(lookup);
|
||||||
|
}
|
||||||
|
}
|
@ -67,9 +67,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
|
|
||||||
AddRepeatStep(@"add many simple", sendManyNotifications, 3);
|
AddRepeatStep(@"add many simple", sendManyNotifications, 3);
|
||||||
|
|
||||||
AddWaitStep("wait some", 5);
|
waitForCompletion();
|
||||||
|
|
||||||
checkProgressingCount(0);
|
|
||||||
|
|
||||||
AddStep(@"progress #3", sendUploadProgress);
|
AddStep(@"progress #3", sendUploadProgress);
|
||||||
|
|
||||||
@ -77,9 +75,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
|
|
||||||
checkDisplayedCount(33);
|
checkDisplayedCount(33);
|
||||||
|
|
||||||
AddWaitStep("wait some", 10);
|
waitForCompletion();
|
||||||
|
|
||||||
checkProgressingCount(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -109,9 +105,9 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
|
|
||||||
AddStep(@"background progress #1", sendBackgroundUploadProgress);
|
AddStep(@"background progress #1", sendBackgroundUploadProgress);
|
||||||
|
|
||||||
AddWaitStep("wait some", 5);
|
checkProgressingCount(1);
|
||||||
|
|
||||||
checkProgressingCount(0);
|
waitForCompletion();
|
||||||
|
|
||||||
checkDisplayedCount(2);
|
checkDisplayedCount(2);
|
||||||
|
|
||||||
@ -190,6 +186,8 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
|
|
||||||
private void checkProgressingCount(int expected) => AddAssert($"progressing count is {expected}", () => progressingNotifications.Count == expected);
|
private void checkProgressingCount(int expected) => AddAssert($"progressing count is {expected}", () => progressingNotifications.Count == expected);
|
||||||
|
|
||||||
|
private void waitForCompletion() => AddUntilStep("wait for notification progress completion", () => progressingNotifications.Count == 0);
|
||||||
|
|
||||||
private void sendBarrage()
|
private void sendBarrage()
|
||||||
{
|
{
|
||||||
switch (RNG.Next(0, 4))
|
switch (RNG.Next(0, 4))
|
||||||
|
@ -259,6 +259,9 @@ namespace osu.Game.Database
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a SHA-2 hash from the provided archive based on file content of all files matching <see cref="HashableFileTypes"/>.
|
/// Create a SHA-2 hash from the provided archive based on file content of all files matching <see cref="HashableFileTypes"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// In the case of no matching files, a hash will be generated from the passed archive's <see cref="ArchiveReader.Name"/>.
|
||||||
|
/// </remarks>
|
||||||
private string computeHash(ArchiveReader reader)
|
private string computeHash(ArchiveReader reader)
|
||||||
{
|
{
|
||||||
// for now, concatenate all .osu files in the set to create a unique hash.
|
// for now, concatenate all .osu files in the set to create a unique hash.
|
||||||
@ -270,7 +273,7 @@ namespace osu.Game.Database
|
|||||||
s.CopyTo(hashable);
|
s.CopyTo(hashable);
|
||||||
}
|
}
|
||||||
|
|
||||||
return hashable.Length > 0 ? hashable.ComputeSHA2Hash() : null;
|
return hashable.Length > 0 ? hashable.ComputeSHA2Hash() : reader.Name.ComputeSHA2Hash();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -13,15 +14,15 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
public abstract class ScreenTitle : CompositeDrawable, IHasAccentColour
|
public abstract class ScreenTitle : CompositeDrawable, IHasAccentColour
|
||||||
{
|
{
|
||||||
public const float ICON_WIDTH = ICON_SIZE + icon_spacing;
|
public const float ICON_WIDTH = ICON_SIZE + spacing;
|
||||||
|
|
||||||
public const float ICON_SIZE = 25;
|
public const float ICON_SIZE = 25;
|
||||||
|
private const float spacing = 6;
|
||||||
|
private const int text_offset = 2;
|
||||||
|
|
||||||
private SpriteIcon iconSprite;
|
private SpriteIcon iconSprite;
|
||||||
private readonly OsuSpriteText titleText, pageText;
|
private readonly OsuSpriteText titleText, pageText;
|
||||||
|
|
||||||
private const float icon_spacing = 10;
|
|
||||||
|
|
||||||
protected IconUsage Icon
|
protected IconUsage Icon
|
||||||
{
|
{
|
||||||
set
|
set
|
||||||
@ -63,26 +64,35 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
new FillFlowContainer
|
new FillFlowContainer
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Spacing = new Vector2(icon_spacing, 0),
|
Spacing = new Vector2(spacing, 0),
|
||||||
Children = new[]
|
|
||||||
{
|
|
||||||
CreateIcon(),
|
|
||||||
new FillFlowContainer
|
|
||||||
{
|
|
||||||
AutoSizeAxes = Axes.Both,
|
|
||||||
Direction = FillDirection.Horizontal,
|
Direction = FillDirection.Horizontal,
|
||||||
Spacing = new Vector2(6, 0),
|
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
|
CreateIcon().With(t =>
|
||||||
|
{
|
||||||
|
t.Anchor = Anchor.Centre;
|
||||||
|
t.Origin = Anchor.Centre;
|
||||||
|
}),
|
||||||
titleText = new OsuSpriteText
|
titleText = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Font = OsuFont.GetFont(size: 30, weight: FontWeight.Light),
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Font = OsuFont.GetFont(size: 20, weight: FontWeight.Bold),
|
||||||
|
Margin = new MarginPadding { Bottom = text_offset }
|
||||||
|
},
|
||||||
|
new Circle
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Size = new Vector2(4),
|
||||||
|
Colour = Color4.Gray,
|
||||||
},
|
},
|
||||||
pageText = new OsuSpriteText
|
pageText = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Font = OsuFont.GetFont(size: 30, weight: FontWeight.Light),
|
Anchor = Anchor.Centre,
|
||||||
}
|
Origin = Anchor.Centre,
|
||||||
}
|
Font = OsuFont.GetFont(size: 20),
|
||||||
|
Margin = new MarginPadding { Bottom = text_offset }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -16,8 +15,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ScreenTitleTextureIcon : CompositeDrawable
|
public class ScreenTitleTextureIcon : CompositeDrawable
|
||||||
{
|
{
|
||||||
private const float circle_allowance = 0.8f;
|
|
||||||
|
|
||||||
private readonly string textureName;
|
private readonly string textureName;
|
||||||
|
|
||||||
public ScreenTitleTextureIcon(string textureName)
|
public ScreenTitleTextureIcon(string textureName)
|
||||||
@ -26,38 +23,17 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(TextureStore textures, OsuColour colours)
|
private void load(TextureStore textures)
|
||||||
{
|
{
|
||||||
Size = new Vector2(ScreenTitle.ICON_SIZE / circle_allowance);
|
Size = new Vector2(ScreenTitle.ICON_SIZE);
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChild = new Sprite
|
||||||
{
|
|
||||||
new CircularContainer
|
|
||||||
{
|
|
||||||
Masking = true,
|
|
||||||
BorderColour = colours.Violet,
|
|
||||||
BorderThickness = 3,
|
|
||||||
MaskingSmoothness = 1,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new Sprite
|
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Texture = textures.Get(textureName),
|
Texture = textures.Get(textureName),
|
||||||
Size = new Vector2(circle_allowance),
|
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
},
|
FillMode = FillMode.Fit
|
||||||
new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Colour = colours.Violet,
|
|
||||||
Alpha = 0,
|
|
||||||
AlwaysPresent = true,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,8 @@ namespace osu.Game.Overlays.Changelog
|
|||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
TabControl.AccentColour = colours.Violet;
|
TabControl.AccentColour = colours.Violet;
|
||||||
|
TitleBackgroundColour = colours.GreyVioletDarker;
|
||||||
|
ControlBackgroundColour = colours.GreyVioletDark;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ChangelogHeaderTitle title;
|
private ChangelogHeaderTitle title;
|
||||||
@ -111,7 +113,7 @@ namespace osu.Game.Overlays.Changelog
|
|||||||
|
|
||||||
public ChangelogHeaderTitle()
|
public ChangelogHeaderTitle()
|
||||||
{
|
{
|
||||||
Title = "Changelog";
|
Title = "changelog";
|
||||||
Version = null;
|
Version = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
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;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
@ -15,7 +14,7 @@ namespace osu.Game.Overlays.News
|
|||||||
{
|
{
|
||||||
public class NewsHeader : OverlayHeader
|
public class NewsHeader : OverlayHeader
|
||||||
{
|
{
|
||||||
private const string front_page_string = "Front Page";
|
private const string front_page_string = "frontpage";
|
||||||
|
|
||||||
private NewsHeaderTitle title;
|
private NewsHeaderTitle title;
|
||||||
|
|
||||||
@ -33,16 +32,18 @@ namespace osu.Game.Overlays.News
|
|||||||
ShowFrontPage?.Invoke();
|
ShowFrontPage?.Invoke();
|
||||||
};
|
};
|
||||||
|
|
||||||
Current.ValueChanged += showArticle;
|
Current.ValueChanged += showPost;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colour)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
TabControl.AccentColour = colour.Violet;
|
TabControl.AccentColour = colours.Violet;
|
||||||
|
TitleBackgroundColour = colours.GreyVioletDarker;
|
||||||
|
ControlBackgroundColour = colours.GreyVioletDark;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showArticle(ValueChangedEvent<string> e)
|
private void showPost(ValueChangedEvent<string> e)
|
||||||
{
|
{
|
||||||
if (e.OldValue != null)
|
if (e.OldValue != null)
|
||||||
TabControl.RemoveItem(e.OldValue);
|
TabControl.RemoveItem(e.OldValue);
|
||||||
@ -52,19 +53,17 @@ namespace osu.Game.Overlays.News
|
|||||||
TabControl.AddItem(e.NewValue);
|
TabControl.AddItem(e.NewValue);
|
||||||
TabControl.Current.Value = e.NewValue;
|
TabControl.Current.Value = e.NewValue;
|
||||||
|
|
||||||
title.IsReadingArticle = true;
|
title.IsReadingPost = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TabControl.Current.Value = front_page_string;
|
TabControl.Current.Value = front_page_string;
|
||||||
title.IsReadingArticle = false;
|
title.IsReadingPost = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Drawable CreateBackground() => new NewsHeaderBackground();
|
protected override Drawable CreateBackground() => new NewsHeaderBackground();
|
||||||
|
|
||||||
protected override Drawable CreateContent() => new Container();
|
|
||||||
|
|
||||||
protected override ScreenTitle CreateTitle() => title = new NewsHeaderTitle();
|
protected override ScreenTitle CreateTitle() => title = new NewsHeaderTitle();
|
||||||
|
|
||||||
private class NewsHeaderBackground : Sprite
|
private class NewsHeaderBackground : Sprite
|
||||||
@ -84,17 +83,17 @@ namespace osu.Game.Overlays.News
|
|||||||
|
|
||||||
private class NewsHeaderTitle : ScreenTitle
|
private class NewsHeaderTitle : ScreenTitle
|
||||||
{
|
{
|
||||||
private const string article_string = "Article";
|
private const string post_string = "post";
|
||||||
|
|
||||||
public bool IsReadingArticle
|
public bool IsReadingPost
|
||||||
{
|
{
|
||||||
set => Section = value ? article_string : front_page_string;
|
set => Section = value ? post_string : front_page_string;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NewsHeaderTitle()
|
public NewsHeaderTitle()
|
||||||
{
|
{
|
||||||
Title = "News";
|
Title = "news";
|
||||||
IsReadingArticle = false;
|
IsReadingPost = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Drawable CreateIcon() => new ScreenTitleTextureIcon(@"Icons/news");
|
protected override Drawable CreateIcon() => new ScreenTitleTextureIcon(@"Icons/news");
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
// 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 JetBrains.Annotations;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
@ -11,59 +14,96 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
protected readonly OverlayHeaderTabControl TabControl;
|
protected readonly OverlayHeaderTabControl TabControl;
|
||||||
|
|
||||||
private const float cover_height = 150;
|
private readonly Box titleBackground;
|
||||||
private const float cover_info_height = 75;
|
private readonly Box controlBackground;
|
||||||
|
private readonly Container background;
|
||||||
|
|
||||||
|
protected Color4 TitleBackgroundColour
|
||||||
|
{
|
||||||
|
set => titleBackground.Colour = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Color4 ControlBackgroundColour
|
||||||
|
{
|
||||||
|
set => controlBackground.Colour = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected float BackgroundHeight
|
||||||
|
{
|
||||||
|
set => background.Height = value;
|
||||||
|
}
|
||||||
|
|
||||||
protected OverlayHeader()
|
protected OverlayHeader()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Add(new FillFlowContainer
|
||||||
{
|
|
||||||
new Container
|
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Height = cover_height,
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
background = new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Height = 80,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
Child = CreateBackground()
|
Child = CreateBackground()
|
||||||
},
|
},
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
Margin = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN },
|
|
||||||
Y = cover_height,
|
|
||||||
Height = cover_info_height,
|
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Anchor = Anchor.TopLeft,
|
AutoSizeAxes = Axes.Y,
|
||||||
Origin = Anchor.BottomLeft,
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
titleBackground = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = Color4.Gray,
|
||||||
|
},
|
||||||
|
CreateTitle().With(title =>
|
||||||
|
{
|
||||||
|
title.Margin = new MarginPadding
|
||||||
|
{
|
||||||
|
Vertical = 10,
|
||||||
|
Left = UserProfileOverlay.CONTENT_X_MARGIN
|
||||||
|
};
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
Depth = -float.MaxValue,
|
Depth = -float.MaxValue,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
CreateTitle().With(t => t.X = -ScreenTitle.ICON_WIDTH),
|
controlBackground = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = Color4.Gray,
|
||||||
|
},
|
||||||
TabControl = new OverlayHeaderTabControl
|
TabControl = new OverlayHeaderTabControl
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Height = cover_info_height - 30,
|
Height = 30,
|
||||||
Margin = new MarginPadding { Left = -UserProfileOverlay.CONTENT_X_MARGIN },
|
Padding = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN },
|
||||||
Padding = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new Container
|
CreateContent()
|
||||||
{
|
|
||||||
Margin = new MarginPadding { Top = cover_height },
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
AutoSizeAxes = Axes.Y,
|
|
||||||
Child = CreateContent()
|
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract Drawable CreateBackground();
|
protected abstract Drawable CreateBackground();
|
||||||
|
|
||||||
protected abstract Drawable CreateContent();
|
[NotNull]
|
||||||
|
protected virtual Drawable CreateContent() => new Container();
|
||||||
|
|
||||||
protected abstract ScreenTitle CreateTitle();
|
protected abstract ScreenTitle CreateTitle();
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,8 @@ namespace osu.Game.Overlays.Profile
|
|||||||
|
|
||||||
public ProfileHeader()
|
public ProfileHeader()
|
||||||
{
|
{
|
||||||
|
BackgroundHeight = 150;
|
||||||
|
|
||||||
User.ValueChanged += e => updateDisplay(e.NewValue);
|
User.ValueChanged += e => updateDisplay(e.NewValue);
|
||||||
|
|
||||||
TabControl.AddItem("Info");
|
TabControl.AddItem("Info");
|
||||||
@ -38,6 +40,8 @@ namespace osu.Game.Overlays.Profile
|
|||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
TabControl.AccentColour = colours.Seafoam;
|
TabControl.AccentColour = colours.Seafoam;
|
||||||
|
TitleBackgroundColour = colours.GreySeafoamDarker;
|
||||||
|
ControlBackgroundColour = colours.GreySeafoam;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Drawable CreateBackground() =>
|
protected override Drawable CreateBackground() =>
|
||||||
@ -101,8 +105,8 @@ namespace osu.Game.Overlays.Profile
|
|||||||
{
|
{
|
||||||
public ProfileHeaderTitle()
|
public ProfileHeaderTitle()
|
||||||
{
|
{
|
||||||
Title = "Player";
|
Title = "player";
|
||||||
Section = "Info";
|
Section = "info";
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -110,6 +114,8 @@ namespace osu.Game.Overlays.Profile
|
|||||||
{
|
{
|
||||||
AccentColour = colours.Seafoam;
|
AccentColour = colours.Seafoam;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override Drawable CreateIcon() => new ScreenTitleTextureIcon(@"Icons/profile");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,8 @@
|
|||||||
<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="12.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.1215.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.1227.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2019.1225.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2019.1227.0" />
|
||||||
<PackageReference Include="Sentry" Version="1.2.0" />
|
<PackageReference Include="Sentry" Version="1.2.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.24.0" />
|
<PackageReference Include="SharpCompress" Version="0.24.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
|
@ -73,8 +73,8 @@
|
|||||||
<Reference Include="System.Net.Http" />
|
<Reference Include="System.Net.Http" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.1215.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.1227.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.1225.0" />
|
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.1227.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->
|
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->
|
||||||
<ItemGroup Label="Transitive Dependencies">
|
<ItemGroup Label="Transitive Dependencies">
|
||||||
@ -82,7 +82,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="12.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2019.1225.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2019.1227.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.24.0" />
|
<PackageReference Include="SharpCompress" Version="0.24.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||||
|
Loading…
Reference in New Issue
Block a user