Merge remote-tracking branch 'upstream/master' into ThePyrotechnic-ShowMorePadding

This commit is contained in:
Dean Herbert
2018-06-20 10:45:43 +09:00
12 changed files with 39 additions and 33 deletions

View File

@ -1,12 +1,11 @@
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="VisualTests (netcoreapp2.1)" type="DotNetProject" factoryName=".NET Project"> <configuration default="false" name="VisualTests" type="DotNetProject" factoryName=".NET Project">
<option name="EXE_PATH" value="$PROJECT_DIR$/osu.Game.Tests/bin/Debug/netcoreapp2.1/osu.Game.Tests.dll" /> <option name="EXE_PATH" value="$PROJECT_DIR$/osu.Game.Tests/bin/Debug/netcoreapp2.1/osu.Game.Tests.dll" />
<option name="PROGRAM_PARAMETERS" value="" /> <option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/osu.Game.Tests" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/osu.Game.Tests" />
<option name="PASS_PARENT_ENVS" value="1" /> <option name="PASS_PARENT_ENVS" value="1" />
<envs />
<option name="USE_MONO" value="0" />
<option name="USE_EXTERNAL_CONSOLE" value="0" /> <option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
<option name="PROJECT_PATH" value="$PROJECT_DIR$/osu.Game.Tests/osu.Game.Tests.csproj" /> <option name="PROJECT_PATH" value="$PROJECT_DIR$/osu.Game.Tests/osu.Game.Tests.csproj" />
<option name="PROJECT_EXE_PATH_TRACKING" value="1" /> <option name="PROJECT_EXE_PATH_TRACKING" value="1" />
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" /> <option name="PROJECT_ARGUMENTS_TRACKING" value="1" />

View File

@ -1,12 +1,11 @@
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="osu! (netcoreapp2.1)" type="DotNetProject" factoryName=".NET Project"> <configuration default="false" name="osu!" type="DotNetProject" factoryName=".NET Project">
<option name="EXE_PATH" value="$PROJECT_DIR$/osu.Desktop/bin/Debug/netcoreapp2.1/osu!.dll" /> <option name="EXE_PATH" value="$PROJECT_DIR$/osu.Desktop/bin/Debug/netcoreapp2.1/osu!.dll" />
<option name="PROGRAM_PARAMETERS" value="" /> <option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/osu.Desktop" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/osu.Desktop" />
<option name="PASS_PARENT_ENVS" value="1" /> <option name="PASS_PARENT_ENVS" value="1" />
<envs />
<option name="USE_MONO" value="0" />
<option name="USE_EXTERNAL_CONSOLE" value="0" /> <option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
<option name="PROJECT_PATH" value="$PROJECT_DIR$/osu.Desktop/osu.Desktop.csproj" /> <option name="PROJECT_PATH" value="$PROJECT_DIR$/osu.Desktop/osu.Desktop.csproj" />
<option name="PROJECT_EXE_PATH_TRACKING" value="1" /> <option name="PROJECT_EXE_PATH_TRACKING" value="1" />
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" /> <option name="PROJECT_ARGUMENTS_TRACKING" value="1" />

View File

@ -1,12 +1,13 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// 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 System.Diagnostics; using System;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Framework.Platform;
using osu.Game; using osu.Game;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Graphics; using osu.Game.Graphics;
@ -24,16 +25,18 @@ namespace osu.Desktop.Overlays
private OsuConfigManager config; private OsuConfigManager config;
private OsuGameBase game; private OsuGameBase game;
private NotificationOverlay notificationOverlay; private NotificationOverlay notificationOverlay;
private GameHost host;
public override bool HandleKeyboardInput => false; public override bool HandleKeyboardInput => false;
public override bool HandleMouseInput => false; public override bool HandleMouseInput => false;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(NotificationOverlay notification, OsuColour colours, TextureStore textures, OsuGameBase game, OsuConfigManager config) private void load(NotificationOverlay notification, OsuColour colours, TextureStore textures, OsuGameBase game, OsuConfigManager config, GameHost host)
{ {
notificationOverlay = notification; notificationOverlay = notification;
this.config = config; this.config = config;
this.game = game; this.game = game;
this.host = host;
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
Anchor = Anchor.BottomCentre; Anchor = Anchor.BottomCentre;
@ -106,19 +109,19 @@ namespace osu.Desktop.Overlays
// only show a notification if we've previously saved a version to the config file (ie. not the first run). // only show a notification if we've previously saved a version to the config file (ie. not the first run).
if (!string.IsNullOrEmpty(lastVersion)) if (!string.IsNullOrEmpty(lastVersion))
notificationOverlay.Post(new UpdateCompleteNotification(version)); notificationOverlay.Post(new UpdateCompleteNotification(version, host.OpenUrlExternally));
} }
} }
private class UpdateCompleteNotification : SimpleNotification private class UpdateCompleteNotification : SimpleNotification
{ {
public UpdateCompleteNotification(string version) public UpdateCompleteNotification(string version, Action<string> openUrl = null)
{ {
Text = $"You are now running osu!lazer {version}.\nClick to see what's new!"; Text = $"You are now running osu!lazer {version}.\nClick to see what's new!";
Icon = FontAwesome.fa_check_square; Icon = FontAwesome.fa_check_square;
Activated = delegate Activated = delegate
{ {
Process.Start($"https://osu.ppy.sh/home/changelog/{version}"); openUrl?.Invoke($"https://osu.ppy.sh/home/changelog/lazer/{version}");
return true; return true;
}; };
} }

View File

@ -4,6 +4,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.MathUtils;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using OpenTK; using OpenTK;
using osu.Game.Graphics; using osu.Game.Graphics;
@ -89,7 +90,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
// find the next vector2 in the curve which is not equal to our current position to infer a rotation. // find the next vector2 in the curve which is not equal to our current position to infer a rotation.
for (int i = searchStart; i >= 0 && i < curve.Count; i += direction) for (int i = searchStart; i >= 0 && i < curve.Count; i += direction)
{ {
if (curve[i] == Position) if (Precision.AlmostEquals(curve[i], Position))
continue; continue;
Rotation = MathHelper.RadiansToDegrees((float)Math.Atan2(curve[i].Y - Position.Y, curve[i].X - Position.X)); Rotation = MathHelper.RadiansToDegrees((float)Math.Atan2(curve[i].Y - Position.Y, curve[i].X - Position.X));

View File

@ -139,8 +139,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
var texture = new Texture(textureWidth, 1); var texture = new Texture(textureWidth, 1);
//initialise background //initialise background
var upload = new TextureUpload(textureWidth * 4); var raw = new RawTexture(textureWidth, 1);
var bytes = upload.Data; var bytes = raw.Data;
const float aa_portion = 0.02f; const float aa_portion = 0.02f;
const float border_portion = 0.128f; const float border_portion = 0.128f;
@ -171,7 +171,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
} }
} }
texture.SetData(upload); texture.SetData(new TextureUpload(raw));
path.Texture = texture; path.Texture = texture;
container.ForceRedraw(); container.ForceRedraw();

View File

@ -18,7 +18,7 @@ using osu.Game.Rulesets.Replays;
namespace osu.Game.Rulesets.Osu.UI namespace osu.Game.Rulesets.Osu.UI
{ {
public class OsuRulesetContainer : RulesetContainer<OsuHitObject> public class OsuRulesetContainer : RulesetContainer<OsuPlayfield, OsuHitObject>
{ {
public OsuRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) public OsuRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap)
: base(ruleset, beatmap) : base(ruleset, beatmap)

View File

@ -13,7 +13,6 @@ using osu.Game.Storyboards;
using osu.Framework.IO.File; using osu.Framework.IO.File;
using System.IO; using System.IO;
using osu.Game.IO.Serialization; using osu.Game.IO.Serialization;
using System.Diagnostics;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
using osu.Game.Skinning; using osu.Game.Skinning;
@ -49,12 +48,13 @@ namespace osu.Game.Beatmaps
/// <summary> /// <summary>
/// Saves the <see cref="Beatmaps.Beatmap"/>. /// Saves the <see cref="Beatmaps.Beatmap"/>.
/// </summary> /// </summary>
public void Save() /// <returns>The absolute path of the output file.</returns>
public string Save()
{ {
var path = FileSafety.GetTempPath(Guid.NewGuid().ToString().Replace("-", string.Empty) + ".json"); var path = FileSafety.GetTempPath(Guid.NewGuid().ToString().Replace("-", string.Empty) + ".json");
using (var sw = new StreamWriter(path)) using (var sw = new StreamWriter(path))
sw.WriteLine(Beatmap.Serialize()); sw.WriteLine(Beatmap.Serialize());
Process.Start(path); return path;
} }
protected abstract IBeatmap GetBeatmap(); protected abstract IBeatmap GetBeatmap();

View File

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

View File

@ -1,12 +1,12 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// 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 System.Diagnostics;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Framework.Input; using osu.Framework.Input;
using osu.Framework.Platform;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
@ -17,6 +17,7 @@ namespace osu.Game.Graphics.UserInterface
public string Link { get; set; } public string Link { get; set; }
private Color4 hoverColour; private Color4 hoverColour;
private GameHost host;
public ExternalLinkButton(string link = null) public ExternalLinkButton(string link = null)
{ {
@ -30,9 +31,10 @@ namespace osu.Game.Graphics.UserInterface
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OsuColour colours, GameHost host)
{ {
hoverColour = colours.Yellow; hoverColour = colours.Yellow;
this.host = host;
} }
protected override bool OnHover(InputState state) protected override bool OnHover(InputState state)
@ -50,11 +52,7 @@ namespace osu.Game.Graphics.UserInterface
protected override bool OnClick(InputState state) protected override bool OnClick(InputState state)
{ {
if(Link != null) if(Link != null)
Process.Start(new ProcessStartInfo host.OpenUrlExternally(Link);
{
FileName = Link,
UseShellExecute = true //see https://github.com/dotnet/corefx/issues/10361
});
return true; return true;
} }

View File

@ -155,7 +155,7 @@ namespace osu.Game.Rulesets.UI
/// RulesetContainer that applies conversion to Beatmaps. Does not contain a Playfield /// RulesetContainer that applies conversion to Beatmaps. Does not contain a Playfield
/// and does not load drawable hit objects. /// and does not load drawable hit objects.
/// <para> /// <para>
/// Should not be derived - derive <see cref="RulesetContainer{TObject}"/> instead. /// Should not be derived - derive <see cref="RulesetContainer{TPlayfield, TObject}"/> instead.
/// </para> /// </para>
/// </summary> /// </summary>
/// <typeparam name="TObject">The type of HitObject contained by this RulesetContainer.</typeparam> /// <typeparam name="TObject">The type of HitObject contained by this RulesetContainer.</typeparam>

View File

@ -13,6 +13,7 @@ using osu.Game.Screens.Edit.Components.Timelines.Summary;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input; using osu.Framework.Input;
using osu.Framework.Platform;
using osu.Framework.Timing; using osu.Framework.Timing;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Screens.Edit.Screens; using osu.Game.Screens.Edit.Screens;
@ -39,13 +40,16 @@ namespace osu.Game.Screens.Edit
private EditorClock clock; private EditorClock clock;
private DependencyContainer dependencies; private DependencyContainer dependencies;
private GameHost host;
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent)
=> dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); => dependencies = new DependencyContainer(base.CreateLocalDependencies(parent));
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OsuColour colours, GameHost host)
{ {
this.host = host;
// TODO: should probably be done at a RulesetContainer level to share logic with Player. // TODO: should probably be done at a RulesetContainer level to share logic with Player.
var sourceClock = (IAdjustableClock)Beatmap.Value.Track ?? new StopwatchClock(); var sourceClock = (IAdjustableClock)Beatmap.Value.Track ?? new StopwatchClock();
clock = new EditorClock(Beatmap.Value, beatDivisor) { IsCoupled = false }; clock = new EditorClock(Beatmap.Value, beatDivisor) { IsCoupled = false };
@ -155,7 +159,7 @@ namespace osu.Game.Screens.Edit
private void exportBeatmap() private void exportBeatmap()
{ {
Beatmap.Value.Save(); host.OpenFileExternally(Beatmap.Value.Save());
} }
private void onModeChanged(EditorScreenMode mode) private void onModeChanged(EditorScreenMode mode)

View File

@ -18,7 +18,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.1.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" /> <PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="ppy.osu.Framework" Version="2018.611.1" /> <PackageReference Include="ppy.osu.Framework" Version="2018.619.0" />
<PackageReference Include="SharpCompress" Version="0.18.1" /> <PackageReference Include="SharpCompress" Version="0.18.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" />