Merge branch 'master' into ParallaxContainerImprovement

This commit is contained in:
Dean Herbert
2018-06-21 12:10:10 +09:00
committed by GitHub
313 changed files with 6922 additions and 4314 deletions

View File

@ -12,7 +12,7 @@ namespace osu.Game.Graphics.Containers
{
public class BeatSyncedContainer : Container
{
protected readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
protected readonly IBindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
private int lastBeat;
private TimingControlPoint lastTimingPoint;
@ -74,9 +74,9 @@ namespace osu.Game.Graphics.Containers
}
[BackgroundDependencyLoader]
private void load(OsuGameBase game)
private void load(IBindableBeatmap beatmap)
{
Beatmap.BindTo(game.Beatmap);
Beatmap.BindTo(beatmap);
}
protected virtual void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)

View File

@ -3,11 +3,11 @@
using osu.Game.Online.Chat;
using System;
using System.Diagnostics;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Sprites;
using System.Collections.Generic;
using osu.Framework.Platform;
using osu.Game.Overlays;
using osu.Game.Overlays.Notifications;
@ -25,12 +25,14 @@ namespace osu.Game.Graphics.Containers
private OsuGame game;
private Action showNotImplementedError;
private GameHost host;
[BackgroundDependencyLoader(true)]
private void load(OsuGame game, NotificationOverlay notifications)
private void load(OsuGame game, NotificationOverlay notifications, GameHost host)
{
// will be null in tests
this.game = game;
this.host = host;
showNotImplementedError = () => notifications?.Post(new SimpleNotification
{
@ -88,7 +90,7 @@ namespace osu.Game.Graphics.Containers
showNotImplementedError?.Invoke();
break;
case LinkAction.External:
Process.Start(url);
host.OpenUrlExternally(url);
break;
case LinkAction.OpenUserProfile:
if (long.TryParse(linkArgument, out long userId))

View File

@ -8,6 +8,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Input;
using OpenTK;
using osu.Framework.Configuration;
using osu.Game.Overlays;
namespace osu.Game.Graphics.Containers
{
@ -16,13 +17,13 @@ namespace osu.Game.Graphics.Containers
private SampleChannel samplePopIn;
private SampleChannel samplePopOut;
private readonly BindableBool allowOpeningOverlays = new BindableBool(true);
protected readonly Bindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>(OverlayActivation.All);
[BackgroundDependencyLoader(true)]
private void load(OsuGame osuGame, AudioManager audio)
{
if (osuGame != null)
allowOpeningOverlays.BindTo(osuGame.AllowOpeningOverlays);
OverlayActivationMode.BindTo(osuGame.OverlayActivationMode);
samplePopIn = audio.Sample.Get(@"UI/overlay-pop-in");
samplePopOut = audio.Sample.Get(@"UI/overlay-pop-out");
@ -32,7 +33,7 @@ namespace osu.Game.Graphics.Containers
/// <summary>
/// Whether mouse input should be blocked screen-wide while this overlay is visible.
/// Performing mouse actions outside of the valid extents will hide the overlay but pass the events through.
/// Performing mouse actions outside of the valid extents will hide the overlay.
/// </summary>
public virtual bool BlockScreenWideMouse => BlockPassThroughMouse;
@ -52,20 +53,18 @@ namespace osu.Game.Graphics.Containers
private void onStateChanged(Visibility visibility)
{
if (allowOpeningOverlays)
switch (visibility)
{
switch (visibility)
{
case Visibility.Visible:
case Visibility.Visible:
if (OverlayActivationMode != OverlayActivation.Disabled)
samplePopIn?.Play();
break;
case Visibility.Hidden:
samplePopOut?.Play();
break;
}
else
State = Visibility.Hidden;
break;
case Visibility.Hidden:
samplePopOut?.Play();
break;
}
else
State = Visibility.Hidden;
}
}
}