This commit is contained in:
Le Duc Anh
2025-09-08 16:29:40 +07:00
9 changed files with 255 additions and 76 deletions
@@ -1,25 +1,64 @@
using BrewMonster;
using CSNetwork;
using CSNetwork;
using CSNetwork.GPDataType;
using System;
using System.Runtime.InteropServices;
namespace PerfectWorld.Scripts.Managers
{
namespace BrewMonster.Managers
{
public class EC_ManPlayer : IMsgHandler, IAutoInitialize
public class EC_ManPlayer : IMsgHandler
{
public void Initialize()
{
EC_ManMessage.RegisterHandler(this); // add to the message handler list
}
public int HandlerId => MANAGER_INDEX.MAN_PLAYER;
public int HandlerId => (int)MANAGER_INDEX.MAN_PLAYER;
public bool ProcessMessage(ECMSG Msg)
{
if (Msg.iSubID == 0)
{
}
else if (Msg.iSubID < 0)
{
switch ((int)Msg.dwMsg)
{
case int value when value == EC_MsgDef.MSG_PM_PLAYERINFO:
{
OnMsgPlayerInfo(Msg);
break;
}
}
}
else
{
}
return true;
}
public void OnMsgPlayerInfo(ECMSG Msg)
{
int iHostID = (int)Msg.dwParam3;
int lenghtByte = Marshal.SizeOf<int>();
byte[] byteArray = new byte[lenghtByte];
byte[] data = (byte[])Msg.dwParam1;
for (int i = 0; i < lenghtByte; i++)
{
byteArray[i] = data[i];
}
int cid = BitConverter.ToInt32(byteArray);
switch (Convert.ToInt32(Msg.dwParam2))
{
case CommandID.PLAYER_INFO_1:
case CommandID.PLAYER_ENTER_WORLD:
case CommandID.PLAYER_ENTER_SLICE:
{
if (cid != iHostID)
{
GameController.Instance.Log("ElsePlayer has join");
}
break;
}
}
}
}
}
}
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8511a50fc48e2cf4bbd9a6bf91442d50
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,16 @@
using UnityEngine;
public class EC_ElsePlayer : MonoBehaviour
{
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 0feb504dc7975e84dab03230dd3277a8