Ejemplo n.º 1
0
        // Show Parameters
        private void ShowParameters()
        {
            GUILayout.BeginVertical("Box", GUILayout.ExpandWidth(true));
            GUILayout.Space(5f);

            // Surface index & Minimum decrement to show pain screen
            int surfacesLength = surfaces.Length;

            if (surfacesLength != SurfaceDetector.GetCount)
            {
                surfaces = SurfaceDetector.GetNames;
            }

            surfacesSFo = System.Convert.ToBoolean(GUILayout.Toolbar(System.Convert.ToInt32(surfacesSFo), stateNames, GUILayout.Height(20f)));

            GUILayout.Space(5f);

            if (surfacesSFo)
            {
                int surfacesSize = surfacesArray.arraySize;

                EditorGUILayout.BeginVertical("box");
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.BeginVertical(GUILayout.Width(30f));
                GUILayout.Space(4f);
                GUI.enabled = ASKSettingsWindow.NotBegin(selection);
                bool moveUp = GUILayout.Button("▲", GUILayout.Height(16f));
                GUI.enabled = true;
                GUI.enabled = ASKSettingsWindow.NotEnd(selection, surfacesSize);
                bool moveDown = GUILayout.Button("▼", GUILayout.Height(16f));
                GUI.enabled = true;
                EditorGUILayout.EndVertical();
                //
                GUI.enabled = surfacesSize < surfacesLength;
                bool add = GUILayout.Button("Add Surface", GUILayout.Height(35f));
                GUI.enabled = (surfacesSize > 0);
                bool delete = GUILayout.Button("Remove it", GUILayout.Height(35f));
                GUI.enabled = true;
                EditorGUILayout.EndHorizontal();

                if (surfacesSize > 0)
                {
                    GUILayout.Space(5f);
                    selection = GUILayout.SelectionGrid(selection, ASKSettingsWindow.GetNames(surfacesArray, surfacesSize), 1);
                }
                GUILayout.Space(5f);
                EditorGUILayout.EndVertical();

                if (surfacesSize > 0)
                {
                    surfacesElement = surfacesArray.GetArrayElementAtIndex(selection);
                    //
                    indexProp           = surfacesElement.FindPropertyRelative("index");
                    jumpingSFXProp      = surfacesElement.FindPropertyRelative("jumpingSFX");
                    landingSFXProp      = surfacesElement.FindPropertyRelative("landingSFX");
                    footstepSoundsArray = surfacesElement.FindPropertyRelative("footstepSounds");

                    if (surfacesSize != footstepSoundsList.Length)
                    {
                        footstepSoundsList = new ReorderableList[surfacesSize];
                    }

                    if (footstepSoundsList[selection] == null)
                    {
                        footstepSoundsList[selection] = new ReorderableList(serializedObject, footstepSoundsArray, true, true, true, true);
                    }

                    GUILayout.Space(5f);
                    int surfaceIndex = indexProp.intValue;
                    surfaceIndex = (surfaceIndex < surfacesLength) ? surfaceIndex : surfacesLength - 1;
                    surfaceIndex = EditorGUILayout.Popup("Surface Type", surfaceIndex, surfaces);
                    surfacesElement.FindPropertyRelative("name").stringValue = surfaces[surfaceIndex];
                    indexProp.intValue = surfaceIndex;
                    GUILayout.Space(10f);

                    EditorHelper.ShowSFXPropertyAndPlayButton(serializedObject, jumpingSFXProp);
                    EditorHelper.ShowSFXPropertyAndPlayButton(serializedObject, landingSFXProp);
                    EditorHelper.ShowSFXListAndPlayButton(serializedObject, footstepSoundsList[selection], "Footstep Sounds");
                }

                // Actions
                if (add)
                {
                    surfacesArray.InsertArrayElementAtIndex(surfacesSize);
                    surfacesElement = surfacesArray.GetArrayElementAtIndex(surfacesSize);

                    surfacesSize = surfacesArray.arraySize;
                    selection    = (surfacesSize > 1) ? surfacesSize - 1 : 0;

                    surfacesElement.FindPropertyRelative("index").intValue = surfacesSize - 1;
                    surfacesElement.FindPropertyRelative("jumpingSFX").objectReferenceValue = null;
                    surfacesElement.FindPropertyRelative("landingSFX").objectReferenceValue = null;
                    surfacesElement.FindPropertyRelative("footstepSounds").ClearArray();
                }

                if (moveUp)
                {
                    surfacesArray.MoveArrayElement(selection - 1, selection--);
                    return;
                }
                if (moveDown)
                {
                    surfacesArray.MoveArrayElement(selection + 1, selection++);
                    return;
                }
                if (delete)
                {
                    surfacesArray.DeleteArrayElementAtIndex(selection);
                    surfacesSize = surfacesArray.arraySize;
                    selection    = ASKSettingsWindow.NotEnd(selection, surfacesSize) ? selection : surfacesSize - 1;
                    return;
                }
            }
            else
            {
                surfacesElement     = serializedObject.FindProperty("generic");
                jumpingSFXProp      = surfacesElement.FindPropertyRelative("jumpingSFX");
                landingSFXProp      = surfacesElement.FindPropertyRelative("landingSFX");
                footstepSoundsArray = surfacesElement.FindPropertyRelative("footstepSounds");
                //
                EditorHelper.ShowSFXPropertyAndPlayButton(serializedObject, jumpingSFXProp);
                EditorHelper.ShowSFXPropertyAndPlayButton(serializedObject, landingSFXProp);
                EditorHelper.ShowSFXListAndPlayButton(serializedObject, fsGenericList, "Footstep Sounds");
            }

            GUILayout.Space(5f);
            GUILayout.EndVertical();
        }
Ejemplo n.º 2
0
        // Show LeftSide
        private static void ShowLeftSide()
        {
            int surfacesSize = surfacesArray.arraySize;

            leftScroll = EditorGUILayout.BeginScrollView(leftScroll, "Box", GUILayout.Width(200f), GUILayout.ExpandHeight(true));

            GUILayout.Space(5f);
            EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
            GUILayout.Space(25f);
            bool add = GUILayout.Button("Add Surface", GUILayout.Height(35f));

            GUI.enabled = true;
            GUILayout.Space(25f);
            EditorGUILayout.EndHorizontal();
            GUILayout.Space(5f);

            EditorGUILayout.BeginVertical("Box", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
            if (surfacesSize > 0)
            {
                selection = GUILayout.SelectionGrid(selection, ASKSettingsWindow.GetNames(surfacesArray, surfacesSize), 1);
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.EndScrollView();

            EditorGUILayout.BeginVertical(GUILayout.Width(25f));
            GUILayout.Space(5f);
            GUI.enabled = (surfacesSize > 0);
            bool delete = GUILayout.Button("X");

            GUI.enabled = true;
            GUI.enabled = ASKSettingsWindow.NotBegin(selection);
            GUILayout.Space(15f);
            bool moveUp = GUILayout.Button("▲", GUILayout.Height(30f));

            GUI.enabled = true;
            GUI.enabled = ASKSettingsWindow.NotEnd(selection, surfacesSize);
            bool moveDown = GUILayout.Button("▼", GUILayout.Height(30f));

            GUI.enabled = true;
            EditorGUILayout.EndVertical();


            if (add)
            {
                surfacesArray.InsertArrayElementAtIndex(surfacesSize);
                surfacesElement = surfacesArray.GetArrayElementAtIndex(surfacesSize);

                surfacesSize = surfacesArray.arraySize;
                selection    = (surfacesSize > 1) ? surfacesSize - 1 : 0;

                surfacesElement.FindPropertyRelative("name").stringValue = "New Surface " + surfacesSize;
                surfacesElement.FindPropertyRelative("materials").ClearArray();
                surfacesElement.FindPropertyRelative("textures").ClearArray();
            }

            if (moveUp)
            {
                surfacesArray.MoveArrayElement(selection - 1, selection--);
                return;
            }
            if (moveDown)
            {
                surfacesArray.MoveArrayElement(selection + 1, selection++);
                return;
            }
            if (delete)
            {
                surfacesArray.DeleteArrayElementAtIndex(selection);
                surfacesSize = surfacesArray.arraySize;
                selection    = ASKSettingsWindow.NotEnd(selection, surfacesSize) ? selection : surfacesSize - 1;
                return;
            }
        }
Ejemplo n.º 3
0
        // Show Surfaces
        private void ShowSurfaces()
        {
            // Surface index & Minimum decrement to show pain screen
            int surfacesLength = surfaces.Length;

            if (surfacesLength != SurfaceDetector.GetCount)
            {
                surfaces = SurfaceDetector.GetNames;
            }

            surfacesSFo = System.Convert.ToBoolean(GUILayout.Toolbar(System.Convert.ToInt32(surfacesSFo), stateNames, GUILayout.Height(20f)));

            GUILayout.Space(5f);

            if (surfacesSFo)
            {
                int surfacesSize = surfacesArray.arraySize;

                EditorGUILayout.BeginVertical("box");
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.BeginVertical(GUILayout.Width(30f));
                GUILayout.Space(4f);
                GUI.enabled = ASKSettingsWindow.NotBegin(selection);
                bool moveUp = GUILayout.Button("▲", GUILayout.Height(16f));
                GUI.enabled = true;
                GUI.enabled = ASKSettingsWindow.NotEnd(selection, surfacesSize);
                bool moveDown = GUILayout.Button("▼", GUILayout.Height(16f));
                GUI.enabled = true;
                EditorGUILayout.EndVertical();
                //
                GUI.enabled = surfacesSize < surfacesLength;
                bool add = GUILayout.Button("Add Surface", GUILayout.Height(35f));
                GUI.enabled = (surfacesSize > 0);
                bool delete = GUILayout.Button("Remove it", GUILayout.Height(35f));
                GUI.enabled = true;
                EditorGUILayout.EndHorizontal();

                if (surfacesSize > 0)
                {
                    GUILayout.Space(5f);
                    selection = GUILayout.SelectionGrid(selection, ASKSettingsWindow.GetNames(surfacesArray, surfacesSize), 1);
                }
                GUILayout.Space(5f);
                EditorGUILayout.EndVertical();


                if (surfacesSize > 0)
                {
                    surfacesElement = surfacesArray.GetArrayElementAtIndex(selection);
                    //
                    indexProp       = surfacesElement.FindPropertyRelative("index");
                    hitTextureProp  = surfacesElement.FindPropertyRelative("hitTexture");
                    hitSoundProp    = surfacesElement.FindPropertyRelative("hitSound");
                    hitParticleProp = surfacesElement.FindPropertyRelative("hitParticle");

                    GUILayout.Space(5f);

                    int surfaceIndex = indexProp.intValue;
                    surfaceIndex = (surfaceIndex < surfacesLength) ? surfaceIndex : surfacesLength - 1;
                    surfaceIndex = EditorGUILayout.Popup("Surface Type", surfaceIndex, surfaces);
                    surfacesElement.FindPropertyRelative("name").stringValue = surfaces[surfaceIndex];
                    indexProp.intValue = surfaceIndex;
                    GUILayout.Space(10f);
                    EditorGUILayout.PropertyField(hitTextureProp, EditorHelper.PropertyLabel("Hit Texture"));
                    EditorHelper.ShowSFXPropertyAndPlayButton(serializedObject, hitSoundProp, "Hit SFX");
                    EditorGUILayout.PropertyField(hitParticleProp, EditorHelper.PropertyLabel("Hit Particle"));
                }

                // Actions
                if (add)
                {
                    surfacesArray.InsertArrayElementAtIndex(surfacesSize);
                    surfacesElement = surfacesArray.GetArrayElementAtIndex(surfacesSize);

                    surfacesSize = surfacesArray.arraySize;
                    selection    = (surfacesSize > 1) ? surfacesSize - 1 : 0;

                    surfacesElement.FindPropertyRelative("index").intValue = surfacesSize - 1;
                    surfacesElement.FindPropertyRelative("hitTexture").objectReferenceValue  = null;
                    surfacesElement.FindPropertyRelative("hitSound").objectReferenceValue    = null;
                    surfacesElement.FindPropertyRelative("hitParticle").objectReferenceValue = null;
                }

                if (moveUp)
                {
                    surfacesArray.MoveArrayElement(selection - 1, selection--);
                    return;
                }
                if (moveDown)
                {
                    surfacesArray.MoveArrayElement(selection + 1, selection++);
                    return;
                }
                if (delete)
                {
                    surfacesArray.DeleteArrayElementAtIndex(selection);
                    surfacesSize = surfacesArray.arraySize;
                    selection    = ASKSettingsWindow.NotEnd(selection, surfacesSize) ? selection : surfacesSize - 1;
                    return;
                }
            }
            else
            {
                surfacesElement = serializedObject.FindProperty("generic");
                hitTextureProp  = surfacesElement.FindPropertyRelative("hitTexture");
                hitSoundProp    = surfacesElement.FindPropertyRelative("hitSound");
                hitParticleProp = surfacesElement.FindPropertyRelative("hitParticle");
                //
                EditorGUILayout.PropertyField(hitTextureProp, EditorHelper.PropertyLabel("Hit Texture"));
                EditorHelper.ShowSFXPropertyAndPlayButton(serializedObject, hitSoundProp, "Hit SFX");
                EditorGUILayout.PropertyField(hitParticleProp, EditorHelper.PropertyLabel("Hit Particle"));
            }
        }
Ejemplo n.º 4
0
        // Show LeftAxesSide
        private static void ShowLeftAxesSide()
        {
            int axesDatabaseSize = axesDatabaseArray.arraySize;

            leftScroll = EditorGUILayout.BeginScrollView(leftScroll, "Box", GUILayout.Width(200f), GUILayout.ExpandHeight(true));

            GUILayout.Space(5f);
            EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
            GUILayout.Space(25f);
            bool add = GUILayout.Button("Add Axis", GUILayout.Height(35f));

            GUI.enabled = true;
            GUILayout.Space(25f);
            EditorGUILayout.EndHorizontal();
            GUILayout.Space(5f);

            EditorGUILayout.BeginVertical("Box", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
            if (axesDatabaseSize > 0)
            {
                axesSel = GUILayout.SelectionGrid(axesSel, ASKSettingsWindow.GetNames(axesDatabaseArray, axesDatabaseSize), 1);
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.EndScrollView();

            EditorGUILayout.BeginVertical(GUILayout.Width(25f));
            GUILayout.Space(5f);
            GUI.enabled = (axesDatabaseSize > 0);
            bool delete = GUILayout.Button("X");

            GUI.enabled = true;
            GUI.enabled = ASKSettingsWindow.NotBegin(axesSel);
            GUILayout.Space(15f);
            bool moveUp = GUILayout.Button("▲", GUILayout.Height(30f));

            GUI.enabled = true;
            GUI.enabled = ASKSettingsWindow.NotEnd(axesSel, axesDatabaseSize);
            bool moveDown = GUILayout.Button("▼", GUILayout.Height(30f));

            GUI.enabled = true;
            EditorGUILayout.EndVertical();


            if (add)
            {
                axesDatabaseArray.InsertArrayElementAtIndex(axesDatabaseSize);
                SerializedProperty axesDatabaseElement = axesDatabaseArray.GetArrayElementAtIndex(axesDatabaseSize);

                axesDatabaseSize = axesDatabaseArray.arraySize;
                axesSel          = (axesDatabaseSize > 1) ? axesSel : 0;

                axesDatabaseElement.FindPropertyRelative("name").stringValue    = "New Axis " + axesDatabaseSize;
                axesDatabaseElement.FindPropertyRelative("type").enumValueIndex = 0;
                axesDatabaseElement.FindPropertyRelative("unityAxes").ClearArray();
                axesDatabaseElement.FindPropertyRelative("customKeys").ClearArray();
                axesDatabaseElement.FindPropertyRelative("normalize").boolValue = false;
            }

            if (moveUp)
            {
                axesDatabaseArray.MoveArrayElement(axesSel - 1, axesSel--);
                return;
            }
            if (moveDown)
            {
                axesDatabaseArray.MoveArrayElement(axesSel + 1, axesSel++);
                return;
            }
            if (delete)
            {
                axesDatabaseArray.DeleteArrayElementAtIndex(axesSel);
                axesDatabaseSize = axesDatabaseArray.arraySize;
                axesSel          = ASKSettingsWindow.NotEnd(axesSel, axesDatabaseSize) ? axesSel : axesDatabaseSize - 1;
                return;
            }
        }