Ejemplo n.º 1
0
    void OnGUI()
    {
        if (window == null)
        {
            OpenWindow();
        }

        GUILayout.Label("Quick Setup", EditorStyles.boldLabel);
        waterLevel = EditorGUI.FloatField(new Rect(5, 30, position.width - 10, 16), "Water Level", waterLevel);
        terrain    = (GameObject)EditorGUI.ObjectField(new Rect(5, 50, position.width - 10, 16), "Terrain", terrain, typeof(GameObject), true);
        camera     = (GameObject)EditorGUI.ObjectField(new Rect(5, 70, position.width - 10, 16), "Main Camera", camera, typeof(GameObject), true);


        if (GUI.Button(new Rect(5, 100, position.width - 10, 32), "About"))
        {
            About();
        }

        targetPlatform = (TARGETPLATFORM)EditorGUI.EnumPopup(new Rect(5, 150, position.width - 10, 16), "Select target platform", targetPlatform);

        if (targetPlatform == TARGETPLATFORM.desktopWebAndConsole)
        {
            presets = (PRESETS)EditorGUI.EnumPopup(new Rect(5, 170, position.width - 10, 16), "Select a Preset", presets);
        }

        else
        {
            mobilePresets = (MOBILEPRESETS)EditorGUI.EnumPopup(new Rect(5, 170, position.width - 10, 16), "Select a Preset", mobilePresets);
        }

        if (GUI.Button(new Rect(5, 190, position.width - 10, 32), "Add Water"))
        {
            AddWater();
        }

        if (GUI.Button(new Rect(5, 230, position.width - 10, 32), "Add Underwater Effects"))
        {
            AddUnderwaterEffects();
        }

        if (GUI.Button(new Rect(5, 270, position.width / 2 - 5, 32), "Hook Up Camera"))
        {
            HookupCamera();
        }

        if (GUI.Button(new Rect(position.width / 2 + 5, 270, position.width / 2 - 10, 32), "<== Info"))
        {
            HookupCameraInfo();
        }

        if (GUI.Button(new Rect(5, 310, position.width - 10, 32), "Hints"))
        {
            Hints();
        }
    }
Ejemplo n.º 2
0
        private void OnGUI()
        {
            EditorStyles.textField.wordWrap = true;

            if (window == null)
            {
                OpenWindow();
            }

            EditorGUILayout.BeginVertical();

            scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition, GUILayout.Width(position.width), GUILayout.Height(position.height));


            GUILayout.Label("AQUAS Setup Wizard", EditorStyles.boldLabel);

            tab = GUILayout.Toolbar(tab, new string[] { "Water Setup", "Underwater Setup", "Tools" });

            if (tab == 0)
            {
                GUILayout.Label("Water Setup", EditorStyles.boldLabel);
                //targetPlatform = (TARGETPLATFORM)EditorGUILayout.EnumPopup("Select Target Platform", targetPlatform);

                waterType = (WATERTYPE)EditorGUILayout.EnumPopup("Select a type of Water", waterType);

                if (targetPlatform == TARGETPLATFORM.desktopWebAndConsole)
                {
                    if (waterType == WATERTYPE.deepWater)
                    {
                        presets = (PRESETS)EditorGUILayout.EnumPopup("Select a Preset", presets);
                    }
                    else
                    {
                        shallowPresets = (SHALLOWPRESETS)EditorGUILayout.EnumPopup("Select a Preset", shallowPresets);
                    }
                }

                else
                {
                    if (waterType == WATERTYPE.deepWater)
                    {
                        mobilePresets = (MOBILEPRESETS)EditorGUILayout.EnumPopup("Select a Preset", mobilePresets);
                    }
                    else
                    {
                    }
                }

                waterLevel = EditorGUILayout.FloatField("Water Level", waterLevel);

                terrain = (GameObject)EditorGUILayout.ObjectField("Terrain", terrain, typeof(GameObject), true);

                if (terrain == null)
                {
                    EditorGUILayout.HelpBox("If no terrain is provided, water will be placed at the center of the scene without scaling.", MessageType.Info);
                }

                camera = (GameObject)EditorGUILayout.ObjectField("Camera", camera, typeof(GameObject), true);

                causticsType = (CAUSTICSTYPE)EditorGUILayout.EnumPopup("Select the caustics type", causticsType);

                if (causticsType == CAUSTICSTYPE.doubleCaustics)
                {
                    EditorGUILayout.HelpBox("Note: Double caustics may be expensive on performance!", MessageType.Info);
                }

                if (GUILayout.Button("About"))
                {
                    About();
                }

                if (GUILayout.Button("Add Water"))
                {
                    AddWater();
                }
            }

            if (tab == 1)
            {
                GUILayout.Label("Underwater Setup", EditorStyles.boldLabel);

                underwaterType = (UNDERWATERTYPE)EditorGUILayout.EnumPopup("Select type of underwater effects", underwaterType);

                switch (underwaterType)
                {
                case UNDERWATERTYPE.Simple:
                    EditorGUILayout.HelpBox("Simple underwater effects offer a lot more performance but offer less features (no split rendering, no screenspace fog).", MessageType.Info);
                    break;

                case UNDERWATERTYPE.Advanced:
                    EditorGUILayout.HelpBox("Advanced underwater effects offer split rendering and screen space fog but are much heavier on performance than simple underwater effects.", MessageType.Info);
                    break;
                }

                camera = (GameObject)EditorGUILayout.ObjectField("Camera", camera, typeof(GameObject), true);

                if (GUILayout.Button("About"))
                {
                    AboutAddUnderwaterEffects();
                }

                if (GUILayout.Button("Add Underwater Effects"))
                {
                    AddUnderwaterEffects();
                }
            }

            if (tab == 2)
            {
                GUILayout.Label("Tools", EditorStyles.boldLabel);
                tabTools = GUILayout.Toolbar(tabTools, new string[] { "River Reference Tool", "Terrain Masking Tool" });

                if (tabTools == 0)
                {
                    GUILayout.Label("River Reference Export", EditorStyles.boldLabel);
                    waterplane = (GameObject)EditorGUILayout.ObjectField("Water Plane", waterplane, typeof(GameObject), true);

                    if (GUILayout.Button("About"))
                    {
                        AboutExportRiverReference();
                    }

                    if (GUILayout.Button("Create river reference image"))
                    {
                        CreateRiverReference();
                    }
                }

                if (tabTools == 1)
                {
                    GUILayout.Label("Terrain Mask Export", EditorStyles.boldLabel);
                    waterplane = (GameObject)EditorGUILayout.ObjectField("Water Plane", waterplane, typeof(GameObject), true);
                    terrain    = (GameObject)EditorGUILayout.ObjectField("Terrain", terrain, typeof(GameObject), true);
                    maskDepth  = EditorGUILayout.FloatField("Maximum Mask Depth", maskDepth);

                    if (GUILayout.Button("About"))
                    {
                        AboutExportTerrainMask();
                    }

                    if (GUILayout.Button("Create Terrain Mask"))
                    {
                        CreateTerrainMask();
                    }
                }
            }


            EditorGUILayout.EndScrollView();
            EditorGUILayout.EndVertical();
        }