예제 #1
0
파일: WorldChat.cs 프로젝트: LordEnigma/UO
        private static void OnLogout(LogoutEventArgs e)
        {
            if (e == null || !(e.Mobile is PlayerMobile))
            {
                return;
            }

            var user = (PlayerMobile)e.Mobile;

            AllChannels.Where(c => c.IsUser(user)).ForEach(c => c.Leave(user));
        }
예제 #2
0
파일: WorldChat.cs 프로젝트: LordEnigma/UO
        private static void OnLogin(LoginEventArgs e)
        {
            if (e == null || !(e.Mobile is PlayerMobile))
            {
                return;
            }

            var user = (PlayerMobile)e.Mobile;

            AllChannels.Where(c => user.AccessLevel <= c.Access && c.Available && c.AutoJoin).ForEach(c => c.Join(user));
        }
예제 #3
0
        public async Task UpdateChannel(string oldName, Channel channel)
        {
            if (oldName != channel.Name)
            {
                Channel[] channelsWithNewName = AllChannels.Where(otherChannel => otherChannel.Name == channel.Name)
                                                .ToArray();

                if (channelsWithNewName.Length == 0)
                {
                    channel.Discriminator = 0;
                }
                else
                {
                    channel.Discriminator = (ushort)(channelsWithNewName.Max(otherChannel => otherChannel.Discriminator) + 1);
                }
            }

            _appDbContext.Channels.Update(channel);
            await _appDbContext.SaveChangesAsync();
        }