Exemplo n.º 1
0
    public void changePlayerProfile()
    {
        GameObject parentPanel        = this.transform.parent.gameObject;
        InputField usernameInputField = parentPanel.transform.Find("UsernameIF").GetComponentInParent <InputField>();
        InputField nicknameInputField = parentPanel.transform.Find("NicknameIF").GetComponentInParent <InputField>();
        InputField passwordInputField = parentPanel.transform.Find("PasswordIF").GetComponentInParent <InputField>();
        string     usernameDB         = usernameInputField.text.ToString();
        string     nicknameDB         = nicknameInputField.text.ToString();
        string     passwordDB         = passwordInputField.text.ToString();

        SendUser usr = new SendUser
        {
            IdUser         = Client.Instance.Me.IdUser,
            Username       = usernameDB,
            Nickname       = nicknameDB,
            Password       = passwordDB,
            WinNo          = Client.Instance.Me.WinNo,
            LossNo         = Client.Instance.Me.LossNo,
            Rank           = Client.Instance.Me.Rank,
            MMR            = Client.Instance.Me.MMR,
            Region         = Client.Instance.Me.Region,
            Avatar         = Client.Instance.Me.Avatar,
            MyDecksList    = Client.Instance.Me.MyDecksList,
            OwnedCardsList = Client.Instance.Me.OwnedCardsList,
        };

        Client.Instance.Me.Username = usernameDB;
        Client.Instance.Me.Nickname = nicknameDB;
        Client.Instance.Me.Password = passwordDB;

        Client.Instance.PutUser(usr);
    }
Exemplo n.º 2
0
        //GET: api/trainees
        public IHttpActionResult GetTrainees()
        {
            var traineeId = Convert.ToInt32(UserRole.Trainee).ToString();

            var users = UserManager.Users
                        .Where(u => u.Roles.Any(r => r.RoleId == traineeId))
                        .ToList();

            if (users == null)
            {
                return(NotFound());
            }

            var usernames = new List <SendUser>();

            foreach (var user in users)
            {
                var newUser = new SendUser
                {
                    Id       = user.Id,
                    UserName = user.UserName
                };

                usernames.Add(newUser);
            }

            return(Ok(usernames));
        }
    public void registerPlayerLoadSignInScene(int sceneIndex)
    {
        GameObject parentPanel        = this.transform.parent.gameObject;
        InputField usernameInputField = parentPanel.transform.Find("UsernameIF").GetComponentInParent <InputField>();
        InputField nicknameInputField = parentPanel.transform.Find("NicknameIF").GetComponentInParent <InputField>();
        InputField passwordInputField = parentPanel.transform.Find("PasswordIF").GetComponentInParent <InputField>();
        string     usernameBase       = usernameInputField.text.ToString();
        string     nicknameBase       = nicknameInputField.text.ToString();
        string     passwordBase       = passwordInputField.text.ToString();

        if (usernameInputField.text.ToString() == "" || nicknameInputField.text.ToString() == "" || passwordInputField.text.ToString() == "")
        {
            Debug.Log("Informacije nisu unesene!");
        }
        else
        {
            SendUser usr = new SendUser
            {
                Username = usernameBase,
                Nickname = nicknameBase,
                Password = passwordBase,
                MMR      = 100,
                Rank     = "Unranked",
                Region   = "EU",
            };
            Client.Instance.Register(usr);
            SceneManager.LoadScene(sceneIndex);
        }
    }