//Search from the Start Node public void ShowDialogWithId(int dialogIdToLoad, bool goBackToBeginning) { //Nothiing at the beginning if (_messageBoxes.ContainsKey(dialogIdToLoad)) { return; } DialogNodeCanvas nodeCanvas; if (_dialogIdTracker.TryGetValue(dialogIdToLoad, out nodeCanvas)) //Checnk if We have already save the Start Node in to the Dictionary. { nodeCanvas.ActivateDialog(dialogIdToLoad, goBackToBeginning); } else { Debug.LogError("Not found Dialog with ID : " + dialogIdToLoad); } MessageBoxHud messageBox = GameObject.Instantiate(_messageBoxPrefab).GetComponent <MessageBoxHud>(); messageBox.Construct(dialogIdToLoad, this); messageBox.transform.SetParent(_canvasObject, false); messageBox.SetData(GetNodeForId(dialogIdToLoad)); _messageBoxes.Add(dialogIdToLoad, messageBox); }
public void ShowDialogWithId(int dialogIdToLoad, bool goBackToBeginning) { if (_messageBoxes.ContainsKey(dialogIdToLoad)) { return; } DialogNodeCanvas nodeCanvas; if (_dialogIdTracker.TryGetValue(dialogIdToLoad, out nodeCanvas)) { nodeCanvas.ActivateDialog(dialogIdToLoad, goBackToBeginning); } else { Debug.LogError("ShowDialogWithId Not found Dialog with ID : " + dialogIdToLoad); return; } MessageBoxHud messageBox = _messageBoxPrefab.GetComponent <MessageBoxHud>(); messageBox.gameObject.SetActive(true); messageBox.Construct(dialogIdToLoad, this); messageBox.transform.SetParent(_canvasObject, false); messageBox.SetData(GetNodeForId(dialogIdToLoad)); _messageBoxes.Add(dialogIdToLoad, messageBox); }