Add ui, font

This commit is contained in:
HungDK
2025-09-15 20:17:49 +07:00
parent e2c272b3d5
commit 2b3af4037a
9 changed files with 1288 additions and 480 deletions
+4 -53
View File
@@ -209,7 +209,7 @@ public class CECHostPlayer : MonoBehaviour
Debug.Log("[Inventory] OWN_ITEM_INFO received");
var data = Msg.dwParam1 as byte[];
int hostId = Convert.ToInt32(Msg.dwParam3);
LogInventoryPacket("OWN_ITEM_INFO", data, hostId);
PerfectWorld.Scripts.Managers.EC_Inventory.LogInventoryPacket("OWN_ITEM_INFO", data, hostId);
break;
}
@@ -226,19 +226,19 @@ public class CECHostPlayer : MonoBehaviour
case CommandID.OWN_IVTR_DATA:
{
Debug.Log("[Inventory] OWN_IVTR_DATA received");
LogInventoryPacket("OWN_IVTR_DATA", data, hostId);
PerfectWorld.Scripts.Managers.EC_Inventory.LogInventoryPacket("OWN_IVTR_DATA", data, hostId);
break;
}
case CommandID.OWN_IVTR_DETAIL_DATA:
{
Debug.Log("[Inventory] OWN_IVTR_DETAIL_DATA received");
LogInventoryPacket("OWN_IVTR_DETAIL_DATA", data, hostId);
PerfectWorld.Scripts.Managers.EC_Inventory.LogInventoryPacket("OWN_IVTR_DETAIL_DATA", data, hostId);
// Parse and store
if (data != null && data.Length >= 6)
{
byte byPackage = data[0];
byte ivtrSize = data[1];
if (PerfectWorld.Scripts.Managers.EC_Inventory.TryParseInventoryDetail(data, out var pkg, out var size, out var items))
if (PerfectWorld.Scripts.Managers.EC_IvtrItem.TryParseInventoryDetail(data, out var pkg, out var size, out var items))
{
PerfectWorld.Scripts.Managers.EC_Inventory.UpdatePack(pkg, size, items);
}
@@ -266,55 +266,6 @@ public class CECHostPlayer : MonoBehaviour
}
private void LogInventoryPacket(string tag, byte[] buffer, int hostId)
{
if (buffer == null)
{
Debug.LogWarning($"[Inventory] {tag}: buffer is null (hostId={hostId})");
return;
}
int index = 0;
if (buffer.Length < 6)
{
Debug.LogWarning($"[Inventory] {tag}: buffer too small: {buffer.Length} bytes (hostId={hostId})");
LogInventoryRaw(tag, buffer);
return;
}
byte byPackage = buffer[index++];
byte ivtrSize = buffer[index++];
uint contentLength = BitConverter.ToUInt32(buffer, index); index += 4;
int remaining = buffer.Length - index;
int contentBytes = remaining;
if (contentLength < (uint)remaining)
{
contentBytes = (int)contentLength;
}
Debug.Log($"[Inventory] {tag}: hostId={hostId}, totalBytes={buffer.Length}, byPackage={byPackage}, ivtrSize={ivtrSize}, contentLength={contentLength}, actualContentBytes={contentBytes}");
if (contentBytes > 0)
{
byte[] content = new byte[contentBytes];
Buffer.BlockCopy(buffer, index, content, 0, contentBytes);
Debug.Log($"[Inventory] {tag}: content HEX=\n{BitConverter.ToString(content)}");
}
int trailing = buffer.Length - (index + contentBytes);
if (trailing > 0)
{
byte[] tail = new byte[trailing];
Buffer.BlockCopy(buffer, index + contentBytes, tail, 0, trailing);
Debug.Log($"[Inventory] {tag}: trailing {trailing} byte(s) HEX=\n{BitConverter.ToString(tail)}");
}
}
private void LogInventoryRaw(string tag, byte[] buffer)
{
Debug.Log($"[Inventory] {tag}: RAW HEX (len={buffer?.Length ?? 0})=\n{(buffer == null ? "<null>" : BitConverter.ToString(buffer))}");
}
private void SetPos(Vector3 pos)
{
transform.position = pos;