UnityEditor.AudioSourceInspector.InitStyles C# (CSharp) Méthode

InitStyles() private static méthode

private static InitStyles ( ) : void
Résultat void
        private static void InitStyles()
        {
            if (ms_Styles == null)
            {
                ms_Styles = new Styles();
            }
        }

Usage Example

        internal static void AnimProp(GUIContent label, SerializedProperty prop, float min, float max, bool useNormalizedValue)
        {
            AudioSourceInspector.InitStyles();
            if (prop.hasMultipleDifferentValues)
            {
                EditorGUILayout.TargetChoiceField(prop, label, new GUILayoutOption[0]);
                return;
            }
            AnimationCurve animationCurveValue = prop.animationCurveValue;

            if (animationCurveValue == null)
            {
                Debug.LogError(label.text + " curve is null!");
                return;
            }
            if (animationCurveValue.length == 0)
            {
                Debug.LogError(label.text + " curve has no keys!");
                return;
            }
            if (animationCurveValue.length != 1)
            {
                using (new EditorGUI.DisabledScope(true))
                {
                    EditorGUILayout.LabelField(label.text, AudioSourceInspector.ms_Styles.controlledByCurveLabel, new GUILayoutOption[0]);
                }
            }
            else
            {
                float num = (!useNormalizedValue) ? animationCurveValue.keys[0].value : Mathf.Lerp(min, max, animationCurveValue.keys[0].value);
                num = MathUtils.DiscardLeastSignificantDecimal(num);
                EditorGUI.BeginChangeCheck();
                if (max > min)
                {
                    num = EditorGUILayout.Slider(label, num, min, max, new GUILayoutOption[0]);
                }
                else
                {
                    num = EditorGUILayout.Slider(label, num, max, min, new GUILayoutOption[0]);
                }
                if (EditorGUI.EndChangeCheck())
                {
                    Keyframe key = animationCurveValue.keys[0];
                    key.time  = 0f;
                    key.value = ((!useNormalizedValue) ? num : Mathf.InverseLerp(min, max, num));
                    animationCurveValue.MoveKey(0, key);
                }
            }
            prop.animationCurveValue = animationCurveValue;
        }
All Usage Examples Of UnityEditor.AudioSourceInspector::InitStyles