public override void OnInspectorGUI()
        {
            bool  initialWideMode   = EditorGUIUtility.wideMode;
            float initialLabelWidth = EditorGUIUtility.labelWidth;

            EditorGUIUtility.wideMode = true;
            RotorzEditorGUI.UseExtendedLabelWidthForLocalization();

            this.serializedObject.Update();

            this.propertyExpandTilesetCreatorSection.boolValue = RotorzEditorGUI.FoldoutSection(
                foldout: this.propertyExpandTilesetCreatorSection.boolValue,
                label: TileLang.Text("Brush and Tileset Creator"),
                callback: this.DrawCreatorSection,
                paddedStyle: RotorzEditorStyles.Instance.InspectorSectionPadded
                );

            this.propertyExpandBrushCategoriesSection.boolValue = RotorzEditorGUI.FoldoutSection(
                foldout: this.propertyExpandBrushCategoriesSection.boolValue,
                label: TileLang.Text("Brush Categories"),
                callback: this.DrawCategoriesSections,
                paddedStyle: RotorzEditorStyles.Instance.InspectorSectionPadded
                );

            EditorGUIUtility.wideMode   = initialWideMode;
            EditorGUIUtility.labelWidth = initialLabelWidth;

            this.serializedObject.ApplyModifiedProperties();
        }
        private void DrawSelectedTab()
        {
            RotorzEditorGUI.UseExtendedLabelWidthForLocalization();

            GUILayout.Space(10);

            RotorzEditorGUI.Title(this.tabs[this.selectedTabIndex]);

            GUILayout.Space(10);

            switch (this.selectedTabIndex)
            {
            case 0:
                this.DrawToolsTab();
                break;

            case 1:
                this.DrawPaintingTab();
                break;

            case 2:
                this.DrawGridTab();
                break;

            case 3:
                this.DrawMiscTab();
                break;
            }
        }
        public override void OnInspectorGUI()
        {
            float initialLabelWidth = EditorGUIUtility.labelWidth;

            RotorzEditorGUI.UseExtendedLabelWidthForLocalization();

            this.serializedObject.Update();

            this.DrawTileSystemNameField();
            ExtraEditorGUI.SeparatorLight(marginTop: 7);

            this.OnSection_TileSystem();

            s_SectionStripping.Value = RotorzEditorGUI.FoldoutSection(s_SectionStripping,
                                                                      label: TileLang.ParticularText("Section", "Stripping"),
                                                                      callback: this.OnSection_Stripping
                                                                      );

            s_SectionBuildOptions.Value = RotorzEditorGUI.FoldoutSection(s_SectionBuildOptions,
                                                                         label: TileLang.ParticularText("Section", "Build Options"),
                                                                         callback: this.OnSection_BuildOptions
                                                                         );

            s_SectionRuntimeOptions.Value = RotorzEditorGUI.FoldoutSection(s_SectionRuntimeOptions,
                                                                           label: TileLang.ParticularText("Section", "Runtime Options"),
                                                                           callback: this.OnSection_RuntimeOptions
                                                                           );

            if (this.DisableUndoOnSerializedObject)
            {
                this.serializedObject.ApplyModifiedPropertiesWithoutUndo();
            }
            else
            {
                this.serializedObject.ApplyModifiedProperties();
            }

            EditorGUIUtility.labelWidth = initialLabelWidth;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Handles GUI events for inspector.
        /// </summary>
        public void OnGUI()
        {
            float initialLabelWidth = EditorGUIUtility.labelWidth;

            RotorzEditorGUI.UseExtendedLabelWidthForLocalization();

            bool formerAddNormals = this.target.addProceduralNormals;

            this.serializedObject.Update();

            GUILayout.Space(6);
            this.DrawToolbar();
            GUILayout.Space(6);

            if (!this.target.IsEditable)
            {
                EditorGUILayout.HelpBox(TileLang.Text("Tile system has been built and can no longer be edited."), MessageType.Info, true);
                return;
            }

            // Display message if any of the target tile systems are locked.
            foreach (TileSystem tileSystem in this.targets)
            {
                if (tileSystem.Locked)
                {
                    string message = this.targets.Length == 1
                        ? TileLang.Text("Tile system is locked. Select 'Toggle Lock' from context menu to unlock inspector.")
                        : TileLang.Text("One or more selected tile systems are locked. Unlock tile systems to unlock inspector.");
                    EditorGUILayout.HelpBox(message, MessageType.Info, true);
                    return;
                }
            }

            s_setting_ToggleModifyGrid.Value = RotorzEditorGUI.FoldoutSection(s_setting_ToggleModifyGrid,
                                                                              label: TileLang.ParticularText("Section", "Modify Grid"),
                                                                              callback: this.DrawModifyGridSection,
                                                                              paddedStyle: RotorzEditorStyles.Instance.InspectorSectionPadded
                                                                              );

            s_setting_ToggleStripping.Value = RotorzEditorGUI.FoldoutSection(s_setting_ToggleStripping,
                                                                             label: TileLang.ParticularText("Section", "Stripping"),
                                                                             callback: this.DrawStrippingSection,
                                                                             paddedStyle: RotorzEditorStyles.Instance.InspectorSectionPadded
                                                                             );

            s_setting_ToggleBuildOptions.Value = RotorzEditorGUI.FoldoutSection(s_setting_ToggleBuildOptions,
                                                                                label: TileLang.ParticularText("Section", "Build Options"),
                                                                                callback: this.DrawBuildOptionsSection,
                                                                                paddedStyle: RotorzEditorStyles.Instance.InspectorSectionPadded
                                                                                );

            s_setting_ToggleRuntimeOptions.Value = RotorzEditorGUI.FoldoutSection(s_setting_ToggleRuntimeOptions,
                                                                                  label: TileLang.ParticularText("Section", "Runtime Options"),
                                                                                  callback: this.DrawRuntimeOptionsSection,
                                                                                  paddedStyle: RotorzEditorStyles.Instance.InspectorSectionPadded
                                                                                  );

            // Ensure that changes are saved.
            if (GUI.changed)
            {
                EditorUtility.SetDirty(this.target);
                this.serializedObject.ApplyModifiedProperties();

                if (formerAddNormals != this.target.addProceduralNormals)
                {
                    this.target.UpdateProceduralTiles(true);
                }
            }

            EditorGUIUtility.labelWidth = initialLabelWidth;
        }