Ejemplo n.º 1
0
    async public void RegisterP1(string user, string password, string email)
    {
        try
        {
            Text[] listTexts = ImgRegisterP1.GetComponentsInChildren <Text>();

            await ws.Register(user, password, email);


            if (ws.userRegistered.idUsuario <= 0)
            {
                //Error textbox inside RegisterP1
                listTexts[6].text = "User name already used";
            }
            else
            {
                TextNameP1.text = user;

                //Update static manager settings for persistence
                StaticManager.p1.Name = user;
                StaticManager.p1.Id   = ws.userLogued.Id;

                enableButtons();

                //Clear all textbox on exit
                listTexts[1].text = "";
                listTexts[3].text = "";
                listTexts[5].text = "";
                listTexts[6].text = "";

                //Hide login window
                ImgRegisterP1.SetActive(false);
            }

            //Hide connection anim
            ImgConnection.SetActive(false);
        }
        catch (Exception ex)
        {
            Debug.Log("Error records");
            TextError.text = "Error contacting with register server";
            //Hide toprecords windows
            ImgRegisterP1.SetActive(false);
            //Hide connection anim
            ImgConnection.SetActive(false);

            enableButtons();
        }
    }