Exemplo n.º 1
0
        GUIFoldout CreateHelpFoldout()
        {
            GUIFoldout    foldout      = new GUIFoldout(Localize.GUI("Help"));
            GUIHorizontal indentLayout = foldout.Add(new GUIHorizontal()) as GUIHorizontal;

            indentLayout.Add(new GUISpace());
            GUIVertical layout = indentLayout.Add(new GUIVertical()) as GUIVertical;

            layout.Add(new GUILabel(Localize.GUI("Alt/Alt+Shift: cycle editor modes")));
            layout.Add(new GUILabel(Localize.GUI("Camera Mode:\nA/S/W/D to move\nLMB to look")));
            layout.Add(new GUILabel(Localize.GUI("Coverage Paint Mode:\nLMB to increase coverage\nLMB+Shift to decrease coverage")));
            layout.Add(new GUILabel(Localize.GUI("Cloud Type Paint Mode:\nLMB to increase cloud type\nLMB+Shift to decrease cloud type")));
            layout.Add(new GUILabel(Localize.GUI("Brush Properties:\nBrush size, opacity & texture can be altered\nfrom the Brush Properties foldout.\nHolding Control while moving the mouse\nin either paint mode adjusts brush size.")));
            layout.Add(new GUIButton(Localize.GUI("Display full documentation")));
            return(foldout);
        }
Exemplo n.º 2
0
        void CreateGUI()
        {
            int      padding = 4;
            GUIStyle style   = new GUIStyle();

            style.padding = new RectOffset(padding, padding, padding, padding);

            _gui = new GUIVertical();

            GUIHorizontal toolLayout = new GUIHorizontal(style);

            toolLayout.Add(new GUIButton(Localize.GUI(null, "Toggle properties panel",
                                                      "Assets/kode80/Clouds/Editor/gui/button_properties.png"),
                                         TogglePropertiesPanel));
            toolLayout.Add(new GUISpace());
            toolLayout.Add(new GUIButton(Localize.GUI(null, "Create a new coverage map",
                                                      "Assets/kode80/Clouds/Editor/gui/button_new.png"),
                                         NewCoverageMapAction));
            toolLayout.Add(new GUIButton(Localize.GUI(null, "Save the current coverage map",
                                                      "Assets/kode80/Clouds/Editor/gui/button_save.png"),
                                         SaveCoverageMapAction));
            toolLayout.Add(new GUIButton(Localize.GUI(null, "Save the current coverage map as a new file",
                                                      "Assets/kode80/Clouds/Editor/gui/button_saveas.png"),
                                         SaveCoverageMapAsAction));
            toolLayout.Add(new GUISpace());
            toolLayout.Add(new GUIButton(Localize.GUI(null, "Export cubemap from current camera",
                                                      "Assets/kode80/Clouds/Editor/gui/button_cubemap.png"),
                                         ExportCubemapAction));

            toolLayout.Add(new GUISpace(true));
            GUIContent[] toolbarContent = new GUIContent[] {
                Localize.GUI(null, null, "Assets/kode80/Clouds/Editor/gui/button_camera.png"),
                Localize.GUI(null, null, "Assets/kode80/Clouds/Editor/gui/button_coverage.png"),
                Localize.GUI(null, null, "Assets/kode80/Clouds/Editor/gui/button_type.png")
            };
            _guiToolbar = toolLayout.Add(new GUIToolbar(toolbarContent, ChangeModeAction)) as GUIToolbar;
            toolLayout.Add(new GUISpace(true));
            toolLayout.Add(new GUIButton(Localize.GUI(null, "Clear the current coverage map",
                                                      "Assets/kode80/Clouds/Editor/gui/button_clearmap.png"),
                                         ClearCoverageMapAction));

            GUIFoldout helpFoldout = CreateHelpFoldout();

            GUIFoldout editorFoldout = new GUIFoldout(Localize.GUI("Editor Properties"));

            editorFoldout.Add(new GUIToggle(Localize.GUI("Continuous Update",
                                                         "If disabled, the editor will only render on changes"),
                                            ContinuousUpdateToggleAction));

            if (_cameraComponents.Length > 0)
            {
                _guiCameraFoldout = new GUIFoldout(Localize.GUI("Editor Camera"));
                foreach (MonoBehaviour component in _cameraComponents)
                {
                    GUIToggle toggle = new GUIToggle(new GUIContent(component.GetType().Name), CameraComponentToggled);
                    toggle.isToggled = component.enabled;
                    _guiCameraFoldout.Add(toggle);
                }
            }

            GUIFoldout brushFoldout = new GUIFoldout(Localize.GUI("Brush Properties"));

            _guiBrushBlendValues = brushFoldout.Add(new GUIToggle(Localize.GUI("Blend Values", "Blend values when painting or set to a specific value"),
                                                                  UpdateBrushPropertiesAction)) as GUIToggle;
            _guiBrushOpacity = brushFoldout.Add(new GUISlider(Localize.GUI("Opacity", "Brush opacity"),
                                                              0.2f, 0.0f, 1.0f,
                                                              UpdateBrushPropertiesAction)) as GUISlider;
            _guiBrushSize = brushFoldout.Add(new GUIIntSlider(Localize.GUI("Size", "Brush size"), 2, 2,
                                                              (int)EditorState.MaxCursorRadius,
                                                              UpdateBrushPropertiesAction)) as GUIIntSlider;
            _guiBrushTexture = brushFoldout.Add(new GUITextureField(Localize.GUI("Brush", "Brush texture"),
                                                                    UpdateBrushPropertiesAction)) as GUITextureField;

            GUIFoldout sunFoldout = new GUIFoldout(Localize.GUI("Sun Properties"));

            _guiSunRotation = sunFoldout.Add(new GUIVector3Field(Localize.GUI("Rotation", "Sun's rotation"),
                                                                 UpdateSunPropertiesAction)) as GUIVector3Field;
            _guiSunColor = sunFoldout.Add(new GUIColorField(Localize.GUI("Color", "Sun's color"),
                                                            UpdateSunPropertiesAction)) as GUIColorField;

            GUIFoldout cloudsFoldout = new GUIFoldout(Localize.GUI("Clouds Properties"));

            GUIHorizontal subLayout = new GUIHorizontal();

            subLayout.Add(new GUISpace());
            subLayout.Add(new GUIButton(Localize.GUI("Load Settings",
                                                     "Load key render settings from asset"),
                                        LoadRenderSettingsAction));
            subLayout.Add(new GUIButton(Localize.GUI("Save Settings",
                                                     "Save key render settings to asset"),
                                        SaveRenderSettingsAction));

            cloudsFoldout.Add(subLayout);
            cloudsFoldout.Add(new GUISpace());
            cloudsFoldout.Add(new GUIDefaultInspector(_clouds));

            GUIScrollView scrollView = new GUIScrollView();

            scrollView.Add(helpFoldout);
            scrollView.Add(editorFoldout);
            if (_cameraComponents.Length > 0)
            {
                scrollView.Add(_guiCameraFoldout);
            }
            scrollView.Add(brushFoldout);
            scrollView.Add(sunFoldout);
            scrollView.Add(cloudsFoldout);

            _guiPropertiesPanel = new GUIVertical(GUILayout.MaxWidth(320.0f));
            _guiPropertiesPanel.Add(scrollView);

            _guiScenePlaceholder = new GUIVertical(GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
            _guiScenePlaceholder.shouldStoreLastRect = true;

            GUIHorizontal lowerLayout = new GUIHorizontal();

            lowerLayout.Add(_guiPropertiesPanel);
            lowerLayout.Add(_guiScenePlaceholder);

            _gui.Add(toolLayout);
            _gui.Add(lowerLayout);

            // Update properties
            _guiBrushBlendValues.isToggled = _editorState.cursorBlendValues;
            _guiBrushOpacity.value         = _editorState.cursorOpacity;
            _guiBrushSize.value            = (int)_editorState.cursorRadius * 2;
            _guiBrushTexture.texture       = _editorState.brushTexture;
            _guiSunColor.color             = _clouds.sunLight.color;
            _guiSunRotation.vector         = _clouds.sunLight.transform.eulerAngles;
        }