Ejemplo n.º 1
0
    void OnGUI()
    {
        InitInputList();
        InitActionGroups();
        LoadSavedInput();


        SerializedProperty axisArray = _inputManager.FindProperty("m_Axes");


        EditorGUILayout.BeginHorizontal();

//    if (_inputManager != null && GUILayout.Button("load Default inputs"))
//    {
//      AssetDatabase.CopyAsset("ProjectSettings/InputManager.asset", "ProjectSettings/InputManager.backup");
//      AssetDatabase.CopyAsset("Assets/Plugins/Input/Default/InputManager.asset~", "ProjectSettings/InputManager.asset");
//      AssetDatabase.SaveAssets();
//      _inputManager = null;
//      InitInputList();
//
//    }

        if (_savedInputs != null)
        {
            _importSelectedIndex = EditorGUILayout.Popup(_importSelectedIndex, _savedInputs.Get());
            if (GUILayout.Button("import"))
            {
                axisArray.InsertArrayElementAtIndex(axisArray.arraySize);
                var p = axisArray.GetArrayElementAtIndex(axisArray.arraySize - 1);
                _savedInputs.Extract(p, _importSelectedIndex);
            }
        }


        if (_inputManager != null && _modified && GUILayout.Button("save"))
        {
            _inputManager.ApplyModifiedProperties();
            //AssetDatabase.CreateAsset(_inputManager.targetObject,"Assets/Plugins/Input/Default/tmp.asset");
            Debug.LogError(Application.dataPath);
            //File.Copy(,true);

            AssetDatabase.SaveAssets();
            _modified = false;
        }


        EditorGUILayout.EndHorizontal();

        //GroupActionMenu();


        if (_inputManager != null)
        {
            EditorGUILayout.BeginHorizontal();

            EditorGUILayout.BeginVertical(GUILayout.Width(250));
//        if (_inputManager != null && GUILayout.Button("+"))
//        {
//          axisArray.InsertArrayElementAtIndex(axisArray.arraySize);
//          _modified = true;
//        }
            DisplayInputList(axisArray);
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical();
            if (_list.SelectedIndexes.Count == 1)
            {
                DisplaySelection(axisArray);
            }
            else if (_list.SelectedIndexes.Count > 1)
            {
                DisplayMultiSelection(axisArray);
            }

            if (_list.SelectedIndexes.Count >= 1)
            {
                _modified |= _actionGroupManager.OnGUI(_list.SelectedIndexes, axisArray);
            }

            EditorGUILayout.EndVertical();

            EditorGUILayout.EndHorizontal();
        }
    }
Ejemplo n.º 2
0
    void OnGUI()
    {
        InitInputList();
        InitActionGroups();

        SerializedProperty axisArray = _inputManager.FindProperty("m_Axes");


        EditorGUILayout.BeginHorizontal();

        if (_inputManager != null && GUILayout.Button("load Default inputs"))
        {
            AssetDatabase.CopyAsset("ProjectSettings/InputManager.asset", "ProjectSettings/InputManager.backup");
            AssetDatabase.CopyAsset("Assets/Plugins/Input/Default/InputManager.asset", "ProjectSettings/InputManager.asset");
            AssetDatabase.SaveAssets();
            _inputManager = null;
            InitInputList();
        }

        if (_inputManager != null && _modified && GUILayout.Button("save"))
        {
            _inputManager.ApplyModifiedProperties();
            AssetDatabase.SaveAssets();
            _modified = false;
        }


        EditorGUILayout.EndHorizontal();

        //GroupActionMenu();


        if (_inputManager != null)
        {
            EditorGUILayout.BeginHorizontal();

            EditorGUILayout.BeginVertical(GUILayout.Width(250));
            if (_inputManager != null && GUILayout.Button("+"))
            {
                axisArray.InsertArrayElementAtIndex(axisArray.arraySize);
                _modified = true;
            }
            DisplayInputList(axisArray);
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical();
            if (_selectedIndexes.Count == 1)
            {
                DisplaySelection(axisArray);
            }
            else if (_selectedIndexes.Count > 1)
            {
                DisplayMultiSelection(axisArray);
            }

            if (_selectedIndexes.Count >= 1)
            {
                _modified |= _actionGroupManager.OnGUI(_selectedIndexes, axisArray);
            }

            EditorGUILayout.EndVertical();

            EditorGUILayout.EndHorizontal();
        }
    }