Exemple #1
0
    //Generates the data from the json string given
    public void SetupFromJsonData(JSONObject Data)
    {
        for (int i = 0; i < Data.list.Count; i++)
        {
            string     key = (string)Data.keys[i];
            JSONObject j   = (JSONObject)Data.list[i];

            //Setup the value depending of which
            switch (key)
            {
            case "nombre":
                this.Nombre = j.str;
                break;

            case "descripcion":
                this.Descripcion = j.str;
                break;

            case "contenidos":
                //This is an array
                Contenidos = Contenido.ParseFromJsonData(j);
                break;

            default:
                break;
            }
        }

        //The title is common, so we should set it up here
        TitleText.text = Nombre;

        //Check if we're open, we should reset the current page
        if (bShown)
        {
            GoToPage(CurrentPage);
        }
    }