From d07636a10589a7c14c02e9fc90ffaf34689dd0a8 Mon Sep 17 00:00:00 2001
From: "ANDY840119-PC\\andy840119" <andy840119@gmail.com>
Date: Sun, 14 Jan 2018 12:49:01 +0900
Subject: [PATCH] Fix : 1. This (along with OnJudgement above) should be done
 in the following three steps: 2. How about giving the stages an Inverted
 BindableBool, and having them decide their scale?

---
 osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 16 ++----------
 osu.Game.Rulesets.Mania/UI/ManiaStage.cs     | 27 +++++++++++++++-----
 2 files changed, 23 insertions(+), 20 deletions(-)

diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs
index 18d2f83fd9..5c6f6b4408 100644
--- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs
+++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs
@@ -81,8 +81,9 @@ namespace osu.Game.Rulesets.Mania.UI
             {
                 var drawableStage = new ManiaStage();
                 drawableStage.VisibleTimeRange.BindTo(VisibleTimeRange);
+                drawableStage.Inverted.BindTo(Inverted);
                 drawableStage.ColumnStartIndex = stageIndex;
-                
+
                 stages.Add(drawableStage);
                 AddNested(drawableStage);
 
@@ -100,19 +101,6 @@ namespace osu.Game.Rulesets.Mania.UI
 
                 stageIndex = stageIndex + stage.Columns;
             }
-
-            Inverted.ValueChanged += invertedChanged;
-            Inverted.TriggerChange();
-        }
-
-        private void invertedChanged(bool newValue)
-        {
-            Scale = new Vector2(1, newValue ? -1 : 1);
-
-            foreach (var single in stages)
-            {
-                single.Judgements.Scale = Scale;
-            }
         }
 
         public override void OnJudgement(DrawableHitObject judgedObject, Judgement judgement)
diff --git a/osu.Game.Rulesets.Mania/UI/ManiaStage.cs b/osu.Game.Rulesets.Mania/UI/ManiaStage.cs
index dee0b8a5bb..408103458e 100644
--- a/osu.Game.Rulesets.Mania/UI/ManiaStage.cs
+++ b/osu.Game.Rulesets.Mania/UI/ManiaStage.cs
@@ -5,6 +5,7 @@ using System;
 using System.Collections.Generic;
 using System.Linq;
 using osu.Framework.Allocation;
+using osu.Framework.Configuration;
 using osu.Framework.Graphics;
 using osu.Framework.Graphics.Containers;
 using osu.Framework.Graphics.Shapes;
@@ -25,6 +26,11 @@ namespace osu.Game.Rulesets.Mania.UI
     {
         public const float HIT_TARGET_POSITION = 50;
 
+        /// <summary>
+        /// Whether this playfield should be inverted. This flips everything inside the playfield.
+        /// </summary>
+        public readonly Bindable<bool> Inverted = new Bindable<bool>(true);
+
         private SpecialColumnPosition specialColumnPosition;
 
         /// <summary>
@@ -61,8 +67,8 @@ namespace osu.Game.Rulesets.Mania.UI
             : base(ScrollingDirection.Up)
         {
             Name = "Playfield elements";
-            Anchor = Anchor.TopCentre;
-            Origin = Anchor.TopCentre;
+            Anchor = Anchor.Centre;
+            Origin = Anchor.Centre;
             //RelativeSizeAxes = Axes.Y;
             //AutoSizeAxes = Axes.X;
             InternalChildren = new Drawable[]
@@ -130,6 +136,15 @@ namespace osu.Game.Rulesets.Mania.UI
                     }
                 }
             };
+
+            Inverted.ValueChanged += invertedChanged;
+            Inverted.TriggerChange();
+        }
+
+        private void invertedChanged(bool newValue)
+        {
+            Scale = new Vector2(1, newValue ? -1 : 1);
+            Judgements.Scale = Scale;
         }
 
         /// <summary>
@@ -166,15 +181,15 @@ namespace osu.Game.Rulesets.Mania.UI
 
         public override void Add(DrawableHitObject h)
         {
-            int index = ((ManiaHitObject)h.HitObject).Column - ColumnStartIndex;
-            Columns.ElementAt(index).Add(h);
+            int columnIndex = ((ManiaHitObject)h.HitObject).Column - ColumnStartIndex;
+            Columns.ElementAt(columnIndex).Add(h);
         }
 
         public void AddJudgement(DrawableHitObject judgedObject, Judgement judgement)
         {
             var maniaObject = (ManiaHitObject)judgedObject.HitObject;
-            int column = maniaObject.Column - ColumnStartIndex;
-            columns[column].OnJudgement(judgedObject, judgement);
+            int columnIndex = maniaObject.Column - ColumnStartIndex;
+            columns[columnIndex].OnJudgement(judgedObject, judgement);
 
             judgements.Clear();
             judgements.Add(new DrawableManiaJudgement(judgement)