void Start() { //_scriptId = gameObject.name; _textBags = GetComponentsInChildren<TextBag>().ToList(); if (_textBags == null) { return; } for (var i = 0; i < _textBags.Count; i++) { var id = _textBags[i].id; //If the id is not explicitly specified, set it to a default value if (String.IsNullOrEmpty(id)) { id = (i + 1).ToString("D2"); //Its place in the list with a padded zero. EX: "06", "15" _textBags[i].id = id; } var dialog = DialogRepository.Instance.GetDialogBit(_scriptId, id); _textBags[i].text = dialog.Text; _textBags[i].Name = dialog.Name; //Overwrite the given textbag's flag with the flag from the stored version if it exists if (dialog.Flag != null) { _textBags[i].flag = dialog.Flag; } } _currentTextBag = _textBags.First(); }
public void Activate(Action callback) { isActive = true; //TODO: less bad etc etc _currentTextBag = _textBags[1]; _examineCallback = callback; }
public void NextTextbag() { _sequentialTextbag = true; var index = _textBags.IndexOf(_currentTextBag); if (index < _textBags.Count - 1) { _currentTextBag = _textBags[index + 1]; } }
void Start() { if (Application.loadedLevelName == SceneMap.GetScene(Scene.Level1)) { _unreadDialogSignal = gameObject.AddComponent<UnreadDialogSignal>(); } //TODO: Automatically create textbins if one doesn't exist for a given piece of dialog _textBags = GetComponentsInChildren<TextBag>().ToList(); if (_textBags == null) { return; } for (var i = 0; i < _textBags.Count; i++) { var id = _textBags[i].id; //If the id is not explicitly specified, set it to a default value if (String.IsNullOrEmpty(id)) { id = (i + 1).ToString("D2"); //Its place in the list with a padded zero. EX: "06", "15" _textBags[i].id = id; } var dialog = DialogRepository.Instance.GetDialogBit(scriptId, id); _textBags[i].text = dialog.Text; _textBags[i].Name = dialog.Name; _textBags[i].Mumble = dialog.Mumble; ReadDialogMap.Add(_textBags[i].id, false); //Overwrite the given textbag's flag with the flag from the stored version if it exists if (dialog.Flag != null){ _textBags[i].flag = dialog.Flag;} } _currentTextBag = _textBags.First(); }
/* public void SetTextbag(string id) { foreach (var textBag in _textBags) { if (textBag.id == id) { _currentTextBag = textBag; return; } } Debug.LogError(String.Format("Tried to set textbag on signpost {0} to {1}, which does not exist")); }*/ public override IEnumerator Examine(Action callback) { if (!_sequentialTextbag) { _currentTextBag = GetCurrentTextBag(); } yield return StartCoroutine(TextboxDisplay.Instance.DisplayText(_currentTextBag.text, _currentTextBag.Name, () => {}, _currentTextBag.Mumble)); ReadDialogMap[_currentTextBag.id] = true; _currentTextBag.ExecuteAction(); if (_unreadDialogSignal != null) _unreadDialogSignal.UpdateStatuses(); callback(); }