Esempio n. 1
0
        public void RemoveAll(bool _toEnd)
        {
            lock (dic) {
                Dictionary <int, SuperTweenUnit> tmpDic = dic;

                dic   = new Dictionary <int, SuperTweenUnit> ();
                toDic = new Dictionary <Action <float>, SuperTweenUnit> ();

                Dictionary <int, SuperTweenUnit> .ValueCollection.Enumerator enumerator = tmpDic.Values.GetEnumerator();

                while (enumerator.MoveNext())
                {
                    SuperTweenUnit unit = enumerator.Current;

                    if (_toEnd)
                    {
                        if (unit.dele != null)
                        {
                            unit.dele(unit.endValue);
                        }

                        if (unit.endCallBack != null)
                        {
                            unit.endCallBack();
                        }
                    }

                    unit.isRemoved = true;
                }
            }
        }
Esempio n. 2
0
        public void Remove(int _index, bool _toEnd)
        {
            lock (dic) {
                if (dic.ContainsKey(_index))
                {
                    SuperTweenUnit unit = dic [_index];

                    dic.Remove(_index);

                    if (unit.dele != null)
                    {
                        toDic.Remove(unit.dele);
                    }

                    if (_toEnd)
                    {
                        if (unit.dele != null)
                        {
                            unit.dele(unit.endValue);
                        }

                        if (unit.endCallBack != null)
                        {
                            unit.endCallBack();
                        }
                    }

                    unit.isRemoved = true;
                }
            }
        }
Esempio n. 3
0
        public void RemoveAll(bool _toEnd)
        {
            Dictionary <int, SuperTweenUnit> tmpDic = dic;

            dic = new Dictionary <int, SuperTweenUnit>();

            toDic = new Dictionary <Action <float>, SuperTweenUnit>();

            IEnumerator <SuperTweenUnit> enumerator = tmpDic.Values.GetEnumerator();

            while (enumerator.MoveNext())
            {
                SuperTweenUnit unit = enumerator.Current;

                if (_toEnd)
                {
                    if (unit.dele != null)
                    {
                        unit.dele(unit.endValue);
                    }

                    if (unit.endCallBack != null)
                    {
                        unit.endCallBack();
                    }
                }

                ReleaseUnit(unit);
            }
        }
Esempio n. 4
0
        public void RemoveWithTag(string _tag, bool _toEnd)
        {
            List <SuperTweenUnit> list = new List <SuperTweenUnit>();

            IEnumerator <SuperTweenUnit> enumerator = dic.Values.GetEnumerator();

            while (enumerator.MoveNext())
            {
                SuperTweenUnit unit = enumerator.Current;

                if (unit.tag == _tag)
                {
                    list.Add(unit);
                }
            }

            for (int i = 0; i < list.Count; i++)
            {
                SuperTweenUnit unit = list[i];

                dic.Remove(unit.index);

                if (unit.dele != null)
                {
                    toDic.Remove(unit.dele);
                }

                if (!_toEnd)
                {
                    ReleaseUnit(unit);
                }
            }

            if (_toEnd)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    SuperTweenUnit unit = list[i];

                    if (unit.dele != null)
                    {
                        unit.dele(unit.endValue);
                    }

                    if (unit.endCallBack != null)
                    {
                        unit.endCallBack();
                    }

                    ReleaseUnit(unit);
                }
            }
        }
Esempio n. 5
0
        public void RemoveWithTag(string _tag, bool _toEnd)
        {
            lock (dic) {
                List <SuperTweenUnit> list = new List <SuperTweenUnit> ();

                Dictionary <int, SuperTweenUnit> .ValueCollection.Enumerator enumerator = dic.Values.GetEnumerator();

                while (enumerator.MoveNext())
                {
                    SuperTweenUnit unit = enumerator.Current;

                    if (unit.tag != null && unit.tag.Equals(_tag))
                    {
                        list.Add(unit);
                    }
                }

                for (int i = 0; i < list.Count; i++)
                {
                    SuperTweenUnit unit = list [i];

                    dic.Remove(unit.index);

                    if (unit.dele != null)
                    {
                        toDic.Remove(unit.dele);
                    }

                    if (_toEnd)
                    {
                        if (unit.dele != null)
                        {
                            unit.dele(unit.endValue);
                        }

                        if (unit.endCallBack != null)
                        {
                            unit.endCallBack();
                        }
                    }

                    unit.isRemoved = true;
                }
            }
        }
Esempio n. 6
0
        // Update is called once per frame
        void Update()
        {
            if (dic.Count > 0)
            {
                float nowTime = Time.time;

                float nowUnscaleTime = Time.unscaledTime;

                IEnumerator <SuperTweenUnit> enumerator = dic.Values.GetEnumerator();

                while (enumerator.MoveNext())
                {
                    SuperTweenUnit unit = enumerator.Current;

                    float tempTime = 0;

                    if (unit.isFixed)
                    {
                        tempTime = nowUnscaleTime;
                    }
                    else
                    {
                        tempTime = nowTime;
                    }

                    if (tempTime > unit.startTime + unit.time)
                    {
                        if (unit.dele != null)
                        {
                            toList.Add(unit.index, unit.endValue);
                        }

                        endList.Add(unit.index);
                    }
                    else if (unit.dele != null)
                    {
                        float value = unit.startValue + (unit.endValue - unit.startValue) * (tempTime - unit.startTime) / unit.time;

                        toList.Add(unit.index, value);
                    }
                }

                if (toList.Count > 0)
                {
                    IEnumerator <KeyValuePair <int, float> > enumerator2 = toList.GetEnumerator();

                    while (enumerator2.MoveNext())
                    {
                        int index = enumerator2.Current.Key;

                        SuperTweenUnit unit;

                        if (dic.TryGetValue(index, out unit))
                        {
                            unit.dele(enumerator2.Current.Value);
                        }
                    }

                    toList.Clear();
                }

                if (endList.Count > 0)
                {
                    for (int i = 0; i < endList.Count; i++)
                    {
                        int index = endList[i];

                        SuperTweenUnit unit;

                        if (dic.TryGetValue(index, out unit))
                        {
                            dic.Remove(index);

                            if (unit.dele != null)
                            {
                                toDic.Remove(unit.dele);
                            }

                            if (unit.endCallBack != null)
                            {
                                unit.endCallBack();
                            }

                            ReleaseUnit(unit);
                        }
                    }

                    endList.Clear();
                }
            }
        }