// 채팅방의 초기상태를 설정한다. private void InitRoomState(RoomDetailInfo roomDetailInfo) { try { // 방에 입장한 사용자들의 정보를 유저리스트에 보여준다. if (roomDetailInfo.Users.Count < 1 || roomDetailInfo.Users == null) { return; } this.userList.Items.Clear(); for (int i = 0; i < roomDetailInfo.Users.Count; i++) { if (roomDetailInfo.Users[i].Kind == 1) { m_userFemaleInfo = roomDetailInfo.Users[i]; } this.userList.Items.Add(roomDetailInfo.Users[i].Id); } // Emoticon들을 얻어 Emoticon컨트롤에 배치하여준다. m_listEmoticons = new List <IconInfo>(); m_listEmoticons = roomDetailInfo.Emoticons; InitLabelCaption(roomDetailInfo); } catch (Exception) { } }
public bool ReplyRoomDetailInfo(string roomId) { RoomDetailInfo roomDetailInfo = new RoomDetailInfo(); roomDetailInfo.Users = Users.GetInstance().GetRoomUsers(roomId); if (roomDetailInfo.Users != null) { for (int i = 0; i < roomDetailInfo.Users.Count; i++) { roomDetailInfo.Users[i] = roomDetailInfo.Users[i]; IPEndPoint ipEndPoint = roomDetailInfo.Users[i].Socket.RemoteEndPoint as IPEndPoint; roomDetailInfo.Users[i].strOwnIP = ipEndPoint.Address.ToString(); } } roomDetailInfo.Emoticons = Database.GetInstance().GetAllEmoticons(); roomDetailInfo.Presents = Database.GetInstance().GetAllPresents(); roomDetailInfo.strRoomID = roomId; BroadCast(roomId, NotifyType.Reply_RoomDetail, roomDetailInfo, null); return(true); }
private void ShowUserList(RoomDetailInfo roomDetailInfo) { // Contacts목록에 현재 방에 입장한 유저들의 목록을 현시한다. this.UserTreeView.Items.Clear(); TreeViewItem treeViewItem = new TreeViewItem(); treeViewItem.Header = "Users"; treeViewItem.Foreground = Brushes.Brown; treeViewItem.FontSize = 14; treeViewItem.IsExpanded = true; for (int i = 0; i < roomDetailInfo.Users.Count; i++) { TreeViewItem treeViewChildItem = new TreeViewItem(); StackPanel stackPanel = new StackPanel(); stackPanel.Orientation = Orientation.Horizontal; Image icon = new Image(); icon = GetLevelIcon(roomDetailInfo.Users[i].LevelNum); icon.Width = 20; icon.Height = 20; Label lbl = new Label(); lbl.Content = roomDetailInfo.Users[i].Id; lbl.Foreground = Brushes.Brown; lbl.FontSize = 14; stackPanel.Children.Add(icon); stackPanel.Children.Add(lbl); treeViewChildItem.Header = stackPanel; treeViewItem.Items.Add(treeViewChildItem); } UserTreeView.Items.Add(treeViewItem); // Present들을 얻어 Present컨트롤에 배치하여준다. m_listPresentInfo = new List <IconInfo>(); m_listPresentInfo = roomDetailInfo.Presents; BitmapImage bitmapPresentImage = new BitmapImage(new Uri("\\\\" + Main_Pan._ServerUri + "\\" + m_listPresentInfo[0].Icon, UriKind.RelativeOrAbsolute)); PresentImage.Source = bitmapPresentImage; // Emoticon들을 얻어 Emoticon컨트롤에 배치하여준다. m_listEmotionInfo = new List <IconInfo>(); m_listEmotionInfo = roomDetailInfo.Emoticons; BitmapImage bitmapEmoticonImage = new BitmapImage(new Uri("\\\\" + Main_Pan._ServerUri + "\\" + m_listEmotionInfo[0].Icon, UriKind.RelativeOrAbsolute)); EmoticonImage.Source = bitmapEmoticonImage; // 사용자가 입장하거나 퇴장할때마다 현재방의 사용자수를 나타낸다. this.Count.Content = "UserCount: " + roomDetailInfo.Users.Count.ToString(); // richTextMessage에 초점을 맞춘다. this.richTextMessage.Focus(); }
// 서버로부터 응답이 들어올때... public void OnReceive(NotifyType type, Socket socket, BaseInfo baseInfo) { try { switch (type) { case NotifyType.Reply_RoomDetail: { RoomDetailInfo roomDetailInfo = (RoomDetailInfo)baseInfo; m_roomDetailInfo = roomDetailInfo; m_bRoomStateChange = true; } break; case NotifyType.Reply_StringChat: { StringInfo strInfo = (StringInfo)baseInfo; AddMessageToHistoryTextBox(strInfo); } break; case NotifyType.Reply_VoiceChat: { VoiceInfo voiceInfo = (VoiceInfo)baseInfo; m_voiceInfo = voiceInfo; ReceiveVoiceInfo(voiceInfo.Data); } break; case NotifyType.Reply_OutMeeting: { UserInfo userInfo = (UserInfo)baseInfo; UserOut(userInfo); } break; case NotifyType.Reply_OutRoom: { UserInfo userInfo = (UserInfo)baseInfo; UserOut(userInfo); } break; } } catch (Exception) { } }
public void OnReceive(NotifyType type, Socket socket, BaseInfo baseInfo) { switch (type) { case NotifyType.Reply_Error: // 서버로부터 통신오류응답이 온경우. { } break; case NotifyType.Reply_StringChat: { StringInfo strInfo = (StringInfo)baseInfo; AddMessageToHistoryTextBox(strInfo); } break; case NotifyType.Reply_RoomDetail: { m_roomDetailInfo = (RoomDetailInfo)baseInfo; ShowUserList(m_roomDetailInfo); } break; case NotifyType.Reply_VoiceChat: { VoiceInfo voiceInfo = (VoiceInfo)baseInfo; ReceiveVoiceInfo(voiceInfo.Data); } break; case NotifyType.Reply_VideoChat: { VideoInfo videoInfo = (VideoInfo)baseInfo; ReceiveVideo(videoInfo.Data); } break; case NotifyType.Reply_Give: { GiveInfo giveInfo = (GiveInfo)baseInfo; SendPresent(giveInfo.PresentId); } break; } }
public bool ReplyRoomDetailInfo(string roomId) { RoomDetailInfo roomDetailInfo = new RoomDetailInfo(); roomDetailInfo.Users = Users.GetInstance().GetRoomUsers(roomId); if (roomDetailInfo.Users != null) { for (int i = 0; i < roomDetailInfo.Users.Count; i++) { roomDetailInfo.Users[i] = roomDetailInfo.Users[i]; } } roomDetailInfo.Emoticons = Database.GetInstance().GetAllEmoticons(); roomDetailInfo.Presents = Database.GetInstance().GetAllPresents(); BroadCast(roomId, NotifyType.Reply_RoomDetail, roomDetailInfo, null); return(true); }
// 방입장시 정보현시. private void InitLabelCaption(RoomDetailInfo roomDetailInfo) { try { UserInfo userInfo = new UserInfo(); for (int i = 0; i < roomDetailInfo.Users.Count; i++) { if (Main._UserInfo.Id.Equals(roomDetailInfo.Users[i].Id)) { userInfo = roomDetailInfo.Users[i]; break; } } if (userInfo.Cash != 0) { if (userInfo.Cash <= m_roomInfo.Cash && userInfo.Kind == 0) { ShowErrorOrMessage(ManagerMessage.NOT_ENOUGH_CASH); } lblCurRemainPrice.Content = LabelContents.CUR_REMAIN_PRICE_LBL + userInfo.Cash.ToString(); lblCurUsingPrice.Content = LabelContents.CUR_USE_PRICE_LBL + m_roomInfo.Cash.ToString(); lblPricePerSecond.Content = LabelContents.PRICE_PER_SECOND + m_roomInfo.Cash.ToString(); } else if (userInfo.Point != 0) { if (userInfo.Point <= m_roomInfo.Point && userInfo.Kind == 0) { ShowErrorOrMessage(ManagerMessage.NOT_ENOUGH_POINT); } lblCurRemainPrice.Content = LabelContents.CUR_REMAIN_POINT_LBL + userInfo.Point.ToString(); lblCurUsingPrice.Content = LabelContents.CUR_USE_POINT_LBL + m_roomInfo.Point.ToString(); lblPricePerSecond.Content = LabelContents.PRICE_PER_SECOND + m_roomInfo.Point.ToString(); } } catch (Exception) { } }