示例#1
0
        void Update()
        {
            if (!thisImage)
            {
                thisImage = GetComponent <Image>();
            }

            if (!scaler)
            {
                scaler = transform.GetComponentInParent <Canvas>().GetComponent <MaterialUIScaler>();
            }
            else
            {
                if (scaleFactor != scaler.scaleFactor)
                {
                    scaleFactor = scaler.scaleFactor;

                    if (scaleFactor > 2f && sprite4x)
                    {
                        thisImage.sprite = sprite4x;
                    }
                    else if (scaleFactor > 1f && sprite2x)
                    {
                        thisImage.sprite = sprite2x;
                    }
                    else
                    {
                        thisImage.sprite = sprite1x;
                    }
                }
            }
        }
示例#2
0
        void Update()
        {
            if (!thisImage)
            {
                thisImage = gameObject.GetComponent<Image>();
            }

            if (!scaler)
            {
                scaler = gameObject.GetComponentInParent<Canvas>().GetComponent<MaterialUIScaler>();
            }
            else
            {
                if (scaleFactor != scaler.scaleFactor)
                {
                    scaleFactor = scaler.scaleFactor;

                    if (scaleFactor > 2f && sprite4x)
                        thisImage.sprite = sprite4x;
                    else if (scaleFactor > 1f && sprite2x)
                        thisImage.sprite = sprite2x;
                    else
                        thisImage.sprite = sprite1x;
                }
            }
        }
示例#3
0
        /// <summary>
        /// Animates the slider to the 'off' state.
        /// </summary>
        private void AnimateOff()
        {
            TweenManager.EndTween(m_HandleSizeTweener);
            TweenManager.EndTween(m_PopupScaleTweener);
            TweenManager.EndTween(m_HandlePositionYTweener);
            TweenManager.EndTween(m_PopupTextColorTweener);

            if (m_HasPopup)
            {
                m_HandlePositionYTweener =
                    TweenManager.TweenFloat(
                        f => handleGraphicTransform.anchoredPosition = new Vector2(handleGraphicTransform.anchoredPosition.x, f),
                        handleGraphicTransform.anchoredPosition.y,
                        MaterialUIScaler.GetRootScaler(transform).canvas.pixelPerfect ? 1f : 0f, m_AnimationDuration, 0, null, false, Tween.TweenType.EaseOutCubed);

                m_PopupScaleTweener = TweenManager.TweenVector3(vector3 => m_PopupTransform.localScale = vector3,
                                                                m_PopupTransform.localScale, Vector3.zero, m_AnimationDuration);
            }

            m_HandleSizeTweener = TweenManager.TweenVector2(vector2 => handleGraphicTransform.sizeDelta = vector2,
                                                            handleGraphicTransform.sizeDelta, new Vector2(16, 16), m_AnimationDuration, 0, null, false,
                                                            Tween.TweenType.EaseOutSept);

            m_PopupTextColorTweener = TweenManager.TweenColor(color => m_PopupText.color = color, m_PopupText.color,
                                                              m_PopupText.color.WithAlpha(0f), m_AnimationDuration * 0.25f);
        }
        /// <summary>
        /// See MonoBehaviour.OnEnable.
        /// </summary>
        protected override void OnEnable()
        {
            SetTracker();

            scaler = MaterialUIScaler.GetRootScaler(transform);

            if (scaler != null)
            {
                scaler.onCanvasAreaChanged.AddListener(OnCanvasChanged);
            }
        }
示例#5
0
        public static void Show(string content, float duration, Color panelColor, Color textColor, int fontSize, Transform canvasHierarchy = null)
        {
            Canvas canvas = null;

            if (canvasHierarchy != null)
            {
                canvas = MaterialUIScaler.GetParentScaler(canvasHierarchy).targetCanvas;
                if (canvas != null)
                {
                    instance.m_ParentCanvas = canvas;
                }
            }

            instance.m_ToastQueue.Enqueue(new KeyValuePair <Toast, Canvas>(new Toast(content, duration, panelColor, textColor, fontSize), canvas));
            instance.StartQueue();
        }
示例#6
0
        protected override void Start()
        {
            if (Application.isPlaying)
            {
                InitializeTabs();
                InitializePages();
            }

            MaterialUIScaler.GetRootScaler(rectTransform).onCanvasAreaChanged.AddListener((scaleChanged, orientationChanged) =>
            {
                if (Application.isPlaying)
                {
                    InitializeTabs();
                    InitializePages();
                }
            });
        }
示例#7
0
        protected override void Start()
        {
            if (Application.isPlaying)
            {
                InitializeTabs();
                InitializePages();
            }

            MaterialUIScaler.GetParentScaler(transform).OnOrientationChange += resolution =>
            {
                if (Application.isPlaying)
                {
                    InitializeTabs();
                    InitializePages();
                }
            };
        }
        void OnEnable()
        {
            scaler = target as MaterialUIScaler;

            m_ScalerMode             = serializedObject.FindProperty("m_ScalerMode");
            m_EditorForceDpi         = serializedObject.FindProperty("m_EditorForceDpi");
            m_EditorForceDpiValue    = serializedObject.FindProperty("m_EditorForceDpiValue");
            m_ReferencePixelsPerUnit = serializedObject.FindProperty("m_ReferencePixelsPerUnit");
            m_DynamicPixelsPerUnit   = serializedObject.FindProperty("m_DynamicPixelsPerUnit");
            m_BaseDpi        = serializedObject.FindProperty("m_BaseDpi");
            m_FallbackDpi    = serializedObject.FindProperty("m_FallbackDpi");
            m_ScaleModifier  = serializedObject.FindProperty("m_ScaleModifier");
            m_ScaleSnapLevel = serializedObject.FindProperty("m_ScaleSnapLevel");

            m_TargetScaler       = serializedObject.FindProperty("m_TargetScaler");
            m_TargetCanvasScaler = serializedObject.FindProperty("m_TargetCanvasScaler");
        }
示例#9
0
        /// <summary>
        /// Copies the settings to other canvas.
        /// </summary>
        /// <param name="canvas">The canvas to copy from.</param>
        /// <param name="otherCanvas">The canvas to copy to.</param>
        public static void CopySettingsToOtherCanvas(this Canvas canvas, Canvas otherCanvas)
        {
            RectTransform mainCanvasRectTransform     = canvas.GetComponent <RectTransform>();
            RectTransform dropdownCanvasRectTransform = otherCanvas.GetComponent <RectTransform>();

            dropdownCanvasRectTransform.position   = mainCanvasRectTransform.position;
            dropdownCanvasRectTransform.sizeDelta  = mainCanvasRectTransform.sizeDelta;
            dropdownCanvasRectTransform.anchorMin  = mainCanvasRectTransform.anchorMin;
            dropdownCanvasRectTransform.anchorMax  = mainCanvasRectTransform.anchorMax;
            dropdownCanvasRectTransform.pivot      = mainCanvasRectTransform.pivot;
            dropdownCanvasRectTransform.rotation   = mainCanvasRectTransform.rotation;
            dropdownCanvasRectTransform.localScale = mainCanvasRectTransform.localScale;

            otherCanvas.gameObject.GetAddComponent <GraphicRaycaster>();
            CanvasScaler mainScaler = canvas.GetComponent <CanvasScaler>();

            if (mainScaler != null)
            {
                CanvasScaler scaler = otherCanvas.gameObject.GetAddComponent <CanvasScaler>();
                scaler.uiScaleMode            = mainScaler.uiScaleMode;
                scaler.referenceResolution    = mainScaler.referenceResolution;
                scaler.screenMatchMode        = mainScaler.screenMatchMode;
                scaler.matchWidthOrHeight     = mainScaler.matchWidthOrHeight;
                scaler.referencePixelsPerUnit = mainScaler.referencePixelsPerUnit;
                scaler.scaleFactor            = mainScaler.scaleFactor;
                otherCanvas.scaleFactor       = scaler.scaleFactor;
            }
            MaterialUIScaler mainMaterialScaler = canvas.GetComponent <MaterialUIScaler>();

            if (mainMaterialScaler != null)
            {
                MaterialUIScaler materialScaler = otherCanvas.gameObject.GetAddComponent <MaterialUIScaler>();
                materialScaler.scalerMode   = MaterialUIScaler.ScalerMode.CopyOtherScaler;
                materialScaler.targetScaler = mainMaterialScaler;
            }
            otherCanvas.gameObject.GetAddComponent <MaterialUIScaler>();
            otherCanvas.renderMode    = canvas.renderMode;
            otherCanvas.targetDisplay = canvas.targetDisplay;
            otherCanvas.worldCamera   = canvas.worldCamera;
            otherCanvas.planeDistance = canvas.planeDistance;
        }
示例#10
0
        /// <summary>
        /// Copies a Canvas to another GameObject.
        /// </summary>
        /// <param name="canvas">The canvas to copy.</param>
        /// <param name="gameObjectToAddTo">The game object to add the new Canvas to.</param>
        /// <returns>The new Canvas instance.</returns>
        public static Canvas Copy(this Canvas canvas, GameObject gameObjectToAddTo)
        {
            Canvas dupCanvas = gameObjectToAddTo.GetAddComponent <Canvas>();

            RectTransform mainCanvasRectTransform     = canvas.GetComponent <RectTransform>();
            RectTransform dropdownCanvasRectTransform = dupCanvas.GetComponent <RectTransform>();

            dropdownCanvasRectTransform.position   = mainCanvasRectTransform.position;
            dropdownCanvasRectTransform.sizeDelta  = mainCanvasRectTransform.sizeDelta;
            dropdownCanvasRectTransform.anchorMin  = mainCanvasRectTransform.anchorMin;
            dropdownCanvasRectTransform.anchorMax  = mainCanvasRectTransform.anchorMax;
            dropdownCanvasRectTransform.pivot      = mainCanvasRectTransform.pivot;
            dropdownCanvasRectTransform.rotation   = mainCanvasRectTransform.rotation;
            dropdownCanvasRectTransform.localScale = mainCanvasRectTransform.localScale;

            dupCanvas.gameObject.GetAddComponent <GraphicRaycaster>();
            CanvasScaler mainScaler = canvas.GetComponent <CanvasScaler>();

            if (mainScaler != null)
            {
                CanvasScaler scaler = dupCanvas.gameObject.GetAddComponent <CanvasScaler>();
                scaler.uiScaleMode            = mainScaler.uiScaleMode;
                scaler.referenceResolution    = mainScaler.referenceResolution;
                scaler.screenMatchMode        = mainScaler.screenMatchMode;
                scaler.matchWidthOrHeight     = mainScaler.matchWidthOrHeight;
                scaler.referencePixelsPerUnit = mainScaler.referencePixelsPerUnit;
            }
            MaterialUIScaler mainMaterialScaler = canvas.GetComponent <MaterialUIScaler>();

            if (mainMaterialScaler != null)
            {
                MaterialUIScaler materialScaler = dupCanvas.gameObject.GetAddComponent <MaterialUIScaler>();
                materialScaler.scalerMode   = MaterialUIScaler.ScalerMode.CopyOtherScaler;
                materialScaler.targetScaler = mainMaterialScaler;
            }
            dupCanvas.gameObject.GetAddComponent <MaterialUIScaler>();
            dupCanvas.renderMode = canvas.renderMode;

            return(dupCanvas);
        }
示例#11
0
        /// <summary>
        /// Gets the parent scaler from a Transform.
        /// </summary>
        /// <param name="transform">The transform.</param>
        /// <returns></returns>
        public static MaterialUIScaler GetParentScaler(Transform transform)
        {
            if (transform == null)
            {
                return(null);
            }

            Transform        currentTransform = transform;
            MaterialUIScaler scaler           = null;

            while (currentTransform.root != currentTransform)
            {
                currentTransform = currentTransform.parent;
                scaler           = currentTransform.GetComponent <MaterialUIScaler>();
                if (scaler != null)
                {
                    break;
                }
            }

            return(scaler);
        }
示例#12
0
        void Update()
        {
            if (!thisImage)
            {
                thisImage = gameObject.GetComponent <Image>();
                //  Debug.Log("call 1");
            }

            if (!scaler)
            {
                if (scaler != null)
                {
                    Debug.Log("call 2");
                    scaler = gameObject.GetComponentInParent <Canvas>().GetComponent <MaterialUIScaler>();
                }
            }
            else
            {
                //Debug.Log("call 3");
                if (scaleFactor != scaler.scaleFactor)
                {
                    scaleFactor = scaler.scaleFactor;

                    if (scaleFactor > 2f && sprite4x)
                    {
                        thisImage.sprite = sprite4x;
                    }
                    else if (scaleFactor > 1f && sprite2x)
                    {
                        thisImage.sprite = sprite2x;
                    }
                    else
                    {
                        thisImage.sprite = sprite1x;
                    }
                }
            }
        }
示例#13
0
        /// <summary>
        /// Shows a toast message. If a toast message is already being shown, then the manager will instead add this toast to the queue.
        /// </summary>
        /// <param name="content">The message to show.</param>
        /// <param name="duration">The duration to show the toast.</param>
        /// <param name="panelColor">Color of the background panel.</param>
        /// <param name="textColor">Color of the text.</param>
        /// <param name="fontSize">Size of the font.</param>
        /// <param name="canvasHierarchy">The toast will be shown under the same canvas as the specified transform. Uses <see cref="m_ParentCanvas"/> if null.</param>
        public static void Show(string content, float duration, Color panelColor, Color textColor, int fontSize, Transform canvasHierarchy = null)
        {
            int toastTotalCount = instance.m_ToastQueue.Count + (m_Instance.m_IsActive ? 1 : 0);

            if (toastTotalCount >= instance.m_MaxQueueSize)
            {
                return;
            }

            Canvas canvas = null;

            if (canvasHierarchy != null)
            {
                canvas = MaterialUIScaler.GetRootScaler(canvasHierarchy).canvas;
                if (canvas != null)
                {
                    instance.m_ParentCanvas = canvas;
                }
            }

            instance.m_ToastQueue.Enqueue(new KeyValuePair <Toast, Canvas>(new Toast(content, duration, panelColor, textColor, fontSize), canvas));
            instance.StartQueue();
        }
示例#14
0
        /// <summary>
        /// Calculateds the position of the fully-expanded dropdown.
        /// </summary>
        /// <returns></returns>
        private Vector3 CalculatedPosition()
        {
            Vector3 position     = m_BaseTransform.GetPositionRegardlessOfPivot();
            float   itemHeight   = m_ListItemTemplate.rectTransform.GetProperSize().y;
            float   minScrollPos = 0f;
            float   maxScrollPos = Mathf.Clamp(m_FullHeight - m_TempMaxHeight, 0f, float.MaxValue);

            int flipper = (int)m_VerticalPivotType < 3 ? 1 : -1;

            if (m_VerticalPivotType == VerticalPivotType.BelowBase || m_VerticalPivotType == VerticalPivotType.AboveBase)
            {
                float baseHeight = m_BaseTransform.GetProperSize().y;

                position.y -= m_ExpandedSize.y * scaler.canvas.transform.localScale.x / 2 * flipper;
                position.y -= baseHeight * scaler.canvas.transform.localScale.x / 2 * flipper;
            }
            else if (m_VerticalPivotType == VerticalPivotType.Top || m_VerticalPivotType == VerticalPivotType.Bottom)
            {
                position.y -= m_ExpandedSize.y * scaler.canvas.transform.localScale.x / 2 * flipper;
                position.y += itemHeight * scaler.canvas.transform.localScale.x / 2 * flipper;
                //  I have absolutely no idea why 3 works better than 4 (according to my math, it should be 4). I've probably missed something, but it works :)
                position.y -= 3 * scaler.canvas.transform.localScale.x * flipper;
            }
            else if (m_VerticalPivotType == VerticalPivotType.FirstItem || m_VerticalPivotType == VerticalPivotType.LastItem)
            {
                position.y -= m_ExpandedSize.y * scaler.canvas.transform.localScale.x / 2f * flipper;
                position.y += itemHeight * scaler.canvas.transform.localScale.x / 2f * flipper;
                position.y += 8f * scaler.canvas.transform.localScale.x / 2f * flipper;
            }

            if (m_HighlightCurrentlySelected)
            {
                Vector2 tempVector2 = m_PanelLayer.anchoredPosition;
                tempVector2.y += itemHeight * Mathf.Clamp(m_CurrentlySelected, 0, int.MaxValue);
                if (m_VerticalPivotType == VerticalPivotType.Center)
                {
                    tempVector2.y -= m_ExpandedSize.y / 2;
                    tempVector2.y += itemHeight / 2;
                    tempVector2.y += 8;
                }
                else if (m_VerticalPivotType == VerticalPivotType.LastItem)
                {
                    tempVector2.y -= m_ExpandedSize.y;
                    tempVector2.y += itemHeight;
                    tempVector2.y += 16;
                }
                tempVector2.y = Mathf.Clamp(tempVector2.y, minScrollPos, maxScrollPos);
                m_PanelLayer.anchoredPosition = tempVector2;

                m_ScrollPosOffset = tempVector2.y;
            }
            else
            {
                m_ScrollPosOffset = 0;
            }

            flipper = m_HorizontalPivotType == HorizontalPivotType.Left ? 1 : -1;

            if (m_HorizontalPivotType != HorizontalPivotType.Center)
            {
                position.x -= m_BaseTransform.GetProperSize().x *scaler.canvas.transform.localScale.x / 2 * flipper;
                position.x += m_ExpandedSize.x * scaler.canvas.transform.localScale.x / 2 * flipper;
            }

            RectTransform rootCanvasRectTransform = MaterialUIScaler.GetRootScaler(m_DropdownPanel).GetComponent <RectTransform>();

            //  Left edge
            float canvasEdge   = rootCanvasRectTransform.position.x / scaler.canvas.transform.localScale.x - rootCanvasRectTransform.rect.width / 2;
            float dropdownEdge = position.x / scaler.canvas.transform.localScale.x - m_ExpandedSize.x / 2;

            if (dropdownEdge < canvasEdge + m_MinDistanceFromEdge)
            {
                position.x += (canvasEdge + m_MinDistanceFromEdge - dropdownEdge) * scaler.canvas.transform.localScale.x;
            }

            //  Right edge
            canvasEdge   = rootCanvasRectTransform.position.x / scaler.canvas.transform.localScale.x + rootCanvasRectTransform.rect.width / 2;
            dropdownEdge = position.x / scaler.canvas.transform.localScale.x + m_ExpandedSize.x / 2;
            if (dropdownEdge > canvasEdge - m_MinDistanceFromEdge)
            {
                position.x -= (dropdownEdge - (canvasEdge - m_MinDistanceFromEdge)) * scaler.canvas.transform.localScale.x;
            }

            //  Top edge
            canvasEdge   = rootCanvasRectTransform.position.y / scaler.canvas.transform.localScale.x + rootCanvasRectTransform.rect.height / 2;
            dropdownEdge = position.y / scaler.canvas.transform.localScale.x + m_ExpandedSize.y / 2;
            if (dropdownEdge > canvasEdge - m_MinDistanceFromEdge)
            {
                position.y -= (dropdownEdge - (canvasEdge - m_MinDistanceFromEdge)) * scaler.canvas.transform.localScale.x;
            }

            //  Bottom edge
            canvasEdge   = rootCanvasRectTransform.position.y / scaler.canvas.transform.localScale.x - rootCanvasRectTransform.rect.height / 2;
            dropdownEdge = position.y / scaler.canvas.transform.localScale.x - m_ExpandedSize.y / 2;
            if (dropdownEdge < canvasEdge + m_MinDistanceFromEdge)
            {
                position.y += ((canvasEdge + m_MinDistanceFromEdge) - dropdownEdge) * scaler.canvas.transform.localScale.x;
            }

            return(position);
        }
示例#15
0
        /// <summary>
        /// Instantiates the dropdown object and expands it.
        /// </summary>
        public void Show()
        {
            Canvas rootCanvas = m_BaseTransform.GetRootCanvas();

            rootCanvas.CopySettingsToOtherCanvas(m_DropdownCanvas);
            m_DropdownCanvas.pixelPerfect = true;
            m_DropdownCanvas.sortingOrder = 30000;

            m_DropdownPanel       = PrefabManager.InstantiateGameObject(PrefabManager.ResourcePrefabs.dropdownPanel, m_DropdownCanvas.transform).GetComponent <RectTransform>();
            m_PanelLayer          = m_DropdownPanel.GetChildByName <RectTransform>("PanelLayer");
            m_DropdownCanvasGroup = m_DropdownPanel.GetComponent <CanvasGroup>();
            m_ShadowCanvasGroup   = m_DropdownPanel.GetChildByName <CanvasGroup>("Shadow");

            m_DropdownPanel.GetRootCanvas().scaleFactor = rootCanvas.scaleFactor;

            m_CancelPanel           = m_DropdownPanel.GetChildByName <RectTransform>("Cancel Panel");
            m_CancelPanel.sizeDelta = scaler.canvas.pixelRect.size * 2;
            DropdownTrigger trigger = m_DropdownPanel.gameObject.GetChildByName <DropdownTrigger>("Cancel Panel");

            trigger.index    = -1;
            trigger.dropdown = this;

            m_DropdownPanel.gameObject.GetChildByName <Image>("ScrollRect").color = m_PanelColor;

            m_ListItemTemplate = new DropdownListItem();

            m_ListItemTemplate.rectTransform = m_DropdownPanel.GetChildByName <RectTransform>("Item");
            m_ListItemTemplate.canvasGroup   = m_ListItemTemplate.rectTransform.GetComponent <CanvasGroup>();
            m_ListItemTemplate.text          = m_ListItemTemplate.rectTransform.GetChildByName <Text>("Text");

            if (m_OptionDataList.imageType == ImageDataType.Sprite)
            {
                m_ListItemTemplate.image = m_ListItemTemplate.rectTransform.GetChildByName <Image>("Icon");
                Destroy(m_ListItemTemplate.rectTransform.GetChildByName <VectorImage>("Icon").gameObject);
            }
            else
            {
                m_ListItemTemplate.image = m_ListItemTemplate.rectTransform.GetChildByName <VectorImage>("Icon");
                Destroy(m_ListItemTemplate.rectTransform.GetChildByName <Image>("Icon").gameObject);
            }

            m_ListItems = new List <DropdownListItem>();

            for (int i = 0; i < m_OptionDataList.options.Count; i++)
            {
                m_ListItems.Add(CreateItem(m_OptionDataList.options[i], i));
            }

            for (int i = 0; i < m_ListItems.Count; i++)
            {
                Selectable selectable = m_ListItems[i].rectTransform.GetComponent <Selectable>();
                Navigation navigation = new Navigation();
                navigation.mode = Navigation.Mode.Explicit;

                if (i > 0)
                {
                    navigation.selectOnUp = m_ListItems[i - 1].rectTransform.GetComponent <Selectable>();
                }
                if (i < m_ListItems.Count - 1)
                {
                    navigation.selectOnDown = m_ListItems[i + 1].rectTransform.GetComponent <Selectable>();
                }

                selectable.navigation = navigation;
            }

            if (m_BaseSelectable != null)
            {
                if (m_ListItems.Count > 0)
                {
                    Navigation navigation = Navigation.defaultNavigation;
                    navigation.selectOnDown     = m_ListItems[0].rectTransform.GetComponent <Selectable>();
                    m_BaseSelectable.navigation = navigation;
                }
            }

            float maxWidth    = CalculateMaxItemWidth();
            float buttonWidth = m_BaseTransform.rect.width;

            m_FullHeight = m_OptionDataList.options.Count * LayoutUtility.GetPreferredHeight(m_ListItemTemplate.rectTransform) + 16;

            m_ExpandedSize = new Vector2(Mathf.Max(maxWidth, buttonWidth), m_FullHeight);

            m_TempMaxHeight = m_MaxHeight;

            if (m_TempMaxHeight == 0)
            {
                m_TempMaxHeight = MaterialUIScaler.GetRootScaler(m_DropdownPanel).canvas.GetComponent <RectTransform>().rect.height - 32;
            }

            if (m_ExpandedSize.y > m_TempMaxHeight)
            {
                m_ExpandedSize.y = m_TempMaxHeight;
            }
            else
            {
                m_DropdownPanel.GetChildByName <Image>("Handle").gameObject.SetActive(false);
            }

            Destroy(m_ListItemTemplate.rectTransform.gameObject);

            m_DropdownPanel.position = m_BaseTransform.GetPositionRegardlessOfPivot();

            if (m_ExpandStartType == ExpandStartType.ExpandFromBaseTransformWidth)
            {
                if (m_VerticalPivotType == VerticalPivotType.BelowBase)
                {
                    m_DropdownPanel.position = new Vector3(m_DropdownPanel.position.x, m_DropdownPanel.position.y - m_BaseTransform.GetProperSize().y / 2, m_DropdownPanel.position.z);
                }
                else if (m_VerticalPivotType == VerticalPivotType.AboveBase)
                {
                    m_DropdownPanel.position = new Vector3(m_DropdownPanel.position.x, m_DropdownPanel.position.y + m_BaseTransform.GetProperSize().y / 2, m_DropdownPanel.position.z);
                }
            }


            m_ExpandedPosition   = CalculatedPosition();
            m_ExpandedPosition.z = m_BaseTransform.position.z;

            m_DropdownCanvasGroup.alpha = 0f;
            m_ShadowCanvasGroup.alpha   = 0f;

            if (m_ExpandStartType == ExpandStartType.ExpandFromBaseTransformWidth)
            {
                m_DropdownPanel.sizeDelta = new Vector2(m_BaseTransform.rect.size.x, 0f);
            }
            else if (m_ExpandStartType == ExpandStartType.ExpandFromBaseTransformHeight)
            {
                m_DropdownPanel.sizeDelta = new Vector2(0f, m_BaseTransform.rect.size.y);
            }
            else if (m_ExpandStartType == ExpandStartType.ExpandFromBaseTransformSize)
            {
                m_DropdownPanel.sizeDelta = m_BaseTransform.rect.size;
            }
            else
            {
                m_DropdownPanel.sizeDelta = Vector2.zero;
            }

            m_DropdownPanel.gameObject.SetActive(true);

            for (int i = 0; i < m_ListItemAutoTweeners.Count; i++)
            {
                TweenManager.EndTween(m_ListItemAutoTweeners[i]);
            }

            m_AutoTweeners         = new List <int>();
            m_ListItemAutoTweeners = new List <int>();

            m_AutoTweeners.Add(TweenManager.TweenFloat(f => m_DropdownCanvasGroup.alpha = f, m_DropdownCanvasGroup.alpha, 1f, m_AnimationDuration * 0.66f, 0, null, false, Tween.TweenType.Linear));
            m_AutoTweeners.Add(TweenManager.TweenFloat(f => m_ShadowCanvasGroup.alpha   = f, m_ShadowCanvasGroup.alpha, 1f, m_AnimationDuration * 0.66f, 0, null, false, Tween.TweenType.Linear));

            m_AutoTweeners.Add(TweenManager.TweenVector2(vector2 => m_DropdownPanel.sizeDelta = vector2, m_DropdownPanel.sizeDelta, m_ExpandedSize, m_AnimationDuration, m_AnimationDuration / 3, null, false, Tween.TweenType.EaseInOutQuint));

            m_AutoTweeners.Add(TweenManager.TweenVector3(UpdateDropdownPos, m_DropdownPanel.position, m_ExpandedPosition, m_AnimationDuration, m_AnimationDuration / 3, () =>
            {
                if (m_BaseSelectable != null && m_IsExapanded)
                {
                    m_BaseSelectable.interactable = false;
                }

                Vector2 tempVector2           = m_PanelLayer.anchoredPosition;
                tempVector2.x                 = Mathf.RoundToInt(tempVector2.x);
                tempVector2.y                 = Mathf.RoundToInt(tempVector2.y);
                m_PanelLayer.anchoredPosition = tempVector2;
            }, false, Tween.TweenType.EaseInOutQuint));

            for (int i = 0; i < m_ListItems.Count; i++)
            {
                int         i1          = i;
                CanvasGroup canvasGroup = m_ListItems[i].canvasGroup;
                m_ListItemAutoTweeners.Add(TweenManager.TweenFloat(f => canvasGroup.alpha = f, canvasGroup.alpha, 1f, m_AnimationDuration * 1.66f, (i1 * (m_AnimationDuration / 6) + m_AnimationDuration) - m_ScrollPosOffset / 800, null, false, Tween.TweenType.Linear));
            }

            if (m_FullHeight > m_TempMaxHeight)
            {
                m_DropdownPanel.GetChildByName <ScrollRect>("ScrollRect").gameObject.AddComponent <RectMask2D>();
            }

            m_IsExapanded = true;

            m_TimeShown = Time.unscaledTime;
        }