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)