mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 22:22:54 +08:00
commit
58b551b98e
@ -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;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -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();
|
||||||
|
@ -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();
|
||||||
|
@ -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))
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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)
|
||||||
|
@ -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" />
|
||||||
|
Loading…
Reference in New Issue
Block a user