private static void SetupCanvas(UnityUIDialogueUI ui, DialogueSystemController dialogueManager) { if (FindObjectOfType <UnityEngine.EventSystems.EventSystem>() == null) { new GameObject("EventSystem", typeof(UnityEngine.EventSystems.EventSystem), typeof(UnityEngine.EventSystems.StandaloneInputModule), typeof(UnityEngine.EventSystems.TouchInputModule)); } var canvas = dialogueManager.GetComponentInChildren <Canvas>(); if (canvas == null) { var canvasObject = new GameObject("Canvas"); canvasObject.layer = 5; // Built-in UI layer. canvasObject.AddComponent <Canvas>(); canvasObject.AddComponent <UnityEngine.UI.CanvasScaler>(); canvasObject.AddComponent <UnityEngine.UI.GraphicRaycaster>(); canvas = canvasObject.GetComponent <Canvas>(); canvas.renderMode = RenderMode.ScreenSpaceOverlay; canvasObject.transform.SetParent(dialogueManager.transform); } var uiInstance = Instantiate(ui) as UnityUIDialogueUI; uiInstance.transform.SetParent(canvas.transform, false); dialogueManager.displaySettings.dialogueUI = uiInstance.gameObject; }
public void Awake() { if (dialogueUI == null) { dialogueUI = Tools.GetComponentAnywhere<UnityUIDialogueUI>(gameObject); } if (typewriterEffect == null) { typewriterEffect = GetComponentInChildren<UnityUITypewriterEffect>(); } }
private bool FindDialogueUI() { if (dialogueUI == null && DialogueManager.DisplaySettings.dialogueUI) { dialogueUI = DialogueManager.DisplaySettings.dialogueUI.GetComponent <UnityUIDialogueUI>(); } return(dialogueUI != null); }
public virtual void Awake() { if (dialogueUI == null) { dialogueUI = Tools.GetComponentAnywhere <UnityUIDialogueUI>(gameObject); } if (typewriterEffect == null) { typewriterEffect = GetComponentInChildren <UnityUITypewriterEffect>(); } }
public static void HandleUnityUIDialogueUI(UnityUIDialogueUI ui, DialogueSystemController dialogueManager) { if (ui == null) return; if (Tools.IsPrefab(ui.gameObject) && (ui.GetComponentInParent<Canvas>() == null)) { if (EditorUtility.DisplayDialog("Unity UI Dialogue UI", "A Unity UI Dialogue UI must be a child of a Canvas. Add a Canvas (if needed) and an instance of the dialogue UI to the Dialogue Manager?", "OK", "Cancel")) { SetupCanvas(ui, dialogueManager); } else { dialogueManager.displaySettings.dialogueUI = null; } } }
public virtual void Awake() { if (dialogueUI == null) { dialogueUI = Tools.GetComponentAnywhere <UnityUIDialogueUI>(gameObject); } if (typewriterEffect == null) { typewriterEffect = GetComponentInChildren <UnityUITypewriterEffect>(); } continueButton = GetComponent <UnityEngine.UI.Button>(); Tools.DeprecationWarning(this); }
/// <summary> /// Sends "OnTextChange(text)" to the dialogue UI GameObject. /// </summary> /// <param name="text"></param> public static void SendTextChangeMessage(UnityEngine.UI.Text text) { if (text == null) { return; } if (dialogueUI == null) { dialogueUI = text.GetComponentInParent <UnityUIDialogueUI>(); } if (dialogueUI == null) { return; } dialogueUI.SendMessage("OnTextChange", text, SendMessageOptions.DontRequireReceiver); }
public static void HandleUnityUIDialogueUI(UnityUIDialogueUI ui, DialogueSystemController dialogueManager) { if (ui == null) { return; } if (Tools.IsPrefab(ui.gameObject) && (ui.GetComponentInParent <Canvas>() == null)) { if (EditorUtility.DisplayDialog("Unity UI Dialogue UI", "A Unity UI Dialogue UI must be a child of a Canvas. Add a Canvas (if needed) and an instance of the dialogue UI to the Dialogue Manager?", "OK", "Cancel")) { SetupCanvas(ui, dialogueManager); } else { dialogueManager.displaySettings.dialogueUI = null; } } }
public void Start() { // Add your initialization code here. You can use the GetParameter***() and GetSubject() // functions to get information from the command's parameters. You can also use the // Sequencer property to access the SequencerCamera, CameraAngle, Speaker, Listener, // and other properties on the sequencer. If IsAudioMuted() is true, the player has // muted audio. // // If your sequencer command only does something immediately and then finishes, // you can call Stop() here and remove the Update() method. //Debug.Log ("Waiting for Sequence to end before showing text field!"); if (dialogueUI == null) { //Debug.Log ("Forcing Continue Bypass!"); dialogueUI = Tools.GetComponentAnywhere<UnityUIDialogueUI>(gameObject); if (dialogueUI != null) dialogueUI.OnContinue (); } Stop (); }
private static void SetupCanvas(UnityUIDialogueUI ui, DialogueSystemController dialogueManager) { if (FindObjectOfType<UnityEngine.EventSystems.EventSystem>() == null) { new GameObject("EventSystem", typeof(UnityEngine.EventSystems.EventSystem), typeof(UnityEngine.EventSystems.StandaloneInputModule), typeof(UnityEngine.EventSystems.TouchInputModule)); } var canvas = dialogueManager.GetComponentInChildren<Canvas>(); if (canvas == null) { var canvasObject = new GameObject("Canvas"); canvasObject.layer = 5; // Built-in UI layer. canvasObject.AddComponent<Canvas>(); canvasObject.AddComponent<UnityEngine.UI.CanvasScaler>(); canvasObject.AddComponent<UnityEngine.UI.GraphicRaycaster>(); canvas = canvasObject.GetComponent<Canvas>(); canvas.renderMode = RenderMode.ScreenSpaceOverlay; canvasObject.transform.SetParent(dialogueManager.transform); } var uiInstance = Instantiate(ui) as UnityUIDialogueUI; uiInstance.transform.SetParent(canvas.transform, false); dialogueManager.displaySettings.dialogueUI = uiInstance.gameObject; }
public virtual void ApplyToDialogueUI(UnityUIDialogueUI ui) { if (checkedContinueButton) { return; } if (subtitle != null && subtitle.continueButton != null) { // Make sure continue button is connected: if (subtitle.continueButton.onClick.GetPersistentEventCount() == 0 || // OnClick() unassigned or subtitle.continueButton.onClick.GetPersistentTarget(0) == null) // OnClick() target is null: { subtitle.continueButton.onClick.AddListener(ui.OnContinue); } // If continue button has fast forward, make sure its UI reference is connected: var ffwd = subtitle.continueButton.GetComponent <UnityUIContinueButtonFastForward>(); if (ffwd != null && ffwd.dialogueUI == null) { ffwd.dialogueUI = ui; } } checkedContinueButton = true; }
private bool FindDialogueUI() { if (dialogueUI == null && DialogueManager.DisplaySettings.dialogueUI) { dialogueUI = DialogueManager.DisplaySettings.dialogueUI.GetComponent<UnityUIDialogueUI>(); } return (dialogueUI != null); }