修复报错

This commit is contained in:
ALIENJACK\alien 2025-01-23 17:44:02 +08:00
parent a3d3e05edd
commit 771175a8fe
3 changed files with 10 additions and 7 deletions

View File

@ -15,6 +15,7 @@ namespace AxibugEmuOnline.Client
private HttpAPI.Resp_RomInfo webData; private HttpAPI.Resp_RomInfo webData;
/// <summary> 依赖的Rom文件 </summary> /// <summary> 依赖的Rom文件 </summary>
private List<RomFile> dependencies = new List<RomFile>(); private List<RomFile> dependencies = new List<RomFile>();
RomPlatformType m_defaultPlatform;
/// <summary> 指示该Rom是否是多文件Rom </summary> /// <summary> 指示该Rom是否是多文件Rom </summary>
public bool MultiFileRom public bool MultiFileRom
@ -111,7 +112,7 @@ namespace AxibugEmuOnline.Client
} }
} }
public RomPlatformType Platform => webData != null ? (RomPlatformType)webData.ptype : RomPlatformType.Invalid; public RomPlatformType Platform => webData != null ? (RomPlatformType)webData.ptype : m_defaultPlatform;
/// <summary> 指示该Rom信息是否已填充 </summary> /// <summary> 指示该Rom信息是否已填充 </summary>
public bool InfoReady public bool InfoReady
{ {
@ -144,6 +145,7 @@ namespace AxibugEmuOnline.Client
public int Index { get; private set; } public int Index { get; private set; }
/// <summary> 在查询结果中的所在页 </summary> /// <summary> 在查询结果中的所在页 </summary>
public int Page { get; private set; } public int Page { get; private set; }
public string Hash => webData != null ? webData.hash : string.Empty; public string Hash => webData != null ? webData.hash : string.Empty;
/// <summary> 标记是否收藏 </summary> /// <summary> 标记是否收藏 </summary>
public bool Star public bool Star
@ -159,10 +161,11 @@ namespace AxibugEmuOnline.Client
public event Action<RomFile> OnDownloadOver; public event Action<RomFile> OnDownloadOver;
public event Action OnInfoFilled; public event Action OnInfoFilled;
public RomFile(int index, int insidePage) public RomFile(int index, int insidePage, RomPlatformType defaultPlatform)
{ {
Index = index; Index = index;
Page = insidePage; Page = insidePage;
m_defaultPlatform = defaultPlatform;
} }
public void CheckLocalFileState() public void CheckLocalFileState()
@ -305,7 +308,7 @@ namespace AxibugEmuOnline.Client
dependencies.Clear(); dependencies.Clear();
foreach (var romID in webData.parentRomIdsList) foreach (var romID in webData.parentRomIdsList)
{ {
var romFile = new RomFile(Index, Page); var romFile = new RomFile(Index, Page, m_defaultPlatform);
dependencies.Add(romFile); dependencies.Add(romFile);
App.StartCoroutine(App.httpAPI.GetRomInfo(romID, (romInfo) => App.StartCoroutine(App.httpAPI.GetRomInfo(romID, (romInfo) =>
{ {

View File

@ -94,7 +94,7 @@ namespace AxibugEmuOnline.Client
for (int i = 0; i < RomFetchList.Length; i++) for (int i = 0; i < RomFetchList.Length; i++)
{ {
//以后考虑用对象池实例化RomFile //以后考虑用对象池实例化RomFile
RomFetchList[i] = new RomFile(i, i / PAGE_SIZE); RomFetchList[i] = new RomFile(i, i / PAGE_SIZE, m_platform);
} }
SaveRomInfoFromWeb(romList); SaveRomInfoFromWeb(romList);
@ -117,7 +117,7 @@ namespace AxibugEmuOnline.Client
for (int i = 0; i < RomFetchList.Length; i++) for (int i = 0; i < RomFetchList.Length; i++)
{ {
//以后考虑用对象池实例化RomFile //以后考虑用对象池实例化RomFile
RomFetchList[i] = new RomFile(i, i / PAGE_SIZE); RomFetchList[i] = new RomFile(i, i / PAGE_SIZE, m_platform);
} }
SaveRomInfoFromWeb(romList); SaveRomInfoFromWeb(romList);

View File

@ -46,7 +46,7 @@ namespace AxibugEmuOnline.Client
App.StartCoroutine(App.httpAPI.GetRomInfo(roomInfo.GameRomID, (romWebData) => App.StartCoroutine(App.httpAPI.GetRomInfo(roomInfo.GameRomID, (romWebData) =>
{ {
RomFile _romFile = new RomFile(0, 0); RomFile _romFile = new RomFile(0, 0, (RomPlatformType)romWebData.ptype);
_romFile.SetWebData(romWebData); _romFile.SetWebData(romWebData);
s_RomFileCahcesInRoomInfo[roomInfo.GameRomID] = _romFile; s_RomFileCahcesInRoomInfo[roomInfo.GameRomID] = _romFile;