Esempio n. 1
0
    public void removeBoolean(int value, int number, MM_MenuInputs myScript)
    {
        //MM_MenuInputs myScript = (MM_MenuInputs)target;

        Undo.RegisterFullObjectHierarchyUndo(myScript.gameObject, "removeBool");

        if (boolValues.GetArrayElementAtIndex(value).FindPropertyRelative("buttonsList").GetArrayElementAtIndex(number).objectReferenceValue != null)
        {
            boolValues.GetArrayElementAtIndex(value).FindPropertyRelative("buttonsList").DeleteArrayElementAtIndex(number);
        }

        boolValues.GetArrayElementAtIndex(value).FindPropertyRelative("buttonsList").DeleteArrayElementAtIndex(number);

        boolValues.GetArrayElementAtIndex(value).FindPropertyRelative("b_Values").DeleteArrayElementAtIndex(number);
    }
Esempio n. 2
0
    public void removeInput(int value, int number, MM_MenuInputs myScript)
    {
        Undo.RegisterFullObjectHierarchyUndo(myScript.gameObject, "removeInput");

        if (remapButtons.GetArrayElementAtIndex(value).FindPropertyRelative("buttonsList").GetArrayElementAtIndex(number).objectReferenceValue != null)
        {
            remapButtons.GetArrayElementAtIndex(value).FindPropertyRelative("buttonsList").DeleteArrayElementAtIndex(number);
        }

        remapButtons.GetArrayElementAtIndex(value).FindPropertyRelative("buttonsList").DeleteArrayElementAtIndex(number);

        remapButtons.GetArrayElementAtIndex(value).FindPropertyRelative("inputNameList").DeleteArrayElementAtIndex(number);
        remapButtons.GetArrayElementAtIndex(value).FindPropertyRelative("stateList").DeleteArrayElementAtIndex(number);
        remapButtons.GetArrayElementAtIndex(value).FindPropertyRelative("b_Axis").DeleteArrayElementAtIndex(number);
        remapButtons.GetArrayElementAtIndex(value).FindPropertyRelative("defaultNamePC").DeleteArrayElementAtIndex(number);
        remapButtons.GetArrayElementAtIndex(value).FindPropertyRelative("defaultNameMac").DeleteArrayElementAtIndex(number);
    }
Esempio n. 3
0
    // Use this for initialization
    void Start()
    {
        canvasVarious = new canvasVariousFunctions();
        GameObject tmp = GameObject.Find(s_canvasMainMenu);

        if (tmp)
        {
            menu_Manager = tmp.GetComponent <Menu_Manager> ();
        }

        tmp = GameObject.Find(s_eventSystem);
        if (tmp)
        {
            eventSys = tmp.GetComponent <EventSystem> ();
        }

        tmp = GameObject.Find(s_mainMenuManager);
        if (tmp)
        {
            mainMenuManager = tmp.GetComponent <MainMenu> ();
        }

        tmp = GameObject.Find(s_InputManager);
        if (tmp)
        {
            inputsManager = tmp.GetComponent <MM_MenuInputs> ();
        }

        tmp = GameObject.Find(s_loadMenuManager);
        if (tmp)
        {
            loadMenuManager = tmp.GetComponent <LoadAndCreateMenu> ();
        }

        tmp = GameObject.Find(s_newGameMenuManager);
        if (tmp)
        {
            newGameMenuManager = tmp.GetComponent <LoadAndCreateMenu> ();
        }
    }
Esempio n. 4
0
    public void addNewFloat(int value, MM_MenuInputs myScript)
    {
        //MM_MenuInputs myScript = (MM_MenuInputs)target;

        Undo.RegisterFullObjectHierarchyUndo(myScript.gameObject, "AddBool");
        if (floatValues.GetArrayElementAtIndex(value).FindPropertyRelative("buttonsList").arraySize > 0)
        {
            floatValues.GetArrayElementAtIndex(value).FindPropertyRelative("buttonsList").InsertArrayElementAtIndex(floatValues.GetArrayElementAtIndex(value).FindPropertyRelative("buttonsList").arraySize - 1);
            floatValues.GetArrayElementAtIndex(value).FindPropertyRelative("b_Values").InsertArrayElementAtIndex(floatValues.GetArrayElementAtIndex(value).FindPropertyRelative("b_Values").arraySize - 1);
        }
        else
        {
            floatValues.GetArrayElementAtIndex(value).FindPropertyRelative("buttonsList").InsertArrayElementAtIndex(0);
            floatValues.GetArrayElementAtIndex(value).FindPropertyRelative("b_Values").InsertArrayElementAtIndex(0);
        }


        GameObject newButton = null;

        if (value == 0)
        {
            newButton = Instantiate(myScript.J_ref_Slider, myScript.J_ref_Slider.gameObject.transform.parent);
        }
        else
        {
            newButton = Instantiate(myScript.K_ref_Slider, myScript.K_ref_Slider.gameObject.transform.parent);
        }

        newButton.name = "NewSlider";
        Undo.RegisterCreatedObjectUndo(newButton, newButton.name);
        newButton.SetActive(true);

        floatValues.GetArrayElementAtIndex(value).FindPropertyRelative("buttonsList").GetArrayElementAtIndex(floatValues.GetArrayElementAtIndex(value).FindPropertyRelative("buttonsList").arraySize - 1).objectReferenceValue
            = newButton.transform.GetChild(0).gameObject;


        newButton.transform.SetSiblingIndex(0);
    }
Esempio n. 5
0
 public void MM_UpdateInputManager(MM_MenuInputs inputManager)
 {
     inputManager.updateInputPage();
 }
Esempio n. 6
0
    public override void OnInspectorGUI()
    {
        MM_MenuInputs myScript = (MM_MenuInputs)target;

        if (SeeInspector.boolValue)                                                             // If true Default Inspector is drawn on screen
        {
            DrawDefaultInspector();
        }

        serializedObject.Update();

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("See Inspector :", GUILayout.Width(85));
        EditorGUILayout.PropertyField(SeeInspector, new GUIContent(""), GUILayout.Width(30));
        EditorGUILayout.EndHorizontal();

        GUIStyle style_Yellow_01     = new GUIStyle(GUI.skin.box);   style_Yellow_01.normal.background = Tex_01;
        GUIStyle style_Blue          = new GUIStyle(GUI.skin.box);   style_Blue.normal.background = Tex_03;
        GUIStyle style_Purple        = new GUIStyle(GUI.skin.box);   style_Purple.normal.background = Tex_04;
        GUIStyle style_Orange        = new GUIStyle(GUI.skin.box);   style_Orange.normal.background = Tex_05;
        GUIStyle style_Yellow_Strong = new GUIStyle(GUI.skin.box);   style_Yellow_Strong.normal.background = Tex_02;


        GUILayout.Label("");


        //--> Default Input Choice
        EditorGUILayout.BeginVertical(style_Yellow_01);
        if (b_PC.boolValue)
        {
            if (GUILayout.Button("Defaut inputs are setup for PC"))
            {
                b_PC.boolValue = false;
            }
        }
        else
        {
            if (GUILayout.Button("Defaut inputs are setup for Mac"))
            {
                b_PC.boolValue = true;
            }
        }
        EditorGUILayout.EndVertical();

        GUILayout.Label("");

        //--> Joystick Axis
        EditorGUILayout.BeginVertical(style_Orange);
        EditorGUILayout.BeginVertical(style_Orange);
        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("Joystick Axis : ", GUILayout.Width(150));
        GUILayout.Label("Default PC Axis : ", GUILayout.Width(110));
        GUILayout.Label("Default Mac Axis : ", GUILayout.Width(110));
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.EndVertical();
        for (var i = 0; i < remapButtons.GetArrayElementAtIndex(0).FindPropertyRelative("buttonsList").arraySize; i++)
        {
            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(i + " : ", GUILayout.Width(20));
            EditorGUILayout.PropertyField(remapButtons.GetArrayElementAtIndex(0).FindPropertyRelative("buttonsList").GetArrayElementAtIndex(i), new GUIContent(""), GUILayout.Width(150));
            EditorGUILayout.PropertyField(remapButtons.GetArrayElementAtIndex(0).FindPropertyRelative("defaultNamePC").GetArrayElementAtIndex(i), new GUIContent(""), GUILayout.Width(110));
            EditorGUILayout.PropertyField(remapButtons.GetArrayElementAtIndex(0).FindPropertyRelative("defaultNameMac").GetArrayElementAtIndex(i), new GUIContent(""), GUILayout.Width(110));
            if (GUILayout.Button("-", GUILayout.Width(20)))
            {
                removeInput(0, i, myScript);
                break;
            }
            EditorGUILayout.EndHorizontal();
        }
        if (GUILayout.Button("Add New Input : Axis", GUILayout.Width(380)))
        {
            addNewInputAxis(0, myScript);
        }

        EditorGUILayout.EndVertical();


        //--> Joystick Buttons
        EditorGUILayout.BeginVertical(style_Orange);
        EditorGUILayout.BeginVertical(style_Orange);
        EditorGUILayout.BeginHorizontal();

        GUILayout.Label("Joystick Buttons : ", GUILayout.Width(150));
        GUILayout.Label("Default PC Buttons : ", GUILayout.Width(110));
        GUILayout.Label("Default Mac Buttons : ", GUILayout.Width(110));
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.EndVertical();
        for (var i = 0; i < remapButtons.GetArrayElementAtIndex(1).FindPropertyRelative("buttonsList").arraySize; i++)
        {
            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(i + " : ", GUILayout.Width(20));
            EditorGUILayout.PropertyField(remapButtons.GetArrayElementAtIndex(1).FindPropertyRelative("buttonsList").GetArrayElementAtIndex(i), new GUIContent(""), GUILayout.Width(150));
            EditorGUILayout.PropertyField(remapButtons.GetArrayElementAtIndex(1).FindPropertyRelative("defaultNamePC").GetArrayElementAtIndex(i), new GUIContent(""), GUILayout.Width(110));
            EditorGUILayout.PropertyField(remapButtons.GetArrayElementAtIndex(1).FindPropertyRelative("defaultNameMac").GetArrayElementAtIndex(i), new GUIContent(""), GUILayout.Width(110));
            if (GUILayout.Button("-", GUILayout.Width(20)))
            {
                removeInput(1, i, myScript);
                break;
            }
            EditorGUILayout.EndHorizontal();
        }
        if (GUILayout.Button("Add New Input : Button", GUILayout.Width(380)))
        {
            addNewInputButton(1, myScript);
        }
        EditorGUILayout.EndVertical();

        GUILayout.Label("");

        //--> Keyboard Axis
        EditorGUILayout.BeginVertical(style_Yellow_01);
        EditorGUILayout.BeginVertical(style_Yellow_01);
        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("Keyboard Axis : ", GUILayout.Width(150));
        GUILayout.Label("Default PC Axis : ", GUILayout.Width(110));
        GUILayout.Label("Default Mac Axis : ", GUILayout.Width(110));
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.EndVertical();
        for (var i = 0; i < remapButtons.GetArrayElementAtIndex(2).FindPropertyRelative("buttonsList").arraySize; i++)
        {
            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(i + " : ", GUILayout.Width(20));
            EditorGUILayout.PropertyField(remapButtons.GetArrayElementAtIndex(2).FindPropertyRelative("buttonsList").GetArrayElementAtIndex(i), new GUIContent(""), GUILayout.Width(150));
            EditorGUILayout.PropertyField(remapButtons.GetArrayElementAtIndex(2).FindPropertyRelative("defaultNamePC").GetArrayElementAtIndex(i), new GUIContent(""), GUILayout.Width(110));
            EditorGUILayout.PropertyField(remapButtons.GetArrayElementAtIndex(2).FindPropertyRelative("defaultNameMac").GetArrayElementAtIndex(i), new GUIContent(""), GUILayout.Width(110));
            if (GUILayout.Button("-", GUILayout.Width(20)))
            {
                removeInput(2, i, myScript);
                break;
            }
            EditorGUILayout.EndHorizontal();
        }
        if (GUILayout.Button("Add New Input : Axis", GUILayout.Width(380)))
        {
            addNewInputAxis(2, myScript);
        }
        EditorGUILayout.EndVertical();


        //--> Keyboard Buttons
        EditorGUILayout.BeginVertical(style_Yellow_01);
        EditorGUILayout.BeginVertical(style_Yellow_01);
        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("Keyboard Buttons : ", GUILayout.Width(150));
        GUILayout.Label("Default PC Buttons : ", GUILayout.Width(110));
        GUILayout.Label("Default Mac Buttons : ", GUILayout.Width(110));
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.EndVertical();
        for (var i = 0; i < remapButtons.GetArrayElementAtIndex(3).FindPropertyRelative("buttonsList").arraySize; i++)
        {
            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(i + " : ", GUILayout.Width(20));
            EditorGUILayout.PropertyField(remapButtons.GetArrayElementAtIndex(3).FindPropertyRelative("buttonsList").GetArrayElementAtIndex(i), new GUIContent(""), GUILayout.Width(150));
            EditorGUILayout.PropertyField(remapButtons.GetArrayElementAtIndex(3).FindPropertyRelative("defaultNamePC").GetArrayElementAtIndex(i), new GUIContent(""), GUILayout.Width(110));
            EditorGUILayout.PropertyField(remapButtons.GetArrayElementAtIndex(3).FindPropertyRelative("defaultNameMac").GetArrayElementAtIndex(i), new GUIContent(""), GUILayout.Width(110));
            if (GUILayout.Button("-", GUILayout.Width(20)))
            {
                removeInput(3, i, myScript);
                break;
            }
            EditorGUILayout.EndHorizontal();
        }
        if (GUILayout.Button("Add New Input : Button", GUILayout.Width(380)))
        {
            addNewInputButton(3, myScript);
        }
        EditorGUILayout.EndVertical();

        GUILayout.Label("");

        //--> bool values Joystick
        EditorGUILayout.BeginVertical(style_Orange);
        EditorGUILayout.BeginVertical(style_Orange);
        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("Toggles value Joystick : ", GUILayout.Width(150));
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.EndVertical();
        for (var i = 0; i < boolValues.GetArrayElementAtIndex(0).FindPropertyRelative("buttonsList").arraySize; i++)
        {
            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(i + " : ", GUILayout.Width(20));
            EditorGUILayout.PropertyField(boolValues.GetArrayElementAtIndex(0).FindPropertyRelative("buttonsList").GetArrayElementAtIndex(i), new GUIContent(""), GUILayout.Width(150));
            EditorGUILayout.PropertyField(boolValues.GetArrayElementAtIndex(0).FindPropertyRelative("b_Values").GetArrayElementAtIndex(i), new GUIContent(""), GUILayout.Width(20));
            if (GUILayout.Button("-", GUILayout.Width(20)))
            {
                removeBoolean(0, i, myScript);
                break;
            }
            EditorGUILayout.EndHorizontal();
        }
        if (GUILayout.Button("Add New Boolean", GUILayout.Width(380)))
        {
            addNewBoolean(0, myScript);
        }
        EditorGUILayout.EndVertical();


        //--> float values Keyboard
        EditorGUILayout.BeginVertical(style_Orange);
        EditorGUILayout.BeginVertical(style_Orange);
        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("Toggles value Keyboard : ", GUILayout.Width(150));
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.EndVertical();
        for (var i = 0; i < boolValues.GetArrayElementAtIndex(1).FindPropertyRelative("buttonsList").arraySize; i++)
        {
            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(i + " : ", GUILayout.Width(20));
            EditorGUILayout.PropertyField(boolValues.GetArrayElementAtIndex(1).FindPropertyRelative("buttonsList").GetArrayElementAtIndex(i), new GUIContent(""), GUILayout.Width(150));
            EditorGUILayout.PropertyField(boolValues.GetArrayElementAtIndex(1).FindPropertyRelative("b_Values").GetArrayElementAtIndex(i), new GUIContent(""), GUILayout.Width(20));
            if (GUILayout.Button("-", GUILayout.Width(20)))
            {
                removeBoolean(1, i, myScript);
                break;
            }
            EditorGUILayout.EndHorizontal();
        }
        if (GUILayout.Button("Add New Boolean", GUILayout.Width(380)))
        {
            addNewBoolean(1, myScript);
        }
        EditorGUILayout.EndVertical();

        GUILayout.Label("");

        //--> float values Joystick
        EditorGUILayout.BeginVertical(style_Yellow_01);
        EditorGUILayout.BeginVertical(style_Yellow_01);
        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("Sliders value Joystick : ", GUILayout.Width(150));
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.EndVertical();
        for (var i = 0; i < floatValues.GetArrayElementAtIndex(0).FindPropertyRelative("buttonsList").arraySize; i++)
        {
            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(i + " : ", GUILayout.Width(20));
            EditorGUILayout.PropertyField(floatValues.GetArrayElementAtIndex(0).FindPropertyRelative("buttonsList").GetArrayElementAtIndex(i), new GUIContent(""), GUILayout.Width(150));
            EditorGUILayout.PropertyField(floatValues.GetArrayElementAtIndex(0).FindPropertyRelative("b_Values").GetArrayElementAtIndex(i), new GUIContent(""), GUILayout.Width(40));
            if (GUILayout.Button("-", GUILayout.Width(20)))
            {
                removeFloat(0, i, myScript);
                break;
            }
            EditorGUILayout.EndHorizontal();
        }
        if (GUILayout.Button("Add New Float", GUILayout.Width(380)))
        {
            addNewFloat(0, myScript);
        }
        EditorGUILayout.EndVertical();

        //--> bool values Keyboard
        EditorGUILayout.BeginVertical(style_Yellow_01);
        EditorGUILayout.BeginVertical(style_Yellow_01);
        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("Slider value Keyboard : ", GUILayout.Width(150));
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.EndVertical();
        for (var i = 0; i < floatValues.GetArrayElementAtIndex(1).FindPropertyRelative("buttonsList").arraySize; i++)
        {
            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(i + " : ", GUILayout.Width(20));
            EditorGUILayout.PropertyField(floatValues.GetArrayElementAtIndex(1).FindPropertyRelative("buttonsList").GetArrayElementAtIndex(i), new GUIContent(""), GUILayout.Width(150));
            EditorGUILayout.PropertyField(floatValues.GetArrayElementAtIndex(1).FindPropertyRelative("b_Values").GetArrayElementAtIndex(i), new GUIContent(""), GUILayout.Width(40));
            if (GUILayout.Button("-", GUILayout.Width(20)))
            {
                removeFloat(1, i, myScript);
                break;
            }
            EditorGUILayout.EndHorizontal();
        }
        if (GUILayout.Button("Add New Float", GUILayout.Width(380)))
        {
            addNewFloat(1, myScript);
        }
        EditorGUILayout.EndVertical();

        serializedObject.ApplyModifiedProperties();
    }