fix send cmd

This commit is contained in:
VDH
2025-09-11 18:12:24 +07:00
parent 68c8799242
commit d4cec0a051
9 changed files with 147 additions and 28 deletions
@@ -0,0 +1,130 @@
{
"runtimeTarget": {
"name": ".NETStandard,Version=v2.1/",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETStandard,Version=v2.1": {},
".NETStandard,Version=v2.1/": {
"CSNetwork/1.0.0": {
"dependencies": {
"System.Reflection.Metadata": "9.0.8"
},
"runtime": {
"CSNetwork.dll": {}
}
},
"System.Buffers/4.5.1": {
"runtime": {
"lib/netstandard2.0/System.Buffers.dll": {
"assemblyVersion": "4.0.3.0",
"fileVersion": "4.6.28619.1"
}
}
},
"System.Collections.Immutable/9.0.8": {
"dependencies": {
"System.Memory": "4.5.5",
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
},
"runtime": {
"lib/netstandard2.0/System.Collections.Immutable.dll": {
"assemblyVersion": "9.0.0.0",
"fileVersion": "9.0.825.36511"
}
}
},
"System.Memory/4.5.5": {
"dependencies": {
"System.Buffers": "4.5.1",
"System.Numerics.Vectors": "4.4.0",
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
},
"runtime": {
"lib/netstandard2.0/System.Memory.dll": {
"assemblyVersion": "4.0.1.2",
"fileVersion": "4.6.31308.1"
}
}
},
"System.Numerics.Vectors/4.4.0": {
"runtime": {
"lib/netstandard2.0/System.Numerics.Vectors.dll": {
"assemblyVersion": "4.1.3.0",
"fileVersion": "4.6.25519.3"
}
}
},
"System.Reflection.Metadata/9.0.8": {
"dependencies": {
"System.Collections.Immutable": "9.0.8",
"System.Memory": "4.5.5"
},
"runtime": {
"lib/netstandard2.0/System.Reflection.Metadata.dll": {
"assemblyVersion": "9.0.0.0",
"fileVersion": "9.0.825.36511"
}
}
},
"System.Runtime.CompilerServices.Unsafe/6.0.0": {
"runtime": {
"lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.21.52210"
}
}
}
}
},
"libraries": {
"CSNetwork/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"System.Buffers/4.5.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg==",
"path": "system.buffers/4.5.1",
"hashPath": "system.buffers.4.5.1.nupkg.sha512"
},
"System.Collections.Immutable/9.0.8": {
"type": "package",
"serviceable": true,
"sha512": "sha512-Eje6exD7AGKPg5SIkmjyWTBq0KK6SpfTBfdFUmpGG07mNbYimFJ+jyVnILcs0ikFOXoYTBpBOxKYgAk2hhjYOw==",
"path": "system.collections.immutable/9.0.8",
"hashPath": "system.collections.immutable.9.0.8.nupkg.sha512"
},
"System.Memory/4.5.5": {
"type": "package",
"serviceable": true,
"sha512": "sha512-XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw==",
"path": "system.memory/4.5.5",
"hashPath": "system.memory.4.5.5.nupkg.sha512"
},
"System.Numerics.Vectors/4.4.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-UiLzLW+Lw6HLed1Hcg+8jSRttrbuXv7DANVj0DkL9g6EnnzbL75EB7EWsw5uRbhxd/4YdG8li5XizGWepmG3PQ==",
"path": "system.numerics.vectors/4.4.0",
"hashPath": "system.numerics.vectors.4.4.0.nupkg.sha512"
},
"System.Reflection.Metadata/9.0.8": {
"type": "package",
"serviceable": true,
"sha512": "sha512-oJQezcASFomKvSp+06pzvSFRTnzdUJtiO19peAdZ9RwiqZinBV56u7zW5fEGf2/VrQFL3qZSV7UapgG31XRWQA==",
"path": "system.reflection.metadata/9.0.8",
"hashPath": "system.reflection.metadata.9.0.8.nupkg.sha512"
},
"System.Runtime.CompilerServices.Unsafe/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg==",
"path": "system.runtime.compilerservices.unsafe/6.0.0",
"hashPath": "system.runtime.compilerservices.unsafe.6.0.0.nupkg.sha512"
}
}
}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 9117d707eb63a6442b7b36c6b7669bf3
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 3b9d74e7123c6e144ae35ceb982d00de
@@ -100,7 +100,6 @@ namespace PerfectWorld.Scripts.Managers
{
bool isDoneWorldRender = false;
bool isDoneNPCRender = false;
Debug.Log("HostPlayerInfo1HostPlayerInfo1");
Action actLoadChar = () =>
{
if(!isDoneNPCRender || !isDoneWorldRender)
@@ -82,7 +82,6 @@ namespace BrewMonster.UI
private void OnSelectRoleComplete(RoleInfo roleInfo)
{
Logger.Log($"OnSelectRoleComplete {roleInfo.name} - {roleInfo.roleid}");
// now we have to enter the world
UnityGameSession.SendProtocol(
+2 -2
View File
@@ -126,7 +126,7 @@ public class CECHostPlayer : MonoBehaviour
transform.forward = move;
Debug.LogWarning("HoangDev :HandleMovement");
m_MoveCtrl.GroundMove(Time.deltaTime);
m_MoveCtrl.SendMoveCmd(transform.position, controller.velocity, (int)MoveMode.GP_MOVE_WALK);
m_MoveCtrl.SendMoveCmd(transform.position, controller.velocity, (int)MoveMode.GP_MOVE_RUN);
}
else
{
@@ -193,7 +193,7 @@ public class CECHostPlayer : MonoBehaviour
public void OnMsgHstCorrectPos(in ECMSG Msg)
{
Debug.Log("OnMsgHstCorrectPos");
byte[] buf = (byte[]) Msg.dwParam1; // chỗ bạn lưu pDataBuf
byte[] buf = (byte[])Msg.dwParam1; // chỗ bạn lưu pDataBuf
GCHandle handle = GCHandle.Alloc(buf, GCHandleType.Pinned);
cmd_host_correct_pos pCmd = (cmd_host_correct_pos)Marshal.PtrToStructure(
handle.AddrOfPinnedObject(), typeof(cmd_host_correct_pos));
-22
View File
@@ -21,25 +21,3 @@ struct cmd_notify_hostpos
public int tag;
public int line;
};
enum MoveMode
{
GP_MOVE_WALK = 0,
GP_MOVE_RUN = 1,
GP_MOVE_STAND = 2,
GP_MOVE_FALL = 3,
GP_MOVE_SLIDE = 4,
GP_MOVE_PUSH = 5, // only sent to NPC
GP_MOVE_FLYFALL = 6,
GP_MOVE_RETURN = 7,
GP_MOVE_JUMP = 8,
GP_MOVE_PULL = 9, // only sent to NPC
GP_MOVE_BLINK = 10, // only sent to NPC£¨Ë²ÒÆ£©
GP_MOVE_MASK = 0x0f,
GP_MOVE_TURN = 0x10, // Turnaround
GP_MOVE_DEAD = 0x20,
GP_MOVE_AIR = 0x40,
GP_MOVE_WATER = 0x80,
GP_MOVE_ENVMASK = 0xc0,
};
+6 -2
View File
@@ -65,6 +65,10 @@ public class CECHostMove
m_CmdTimeCnt.Reset();
iMoveMode |= (int)MoveMode.GP_MOVE_DEAD;
// HoangTODO: vCurPos c# unity khác với vCurPos của bên c++ kia
c2s_CmdPlayerMove(vCurPos, vCurPos, iTime/* MOVECMD_INTERVAL */, fSpeed, iMoveMode, m_wMoveStamp++);
m_vLastSevPos = vCurPos;
@@ -78,12 +82,12 @@ public class CECHostMove
{
gamedatasend gamedatasend = new gamedatasend();
//TODO: tim cach convert vector 3 unity sang System.Numerics.Vector3
Debug.LogWarning("vCurPos " + vCurPos);
gamedatasend.Data = C2SCommandFactory.CreatePlayerMove(ToSysVec3(vCurPos), ToSysVec3(vDest), (ushort)iTime, (short)fSpeed, (byte)iMoveMode, wStamp);
gamedatasend.Data = C2SCommandFactory.CreatePlayerMove(ToSysVec3(vCurPos), ToSysVec3(vDest), (ushort)iTime, fSpeed, (byte)iMoveMode, wStamp);
UnityGameSession.SendProtocol(gamedatasend);
Debug.LogWarning("HoangDev : SendProtocolSendProtocolSendProtocol");
}
public void GroundMove(float ftime)
{
m_fMoveTime += ftime;