/// <summary>
        /// Implement this function to make a custom inspector.
        /// </summary>
        public override void OnInspectorGUI()
        {
            bool isNeedBuildMat = false;

            serializedObject.Update();

            //================
            // Effect material.
            //================
            EditorGUI.BeginDisabledGroup(true);
            EditorGUILayout.PropertyField(_spMaterial);
            EditorGUI.EndDisabledGroup();

            //================
            // Effect setting.
            //================
            EditorGUILayout.PropertyField(_spEffectFactor);
            EditorGUILayout.PropertyField(_spWidth);
            EditorGUILayout.PropertyField(_spSoftness);
            EditorGUILayout.PropertyField(_spColor);
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(_spColorMode);
            EditorGUILayout.PropertyField(_spNoiseTexture);
            isNeedBuildMat = EditorGUI.EndChangeCheck();

            //================
            // Advanced option.
            //================
            EditorGUILayout.PropertyField(_spEffectArea);
            EditorGUILayout.PropertyField(_spKeepAspectRatio);

            //================
            // Set Mat.
            //================
            var obj = target as LUIDissolve;

            if ((isNeedBuildMat || _spMaterial.objectReferenceValue == null || _lastGraphic != obj.targetGraphic) && _spNoiseTexture.objectReferenceValue != null)
            {
                if (obj.targetGraphic is LImageForTP)
                {
                    Shader shader = Shader.Find("UI/Hidden/UI-Effect-Dissolve(RGB+A)");
                    _spMaterial.objectReferenceValue = MaterialUtility.GetOrGenerateMaterialVariant(shader, (ColorMode)(_spColorMode.intValue));
                }
                else
                {
                    Shader shader = Shader.Find("UI/Hidden/UI-Effect-Dissolve");
                    _spMaterial.objectReferenceValue = MaterialUtility.GetOrGenerateMaterialVariant(shader, (ColorMode)(_spColorMode.intValue));
                }
                _lastGraphic = obj.targetGraphic;
            }

            serializedObject.ApplyModifiedProperties();
        }
示例#2
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            //================
            // Effect material.
            //================
            EditorGUI.BeginDisabledGroup(true);
            EditorGUILayout.PropertyField(_spMaterial);
            EditorGUI.EndDisabledGroup();

            //================
            // Effect setting.
            //================
            EditorGUILayout.PropertyField(_spEffectFactor);
            EditorGUILayout.PropertyField(_spWidth);
            EditorGUILayout.PropertyField(_spRotation);
            EditorGUILayout.PropertyField(_spSoftness);
            EditorGUILayout.PropertyField(_spBrightness);
            EditorGUILayout.PropertyField(_spGloss);

            //================
            // Advanced option.
            //================
            EditorGUILayout.PropertyField(_spEffectArea);

            //================
            // Set Mat.
            //================
            var obj = target as LUIShiny;

            if (_spMaterial.objectReferenceValue == null || _lastGraphic != obj.targetGraphic)
            {
                if (obj.targetGraphic is LImageForTP)
                {
                    Shader shader = Shader.Find("UI/Hidden/UI-Effect-Shiny(RGB+A)");
                    _spMaterial.objectReferenceValue = MaterialUtility.GetOrGenerateMaterialVariant(shader);
                }
                else
                {
                    Shader shader = Shader.Find("UI/Hidden/UI-Effect-Shiny");
                    _spMaterial.objectReferenceValue = MaterialUtility.GetOrGenerateMaterialVariant(shader);
                }
            }

            serializedObject.ApplyModifiedProperties();
        }
示例#3
0
        /// <summary>
        /// Implement this function to make a custom inspector.
        /// </summary>
        public override void OnInspectorGUI()
        {
            bool isNeedBuildMat = false;

            var graphic = (target as LRawImageForCapScreen);

            serializedObject.Update();

            //================
            // Basic properties.
            //================
            EditorGUILayout.PropertyField(_spTexture);
            EditorGUILayout.PropertyField(_spColor);
            EditorGUILayout.PropertyField(_spRaycastTarget);
            //================
            // Effect material.
            //================
            var spMaterial = serializedObject.FindProperty("m_EffectMaterial");

            EditorGUI.BeginDisabledGroup(true);
            EditorGUILayout.PropertyField(spMaterial);
            EditorGUI.EndDisabledGroup();

            //================
            // Blur effect.
            //================
            GUILayout.Space(10);
            EditorGUILayout.LabelField("Blur Effect", EditorStyles.boldLabel);
            isNeedBuildMat = LUIBlurEffectEditor.DrawBlurProperties(serializedObject);

            //================
            // Advanced option.
            //================
            GUILayout.Space(10);
            EditorGUILayout.LabelField("Advanced Option", EditorStyles.boldLabel);

            EditorGUI.BeginChangeCheck();

            if (_spBlurMode.intValue != 0)
            {
                EditorGUILayout.PropertyField(_spIterations); // Iterations.
            }
            DrawDesamplingRate(_spReductionRate);             // Reduction rate.

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Result Texture Setting", EditorStyles.boldLabel);

            EditorGUILayout.PropertyField(_spFilterMode); // Filter Mode.
            DrawDesamplingRate(_spDesamplingRate);        // Desampling rate.

            serializedObject.ApplyModifiedProperties();

            // Debug.
            using (new EditorGUILayout.HorizontalScope(EditorStyles.helpBox))
            {
                GUILayout.Label("Debug");

                if (GUILayout.Button("Capture", "ButtonLeft"))
                {
                    graphic.Release();
                    EditorApplication.delayCall += graphic.Capture;
                }

                EditorGUI.BeginDisabledGroup(!(target as LRawImageForCapScreen).capturedTexture);
                if (GUILayout.Button("Release", "ButtonRight"))
                {
                    graphic.Release();
                }
                EditorGUI.EndDisabledGroup();
            }

            if (isNeedBuildMat || (spMaterial.objectReferenceValue == null && _spBlurMode.intValue != 0))
            {
                Shader shader = Shader.Find("UI/Hidden/UI-EffectCapture-Blur");
                spMaterial.objectReferenceValue = MaterialUtility.GetOrGenerateMaterialVariant(shader, (BlurMode)_spBlurMode.intValue);
                serializedObject.ApplyModifiedProperties();
            }
        }