private static void OnRootConsoleRender(object sender, UpdateEventArgs e) { MainConsole.Clear(); //MainConsole.Print(30, 20, "@", RLColor.White); if (currentState != null) { currentState.Render(MainConsole); } MainConsole.Draw(); }
private void button2_Click(object sender, EventArgs e) { InputWord.Text = InputWord.Text.Replace("\n", ""); MainConsole.Clear(); MainConsole.AppendText("Старт\n"); MainConsole.Select(0, 5); MainConsole.SelectionFont = new Font(MainConsole.Font.FontFamily, this.Font.Size, FontStyle.Bold); string word = InputWord.Text; List <Tuple <string, string> > list = new List <Tuple <string, string> >(); for (int i = 1; i <= number_of_enter; ++i) { string enter = (panel.Controls.Find("In" + i, true)[0] as TextBox).Text; string exit = (panel.Controls.Find("Out" + i, true)[0] as TextBox).Text; list.Add(new Tuple <string, string>(enter, exit)); } MainConsole.AppendText("Слово: " + word + "\n"); MainConsole.Select(6, 6); MainConsole.SelectionFont = new Font(MainConsole.Font.FontFamily, this.Font.Size, FontStyle.Bold); while (true) { bool exit = true; for (int i = 0; i < number_of_enter; ++i) { if (list[i].Item1 == "") { word = list[i].Item2 + word; MainConsole.AppendText("Подстановка " + (i + 1) + ": " + word + "\n"); MainConsole.Select(MainConsole.Text.Length - word.Length - 17, 13); MainConsole.SelectionFont = new Font(MainConsole.Font.FontFamily, this.Font.Size, FontStyle.Bold); exit = (panel.Controls.Find("End" + (i + 1), true)[0] as CheckBox).Checked; break; } int index = word.IndexOf(list[i].Item1); if (index != -1) { word = word.Remove(index, list[i].Item1.Length); word = word.Insert(index, list[i].Item2); MainConsole.AppendText("Подстановка " + (i + 1) + ": " + word + "\n"); MainConsole.Select(MainConsole.Text.Length - word.Length - 17, 13); MainConsole.SelectionFont = new Font(MainConsole.Font.FontFamily, this.Font.Size, FontStyle.Bold); exit = (panel.Controls.Find("End" + (i + 1), true)[0] as CheckBox).Checked; break; } } if (exit) { MainConsole.AppendText("Стоп: " + word + "\n"); MainConsole.Select(MainConsole.Text.Length - word.Length - 8, 6); MainConsole.SelectionFont = new Font(MainConsole.Font.FontFamily, this.Font.Size, FontStyle.Bold); break; } } }