From 7b85fd8ce8f4c7d970c889aa27f55284afbacf60 Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Thu, 7 Nov 2024 20:20:53 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=AD=E4=BB=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/Script/UI/RoomItem.cs | 21 ------------------- .../Assets/Script/UI/RoomListMenuItem.cs | 10 +++++++++ 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/RoomItem.cs b/AxibugEmuOnline.Client/Assets/Script/UI/RoomItem.cs index 56016ee..19fbd0e 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/RoomItem.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/RoomItem.cs @@ -23,27 +23,6 @@ namespace AxibugEmuOnline.Client public int Index { get; set; } public int roomID { get; private set; } - protected override void Awake() - { - base.Awake(); - - Eventer.Instance.RegisterEvent(EEvent.OnRoomListSingleUpdate, OnRoomSingleUpdate); - } - - protected override void OnDestroy() - { - Eventer.Instance.UnregisterEvent(EEvent.OnRoomListSingleUpdate, OnRoomSingleUpdate); - } - - private void OnRoomSingleUpdate(int roomId) - { - if (roomId != roomID) return; - - if (App.roomMgr.GetRoomListMiniInfo(roomId, out var roomInfo)) - { - UpdateUI(roomInfo); - } - } public void SetData(object data) { diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/RoomListMenuItem.cs b/AxibugEmuOnline.Client/Assets/Script/UI/RoomListMenuItem.cs index 4514913..b18f9da 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/RoomListMenuItem.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/RoomListMenuItem.cs @@ -12,6 +12,7 @@ namespace AxibugEmuOnline.Client { Eventer.Instance.RegisterEvent(EEvent.OnRoomListAllUpdate, OnRoomListUpdateAll); Eventer.Instance.RegisterEvent(EEvent.OnRoomListSingleClose, OnRoomClosed); + Eventer.Instance.RegisterEvent(EEvent.OnRoomListSingleUpdate, OnRoomSingleUpdate); base.Awake(); } @@ -19,6 +20,7 @@ namespace AxibugEmuOnline.Client protected override void OnDestroy() { Eventer.Instance.UnregisterEvent(EEvent.OnRoomListAllUpdate, OnRoomListUpdateAll); + Eventer.Instance.UnregisterEvent(EEvent.OnRoomListSingleUpdate, OnRoomSingleUpdate); Eventer.Instance.UnregisterEvent(EEvent.OnRoomListSingleClose, OnRoomClosed); } @@ -36,6 +38,14 @@ namespace AxibugEmuOnline.Client return res; } + private void OnRoomSingleUpdate(int obj) + { + if (m_entering) + { + RefreshUI(); + } + } + private void OnRoomListUpdateAll(int obj) { if (m_entering)