Fix dead and revive error before enter world
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user