Esempio n. 1
0
 void UnpackRecursively(SegmentSequence sequence)
 {
     if (sequence.isCustom && sequence.customSequence != null)
     {
         GameObject[] customSequencePrefabs = sequence.customSequence.GetAllSegments();
         for (int j = 0; j < customSequencePrefabs.Length; j++)
         {
             GameObject   go = Instantiate(customSequencePrefabs[j]);
             LevelSegment ls = go.GetComponent <LevelSegment>();
             if (ls != null)
             {
                 UnpackSegment(ls);
             }
         }
         return;
     }
     for (int i = 0; i < sequence.segments.Length; i++)
     {
         if (sequence.segments[i].nested)
         {
             UnpackRecursively(sequence.segments[i].nestedSequence);
         }
         else
         {
             LevelSegment ls = sequence.segments[i].Instantiate();
             if (ls != null)
             {
                 UnpackSegment(ls);
             }
         }
     }
 }
Esempio n. 2
0
        private Glob(string text, SegmentSequence[] segments)
        {
            this.text = text;
            this.segments = segments;
            this.regexCache = new Lazy<Regex>(MakeRegex);

            this.Enumerator = MakeEnumerator();
        }
        static Exception _TryParse(string text, out SegmentSequence[] results2)
        {
            results2 = null;
            if (text == null)
                return new ArgumentNullException("text");
            if (text.Length == 0)
                return Failure.EmptyString("text");

            List<SegmentSequence> results = new List<SegmentSequence>();

            foreach (string sub in text.Split(';')) {

                if (Path.IsPathRooted(sub) && NoSpecialChars(sub)) {
                    RootedSegmentSequence sequence = new RootedSegmentSequence(sub);
                    results.Add(sequence);

                } else {
                    IteratedSegmentSequence segments;
                    _TryParseList(sub, out segments);
                    results.Add(segments);
                }
            }

            results2 = results.ToArray();
            return null;
        }