forked from sin365/AxibugEmuOnline
新增收藏列表菜单
This commit is contained in:
parent
5561fdd881
commit
752c4c4511
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 129ec103ea87b1f4ebe9428427bb8988
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -23,7 +23,14 @@ namespace AxibugEmuOnline.Client.ClientCore
|
||||
public static UserDataManager user;
|
||||
//public static AppNetGame netgame;
|
||||
public static AppEmu emu;
|
||||
/// <summary>
|
||||
/// nes Rom库
|
||||
/// </summary>
|
||||
public static RomLib nesRomLib;
|
||||
/// <summary>
|
||||
/// 收藏 Rom库
|
||||
/// </summary>
|
||||
public static RomLib starRomLib;
|
||||
public static HttpAPI httpAPI;
|
||||
public static CacheManager CacheMgr;
|
||||
public static AppRoom roomMgr;
|
||||
@ -68,6 +75,7 @@ namespace AxibugEmuOnline.Client.ClientCore
|
||||
if (bUseLocalWebApi)
|
||||
httpAPI.WebHost = mLocalWebApi;
|
||||
nesRomLib = new RomLib(RomPlatformType.Nes);
|
||||
starRomLib = new RomLib();
|
||||
CacheMgr = new CacheManager();
|
||||
roomMgr = new AppRoom();
|
||||
share = new AppShare();
|
||||
|
@ -87,7 +87,7 @@
|
||||
/// 当Rom收藏状态变化时触发
|
||||
/// <para><see cref="int"/>RomID</para>
|
||||
/// </summary>
|
||||
OnRomStarStateChanged, //TODO 实现这个事件
|
||||
OnRomStarStateChanged,
|
||||
/// <summary>
|
||||
/// 网络即时存档列表更新
|
||||
/// </summary>
|
||||
|
@ -36,7 +36,7 @@ namespace AxibugEmuOnline.Client.Manager
|
||||
void RecvGameStar(byte[] reqData)
|
||||
{
|
||||
Protobuf_Game_Mark_RESP msg = ProtoBufHelper.DeSerizlize<Protobuf_Game_Mark_RESP>(reqData);
|
||||
Eventer.Instance.PostEvent(EEvent.OnRomStarStateChanged, msg.RomID,msg.IsStar == 1);
|
||||
Eventer.Instance.PostEvent(EEvent.OnRomStarStateChanged, msg.RomID, msg.IsStar == 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ namespace AxibugEmuOnline.Client
|
||||
|
||||
public delegate void GetRomListAPI(Action<int, Resp_GameList> callback, AxibugProtobuf.RomPlatformType Platform, int page, int pageSize = 10);
|
||||
public delegate void SearchRomListAPI(Action<int, Resp_GameList> callback, AxibugProtobuf.RomPlatformType Platform, string searchKey, int page, int pageSize = 10);
|
||||
public delegate void GetStarRomListAPI(Action<int, Resp_GameList> callback, AxibugProtobuf.RomPlatformType platform, int page, int pageSize = 10);
|
||||
|
||||
public void GetRomList(Action<int, Resp_GameList> callback, AxibugProtobuf.RomPlatformType platform, int page, int pageSize = 10)
|
||||
{
|
||||
|
@ -28,17 +28,19 @@ namespace AxibugEmuOnline.Client
|
||||
public RomLib(RomPlatformType platform)
|
||||
{
|
||||
m_platform = platform;
|
||||
switch (platform)
|
||||
{
|
||||
case RomPlatformType.Nes:
|
||||
m_romGetFunc = App.httpAPI.GetRomList;
|
||||
m_romSearchFunc = App.httpAPI.SearchRomList;
|
||||
break;
|
||||
}
|
||||
m_romGetFunc = App.httpAPI.GetRomList;
|
||||
m_romSearchFunc = App.httpAPI.SearchRomList;
|
||||
|
||||
Eventer.Instance.RegisterEvent<int, bool>(EEvent.OnRomStarStateChanged, OnRomStarStateChanged);
|
||||
}
|
||||
|
||||
/// <summary> 无参构造函数将会创建一个管理收藏的Rom列表 </summary>
|
||||
public RomLib() : this(RomPlatformType.All)
|
||||
{
|
||||
m_romGetFunc = App.httpAPI.GetMarkList;
|
||||
m_romSearchFunc = App.httpAPI.SearchMarkList;
|
||||
}
|
||||
|
||||
private void OnRomStarStateChanged(int romID, bool star)
|
||||
{
|
||||
var targetRom = nesRomFetchList.FirstOrDefault(rom => rom.ID == romID);
|
||||
@ -71,7 +73,6 @@ namespace AxibugEmuOnline.Client
|
||||
/// <summary>
|
||||
/// 获得所有Rom文件
|
||||
/// </summary>
|
||||
/// <param name="callback"></param>
|
||||
public void FetchRomCount(Action<RomFile[]> callback, string searchKey = null)
|
||||
{
|
||||
lastSearchKey = searchKey;
|
||||
|
@ -0,0 +1,17 @@
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AxibugEmuOnline.Client
|
||||
{
|
||||
public class StarRomListMenuItem : VirtualSubMenuItem
|
||||
{
|
||||
protected override void GetVirtualListDatas(VirtualListDataHandle callback)
|
||||
{
|
||||
App.starRomLib.FetchRomCount((roms) =>
|
||||
{
|
||||
List<RomFile> data = new List<RomFile>(roms);
|
||||
callback.Invoke(data, 0);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 41a13aef8489f0c48a32d159ce1be947
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in New Issue
Block a user