1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 14:07:25 +08:00

Merge branch 'master' into chat-focus

This commit is contained in:
Dean Herbert 2017-06-06 19:13:30 +09:00 committed by GitHub
commit 78fc36904e
5 changed files with 96 additions and 127 deletions

@ -1 +1 @@
Subproject commit a5199500cc3ba96101fd858e0f78f36e538697b1
Subproject commit b348c1e540edbb3325a8da9bca452c9dce2938d6

View File

@ -7,21 +7,24 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
using osu.Game.Overlays.Notifications;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI;
using osu.Game.Screens.Play.HUD;
using OpenTK;
using OpenTK.Input;
namespace osu.Game.Screens.Play
{
public abstract class HUDOverlay : Container
public class HUDOverlay : Container
{
private const int duration = 100;
private readonly Container content;
public readonly KeyCounterCollection KeyCounter;
public readonly RollingCounter<int> ComboCounter;
public readonly ScoreCounter ScoreCounter;
@ -35,16 +38,7 @@ namespace osu.Game.Screens.Play
private static bool hasShownNotificationOnce;
protected abstract KeyCounterCollection CreateKeyCounter();
protected abstract RollingCounter<int> CreateComboCounter();
protected abstract RollingCounter<double> CreateAccuracyCounter();
protected abstract ScoreCounter CreateScoreCounter();
protected abstract HealthDisplay CreateHealthDisplay();
protected abstract SongProgress CreateProgress();
protected abstract ModDisplay CreateModsContainer();
//protected abstract ReplaySettingsOverlay CreateReplaySettingsOverlay();
protected HUDOverlay()
public HUDOverlay()
{
RelativeSizeAxes = Axes.Both;
@ -67,7 +61,7 @@ namespace osu.Game.Screens.Play
}
[BackgroundDependencyLoader(true)]
private void load(OsuConfigManager config, NotificationManager notificationManager)
private void load(OsuConfigManager config, NotificationManager notificationManager, OsuColour colours)
{
showHud = config.GetBindable<bool>(OsuSetting.ShowInterface);
showHud.ValueChanged += hudVisibility => content.FadeTo(hudVisibility ? 1 : 0, duration);
@ -82,14 +76,18 @@ namespace osu.Game.Screens.Play
Text = @"The score overlay is currently disabled. You can toggle this by pressing Shift+Tab."
});
}
}
public virtual void BindProcessor(ScoreProcessor processor)
// todo: the stuff below should probably not be in this base implementation, but in each individual class.
ComboCounter.AccentColour = colours.BlueLighter;
AccuracyCounter.AccentColour = colours.BlueLighter;
ScoreCounter.AccentColour = colours.BlueLighter;
var shd = HealthDisplay as StandardHealthDisplay;
if (shd != null)
{
ScoreCounter?.Current.BindTo(processor.TotalScore);
AccuracyCounter?.Current.BindTo(processor.Accuracy);
ComboCounter?.Current.BindTo(processor.Combo);
HealthDisplay?.Current.BindTo(processor.Health);
shd.AccentColour = colours.BlueLighter;
shd.GlowColour = colours.BlueDarker;
}
}
public virtual void BindHitRenderer(HitRenderer hitRenderer)
@ -122,5 +120,82 @@ namespace osu.Game.Screens.Play
return base.OnKeyDown(state, args);
}
protected virtual RollingCounter<double> CreateAccuracyCounter() => new PercentageCounter
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopRight,
Position = new Vector2(0, 35),
TextSize = 20,
Margin = new MarginPadding { Right = 140 },
};
protected virtual RollingCounter<int> CreateComboCounter() => new SimpleComboCounter
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopLeft,
Position = new Vector2(0, 35),
Margin = new MarginPadding { Left = 140 },
TextSize = 20,
};
protected virtual HealthDisplay CreateHealthDisplay() => new StandardHealthDisplay
{
Size = new Vector2(1, 5),
RelativeSizeAxes = Axes.X,
Margin = new MarginPadding { Top = 20 }
};
protected virtual KeyCounterCollection CreateKeyCounter() => new KeyCounterCollection
{
IsCounting = true,
FadeTime = 50,
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
Margin = new MarginPadding(10),
Y = -TwoLayerButton.SIZE_RETRACTED.Y,
};
protected virtual ScoreCounter CreateScoreCounter() => new ScoreCounter(6)
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
TextSize = 40,
Position = new Vector2(0, 30),
};
protected virtual SongProgress CreateProgress() => new SongProgress
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
RelativeSizeAxes = Axes.X,
};
protected virtual ModDisplay CreateModsContainer() => new ModDisplay
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
AutoSizeAxes = Axes.Both,
Margin = new MarginPadding { Top = 20, Right = 10 },
};
//protected virtual ReplaySettingsOverlay CreateReplaySettingsOverlay() => new ReplaySettingsOverlay
//{
// Anchor = Anchor.TopRight,
// Origin = Anchor.TopRight,
// Margin = new MarginPadding { Top = 100, Right = 10 },
//};
public virtual void BindProcessor(ScoreProcessor processor)
{
ScoreCounter?.Current.BindTo(processor.TotalScore);
AccuracyCounter?.Current.BindTo(processor.Accuracy);
ComboCounter?.Current.BindTo(processor.Combo);
HealthDisplay?.Current.BindTo(processor.Health);
var shd = HealthDisplay as StandardHealthDisplay;
if (shd != null)
processor.NewJudgement += shd.Flash;
}
}
}

View File

@ -170,7 +170,7 @@ namespace osu.Game.Screens.Play
HitRenderer,
}
},
hudOverlay = new StandardHUDOverlay
hudOverlay = new HUDOverlay
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre

View File

@ -1,105 +0,0 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets.Scoring;
using osu.Game.Screens.Play.HUD;
using OpenTK;
namespace osu.Game.Screens.Play
{
public class StandardHUDOverlay : HUDOverlay
{
protected override RollingCounter<double> CreateAccuracyCounter() => new PercentageCounter
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopRight,
Position = new Vector2(0, 35),
TextSize = 20,
Margin = new MarginPadding { Right = 140 },
};
protected override RollingCounter<int> CreateComboCounter() => new SimpleComboCounter
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopLeft,
Position = new Vector2(0, 35),
Margin = new MarginPadding { Left = 140 },
TextSize = 20,
};
protected override HealthDisplay CreateHealthDisplay() => new StandardHealthDisplay
{
Size = new Vector2(1, 5),
RelativeSizeAxes = Axes.X,
Margin = new MarginPadding { Top = 20 }
};
protected override KeyCounterCollection CreateKeyCounter() => new KeyCounterCollection
{
IsCounting = true,
FadeTime = 50,
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
Margin = new MarginPadding(10),
Y = -TwoLayerButton.SIZE_RETRACTED.Y,
};
protected override ScoreCounter CreateScoreCounter() => new ScoreCounter(6)
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
TextSize = 40,
Position = new Vector2(0, 30),
};
protected override SongProgress CreateProgress() => new SongProgress
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
RelativeSizeAxes = Axes.X,
};
protected override ModDisplay CreateModsContainer() => new ModDisplay
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
AutoSizeAxes = Axes.Both,
Margin = new MarginPadding { Top = 20, Right = 10 },
};
//protected override ReplaySettingsOverlay CreateReplaySettingsOverlay() => new ReplaySettingsOverlay
//{
// Anchor = Anchor.TopRight,
// Origin = Anchor.TopRight,
// Margin = new MarginPadding { Top = 100, Right = 10 },
//};
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
ComboCounter.AccentColour = colours.BlueLighter;
AccuracyCounter.AccentColour = colours.BlueLighter;
ScoreCounter.AccentColour = colours.BlueLighter;
var shd = HealthDisplay as StandardHealthDisplay;
if (shd != null)
{
shd.AccentColour = colours.BlueLighter;
shd.GlowColour = colours.BlueDarker;
}
}
public override void BindProcessor(ScoreProcessor processor)
{
base.BindProcessor(processor);
var shd = HealthDisplay as StandardHealthDisplay;
if (shd != null)
processor.NewJudgement += shd.Flash;
}
}
}

View File

@ -253,7 +253,6 @@
<Compile Include="Screens\Play\SongProgressInfo.cs" />
<Compile Include="Screens\Play\HUD\ModDisplay.cs" />
<Compile Include="Screens\Play\SquareGraph.cs" />
<Compile Include="Screens\Play\StandardHUDOverlay.cs" />
<Compile Include="Screens\Ranking\ResultsPage.cs" />
<Compile Include="Screens\Ranking\ResultsPageRanking.cs" />
<Compile Include="Screens\Ranking\ResultsPageScore.cs" />