Ejemplo n.º 1
0
        public async Task <LoginResult> Login(Player player, string password)
        {
            UserDto user;

            if (m_UserData.TryGetValue(player.Name, out user))
            {
                return(Validate(user, password, player));
            }
            else
            {
                UserDto u = await RemoteApi.GetUserData(player.Name);

                if (u == null)
                {
                    return(new LoginResult()
                    {
                        Result = player.Name + " does not exist. Sign up at hqmpubstars.com."
                    });
                }
                else
                {
                    m_UserData[u.Name] = u;
                    return(Validate(u, password, player));
                }
            }
        }
Ejemplo n.º 2
0
        public async Task Init()
        {
            var userData = await RemoteApi.GetUserData();

            if (userData != null)
            {
                m_UserData.Init(userData);
                m_CommandListener.AddCommand("join", Login);
                m_CommandListener.AddCommand("info", Info);
                Console.WriteLine("LoginManager initialized successfully.");
            }
            else
            {
                Console.WriteLine("LoginManager failed to initialize.");
                Console.ReadLine();
            }
        }