private void TryToBuyBackground(int id, Button button) { Debug.Log("Cost: " + _itemsConfig[id].cost); if (_resourcesManager.BuyItem(_itemsConfig[id].cost)) { Debug.Log("Buyed!"); button.image.color = Color.white; SetBackground(id); _itemsConfig[id].hasItem = true; //File.WriteAllText(pathForJson, JsonArrayParser.ToJson(_itemsConfig)); //MainMenuManager _menu = FindObjectOfType<MainMenuManager>(); //_menu.SuccessPurchasingInfoPanel(); //_menu.UpdateGemsValue(); } else { //MainMenuManager _menu = FindObjectOfType<MainMenuManager>(); //if (!_menu) //{ // Log.WriteLog("Can not set MainMenuManager.", Log.LevelsOfLogs.ERROR, "BuyItemManager"); // return; //} //_menu.NeedMoreGemsInfoPanel(); } }