private void readInput() { try { _rawEingabe = terminalBody.transform.GetChild(terminalBody.transform.childCount - 1).GetComponentInChildren <InputField>().text; _rawEingabe.ToString(); while (_tmphistory.Count > 0) { _rawEingabenHistory.Push(_tmphistory.Pop()); } _rawEingabenHistory.Push(_rawEingabe); if (_rawEingabenHistory.Count > 10) { while (_rawEingabenHistory.Count > 1) { _tmphistory.Push(_rawEingabenHistory.Pop()); } _rawEingabenHistory.Pop(); while (_tmphistory.Count > 0) { _rawEingabenHistory.Push(_tmphistory.Pop()); } } if (_rawEingabe != "")//hat der User überhaubt was geschrieben ? { _eingabe = _rawEingabe.Split(' '); string[] option = new string[] { "", "" }; if (_eingabe.Length > 1) { option[0] = _eingabe.GetValue(1).ToString(); if (_eingabe.Length > 2) { option[1] = _eingabe.GetValue(2).ToString(); } } foreach (string text in manager.BefehleErkennen(_eingabe.GetValue(0).ToString(), option)) //für jeden string, der als Ergebnis von befehleErkennen erzeugt wird { newLine(text, false); // false because we dont need that " < " - Icon. } } } catch (Exception e) { newLine("Error: " + e, false); } newLine(manager.GetDirectoryPath(), false); newLine("", true); // true cause we need that " < " icon. User can type in these lines StartCoroutine(GoToEnd()); }
// Start is called before the first frame update void Start() { // erstelle die erste Zeile manager = new CommandsManager(); manager.ReadFileSystem(GameObject.FindWithTag("RootDictory")); newLine(manager.GetDirectoryPath(), false); newLine("", true); if (this.transform.parent.GetComponent <FlexibleGridLayout>()) { knoten = this.transform.parent.gameObject; } historyPointer = 0; _rawEingabenHistory = new Stack <string>(10); _rawEingabenHistory.Push(" "); _tmphistory = new Stack <string>(10); MonsterAttackEvent.MonsterAttack += MonsterAttacks; fitType = knoten.GetComponent <FlexibleGridLayout>().fitType; }