Exemplo n.º 1
0
 public void Call(SignUpResponseFail packet, IClientManager manager)
 {
     manager.EventContent = new WindowBoxViewModel(manager)
     {
         Text = "Log In fail: " + packet.Info.ToString()
     };
 }
Exemplo n.º 2
0
        public override void Call(SignUpRequest packet, IUser sender, IServerManager manager)
        {
            var             profiles = manager.Data.Profiles;
            var             profile  = profiles.Where(x => x.Email.Equals(packet.Email)).FirstOrDefault();
            IPacketResponse p        = null;

            if (sender.IsLogIn)
            {
                p = new SignUpResponseFail
                {
                    Info = SignUpResponseFail.FailInfo.NotSpectator
                };
            }
            else if (profile != null)
            {
                p = new SignUpResponseFail
                {
                    Info = SignUpResponseFail.FailInfo.ExistsEmail
                };
            }
            else
            {
                p = new SignUpResponseLuck();
                int id         = profiles.Count() + 1;
                var newProfile = new Profile
                {
                    Id       = id,
                    Email    = packet.Email,
                    Password = packet.Password,
                    Name     = packet.Name
                };
                manager.Data.Profiles.Add(newProfile);
            }
            sender.Connector.Send(p);
        }