예제 #1
0
        public void RenderEditorGUI(UnityEngine.Object undoRecordObject)
        {
            var content = new GUIContent();

            for (int tabIndex = 0; tabIndex < _tabs.Length; ++tabIndex)
            {
                if (tabIndex % _numTabsPerRow == 0)
                {
                    if (tabIndex == 0)
                    {
                        EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);
                    }
                    else
                    {
                        EditorGUILayout.EndHorizontal();
                        EditorGUILayout.BeginHorizontal();
                    }
                }

                content.text    = _tabs[tabIndex].Text;
                content.tooltip = _tabs[tabIndex].Tooltip;

                if (tabIndex == _activeTabIndex)
                {
                    GUIEx.PushColor(_activeTabColor);
                }
                else
                {
                    GUIEx.PushColor(Color.white);
                }
                if (GUILayout.Button(content, EditorStyles.toolbarButton))
                {
                    EditorUndoEx.Record(undoRecordObject);
                    _activeTabIndex = tabIndex;
                }
                GUIEx.PopColor();
            }
            EditorGUILayout.EndHorizontal();

            EditorToolbarTab activeTab = ActiveTab;

            if (activeTab.NumTargetSettings != 0)
            {
                activeTab.RenderTargetSettingsEditorGUI(undoRecordObject);
            }
            else
            if (activeTab.TargetToolbar != null)
            {
                activeTab.TargetToolbar.RenderEditorGUI(undoRecordObject);
            }
        }
예제 #2
0
        public void OnGUI()
        {
            var    sgLookAndFeel = _sceneGizmo.LookAndFeel;
            Camera gizmoCamera   = _sceneGizmo.SceneGizmoCamera.Camera;

            if (sgLookAndFeel.IsCamPrjSwitchLabelVisible)
            {
                if (_sceneGizmo.SceneGizmoCamera.SceneCamera != RTFocusCamera.Get.TargetCamera ||
                    !RTFocusCamera.Get.IsDoingProjectionSwitch)
                {
                    Texture2D labelTexture = gizmoCamera.orthographic ? sgLookAndFeel.CamOrthoModeLabelTexture : sgLookAndFeel.CamPerspModeLabelTexture;
                    GUIEx.PushColor(sgLookAndFeel.CamPrjSwitchLabelTint);

                    Rect drawRect = RectEx.FromTexture2D(labelTexture).PlaceBelowCenterHrz(gizmoCamera.pixelRect).InvertScreenY();
                    drawRect.center = new Vector2(drawRect.center.x, Screen.height - 1 - _labelQuad.Center.y);

                    GUI.DrawTexture(drawRect, labelTexture);
                    GUIEx.PopColor();
                }
                else
                {
                    Texture2D destLabelTexture   = sgLookAndFeel.CamOrthoModeLabelTexture;
                    Texture2D sourceLabelTexture = sgLookAndFeel.CamPerspModeLabelTexture;
                    if (RTFocusCamera.Get.PrjSwitchTransitionType == CameraPrjSwitchTransition.Type.ToPerspective)
                    {
                        destLabelTexture   = sgLookAndFeel.CamPerspModeLabelTexture;
                        sourceLabelTexture = sgLookAndFeel.CamOrthoModeLabelTexture;
                    }

                    AnimationCurve srcAnimCurve  = AnimationCurve.EaseInOut(0.0f, sgLookAndFeel.CamPrjSwitchLabelTint.a, 1.0f, 0.0f);
                    AnimationCurve destAnimCurve = AnimationCurve.EaseInOut(0.0f, 0.0f, 1.0f, sgLookAndFeel.CamPrjSwitchLabelTint.a);

                    float destAlpha = destAnimCurve.Evaluate(RTFocusCamera.Get.PrjSwitchProgress);
                    float srcAlpha  = srcAnimCurve.Evaluate(RTFocusCamera.Get.PrjSwitchProgress);

                    GUIEx.PushColor(ColorEx.KeepAllButAlpha(sgLookAndFeel.CamPrjSwitchLabelTint, srcAlpha));
                    Rect drawRect = RectEx.FromTexture2D(sourceLabelTexture).PlaceBelowCenterHrz(gizmoCamera.pixelRect).InvertScreenY();
                    drawRect.center = new Vector2(drawRect.center.x, Screen.height - 1 - _labelQuad.Center.y);
                    GUI.DrawTexture(drawRect, sourceLabelTexture);
                    GUIEx.PopColor();

                    GUIEx.PushColor(ColorEx.KeepAllButAlpha(sgLookAndFeel.CamPrjSwitchLabelTint, destAlpha));
                    drawRect        = RectEx.FromTexture2D(destLabelTexture).PlaceBelowCenterHrz(gizmoCamera.pixelRect).InvertScreenY();
                    drawRect.center = new Vector2(drawRect.center.x, Screen.height - 1 - _labelQuad.Center.y);
                    GUI.DrawTexture(drawRect, destLabelTexture);
                    GUIEx.PopColor();
                }
            }
        }