Esempio n. 1
0
    // 回收一个倒计时信息
    private void RecoveryTimerEvent(int uniqueId)
    {
        TimerEvent timerEvent = null;

        if (_timerEventDic.TryGetValue(uniqueId, out timerEvent))
        {
            return;
        }
        timerEvent.Clear();
        _freeTimerEventList.Add(timerEvent);
    }
Esempio n. 2
0
        public void Destroy()
        {
            if (destroy)
            {
                return;
            }

            try {
                if (children != null)
                {
                    for (PListNode n = children.next, next; n != children; n = next)
                    {
                        next = n.next;
                        IRenderObject child = (IRenderObject)n;
                        if (child != null)
                        {
                            child.SetParent(null);
                        }
                    }
                    children = null;
                }

                if (ctrls != null)
                {
                    foreach (IController c in ctrls.Values)
                    {
                        if (c != null)
                        {
                            c.Destroy();
                        }
                    }
                    ctrls.Clear();
                    ctrls = null;
                }

                if (timer != null)
                {
                    timer.Clear();
                }

                this.SetParent(null);
                this.OnDestroy();

                if (this.owner != null)
                {
                    this.owner.RemoveInstance(this);
                    this.owner = null;
                }
            } catch (Exception e) {
                LOG.LogError(e.ToString(), this.gameObject);
            }
            destroy = true;
        }
Esempio n. 3
0
    public void Stop()
    {
        if (!_isPlaying)
        {
            return;
        }

        _isPlaying = false;

        _timerEvent.Clear();
        _timerEvent = null;
    }
        public void Dispose()
        {
            try
            {
                RenderFactory.RemoveRenderObject(this);
                AssetBundleManager.UnloadAssetBundle(name);
                if (children != null)
                {
                    for (var n = children.next; n != children;)
                    {
                        var           next  = n.next;
                        IRenderObject child = (IRenderObject)n;
                        if (child != null)
                        {
                            child.Parent = null;
                        }
                        n = next;
                    }
                    children = null;
                }

                if (components != null)
                {
                    if (dict == null)
                    {
                        dict = new Dictionary <IRenderComponent, bool>();
                    }
                    dict.Clear();

                    for (int i = 0; i < tempComponents.Count; i++)
                    {
                        var c = tempComponents[i];
                        if (c == null)
                        {
                            continue;
                        }
                        if (dict.ContainsKey(c))
                        {
                            continue;
                        }
                        dict[c] = true;
                        c.Destroy();
                    }
                    tempComponents.Clear();

                    components.Clear();
                    components = null;
                }

                if (timer != null)
                {
                    timer.Clear();
                }

                this.Parent = null;
                this.OnDestroy();
            }
            catch (Exception e)
            {
                LOG.LogError(e.ToString(), this.gameObject);
            }
        }