예제 #1
0
    public void openInventory()
    {
        recipe_database = GetComponent <Recipedept> ();

        slotAmount    = 30;
        itemPanel     = GameObject.Find("Item Content Panel");     //Inventory Panal
        itemSlotPanel = itemPanel.transform.Find("Item Slot Panel").gameObject;

        for (int i = 0; i < slotAmount; i++)
        {
            recipes.Add(new Recipe());
            recipe_slots.Add(Instantiate(itemSlot));
            recipe_slots [i].transform.SetParent(itemSlotPanel.transform);
        }

        /*for (int i = 0; i < 30; i++) {
         *      recipe_count = i + 51;
         *
         *      item_count [i] = PlayerPrefs.GetInt("recipe"+recipe_count);
         *      for (int j = 1; j <= item_count [i]; j++) {
         *              AddRecipe(recipe_count);
         *      }
         * }*/
        AddRecipe(51);
        AddRecipe(60);
    }
예제 #2
0
    // Use this for initialization

    void Craft()
    {
        database = GetComponent <Recipedept> ();

        slotAmount     = 30;
        inventoryPanel = GameObject.Find("RContent Panal");         //Inventory Panal
        slotPanel      = inventoryPanel.transform.Find("RSlot Panal").gameObject;

        for (int i = 0; i < slotAmount; i++)
        {
            recipes.Add(new Recipe());
            slots.Add(Instantiate(inventorySlot));
            slots [i].transform.SetParent(slotPanel.transform);
        }

        for (int i = 0; i < 30; i++)
        {
            recipe_count   = i + 51;
            item_count [i] = PlayerPrefs.GetInt("recipe" + recipe_count);
            for (int j = 1; j <= item_count [i]; j++)
            {
                AddRecipe(recipe_count);
            }
        }
    }