private void ButtonOnline_Click(object sender, RoutedEventArgs e) { var placement = this.GetPlacement(); RoomWindow roomWindow = new RoomWindow(_loginData, placement); roomWindow.Show(); this.Close(); }
protected override void OnInit() { contentPane = UIPackage.CreateObject("BattleCity8102", "CreateRoom_Window").asCom; createRoomFrame = contentPane.GetChild("frame").asCom; roomNameTextField = createRoomFrame.GetChild("roomNameTextField").asTextField; mapComboBox = createRoomFrame.GetChild("mapComboBox").asComboBox; modeComboBox = createRoomFrame.GetChild("modeComboBox").asComboBox;; numComboBox = createRoomFrame.GetChild("numComboBox").asComboBox; tickButton = createRoomFrame.GetChild("tickButton").asButton; tickButton.onClick.Add(() => { if (roomNameTextField.text.Equals("")) { return; } Room rm = new Room(roomNameTextField.text, MainUI.player.name, mapComboBox.value, modeComboBox.value, new List <Player> { }, System.Convert.ToInt32(numComboBox.value)); rm.isAlive = true; rm.hostIP = System.Net.IPAddress.Loopback.ToString(); MainUI.currentRoom = rm; RoomManager.CreateRoom(rm); RoomWindow rw = new RoomWindow(); rw.Show(); this.Dispose(); }); }
/// <summary> /// 包厢管理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsbRoom_Click(object sender, EventArgs e) { if (null == roomWindow || roomWindow.IsDisposed) { roomWindow = new RoomWindow(); roomWindow.MdiParent = this; roomWindow.StartLoad += (obj, ev) => { StartLoad(obj); }; roomWindow.StopLoad += (obj, ev) => { StopLoad(obj); }; roomWindow.ChangeName += (obj, ev) => { if (null != homeWindow && !homeWindow.IsDisposed) { homeWindow.RoomNoChange(obj as Room); } if (null != deviceWindow && !deviceWindow.IsDisposed) { deviceWindow.RealoadRoomNo(); } }; roomWindow.RemoveRoom += (obj, ev) => { if (null != homeWindow && !homeWindow.IsDisposed) { homeWindow.RoomRemove(obj as Room); } }; roomWindow.AddRoom += (obj, ev) => { if (null != homeWindow && !homeWindow.IsDisposed) { homeWindow.RefreshSome(new List <long>() { (obj as Room).RoomId }); } }; roomWindow.Show(); } SetSelect(tsbRoom, tsmiRoom); roomWindow.Activate(); }
private void JoinRoomButton_Click(object sender, RoutedEventArgs e) { Responses.JoinRoom joinRoomResponse = this.communicator.submitRequest <Requests.JoinRoom, Responses.JoinRoom>(new Requests.JoinRoom(int.Parse(RoomName.Text)), (int)Defs.Codes.JOIN_ROOM_REQUEST); if (joinRoomResponse.status == 0) { MessageBox.Show($"Join room faild..."); } else { RoomWindow roomWindow = new RoomWindow(this.communicator); roomWindow.Show(); this.mainMenuWindow.Close(); } }
private void CreateRoomClick(object sender, RoutedEventArgs e) { if (RoomName.Text == string.Empty || QuestionTime.Text == string.Empty || MaxOfPlayers.Text == string.Empty || QuestionCount.Text == string.Empty || RoomName.Text == "room name" || QuestionTime.Text == "time for each question" || MaxOfPlayers.Text == "number of players in room" || QuestionCount.Text == "question count") { //TODO: implement message box } else { Responses.CreateRoom createRoomResponse = this.communicator.submitRequest <Requests.CreateRoom, Responses.CreateRoom>(new Requests.CreateRoom(RoomName.Text, int.Parse(MaxOfPlayers.Text), int.Parse(QuestionCount.Text), int.Parse(QuestionCount.Text)), (int)Defs.Codes.CREATE_ROOM_REQUEST); if (createRoomResponse.status == 0) { //TODO: implement message box } else { RoomWindow roomWindow = new RoomWindow(this.communicator); roomWindow.Show(); this.mainMenuWindow.Close(); } } }
public void CreateRoomWindow() { var roomWindow = new RoomWindow(); roomWindow.Show(); }
private void ConnectClick(object sender, RoutedEventArgs e) { string err= String.Empty; if (!Global.NetworkClient.ConnectToServer(Global.servLink, Global.servPort, out err)) Error = err; else { var wind = new RoomWindow(); this.Close(); wind.Show(); } }