diff --git a/Assets/Scripts/Managers/BalanceManager.cs b/Assets/Scripts/Managers/BalanceManager.cs index 91e1902..aeb8a28 100644 --- a/Assets/Scripts/Managers/BalanceManager.cs +++ b/Assets/Scripts/Managers/BalanceManager.cs @@ -36,6 +36,7 @@ namespace RR.Common.Managers private int _startGameCost = 10; private int _continueGameCost = 5; private bool _freeGame; + private bool _isSyncingCredits; private void Awake() { @@ -143,6 +144,9 @@ namespace RR.Common.Managers /// private void OnImpulsePaid(int creditsCount) { + if (_isSyncingCredits) + return; + // creditsCount - это количество добавленных кредитов (всегда 1 для одного импульса) // Начисляем стоимость импульса AddBalance(_impulseCost); @@ -302,8 +306,16 @@ namespace RR.Common.Managers if (targetCredits == currentCredits) return; // Кредиты уже синхронизированы - // Устанавливаем кредиты напрямую через SetCredits - ComSystemManager.SetCredits(targetCredits); + _isSyncingCredits = true; + try + { + // Устанавливаем кредиты напрямую через SetCredits + ComSystemManager.SetCredits(targetCredits); + } + finally + { + _isSyncingCredits = false; + } } ///