Exemplo n.º 1
0
    public static void EditAxis(string baseName, InputAxisData axisData)
    {
        SerializedObject inputManager = LoadInputManager();

        // TODO: get all indexes to edit based on baseName, move this to for loop
        EditAxisData(inputManager, 1000, axisData);
    }
Exemplo n.º 2
0
    public static void AddNewAxis(InputAxisData axisData)
    {
        SerializedObject   inputManager    = LoadInputManager();
        SerializedProperty allAxesProperty = GetAllAxes(inputManager);

        allAxesProperty.arraySize++;
        inputManager.ApplyModifiedProperties();

        int lastIndex = GetAxesAmount(inputManager) - 1;

        EditAxisData(inputManager, lastIndex, axisData);
    }
Exemplo n.º 3
0
    public override void OnInspectorGUI()
    {
        InputAxisData ctrl = target as InputAxisData;

        var list = ctrl.Config;

        if (!m_IsInitialized)
        {
            InitializeList(list.Count);
        }

        if (m_FoldingList = EditorGUILayout.Foldout(m_FoldingList, "InputAxisData"))
        {
            GUI.enabled = false;
            EditorGUI.indentLevel++;

            for (int i = 0; i < list.Count; i++)
            {
                EditorGUI.indentLevel++;
                var elem = list[i];
                // 表示名をStatusの要素に変更
                if (m_Foldings[i] = EditorGUILayout.Foldout(m_Foldings[i], list[i].Name))
                {
                    EditorGUILayout.TextField("Name", elem.Name);
                    EditorGUILayout.TextField("DescriptiveName", elem.DescriptiveName);
                    EditorGUILayout.TextField("DescriptiveNegativeName", elem.DescriptiveNegativeName);
                    EditorGUILayout.TextField("NegativeButton", elem.NegativeButton);
                    EditorGUILayout.TextField("PositiveButton", elem.PositiveButton);
                    EditorGUILayout.TextField("AltNegativeButton", elem.AltNegativeButton);
                    EditorGUILayout.TextField("AltPositiveButton", elem.AltPositiveButton);
                    EditorGUILayout.FloatField("Gravity", elem.Gravity);
                    EditorGUILayout.FloatField("Dead", elem.Dead);
                    EditorGUILayout.FloatField("Sensitivity", elem.Sensitivity);
                    EditorGUILayout.Toggle("Snap", elem.Snap);
                    EditorGUILayout.Toggle("Invert", elem.Invert);
                    EditorGUILayout.EnumPopup("Type", elem.Type);
                    EditorGUILayout.IntField("Axis", elem.Axis);
                    EditorGUILayout.IntField("JoyNum", elem.JoyNum);
                }

                EditorGUI.indentLevel--;
            }

            // インデントを減らす
            EditorGUI.indentLevel--;
            GUI.enabled = true;
        }
    }
Exemplo n.º 4
0
 private static void EditAxisData(SerializedObject inputManager, int index, InputAxisData axisData)
 {
     FindAxisProperty(inputManager, "m_Name", index).stringValue                  = axisData.Name;
     FindAxisProperty(inputManager, "descriptiveName", index).stringValue         = axisData.DescriptiveName;
     FindAxisProperty(inputManager, "descriptiveNegativeName", index).stringValue = axisData.DescriptiveNegativeName;
     FindAxisProperty(inputManager, "negativeButton", index).stringValue          = axisData.NegativeButton;
     FindAxisProperty(inputManager, "positiveButton", index).stringValue          = axisData.PositiveButton;
     FindAxisProperty(inputManager, "altNegativeButton", index).stringValue       = axisData.AltNegativeButton;
     FindAxisProperty(inputManager, "altPositiveButton", index).stringValue       = axisData.AltPositiveButton;
     FindAxisProperty(inputManager, "gravity", index).floatValue                  = axisData.Gravity;
     FindAxisProperty(inputManager, "dead", index).floatValue        = axisData.Dead;
     FindAxisProperty(inputManager, "sensitivity", index).floatValue = axisData.Sensitivity;
     FindAxisProperty(inputManager, "snap", index).boolValue         = axisData.Snap;
     FindAxisProperty(inputManager, "invert", index).boolValue       = axisData.Invert;
     FindAxisProperty(inputManager, "type", index).intValue          = 2;
     FindAxisProperty(inputManager, "axis", index).intValue          = axisData.Axis;
     if (axisData.JoyNum != -1)
     {
         FindAxisProperty(inputManager, "joyNum", index).intValue = axisData.JoyNum;
     }
     inputManager.ApplyModifiedProperties();
 }