Beispiel #1
0
    public void HandleClick(string targetProductId)
    {
        int currentDiamondAmount = diamondController.GetDiamondAmount();

        switch (targetProductId)
        {
        case Constants.SmallHeart:
        {
            if (currentDiamondAmount < 15)
            {
                base.ToggleNoDiamondPopup(true);
                return;
            }

            diamondController.SubtractDiamondAmount(15);
            newHeartController.AddHeartAmount(5);
            afterPurchaseEffectController.ShowScreen("0", 5);
            break;
        }

        case Constants.LargeHeart:
        {
            if (currentDiamondAmount < 120)
            {
                base.ToggleNoDiamondPopup(true);
                return;
            }

            diamondController.SubtractDiamondAmount(120);
            newHeartController.AddHeartAmount(50);
            afterPurchaseEffectController.ShowScreen("0", 50);
            break;
        }

        case Constants.HeartRechargeSpeedUp:
        {
            if (currentDiamondAmount < 20)
            {
                base.ToggleNoDiamondPopup(true);
                return;
            }

            diamondController.SubtractDiamondAmount(20);
            newHeartController.UpgradeHeartRechargeSpeed(2);
            afterPurchaseEffectController.ShowScreen("1", 0);
            SetSpeedUpText();
            break;
        }
        }
    }
    public void HandleClick(string targetProductId)
    {
        int currentDiamondAmount = diamondController.GetDiamondAmount();

        switch (targetProductId)
        {
        case Constants.GOLD_MINE_1:
        {
            if (currentDiamondAmount < 10)
            {
                popupController.ToggleNoDiamondPopup(true);
                return;
            }
            itemController.AddItemAmount(ItemController.TYPE.GOLD_MINE, 1);
            diamondController.SubtractDiamondAmount(10);
            afterPurchaseEffectController.ShowScreen("5", 1);
            break;
        }

        case Constants.GOLD_MINE_5:
        {
            if (currentDiamondAmount < 40)
            {
                popupController.ToggleNoDiamondPopup(true);
                return;
            }

            itemController.AddItemAmount(ItemController.TYPE.GOLD_MINE, 5);
            diamondController.SubtractDiamondAmount(40);
            afterPurchaseEffectController.ShowScreen("5", 5);
            break;
        }

        case Constants.EXPLOSIVE_WAREHOUSE_1:
        {
            if (currentDiamondAmount < 10)
            {
                popupController.ToggleNoDiamondPopup(true);
                return;
            }

            itemController.AddItemAmount(ItemController.TYPE.EXPLOSIVE_WAREHOUSE, 1);
            diamondController.SubtractDiamondAmount(10);
            afterPurchaseEffectController.ShowScreen("6", 1);
            break;
        }

        case Constants.EXPLOSIVE_WAREHOUSE_5:
        {
            if (currentDiamondAmount < 40)
            {
                popupController.ToggleNoDiamondPopup(true);
                return;
            }

            itemController.AddItemAmount(ItemController.TYPE.EXPLOSIVE_WAREHOUSE, 5);
            diamondController.SubtractDiamondAmount(40);
            afterPurchaseEffectController.ShowScreen("6", 5);
            break;
        }
        }
    }