Example #1
0
 public void OnBuyItem(int shopId, int itemId, int shopItemId)
 {
     BuyItem?.Invoke(Bot, shopId, itemId, shopItemId);
 }
Example #2
0
    private void PurchaseManager_OnPurchaseConsumable(PurchaseEventArgs args)
    {
        //MainMenuManager _menu = FindObjectOfType<MainMenuManager>();
        int     add       = 0;
        BuyItem buyFunc   = null;
        Info    infoPanel = null;

        switch (args.purchasedProduct.definition.id)
        {
        case "money_0":
            Log.WriteLog($"Purchased {moneyAdd_0} money.", Log.LevelsOfLogs.INFO, "Purchaser");
            add     = moneyAdd_0;
            buyFunc = MoneyManager.AddMoney;
            //infoPanel = _menu.CoinsAddInfoPanel;
            break;

        case "money_1":
            Log.WriteLog($"Purchased {moneyAdd_1} money.", Log.LevelsOfLogs.INFO, "Purchaser");
            add     = moneyAdd_1;
            buyFunc = MoneyManager.AddMoney;
            //infoPanel = _menu.CoinsAddInfoPanel;
            break;

        case "money_2":
            Log.WriteLog($"Purchased {moneyAdd_2} money.", Log.LevelsOfLogs.INFO, "Purchaser");
            add     = moneyAdd_2;
            buyFunc = MoneyManager.AddMoney;
            //infoPanel = _menu.CoinsAddInfoPanel;
            break;

        case "gems_0":
            Log.WriteLog($"Purchased {gemsAdd_0} gems.", Log.LevelsOfLogs.INFO, "Purchaser");
            add     = gemsAdd_0;
            buyFunc = MoneyManager.AddGems;
            //infoPanel = _menu.GemsAddInfoPanel;
            break;

        case "gems_1":
            Log.WriteLog($"Purchased {gemsAdd_1} gems.", Log.LevelsOfLogs.INFO, "Purchaser");
            add     = gemsAdd_1;
            buyFunc = MoneyManager.AddGems;
            // infoPanel = _menu.GemsAddInfoPanel;
            break;

        case "gems_2":
            Log.WriteLog($"Purchased {gemsAdd_2} gems.", Log.LevelsOfLogs.INFO, "Purchaser");
            add     = gemsAdd_2;
            buyFunc = MoneyManager.AddGems;
            // infoPanel = _menu.GemsAddInfoPanel;
            break;

        case "support_0":
            Log.WriteLog("Supoort purching.", Log.LevelsOfLogs.INFO, "Purchaser");
            add = moneyAdd_2;
            break;

        default:
            Log.WriteLog("You try to purche item that is not in list!", Log.LevelsOfLogs.ERROR, "Purchaser");
            break;
        }
        buyFunc?.Invoke(add);
        infoPanel?.Invoke(add);
    }