private void button1_Click_1(object sender, EventArgs e) { ProtocolProcess.CreatePlayer(lgameIp.Text, int.Parse(lgamePort.Text)); ProtocolProcess.StartClient(); PlayerSetting.Username = lgamerName.Text; ProtocolProcess.JoinGame(PlayerSetting.Username); this.Hide(); if (GamePanel == null) { GamePanel = new Form2(); GamePanel.Show(); } }
private void btnCreateGame_Click(object sender, EventArgs e) { ProtocolProcess.SetSettings(int.Parse(cgameRt.Text), int.Parse(cgameSr.Text), int.Parse(cgameSb.Text), int.Parse(cgameSy.Text), int.Parse(cgameWg.Text), int.Parse(cgamePsizeX.Text), int.Parse(cgamePsizeY.Text)); ProtocolProcess.CreateGame(cgameIp.Text, int.Parse(cgamePort.Text), cgameName.Text); ProtocolProcess.StartServer(); ProtocolProcess.CreatePlayer(lgameIp.Text, int.Parse(lgamePort.Text)); ProtocolProcess.StartClient(); PlayerSetting.Username = cgamerName.Text; PlayerSetting.IsHost = true; ProtocolProcess.JoinGame(PlayerSetting.Username); this.Hide(); if (GamePanel == null) { GamePanel = new Form2(); GamePanel.Show(); } }
private void Form2_Load(object sender, EventArgs e) { label9.Text = PlayerSetting.Username; ProtocolProcess.RequestGameSettings(); ProtocolProcess.OnGameSettingsReceivedEvent += delegate(object o, GameSettingsReceivedEvent ev) { if (ev.GameSettings != null) { textBox4.Invoke((MethodInvoker)(() => textBox4.Text = ev.GameSettings.GameName)); textBox5.Invoke((MethodInvoker)(() => textBox5.Text = ev.GameSettings.Red)); textBox6.Invoke((MethodInvoker)(() => textBox6.Text = ev.GameSettings.Blue)); textBox7.Invoke((MethodInvoker)(() => textBox7.Text = ev.GameSettings.Yellow)); textBox8.Invoke((MethodInvoker)(() => textBox8.Text = ev.GameSettings.Timer)); textBox9.Invoke((MethodInvoker)(() => textBox9.Text = ev.GameSettings.Win)); //this.Invoke((MethodInvoker)(() => this.Size = new Size(ev.GameSettings.PanelSize.X + 300, ev.GameSettings.PanelSize.Y + 300))); } }; }
private void button2_Click_1(object sender, EventArgs e) { ProtocolProcess.StartGame(); button2.Visible = false; }
private void button1_Click_1(object sender, EventArgs e) { ProtocolProcess.SendMessage(textBox3.Text, PlayerSetting.Username); textBox3.Text = ""; }
private void panel1_MouseClick(object sender, MouseEventArgs e) { ProtocolProcess.SendClickCoor(e.X, e.Y); }