mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 12:32:56 +08:00
Implement beatmap sending/receiving over IPC
This commit is contained in:
parent
c7d12bc072
commit
94f2898f52
@ -1 +1 @@
|
|||||||
Subproject commit 7439250a63dd451f34dbc08ecf68a196cf8e479f
|
Subproject commit aa96aeec4a1da743b5b997844b9107ea94b9b8de
|
@ -14,7 +14,7 @@ namespace osu.Desktop
|
|||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
BasicGameHost host = Host.GetSuitableHost(@"osu");
|
BasicGameHost host = Host.GetSuitableHost(@"osu");
|
||||||
host.Add(new OsuGame());
|
host.Add(new OsuGame(args));
|
||||||
host.Run();
|
host.Run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,7 @@
|
|||||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||||
<RunCodeAnalysis>false</RunCodeAnalysis>
|
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||||
<Prefer32Bit>false</Prefer32Bit>
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
|
<Commandlineparameters></Commandlineparameters>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<DebugType>none</DebugType>
|
<DebugType>none</DebugType>
|
||||||
|
@ -20,17 +20,30 @@ using osu.Framework;
|
|||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Game.Input;
|
using osu.Game.Input;
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace osu.Game
|
namespace osu.Game
|
||||||
{
|
{
|
||||||
public class OsuGame : OsuGameBase
|
public class OsuGame : OsuGameBase
|
||||||
{
|
{
|
||||||
|
private class ImportBeatmapIPC
|
||||||
|
{
|
||||||
|
public string Path;
|
||||||
|
}
|
||||||
|
|
||||||
public Toolbar Toolbar;
|
public Toolbar Toolbar;
|
||||||
public ChatConsole Chat;
|
public ChatConsole Chat;
|
||||||
public MainMenu MainMenu => intro?.ChildGameMode as MainMenu;
|
public MainMenu MainMenu => intro?.ChildGameMode as MainMenu;
|
||||||
private Intro intro;
|
private Intro intro;
|
||||||
|
private string[] args;
|
||||||
|
private IPCHost<ImportBeatmapIPC> BeatmapIPC;
|
||||||
|
|
||||||
public Bindable<PlayMode> PlayMode;
|
public Bindable<PlayMode> PlayMode;
|
||||||
|
|
||||||
|
public OsuGame(string[] args)
|
||||||
|
{
|
||||||
|
this.args = args;
|
||||||
|
}
|
||||||
|
|
||||||
public override void SetHost(BasicGameHost host)
|
public override void SetHost(BasicGameHost host)
|
||||||
{
|
{
|
||||||
@ -41,7 +54,27 @@ namespace osu.Game
|
|||||||
|
|
||||||
public override void Load(BaseGame game)
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
|
<<<<<<< HEAD
|
||||||
base.Load(game);
|
base.Load(game);
|
||||||
|
=======
|
||||||
|
BeatmapIPC = new IPCHost<ImportBeatmapIPC>(Host);
|
||||||
|
|
||||||
|
if (!Host.IsPrimaryInstance)
|
||||||
|
{
|
||||||
|
if (args.Length == 1 && File.Exists(args[0]))
|
||||||
|
{
|
||||||
|
BeatmapIPC.SendMessage(new ImportBeatmapIPC { Path = args[0] }).Wait();
|
||||||
|
Console.WriteLine(@"Sent file to running instance");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Console.WriteLine(@"osu! does not support multiple running instances.");
|
||||||
|
Environment.Exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
BeatmapIPC.MessageReceived += (message) => Console.WriteLine($@"Got beatmap: {message.Path}");
|
||||||
|
|
||||||
|
base.Load();
|
||||||
|
>>>>>>> Implement beatmap sending/receiving over IPC
|
||||||
|
|
||||||
//attach our bindables to the audio subsystem.
|
//attach our bindables to the audio subsystem.
|
||||||
Audio.Volume.Weld(Config.GetBindable<double>(OsuConfig.VolumeGlobal));
|
Audio.Volume.Weld(Config.GetBindable<double>(OsuConfig.VolumeGlobal));
|
||||||
|
1
osu.sln
1
osu.sln
@ -26,6 +26,7 @@ Global
|
|||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
Deploy|Any CPU = Deploy|Any CPU
|
Deploy|Any CPU = Deploy|Any CPU
|
||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
|
Deploy|Any CPU = Deploy|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
Loading…
Reference in New Issue
Block a user