1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-22 11:27:19 +08:00

Invert the playfield by default to make calculations a bit simpler and clean up a lot of code.

This commit is contained in:
smoogipooo 2017-05-16 17:34:41 +09:00
parent 62139015fb
commit 7039205363
6 changed files with 57 additions and 61 deletions

View File

@ -27,18 +27,18 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
// This will be fixed when new designs are given or the current design is finalized.
bodyPiece = new BodyPiece
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
},
headPiece = new NotePiece
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre
},
tailPiece = new NotePiece
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre
}
});
}

View File

@ -22,11 +22,8 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
{
HitObject = hitObject;
Anchor = Anchor.BottomCentre;
Origin = Anchor.BottomCentre;
RelativePositionAxes = Axes.Y;
Y = (float)-HitObject.StartTime;
Y = (float)HitObject.StartTime;
Add(glowContainer = new Container
{

View File

@ -20,8 +20,8 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
Add(headPiece = new NotePiece
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre
});
}

View File

@ -87,18 +87,13 @@ namespace osu.Game.Rulesets.Mania.Timing
{
this.timingChange = timingChange;
Anchor = Anchor.BottomCentre;
Origin = Anchor.BottomCentre;
RelativeSizeAxes = Axes.Both;
AddInternal(content = new AutoTimeRelativeContainer
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
RelativeSizeAxes = Axes.Both,
RelativePositionAxes = Axes.Both,
Y = -(float)timingChange.Time
Y = (float)timingChange.Time
});
}
@ -111,7 +106,7 @@ namespace osu.Game.Rulesets.Mania.Timing
RelativeCoordinateSpace = new Vector2(1, (float)parent.TimeSpan);
// Scroll the content
content.Y = (float)(Time.Current - timingChange.Time);
content.Y = (float)(timingChange.Time - Time.Current);
}
public override void Add(Drawable drawable)
@ -120,7 +115,7 @@ namespace osu.Game.Rulesets.Mania.Timing
// we need to offset it back by our position so that it becomes correctly relatively-positioned to us
// This can be removed if hit objects were stored such that either their StartTime or their "beat offset" was relative to the timing section
// they belonged to, but this requires a radical change to the beatmap format which we're not ready to do just yet
drawable.Y += (float)timingChange.Time;
drawable.Y -= (float)timingChange.Time;
base.Add(drawable);
}
@ -130,7 +125,7 @@ namespace osu.Game.Rulesets.Mania.Timing
/// can be placed within the timing section's bounds (in this case, from the start of the timing section up to infinity).
/// </summary>
/// <param name="drawable">The drawable to check.</param>
public bool CanContain(Drawable drawable) => content.Y >= drawable.Y;
public bool CanContain(Drawable drawable) => content.Y <= drawable.Y;
private class AutoTimeRelativeContainer : Container
{
@ -140,8 +135,7 @@ namespace osu.Game.Rulesets.Mania.Timing
foreach (Drawable child in Children)
{
// Todo: This is wrong, it won't work for absolute-y-sized children
float childEndPos = -child.Y + child.Height;
float childEndPos = child.Y + child.Height;
if (childEndPos > height)
height = childEndPos;
}

View File

@ -18,6 +18,7 @@ using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.Judgements;
using osu.Game.Beatmaps.Timing;
using osu.Framework.Graphics.Primitives;
namespace osu.Game.Rulesets.Mania.UI
{
@ -56,51 +57,50 @@ namespace osu.Game.Rulesets.Mania.UI
},
new Container
{
Name = "Hit target",
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
RelativeSizeAxes = Axes.X,
Height = hit_target_height,
Y = -ManiaPlayfield.HIT_TARGET_POSITION,
Name = "Hit target + hit objects",
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Top = ManiaPlayfield.HIT_TARGET_POSITION},
Children = new Drawable[]
{
new Box
new Container
{
Name = "Background",
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black
},
hitTargetBar = new Container
{
Name = "Bar",
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Name = "Hit target",
RelativeSizeAxes = Axes.X,
Height = hit_target_bar_height,
Masking = true,
Children = new[]
Height = hit_target_height,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both
Name = "Background",
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black
},
hitTargetBar = new Container
{
Name = "Bar",
RelativeSizeAxes = Axes.X,
Height = hit_target_bar_height,
Masking = true,
Children = new[]
{
new Box
{
RelativeSizeAxes = Axes.Both
}
}
}
}
}
},
TimingSectionContainer = new TimeRelativeContainer(timingChanges)
{
Name = "Hit objects",
RelativeSizeAxes = Axes.Both,
},
}
},
TimingSectionContainer = new TimeRelativeContainer(timingChanges)
{
Name = "Hit objects",
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Y = -ManiaPlayfield.HIT_TARGET_POSITION
},
new Container
{
Name = "Key",
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
RelativeSizeAxes = Axes.X,
Height = ManiaPlayfield.HIT_TARGET_POSITION,
Children = new Drawable[]

View File

@ -74,8 +74,8 @@ namespace osu.Game.Rulesets.Mania.UI
{
new Container
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X,
Masking = true,
@ -95,13 +95,18 @@ namespace osu.Game.Rulesets.Mania.UI
Padding = new MarginPadding { Left = 1, Right = 1 },
Spacing = new Vector2(1, 0)
},
barlineContainer = new TimeRelativeContainer(timingChanges)
new Container
{
Name = "Bar lines",
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Bottom = HIT_TARGET_POSITION }
Padding = new MarginPadding { Top = HIT_TARGET_POSITION },
Children = new[]
{
barlineContainer = new TimeRelativeContainer(timingChanges)
{
Name = "Bar lines",
RelativeSizeAxes = Axes.Both,
}
}
}
}
}