From a73bacfa879729f38e8dc7c8a4c8d1d0ec56fdd6 Mon Sep 17 00:00:00 2001 From: MinhHai Date: Tue, 2 Dec 2025 14:28:00 +0700 Subject: [PATCH] fix UIPlayer class --- .../Scripts/Task/CECTaskInterface.cs | 19 ++++++++----------- Assets/PerfectWorld/Scripts/UI/HUDPlayer.cs | 2 +- Assets/PerfectWorld/Scripts/UI/UIPlayer.cs | 7 ++++--- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/Assets/PerfectWorld/Scripts/Task/CECTaskInterface.cs b/Assets/PerfectWorld/Scripts/Task/CECTaskInterface.cs index e0a314c53d..73221fb451 100644 --- a/Assets/PerfectWorld/Scripts/Task/CECTaskInterface.cs +++ b/Assets/PerfectWorld/Scripts/Task/CECTaskInterface.cs @@ -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); + } } diff --git a/Assets/PerfectWorld/Scripts/UI/HUDPlayer.cs b/Assets/PerfectWorld/Scripts/UI/HUDPlayer.cs index ce7c7ea87c..8e55d1efad 100644 --- a/Assets/PerfectWorld/Scripts/UI/HUDPlayer.cs +++ b/Assets/PerfectWorld/Scripts/UI/HUDPlayer.cs @@ -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}%"; diff --git a/Assets/PerfectWorld/Scripts/UI/UIPlayer.cs b/Assets/PerfectWorld/Scripts/UI/UIPlayer.cs index 3f6b670746..7965f78638 100644 --- a/Assets/PerfectWorld/Scripts/UI/UIPlayer.cs +++ b/Assets/PerfectWorld/Scripts/UI/UIPlayer.cs @@ -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(); + hostplayer = GetComponentInParent(); if (hostplayer == null) { Debug.LogError("Host player not found");