示例#1
0
    /**
     * Use this for initialization
     */
    void Start()
    {
        user         = User.getInstance;
        mainCategory = (MainCategory)user.CurrentCategory;
        mathCategory = (MathSubCategory)user.CurrentSubCategory;
        numbersUsed  = new List <int> ();

        // Initializing variables

        setOperationOptions();
        createOperation();
        animator.SetBool("Waiting", true);
    }
示例#2
0
    List <Category> retrieveSubCategories(Category category, int categoryStage)
    {
        string targetUri = serverUriPath + TaskManagerAccessUriPath;

        targetUri += ("subCategories/filter/" + category.Id + "/" + user.CurrentStage + "/"
                      + categoryStage + "/" + user.CurrentSubStage + "/");

        GET(targetUri);
        string response = wwwResquest.text;

        if (response == "")
        {
            retrieveTasksAndUserDoes(category, null);
            return(null);            // There is not subcategory
        }
        else
        {
            Debug.Log("category: " + ((MainCategory)category).ToString());
            List <Category> subCategories = new List <Category>();

            string[] subCategoryObjects = response.Split(';');
            foreach (string subCategoryS in subCategoryObjects)
            {
                string[]        values      = subCategoryS.Split('.');
                MathSubCategory subCategory = new MathSubCategory();
                subCategory.Id       = int.Parse(values[0]);
                subCategory.Category = category;
                subCategory.SubStage = int.Parse(values[2]);
                subCategory.Integer  = bool.Parse(values[3]);
                int value = int.Parse(values[4]);
                if (value != 0)
                {
                    subCategory.Value = value;
                }
                else
                {
                    subCategory.Random = true;
                }
                subCategory.Available = bool.Parse(values[5]);
                subCategories.Add(subCategory);

                retrieveTasksAndUserDoes(category, subCategory);
            }

            return(subCategories);
        }
    }
示例#3
0
    void repopulate(ItemCategory item)
    {
        ListFactory  factory = gameObject.GetComponent <ListFactory> ();
        ListAbstract tempList;
        User         user = User.getInstance;

        user.CurrentCategory = user.getCategory(item.CategoryId);

        if (item.Categories != null)         // It has SubCategories

        {
            List <Item> items = new List <Item> ();

            foreach (Category category in item.Categories)
            {
                Task task = user.getTask(item.CategoryId, category.Id);

                MathSubCategory subCategory = (MathSubCategory)user.getSubCategory(category.Id);
                user.CurrentSubCategory = subCategory;

                string nameItem = task.Name + "\n" + subCategory.ToString();

                Item ItemCategory = new ItemCategory(
                    nameItem,
                    task.Available,
                    null,
                    category.Id);

                items.Add(ItemCategory);
            }

            tempList       = factory.showList("subCategories", gameObject);
            tempList.Items = items;

            tempList.populate(true);
        }
        else
        {
            tempList = factory.showList("Images", gameObject);
            tempList.populate(false);
        }
    }