Exemple #1
0
    public void exitModePressed()
    {
        if (isTweakingGardenDecor)
        {
            Destroy(tweakedGardenDecor);

            queueRewardText("Cancelled!", new Color(0.7f, 0.7f, 0.7f, 1));
        }

        seedToPlant           = null;
        isPlantingSeed        = false;
        gardenDecorToBuild    = null;
        isBuildingGardenDecor = false;
        tweakedGardenDecor    = null;
        isTweakingGardenDecor = false;
        isRemovingGardenDecor = false;

        foreach (GameObject decor in GameObject.FindGameObjectsWithTag("GardenDecor"))
        {
            decor.GetComponent <GardenDecorWorld>().hideRemoval();
        }

        G_TweakUI.SetActive(false);
        G_UIButtons.SetActive(true);
        G_CloseButton.SetActive(false);
        G_ModeHint.SetActive(false);

        InventoryUI.reRender = true;
    }
Exemple #2
0
    public void startBuildingGardenDecor(GardenDecor gardenDecorInfo)
    {
        isBuildingGardenDecor = true;
        gardenDecorToBuild    = gardenDecorInfo;

        G_UIButtons.SetActive(false);
        G_CloseButton.SetActive(true);
        G_ModeHint.SetActive(true);

        G_ModeHint.GetComponentInChildren <Text>().text = "Build Decor!";
    }
Exemple #3
0
    public void remove()
    {
        PetKeeper.pet.Base.baseGardenDecors.Remove(representedDecor);

        GameControl.playPostMortemAudioClip(A_GardenDecorRemove);

        Destroy(gameObject);

        GardenDecor decorInfo = Inventory.getGardenDecorTypeInfo(representedDecor.gardenDecorType);

        PetKeeper.pet.buildingMaterials += decorInfo.bmCost;
        PetKeeper.pet.inventory.gardenDecorCounts[(int)decorInfo.gardenDecorType] += 1;

        InventoryUI.reRender = true;

        PetKeeper.pet.Save(false);
    }
Exemple #4
0
    public void initGardenDecorItem(int count, GardenDecor gardenDecorInfo, Transform inventory)
    {
        nameText.text     = gardenDecorInfo.name;
        countText.text    = "x" + count;
        image.sprite      = (Sprite)Resources.Load(gardenDecorInfo.imagePath, typeof(Sprite));
        rarityFrame.color = Inventory.getRarityColor(gardenDecorInfo.rarity);
        costText.text     = "" + gardenDecorInfo.bmCost;

        this.gardenDecorInfo = gardenDecorInfo;

        if (gardenDecorInfo.bmCost > PetKeeper.pet.buildingMaterials)
        {
            buildButton.interactable = false;
        }

        this.inventory = inventory;
    }
Exemple #5
0
    public void initShopBuyItem(Shop.ShopItem item)
    {
        switch (item.itemType)
        {
        case Shop.ItemType.SEED:
            Seed seedInfo = Inventory.getSeedTypeInfo((Inventory.SeedType)item.itemIndex);
            nameText.text  = seedInfo.name;
            countText.text = "x" + item.amount;
            image.sprite   = (Sprite)Resources.Load(seedInfo.imagePath, typeof(Sprite));
            item.price     = seedInfo.price * 5;
            break;

        case Shop.ItemType.PRODUCE:
            Produce produceInfo = Inventory.getProduceTypeInfo((Inventory.ProduceType)item.itemIndex);
            nameText.text  = produceInfo.name;
            countText.text = "x" + item.amount;
            image.sprite   = (Sprite)Resources.Load(produceInfo.imagePath, typeof(Sprite));
            item.price     = produceInfo.price * 3;
            break;

        case Shop.ItemType.UNIQUE:
            Unique uniqueInfo = Inventory.getUniqueTypeInfo((Inventory.UniqueType)item.itemIndex);
            nameText.text  = uniqueInfo.name;
            countText.text = "x" + item.amount;
            image.sprite   = (Sprite)Resources.Load(uniqueInfo.imagePath, typeof(Sprite));
            item.price     = uniqueInfo.price * 5;
            break;

        case Shop.ItemType.GARDEN_DECOR:
            GardenDecor decorInfo = Inventory.getGardenDecorTypeInfo((Inventory.GardenDecorType)item.itemIndex);
            nameText.text  = decorInfo.name;
            countText.text = "x" + item.amount;
            image.sprite   = (Sprite)Resources.Load(decorInfo.imagePath, typeof(Sprite));
            item.price     = decorInfo.coinCost;
            break;
        }

        buyButton.GetComponentInChildren <Text>().text = "" + (item.price);

        this.item = item;
    }
Exemple #6
0
    public void onClick()
    {
        switch (item.itemType)
        {
        case Shop.ItemType.SEED:
            Seed seedInfo = Inventory.getSeedTypeInfo((Inventory.SeedType)item.itemIndex);
            PetKeeper.pet.inventory.seedCounts[(int)seedInfo.seedType] += 1;
            break;

        case Shop.ItemType.PRODUCE:
            Produce produceInfo = Inventory.getProduceTypeInfo((Inventory.ProduceType)item.itemIndex);
            PetKeeper.pet.inventory.produceCounts[(int)produceInfo.produceType] += 1;
            break;

        case Shop.ItemType.UNIQUE:
            Unique uniqueInfo = Inventory.getUniqueTypeInfo((Inventory.UniqueType)item.itemIndex);
            PetKeeper.pet.inventory.uniqueCounts[(int)uniqueInfo.uniqueType] += 1;
            break;

        case Shop.ItemType.GARDEN_DECOR:
            GardenDecor decorInfo = Inventory.getGardenDecorTypeInfo((Inventory.GardenDecorType)item.itemIndex);
            PetKeeper.pet.inventory.gardenDecorCounts[(int)decorInfo.gardenDecorType] += 1;
            break;
        }

        PetKeeper.pet.takeCurrency(item.price);

        GameControl.playPostMortemAudioClip(A_BuySound);

        item.amount -= 1;
        if (item.amount <= 0)
        {
            ShopUI.shop.buyList.Remove(item);
        }

        InventoryUI.reRender = true;
        ShopUI.reRender      = true;
    }