コード例 #1
0
        public void Deserialize([NotNull] ISplittableInspectorDrawer drawer)
        {
                        #if DEV_MODE && DEBUG_ENABLED
            Debug.Log("Restoring state of " + drawer + "...\nmainView: " + StringUtils.ToString(mainViewState.Deserialize()) + "\nsplitView: " + (splitViewState == null ? "null" : StringUtils.ToString(splitViewState.Deserialize())));
                        #endif

            mainViewState.Deserialize(drawer, drawer.MainView);

                        #if DONT_USE_ODIN_SERIALIZER
            if (!viewIsSplit)
            {
                drawer.SetSplitView(false);
                return;
            }
                        #endif

            if (splitViewState != null)
            {
                mainViewState.Deserialize(drawer, drawer.ViewIsSplit ? drawer.SplitView : null);
            }
            else
            {
                drawer.SetSplitView(false);
            }
        }
コード例 #2
0
        internal static void UpdateDimensions(IInspectorDrawer inspectorDrawer, ISplittableInspectorDrawer splittable)
        {
            var inspectorWindowRect = inspectorDrawer.position;

            inspectorWindowRect.x = 0f;
            inspectorWindowRect.y = 0f;

            if (splittable != null && splittable.ViewIsSplit)
            {
                inspectorWindowRect.height *= 0.5f;

                var view = inspectorDrawer.MainView;
                view.State.UpdateDimensions(false, false, inspectorWindowRect, view.ToolbarHeight, view.PreviewAreaHeight);

                view = splittable.SplitView;
                if (view == null)
                {
                                        #if DEV_MODE
                    Debug.LogWarning("Splittable.ViewIsSplit was true but SplitView was null. Fixing now!");
                                        #endif
                    splittable.SetSplitView(true);
                    view = splittable.SplitView;
                                        #if DEV_MODE && PI_ASSERTATIONS
                    Debug.Assert(view != null, inspectorDrawer + " SplitView still null after calling SetSplitView(true)!");
                                        #endif
                }

                inspectorWindowRect.y += inspectorWindowRect.height;
                view.State.UpdateDimensions(false, false, inspectorWindowRect, view.ToolbarHeight, view.PreviewAreaHeight);
            }
            else
            {
                var view = inspectorDrawer.MainView;
                view.State.UpdateDimensions(false, false, inspectorWindowRect, view.ToolbarHeight, view.PreviewAreaHeight);
            }
        }