This commit is contained in:
ALIENJACK\alien 2024-11-07 20:20:53 +08:00
parent 1c589ac3be
commit 7b85fd8ce8
2 changed files with 10 additions and 21 deletions

View File

@ -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<int>(EEvent.OnRoomListSingleUpdate, OnRoomSingleUpdate);
}
protected override void OnDestroy()
{
Eventer.Instance.UnregisterEvent<int>(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)
{

View File

@ -12,6 +12,7 @@ namespace AxibugEmuOnline.Client
{
Eventer.Instance.RegisterEvent<int>(EEvent.OnRoomListAllUpdate, OnRoomListUpdateAll);
Eventer.Instance.RegisterEvent<int>(EEvent.OnRoomListSingleClose, OnRoomClosed);
Eventer.Instance.RegisterEvent<int>(EEvent.OnRoomListSingleUpdate, OnRoomSingleUpdate);
base.Awake();
}
@ -19,6 +20,7 @@ namespace AxibugEmuOnline.Client
protected override void OnDestroy()
{
Eventer.Instance.UnregisterEvent<int>(EEvent.OnRoomListAllUpdate, OnRoomListUpdateAll);
Eventer.Instance.UnregisterEvent<int>(EEvent.OnRoomListSingleUpdate, OnRoomSingleUpdate);
Eventer.Instance.UnregisterEvent<int>(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)