Exemplo n.º 1
0
        /// <summary>
        /// Gets the dependency root object.
        /// </summary>
        public IPathNode GetDependencyRoot(IPathNode source)
        {
            if (source == null)
            {
                return(null);
            }
            if (DependencyRootType.IsAssignableFrom(source.GetType()))
            {
                return(source);
            }
            var current = source;

            while (null != (current = current.Parent))
            {
                if (DependencyRootType.IsAssignableFrom(current.GetType()))
                {
                    return(current);
                }
            }
            return(null);
        }
Exemplo n.º 2
0
        public IPathNode AddChild(IPathNode child)
        {
            if (mPathes.ContainsKey(child.Name))
            {
                if (mPathes[child.Name].GetType() != child.GetType())
                {
                    EB.Debug.LogError("MapNode.AddChild: child type not match, path: {0} current: {1} input: {2}",
                                      mPathes[child.Name].FullPath, mPathes[child.Name].GetType().ToString(), child.GetType().ToString());
                    return(null);
                }

                return(mPathes[child.Name]);
            }

            mPathes[child.Name] = child as IDataNode;
            child.Parent        = this;
            child.FullPath      = !string.IsNullOrEmpty(FullPath) ? FullPath + "." + child.Name : child.Name;

//#if DEBUG
////			DebugSystem.RegisterSystem(child.FullPath, mPathes[child.Name], string.IsNullOrEmpty(FullPath) ? "Game Data Root Node" : FullPath);
//#endif

            return(child);
        }
Exemplo n.º 3
0
        public IPathNode AddChild(IPathNode child)
        {
            if (mDefaultPath != null)
            {
                if (mDefaultPath.GetType() != child.GetType())
                {
                    EB.Debug.LogError("ArrayNode.AddChild: child type not match, path: {0} current: {1} input: {2}",
                                      mDefaultPath.FullPath, mDefaultPath.GetType().ToString(), child.GetType().ToString());
                    return(null);
                }

                return(mDefaultPath);
            }

            mDefaultPath          = child as IDataNode;
            mDefaultPath.Parent   = this;
            mDefaultPath.FullPath = FullPath + "[]";

//#if DEBUG
////			DebugSystem.RegisterSystem(child.FullPath, mDefaultPath, string.IsNullOrEmpty(FullPath) ? "Game Data Root Node" : FullPath);
//#endif

            return(mDefaultPath);
        }