コード例 #1
0
        /// <inheritdoc/>
        protected internal override void Initialize()
        {
            LoadResource();

            SpriteTexture spriteTexture = InspectedObject as SpriteTexture;

            if (spriteTexture == null)
            {
                return;
            }

            genericDrawer = new GenericInspectorDrawer(spriteTexture, this, Layout);

            GUILayout previewLayout = PreviewGUI.AddLayoutY();

            previewTitleLayout = GUILayoutWithBackground.Create <GUILayoutX>(previewLayout, Builtin.WhiteTexture,
                                                                             new Color(0.129f, 0.129f, 0.129f), new RectOffset(11, 0, 2, 0));

            GUILabel title = new GUILabel(new LocEdString("Preview"));

            previewTitleLayout.Layout.AddElement(title);
            previewTitleLayout.Layout.AddFlexibleSpace();

            previewContentLayout = GUILayoutWithBackground.Create <GUILayoutX>(previewLayout, Builtin.WhiteTexture,
                                                                               new Color(0.09f, 0.09f, 0.09f), new RectOffset(5, 5, 5, 5));

            previewContentLayout.MainPanel.SetHeight(250);

            previewTexture = new GUITexture(spriteTexture, GUITextureScaleMode.ScaleToFit,
                                            GUIOption.FlexibleWidth(), GUIOption.FlexibleHeight());
            previewContentLayout.Layout.AddElement(previewTexture);
        }
コード例 #2
0
        /// <inheritdoc/>
        protected internal override void Initialize()
        {
            if (InspectedObject == null)
            {
                LoadResource();
            }

            drawer = new GenericInspectorDrawer(InspectedObject, this, Layout);

            isEmpty = drawer.Fields.Count == 0;
            base.SetVisible(!isEmpty);
        }
コード例 #3
0
        /// <inheritdoc/>
        protected internal override void Initialize()
        {
            if (InspectedObject == null)
            {
                LoadResource();
            }

            Component inspectedComponent = InspectedObject as Component;

            drawer = new GenericInspectorDrawer(InspectedObject, new InspectableContext(Persistent, inspectedComponent),
                                                Layout);

            isEmpty = drawer.Fields.Count == 0;
            base.SetVisible(!isEmpty);
        }
コード例 #4
0
        private void OnInitialize()
        {
            EditorApplication.OnProjectSave += SaveSettings;

            SceneWindow sceneWindow = SceneWindow.GetWindow <SceneWindow>();

            if (sceneWindow != null)
            {
                viewSettings   = sceneWindow.Camera.ViewSettings;
                moveSettings   = sceneWindow.Camera.MoveSettings;
                renderSettings = sceneWindow.Camera.RenderSettings;
            }
            else
            {
                viewSettings   = ProjectSettings.GetObject <SceneCameraViewSettings>(SceneCamera.ViewSettingsKey);
                moveSettings   = ProjectSettings.GetObject <SceneCameraMoveSettings>(SceneCamera.MoveSettingsKey);
                renderSettings = ProjectSettings.GetObject <RenderSettings>(SceneCamera.RenderSettingsKey);
            }

            expandStates = ProjectSettings.GetObject <SerializableProperties>(ExpandStatesKey);
            InspectableContext inspectableContext = new InspectableContext(expandStates);

            GUILayout mainLayout = GUI.AddLayoutY();

            GUIScrollArea scrollArea = new GUIScrollArea(ScrollBarType.ShowIfDoesntFit, ScrollBarType.NeverShow);

            mainLayout.AddElement(scrollArea);

            GUILayoutX horzPadLayout = scrollArea.Layout.AddLayoutX(GUIOption.FlexibleWidth(100, 400));

            horzPadLayout.AddSpace(5);

            GUILayout vertLayout = horzPadLayout.AddLayoutY();

            horzPadLayout.AddSpace(5);

            vertLayout.AddSpace(5);

            vertLayout.AddElement(new GUILabel(new LocEdString("View Settings"), EditorStyles.LabelBold));
            GUILayoutY viewSettingsLayout = vertLayout.AddLayoutY();

            vertLayout.AddSpace(10);

            vertLayout.AddElement(new GUILabel(new LocEdString("Move Settings"), EditorStyles.LabelBold));
            GUILayoutY moveSettingsLayout = vertLayout.AddLayoutY();

            vertLayout.AddSpace(10);

            vertLayout.AddElement(new GUILabel(new LocEdString("Render Settings"), EditorStyles.LabelBold));
            GUILayoutY renderSettingsLayout = vertLayout.AddLayoutY();

            guiViewSettings     = new GenericInspectorDrawer(viewSettings, inspectableContext, viewSettingsLayout);
            guiMovementSettings = new GenericInspectorDrawer(moveSettings, inspectableContext, moveSettingsLayout);
            guiRenderSettings   = new GenericInspectorDrawer(renderSettings, inspectableContext, renderSettingsLayout);

            mainLayout.AddSpace(5);
            GUILayout buttonCenterLayout = mainLayout.AddLayoutX();

            mainLayout.AddSpace(5);

            GUIButton resetToDefaultBtn = new GUIButton(new LocEdString("Reset to defaults"));

            resetToDefaultBtn.OnClick += () => ConfirmResetToDefault(ResetToDefault, null);

            buttonCenterLayout.AddFlexibleSpace();
            buttonCenterLayout.AddElement(resetToDefaultBtn);
            buttonCenterLayout.AddFlexibleSpace();
        }