1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 15:47:26 +08:00

Merge branch 'master' into ruleset-container

This commit is contained in:
Dan Balasescu 2018-06-19 21:47:10 +09:00 committed by GitHub
commit 77e03a59a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 31 additions and 24 deletions

View File

@ -1,12 +1,13 @@
// 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.Diagnostics;
using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Framework.Platform;
using osu.Game;
using osu.Game.Configuration;
using osu.Game.Graphics;
@ -24,16 +25,18 @@ namespace osu.Desktop.Overlays
private OsuConfigManager config;
private OsuGameBase game;
private NotificationOverlay notificationOverlay;
private GameHost host;
public override bool HandleKeyboardInput => false;
public override bool HandleMouseInput => false;
[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;
this.config = config;
this.game = game;
this.host = host;
AutoSizeAxes = Axes.Both;
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).
if (!string.IsNullOrEmpty(lastVersion))
notificationOverlay.Post(new UpdateCompleteNotification(version));
notificationOverlay.Post(new UpdateCompleteNotification(version, host.OpenUrlExternally));
}
}
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!";
Icon = FontAwesome.fa_check_square;
Activated = delegate
{
Process.Start($"https://osu.ppy.sh/home/changelog/{version}");
openUrl?.Invoke($"https://osu.ppy.sh/home/changelog/lazer/{version}");
return true;
};
}

View File

@ -139,8 +139,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
var texture = new Texture(textureWidth, 1);
//initialise background
var upload = new TextureUpload(textureWidth * 4);
var bytes = upload.Data;
var raw = new RawTexture(textureWidth, 1);
var bytes = raw.Data;
const float aa_portion = 0.02f;
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;
container.ForceRedraw();

View File

@ -13,7 +13,6 @@ using osu.Game.Storyboards;
using osu.Framework.IO.File;
using System.IO;
using osu.Game.IO.Serialization;
using System.Diagnostics;
using osu.Game.Rulesets;
using osu.Game.Rulesets.UI;
using osu.Game.Skinning;
@ -49,12 +48,13 @@ namespace osu.Game.Beatmaps
/// <summary>
/// Saves the <see cref="Beatmaps.Beatmap"/>.
/// </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");
using (var sw = new StreamWriter(path))
sw.WriteLine(Beatmap.Serialize());
Process.Start(path);
return path;
}
protected abstract IBeatmap GetBeatmap();

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

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

View File

@ -13,6 +13,7 @@ using osu.Game.Screens.Edit.Components.Timelines.Summary;
using osu.Framework.Allocation;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input;
using osu.Framework.Platform;
using osu.Framework.Timing;
using osu.Game.Graphics.UserInterface;
using osu.Game.Screens.Edit.Screens;
@ -39,13 +40,16 @@ namespace osu.Game.Screens.Edit
private EditorClock clock;
private DependencyContainer dependencies;
private GameHost host;
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent)
=> dependencies = new DependencyContainer(base.CreateLocalDependencies(parent));
[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.
var sourceClock = (IAdjustableClock)Beatmap.Value.Track ?? new StopwatchClock();
clock = new EditorClock(Beatmap.Value, beatDivisor) { IsCoupled = false };
@ -155,7 +159,7 @@ namespace osu.Game.Screens.Edit
private void exportBeatmap()
{
Beatmap.Value.Save();
host.OpenFileExternally(Beatmap.Value.Save());
}
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.Core" Version="2.1.0" />
<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="NUnit" Version="3.10.1" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.5.0" />