Example #1
0
    /* public Texture2D eye;
     *
     * public string[] listDatas2 = new string[] { "wTextnVoices", "wFeedback", "wUI", "wItem" };      // use to update w_Diary,w_Inventory...
     * public string[] listSaveType = new string[] { "PlayerPrefs", ".dat" };
     *
     */

    void OnEnable()
    {
        //manipulateTextList = new EditorManipulateTextList();

        _MakeTexture();


        string objectPath = "Assets/MCR Creator/Assets/Datas/GripDatas.asset";

        datasGrip = AssetDatabase.LoadAssetAtPath(objectPath, typeof(UnityEngine.Object)) as grip_Datas;
        if (datasGrip)
        {
            serializedObject2 = new UnityEditor.SerializedObject(datasGrip);
            listOfSurface     = serializedObject2.FindProperty("listOfSurface");

            // helpBoxEditor                   = serializedObject2.FindProperty("helpBoxEditor");

            /* currentDatasProjectFolder       = serializedObject2.FindProperty("currentDatasProjectFolder");
             * int_CurrentDatasProjectFolder   = serializedObject2.FindProperty("int_CurrentDatasProjectFolder");
             * int_CurrentDatasSaveSystem      = serializedObject2.FindProperty("int_CurrentDatasSaveSystem");
             * s_newProjectName                = serializedObject2.FindProperty("s_newProjectName");
             * s_newLanguageName               = serializedObject2.FindProperty("s_newLanguageName");
             * firstSceneBuildInIndex          = serializedObject2.FindProperty("firstSceneBuildInIndex");
             * buildinList                     = serializedObject2.FindProperty("buildinList");
             * newSceneName                    = serializedObject2.FindProperty("newSceneName");
             * specificChar                    = serializedObject2.FindProperty("specificChar");*/
        }
        else
        {
            b_ProjectManagerAssetExist = false;
        }
    }
Example #2
0
    void OnGUI()
    {
        //--> Scrollview
        scrollPosAll = EditorGUILayout.BeginScrollView(scrollPosAll);

        //--> Window description
        //GUI.backgroundColor = _cGreen;
        CheckTex();
        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;

        //
        EditorGUILayout.BeginVertical(style_Purple);
        EditorGUILayout.HelpBox("Window Tab : Project Manager", MessageType.Info);
        EditorGUILayout.EndVertical();


        // --> Display data
        EditorGUILayout.BeginHorizontal();
        datasGrip = EditorGUILayout.ObjectField(datasGrip, typeof(UnityEngine.Object), true) as grip_Datas;
        EditorGUILayout.EndHorizontal();

        if (datasGrip != null)
        {
            GUILayout.Label("");


            serializedObject2.Update();

            for (var i = 0; i < listOfSurface.arraySize; i++)
            {
                //_Tag
                EditorGUILayout.BeginVertical(style_Yellow_01);

                EditorGUILayout.LabelField("Surface " + i + "-> " + listOfSurface.GetArrayElementAtIndex(i).FindPropertyRelative("_Tag").stringValue, EditorStyles.boldLabel);

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Tag:", GUILayout.Width(145));
                EditorGUILayout.PropertyField(listOfSurface.GetArrayElementAtIndex(i).FindPropertyRelative("_Tag"), new GUIContent(""));
                EditorGUILayout.EndHorizontal();

                // 1.5 = the car stop very quickly / 5 = the car stop slowly
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Slow down (1.5 to 5):", GUILayout.Width(145));
                EditorGUILayout.PropertyField(listOfSurface.GetArrayElementAtIndex(i).FindPropertyRelative("CoeffZWhenCarIsSlow"), new GUIContent(""));
                EditorGUILayout.EndHorizontal();

                // Reduce the speed of the car 0 to 1
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Grip Forward (0 to 1):", GUILayout.Width(145));
                EditorGUILayout.PropertyField(listOfSurface.GetArrayElementAtIndex(i).FindPropertyRelative("GripForward"), new GUIContent(""));
                EditorGUILayout.EndHorizontal();

                // Reduce or increase break force
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Brake Force:", GUILayout.Width(145));
                EditorGUILayout.PropertyField(listOfSurface.GetArrayElementAtIndex(i).FindPropertyRelative("BrakeForce"), new GUIContent(""));
                EditorGUILayout.EndHorizontal();

                // Slide coefficient .1f very little slide / .001 very long slide
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Slide Coeff (0.1f to .001f):", GUILayout.Width(145));
                EditorGUILayout.PropertyField(listOfSurface.GetArrayElementAtIndex(i).FindPropertyRelative("SlideCoeff"), new GUIContent(""));
                EditorGUILayout.EndHorizontal();

                // add rotation to the wheel
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Wheel rotation Y:", GUILayout.Width(145));
                EditorGUILayout.PropertyField(listOfSurface.GetArrayElementAtIndex(i).FindPropertyRelative("SlideEulerAngleY"), new GUIContent(""));
                EditorGUILayout.EndHorizontal();

                if (i > 0)
                {
                    if (GUILayout.Button("Delete Surface"))
                    {
                        Undo.RegisterFullObjectHierarchyUndo(datasGrip, datasGrip.name);
                        datasGrip.listOfSurface.RemoveAt(i);
                        break;
                    }
                }


                EditorGUILayout.EndVertical();


                EditorGUILayout.LabelField("");
            }

            GUI.backgroundColor = _cGreen;
            if (GUILayout.Button("Create new Surface", GUILayout.Height(60)))
            {
                Undo.RegisterFullObjectHierarchyUndo(datasGrip, datasGrip.name);
                datasGrip.listOfSurface.Add(new grip_Datas._Surface());
            }

            serializedObject2.ApplyModifiedProperties();

            EditorGUILayout.LabelField("");
            EditorGUILayout.LabelField("");
        }
        EditorGUILayout.EndScrollView();
    }