1
This commit is contained in:
@@ -2126,7 +2126,9 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 防止金币不足退出房间弹窗重复弹出(金币恢复后自动重置)
|
||||
/// 防止金币不足退出房间弹窗重复弹出。
|
||||
/// 一旦弹出后保持 true,直到金币恢复到能发射最小炮倍才重置,
|
||||
/// 确保同一时段内屏幕上最多只显示一个弹窗。
|
||||
/// </summary>
|
||||
private bool _isGoldInsufficientPanelShown = false;
|
||||
|
||||
@@ -2144,6 +2146,7 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
|
||||
/// 金币不足则不切换攻击状态、不发送开炮请求,避免无效请求与服务端拒绝。
|
||||
/// ⭐ 当金币不足以发射最小炮倍时,弹窗询问是否退出房间:
|
||||
/// 确认 → 走退出房间逻辑;X号 → 关闭面板。本地判断,不发送开炮请求。
|
||||
/// 弹窗期间通过 _isGoldInsufficientPanelShown 保证全局只显示一个。
|
||||
/// </summary>
|
||||
private bool HasEnoughGoldToFire(bool isSanShe)
|
||||
{
|
||||
@@ -2152,24 +2155,30 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
|
||||
long need = currSitData.consumeGoldNum * count;
|
||||
if (currSitData.goldNum >= need)
|
||||
{
|
||||
// 金币足够:重置弹窗标志,允许下次不足时再次弹窗
|
||||
// 金币够当前炮倍:重置弹窗标志
|
||||
_isGoldInsufficientPanelShown = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// 金币不足当前炮倍:进一步判断是否连最小炮倍都发射不起
|
||||
long minConsume = GetMinConsumeGold();
|
||||
if (minConsume > 0 && currSitData.goldNum < minConsume)
|
||||
|
||||
// 金币恢复到能发射最小炮倍 → 重置弹窗标志,允许下次不足时再次弹窗
|
||||
if (minConsume <= 0 || currSitData.goldNum >= minConsume)
|
||||
{
|
||||
// ⭐ 金币不足以发射最小炮倍 → 弹窗询问是否退出房间(防重复)
|
||||
if (!_isGoldInsufficientPanelShown)
|
||||
{
|
||||
_isGoldInsufficientPanelShown = true;
|
||||
UIManager.Instance.ShowTiShi(
|
||||
"金币不足,是否退出房间?",
|
||||
() => RequestLeaveRoom(),
|
||||
true);
|
||||
}
|
||||
_isGoldInsufficientPanelShown = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ⭐ 金币不足以发射最小炮倍 → 弹窗询问是否退出房间
|
||||
// _isGoldInsufficientPanelShown 保证只弹一个,不重复
|
||||
if (!_isGoldInsufficientPanelShown)
|
||||
{
|
||||
_isGoldInsufficientPanelShown = true;
|
||||
UIManager.Instance.ShowTiShi(
|
||||
"金币不足,是否退出房间?",
|
||||
() => RequestLeaveRoom(),
|
||||
true);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user