private string GetText(object text) { // InvokeRequired required compares the thread ID of the // calling thread to the thread ID of the creating thread. // If these threads are different, it returns true. if (this.richTextBox1.InvokeRequired) { getText d = new getText(GetText); return(Convert.ToString(this.Invoke(d, new object[] { text }))); } else { if (text.GetType() == typeof(TextBox)) { return(((TextBox)(text)).Text); } else if (text.GetType() == typeof(RichTextBox)) { return(((RichTextBox)(text)).Text); } else { return(""); } } }
public void addData() { if (chain) { if (input.text != "") { GameObject thisBlock = Instantiate(block, new Vector3(origin.transform.position.x, origin.transform.position.y - (origin.transform.localScale.y * 2), origin.transform.position.z), Quaternion.identity); thisBlock.name = "blockdata" + index; origin = thisBlock; getText blockData = GameObject.Find("blockdata" + index + "/blockData/data").GetComponent <getText>(); blockData.blockIndex = index; blockData.blocktext = input.text; input.text = ""; index++; } } else { if (input.text != "") { GameObject thisBlock = Instantiate(block, new Vector3(origin.transform.position.x, origin.transform.position.y - (origin.transform.localScale.y * 2), origin.transform.position.z), Quaternion.identity); thisBlock.name = "blockdata" + index; origin = thisBlock; getText blockData = GameObject.Find("blockdata" + index + "/blockData/data").GetComponent <getText>(); blockData.blocktext = input.text; input.text = ""; index++; } } }
void Start() { if (blockIndex != 0) { oldBlock = GameObject.Find(blockName + (blockIndex - 1) + "/blockData/data").GetComponent <getText>(); } showText = GetComponent <Text>(); }