void Update() { string c = Input.inputString; if (Input.GetKeyDown(KeyCode.Backspace)) { rawstm.text = rawstm.text.Substring(0, rawstm.text.Length - 1); //remove last character rawstm.Rebuild(); } for (int i = 0, iL = c.Length; i < iL; i++) { if (c[i] == '\b') //backspace? //if(rawstm.text.Length > 0){ // rawstm.text = rawstm.text.Substring(0, rawstm.text.Length-1); //remove last character //} { } else { //if(c == '\n' || c == '\r'){ //enter key was pressed //} rawstm.text += c[i].ToString(); } } if (c.Length > 0) { rawstm.Rebuild(); } }
public void StartDialogue(Dialogue dialogue) { if (!inDialogue) { inDialogue = true; foreach (string line in dialogue.lines) { currentLines.Add(line); } currentIndex = 0; if (currentLines.Count > 0) { maxIndex = currentLines.Count - 1; } textUI.text = currentLines[0]; textUI.Rebuild(); } }
public void SetItem(ItemPackage pack) { var data = GM.instance.itemData[pack.type]; icon.sprite = data.sprite; if (pack.number == 1) { textMesh.text = "You got a " + data.name + "!"; } else { textMesh.text = "You got " + pack.number + " " + data.name + "s!"; } GM.instance.player.SubscribeToInteract(OnActionPressed); this.gameObject.SetActive(true); textMesh.Rebuild(); }
public void Advance() { if (textMesh.reading) { textMesh.SkipToEnd(); } else { if (messageIndex < messages.Count - 1) { messageIndex++; textMesh.text = messages[messageIndex]; textMesh.Rebuild(); } else { if (finishedReadingCallback != null) { finishedReadingCallback(); } Destroy(this.gameObject); } } }
private void Update() { superTextMesh.color = color; superTextMesh.Rebuild(); }