示例#1
0
        /// <summary>
        /// 添加本对象的依赖
        /// </summary>
        /// <param name="target"></param>
        private void AddDepend(ABTarget target)
        {
            if (target == this || this.ContainsDepend(target))
            {
                return;
            }
            if (target.ContainsDepend(this))
            {
                Debug.LogError("出现循环依赖:" + target.bundleName + " 与 " + bundleName);
                return;
            }
            dependencies.Add(target);
            target.reverseDependencies.Add(this);

            //遍历依赖树依赖我的对象不需要再依赖该目标
            IEnumerable <ABTarget> cols = dependencies;

            cols = new ABTarget[] { target };
            foreach (var at in cols)
            {
                var e = reverseDependencies.GetEnumerator();
                while (e.MoveNext())
                {
                    ABTarget dc = e.Current;
                    if (dc == null)
                    {
                        continue;
                    }
                    dc.RemoveDepend(at);
                }
                e.Dispose();
            }
        }
示例#2
0
 /// <summary>
 /// 从依赖本对象的依赖列表中移除
 /// </summary>
 /// <param name="target"></param>
 private void RemoveReverseDepend(ABTarget target)
 {
     target.RemoveDepend(this);
 }