1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 02:43:19 +08:00

Merge remote-tracking branch 'upstream/master' into counters-a

This commit is contained in:
Adonais Romero González 2016-10-17 20:36:04 -05:00
commit 5abc3ba898
20 changed files with 55 additions and 141 deletions

@ -1 +1 @@
Subproject commit cb420e7f7f4ef9cdda8ae8336d997946384d3732
Subproject commit 852df4b405bf40cee0df8f0450a081fa657e7b43

View File

@ -6,7 +6,6 @@ using System.Collections.Generic;
using osu.Framework.GameModes;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Drawables;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transformations;
using osu.Framework.Graphics.UserInterface;

View File

@ -4,7 +4,6 @@ using OpenTK.Input;
using osu.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Drawables;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transformations;
@ -21,7 +20,7 @@ namespace osu.Game.GameModes.Menu
public class Button : AutoSizeContainer, IStateful<ButtonState>
{
private Container iconText;
private WedgedBox box;
private Box box;
private Color4 colour;
private TextAwesome icon;
private string internalName;
@ -31,7 +30,10 @@ namespace osu.Game.GameModes.Menu
private Key triggerKey;
private string text;
public override Quad ScreenSpaceInputQuad => box.ScreenSpaceInputQuad;
public override bool Contains(Vector2 screenSpacePos)
{
return box.Contains(screenSpacePos);
}
public Button(string text, string internalName, FontAwesome symbol, Color4 colour, Action clickAction = null, float extraWidth = 0, Key triggerKey = Key.Unknown)
{
@ -49,14 +51,18 @@ namespace osu.Game.GameModes.Menu
base.Load(game);
Alpha = 0;
Vector2 boxSize = new Vector2(ButtonSystem.button_width + Math.Abs(extraWidth), ButtonSystem.button_area_height);
Children = new Drawable[]
{
box = new WedgedBox(new Vector2(ButtonSystem.button_width + Math.Abs(extraWidth), ButtonSystem.button_area_height), ButtonSystem.wedge_width)
box = new Box
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Colour = colour,
Scale = new Vector2(0, 1)
Scale = new Vector2(0, 1),
Size = boxSize,
Shear = new Vector2(ButtonSystem.wedge_width / boxSize.Y, 0),
},
iconText = new AutoSizeContainer
{
@ -267,42 +273,6 @@ namespace osu.Game.GameModes.Menu
}
}
}
/// <summary>
/// ________
/// / /
/// / /
/// /_______/
/// </summary>
class WedgedBox : Box
{
float wedgeWidth;
public WedgedBox(Vector2 boxSize, float wedgeWidth)
{
Size = boxSize;
this.wedgeWidth = wedgeWidth;
}
/// <summary>
/// Custom DrawQuad used to create the slanted effect.
/// </summary>
protected override Quad DrawQuad
{
get
{
Quad q = base.DrawQuad;
//Will become infinite if we don't limit its maximum size.
float wedge = Math.Min(q.Width, wedgeWidth / Scale.X);
q.TopLeft.X += wedge;
q.BottomRight.X -= wedge;
return q;
}
}
}
}
public enum ButtonState

View File

@ -6,13 +6,10 @@ using System.Collections.Generic;
using System.Linq;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Drawables;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transformations;
using osu.Framework.Input;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Input;

View File

@ -17,7 +17,8 @@ namespace osu.Game.GameModes.Menu
/// </summary>
public partial class OsuLogo : AutoSizeContainer
{
private SpriteCircular logo;
private Sprite logo;
private CircularContainer logoContainer;
private Container logoBounceContainer;
private MenuVisualisation vis;
@ -29,6 +30,11 @@ namespace osu.Game.GameModes.Menu
private Container rippleContainer;
public override bool Contains(Vector2 screenSpacePos)
{
return logoContainer.Contains(screenSpacePos);
}
public bool Ripple
{
get { return rippleContainer.Alpha > 0; }
@ -38,11 +44,6 @@ namespace osu.Game.GameModes.Menu
}
}
public override bool Contains(Vector2 screenSpacePos)
{
return logo.Contains(screenSpacePos);
}
public bool Interactive = true;
public OsuLogo()
@ -56,10 +57,17 @@ namespace osu.Game.GameModes.Menu
{
Children = new Drawable[]
{
logo = new SpriteCircular()
logoContainer = new CircularContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre
Children = new[]
{
logo = new Sprite
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
},
},
},
rippleContainer = new Container
{

View File

@ -3,7 +3,6 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Drawables;
using osu.Framework.Graphics.Sprites;
using OpenTK;
using OpenTK.Graphics;

View File

@ -3,7 +3,6 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Drawables;
using osu.Framework.Graphics.Sprites;
using OpenTK;
using OpenTK.Graphics;

View File

@ -3,9 +3,9 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Drawables;
using OpenTK;
using osu.Framework;
using osu.Framework.Graphics.Sprites;
namespace osu.Game.GameModes.Play.Osu
{

View File

@ -3,7 +3,6 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Drawables;
using osu.Framework.Graphics.Sprites;
using OpenTK;
using OpenTK.Graphics;

View File

@ -5,7 +5,6 @@ using System;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Drawables;
using osu.Framework.Graphics.Sprites;
using OpenTK;
using OpenTK.Graphics;

View File

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

View File

@ -9,7 +9,6 @@ using OpenTK.Graphics;
using osu.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Drawables;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transformations;
using osu.Framework.Threading;
@ -20,7 +19,7 @@ using osu.Game.Online.Chat.Display;
namespace osu.Game.Overlays
{
public class ChatConsole : Overlay
public class ChatConsole : OverlayContainer
{
private ChannelDisplay channelDisplay;

View File

@ -6,13 +6,14 @@ using OpenTK.Graphics;
using OpenTK.Input;
using osu.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Drawables;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transformations;
using osu.Framework.Input;
namespace osu.Game.Overlays
{
public class Options : Overlay
public class Options : OverlayContainer
{
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

@ -7,15 +7,15 @@ using OpenTK.Graphics;
using osu.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Drawables;
using osu.Framework.Graphics.Transformations;
using osu.Game.Configuration;
using osu.Game.GameModes.Play;
using osu.Game.Graphics;
using osu.Framework.Graphics.Sprites;
namespace osu.Game.Overlays
{
public class Toolbar : Overlay
public class Toolbar : OverlayContainer
{
private const float height = 50;
@ -62,9 +62,9 @@ namespace osu.Game.Overlays
new ToolbarButton
{
Icon = FontAwesome.gear,
Action = OnSettings,
TooltipMain = "Settings",
TooltipSub = "Change your settings",
Action = OnSettings
},
new ToolbarButton
{

View File

@ -4,7 +4,6 @@
using System;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Drawables;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input;
using osu.Game.Graphics;

View File

@ -6,12 +6,12 @@ using System.Linq;
using osu.Framework.Cached;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Drawables;
using osu.Framework.Graphics.Transformations;
using osu.Game.GameModes.Play;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework;
using osu.Framework.Graphics.Sprites;
namespace osu.Game.Overlays
{

View File

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

View File

@ -1,7 +1,6 @@
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Drawables;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transformations;
using osu.Framework.Input;

View File

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