void AddDefaultPresetsToLibrary(PresetLibrary presetLibrary)
        {
            DoubleCurvePresetLibrary doubleCurveDefaultLib = presetLibrary as DoubleCurvePresetLibrary;

            if (doubleCurveDefaultLib == null)
            {
                Debug.Log("Incorrect preset library, should be a DoubleCurvePresetLibrary but was a " + presetLibrary.GetType());
                return;
            }

            bool signedRange            = m_DoubleCurve.signedRange;
            List <DoubleCurve> defaults = new List <DoubleCurve>();

            if (IsSingleCurve(m_DoubleCurve))
            {
                defaults = GetUnsignedSingleCurveDefaults(signedRange);
            }
            else
            {
                if (signedRange)
                {
                    defaults = GetSignedDoubleCurveDefaults();
                }
                else
                {
                    defaults = GetUnsignedDoubleCurveDefaults();
                }
            }

            foreach (DoubleCurve preset in defaults)
            {
                doubleCurveDefaultLib.Add(preset, "");
            }
        }
Ejemplo n.º 2
0
        private void AddDefaultPresetsToLibrary(PresetLibrary presetLibrary)
        {
            DoubleCurvePresetLibrary library = presetLibrary as DoubleCurvePresetLibrary;

            if (library == null)
            {
                Debug.Log("Incorrect preset library, should be a DoubleCurvePresetLibrary but was a " + presetLibrary.GetType());
            }
            else
            {
                bool signedRange = this.m_DoubleCurve.signedRange;
                List <DoubleCurve> unsignedSingleCurveDefaults = new List <DoubleCurve>();
                if (this.IsSingleCurve(this.m_DoubleCurve))
                {
                    unsignedSingleCurveDefaults = GetUnsignedSingleCurveDefaults(signedRange);
                }
                else if (signedRange)
                {
                    unsignedSingleCurveDefaults = GetSignedDoubleCurveDefaults();
                }
                else
                {
                    unsignedSingleCurveDefaults = GetUnsignedDoubleCurveDefaults();
                }
                foreach (DoubleCurve curve in unsignedSingleCurveDefaults)
                {
                    library.Add(curve, string.Empty);
                }
            }
        }
        private void AddDefaultPresetsToLibrary(PresetLibrary presetLibrary)
        {
            DoubleCurvePresetLibrary doubleCurvePresetLibrary = presetLibrary as DoubleCurvePresetLibrary;

            if (doubleCurvePresetLibrary == null)
            {
                Debug.Log("Incorrect preset library, should be a DoubleCurvePresetLibrary but was a " + presetLibrary.GetType());
                return;
            }
            bool signedRange        = this.m_DoubleCurve.signedRange;
            List <DoubleCurve> list = new List <DoubleCurve>();

            if (this.IsSingleCurve(this.m_DoubleCurve))
            {
                list = DoubleCurvePresetsContentsForPopupWindow.GetUnsignedSingleCurveDefaults(signedRange);
            }
            else
            {
                if (signedRange)
                {
                    list = DoubleCurvePresetsContentsForPopupWindow.GetSignedDoubleCurveDefaults();
                }
                else
                {
                    list = DoubleCurvePresetsContentsForPopupWindow.GetUnsignedDoubleCurveDefaults();
                }
            }
            foreach (DoubleCurve current in list)
            {
                doubleCurvePresetLibrary.Add(current, string.Empty);
            }
        }
        private void AddDefaultPresetsToLibrary(PresetLibrary presetLibrary)
        {
            DoubleCurvePresetLibrary curvePresetLibrary = presetLibrary as DoubleCurvePresetLibrary;

            if ((UnityEngine.Object)curvePresetLibrary == (UnityEngine.Object)null)
            {
                Debug.Log((object)("Incorrect preset library, should be a DoubleCurvePresetLibrary but was a " + (object)presetLibrary.GetType()));
            }
            else
            {
                bool signedRange = this.m_DoubleCurve.signedRange;
                List <DoubleCurve> doubleCurveList = new List <DoubleCurve>();
                using (List <DoubleCurve> .Enumerator enumerator = (!this.IsSingleCurve(this.m_DoubleCurve) ? (!signedRange ? DoubleCurvePresetsContentsForPopupWindow.GetUnsignedDoubleCurveDefaults() : DoubleCurvePresetsContentsForPopupWindow.GetSignedDoubleCurveDefaults()) : DoubleCurvePresetsContentsForPopupWindow.GetUnsignedSingleCurveDefaults(signedRange)).GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        DoubleCurve current = enumerator.Current;
                        curvePresetLibrary.Add((object)current, string.Empty);
                    }
                }
            }
        }