Esempio n. 1
0
 /// <summary>
 /// Changes the effect.
 /// </summary>
 /// <param name="effect">Effect.</param>
 void ChangeEffect(UIButtonEffect effect, IUIButtonEffect alternetEffects)
 {
     if (!effect.isMainEffectEnable)
     {
         return;
     }
     effect.ApplyUIEffect(gameObject, transition, alternetEffects);
 }
Esempio n. 2
0
 public void ApplyUIEffect(GameObject container, ButtonTransitionStyle transition, IUIButtonEffect alternetEffect)
 {
     if (!_isMainEffectEnable)
     {
         return;
     }
     if (isEnable)
     {
         UpdateUI(container, transition, this, alternetEffect);
     }
     else if (alternetEffect.isEnable)
     {
         UpdateUI(container, transition, alternetEffect, alternetEffect);
     }
     for (int i = 0; i < childEffects.Count; i++)
     {
         if (childEffects[i].isEnable)
         {
             UpdateUI(childEffects[i].child, transition, childEffects[i], ((UIButtonEffect)alternetEffect).childEffects[i]);
         }
     }
 }
Esempio n. 3
0
        private void UpdateUI(GameObject container, ButtonTransitionStyle transition, IUIButtonEffect effect, IUIButtonEffect regularEffect)
        {
            if (!effect.isEnable)
            {
                return;
            }
            tmpSprite = null;
            bool isChangeColor = true;

            image = container.GetComponent <Image>();
            text  = container.GetComponent <Text>();
            if ((null == image && null == text))
            {
                return;
            }

            switch (transition)
            {
            case ButtonTransitionStyle.ColorSwap:
                tmpColor = effect.color;
                break;

            case ButtonTransitionStyle.ColorMultiplie:
                if (regularEffect.color.Equals(effect.color))
                {
                    tmpColor = effect.color;
                }
                else
                {
                    tmpColor = regularEffect.color * effect.color;
                }
                break;

            case ButtonTransitionStyle.SpriteSwap:
                tmpSprite     = effect.sprite != null ? effect.sprite : regularEffect.sprite;
                tmpColor      = effect.color;
                isChangeColor = false;
                break;

            default:
                return;

                break;
            }


            if (null != image)
            {
                if (null != tmpSprite)
                {
                    image.sprite = tmpSprite;
                }
                if (isChangeColor)
                {
                    image.color = tmpColor;
                }
            }
            else if (null != text)
            {
                text.color = tmpColor;
            }
        }