public void Initialize(TextboxController textboxController, TextSpeed textSpeed, int linesPerTextbox) { this.textboxController = textboxController; if (font == null) { LoadDefaultFont(); } this.linesPerTextbox = linesPerTextbox; this.textSpeed = textSpeed; if (fontScaler == null) { fontScaler = new AutoFontScaler(); } if (autoFontSize) { SetAutoFontSize(); } SetHigherSpeed(); }
void HandleDisplayingTextbox() { // Create and initialize the textbox Debug.Log(this.name + " displaying textbox."); GameController.S.RequestGamePause(); textbox = Textbox.Create(textboxPrefab.gameObject); tbController = textbox.GetComponent <TextboxController>(); tbController.ApplyTextSettings(dialogueUI.textSettings); // Make sure the textbox shows up dialogueUI.needsDialogueCanvas.Add(this.gameObject); tbController.rectTransform.SetParent(dialogueCanvas.transform, false); tbController.nameTagText = "System"; HidePortrait(); PrepareForTextboxEnd(); tbController.gameObject.SetActive(false); // ^ Need to do this to avoid a weird visual effect. Don't worry, the textbox gets reenabled // right before it's time for it to display the text. StartCoroutine(DisplayTextDelayed(Time.deltaTime * 2)); }
/// Starts the games. public IEnumerator StartGame() { currentBoard = Instantiate(boardPrefab); // Give player basic deck yield return(StartCoroutine(TextboxController.ShowText("Welcom to the game"))); //Stacks all the cards into their character's deck yield return(StartCoroutine(currentBoard.Initialize(Instantiate(characterPrefab), CreateEnemy()))); }
// Start is called before the first frame update void Start() { if (instance == null) { instance = this; } else { Debug.LogError("There's already a Textbox Controller"); Destroy(this); } }
// Use this for initialization void Awake() { mainText = GetComponent <Text>(); promptText = transform.GetComponentInChildren <Text>(); panel = transform.parent.gameObject; canvasRenderer = panel.GetComponent <CanvasRenderer>(); panel.SetActive(false); prompt = promptText.text; promptText.text = ""; controller = this; }
public void Initialize(TextboxController tbText) { this.textboxController = tbText; if (font == null) { LoadDefaultFont(); } SetHigherSpeed(); if (fontScaler == null) { fontScaler = new AutoFontScaler(); } if (autoFontSize) { SetAutoFontSize(); } }
public bool gotoNextSentence() { currentSentence++; if (currentSentence > sentences.Length - 1) { currentSentence = -1; TextboxController currentTextBoxController = currentTextBox.GetComponent <TextboxController>(); currentTextBoxController.FadeOutTextBox(); } else { if (currentSentence != 0) { TextboxController currentTextBoxController = currentTextBox.GetComponent <TextboxController>(); currentTextBoxController.FadeOutTextBox(); } currentTextBox = (GameObject)Instantiate(textBox, this.transform.position, this.transform.rotation); currentTextBox.transform.parent = this.transform; currentTextBox.transform.position = new Vector3(this.transform.position.x, this.transform.position.y + (12f * (this.transform.localScale.y / 5)), this.transform.position.z); currentTextBox.transform.rotation = transform.rotation; currentTextBox.transform.Rotate(new Vector3(0, 90, 0)); currentTextBox.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f); setTextOfCurrentTextBox(sentences[currentSentence]); TextboxController newCurrentTextBoxController = currentTextBox.GetComponent <TextboxController>(); newCurrentTextBoxController.SetInvisible(); newCurrentTextBoxController.FadeInTextBox(); } if (currentSentence != -1) { return(true); } else { return(false); } }
void CreateTextbox() { if (textbox == null) { textbox = Textbox.Create(textboxPrefab); textboxController = textbox.GetComponent <TextboxController> (); textboxController.DoneDisplayingText.AddListener(ResumeDialogueRunning); EndedDialogue.AddListener(textboxController.Close); textbox.transform.SetParent(dialogueCanvas.transform, false); textboxController.PlaceOnScreen(new Vector2(0.5f, 0.0f)); if (textSettings.font != null) { textboxController.font = textSettings.font; } textSettings.Initialize(textboxController); textboxController.ApplyTextSettings(textSettings); // Have the textbox be invisible until it is time to show it CanvasGroup cGroup = textbox.AddComponent <CanvasGroup>(); cGroup.alpha = 0; cGroup.blocksRaycasts = false; } }
// Start is called before the first frame update void Start() { rb = GetComponent <Rigidbody2D>(); textbox = GameObject.FindGameObjectWithTag("Textbox").GetComponent <TextboxController>(); sr = GetComponent <SpriteRenderer>(); }
public void Initialize(TextboxController tbController) { textboxController = tbController; }