1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 20:13:22 +08:00

Merge remote-tracking branch 'upstream/master' into peppy-clickable-download-notifications

This commit is contained in:
Dean Herbert 2018-07-13 21:04:17 +09:00
commit a1a077398c
36 changed files with 305 additions and 195 deletions

View File

@ -2,6 +2,9 @@ clone_depth: 1
version: '{branch}-{build}' version: '{branch}-{build}'
image: Visual Studio 2017 image: Visual Studio 2017
configuration: Debug configuration: Debug
cache:
- C:\ProgramData\chocolatey\bin -> appveyor.yml
- C:\ProgramData\chocolatey\lib -> appveyor.yml
install: install:
- cmd: git submodule update --init --recursive --depth=5 - cmd: git submodule update --init --recursive --depth=5
- cmd: choco install resharper-clt -y - cmd: choco install resharper-clt -y
@ -18,4 +21,4 @@ build:
verbosity: minimal verbosity: minimal
after_build: after_build:
- cmd: inspectcode --o="inspectcodereport.xml" --projects:osu.Game* --caches-home="inspectcode" osu.sln > NUL - cmd: inspectcode --o="inspectcodereport.xml" --projects:osu.Game* --caches-home="inspectcode" osu.sln > NUL
- cmd: NVika parsereport "inspectcodereport.xml" --treatwarningsaserrors - cmd: NVika parsereport "inspectcodereport.xml" --treatwarningsaserrors

View File

@ -72,7 +72,7 @@ namespace osu.Desktop.Updater
bestAsset = release.Assets?.FirstOrDefault(f => f.Name.EndsWith(".exe")); bestAsset = release.Assets?.FirstOrDefault(f => f.Name.EndsWith(".exe"));
break; break;
case RuntimeInfo.Platform.MacOsx: case RuntimeInfo.Platform.MacOsx:
bestAsset = release.Assets?.FirstOrDefault(f => f.Name.EndsWith(".dmg")); bestAsset = release.Assets?.FirstOrDefault(f => f.Name.EndsWith(".app.zip"));
break; break;
} }

View File

@ -21,9 +21,9 @@ namespace osu.Game.Rulesets.Mania.Tests
this.direction = direction; this.direction = direction;
} }
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
{ {
var dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
dependencies.CacheAs<IScrollingInfo>(new ScrollingInfo { Direction = { Value = direction }}); dependencies.CacheAs<IScrollingInfo>(new ScrollingInfo { Direction = { Value = direction }});
return dependencies; return dependencies;
} }

View File

@ -137,9 +137,9 @@ namespace osu.Game.Rulesets.Mania.Tests
}; };
} }
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
{ {
var dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
dependencies.CacheAs<IBindable<ManiaAction>>(new Bindable<ManiaAction>()); dependencies.CacheAs<IBindable<ManiaAction>>(new Bindable<ManiaAction>());
return dependencies; return dependencies;
} }

View File

@ -19,14 +19,14 @@ namespace osu.Game.Rulesets.Mania
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(ManiaConfigManager config) private void load()
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
new SettingsEnumDropdown<ManiaScrollingDirection> new SettingsEnumDropdown<ManiaScrollingDirection>
{ {
LabelText = "Scrolling direction", LabelText = "Scrolling direction",
Bindable = config.GetBindable<ManiaScrollingDirection>(ManiaSetting.ScrollDirection) Bindable = ((ManiaConfigManager)Config).GetBindable<ManiaScrollingDirection>(ManiaSetting.ScrollDirection)
} }
}; };
} }

View File

@ -118,9 +118,9 @@ namespace osu.Game.Rulesets.Mania.UI
} }
} }
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
{ {
var dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
dependencies.CacheAs<IBindable<ManiaAction>>(Action); dependencies.CacheAs<IBindable<ManiaAction>>(Action);
return dependencies; return dependencies;
} }

View File

@ -70,19 +70,19 @@ namespace osu.Game.Rulesets.Mania.UI
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(ManiaConfigManager config) private void load()
{ {
BarLines.ForEach(Playfield.Add); BarLines.ForEach(Playfield.Add);
config.BindWith(ManiaSetting.ScrollDirection, configDirection); ((ManiaConfigManager)Config).BindWith(ManiaSetting.ScrollDirection, configDirection);
configDirection.BindValueChanged(d => scrollingInfo.Direction.Value = (ScrollingDirection)d, true); configDirection.BindValueChanged(d => scrollingInfo.Direction.Value = (ScrollingDirection)d, true);
} }
private DependencyContainer dependencies; private DependencyContainer dependencies;
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
{ {
dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
dependencies.CacheAs<IScrollingInfo>(scrollingInfo = new ScrollingInfo()); dependencies.CacheAs<IScrollingInfo>(scrollingInfo = new ScrollingInfo());
return dependencies; return dependencies;
} }

View File

@ -31,8 +31,8 @@ namespace osu.Game.Rulesets.Osu
public override IEnumerable<KeyBinding> GetDefaultKeyBindings(int variant = 0) => new[] public override IEnumerable<KeyBinding> GetDefaultKeyBindings(int variant = 0) => new[]
{ {
new KeyBinding(InputKey.Z, OsuAction.LeftButton), new KeyBinding(InputKey.A, OsuAction.LeftButton),
new KeyBinding(InputKey.X, OsuAction.RightButton), new KeyBinding(InputKey.S, OsuAction.RightButton),
new KeyBinding(InputKey.MouseLeft, OsuAction.LeftButton), new KeyBinding(InputKey.MouseLeft, OsuAction.LeftButton),
new KeyBinding(InputKey.MouseRight, OsuAction.RightButton), new KeyBinding(InputKey.MouseRight, OsuAction.RightButton),
}; };

View File

@ -0,0 +1,28 @@
// Copyright (c) 2007-2018 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.Framework.Graphics.Shapes;
using osu.Game.Screens.Menu;
using OpenTK.Graphics;
namespace osu.Game.Tests.Visual
{
public class TestCaseDisclaimer : OsuTestCase
{
[BackgroundDependencyLoader]
private void load()
{
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black,
},
new Disclaimer()
};
}
}
}

View File

@ -6,7 +6,6 @@ using System.Collections.Generic;
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Timing;
using osu.Game.Screens; using osu.Game.Screens;
using osu.Game.Screens.Menu; using osu.Game.Screens.Menu;
using OpenTK.Graphics; using OpenTK.Graphics;
@ -23,19 +22,15 @@ namespace osu.Game.Tests.Visual
public TestCaseOsuGame() public TestCaseOsuGame()
{ {
var rateAdjustClock = new StopwatchClock(true); Children = new Drawable[]
var framedClock = new FramedClock(rateAdjustClock);
framedClock.ProcessFrame();
Add(new Box
{ {
RelativeSizeAxes = Axes.Both, new Box
Colour = Color4.Black, {
}); RelativeSizeAxes = Axes.Both,
Colour = Color4.Black,
Add(new Loader()); },
new Loader()
AddSliderStep("Playback speed", 0.0, 2.0, 1, v => rateAdjustClock.Rate = v); };
} }
} }
} }

View File

@ -14,9 +14,9 @@ namespace osu.Game.Tests.Visual
{ {
private readonly PreviewTrackManager trackManager = new TestPreviewTrackManager(); private readonly PreviewTrackManager trackManager = new TestPreviewTrackManager();
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
{ {
var dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
dependencies.CacheAs(trackManager); dependencies.CacheAs(trackManager);
dependencies.CacheAs<IPreviewTrackOwner>(this); dependencies.CacheAs<IPreviewTrackOwner>(this);
return dependencies; return dependencies;
@ -101,9 +101,9 @@ namespace osu.Game.Tests.Visual
AddInternal(track); AddInternal(track);
} }
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
{ {
var dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
dependencies.CacheAs<IPreviewTrackOwner>(this); dependencies.CacheAs<IPreviewTrackOwner>(this);
return dependencies; return dependencies;
} }

View File

@ -97,7 +97,7 @@ namespace osu.Game.Beatmaps
// by setting the model here, we can update the noline set id below. // by setting the model here, we can update the noline set id below.
b.BeatmapSet = model; b.BeatmapSet = model;
fetchAndPopulateOnlineIDs(b); fetchAndPopulateOnlineIDs(b, model.Beatmaps);
} }
// check if a set already exists with the same online id, delete if it does. // check if a set already exists with the same online id, delete if it does.
@ -409,9 +409,10 @@ namespace osu.Game.Beatmaps
/// Query the API to populate mising OnlineBeatmapID / OnlineBeatmapSetID properties. /// Query the API to populate mising OnlineBeatmapID / OnlineBeatmapSetID properties.
/// </summary> /// </summary>
/// <param name="beatmap">The beatmap to populate.</param> /// <param name="beatmap">The beatmap to populate.</param>
/// <param name="otherBeatmaps">The other beatmaps contained within this set.</param>
/// <param name="force">Whether to re-query if the provided beatmap already has populated values.</param> /// <param name="force">Whether to re-query if the provided beatmap already has populated values.</param>
/// <returns>True if population was successful.</returns> /// <returns>True if population was successful.</returns>
private bool fetchAndPopulateOnlineIDs(BeatmapInfo beatmap, bool force = false) private bool fetchAndPopulateOnlineIDs(BeatmapInfo beatmap, IEnumerable<BeatmapInfo> otherBeatmaps, bool force = false)
{ {
if (!force && beatmap.OnlineBeatmapID != null && beatmap.BeatmapSet.OnlineBeatmapSetID != null) if (!force && beatmap.OnlineBeatmapID != null && beatmap.BeatmapSet.OnlineBeatmapSetID != null)
return true; return true;
@ -431,6 +432,12 @@ namespace osu.Game.Beatmaps
Logger.Log($"Successfully mapped to {res.OnlineBeatmapSetID} / {res.OnlineBeatmapID}.", LoggingTarget.Database); Logger.Log($"Successfully mapped to {res.OnlineBeatmapSetID} / {res.OnlineBeatmapID}.", LoggingTarget.Database);
if (otherBeatmaps.Any(b => b.OnlineBeatmapID == res.OnlineBeatmapID))
{
Logger.Log("Another beatmap in the same set already mapped to this ID. We'll skip adding it this time.", LoggingTarget.Database);
return false;
}
beatmap.BeatmapSet.OnlineBeatmapSetID = res.OnlineBeatmapSetID; beatmap.BeatmapSet.OnlineBeatmapSetID = res.OnlineBeatmapSetID;
beatmap.OnlineBeatmapID = res.OnlineBeatmapID; beatmap.OnlineBeatmapID = res.OnlineBeatmapID;
return true; return true;

View File

@ -9,14 +9,14 @@ using OpenTK.Graphics;
namespace osu.Game.Beatmaps.Drawables namespace osu.Game.Beatmaps.Drawables
{ {
public class DifficultyColouredContainer : Container, IHasAccentColour public abstract class DifficultyColouredContainer : Container, IHasAccentColour
{ {
public Color4 AccentColour { get; set; } public Color4 AccentColour { get; set; }
private readonly BeatmapInfo beatmap; private readonly BeatmapInfo beatmap;
private OsuColour palette; private OsuColour palette;
public DifficultyColouredContainer(BeatmapInfo beatmap) protected DifficultyColouredContainer(BeatmapInfo beatmap)
{ {
this.beatmap = beatmap; this.beatmap = beatmap;
} }

View File

@ -3,10 +3,14 @@
using System; using System;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using OpenTK; using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Beatmaps.Drawables namespace osu.Game.Beatmaps.Drawables
{ {
@ -14,7 +18,8 @@ namespace osu.Game.Beatmaps.Drawables
{ {
private readonly BeatmapInfo beatmap; private readonly BeatmapInfo beatmap;
public DifficultyIcon(BeatmapInfo beatmap) : base(beatmap) public DifficultyIcon(BeatmapInfo beatmap)
: base(beatmap)
{ {
if (beatmap == null) if (beatmap == null)
throw new ArgumentNullException(nameof(beatmap)); throw new ArgumentNullException(nameof(beatmap));
@ -28,16 +33,29 @@ namespace osu.Game.Beatmaps.Drawables
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
new SpriteIcon new CircularContainer
{ {
RelativeSizeAxes = Axes.Both,
Scale = new Vector2(0.84f),
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both, Masking = true,
Colour = AccentColour, EdgeEffect = new EdgeEffectParameters
Icon = FontAwesome.fa_circle {
Colour = Color4.Black.Opacity(0.08f),
Type = EdgeEffectType.Shadow,
Radius = 5,
},
Child = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = AccentColour,
},
}, },
new ConstrainedIconContainer new ConstrainedIconContainer
{ {
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
// the null coalesce here is only present to make unit tests work (ruleset dlls aren't copied correctly for testing at the moment) // the null coalesce here is only present to make unit tests work (ruleset dlls aren't copied correctly for testing at the moment)
Icon = beatmap.Ruleset?.CreateInstance().CreateIcon() ?? new SpriteIcon { Icon = FontAwesome.fa_question_circle_o } Icon = beatmap.Ruleset?.CreateInstance().CreateIcon() ?? new SpriteIcon { Icon = FontAwesome.fa_question_circle_o }

View File

@ -26,9 +26,9 @@ namespace osu.Game.Graphics.Containers
protected readonly Bindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>(OverlayActivation.All); protected readonly Bindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>(OverlayActivation.All);
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
{ {
var dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
dependencies.CacheAs<IPreviewTrackOwner>(this); dependencies.CacheAs<IPreviewTrackOwner>(this);
return dependencies; return dependencies;
} }

View File

@ -21,6 +21,8 @@ namespace osu.Game.Graphics.Cursor
{ {
} }
protected override double AppearDelay => (1 - CurrentTooltip.Alpha) * base.AppearDelay; // reduce appear delay if the tooltip is already partly visible.
public class OsuTooltip : Tooltip public class OsuTooltip : Tooltip
{ {
private readonly Box background; private readonly Box background;

View File

@ -8,7 +8,6 @@ namespace osu.Game.Migrations
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.Sql("DELETE FROM KeyBinding WHERE RulesetID = 1"); migrationBuilder.Sql("DELETE FROM KeyBinding WHERE RulesetID = 1");
Logger.Log("osu!taiko bindings have been reset due to new defaults", LoggingTarget.Runtime, LogLevel.Important);
} }
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)

View File

@ -19,6 +19,7 @@ using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using osu.Framework.Audio; using osu.Framework.Audio;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Input; using osu.Framework.Input;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Platform; using osu.Framework.Platform;
@ -124,8 +125,8 @@ namespace osu.Game
private DependencyContainer dependencies; private DependencyContainer dependencies;
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) => protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) =>
dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(FrameworkConfigManager frameworkConfig) private void load(FrameworkConfigManager frameworkConfig)
@ -351,24 +352,6 @@ namespace osu.Game
dependencies.Cache(notifications); dependencies.Cache(notifications);
dependencies.Cache(dialogOverlay); dependencies.Cache(dialogOverlay);
// ensure only one of these overlays are open at once.
var singleDisplayOverlays = new OverlayContainer[] { chat, social, direct };
overlays.AddRange(singleDisplayOverlays);
foreach (var overlay in singleDisplayOverlays)
{
overlay.StateChanged += state =>
{
if (state == Visibility.Hidden) return;
foreach (var c in singleDisplayOverlays)
{
if (c == overlay) continue;
c.State = Visibility.Hidden;
}
};
}
var singleDisplaySideOverlays = new OverlayContainer[] { settings, notifications }; var singleDisplaySideOverlays = new OverlayContainer[] { settings, notifications };
overlays.AddRange(singleDisplaySideOverlays); overlays.AddRange(singleDisplaySideOverlays);
@ -377,12 +360,7 @@ namespace osu.Game
overlay.StateChanged += state => overlay.StateChanged += state =>
{ {
if (state == Visibility.Hidden) return; if (state == Visibility.Hidden) return;
singleDisplaySideOverlays.Where(o => o != overlay).ForEach(o => o.Hide());
foreach (var c in singleDisplaySideOverlays)
{
if (c == overlay) continue;
c.State = Visibility.Hidden;
}
}; };
} }
@ -395,12 +373,24 @@ namespace osu.Game
overlay.StateChanged += state => overlay.StateChanged += state =>
{ {
if (state == Visibility.Hidden) return; if (state == Visibility.Hidden) return;
informationalOverlays.Where(o => o != overlay).ForEach(o => o.Hide());
};
}
foreach (var c in informationalOverlays) // ensure only one of these overlays are open at once.
{ var singleDisplayOverlays = new OverlayContainer[] { chat, social, direct };
if (c == overlay) continue; overlays.AddRange(singleDisplayOverlays);
c.State = Visibility.Hidden;
} foreach (var overlay in singleDisplayOverlays)
{
overlay.StateChanged += state =>
{
// informational overlays should be dismissed on a show or hide of a full overlay.
informationalOverlays.ForEach(o => o.Hide());
if (state == Visibility.Hidden) return;
singleDisplayOverlays.Where(o => o != overlay).ForEach(o => o.Hide());
}; };
} }

View File

@ -95,8 +95,8 @@ namespace osu.Game
private DependencyContainer dependencies; private DependencyContainer dependencies;
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) => protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) =>
dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
private DatabaseContextFactory contextFactory; private DatabaseContextFactory contextFactory;

View File

@ -102,6 +102,7 @@ namespace osu.Game.Overlays.KeyBinding
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Margin = new MarginPadding(padding), Margin = new MarginPadding(padding),
Padding = new MarginPadding { Top = height },
Alpha = 0, Alpha = 0,
Colour = colours.YellowDark Colour = colours.YellowDark
} }
@ -267,7 +268,7 @@ namespace osu.Game.Overlays.KeyBinding
GetContainingInputManager().ChangeFocus(null); GetContainingInputManager().ChangeFocus(null);
pressAKey.FadeOut(300, Easing.OutQuint); pressAKey.FadeOut(300, Easing.OutQuint);
pressAKey.Padding = new MarginPadding { Top = height, Bottom = -pressAKey.DrawHeight }; pressAKey.BypassAutoSizeAxes |= Axes.Y;
} }
protected override void OnFocus(InputState state) protected override void OnFocus(InputState state)
@ -276,7 +277,7 @@ namespace osu.Game.Overlays.KeyBinding
AutoSizeEasing = Easing.OutQuint; AutoSizeEasing = Easing.OutQuint;
pressAKey.FadeIn(300, Easing.OutQuint); pressAKey.FadeIn(300, Easing.OutQuint);
pressAKey.Padding = new MarginPadding { Top = height }; pressAKey.BypassAutoSizeAxes &= ~Axes.Y;
updateBindTarget(); updateBindTarget();
base.OnFocus(state); base.OnFocus(state);

View File

@ -158,6 +158,13 @@ namespace osu.Game.Overlays.Profile
} }
} }
}, },
new Box // this is a temporary workaround for incorrect masking behaviour of FillMode.Fill used in UserCoverBackground (see https://github.com/ppy/osu-framework/issues/1675)
{
RelativeSizeAxes = Axes.X,
Height = 1,
Y = cover_height,
Colour = OsuColour.Gray(34),
},
infoTextLeft = new LinkFlowContainer(t => t.TextSize = 14) infoTextLeft = new LinkFlowContainer(t => t.TextSize = 14)
{ {
X = UserProfileOverlay.CONTENT_X_MARGIN, X = UserProfileOverlay.CONTENT_X_MARGIN,

View File

@ -3,6 +3,7 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Rulesets.Configuration;
namespace osu.Game.Overlays.Settings namespace osu.Game.Overlays.Settings
{ {
@ -14,6 +15,8 @@ namespace osu.Game.Overlays.Settings
{ {
private readonly Ruleset ruleset; private readonly Ruleset ruleset;
protected IRulesetConfigManager Config;
protected RulesetSettingsSubsection(Ruleset ruleset) protected RulesetSettingsSubsection(Ruleset ruleset)
{ {
this.ruleset = ruleset; this.ruleset = ruleset;
@ -21,13 +24,13 @@ namespace osu.Game.Overlays.Settings
private DependencyContainer dependencies; private DependencyContainer dependencies;
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
{ {
dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
var config = dependencies.Get<RulesetConfigCache>().GetConfigFor(ruleset); Config = dependencies.Get<RulesetConfigCache>().GetConfigFor(ruleset);
if (config != null) if (Config != null)
dependencies.Cache(config); dependencies.Cache(Config);
return dependencies; return dependencies;
} }

View File

@ -70,7 +70,8 @@ namespace osu.Game.Rulesets.UI
protected readonly Ruleset Ruleset; protected readonly Ruleset Ruleset;
private IRulesetConfigManager rulesetConfig; protected IRulesetConfigManager Config { get; private set; }
private OnScreenDisplay onScreenDisplay; private OnScreenDisplay onScreenDisplay;
/// <summary> /// <summary>
@ -85,17 +86,17 @@ namespace osu.Game.Rulesets.UI
Cursor = CreateCursor(); Cursor = CreateCursor();
} }
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
{ {
var dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
onScreenDisplay = dependencies.Get<OnScreenDisplay>(); onScreenDisplay = dependencies.Get<OnScreenDisplay>();
rulesetConfig = dependencies.Get<RulesetConfigCache>().GetConfigFor(Ruleset); Config = dependencies.Get<RulesetConfigCache>().GetConfigFor(Ruleset);
if (rulesetConfig != null) if (Config != null)
{ {
dependencies.Cache(rulesetConfig); dependencies.Cache(Config);
onScreenDisplay?.BeginTracking(this, rulesetConfig); onScreenDisplay?.BeginTracking(this, Config);
} }
return dependencies; return dependencies;
@ -143,10 +144,10 @@ namespace osu.Game.Rulesets.UI
{ {
base.Dispose(isDisposing); base.Dispose(isDisposing);
if (rulesetConfig != null) if (Config != null)
{ {
onScreenDisplay?.StopTracking(this, rulesetConfig); onScreenDisplay?.StopTracking(this, Config);
rulesetConfig = null; Config = null;
} }
} }
} }

View File

@ -222,23 +222,16 @@ namespace osu.Game.Rulesets.UI
mouseDisabled = config.GetBindable<bool>(OsuSetting.MouseDisableButtons); mouseDisabled = config.GetBindable<bool>(OsuSetting.MouseDisableButtons);
} }
protected override void TransformState(InputState state) protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
{ {
base.TransformState(state); if (mouseDisabled.Value && (args.Button == MouseButton.Left || args.Button == MouseButton.Right)) return false;
return base.OnMouseDown(state, args);
}
// we don't want to transform the state if a replay is present (for now, at least). protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
if (replayInputHandler != null) return; {
if (!CurrentState.Mouse.IsPressed(args.Button)) return false;
var mouse = state.Mouse as Framework.Input.MouseState; return base.OnMouseUp(state, args);
if (mouse != null)
{
if (mouseDisabled.Value)
{
mouse.SetPressed(MouseButton.Left, false);
mouse.SetPressed(MouseButton.Right, false);
}
}
} }
#endregion #endregion

View File

@ -42,8 +42,8 @@ namespace osu.Game.Screens.Edit
private DependencyContainer dependencies; private DependencyContainer dependencies;
private GameHost host; private GameHost host;
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
=> dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); => dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours, GameHost host) private void load(OsuColour colours, GameHost host)

View File

@ -3,10 +3,9 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Screens; using osu.Framework.Screens;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Containers;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Game.Overlays; using osu.Game.Overlays;
@ -16,96 +15,89 @@ namespace osu.Game.Screens.Menu
public class Disclaimer : OsuScreen public class Disclaimer : OsuScreen
{ {
private Intro intro; private Intro intro;
private readonly SpriteIcon icon; private SpriteIcon icon;
private Color4 iconColour; private Color4 iconColour;
private LinkFlowContainer textFlow;
protected override bool HideOverlaysOnEnter => true; protected override bool HideOverlaysOnEnter => true;
protected override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled; protected override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled;
public override bool CursorVisible => false; public override bool CursorVisible => false;
private const float icon_y = -0.09f;
public Disclaimer() public Disclaimer()
{ {
ValidForResume = false; ValidForResume = false;
Children = new Drawable[]
{
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 2),
Children = new Drawable[]
{
icon = new SpriteIcon
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Icon = FontAwesome.fa_warning,
Size = new Vector2(30),
},
new OsuSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
TextSize = 30,
Text = "This is a development build",
Margin = new MarginPadding
{
Bottom = 20
},
},
new OsuSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Text = "Don't expect shit to work perfectly as this is very much a work in progress."
},
new OsuSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Text = "Don't report bugs because we are aware. Don't complain about missing features because we are adding them."
},
new OsuSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Text = "Sit back and enjoy. Visit discord.gg/ppy if you want to help out!",
Margin = new MarginPadding { Bottom = 20 },
},
new OsuSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
TextSize = 12,
Text = "oh and yes, you will get seizures.",
},
}
}
};
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OsuColour colours)
{ {
LoadComponentAsync(intro = new Intro()); Children = new Drawable[]
{
icon = new SpriteIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Icon = FontAwesome.fa_warning,
Size = new Vector2(30),
RelativePositionAxes = Axes.Both,
Y = icon_y,
},
textFlow = new LinkFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding(50),
TextAnchor = Anchor.TopCentre,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Spacing = new Vector2(0, 2),
}
};
textFlow.AddText("This is an ", t =>
{
t.TextSize = 30;
t.Font = @"Exo2.0-Light";
});
textFlow.AddText("early development build", t =>
{
t.TextSize = 30;
t.Font = @"Exo2.0-SemiBold";
});
textFlow.AddParagraph("Don't expect everything to work perfectly.");
textFlow.AddParagraph("");
textFlow.AddParagraph("Detailed bug reports are welcomed via github issues.");
textFlow.AddParagraph("");
textFlow.AddText("Visit ");
textFlow.AddLink("discord.gg/ppy", "https://discord.gg/ppy");
textFlow.AddText(" if you want to help out or follow progress!");
iconColour = colours.Yellow; iconColour = colours.Yellow;
} }
protected override void LoadComplete()
{
base.LoadComplete();
LoadComponentAsync(intro = new Intro());
}
protected override void OnEntering(Screen last) protected override void OnEntering(Screen last)
{ {
base.OnEntering(last); base.OnEntering(last);
icon.Delay(1500).FadeColour(iconColour, 200); icon.Delay(1500).FadeColour(iconColour, 200, Easing.OutQuint);
icon.Delay(1500).MoveToY(icon_y * 1.1f, 100, Easing.OutCirc).Then().MoveToY(icon_y, 100, Easing.InCirc);
Content Content
.FadeInFromZero(500) .FadeInFromZero(500)
.Then(5500) .Then(5500)
.FadeOut(250) .FadeOut(250)
.ScaleTo(0.9f, 250, Easing.InQuint)
.Finally(d => Push(intro)); .Finally(d => Push(intro));
} }
} }

View File

@ -19,6 +19,7 @@ using osu.Game.Graphics.Backgrounds;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using OpenTK.Input;
namespace osu.Game.Screens.Menu namespace osu.Game.Screens.Menu
{ {
@ -345,12 +346,16 @@ namespace osu.Game.Screens.Menu
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
{ {
if (args.Button != MouseButton.Left) return false;
logoBounceContainer.ScaleTo(0.9f, 1000, Easing.Out); logoBounceContainer.ScaleTo(0.9f, 1000, Easing.Out);
return true; return true;
} }
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
{ {
if (args.Button != MouseButton.Left) return false;
logoBounceContainer.ScaleTo(1f, 500, Easing.OutElastic); logoBounceContainer.ScaleTo(1f, 500, Easing.OutElastic);
return true; return true;
} }

View File

@ -69,8 +69,8 @@ namespace osu.Game.Screens.Select
private DependencyContainer dependencies; private DependencyContainer dependencies;
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
=> dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); => dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
protected SongSelect() protected SongSelect()
{ {

View File

@ -49,8 +49,8 @@ namespace osu.Game.Screens.Tournament
private DependencyContainer dependencies; private DependencyContainer dependencies;
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) => protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) =>
dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(TextureStore textures, Storage storage) private void load(TextureStore textures, Storage storage)

View File

@ -71,9 +71,9 @@ namespace osu.Game.Skinning
private void onSourceChanged() => SourceChanged?.Invoke(); private void onSourceChanged() => SourceChanged?.Invoke();
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
{ {
var dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
fallbackSource = dependencies.Get<ISkinSource>(); fallbackSource = dependencies.Get<ISkinSource>();
dependencies.CacheAs<ISkinSource>(this); dependencies.CacheAs<ISkinSource>(this);

View File

@ -36,8 +36,8 @@ namespace osu.Game.Storyboards.Drawables
public override bool RemoveCompletedTransforms => false; public override bool RemoveCompletedTransforms => false;
private DependencyContainer dependencies; private DependencyContainer dependencies;
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) => protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) =>
dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
public DrawableStoryboard(Storyboard storyboard) public DrawableStoryboard(Storyboard storyboard)
{ {

View File

@ -0,0 +1,69 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.IO;
using osu.Framework.Allocation;
using osu.Framework.Audio.Sample;
using osu.Framework.Graphics;
using osu.Game.Beatmaps;
namespace osu.Game.Storyboards.Drawables
{
public class DrawableStoryboardSample : Component
{
/// <summary>
/// The amount of time allowable beyond the start time of the sample, for the sample to start.
/// </summary>
private const double allowable_late_start = 100;
private readonly StoryboardSample sample;
private SampleChannel channel;
public override bool RemoveWhenNotAlive => false;
public DrawableStoryboardSample(StoryboardSample sample)
{
this.sample = sample;
LifetimeStart = sample.Time;
}
[BackgroundDependencyLoader]
private void load(IBindableBeatmap beatmap)
{
// Try first with the full name, then attempt with no path
channel = beatmap.Value.Skin.GetSample(sample.Path) ?? beatmap.Value.Skin.GetSample(Path.ChangeExtension(sample.Path, null));
if (channel != null)
channel.Volume.Value = sample.Volume / 100;
}
protected override void Update()
{
base.Update();
// TODO: this logic will need to be consolidated with other game samples like hitsounds.
if (Time.Current < sample.Time)
{
// We've rewound before the start time of the sample
channel?.Stop();
// In the case that the user fast-forwards to a point far beyond the start time of the sample,
// we want to be able to fall into the if-conditional below (therefore we must not have a life time end)
LifetimeStart = sample.Time;
LifetimeEnd = double.MaxValue;
}
else if (Time.Current - Time.Elapsed < sample.Time)
{
// We've passed the start time of the sample. We only play the sample if we're within an allowable range
// from the sample's start, to reduce layering if we've been fast-forwarded far into the future
if (Time.Current - sample.Time < allowable_late_start)
channel?.Play();
// In the case that the user rewinds to a point far behind the start time of the sample,
// we want to be able to fall into the if-conditional above (therefore we must not have a life time start)
LifetimeStart = double.MinValue;
LifetimeEnd = sample.Time;
}
}
}
}

View File

@ -2,14 +2,14 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics; using osu.Framework.Graphics;
using System; using osu.Game.Storyboards.Drawables;
namespace osu.Game.Storyboards namespace osu.Game.Storyboards
{ {
public class StoryboardSample : IStoryboardElement public class StoryboardSample : IStoryboardElement
{ {
public string Path { get; set; } public string Path { get; set; }
public bool IsDrawable => false; public bool IsDrawable => true;
public double Time; public double Time;
public float Volume; public float Volume;
@ -21,9 +21,6 @@ namespace osu.Game.Storyboards
Volume = volume; Volume = volume;
} }
public Drawable CreateDrawable() public Drawable CreateDrawable() => new DrawableStoryboardSample(this);
{
throw new InvalidOperationException();
}
} }
} }

View File

@ -25,9 +25,9 @@ namespace osu.Game.Tests.Visual
Clock = new EditorClock(new ControlPointInfo(), 5000, BeatDivisor) { IsCoupled = false }; Clock = new EditorClock(new ControlPointInfo(), 5000, BeatDivisor) { IsCoupled = false };
} }
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
{ {
var dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
dependencies.Cache(BeatDivisor); dependencies.Cache(BeatDivisor);
dependencies.CacheAs<IFrameBasedClock>(Clock); dependencies.CacheAs<IFrameBasedClock>(Clock);

View File

@ -20,9 +20,9 @@ namespace osu.Game.Tests.Visual
protected DependencyContainer Dependencies { get; private set; } protected DependencyContainer Dependencies { get; private set; }
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
{ {
Dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); Dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
Dependencies.CacheAs<BindableBeatmap>(beatmap); Dependencies.CacheAs<BindableBeatmap>(beatmap);
Dependencies.CacheAs<IBindableBeatmap>(beatmap); Dependencies.CacheAs<IBindableBeatmap>(beatmap);

View File

@ -18,7 +18,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.1.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.1.1" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" /> <PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="ppy.osu.Framework" Version="2018.710.0" /> <PackageReference Include="ppy.osu.Framework" Version="2018.712.0" />
<PackageReference Include="SharpCompress" Version="0.17.1" /> <PackageReference Include="SharpCompress" Version="0.17.1" />
<PackageReference Include="NUnit" Version="3.10.1" /> <PackageReference Include="NUnit" Version="3.10.1" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.5.0" /> <PackageReference Include="System.ComponentModel.Annotations" Version="4.5.0" />