1
This commit is contained in:
@@ -2029,6 +2029,11 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
|
||||
/// </summary>
|
||||
/// <summary>大喇叭发送中标志:防止回调返回前连点发送按钮导致多发多扣道具</summary>
|
||||
private bool _isSendingDaLaBa;
|
||||
/// <summary>大喇叭发送超时协程:APIManager在code!=0时只弹错误不走成功回调,
|
||||
/// 若只在成功回调复位标志,失败一次(如字数超限)后标志永久卡死,发送按钮失效</summary>
|
||||
private Coroutine _daLaBaTimeoutRoutine;
|
||||
/// <summary>发送超时秒数:超过后自动复位防重入标志,允许重试</summary>
|
||||
private const float DaLaBaTimeoutSeconds = 3f;
|
||||
|
||||
private void OnClickDaLaBaSend()
|
||||
{
|
||||
@@ -2042,11 +2047,21 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
|
||||
}
|
||||
|
||||
_isSendingDaLaBa = true;
|
||||
// ⭐ 超时兜底:后端拒绝(字数超限等)时没有回调,靠超时复位防重入标志
|
||||
if (_daLaBaTimeoutRoutine != null) StopCoroutine(_daLaBaTimeoutRoutine);
|
||||
_daLaBaTimeoutRoutine = StartCoroutine(ResetDaLaBaFlagAfterTimeout());
|
||||
|
||||
// ⭐ 显示格式:"<sprite index=0>【小*鱼】:内容"(前面加喇叭图标 TMP 标签;名字打码:首尾保留、中间一个 *)
|
||||
var userName = GameManager.Instance.user?.BaseInfo?.userName;
|
||||
if (string.IsNullOrEmpty(userName)) userName = "玩家";
|
||||
APIRequestList.SendBroadcast($"<sprite index=0>【{MaskBroadcastName(userName)}】:{msg}", (result) =>
|
||||
{
|
||||
// 成功:停掉超时协程并复位标志
|
||||
if (_daLaBaTimeoutRoutine != null)
|
||||
{
|
||||
StopCoroutine(_daLaBaTimeoutRoutine);
|
||||
_daLaBaTimeoutRoutine = null;
|
||||
}
|
||||
_isSendingDaLaBa = false;
|
||||
// 发送成功:清空输入框并关闭面板(广播内容会通过 LoginBroadcast 全服弹幕显示)
|
||||
if (tmp_DaLaBaInput != null) tmp_DaLaBaInput.text = "";
|
||||
@@ -2062,6 +2077,14 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>超时复位防重入标志:后端返回错误码时APIManager不走成功回调,靠此协程兜底解锁发送按钮</summary>
|
||||
private IEnumerator ResetDaLaBaFlagAfterTimeout()
|
||||
{
|
||||
yield return new WaitForSeconds(DaLaBaTimeoutSeconds);
|
||||
_isSendingDaLaBa = false;
|
||||
_daLaBaTimeoutRoutine = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 玩家名打码(广播格式):保留首尾字符、中间一个 *("小金鱼"→"小*鱼"、"我是大帅哥"→"我*哥")。
|
||||
/// 与召唤卡提示的 MaskUserName(三个星)区分,广播用单星。
|
||||
|
||||
Reference in New Issue
Block a user