示例#1
0
            protected override void RunTransition_Internal(UIGraphicEventState eventStateElement, float currentTransitionTime, float totalTransitionTime, Image image, Text text)
            {
                /*
                 *    For internal use only
                 *    ---------------------
                 *    Attempts to scale the Graphic object to its' desired target.
                 */

                if (image != null)
                {
                    Color elementColor = image.color;
                    elementColor = Color.Lerp(elementColor, _finalColor, currentTransitionTime / totalTransitionTime);
                    if (currentTransitionTime >= totalTransitionTime)
                    {
                        elementColor = _finalColor;
                    }

                    image.color = elementColor;
                }
                else if (text != null)
                {
                    Color elementColor = text.color;
                    elementColor = Color.Lerp(elementColor, _finalColor, currentTransitionTime / totalTransitionTime);
                    if (currentTransitionTime >= totalTransitionTime)
                    {
                        elementColor = _finalColor;
                    }

                    text.color = elementColor;
                }
            }
示例#2
0
            public void RunTransition(UIGraphicEventState eventStateElement, float currentTransitionTime, float totalTransitionTime)
            {
                /*
                 *    For internal use only
                 *    ---------------------
                 *    Runs the transition on the Graphic object
                 */

                if (!_enableTransition)
                {
                    return;
                }

                if (eventStateElement == null)
                {
                    return;
                }

                Image image = eventStateElement.imageElement;
                Text  text  = eventStateElement.textElement;

                if (image == null && text == null)
                {
                    return;
                }

                RunTransition_Internal(eventStateElement, currentTransitionTime, totalTransitionTime, image, text);
            }
示例#3
0
            protected override void RunTransition_Internal(UIGraphicEventState eventStateElement, float currentTransitionTime, float totalTransitionTime, Image image, Text text)
            {
                /*
                 *    For internal use only
                 *    ---------------------
                 *    Attempts to scale the target to its' desired target.
                 */

                eventStateElement.cachedRectTransform.localScale = Vector3.Lerp(eventStateElement.cachedRectTransform.localScale, _scale, currentTransitionTime / totalTransitionTime);
                if (currentTransitionTime >= totalTransitionTime)
                {
                    eventStateElement.cachedRectTransform.localScale = _scale;
                }
            }
示例#4
0
            protected override void RunTransition_Internal(UIGraphicEventState eventStateElement, float currentTransitionTime, float totalTransitionTime, Image image, Text text)
            {
                /*
                 *    For internal use only
                 *    ---------------------
                 *    Attempts to rotate the Graphic object to its' desired target.
                 */

                eventStateElement.cachedRectTransform.eulerAngles = Vector3.Lerp(eventStateElement.cachedRectTransform.eulerAngles, _rotation, currentTransitionTime / totalTransitionTime);
                if (currentTransitionTime >= totalTransitionTime)
                {
                    eventStateElement.cachedRectTransform.eulerAngles = _rotation;
                }
            }
示例#5
0
            protected override void RunTransition_Internal(UIGraphicEventState eventStateElement, float currentTransitionTime, float totalTransitionTime, Image image, Text text)
            {
                /*
                 *    For internal use only
                 *    ---------------------
                 *    Lerps the color of the Text object
                 */

                float elementFontSize = text.fontSize;

                elementFontSize = Mathf.Lerp(elementFontSize, _finalFontSize, currentTransitionTime / totalTransitionTime);
                text.fontSize   = (int)Mathf.Ceil(elementFontSize);
                if (currentTransitionTime >= totalTransitionTime)
                {
                    elementFontSize = _finalFontSize;
                }
            }
示例#6
0
            protected override void RunTransition_Internal(UIGraphicEventState eventStateElement, float currentTransitionTime, float totalTransitionTime, Image image, Text text)
            {
                /*
                 *    For internal use only
                 *    ---------------------
                 *    Attempts to scale the Graphic object to its' desired target.
                 */

                if (image != null)
                {
                    image.material = _finalMaterial;
                }
                else if (text != null)
                {
                    text.material = _finalMaterial;
                }
            }
示例#7
0
            protected override void RunTransition_Internal(UIGraphicEventState eventStateElement, float currentTransitionTime, float totalTransitionTime, Image image, Text text)
            {
                /*
                 *    For internal use only
                 *    ---------------------
                 *    Attempts to set the Image's sprite to the destination sprite
                 */

                if (image == null)
                {
                    return;
                }

                image.sprite = _finalSprite;
                if (_useImageFill)
                {
                    // We need to manually set the sprite to "filled" after we change from a potentially null sprite
                    if (image.sprite != null)
                    {
                        image.type       = Image.Type.Filled;
                        image.fillMethod = _fillMethod;

                        if (_fillType == FillType.IncrementFill)
                        {
                            image.fillAmount = currentTransitionTime / totalTransitionTime;
                        }
                        else
                        {
                            image.fillAmount = 1 - (currentTransitionTime / totalTransitionTime);
                        }
                    }
                }

                if (currentTransitionTime >= totalTransitionTime)
                {
                    if (_fillType == FillType.IncrementFill)
                    {
                        image.fillAmount = 1;
                    }
                    else if (_fillType == FillType.DecrementFill)
                    {
                        image.fillAmount = 0;
                    }
                }
            }
示例#8
0
            protected override void RunTransition_Internal(UIGraphicEventState eventStateElement, float currentTransitionTime, float totalTransitionTime, Image image, Text text)
            {
                /*
                 *    For internal use only
                 *    ---------------------
                 *    Changes the actual Text of a text element
                 */

                if (text == null)
                {
                    return;
                }

                string endText = text.text;

                if (!_writeoutOverDuration || currentTransitionTime >= totalTransitionTime)
                {
                    endText = _finalString;
                }
                else
                {
                    int   stringLength        = _finalString.Length;
                    float roughStringPosition = stringLength * (currentTransitionTime / totalTransitionTime);
                    int   finalStringLength   = Mathf.CeilToInt(roughStringPosition);
                    if (finalStringLength > stringLength)
                    {
                        finalStringLength = stringLength;
                    }

                    if (finalStringLength < 1)
                    {
                        finalStringLength = 1;
                    }

                    endText = _finalString.Substring(0, finalStringLength - 1);
                }

                text.text = endText;
            }
示例#9
0
 protected virtual void RunTransition_Internal(UIGraphicEventState eventStateElement, float currentTransitionTime, float totalTransitionTime, Image image, Text text)
 {
     throw new System.NotImplementedException();
 }