예제 #1
0
파일: Container.cs 프로젝트: zhalesi/ink
        protected Runtime.Object ContentWithPathComponent(Path.Component component)
        {
            if (component.isIndex)
            {
                if (component.index >= 0 && component.index < content.Count)
                {
                    return(content [component.index]);
                }

                // When path is out of range, quietly return nil
                // (useful as we step/increment forwards through content)
                else
                {
                    return(null);
                }
            }

            else if (component.isParent)
            {
                return(this.parent);
            }

            else
            {
                INamedContent foundContent = null;
                if (namedContent.TryGetValue(component.name, out foundContent))
                {
                    return((Runtime.Object)foundContent);
                }
                else
                {
                    throw new StoryException("Content '" + component.name + "' not found at path: '" + this.path + "'");
                }
            }
        }
예제 #2
0
        protected Object ContentWithPathComponent(Path.Component component)
        {
            if (component.isIndex)
            {
                if (component.index >= 0 && component.index < content.Count)
                {
                    return(content[component.index]);
                }

                // When path is out of range, quietly return nil
                // (useful as we step/increment forwards through content)
                else
                {
                    return(null);
                }
            }

            else if (component.isParent)
            {
                return(this.parent);
            }

            else
            {
                INamedContent foundContent = null;
                if (namedContent.TryGetValue(component.name, out foundContent))
                {
                    return((Object)foundContent);
                }
                else
                {
                    return(null);
                }
            }
        }