private void CreateNewMoment(TextMoment newMoment) { Subtitle subtitle = new Subtitle(newMoment); _subtitles.Add(subtitle); _latestSubtitle = subtitle; }
public Subtitle(TextMoment firstMoment) { _textHistory = new List <TextMoment>() { firstMoment }; _latestMoment = firstMoment; }
private void Watcher_Changed(object sender, FileSystemEventArgs e) { if (e.ChangeType == WatcherChangeTypes.Changed || e.ChangeType == WatcherChangeTypes.Created) { string log = GetLog(e.FullPath); string latestLine = log.Split('\n').First(); string[] components = latestLine.Split(':'); long timeCode = Convert.ToInt64(components[0]); string text = components[1]; _newMoment = e.ChangeType == WatcherChangeTypes.Created; _improvedMoment = e.ChangeType == WatcherChangeTypes.Changed; _enquedMoment = new TextMoment(timeCode, text); } }
void Update() { if (_newMoment) { TextMoment moment = _enquedMoment; _newMoment = false; ImproveMoment(moment); } if (_improvedMoment) { TextMoment moment = _enquedMoment; _improvedMoment = false; CreateNewMoment(moment); } if (_latestSubtitle != null) { _textMesh.text = _latestSubtitle.LatestMoment.Text; } LookAtCamera(); }
private void ImproveMoment(TextMoment latestMoment) { _latestSubtitle.AddTextMoment(latestMoment); }
public void AddTextMoment(TextMoment moment) { _textHistory.Add(moment); _latestMoment = moment; }