public Form1() { InitializeComponent(); roomList = new List<Room>(); spawnRoomID = -1; spawnX = spawnY = 0.0f; radioPlayer = null; selectedTool = TOOLENUM.TOOL_NONE; }
private void Form1_KeyPress(object sender, KeyPressEventArgs e) { e.Handled = true; if (e.KeyChar == 13 || e.KeyChar == 27 || this.ActiveControl == null) { this.ActiveControl = null; return; } if (this.ActiveControl.GetType() == (new NumericUpDown()).GetType() && e.KeyChar >= 48 && e.KeyChar <= 57) e.Handled = false; if (this.ActiveControl.GetType() == (new TextBox()).GetType()) e.Handled = false; if (this.ActiveControl.GetType() == (new ListBox()).GetType()) e.Handled = false; switch (e.KeyChar) { case 'w': selectedTool = TOOLENUM.TOOL_TRANSLATE; break; case 'e': selectedTool = TOOLENUM.TOOL_ROTATE; break; case 'r': selectedTool = TOOLENUM.TOOL_SCALE; break; case (char)33: selectedTool = TOOLENUM.TOOL_NONE; break; } }