1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 16:52:55 +08:00

Merge branch 'master' of github.com:ppy/osu into unified_shader

# Conflicts:
#	osu-framework
#	osu.Game/Overlays/Options.cs
This commit is contained in:
Thomas Müller 2016-10-16 15:15:28 +02:00
commit fec127eb8c
9 changed files with 27 additions and 79 deletions

@ -1 +1 @@
Subproject commit 27e2bbc71a9e97e538c0d6018ea81a08bd24105e Subproject commit 1b66dff88718c7c7439a5d12d0232db8f7b62f49

View File

@ -22,6 +22,7 @@ using osu.Game.Input;
using OpenTK.Input; using OpenTK.Input;
using System.IO; using System.IO;
using osu.Game.Beatmaps.IO; using osu.Game.Beatmaps.IO;
using osu.Framework.Logging;
namespace osu.Game namespace osu.Game
{ {
@ -62,10 +63,10 @@ namespace osu.Game
if (args.Length == 1 && File.Exists(args[0])) if (args.Length == 1 && File.Exists(args[0]))
{ {
BeatmapIPC.SendMessage(new ImportBeatmap { Path = args[0] }).Wait(); BeatmapIPC.SendMessage(new ImportBeatmap { Path = args[0] }).Wait();
Console.WriteLine(@"Sent file to running instance"); Logger.Log(@"Sent file to running instance");
} }
else else
Console.WriteLine(@"osu! does not support multiple running instances."); Logger.Log(@"osu! does not support multiple running instances.", LoggingTarget.Runtime, LogLevel.Error);
Environment.Exit(0); Environment.Exit(0);
} }
@ -79,7 +80,7 @@ namespace osu.Game
catch (Exception ex) catch (Exception ex)
{ {
// TODO: Show the user some info? // TODO: Show the user some info?
Console.WriteLine($@"Failed to import beatmap: {ex}"); Logger.Log($@"Failed to import beatmap: {ex}", LoggingTarget.Runtime, LogLevel.Error);
} }
}; };

View File

@ -25,12 +25,23 @@ namespace osu.Game
public Options Options; public Options Options;
public APIAccess API; public APIAccess API;
protected override Container Content => ratioContainer?.IsLoaded == true ? ratioContainer : base.Content; protected override Container Content => ratioContainer;
private RatioAdjust ratioContainer; private RatioAdjust ratioContainer;
public CursorContainer Cursor; public CursorContainer Cursor;
public OsuGameBase()
{
AddInternal(ratioContainer = new RatioAdjust());
Children = new Drawable[]
{
Options = new Options(),
Cursor = new OsuCursorContainer()
};
}
public override void Load(BaseGame game) public override void Load(BaseGame game)
{ {
base.Load(game); base.Load(game);
@ -50,18 +61,6 @@ namespace osu.Game
Password = Config.Get<string>(OsuConfig.Password), Password = Config.Get<string>(OsuConfig.Password),
Token = Config.Get<string>(OsuConfig.Token) Token = Config.Get<string>(OsuConfig.Token)
}; };
Add(new Drawable[]
{
ratioContainer = new RatioAdjust
{
Children = new Drawable[]
{
Options = new Options(),
Cursor = new OsuCursorContainer()
}
}
});
} }
protected override void Update() protected override void Update()

View File

@ -19,7 +19,7 @@ using osu.Game.Online.Chat.Display;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
public class ChatConsole : Overlay public class ChatConsole : OverlayContainer
{ {
private ChannelDisplay channelDisplay; private ChannelDisplay channelDisplay;

View File

@ -6,13 +6,14 @@ using OpenTK.Graphics;
using OpenTK.Input; using OpenTK.Input;
using osu.Framework; using osu.Framework;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transformations; using osu.Framework.Graphics.Transformations;
using osu.Framework.Input; using osu.Framework.Input;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
public class Options : Overlay public class Options : OverlayContainer
{ {
private const float width = 300; private const float width = 300;

View File

@ -1,53 +0,0 @@
using osu.Framework;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Overlays
{
/// <summary>
/// An element which starts hidden and can be toggled to visible.
/// </summary>
public abstract class Overlay : Container, IStateful<Visibility>
{
public override void Load(BaseGame game)
{
base.Load(game);
//TODO: init code using Alpha or IsVisible override to ensure we don't call Load on children before we first get unhidden.
PopOut();
Flush();
}
private Visibility state;
public Visibility State
{
get { return state; }
set
{
if (value == state) return;
state = value;
switch (value)
{
case Visibility.Hidden:
PopOut();
break;
case Visibility.Visible:
PopIn();
break;
}
}
}
protected abstract void PopIn();
protected abstract void PopOut();
public void ToggleVisibility() => State = (State == Visibility.Visible ? Visibility.Hidden : Visibility.Visible);
}
public enum Visibility
{
Hidden,
Visible
}
}

View File

@ -15,7 +15,7 @@ using osu.Framework.Graphics.Sprites;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
public class Toolbar : Overlay public class Toolbar : OverlayContainer
{ {
private const float height = 50; private const float height = 50;

View File

@ -4,10 +4,11 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Input; using osu.Framework.Input;
using OpenTK; using OpenTK;
using osu.Framework.Graphics.Primitives;
namespace osu.Game namespace osu.Game
{ {
internal class VolumeControl : Container internal class VolumeControl : AutoSizeContainer
{ {
private FlowContainer volumeMetersContainer; private FlowContainer volumeMetersContainer;
private VolumeMeter volumeMeterMaster; private VolumeMeter volumeMeterMaster;
@ -15,14 +16,14 @@ namespace osu.Game
public BindableDouble VolumeSample { get; set; } public BindableDouble VolumeSample { get; set; }
public BindableDouble VolumeTrack { get; set; } public BindableDouble VolumeTrack { get; set; }
public VolumeControl() public override bool Contains(Vector2 screenSpacePos) => true;
{
RelativeSizeAxes = Axes.Both;
}
private void volumeChanged(object sender, System.EventArgs e) private void volumeChanged(object sender, System.EventArgs e)
{ {
appear(); appear();
Anchor = Anchor.BottomRight;
Origin = Anchor.BottomRight;
} }
public override void Load(BaseGame game) public override void Load(BaseGame game)

View File

@ -156,7 +156,6 @@
<Compile Include="OsuGameBase.cs" /> <Compile Include="OsuGameBase.cs" />
<Compile Include="Overlays\ChatConsole.cs" /> <Compile Include="Overlays\ChatConsole.cs" />
<Compile Include="Overlays\Options.cs" /> <Compile Include="Overlays\Options.cs" />
<Compile Include="Overlays\Overlay.cs" />
<Compile Include="Overlays\Toolbar.cs" /> <Compile Include="Overlays\Toolbar.cs" />
<Compile Include="Overlays\ToolbarButton.cs" /> <Compile Include="Overlays\ToolbarButton.cs" />
<Compile Include="Overlays\ToolbarModeButton.cs" /> <Compile Include="Overlays\ToolbarModeButton.cs" />