public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
            EditorGUILayout.Space();

            //Lets make sure we have an Input Scheme first.  If not the User can create one
            //by hitting the create button
            if (!m_Target.m_InputScheme)
            {
                EditorGUILayout.Space();
                if (GUILayout.Button("Add Input Scheme", GUILayout.Height(35), GUILayout.ExpandWidth(true)))
                {
                    m_Target.m_InputScheme = EF_Input_Editor_Utils.CreateInputScheme();
                }

                return;
            }


            //We do have a Scheme so lets draw the inputs and let the user create new Inputs
            EF_Input_Scheme inputScheme = m_Target.m_InputScheme;

            if (inputScheme.m_Inputs.Count > 0)
            {
                foreach (var input in inputScheme.m_Inputs)
                {
                    //Draw each Input Editor UI
                    EditorGUILayout.BeginHorizontal(GUI.skin.box);
                    GUILayout.Space(5);
                    EditorGUILayout.BeginVertical();
                    GUILayout.Space(5);
                    input.UpdateEditor();
                    GUILayout.Space(5);
                    EditorGUILayout.EndVertical();
                    GUILayout.Space(5);
                    EditorGUILayout.EndHorizontal();
                    GUILayout.Space(10);
                }
            }

            //Allow the user to create new Inputs
            EditorGUILayout.Space();
            if (GUILayout.Button("Add Input Type", GUILayout.Height(35), GUILayout.ExpandWidth(true)))
            {
                EF_Input_Editor_Utils.CreateNewInput(inputScheme);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a new input scheme.
        /// </summary>
        /// <returns>The input scheme.</returns>
        public static EF_Input_Scheme CreateInputScheme()
        {
            //Create the new Data Container
            EF_Input_Scheme inputScheme = ScriptableObject.CreateInstance <EF_Input_Scheme>();

            //Get the User defined path
            string dataPath = EditorUtility.SaveFilePanel("Create Input Scheme", "Assets", "New_Input_Scheme", "asset");

            if (dataPath.Length > 0)
            {
                //Create the Asset and Save the Database
                AssetDatabase.CreateAsset(inputScheme, dataPath.Substring(dataPath.IndexOf("Assets")));
                AssetDatabase.SaveAssets();

                //Return the input scheme
                return(inputScheme);
            }
            else
            {
                //We were unsuccessful in creating the new input scheme
                return(null);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a new input.
        /// </summary>
        /// <returns>The new input.</returns>
        public static void CreateNewInput(EF_Input_Scheme inputScheme)
        {
            EF_Input_Popup win = EF_Input_Popup.InitInputPopup();

            win.OnComplete += inputScheme.AddInput;
        }