Exemple #1
0
 public Trunk(int new_id, string new_name, string new_description, TreePlus new_tree)
 {
     id          = new_id;
     name        = new_name;
     description = new_description;
     tree        = new TreePlus(new_tree.name);
 }
Exemple #2
0
    public IEnumerator BuildStructureTree(ArticleSerializable[] articles)
    {
        leaves = new List <Leaf> ();

        for (int i = 0; i < articles.Length; i++)
        {
            GetCategories(articles[i]);
            yield return(new WaitForSeconds(1f));

            for (int j = 0; j < APIRestClient.categories.Length; j++)
            {
                GetThematic(APIRestClient.categories[j]);
                yield return(new WaitForSeconds(1f));

                TreePlus tree = new TreePlus("arbol");

                Trunk trunk = new Trunk(APIRestClient.thematics [0].id, APIRestClient.thematics [0].nombre, APIRestClient.thematics[0].descripcion, tree);

                Branch branch = new Branch(APIRestClient.categories [j].id, APIRestClient.categories [j].nombre, APIRestClient.categories[j].descripcion, trunk);

                Leaf leaf = FindExistingArticle(leaves, articles [i].id);
                if (leaf == null)
                {
                    leaf = new Leaf(articles [i].id, articles [i].titulo, articles [i].contenido, branch);
                    leaves.Add(leaf);
                }
                else
                {
                    leaf.branchs.Add(branch);
                }
            }
        }

        SetStatus(StatusBuildTree.Completed);
    }