示例#1
0
    // try upgrade base
    public void upgradeBase(int upgradeType)
    {
        if (upgradeType == BASEUPGRADE.CRAFT)
        {
            Debug.Log(cm);
            if (cm.craft(BASEUPGRADE.CRAFT_UPGRADE[craftLevel], 1))
            {
                craftLevel++;
                gm.playSE("hammering");
                return;
            }

            // upgrade fail
            Recipe recipe = RecipeDatabase.findRecipe(BASEUPGRADE.CRAFT_UPGRADE[craftLevel]);
            string msg    = "";

            msg += "업그레이드를 위해 다음의 재료가 필요합니다. \n\n";

            List <RecipeElement> ingredients = recipe.getIngredients();
            foreach (RecipeElement e in ingredients)
            {
                msg += e.item.getName() + " x " + e.count.ToString() + "\n";
            }

            gm.showMessage(msg);
        }

        else if (upgradeType == BASEUPGRADE.CULTIVATE)
        {
            if (cm.craft(BASEUPGRADE.CULTIVATE_UPGRADE[cultivateLevel], 1))
            {
                cultivateLevel++;
                gm.playSE("hammering");
                return;
            }

            // upgrade fail
            Recipe recipe = RecipeDatabase.findRecipe(BASEUPGRADE.CULTIVATE_UPGRADE[cultivateLevel]);
            string msg    = "";

            msg += "업그레이드를 위해 다음의 재료가 필요합니다. \n\n";

            List <RecipeElement> ingredients = recipe.getIngredients();
            foreach (RecipeElement e in ingredients)
            {
                msg += e.item.getName() + " x " + e.count.ToString() + "\n";
            }

            gm.showMessage(msg);
        }
        else
        {
            return;
        }
    }
示例#2
0
 // when button is clicked, try craft
 public void onClick()
 {
     if (cm.craft(this.recipe.getId(), 1))
     {
         gm.playSE("wood-hammering");
         panel.makeCraftList();
     }
     else
     {
         gm.playSE("fail2");
     }
 }
示例#3
0
    public void onClick()
    {
        if (cm.craft(1000, 1))
        {
            gm.playSE("hammering");
            map.setBase();
        }
        else
        {
            Recipe recipe = RecipeDatabase.findRecipe(1000);
            string msg    = "";

            msg += "다음의 재료가 필요합니다. \n\n";

            List <RecipeElement> ingredients = recipe.getIngredients();
            foreach (RecipeElement e in ingredients)
            {
                msg += e.item.getName() + " x " + e.count.ToString() + "\n";
            }

            gm.showMessage(msg);
        }
    }
示例#4
0
 public void onClick()
 {
     cm.craft(recipeId, 1);
 }