Exemplo n.º 1
0
        private bool DoJoinWebChatMember(GuildEntity entity, HeroesGuildChatRelay server, ChatJoinEventArg arg)
        {
            if (entity != null && entity.ChatRoom != null)
            {
                Log <GuildService> .Logger.InfoFormat("JoinWebChatMember is called. [ {0}, {1}, {2} ]", arg.GuildKey, arg.CID, arg.Sender);

                GuildChatWebMember member = new GuildChatWebMember(arg.CID, arg.GuildKey, arg.Sender, server);
                if (entity.ChatRoom.JoinWebMember(member))
                {
                    string gameMembers = this.GetGameMembers(arg.GuildKey);
                    Log <GuildService> .Logger.InfoFormat("JoinWebChatMember is called. [ {0}, {1}, {2}, {3} ]", new object[]
                    {
                        arg.GuildKey,
                        arg.CID,
                        arg.Sender,
                        gameMembers
                    });

                    server.JoinWebMember(member);
                    return(true);
                }
            }
            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);
        }