public void LoadAllRoom(string strPar) { string strRooms = funcLoadAllRoom(); Package pk = new Package(); arrMsg = pk.PackStrCmd(strRooms); }
/// <summary> /// 向客户端发送闪屏 /// </summary> /// <param name="strMsg"></param> public void SendShake() { //byte[] arrMsgFinal = new byte[1]; //arrMsgFinal[0] = 2; //sokMsg.Send(arrMsgFinal); Package pk = new Package(); sokMsg.Send(pk.PackStrCmd("ShakeWindow")); }
private void timer1_Tick(object sender, EventArgs e) { string strRooms = LoadAllRoom(); Package pk = new Package(); byte[] arrData = pk.PackStrCmd(strRooms); foreach (ConnectionClient conn in dictConn.Values) { conn.SokMsg.Send(arrData); } }
//更新客户端的房间 public void SenAllRoomsToAllClient(Room room) { string strRooms = LoadAllRoom(); Package pk = new Package(); byte[] arrData = pk.PackStrCmd(strRooms); foreach (ConnectionClient conn in dictConn.Values) { if (room.hostSock != conn.SokMsg) { conn.SokMsg.Send(arrData); } } }
public void JoinRoom(Room room) { for (int i = 0; i < listView1.Items.Count; i++) { Room roomJ = listView1.Items[i].Tag as Room; if (roomJ != null && roomJ.roomId == room.roomId) { listView1.Items[i].ImageIndex = room.roomState; roomJ.roomState = room.roomState; roomJ.payerSock = room.payerSock; Package pk = new Package(); roomJ.hostSock.Send(pk.PackStrCmd("PlayerJoin" + "|roomName=" + roomJ.roomName + "|roomId=" + roomJ.roomId + "|roomState=" + roomJ.roomState)); return; } } }