/// <summary>
        /// Helper method used to invert an axis, providing an undo action.
        /// </summary>
        /// <param name="axis"></param>
        private void AxisToggle(CAxis axis)
        {
            EditorGUI.BeginChangeCheck();
            bool value = EditorGUILayout.ToggleLeft(axis.ToString(), Settings[axis], GUILayout.Width(40));

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(Settings, "Inverted Axis " + axis.ToString());
                Settings[axis] = value;
            }
        }
Exemple #2
0
 private void PlayerColumn(PlayerIndex id, int x)
 {
     GUI.contentColor = Color.white;
     GUI.Label(new Rect(x, 20, 100, 20), "Player " + id);
     if (id != PlayerIndex.Any)
     {
         GUI.Label(new Rect(x, 40, 100, 20), GamePad.GetMapping(id).Controller.name);
     }
     for (CButton btn = CButton.A; btn <= CButton.RS; btn++)
     {
         if (GamePad.GetButton(btn, id))
         {
             GUI.contentColor = Color.green;
         }
         else
         {
             GUI.contentColor = Color.white;
         }
         GUI.Label(new Rect(x, 60 + 20 * (int)btn, 40, 20), btn.ToString());
     }
     for (CAxis axis = CAxis.LX; axis <= CAxis.DY; axis++)
     {
         float value = GamePad.GetAxis(axis, id);
         if (Mathf.Abs(value) > 0)
         {
             GUI.contentColor = Color.green;
         }
         else
         {
             GUI.contentColor = Color.white;
         }
         GUI.Label(new Rect(x + 40, 60 + 20 * (int)axis, 80, 20), axis.ToString() + " " + value.ToString("F"));
     }
 }