GetChildById() private method

private GetChildById ( string id ) : GObject
id string
return GObject
コード例 #1
0
        void InternalPlay(float delay)
        {
            _ownerBaseX = _owner.x;
            _ownerBaseY = _owner.y;

            _totalTasks = 0;
            int cnt = _items.Count;

            for (int i = 0; i < cnt; i++)
            {
                TransitionItem item = _items[i];
                if (item.targetId.Length > 0)
                {
                    item.target = _owner.GetChildById(item.targetId);
                }
                else
                {
                    item.target = _owner;
                }
                if (item.target == null)
                {
                    continue;
                }

                if (item.tween)
                {
                    float startTime = delay;
                    if (_reversed)
                    {
                        startTime += (_maxTime - item.time - item.duration);
                    }
                    else
                    {
                        startTime += item.time;
                    }
                    item.completed = false;
                    switch (item.type)
                    {
                    case TransitionActionType.XY:
                    case TransitionActionType.Size:
                        _totalTasks++;
                        if (startTime == 0)
                        {
                            StartTween(item);
                        }
                        else
                        {
                            item.tweener = DOVirtual.DelayedCall(startTime, () =>
                            {
                                item.tweener = null;
                                StartTween(item);
                            }, true);
                            if (_timeScale != 1)
                            {
                                item.tweener.timeScale = _timeScale;
                            }
                        }
                        break;

                    case TransitionActionType.Scale:
                    case TransitionActionType.Skew:
                    {
                        _totalTasks++;
                        Vector2 endValue;
                        if (_reversed)
                        {
                            item.value.f1 = item.endValue.f1;
                            item.value.f2 = item.endValue.f2;
                            endValue      = new Vector2(item.startValue.f1, item.startValue.f2);
                        }
                        else
                        {
                            item.value.f1 = item.startValue.f1;
                            item.value.f2 = item.startValue.f2;
                            endValue      = new Vector2(item.endValue.f1, item.endValue.f2);
                        }
                        item.tweener = DOTween.To(() => new Vector2(item.value.f1, item.value.f2),
                                                  val =>
                            {
                                item.value.f1 = val.x;
                                item.value.f2 = val.y;
                            }, endValue, item.duration);
                        SetupTween(item, startTime);
                        break;
                    }

                    case TransitionActionType.Alpha:
                    {
                        _totalTasks++;
                        float endValue;
                        if (_reversed)
                        {
                            item.value.f1 = item.endValue.f1;
                            endValue      = item.startValue.f1;
                        }
                        else
                        {
                            item.value.f1 = item.startValue.f1;
                            endValue      = item.endValue.f1;
                        }
                        item.tweener = DOTween.To(() => item.value.f1, v => item.value.f1 = v, endValue, item.duration);
                        SetupTween(item, startTime);
                        break;
                    }

                    case TransitionActionType.Rotation:
                    {
                        _totalTasks++;
                        int endValue;
                        if (_reversed)
                        {
                            item.value.f1 = item.endValue.i;
                            endValue      = item.startValue.i;
                        }
                        else
                        {
                            item.value.f1 = item.startValue.i;
                            endValue      = item.endValue.i;
                        }
                        item.tweener = DOTween.To(() => item.value.f1, v => item.value.f1 = v, endValue, item.duration);
                        SetupTween(item, startTime);
                        break;
                    }

                    case TransitionActionType.Color:
                    {
                        _totalTasks++;
                        Color endValue;
                        if (_reversed)
                        {
                            item.value.c = item.endValue.c;
                            endValue     = item.startValue.c;
                        }
                        else
                        {
                            item.value.c = item.startValue.c;
                            endValue     = item.endValue.c;
                        }
                        item.tweener = DOTween.To(() => item.value.c, v => item.value.c = v, endValue, item.duration);
                        SetupTween(item, startTime);
                        break;
                    }

                    case TransitionActionType.ColorFilter:
                    {
                        _totalTasks++;
                        Vector4 endValue;
                        if (_reversed)
                        {
                            item.value.f1 = item.endValue.f1;
                            item.value.f2 = item.endValue.f2;
                            item.value.f3 = item.endValue.f3;
                            item.value.f4 = item.endValue.f4;
                            endValue      = new Vector4(item.startValue.f1, item.startValue.f2, item.startValue.f3, item.startValue.f4);
                        }
                        else
                        {
                            item.value.f1 = item.startValue.f1;
                            item.value.f2 = item.startValue.f2;
                            item.value.f3 = item.startValue.f3;
                            item.value.f4 = item.startValue.f4;
                            endValue      = new Vector4(item.endValue.f1, item.endValue.f2, item.endValue.f3, item.endValue.f4);
                        }
                        item.tweener = DOTween.To(() => new Vector4(item.value.f1, item.value.f2, item.value.f3, item.value.f4),
                                                  v =>
                            {
                                item.value.f1 = v.x;
                                item.value.f2 = v.y;
                                item.value.f3 = v.z;
                                item.value.f4 = v.w;
                            },
                                                  endValue, item.duration);
                        SetupTween(item, startTime);
                        break;
                    }
                    }
                }
                else
                {
                    float startTime = delay;
                    if (_reversed)
                    {
                        startTime += (_maxTime - item.time);
                    }
                    else
                    {
                        startTime += item.time;
                    }
                    if (startTime == 0)
                    {
                        ApplyValue(item, item.value);
                    }
                    else
                    {
                        item.completed = false;
                        _totalTasks++;
                        item.tweener = DOVirtual.DelayedCall(startTime, () =>
                        {
                            item.tweener   = null;
                            item.completed = true;
                            _totalTasks--;

                            ApplyValue(item, item.value);
                            if (item.hook != null)
                            {
                                item.hook();
                            }

                            CheckAllComplete();
                        }, true);
                        if (_timeScale != 1)
                        {
                            item.tweener.timeScale = _timeScale;
                        }
                    }
                }
            }
        }
コード例 #2
0
        void InternalPlay(float delay)
        {
            _ownerBaseX = _owner.x;
            _ownerBaseY = _owner.y;

            _totalTasks = 0;
            int cnt = _items.Count;

            for (int i = 0; i < cnt; i++)
            {
                TransitionItem item = _items[i];
                if (item.targetId.Length > 0)
                {
                    item.target = _owner.GetChildById(item.targetId);
                }
                else
                {
                    item.target = _owner;
                }
                if (item.target == null)
                {
                    continue;
                }

                if (item.tween)
                {
                    float startTime = delay;
                    if (_reversed)
                    {
                        startTime += (_maxTime - item.time - item.duration);
                    }
                    else
                    {
                        startTime += item.time;
                    }
                    item.completed = false;
                    switch (item.type)
                    {
                    case TransitionActionType.XY:
                    case TransitionActionType.Size:
                        _totalTasks++;
                        if (startTime == 0)
                        {
                            StartTween(item);
                        }
                        else
                        {
                            item.tweener = DOVirtual.DelayedCall(startTime, () =>
                            {
                                item.tweener = null;
                                StartTween(item);
                            }, true);
                        }
                        break;

                    case TransitionActionType.Scale:
                    {
                        _totalTasks++;
                        Vector2 endValue;
                        if (_reversed)
                        {
                            item.value.f1 = item.endValue.f1;
                            item.value.f2 = item.endValue.f2;
                            endValue      = new Vector2(item.startValue.f1, item.startValue.f2);
                        }
                        else
                        {
                            item.value.f1 = item.startValue.f1;
                            item.value.f2 = item.startValue.f2;
                            endValue      = new Vector2(item.endValue.f1, item.endValue.f2);
                        }
                        item.tweener = DOTween.To(() => new Vector2(item.value.f1, item.value.f2),
                                                  val =>
                            {
                                item.value.f1 = val.x;
                                item.value.f2 = val.y;
                            }, endValue, item.duration)
                                       .SetEase(item.easeType)
                                       .SetUpdate(true)
                                       .OnStart(() => { if (item.hook != null)
                                                        {
                                                            item.hook();
                                                        }
                                                })
                                       .OnUpdate(() => { ApplyValue(item, item.value); })
                                       .OnComplete(() => { tweenComplete(item); });
                        if (startTime > 0)
                        {
                            item.tweener.SetDelay(startTime);
                        }
                        else
                        {
                            ApplyValue(item, item.value);
                        }
                        if (item.repeat != 0)
                        {
                            item.tweener.SetLoops(item.repeat == -1 ? int.MaxValue : (item.repeat + 1), item.yoyo ? LoopType.Yoyo : LoopType.Restart);
                        }
                        break;
                    }

                    case TransitionActionType.Alpha:
                    {
                        _totalTasks++;
                        float endValue;
                        if (_reversed)
                        {
                            item.value.f1 = item.endValue.f1;
                            endValue      = item.startValue.f1;
                        }
                        else
                        {
                            item.value.f1 = item.startValue.f1;
                            endValue      = item.endValue.f1;
                        }
                        item.tweener = DOTween.To(() => item.value.f1, v => item.value.f1 = v, endValue, item.duration)
                                       .SetEase(item.easeType)
                                       .SetUpdate(true)
                                       .OnStart(() => { if (item.hook != null)
                                                        {
                                                            item.hook();
                                                        }
                                                })
                                       .OnUpdate(() => { ApplyValue(item, item.value); })
                                       .OnComplete(() => { tweenComplete(item); });
                        if (startTime > 0)
                        {
                            item.tweener.SetDelay(startTime);
                        }
                        else
                        {
                            ApplyValue(item, item.value);
                        }
                        if (item.repeat != 0)
                        {
                            item.tweener.SetLoops(item.repeat == -1 ? int.MaxValue : (item.repeat + 1), item.yoyo ? LoopType.Yoyo : LoopType.Restart);
                        }
                        break;
                    }

                    case TransitionActionType.Rotation:
                    {
                        _totalTasks++;
                        int endValue;
                        if (_reversed)
                        {
                            item.value.i = item.endValue.i;
                            endValue     = item.startValue.i;
                        }
                        else
                        {
                            item.value.i = item.startValue.i;
                            endValue     = item.endValue.i;
                        }
                        item.tweener = DOTween.To(() => item.value.i, v => item.value.i = v, endValue, item.duration)
                                       .SetEase(item.easeType)
                                       .SetUpdate(true)
                                       .OnStart(() => { if (item.hook != null)
                                                        {
                                                            item.hook();
                                                        }
                                                })
                                       .OnUpdate(() => { ApplyValue(item, item.value); })
                                       .OnComplete(() => { tweenComplete(item); });
                        if (startTime > 0)
                        {
                            item.tweener.SetDelay(startTime);
                        }
                        else
                        {
                            ApplyValue(item, item.value);
                        }
                        if (item.repeat != 0)
                        {
                            item.tweener.SetLoops(item.repeat == -1 ? int.MaxValue : (item.repeat + 1), item.yoyo ? LoopType.Yoyo : LoopType.Restart);
                        }
                        break;
                    }
                    }
                }
                else
                {
                    float startTime = delay;
                    if (_reversed)
                    {
                        startTime += (_maxTime - item.time);
                    }
                    else
                    {
                        startTime += item.time;
                    }
                    if (startTime == 0)
                    {
                        ApplyValue(item, item.value);
                    }
                    else
                    {
                        item.completed = false;
                        _totalTasks++;
                        item.tweener = DOVirtual.DelayedCall(startTime, () =>
                        {
                            item.tweener   = null;
                            item.completed = true;
                            _totalTasks--;

                            ApplyValue(item, item.value);
                            if (item.hook != null)
                            {
                                item.hook();
                            }

                            CheckAllComplete();
                        }, true);
                    }
                }
            }
        }
コード例 #3
0
ファイル: Transition.cs プロジェクト: nqku/FairyGUI-unity
        void InternalPlay(float delay)
        {
            _ownerBaseX = _owner.x;
            _ownerBaseY = _owner.y;

            _totalTasks = 0;
            int cnt = _items.Count;

            for (int i = 0; i < cnt; i++)
            {
                TransitionItem item = _items[i];
                if (item.targetId.Length > 0)
                {
                    item.target = _owner.GetChildById(item.targetId);
                }
                else
                {
                    item.target = _owner;
                }
                if (item.target == null)
                {
                    continue;
                }

                if (item.tween)
                {
                    float startTime = delay;
                    if (_reversed)
                    {
                        startTime += (_maxTime - item.time - item.duration);
                    }
                    else
                    {
                        startTime += item.time;
                    }
                    if (startTime > 0 && (item.type == TransitionActionType.XY || item.type == TransitionActionType.Size))
                    {
                        _totalTasks++;
                        item.completed = false;
                        item.tweener   = DOVirtual.DelayedCall(startTime, item.delayedCallDelegate, true);
                        item.tweener.SetRecyclable();
                        if (_timeScale != 1)
                        {
                            item.tweener.timeScale = _timeScale;
                        }
                    }
                    else
                    {
                        StartTween(item, startTime);
                    }
                }
                else
                {
                    float startTime = delay;
                    if (_reversed)
                    {
                        startTime += (_maxTime - item.time);
                    }
                    else
                    {
                        startTime += item.time;
                    }
                    if (startTime == 0)
                    {
                        ApplyValue(item, item.value);
                    }
                    else
                    {
                        item.completed = false;
                        _totalTasks++;
                        item.tweener = DOVirtual.DelayedCall(startTime, item.delayedCallDelegate, true);
                        item.tweener.SetRecyclable();
                        if (_timeScale != 1)
                        {
                            item.tweener.timeScale = _timeScale;
                        }
                    }
                }
            }
        }