From 88313eee6be649d146b971c289f663e4b82265be Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Thu, 7 Nov 2024 17:58:20 +0800 Subject: [PATCH 1/4] =?UTF-8?q?IEmuCore=E6=8E=A5=E5=8F=A3=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=8E=B7=E5=8F=96gameObject=E7=9A=84=E6=96=B9?= =?UTF-8?q?=E6=B3=95,=E5=AE=8C=E5=96=84=E6=B8=B8=E6=88=8F=E4=B8=AD?= =?UTF-8?q?=E5=92=8CUI=E6=93=8D=E4=BD=9C=E7=9A=84=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E9=9B=86=E5=88=87=E6=8D=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/Script/IEmuCore.cs | 5 ++++- .../Assets/Script/Manager/AppEmu.cs | 19 +++++++++++++------ .../UI/CommandDispatcher/CommandDispatcher.cs | 4 ++++ .../Assets/Script/UI/InGameUI/InGameUI.cs | 18 +++++++++++++++++- .../Assets/Script/UI/OptionUI/OptionUI.cs | 4 ++++ 5 files changed, 42 insertions(+), 8 deletions(-) diff --git a/AxibugEmuOnline.Client/Assets/Script/IEmuCore.cs b/AxibugEmuOnline.Client/Assets/Script/IEmuCore.cs index c60b316..a054acf 100644 --- a/AxibugEmuOnline.Client/Assets/Script/IEmuCore.cs +++ b/AxibugEmuOnline.Client/Assets/Script/IEmuCore.cs @@ -6,12 +6,15 @@ namespace AxibugEmuOnline.Client { public interface IEmuCore { + GameObject gameObject { get; } + object GetState(); byte[] GetStateBytes(); void LoadState(object state); void LoadStateFromBytes(byte[] data); void Pause(); void Resume(); - void SetupScheme(); + void SetupScheme(); + void StartGame(RomFile romFile); } } diff --git a/AxibugEmuOnline.Client/Assets/Script/Manager/AppEmu.cs b/AxibugEmuOnline.Client/Assets/Script/Manager/AppEmu.cs index 6517770..4b59524 100644 --- a/AxibugEmuOnline.Client/Assets/Script/Manager/AppEmu.cs +++ b/AxibugEmuOnline.Client/Assets/Script/Manager/AppEmu.cs @@ -1,4 +1,5 @@ 锘縰sing AxibugEmuOnline.Client.ClientCore; +using MyNes.Core; using UnityEngine; namespace AxibugEmuOnline.Client.Manager @@ -6,6 +7,7 @@ namespace AxibugEmuOnline.Client.Manager public class AppEmu { private GameObject m_emuInstance; + private IEmuCore m_emuCore; public void BeginGame(RomFile romFile) { @@ -14,14 +16,17 @@ namespace AxibugEmuOnline.Client.Manager switch (romFile.Platform) { case EnumPlatform.NES: - var nesEmu = GameObject.Instantiate(Resources.Load("NES/NesEmulator")).GetComponent(); - m_emuInstance = nesEmu.gameObject; - - nesEmu.StartGame(romFile); - LaunchUI.Instance.HideMainMenu(); - InGameUI.Instance.Show(romFile, nesEmu); + m_emuCore = GameObject.Instantiate(Resources.Load("NES/NesEmulator")).GetComponent(); break; } + + m_emuInstance = m_emuCore.gameObject; + + m_emuCore.StartGame(romFile); + LaunchUI.Instance.HideMainMenu(); + InGameUI.Instance.Show(romFile, m_emuCore); + + m_emuCore.SetupScheme(); } public void StopGame() @@ -32,6 +37,8 @@ namespace AxibugEmuOnline.Client.Manager InGameUI.Instance.Hide(); LaunchUI.Instance.ShowMainMenu(); + + ControlScheme.Current = ControlSchemeSetts.Normal; } } } diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandDispatcher.cs b/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandDispatcher.cs index d953740..3beece3 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandDispatcher.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandDispatcher.cs @@ -74,8 +74,12 @@ namespace AxibugEmuOnline.Client } } + //键位映射表需要在按键响应的堆栈结束后处理,防止迭代器修改问题 if (m_waitMapperSetting != null) + { m_keyMapper = m_waitMapperSetting; + m_waitMapperSetting = null; + } } private Dictionary m_waitMapperSetting = null; diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/InGameUI/InGameUI.cs b/AxibugEmuOnline.Client/Assets/Script/UI/InGameUI/InGameUI.cs index 2e402b1..22f3f50 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/InGameUI/InGameUI.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/InGameUI/InGameUI.cs @@ -12,7 +12,7 @@ namespace AxibugEmuOnline.Client public override bool Enable => gameObject.activeInHierarchy; /// 指示该游戏实例是否处于联网模式 - public bool IsOnline => App.roomMgr.RoomState > AxibugProtobuf.RoomGameState.OnlyHost; + public bool IsOnline => App.user.IsLoggedIn ? App.roomMgr.RoomState > AxibugProtobuf.RoomGameState.OnlyHost : false; private RomFile m_rom; public IEmuCore Core { get; private set; } @@ -57,6 +57,7 @@ namespace AxibugEmuOnline.Client public void Show(RomFile currentRom, IEmuCore core) { + m_state = null;//清空游戏快照 CommandDispatcher.Instance.RegistController(this); m_rom = currentRom; @@ -69,6 +70,7 @@ namespace AxibugEmuOnline.Client } Eventer.Instance.RegisterEvent(EEvent.OnRoomWaitStepChange, OnServerStepUpdate); + OptionUI.Instance.OnHide += PopMenu_OnHide; gameObject.SetActiveEx(true); } @@ -82,14 +84,28 @@ namespace AxibugEmuOnline.Client { CommandDispatcher.Instance.UnRegistController(this); + OptionUI.Instance.OnHide -= PopMenu_OnHide; gameObject.SetActiveEx(false); } protected override void OnCmdOptionMenu() { OptionUI.Instance.Pop(menus); + + if (!IsOnline)//单人模式暂停模拟器 + { + Core.Pause(); + } } + //菜单关闭时候 + private void PopMenu_OnHide() + { + if (!IsOnline)//单人模式恢复模拟器的暂停 + Core.Resume(); + } + + public void QuitGame() { Eventer.Instance.UnregisterEvent(EEvent.OnRoomWaitStepChange, OnServerStepUpdate); diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI.cs b/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI.cs index e01c88a..f4bc4dd 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI.cs @@ -24,6 +24,8 @@ namespace AxibugEmuOnline.Client private bool m_bPoped = false; private List m_runtimeMenuItems = new List(); + public event Action OnHide; + private int m_selectIndex = -1; public int SelectIndex { @@ -178,6 +180,8 @@ namespace AxibugEmuOnline.Client m_bPoped = false; ControlScheme.Current = m_lastCS; + + OnHide?.Invoke(); } } From 9f732c7719d09e732a7168b919b29ade2e060356 Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Thu, 7 Nov 2024 19:18:50 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=88=BF=E9=97=B4=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E8=8E=B7=E5=8F=96,=E8=B0=83=E7=94=A8=E5=AE=9E=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/Script/Manager/AppRoom.cs | 2 +- .../Script/UI/InGameUI/InGameUI_LoadState.cs | 11 ++-- .../Script/UI/ItemPresent/ItemPresent.cs | 1 + .../Assets/Script/UI/RoomListMenuItem.cs | 53 +++++++++++-------- .../Assets/Script/UI/ThirdMenuRoot.cs | 9 ++-- .../Assets/Script/UI/VirtualSubMenuItem.cs | 21 ++++---- 6 files changed, 58 insertions(+), 39 deletions(-) diff --git a/AxibugEmuOnline.Client/Assets/Script/Manager/AppRoom.cs b/AxibugEmuOnline.Client/Assets/Script/Manager/AppRoom.cs index e779df2..ff47973 100644 --- a/AxibugEmuOnline.Client/Assets/Script/Manager/AppRoom.cs +++ b/AxibugEmuOnline.Client/Assets/Script/Manager/AppRoom.cs @@ -89,7 +89,7 @@ namespace AxibugEmuOnline.Client.Manager List result = new List(); foreach (var item in dictRoomListID2Info) { - result.Add(new Protobuf_Room_MiniInfo()); + result.Add(item.Value); } return result; } diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/InGameUI/InGameUI_LoadState.cs b/AxibugEmuOnline.Client/Assets/Script/UI/InGameUI/InGameUI_LoadState.cs index 9f33a2a..2c764ad 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/InGameUI/InGameUI_LoadState.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/InGameUI/InGameUI_LoadState.cs @@ -1,6 +1,5 @@ using AxibugEmuOnline.Client.ClientCore; using System.Diagnostics; -using VirtualNes.Core; namespace AxibugEmuOnline.Client { @@ -16,10 +15,14 @@ namespace AxibugEmuOnline.Client public override void OnExcute() { + object state = m_gameUI.GetQuickState(); Stopwatch sw = Stopwatch.StartNew(); - m_gameUI.Core.LoadState(m_gameUI.GetQuickState()); - sw.Stop(); - App.log.Info($"{m_gameUI.RomFile.Platform}====>快照加载耗时:{sw.Elapsed.TotalMilliseconds}ms"); + if (state != null) + { + m_gameUI.Core.LoadState(state); + sw.Stop(); + App.log.Info($"{m_gameUI.RomFile.Platform}====>快照加载耗时:{sw.Elapsed.TotalMilliseconds}ms"); + } } } } diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/ItemPresent/ItemPresent.cs b/AxibugEmuOnline.Client/Assets/Script/UI/ItemPresent/ItemPresent.cs index 6809350..93f3eb8 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/ItemPresent/ItemPresent.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/ItemPresent/ItemPresent.cs @@ -517,6 +517,7 @@ public class ItemPresent : GridLayoutGroup, IVirtualLayout } public RectTransform GetItemUIIfExist(int index) { + if (index < 0) return null; if (children.Count <= index) return null; var proxy = children[index]; diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/RoomListMenuItem.cs b/AxibugEmuOnline.Client/Assets/Script/UI/RoomListMenuItem.cs index a946a85..ee56588 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/RoomListMenuItem.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/RoomListMenuItem.cs @@ -1,34 +1,45 @@ using AxibugEmuOnline.Client.ClientCore; -using AxibugProtobuf; +using AxibugEmuOnline.Client.Event; using System; -using System.Collections; -using System.Collections.Generic; namespace AxibugEmuOnline.Client { public class RoomListMenuItem : VirtualSubMenuItem { + bool m_entering; + + protected override void Awake() + { + Eventer.Instance.RegisterEvent(EEvent.OnRoomListAllUpdate, OnRoomListUpdateAll); + } + + public override bool OnEnterItem() + { + var res = base.OnEnterItem(); + if (res) m_entering = true; + return res; + } + + public override bool OnExitItem() + { + var res = base.OnExitItem(); + if (res) m_entering = false; + return res; + } + + private void OnRoomListUpdateAll(int obj) + { + if (m_entering) + { + RefreshUI(); + } + } + protected override void GetVirtualListDatas(Action datas) { - App.StartCoroutine(Test(datas)); + var roomList = App.roomMgr.GetRoomList(); + datas.Invoke(roomList); } - private IEnumerator Test(Action datas) - { - yield return null; - - List fakeData = new List() - { - new Protobuf_Room_MiniInfo{ GameRomID = 1, RoomID = 1, HostPlayerUID = 1, Player1UID = 1, Player1NickName = "Test1"}, - new Protobuf_Room_MiniInfo{ GameRomID = 2, RoomID = 2, HostPlayerUID = 2, Player1UID = 2, Player1NickName = "Test2"}, - new Protobuf_Room_MiniInfo{ GameRomID = 3, RoomID = 3, HostPlayerUID = 3, Player1UID = 3, Player1NickName = "Test3"}, - new Protobuf_Room_MiniInfo{ GameRomID = 4, RoomID = 4, HostPlayerUID = 4, Player1UID = 4, Player1NickName = "Test4"}, - new Protobuf_Room_MiniInfo{ GameRomID = 5, RoomID = 5, HostPlayerUID = 5, Player1UID = 5, Player1NickName = "Test5"}, - }; - - datas.Invoke(fakeData); - - yield break; - } } } diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/ThirdMenuRoot.cs b/AxibugEmuOnline.Client/Assets/Script/UI/ThirdMenuRoot.cs index cee8137..5b7a3fb 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/ThirdMenuRoot.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/ThirdMenuRoot.cs @@ -47,7 +47,7 @@ namespace AxibugEmuOnline.Client protected override MenuItem GetItemUIByIndex(int index) { - return itemGroup.GetItemUIByDataIndex(index).GetComponent(); + return itemGroup.GetItemUIByDataIndex(index)?.GetComponent(); } protected override void Awake() @@ -63,13 +63,16 @@ namespace AxibugEmuOnline.Client protected override bool OnCmdEnter() { var item = GetItemUIByIndex(SelectIndex); - return item.OnEnterItem(); + if (item != null) + return item.OnEnterItem(); + else + return true; } protected override void OnCmdBack() { var item = GetItemUIByIndex(SelectIndex); - item.OnExitItem(); + item?.OnExitItem(); } private void LateUpdate() diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/VirtualSubMenuItem.cs b/AxibugEmuOnline.Client/Assets/Script/UI/VirtualSubMenuItem.cs index 9f91878..9721a82 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/VirtualSubMenuItem.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/VirtualSubMenuItem.cs @@ -3,11 +3,7 @@ using DG.Tweening; using DG.Tweening.Core; using DG.Tweening.Plugins.Options; using System; -using System.Collections; -using System.Collections.Generic; using UnityEngine; -using VirtualNes.Core; -using App = AxibugEmuOnline.Client.ClientCore.App; namespace AxibugEmuOnline.Client { @@ -15,7 +11,7 @@ namespace AxibugEmuOnline.Client { [SerializeField] protected CanvasGroup RomGroupRoot; - + private TweenerCore m_showTween; @@ -60,7 +56,16 @@ namespace AxibugEmuOnline.Client var thirdMenuGroup = SubMenuItemGroup as ThirdMenuRoot; thirdMenuGroup.itemGroup.Clear(); - + + RefreshUI(); + + if (SubMenuItemGroup != null) SubMenuItemGroup.SetSelect(true); + + return true; + } + + protected void RefreshUI() + { GetVirtualListDatas((datas) => { var thirdMenuGroup = SubMenuItemGroup as ThirdMenuRoot; @@ -69,10 +74,6 @@ namespace AxibugEmuOnline.Client thirdMenuGroup.itemGroup.UpdateProxyVisualState(); thirdMenuGroup.ResetToFirst(); }); - - if (SubMenuItemGroup != null) SubMenuItemGroup.SetSelect(true); - - return true; } protected abstract void GetVirtualListDatas(Action datas); From dfee4fa002ce91fe22ecf346201a43d8c607c2bc Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Thu, 7 Nov 2024 19:23:59 +0800 Subject: [PATCH 3/4] =?UTF-8?q?Room=E5=88=97=E8=A1=A8=E8=BF=AD=E4=BB=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AxibugEmuOnline.Client/Assets/Script/UI/MenuItem.cs | 5 +++++ AxibugEmuOnline.Client/Assets/Script/UI/RoomListMenuItem.cs | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/MenuItem.cs b/AxibugEmuOnline.Client/Assets/Script/UI/MenuItem.cs index 9074238..cf644df 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/MenuItem.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/MenuItem.cs @@ -37,6 +37,11 @@ namespace AxibugEmuOnline.Client.UI Reset(); } + protected virtual void OnDestroy() + { + + } + public void SetData(MenuData data) { Reset(); diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/RoomListMenuItem.cs b/AxibugEmuOnline.Client/Assets/Script/UI/RoomListMenuItem.cs index ee56588..98ed035 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/RoomListMenuItem.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/RoomListMenuItem.cs @@ -11,6 +11,12 @@ namespace AxibugEmuOnline.Client protected override void Awake() { Eventer.Instance.RegisterEvent(EEvent.OnRoomListAllUpdate, OnRoomListUpdateAll); + base.Awake(); + } + + protected override void OnDestroy() + { + Eventer.Instance.UnregisterEvent(EEvent.OnRoomListAllUpdate, OnRoomListUpdateAll); } public override bool OnEnterItem() From 12716c77c86547324b67e449cd32799abaeb6aa8 Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Thu, 7 Nov 2024 19:38:48 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=88=BF=E9=97=B4=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E7=9B=91=E5=90=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/Script/Manager/AppRoom.cs | 6 +- .../Assets/Script/UI/RoomItem.cs | 59 ++++++++++++++----- .../Assets/Script/UI/RoomListMenuItem.cs | 10 ++++ 3 files changed, 56 insertions(+), 19 deletions(-) diff --git a/AxibugEmuOnline.Client/Assets/Script/Manager/AppRoom.cs b/AxibugEmuOnline.Client/Assets/Script/Manager/AppRoom.cs index ff47973..ec0f103 100644 --- a/AxibugEmuOnline.Client/Assets/Script/Manager/AppRoom.cs +++ b/AxibugEmuOnline.Client/Assets/Script/Manager/AppRoom.cs @@ -204,12 +204,12 @@ namespace AxibugEmuOnline.Client.Manager if (msg.UpdateType == 0) { AddOrUpdateRoomList(msg.RoomMiniInfo); - Eventer.Instance.PostEvent(EEvent.OnRoomListSingleUpdate, msg.RoomMiniInfo.GameRomID); + Eventer.Instance.PostEvent(EEvent.OnRoomListSingleUpdate, msg.RoomMiniInfo.RoomID); } else { - RemoveRoomList(msg.RoomMiniInfo.GameRomID); - Eventer.Instance.PostEvent(EEvent.OnRoomListSingleClose, msg.RoomMiniInfo.GameRomID); + RemoveRoomList(msg.RoomMiniInfo.RoomID); + Eventer.Instance.PostEvent(EEvent.OnRoomListSingleClose, msg.RoomMiniInfo.RoomID); } } diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/RoomItem.cs b/AxibugEmuOnline.Client/Assets/Script/UI/RoomItem.cs index 024e174..56016ee 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/RoomItem.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/RoomItem.cs @@ -1,7 +1,7 @@ using AxibugEmuOnline.Client.ClientCore; +using AxibugEmuOnline.Client.Event; using AxibugEmuOnline.Client.UI; using AxibugProtobuf; -using System; using UnityEngine; using UnityEngine.UI; @@ -21,28 +21,55 @@ namespace AxibugEmuOnline.Client private RomFile m_romFile; 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) { - if (data is Protobuf_Room_MiniInfo roomInfo) + var roomInfo = data as Protobuf_Room_MiniInfo; + roomID = roomInfo.RoomID; + + UpdateUI(roomInfo); + } + + private void UpdateUI(Protobuf_Room_MiniInfo roomInfo) + { + var hostNick = roomInfo.GetHostNickName(); + roomInfo.GetRoomPlayers(out var cur, out var max); + SetBaseInfo(string.Empty, $"{hostNick}的房间 - {cur}/{max}"); + SetIcon(null); + + roomInfo.FetchRomFileInRoomInfo(EnumPlatform.NES, (romFile) => { - var hostNick = roomInfo.GetHostNickName(); - roomInfo.GetRoomPlayers(out var cur, out var max); - SetBaseInfo(string.Empty, $"{hostNick}的房间 - {cur}/{max}"); - SetIcon(null); + m_romFile = romFile; - roomInfo.FetchRomFileInRoomInfo(EnumPlatform.NES, (romFile) => - { - m_romFile = romFile; + if (romFile.ID == roomInfo.GameRomID) + Txt.text = romFile.Alias; - if (romFile.ID == roomInfo.GameRomID) - Txt.text = romFile.Alias; - - UpdateRomInfoView(); - App.CacheMgr.GetSpriteCache(romFile.ImageURL, OnGetRomImage); - }); - } + UpdateRomInfoView(); + App.CacheMgr.GetSpriteCache(romFile.ImageURL, OnGetRomImage); + }); } private void Update() diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/RoomListMenuItem.cs b/AxibugEmuOnline.Client/Assets/Script/UI/RoomListMenuItem.cs index 98ed035..4514913 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/RoomListMenuItem.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/RoomListMenuItem.cs @@ -11,12 +11,15 @@ namespace AxibugEmuOnline.Client protected override void Awake() { Eventer.Instance.RegisterEvent(EEvent.OnRoomListAllUpdate, OnRoomListUpdateAll); + Eventer.Instance.RegisterEvent(EEvent.OnRoomListSingleClose, OnRoomClosed); base.Awake(); } + protected override void OnDestroy() { Eventer.Instance.UnregisterEvent(EEvent.OnRoomListAllUpdate, OnRoomListUpdateAll); + Eventer.Instance.UnregisterEvent(EEvent.OnRoomListSingleClose, OnRoomClosed); } public override bool OnEnterItem() @@ -40,6 +43,13 @@ namespace AxibugEmuOnline.Client RefreshUI(); } } + private void OnRoomClosed(int obj) + { + if (m_entering) + { + RefreshUI(); + } + } protected override void GetVirtualListDatas(Action datas) {