예제 #1
0
        /// <summary>
        /// 전체 플레이어수를 반환한다.
        /// </summary>
        /// <returns></returns>
        public static int GetPeerCount()
        {
            int peerCount = 0;

            foreach (KeyValuePair <int, cChatRoom> pair in ChatRoomMap)
            {
                cChatRoom chatRoom = pair.Value;
                peerCount += chatRoom.GetPeerCount();
            }

            return(peerCount);
        }
예제 #2
0
        public static void OnTimer(object source, ElapsedEventArgs e)
        {
            StringBuilder message = new StringBuilder();

            foreach (cChatRoomPair pair in ChatRoomMap)
            {
                cChatRoom chatRoom = pair.Value;
                message.AppendFormat("| ChatRoomIndex: {0}, MemberCount: {1} |",
                                     chatRoom.ChatRoomIndex, chatRoom.GetPeerCount());
            }

            cLogger.Information("ChatRoomInfo -----> {0}\r\n", message);
        }
예제 #3
0
        /// <summary>
        /// 들어갈 수 있는 채팅방을 반환한다.
        /// </summary>
        /// <returns>채팅방</returns>
        private static cChatRoom GetSuitableChatRoom()
        {
            for (int loop1 = 0; NextChatRoomMaxIndex > loop1; ++loop1)
            {
                cChatRoom chatRoom = null;
                if (false == ChatRoomMap.TryGetValue(loop1, out chatRoom))
                {
                    continue;
                }

                if (CHAT_ROOM_MEMBER_MAX_COUNT > chatRoom.GetPeerCount())
                {
                    return(chatRoom);
                }
            }

            return(null);
        }