public void MoveTo(GlobalLineId id) { _player.MoveTo(id); }
internal void MoveTo(GlobalLineId id) { TraceVerbose($"Internal: moving to line {id.ToStringDebug()}"); if (id.ChapterId != null) { var chapter = _script.Chapters[id.ChapterId]; if (chapter == null) { throw new ArgumentException($"Chapter with id = {id.ChapterId.ToStringDebug()} is not found!"); } _progress.CurrentChapterId = chapter.Id; if (id.BlockId == null && id.LineId == null) { // Move to Chapter return; } } Block block = null; if (id.BlockId != null) { block = CurrentChapter.Blocks[id.BlockId]; if (block == null) { throw new ArgumentException($"Block with id = {id.ChapterId.ToStringDebug()} is not found in chapter {id.ChapterId}!"); } _progress.CurrentBlockId = block.Id; } else { // If chapter was reset during prev. step, set up dirst block. if (id.ChapterId != null) { _progress.CurrentBlockId = CurrentChapter.StartBlockId; } } Line line = null; if (id.LineId == null) { if (block == null) { throw new InvalidOperationException($"Cannot move to target cause Block and Line not specified!"); } line = block.GetFirstLine(); } else { line = CurrentBlock.Lines[id.LineId]; } if (line == null) { throw new ArgumentException($"Line with id = {id.LineId.ToStringDebug()} is not found in block {id.BlockId}, chapter = {id.ChapterId}!"); } _progress.CurrentLineId = line.Id; }