1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 19:22:54 +08:00

Migrate to new anchor system without x/y reversal.

This commit is contained in:
Tom94 2016-11-14 17:22:20 +01:00
parent 63f0a01888
commit c860eb25f9
7 changed files with 26 additions and 21 deletions

@ -1 +1 @@
Subproject commit 87a5cd4ce48d6370b8e392378289825f4b4a2039
Subproject commit cf7dd12f24d0b60bae2a4ebaa6ef0eaa67b0fd52

View File

@ -14,6 +14,7 @@ using osu.Game.GameModes.Play.Taiko;
using osu.Game.Graphics.UserInterface;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Graphics.Primitives;
namespace osu.Desktop.VisualTests.Tests
{
@ -37,7 +38,7 @@ namespace osu.Desktop.VisualTests.Tests
Anchor = Anchor.TopRight,
TextSize = 40,
Count = 0,
Position = new Vector2(20, 20),
Margin = new MarginPadding(20),
};
Add(score);
@ -45,8 +46,8 @@ namespace osu.Desktop.VisualTests.Tests
{
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,
Position = new Vector2(10, 10),
InnerCountPosition = new Vector2(10, 10),
Margin = new MarginPadding(10),
InnerCountMargin = new MarginPadding(10),
Count = 0,
TextSize = 40,
};
@ -86,7 +87,7 @@ namespace osu.Desktop.VisualTests.Tests
{
Origin = Anchor.TopRight,
Anchor = Anchor.TopRight,
Position = new Vector2(20, 60),
Position = new Vector2(-20, 60),
};
Add(accuracyCombo);
@ -94,7 +95,7 @@ namespace osu.Desktop.VisualTests.Tests
{
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,
Position = new Vector2(20, 160),
Position = new Vector2(20, -160),
Count = 5,
};
Add(stars);
@ -103,7 +104,7 @@ namespace osu.Desktop.VisualTests.Tests
{
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,
Position = new Vector2(20, 190),
Position = new Vector2(20, -190),
Text = stars.Count.ToString("0.00"),
};
Add(starsLabel);

View File

@ -9,6 +9,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Primitives;
namespace osu.Game.GameModes.Play.Osu
{
@ -22,15 +23,15 @@ namespace osu.Game.GameModes.Play.Osu
protected virtual float PopOutSmallScale => 1.1f;
protected virtual bool CanPopOutWhileRolling => false;
public Vector2 InnerCountPosition
public MarginPadding InnerCountMargin
{
get
{
return DisplayedCountSpriteText.Position;
return DisplayedCountSpriteText.Margin;
}
set
{
DisplayedCountSpriteText.Position = value;
DisplayedCountSpriteText.Margin = value;
}
}

View File

@ -11,6 +11,7 @@ using osu.Game.Graphics.UserInterface;
using OpenTK;
using OpenTK.Input;
using osu.Game.Beatmaps.Objects;
using osu.Framework.Graphics.Primitives;
namespace osu.Game.GameModes.Play.Osu
{
@ -42,7 +43,7 @@ namespace osu.Game.GameModes.Play.Osu
FadeTime = 50,
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
Position = new Vector2(10),
Margin = new MarginPadding(10),
Counters = new KeyCounter[]
{
new KeyCounterKeyboard(@"Z", Key.Z),

View File

@ -7,6 +7,7 @@ using osu.Framework.Input;
using osu.Framework.Threading;
using OpenTK;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Primitives;
namespace osu.Game.Graphics.UserInterface.Volume
{
@ -40,7 +41,7 @@ namespace osu.Game.Graphics.UserInterface.Volume
AutoSizeAxes = Axes.Both,
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
Position = new Vector2(10, 30),
Margin = new MarginPadding { Left = 10, Right = 10, Top = 30, Bottom = 30 },
Spacing = new Vector2(15, 0),
});
}

View File

@ -22,12 +22,13 @@ using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Database;
using osu.Game.Graphics;
using osu.Framework.Graphics.Primitives;
namespace osu.Game.Overlays
{
public class MusicController : OverlayContainer
{
private static readonly Vector2 start_position = new Vector2(10, 60);
private static readonly Vector2 start_position = new Vector2(0, 50);
private MusicControllerBackground backgroundSprite;
private DragBar progress;
@ -63,6 +64,8 @@ namespace osu.Game.Overlays
Anchor = Anchor.TopRight;//placeholder
Origin = Anchor.TopRight;
Position = start_position;
Margin = new MarginPadding(10);
Children = new Drawable[]
{
title = new SpriteText
@ -90,7 +93,7 @@ namespace osu.Game.Overlays
AutoSizeAxes = Axes.Both,
Origin = Anchor.Centre,
Anchor = Anchor.BottomCentre,
Position = new Vector2(0, 30),
Position = new Vector2(0, -30),
Action = () =>
{
if (current?.Track == null) return;
@ -115,7 +118,7 @@ namespace osu.Game.Overlays
AutoSizeAxes = Axes.Both,
Origin = Anchor.Centre,
Anchor = Anchor.BottomCentre,
Position = new Vector2(-30, 30),
Position = new Vector2(-30, -30),
Action = prev,
Children = new Drawable[]
{
@ -133,7 +136,7 @@ namespace osu.Game.Overlays
AutoSizeAxes = Axes.Both,
Origin = Anchor.Centre,
Anchor = Anchor.BottomCentre,
Position = new Vector2(30, 30),
Position = new Vector2(30, -30),
Action = next,
Children = new Drawable[]
{
@ -151,7 +154,7 @@ namespace osu.Game.Overlays
AutoSizeAxes = Axes.Both,
Origin = Anchor.Centre,
Anchor = Anchor.BottomRight,
Position = new Vector2(20, 30),
Position = new Vector2(20, -30),
Children = new Drawable[]
{
listButton = new TextAwesome
@ -180,9 +183,7 @@ namespace osu.Game.Overlays
{
Vector2 change = (state.Mouse.Position - state.Mouse.PositionMouseDown.Value);
if ((Anchor & Anchor.x2) > 0)
change.X = -change.X;
// Diminish the drag distance as we go further to simulate "rubber band" feeling.
change *= (float)Math.Pow(change.Length, 0.7f) / change.Length;
MoveTo(start_position + change);

View File

@ -98,7 +98,7 @@ namespace osu.Game.Overlays
Direction = FlowDirection.VerticalOnly,
AutoSizeAxes = Axes.Both,
Anchor = Anchor.BottomLeft,
Position = new Vector2(5, -5),
Position = new Vector2(5, 5),
Alpha = 0,
Children = new[]
{