add logic player exit game

This commit is contained in:
NguyenVanDat
2026-02-27 11:09:47 +07:00
parent 0b90bd8aa2
commit 32cb522970
3 changed files with 26 additions and 0 deletions
@@ -109,6 +109,9 @@ namespace PerfectWorld.Scripts.Managers
}
TransmitMessage(Msg);
break;
case EC_MsgDef.MSG_PM_PLAYEREXIT:
OnMsgPlayerExit(Msg);
break;
}
}
else
@@ -819,6 +822,13 @@ namespace PerfectWorld.Scripts.Managers
}
}
}
// Handler of MSG_PM_PLAYEREXIT
public bool OnMsgPlayerExit(ECMSG Msg)
{
cmd_player_leave_world pCmd = GPDataTypeHelper.FromBytes<cmd_player_leave_world>((byte[])Msg.dwParam1);
ElsePlayerLeave(pCmd.id, true);
return true;
}
}
}
public struct EC_PLAYERLOADRESULT
@@ -2589,5 +2589,12 @@ namespace CSNetwork.GPDataType
public ushort equip_idx;
public uint cost;
};
// player leaves the world
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct cmd_player_leave_world
{
public int id;
};
}
@@ -1140,6 +1140,15 @@ namespace CSNetwork
case CommandID.CLEAR_TESSERA:
EC_ManMessage.PostMessage(EC_MsgDef.MSG_HST_CLEARTESSERA, MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf, pCmdHeader);
break;
case CommandID.PLAYER_LEAVE_WORLD:
{
cmd_player_leave_world pCmd = GPDataTypeHelper.FromBytes<cmd_player_leave_world>(pDataBuf);
if (ISPLAYERID(pCmd.id))
{
EC_ManMessage.PostMessage(EC_MsgDef.MSG_PM_PLAYEREXIT, MANAGER_INDEX.MAN_PLAYER, -1, pDataBuf, pCmdHeader);
}
break;
}
default:
#if UNITY_EDITOR
if (isDebug)