예제 #1
0
    async public void GetTopRecords()
    {
        try {
            //Shows image before connection
            ImgConnection.SetActive(true);

            await ws.GetTopRecords();

            //If result is OK we get list of records
            if (ws.topRecords.ok)
            {
                this.recordsList = ws.topRecords.records;

                TextTopRecords.text = "";

                foreach (Record rec in recordsList)
                {
                    TextTopRecords.text = TextTopRecords.text + "\t" + rec.nombre + "  -  " + rec.puntos + "\r\n";
                }

                ImgTopRecords.SetActive(true);

                disableButtons();
            }

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

            enableButtons();
        }
    }