Exemple #1
0
        public static void DoColor(TSSItem item, float time)
        {
            if (item.image != null)
            {
                item.image.color = Color.LerpUnclamped(item.values.colors[0], item.values.colors[1], time);
            }
            else if (item.rawImage != null)
            {
                item.rawImage.color = Color.LerpUnclamped(item.values.colors[0], item.values.colors[1], time);
            }
            else if (item.text != null)
            {
                item.text.color = Color.LerpUnclamped(item.values.colors[0], item.values.colors[1], time);
            }
            else if (item.itemLight != null)
            {
                item.itemLight.color = Color.LerpUnclamped(item.values.colors[0], item.values.colors[1], time);
            }

            if (item.material == null || !item.material.HasProperty("_Color"))
            {
                return;
            }
            item.material.SetColor("_Color", Color.LerpUnclamped(item.values.colors[0], item.values.colors[1], time));
        }
Exemple #2
0
 public static void CaptureItemMaterialColor(TSSItem item, ItemKey key)
 {
     if (item.material != null && item.material.HasProperty("_Color"))
     {
         item.values.colors[(int)key] = item.material.GetColor("_Color");
     }
 }
Exemple #3
0
        public static void DoAllEffects(TSSItem item, float time)
        {
            float effectValue = 0.0f;

            for (int i = 0; i < item.tweens.Count; i++)
            {
                if (!item.tweens[i].enabled)
                {
                    continue;
                }

                if (item.tweens[i].mode == TweenMode.Multiple)
                {
                    effectValue = item.tweens[i].Evaluate(time, (item.IsClosed || item.isClosing) ?
                                                          item.tweens[i].closingType :
                                                          item.tweens[i].type);
                }
                else
                {
                    effectValue = item.tweens[i].Evaluate(time, item.tweens[i].type);
                }

                if (item.tweens[i].effect == ItemEffect.property)
                {
                    DoProperty(item, item.tweens[i].matProperty, effectValue);
                }
                else
                {
                    effects[(int)item.tweens[i].effect](item, effectValue);
                }
            }
        }
Exemple #4
0
        public static void Evaluate(this TSSItem item, float time)
        {
            float effectValue = 0.0f;

            if (item.state != ItemState.slave)
            {
                item.state = ItemState.slave;
            }
            for (int i = 0; i < item.tweens.Count; i++)
            {
                if (!item.tweens[i].enabled)
                {
                    continue;
                }

                effectValue = item.tweens[i].Evaluate(time, item.tweens[i].type);

                if (item.tweens[i].effect == ItemEffect.property)
                {
                    DoProperty(item, item.tweens[i].matProperty, effectValue);
                }
                else
                {
                    effects[(int)item.tweens[i].effect](item, effectValue);
                }
            }
        }
Exemple #5
0
 public static void DoText(TSSItem item, float time)
 {
     if (item.text != null)
     {
         item.text.text = TSSText.Lerp(item.values.texts[0], item.values.texts[1], time, item.values.randomWaveLength);
     }
 }
Exemple #6
0
        public static void CaptureItemUI(TSSItem item, ItemKey key)
        {
            if (item.canvasGroup != null)
            {
                item.values.alphas[(int)key] = item.canvasGroup.alpha;
            }
            else if (item.image != null)
            {
                item.values.alphas[(int)key]     = item.image.color.a;
                item.values.colors[(int)key]     = item.image.color;
                item.values.imageFills[(int)key] = item.image.fillAmount;
            }
            else if (item.rawImage != null)
            {
                item.values.alphas[(int)key] = item.rawImage.color.a;
                item.values.colors[(int)key] = item.rawImage.color;
            }
            else if (item.text != null)
            {
                item.values.alphas[(int)key] = item.text.color.a;
                item.values.colors[(int)key] = item.text.color;
                item.values.texts[(int)key]  = item.text.text;

                TSSText.Parse(item.text.text, out item.values.numbers[(int)key], out item.stringPart);
            }
        }
Exemple #7
0
 public static void CloseChilds(TSSItem item)
 {
     for (int i = 0; i < item.childItems.Count; i++)
     {
         Activate(item.childItems[i], item.childItems[i].activationClose);
     }
 }
Exemple #8
0
 public static void DoImageFill(TSSItem item, float time)
 {
     if (item.image != null)
     {
         item.image.fillAmount = Mathf.Lerp(item.values.imageFills[0], item.values.imageFills[1], time);
     }
 }
Exemple #9
0
        public static void Evaluate(this TSSItem item, float time, ItemKey direction)
        {
            float effectValue = 0;

            if (item.state != ItemState.slave)
            {
                item.state = ItemState.slave;
            }
            for (int i = 0; i < item.tweens.Count; i++)
            {
                if (!item.tweens[i].enabled ||
                    (direction == ItemKey.closed && item.tweens[i].direction != TweenDirection.Close && item.tweens[i].direction != TweenDirection.OpenClose) ||
                    (direction == ItemKey.opened && item.tweens[i].direction != TweenDirection.Open && item.tweens[i].direction != TweenDirection.OpenClose))
                {
                    continue;
                }

                TweenType type = item.tweens[i].mode == TweenMode.Single ? item.tweens[i].type :
                                 (direction == ItemKey.closed ? item.tweens[i].closingType : item.tweens[i].type);

                effectValue = item.tweens[i].Evaluate(time, type);

                if (item.tweens[i].effect == ItemEffect.property)
                {
                    DoProperty(item, item.tweens[i].matProperty, effectValue);
                }
                else
                {
                    effects[(int)item.tweens[i].effect](item, effectValue);
                }
            }
        }
Exemple #10
0
 public static void EvaluateBranch(this TSSItem item, float time, ItemKey direction)
 {
     Evaluate(item, time, direction);
     for (int i = 0; i < item.childItems.Count; i++)
     {
         EvaluateBranch(item.childItems[i], time, direction);
     }
 }
Exemple #11
0
 public static void OpenCloseBranchImmediately(TSSItem item)
 {
     OpenCloseImmediately(item);
     for (int i = 0; i < item.childItems.Count; i++)
     {
         OpenCloseBranchImmediately(item.childItems[i]);
     }
 }
Exemple #12
0
 public static void CloseImmediately(TSSItem item)
 {
     TSSBehaviour.RemoveItem(item);
     item.state = ItemState.closed;
     item.time  = 0;
     DoAllEffects(item, item.time);
     item.stateChgTime = 0;
 }
Exemple #13
0
 public static void CloseBranch(TSSItem item)
 {
     Close(item);
     item.stateChgBranchMode = true;
     if (item.closeChildBefore)
     {
         CloseChilds(item);
     }
 }
Exemple #14
0
 public static void CaptureItemLight(TSSItem item, ItemKey key)
 {
     if (item.itemLight != null)
     {
         item.values.colors[(int)key]      = item.itemLight.color;
         item.values.lightRange[(int)key]  = item.itemLight.range;
         item.values.intensities[(int)key] = item.itemLight.intensity;
     }
 }
Exemple #15
0
 public static void OpenBranch(TSSItem item)
 {
     Open(item);
     item.stateChgBranchMode = true;
     if (item.openChildBefore)
     {
         OpenChilds(item);
     }
 }
Exemple #16
0
 public static void DoNumber(TSSItem item, float time)
 {
     if (item.text == null)
     {
         return;
     }
     item.text.text = string.Format("{0}{1}", Mathf.LerpUnclamped(item.values.numbers[0], item.values.numbers[1], time)
                                    .ToString(item.values.floatFormat, System.Globalization.CultureInfo.InvariantCulture)
                                    .Replace(string.Format("<{0}>", TSSPrefs.Symbols.dot), string.Empty).Replace("<>", string.Empty), item.stringPart);
 }
Exemple #17
0
 public TSSItemActivator(TSSItem item)
 {
     this.item = item;
     if (item == null)
     {
         return;
     }
     mode[0] = item.values.activations[0];
     mode[1] = item.values.activations[1];
 }
Exemple #18
0
        public static Transform GetItemParentTransform(TSSItem item)
        {
            Transform parent = item.transform.parent;

            while (parent != null && (parent.GetComponent <TSSItem>() == null || (parent.GetComponent <TSSItem>() != null && !parent.GetComponent <TSSItem>().enabled)))
            {
                parent = parent.parent;
            }
            return(parent);
        }