mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 08:52:55 +08:00
Merge branch 'master' into mania-hit-explosion
This commit is contained in:
commit
141e83fada
@ -63,6 +63,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.904.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2019.909.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2019.911.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
@ -68,6 +68,10 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||
Alpha = 0.2f;
|
||||
}
|
||||
|
||||
protected override void UpdateInitialTransforms()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void UpdateStateTransforms(ArmedState state)
|
||||
{
|
||||
}
|
||||
|
@ -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 System.Collections.Generic;
|
||||
using osu.Game.Overlays.Rankings;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Mania;
|
||||
using osu.Game.Rulesets.Taiko;
|
||||
using osu.Game.Rulesets.Catch;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
public class TestSceneRankingsRulesetSelector : OsuTestScene
|
||||
{
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||
{
|
||||
typeof(RankingsRulesetSelector),
|
||||
};
|
||||
|
||||
public TestSceneRankingsRulesetSelector()
|
||||
{
|
||||
var current = new Bindable<RulesetInfo>();
|
||||
|
||||
Add(new RankingsRulesetSelector
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Current = { BindTarget = current }
|
||||
});
|
||||
|
||||
AddStep("Select osu!", () => current.Value = new OsuRuleset().RulesetInfo);
|
||||
AddStep("Select mania", () => current.Value = new ManiaRuleset().RulesetInfo);
|
||||
AddStep("Select taiko", () => current.Value = new TaikoRuleset().RulesetInfo);
|
||||
AddStep("Select catch", () => current.Value = new CatchRuleset().RulesetInfo);
|
||||
}
|
||||
}
|
||||
}
|
@ -32,7 +32,7 @@ namespace osu.Game.Graphics.Containers
|
||||
protected virtual bool DimMainContent => true;
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
private OsuGame osuGame { get; set; }
|
||||
private OsuGame game { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private PreviewTrackManager previewTrackManager { get; set; }
|
||||
@ -42,13 +42,22 @@ namespace osu.Game.Graphics.Containers
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
if (osuGame != null)
|
||||
OverlayActivationMode.BindTo(osuGame.OverlayActivationMode);
|
||||
|
||||
samplePopIn = audio.Samples.Get(@"UI/overlay-pop-in");
|
||||
samplePopOut = audio.Samples.Get(@"UI/overlay-pop-out");
|
||||
}
|
||||
|
||||
State.ValueChanged += onStateChanged;
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
if (game != null)
|
||||
OverlayActivationMode.BindTo(game.OverlayActivationMode);
|
||||
|
||||
OverlayActivationMode.BindValueChanged(mode =>
|
||||
{
|
||||
if (mode.NewValue == OverlayActivation.Disabled)
|
||||
State.Value = Visibility.Hidden;
|
||||
}, true);
|
||||
|
||||
base.LoadComplete();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -106,26 +115,28 @@ namespace osu.Game.Graphics.Containers
|
||||
|
||||
public bool OnReleased(GlobalAction action) => false;
|
||||
|
||||
private void onStateChanged(ValueChangedEvent<Visibility> state)
|
||||
protected override void UpdateState(ValueChangedEvent<Visibility> state)
|
||||
{
|
||||
switch (state.NewValue)
|
||||
{
|
||||
case Visibility.Visible:
|
||||
if (OverlayActivationMode.Value != OverlayActivation.Disabled)
|
||||
if (OverlayActivationMode.Value == OverlayActivation.Disabled)
|
||||
{
|
||||
if (PlaySamplesOnStateChange) samplePopIn?.Play();
|
||||
if (BlockScreenWideMouse && DimMainContent) osuGame?.AddBlockingOverlay(this);
|
||||
State.Value = Visibility.Hidden;
|
||||
return;
|
||||
}
|
||||
else
|
||||
Hide();
|
||||
|
||||
if (PlaySamplesOnStateChange) samplePopIn?.Play();
|
||||
if (BlockScreenWideMouse && DimMainContent) game?.AddBlockingOverlay(this);
|
||||
break;
|
||||
|
||||
case Visibility.Hidden:
|
||||
if (PlaySamplesOnStateChange) samplePopOut?.Play();
|
||||
if (BlockScreenWideMouse) osuGame?.RemoveBlockingOverlay(this);
|
||||
if (BlockScreenWideMouse) game?.RemoveBlockingOverlay(this);
|
||||
break;
|
||||
}
|
||||
|
||||
base.UpdateState(state);
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
@ -137,7 +148,7 @@ namespace osu.Game.Graphics.Containers
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
osuGame?.RemoveBlockingOverlay(this);
|
||||
game?.RemoveBlockingOverlay(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
Margin = new MarginPadding { Top = 8, Bottom = 8 },
|
||||
Origin = Anchor.BottomLeft,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Text = (value as Enum)?.GetDescription() ?? value.ToString(),
|
||||
Text = CreateText(),
|
||||
Font = OsuFont.GetFont(size: 14)
|
||||
},
|
||||
box = new Box
|
||||
@ -81,6 +81,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
Active.BindValueChanged(active => Text.Font = Text.Font.With(Typeface.Exo, weight: active.NewValue ? FontWeight.Bold : FontWeight.Medium), true);
|
||||
}
|
||||
|
||||
protected virtual string CreateText() => (Value as Enum)?.GetDescription() ?? Value.ToString();
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
{
|
||||
if (!Active.Value)
|
||||
|
56
osu.Game/Overlays/Rankings/RankingsRulesetSelector.cs
Normal file
56
osu.Game/Overlays/Rankings/RankingsRulesetSelector.cs
Normal file
@ -0,0 +1,56 @@
|
||||
// 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.Graphics.UserInterface;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Rulesets;
|
||||
using osuTK;
|
||||
using System.Linq;
|
||||
|
||||
namespace osu.Game.Overlays.Rankings
|
||||
{
|
||||
public class RankingsRulesetSelector : PageTabControl<RulesetInfo>
|
||||
{
|
||||
protected override TabItem<RulesetInfo> CreateTabItem(RulesetInfo value) => new RankingsTabItem(value);
|
||||
|
||||
protected override Dropdown<RulesetInfo> CreateDropdown() => null;
|
||||
|
||||
public RankingsRulesetSelector()
|
||||
{
|
||||
AutoSizeAxes = Axes.X;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours, RulesetStore rulesets)
|
||||
{
|
||||
foreach (var r in rulesets.AvailableRulesets)
|
||||
AddItem(r);
|
||||
|
||||
AccentColour = colours.Lime;
|
||||
|
||||
SelectTab(TabContainer.FirstOrDefault());
|
||||
}
|
||||
|
||||
protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.X,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Spacing = new Vector2(20, 0),
|
||||
};
|
||||
|
||||
private class RankingsTabItem : PageTabItem
|
||||
{
|
||||
public RankingsTabItem(RulesetInfo value)
|
||||
: base(value)
|
||||
{
|
||||
}
|
||||
|
||||
protected override string CreateText() => $"{Value.Name}";
|
||||
}
|
||||
}
|
||||
}
|
@ -26,7 +26,7 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.904.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2019.909.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2019.911.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.24.0" />
|
||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||
|
@ -118,8 +118,8 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.904.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2019.909.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.909.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2019.911.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.911.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.24.0" />
|
||||
<PackageReference Include="NUnit" Version="3.11.0" />
|
||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||
|
Loading…
Reference in New Issue
Block a user