FairyGUI.GComponent.GetChildById C# (CSharp) Method

GetChildById() private method

private GetChildById ( string id ) : GObject
id string
return GObject
        internal GObject GetChildById(string id)
        {
            int cnt = _children.Count;
            for (int i = 0; i < cnt; ++i)
            {
                if (_children[i].id == id)
                    return _children[i];
            }

            return null;
        }

Usage Example

Beispiel #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;
                        }
                    }
                }
            }
        }
All Usage Examples Of FairyGUI.GComponent::GetChildById