Example #1
0
        public override bool ReadLine(string line)
        {
            if (UseVariables && _variables.Count > 0 && line.IndexOf('$') >= 0)
            {
                line = CheckVariables(line);
            }
            if ((line.StartsWith(" ") || line.StartsWith("_")) && _lastSpriteEvent != null)
            {
                LoopEvent             l;
                TriggerEvent          te;
                TransformationEvent[] transforms;
                if (LoopEvent.TryParse(line, out l))
                {
                    _lastSpriteEvent.Loopevents.Add(l);
                    _lastTransformable = l;
                }
                else if (TriggerEvent.TryParse(line, out te))
                {
                    _lastSpriteEvent.Triggerevents.Add(te);
                    _lastTransformable = te;
                }
                else if (TransformationEvent.TryParse(line, out transforms))
                {
                    if (!line.StartsWith("  ") && !line.StartsWith("__"))
                    {
                        _lastTransformable = _lastSpriteEvent;
                    }
                    foreach (var transform in transforms)
                    {
                        _lastTransformable?.AddTransformation(transform);
                    }
                    return(true);
                }
            }
            if (base.ReadLine(line))
            {
                return(true);
            }
            EventBase e;

            if (!EventBase.TryParse(line, out e))
            {
                return(false);
            }
            var sample = e as SampleEvent;

            if (sample != null)
            {
                _model.SampleEvents.Add(sample);
                return(true);
            }
            var spriteEvent = e as SpriteEvent;

            if (spriteEvent == null)
            {
                return(false);
            }
            _lastSpriteEvent   = spriteEvent;
            _lastTransformable = spriteEvent;
            _model.AddSpriteEvent(spriteEvent);
            return(true);
        }