Fix dead and revive error before enter world

This commit is contained in:
HungDK
2026-03-24 17:14:45 +07:00
parent f3e57850b6
commit 445ff4ae62
4 changed files with 34 additions and 9 deletions
@@ -6,6 +6,7 @@ namespace BrewMonster
public class PopupManager : MonoBehaviour
{
public static PopupManager Instance { get; private set; }
private static bool s_shouldShowRevivePopup;
[SerializeField] private GameObject ReviveOptionPopup;
@@ -14,6 +15,7 @@ namespace BrewMonster
if (Instance == null)
{
Instance = this;
ApplyRevivePopupState();
}
else
{
@@ -31,11 +33,35 @@ namespace BrewMonster
public void OnPlayerDied()
{
ReviveOptionPopup.SetActive(true);
s_shouldShowRevivePopup = true;
ApplyRevivePopupState();
}
public void OnPlayerRevived()
{
ReviveOptionPopup.SetActive(false);
s_shouldShowRevivePopup = false;
ApplyRevivePopupState();
}
private void ApplyRevivePopupState()
{
if (ReviveOptionPopup == null)
{
return;
}
ReviveOptionPopup.SetActive(s_shouldShowRevivePopup);
}
public static void NotifyPlayerDied()
{
s_shouldShowRevivePopup = true;
Instance?.ApplyRevivePopupState();
}
public static void NotifyPlayerRevived()
{
s_shouldShowRevivePopup = false;
Instance?.ApplyRevivePopupState();
}
}
+1 -4
View File
@@ -876,10 +876,7 @@ namespace BrewMonster
EventBus.PublishChannel(GetCharacterID(), new ClearComActFlagAllRankNodesEvent(true));
PlayAction((int)PLAYER_ACTION_TYPE.ACT_GROUNDDIE);
if (PopupManager.Instance != null)
{
PopupManager.Instance.OnPlayerDied();
}
PopupManager.NotifyPlayerDied();
}
private bool NormalAttackObject(int idTarget, bool bForceAttack, bool bMoreClose = false)
+2 -2
View File
@@ -1,4 +1,4 @@
using BrewMonster.Network;
using BrewMonster.Network;
using BrewMonster.Scripts;
using CSNetwork;
using CSNetwork.GPDataType;
@@ -35,7 +35,7 @@ namespace BrewMonster
}
public void OnMsgHstGoto(in ECMSG Msg)
{
PopupManager.Instance.OnPlayerRevived();
PopupManager.NotifyPlayerRevived();
// p1 is a byte[] buffer; parse into cmd_notify_hostpos then set position
// p1 是一个 byte[] 缓冲区;解析为 cmd_notify_hostpos 然后设置位置
byte[] buf = (byte[])Msg.dwParam1;
+3 -1
View File
@@ -1454,9 +1454,11 @@ namespace BrewMonster
//m_pWorkMan.StartWork_p0(pWork);
EventBus.PublishChannel(GetCharacterID(), new ClearComActFlagAllRankNodesEvent(true));
PlayAction((int)PLAYER_ACTION_TYPE.ACT_GROUNDDIE);
PopupManager.NotifyPlayerDied();
}
else
{
PopupManager.NotifyPlayerRevived();
UnityGameSession.c2s_CmdGetAllData(true, true, false);
UnityGameSession.c2s_CmdSendEnterPKPrecinct();
UnityGameSession.RequesrQueryPlayerCash();
@@ -2632,7 +2634,7 @@ namespace BrewMonster
{
/* CECGameUIMan pGameUI = g_pGame.GetGameRun().GetUIManager().GetInGameUIMan();
pGameUI.PopupReviveDialog(true);*/
PopupManager.Instance.OnPlayerDied();
PopupManager.NotifyPlayerDied();
}
m_bEnterGame = true;
}