fix UIPlayer class

This commit is contained in:
MinhHai
2025-12-02 14:28:00 +07:00
parent f827878785
commit a73bacfa87
3 changed files with 13 additions and 15 deletions
@@ -7,6 +7,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using CSNetwork;
using UnityEngine;
namespace BrewMonster.Scripts.Task
@@ -362,12 +363,7 @@ namespace BrewMonster.Scripts.Task
return false;
}
// allocate internal buffers and copy; remaining bytes are zero-initialized in C#
// m_pActiveListRawBuf = new byte[TaskInterfaceConstants.TASK_ACTIVE_LIST_BUF_SIZE];
// {
// int copy = Mathf.Min(iActiveListLen, TaskInterfaceConstants.TASK_ACTIVE_LIST_BUF_SIZE);
// if (copy > 0) System.Buffer.BlockCopy(pActiveListBuf, 0, m_pActiveListRawBuf, 0, copy);
// }
m_pActiveListBuf = new ActiveTaskList();
m_pActiveListBuf.ReadFromBuffer(pActiveListBuf);
@@ -1310,11 +1306,6 @@ namespace BrewMonster.Scripts.Task
if (m_TasksToConfirm.TryGetValue(iTaskID, out ret)) return ret;
return false;
}
public void NotifyServer(ref task_notify_base pBuf, uint sz)
{
UnityGameSession.c2s_CmdTaskNotify(ref pBuf, sz);
}
public bool CheckVersion()
{
@@ -1436,6 +1427,12 @@ namespace BrewMonster.Scripts.Task
break;
}
}
public void NotifyServer(byte[] pBuf, uint sz)
{
// g_pGame->GetGameSession()->c2s_CmdTaskNotify(pBuf, sz);
UnityGameSession.c2s_CmdTaskNotify(pBuf, sz);
}
}
+1 -1
View File
@@ -44,7 +44,7 @@ namespace BrewMonster
private void UpdateHostPlayerInfoUI(cmd_self_info_00 obj)
{
BMLogger.LogError("Update HUD Player Info");
// BMLogger.LogError("Update HUD Player Info");
healthText.text = $"{obj.iHP}/{obj.iMaxHP}";
manaText.text = $"{obj.iMP}/{obj.iMaxMP}";
expText.text = $"{((float)obj.iExp/neededExp)*100}%";
+4 -3
View File
@@ -9,11 +9,12 @@ namespace BrewMonster.PerfectWorld.Scripts.UI
public class UIPlayer : MonoBehaviour
{
public Image healthImage;
// public TextMeshProUGUI healthText;
public CECHostPlayer hostplayer;
// public TextMeshProUGUI healthText;
[Header("DEBUG")]
[SerializeField] private CECPlayer hostplayer;
private void Start()
{
hostplayer = GetComponentInParent<CECHostPlayer>();
hostplayer = GetComponentInParent<CECPlayer>();
if (hostplayer == null)
{
Debug.LogError("Host player not found");