Exemplo n.º 1
0
        public bool JoinChatRoomFromGame(GuildEntity entity, GuildMemberKey key)
        {
            Log <GuildService> .Logger.InfoFormat("JoinChatRoomFromGame is called", new object[0]);

            if (entity != null)
            {
                OnlineGuildMember onlineMember = entity.GetOnlineMember(key.CID);
                if (onlineMember != null)
                {
                    Log <GuildService> .Logger.InfoFormat("JoinChatRoomFromGame onlineGuildMember is not null", new object[0]);

                    GuildChatRoom chatRoom = entity.ChatRoom;
                    return(chatRoom.JoinGameMember(onlineMember));
                }
                Log <GuildService> .Logger.WarnFormat("JoinChatRoomFromGame onlineGuildMember is null", new object[0]);
            }
            return(false);
        }
Exemplo n.º 2
0
        private bool DoSyncWebMember(GuildEntity entity, HeroesGuildChatRelay server, ChatMemberSyncEventArg arg)
        {
            if (entity != null && entity.ChatRoom != null)
            {
                GuildChatRoom chatRoom = entity.ChatRoom;
                chatRoom.LeaveAllMembers(entity.GuildID);
                foreach (KeyValuePair <long, string> keyValuePair in arg.Members)
                {
                    Log <GuildService> .Logger.InfoFormat("DoSyncWebMember is called. [ {0}, {1}, {2} ]", arg.GuildKey, keyValuePair.Key, keyValuePair.Value);

                    GuildChatWebMember guildChatWebMember = new GuildChatWebMember(keyValuePair.Key, arg.GuildKey, keyValuePair.Value, server);
                    if (!chatRoom.JoinWebMember(guildChatWebMember))
                    {
                        this.ChatRelay.KickMember(guildChatWebMember.GuildID, guildChatWebMember.CID);
                    }
                    else
                    {
                        server.JoinWebMember(guildChatWebMember);
                    }
                }
                return(true);
            }
            return(false);
        }