1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 06:42:54 +08:00

Merge pull request #174 from peppy/general-fixes

General fixes
This commit is contained in:
Thomas Müller 2016-11-15 18:20:48 +01:00 committed by GitHub
commit 696d21f762
9 changed files with 49 additions and 19 deletions

View File

@ -22,8 +22,6 @@ namespace osu.Game.Graphics.UserInterface.Volume
private FlowContainer content;
protected override Container<Drawable> Content => content;
public override bool Contains(Vector2 screenSpacePos) => true;
private void volumeChanged(object sender, EventArgs e)
{
Show();
@ -70,13 +68,15 @@ namespace osu.Game.Graphics.UserInterface.Volume
base.Dispose(isDisposing);
}
protected override bool OnWheel(InputState state)
public void Adjust(InputState state)
{
if (!IsVisible)
return false;
{
Show();
return;
}
volumeMeterMaster.TriggerWheel(state);
return true;
}
ScheduledDelegate popOutDelegate;

View File

@ -12,11 +12,11 @@ namespace osu.Game.Graphics.UserInterface.Volume
{
class VolumeControlReceptor : Container
{
public Action ActivateRequested;
public Action<InputState> ActionRequested;
protected override bool OnWheel(InputState state)
{
ActivateRequested?.Invoke();
ActionRequested?.Invoke(state);
return true;
}
@ -26,7 +26,7 @@ namespace osu.Game.Graphics.UserInterface.Volume
{
case Key.Up:
case Key.Down:
ActivateRequested?.Invoke();
ActionRequested?.Invoke(state);
return true;
}

View File

@ -91,7 +91,7 @@ namespace osu.Game
new VolumeControlReceptor
{
RelativeSizeAxes = Axes.Both,
ActivateRequested = delegate { volume.Show(); }
ActionRequested = delegate(InputState state) { volume.Adjust(state); }
},
mainContent = new Container
{
@ -121,8 +121,8 @@ namespace osu.Game
//overlay elements
(chat = new ChatConsole(API) { Depth = 0 }).Preload(this, overlayContent.Add);
(musicController = new MusicController()).Preload(this, overlayContent.Add);
(Options = new OptionsOverlay { Depth = 1 }).Preload(this, overlayContent.Add);
(musicController = new MusicController() { Depth = 3 }).Preload(this, overlayContent.Add);
(Toolbar = new Toolbar
{
Depth = 2,
@ -175,9 +175,10 @@ namespace osu.Game
// - Frame limiter changes
//central game mode change logic.
if ((newMode as OsuGameMode)?.ShowToolbar != true)
if ((newMode as OsuGameMode)?.ShowOverlays != true)
{
Toolbar.State = Visibility.Hidden;
musicController.State = Visibility.Hidden;
chat.State = Visibility.Hidden;
}
else

View File

@ -12,8 +12,10 @@ using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Colour;
using osu.Game.Modes;
using osu.Game.Screens.Play;
using osu.Framework.Input;
namespace osu.Game.Overlays
{
@ -28,6 +30,7 @@ namespace osu.Game.Overlays
private ToolbarModeSelector modeSelector;
private ToolbarButton userButton;
private Box gradientBackground;
private const int transition_time = 200;
@ -43,6 +46,17 @@ namespace osu.Game.Overlays
FadeOut(transition_time, EasingTypes.InQuint);
}
protected override bool OnHover(InputState state)
{
gradientBackground.FadeIn(200);
return true;
}
protected override void OnHoverLost(InputState state)
{
gradientBackground.FadeOut(200);
}
public Toolbar()
{
Children = new Drawable[]
@ -50,7 +64,20 @@ namespace osu.Game.Overlays
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = new Color4(0.1f, 0.1f, 0.1f, 0.4f)
Colour = new Color4(0.1f, 0.1f, 0.1f, 0.6f)
},
gradientBackground = new Box
{
RelativeSizeAxes = Axes.X,
Anchor = Anchor.BottomLeft,
Alpha = 0,
Height = 90,
ColourInfo = new ColourInfo {
TopLeft = new Color4(0.1f, 0.1f, 0.1f, 0.5f),
TopRight = new Color4(0.1f, 0.1f, 0.1f, 0.5f),
BottomLeft = new Color4(0.1f, 0.1f, 0.1f, 0f),
BottomRight = new Color4(0.1f, 0.1f, 0.1f, 0f),
},
},
new FlowContainer
{

View File

@ -127,7 +127,9 @@ namespace osu.Game.Overlays
Size = new Vector2(WIDTH + (DrawableText.IsVisible ? DrawableText.DrawSize.X : 0), 1);
}
protected override bool OnMouseDown(InputState state, MouseDownEventArgs e)
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true;
protected override bool OnClick(InputState state)
{
Action?.Invoke();
HoverBackground.FlashColour(Color4.White, 400);
@ -138,7 +140,7 @@ namespace osu.Game.Overlays
{
HoverBackground.FadeTo(0.4f, 200);
tooltipContainer.FadeIn(100);
return true;
return false;
}
protected override void OnHoverLost(InputState state)

View File

@ -26,7 +26,7 @@ namespace osu.Game.Screens.Menu
private AudioSample welcome;
private AudioTrack bgm;
internal override bool ShowToolbar => (ParentGameMode as OsuGameMode)?.ShowToolbar ?? false;
internal override bool ShowOverlays => (ParentGameMode as OsuGameMode)?.ShowOverlays ?? false;
protected override BackgroundMode CreateBackground() => new BackgroundModeEmpty();

View File

@ -23,7 +23,7 @@ namespace osu.Game.Screens.Menu
private ButtonSystem buttons;
public override string Name => @"Main Menu";
internal override bool ShowToolbar => true;
internal override bool ShowOverlays => true;
private BackgroundMode background;

View File

@ -20,11 +20,11 @@ namespace osu.Game.Screens
/// </summary>
protected virtual BackgroundMode CreateBackground() => null;
internal virtual bool ShowToolbar => true;
internal virtual bool ShowOverlays => true;
protected new OsuGameBase Game => base.Game as OsuGameBase;
protected float ToolbarPadding => ShowToolbar ? (Game as OsuGame)?.Toolbar.DrawHeight ?? 0 : 0;
protected float ToolbarPadding => ShowOverlays ? (Game as OsuGame)?.Toolbar.DrawHeight ?? 0 : 0;
private bool boundToBeatmap;
private Bindable<WorkingBeatmap> beatmap;

View File

@ -26,7 +26,7 @@ namespace osu.Game.Screens.Play
protected override BackgroundMode CreateBackground() => new BackgroundModeCustom(@"Backgrounds/bg4");
internal override bool ShowToolbar => false;
internal override bool ShowOverlays => false;
public BeatmapInfo BeatmapInfo;