예제 #1
0
        public static LightSystemDialog ShowDialog(ResultCallback resultCallback)
        {
            if (m_instance != null)
            {
                m_instance.CloseDialog();
            }
            m_active         = true;
            m_resultCallback = resultCallback;
            m_instance       = EditorWindow.CreateInstance <LightSystemDialog>();

            Vector2 point = GUIUtility.GUIToScreenPoint(Event.current.mousePosition);

            m_instance.position = new Rect(point.x, point.y, 250, 300);
            m_instance.ShowPopup();
            return(m_instance);
        }
        public static void DrawDaydreamLightingToggle(DaydreamRenderer renderer)
        {
            if (renderer == null)
            {
                return;
            }

            // determine lighting system in use
            const int kDaydreamLighting = 0;
            const int kUnityLighting    = 1;
            int       selectedIndex     = renderer.m_daydreamLighting ? kDaydreamLighting : kUnityLighting;

            EditorGUI.BeginChangeCheck();

            // draw section separator
            DrawSection(500, 1);
            EditorGUILayout.BeginHorizontal();
            if (selectedIndex == kDaydreamLighting)
            {
                EditorGUILayout.LabelField("Lighting System", Styles.sectionLabel, GUILayout.Width(105), GUILayout.Height(25));
                GUILayout.Button("", Styles.daydreamLightingStyle, GUILayout.Width(25), GUILayout.Height(25));
            }
            else
            {
                EditorGUILayout.LabelField("Lighting System", Styles.sectionLabel, GUILayout.Width(105), GUILayout.Height(25));
                GUILayout.Button("", Styles.unityLightingStyle, GUILayout.Width(25), GUILayout.Height(25));
            }

            EditorGUILayout.EndHorizontal();
            GUILayout.Space(5);

            EditorGUI.BeginChangeCheck();
            DREditorUtility.RadioButtonOutput selected = DREditorUtility.DrawRadioButton(selectedIndex, Styles.m_lightingSystemUI, Styles.m_buttonUnselected, Styles.m_buttonSelected, 20, 32, 150, new bool[] { true, false });
            if (EditorGUI.EndChangeCheck())
            {
                if (selected.m_selectedIndex == kDaydreamLighting)
                {
                    if (renderer.m_daydreamLighting == false)
                    {
                        renderer.m_daydreamLighting = true;
                        if (!renderer.m_enableManualLightingComponents)
                        {
                            DaydreamRendererImportManager.ApplyLightingComponents();
                        }
                        renderer.EnableEnlighten(false);
                    }
                }
                else
                {
                    if (renderer.m_daydreamLighting == true)
                    {
                        renderer.m_daydreamLighting = false;
                        if (!renderer.m_enableManualLightingComponents)
                        {
                            DaydreamRendererImportManager.RemoveAllLightingComponents();
                        }
                        renderer.EnableEnlighten(true);
                    }
                }

                // display advanced settings
                if (selected.m_dropDownSelected == kDaydreamLighting)
                {
                    LightSystemDialog.ShowDialog(null);
                }
            }
            GUILayout.Space(5);
        }