예제 #1
0
 public void Close()
 {
     if (item != null && enabled)
     {
         TSSItemBase.Activate(item, overrideModes ? mode[0] : item.activationClose);
     }
 }
예제 #2
0
 public void ActivateManualy(ActivationMode mode)
 {
     if (item != null && enabled)
     {
         TSSItemBase.Activate(item, mode);
     }
 }
예제 #3
0
 public void Open()
 {
     if (item != null && enabled)
     {
         TSSItemBase.Activate(item, overrideModes ? mode[1] : item.activationOpen);
     }
 }
예제 #4
0
        /// <summary>Manualy refresh all items inheritances and activate start states. Strongly not recommended for manual use</summary>
        public static void RefreshAndStart()
        {
            for (int i = 0; i < AllItems.Count; i++)
            {
                if (AllItems[i].parent == null)
                {
                    AllItems[i].Refresh();
                }
                TSSItemBase.Activate(AllItems[i], AllItems[i].activationStart);
            }

            for (int i = 0; i < cores.Count; i++)
            {
                cores[i].SelectDefaultState();
            }
        }
예제 #5
0
        private void UpdateItem(TSSItem item, float deltaTime)
        {
            if (!item.enabled)
            {
                return;
            }

            item.deltaTime = deltaTime;

            switch (item.state)
            {
            case ItemState.opening:
                if (item.stateChgTime >= 0)
                {
                    item.stateChgTime -= deltaTime;
                    if (item.stateChgTime > 0)
                    {
                        break;
                    }
                    for (int i = 0; i < item.tweens.Count; i++)
                    {
                        item.tweens[i].blendTime = 0;
                    }
                    if (item.stateChgBranchMode && !item.openChildBefore)
                    {
                        TSSItemBase.OpenChilds(item);
                    }
                }
                else if (item.time < 1)
                {
                    item.time += deltaTime / item.openDuration;
                }
                else if (item.childStateCounts[(int)ItemState.opened] == item.childCountWithoutLoops)
                {
                    item.time  = 1;
                    item.state = ItemState.opened;
                }

                item.UpdateInput();

                for (int i = 0; i < item.tweens.Count; i++)
                {
                    item.tweens[i].Update();
                }
                break;

            case ItemState.closing:
                if (item.stateChgTime >= 0)
                {
                    item.stateChgTime -= deltaTime;
                    if (item.stateChgTime > 0)
                    {
                        break;
                    }
                    for (int i = 0; i < item.tweens.Count; i++)
                    {
                        item.tweens[i].blendTime = 0;
                    }
                    if (item.stateChgBranchMode && !item.closeChildBefore)
                    {
                        TSSItemBase.CloseChilds(item);
                    }
                }
                else if (item.time > 0)
                {
                    item.time -= deltaTime / item.closeDuration;
                }
                else if (item.childStateCounts[(int)ItemState.closed] == item.childCountWithoutLoops)
                {
                    item.time  = 0;
                    item.state = ItemState.closed;
                    if (!item.loopActivated)
                    {
                        RemoveItem(item);
                    }
                }

                for (int i = 0; i < item.tweens.Count; i++)
                {
                    item.tweens[i].Update();
                }
                break;

            case ItemState.closed:

                if (!item.loopActivated)
                {
                    RemoveItem(item);
                    if (!Application.isPlaying)
                    {
                        break;
                    }
                }

                if (item.currentLoops > 0 || item.loops < 0)
                {
                    TSSItemBase.Activate(item, item.activationOpen);
                    item.loopActivated = true;
                    item.stateChgTime  = 0;
                    break;
                }

                item.loopActivated = false;

                return;

            case ItemState.opened:

                item.UpdateInput();

                item.UpdateMedia();

                if (item.loops == 0 || !Application.isPlaying)
                {
                    break;
                }

                if (!item.loopActivated)
                {
                    item.loopActivated = true; item.currentLoops = item.loops;
                }

                if (item.currentLoops > 0 || item.loops < 0)
                {
                    float time = item.time;

                    TSSItemBase.Activate(item, item.loopMode);
                    item.loopActivated = true;
                    if (item.loops > 0)
                    {
                        item.currentLoops--;
                    }
                    if (item.loopMode == ActivationMode.closeImmediately ||
                        item.loopMode == ActivationMode.closeBranchImmediately)
                    {
                        item.time = time - 1;
                        UpdateItem(item, deltaTime);
                    }
                }

                break;
            }

            item.UpdateButton(deltaTime);
            if (item.path != null)
            {
                item.path.UpdatePath();
            }
        }