master #40
@ -89,7 +89,7 @@ namespace AxibugEmuOnline.Client.Manager
|
|||||||
List<Protobuf_Room_MiniInfo> result = new List<Protobuf_Room_MiniInfo>();
|
List<Protobuf_Room_MiniInfo> result = new List<Protobuf_Room_MiniInfo>();
|
||||||
foreach (var item in dictRoomListID2Info)
|
foreach (var item in dictRoomListID2Info)
|
||||||
{
|
{
|
||||||
result.Add(new Protobuf_Room_MiniInfo());
|
result.Add(item.Value);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using AxibugEmuOnline.Client.ClientCore;
|
using AxibugEmuOnline.Client.ClientCore;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using VirtualNes.Core;
|
|
||||||
|
|
||||||
namespace AxibugEmuOnline.Client
|
namespace AxibugEmuOnline.Client
|
||||||
{
|
{
|
||||||
@ -16,10 +15,14 @@ namespace AxibugEmuOnline.Client
|
|||||||
|
|
||||||
public override void OnExcute()
|
public override void OnExcute()
|
||||||
{
|
{
|
||||||
|
object state = m_gameUI.GetQuickState();
|
||||||
Stopwatch sw = Stopwatch.StartNew();
|
Stopwatch sw = Stopwatch.StartNew();
|
||||||
m_gameUI.Core.LoadState(m_gameUI.GetQuickState());
|
if (state != null)
|
||||||
sw.Stop();
|
{
|
||||||
App.log.Info($"{m_gameUI.RomFile.Platform}====>快照加载耗时:{sw.Elapsed.TotalMilliseconds}ms");
|
m_gameUI.Core.LoadState(state);
|
||||||
|
sw.Stop();
|
||||||
|
App.log.Info($"{m_gameUI.RomFile.Platform}====>快照加载耗时:{sw.Elapsed.TotalMilliseconds}ms");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -517,6 +517,7 @@ public class ItemPresent : GridLayoutGroup, IVirtualLayout
|
|||||||
}
|
}
|
||||||
public RectTransform GetItemUIIfExist(int index)
|
public RectTransform GetItemUIIfExist(int index)
|
||||||
{
|
{
|
||||||
|
if (index < 0) return null;
|
||||||
if (children.Count <= index) return null;
|
if (children.Count <= index) return null;
|
||||||
|
|
||||||
var proxy = children[index];
|
var proxy = children[index];
|
||||||
|
@ -1,34 +1,45 @@
|
|||||||
using AxibugEmuOnline.Client.ClientCore;
|
using AxibugEmuOnline.Client.ClientCore;
|
||||||
using AxibugProtobuf;
|
using AxibugEmuOnline.Client.Event;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace AxibugEmuOnline.Client
|
namespace AxibugEmuOnline.Client
|
||||||
{
|
{
|
||||||
public class RoomListMenuItem : VirtualSubMenuItem
|
public class RoomListMenuItem : VirtualSubMenuItem
|
||||||
{
|
{
|
||||||
|
bool m_entering;
|
||||||
|
|
||||||
|
protected override void Awake()
|
||||||
|
{
|
||||||
|
Eventer.Instance.RegisterEvent<int>(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<object> datas)
|
protected override void GetVirtualListDatas(Action<object> datas)
|
||||||
{
|
{
|
||||||
App.StartCoroutine(Test(datas));
|
var roomList = App.roomMgr.GetRoomList();
|
||||||
|
datas.Invoke(roomList);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerator Test(Action<object> datas)
|
|
||||||
{
|
|
||||||
yield return null;
|
|
||||||
|
|
||||||
List<Protobuf_Room_MiniInfo> fakeData = new List<Protobuf_Room_MiniInfo>()
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ namespace AxibugEmuOnline.Client
|
|||||||
|
|
||||||
protected override MenuItem GetItemUIByIndex(int index)
|
protected override MenuItem GetItemUIByIndex(int index)
|
||||||
{
|
{
|
||||||
return itemGroup.GetItemUIByDataIndex(index).GetComponent<MenuItem>();
|
return itemGroup.GetItemUIByDataIndex(index)?.GetComponent<MenuItem>();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Awake()
|
protected override void Awake()
|
||||||
@ -63,13 +63,16 @@ namespace AxibugEmuOnline.Client
|
|||||||
protected override bool OnCmdEnter()
|
protected override bool OnCmdEnter()
|
||||||
{
|
{
|
||||||
var item = GetItemUIByIndex(SelectIndex);
|
var item = GetItemUIByIndex(SelectIndex);
|
||||||
return item.OnEnterItem();
|
if (item != null)
|
||||||
|
return item.OnEnterItem();
|
||||||
|
else
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnCmdBack()
|
protected override void OnCmdBack()
|
||||||
{
|
{
|
||||||
var item = GetItemUIByIndex(SelectIndex);
|
var item = GetItemUIByIndex(SelectIndex);
|
||||||
item.OnExitItem();
|
item?.OnExitItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LateUpdate()
|
private void LateUpdate()
|
||||||
|
@ -3,11 +3,7 @@ using DG.Tweening;
|
|||||||
using DG.Tweening.Core;
|
using DG.Tweening.Core;
|
||||||
using DG.Tweening.Plugins.Options;
|
using DG.Tweening.Plugins.Options;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using VirtualNes.Core;
|
|
||||||
using App = AxibugEmuOnline.Client.ClientCore.App;
|
|
||||||
|
|
||||||
namespace AxibugEmuOnline.Client
|
namespace AxibugEmuOnline.Client
|
||||||
{
|
{
|
||||||
@ -61,6 +57,15 @@ namespace AxibugEmuOnline.Client
|
|||||||
var thirdMenuGroup = SubMenuItemGroup as ThirdMenuRoot;
|
var thirdMenuGroup = SubMenuItemGroup as ThirdMenuRoot;
|
||||||
thirdMenuGroup.itemGroup.Clear();
|
thirdMenuGroup.itemGroup.Clear();
|
||||||
|
|
||||||
|
RefreshUI();
|
||||||
|
|
||||||
|
if (SubMenuItemGroup != null) SubMenuItemGroup.SetSelect(true);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void RefreshUI()
|
||||||
|
{
|
||||||
GetVirtualListDatas((datas) =>
|
GetVirtualListDatas((datas) =>
|
||||||
{
|
{
|
||||||
var thirdMenuGroup = SubMenuItemGroup as ThirdMenuRoot;
|
var thirdMenuGroup = SubMenuItemGroup as ThirdMenuRoot;
|
||||||
@ -69,10 +74,6 @@ namespace AxibugEmuOnline.Client
|
|||||||
thirdMenuGroup.itemGroup.UpdateProxyVisualState();
|
thirdMenuGroup.itemGroup.UpdateProxyVisualState();
|
||||||
thirdMenuGroup.ResetToFirst();
|
thirdMenuGroup.ResetToFirst();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (SubMenuItemGroup != null) SubMenuItemGroup.SetSelect(true);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void GetVirtualListDatas(Action<object> datas);
|
protected abstract void GetVirtualListDatas(Action<object> datas);
|
||||||
|
Loading…
Reference in New Issue
Block a user