From 771175a8fe39da0aeebb4400481d83406c8077e3 Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Thu, 23 Jan 2025 17:44:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/Script/AppMain/Manager/RomLib/RomFile.cs | 11 +++++++---- .../Assets/Script/AppMain/Manager/RomLib/RomLib.cs | 4 ++-- .../Assets/Script/AppMain/Utility.cs | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/RomLib/RomFile.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/RomLib/RomFile.cs index 96d3eb29..edfd0051 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/RomLib/RomFile.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/RomLib/RomFile.cs @@ -15,6 +15,7 @@ namespace AxibugEmuOnline.Client private HttpAPI.Resp_RomInfo webData; /// 依赖的Rom文件 private List dependencies = new List(); + RomPlatformType m_defaultPlatform; /// 指示该Rom是否是多文件Rom 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; /// 指示该Rom信息是否已填充 public bool InfoReady { @@ -143,7 +144,8 @@ namespace AxibugEmuOnline.Client /// 在查询结果中的索引 public int Index { get; private set; } /// 在查询结果中的所在页 - public int Page { get; private set; } + public int Page { get; private set; } + public string Hash => webData != null ? webData.hash : string.Empty; /// 标记是否收藏 public bool Star @@ -159,10 +161,11 @@ namespace AxibugEmuOnline.Client public event Action OnDownloadOver; public event Action OnInfoFilled; - public RomFile(int index, int insidePage) + public RomFile(int index, int insidePage, RomPlatformType defaultPlatform) { Index = index; Page = insidePage; + m_defaultPlatform = defaultPlatform; } public void CheckLocalFileState() @@ -305,7 +308,7 @@ namespace AxibugEmuOnline.Client dependencies.Clear(); foreach (var romID in webData.parentRomIdsList) { - var romFile = new RomFile(Index, Page); + var romFile = new RomFile(Index, Page, m_defaultPlatform); dependencies.Add(romFile); App.StartCoroutine(App.httpAPI.GetRomInfo(romID, (romInfo) => { diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/RomLib/RomLib.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/RomLib/RomLib.cs index 8b6eae53..f18d1c1d 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/RomLib/RomLib.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/RomLib/RomLib.cs @@ -94,7 +94,7 @@ namespace AxibugEmuOnline.Client for (int i = 0; i < RomFetchList.Length; i++) { //以后考虑用对象池实例化RomFile - RomFetchList[i] = new RomFile(i, i / PAGE_SIZE); + RomFetchList[i] = new RomFile(i, i / PAGE_SIZE, m_platform); } SaveRomInfoFromWeb(romList); @@ -117,7 +117,7 @@ namespace AxibugEmuOnline.Client for (int i = 0; i < RomFetchList.Length; i++) { //以后考虑用对象池实例化RomFile - RomFetchList[i] = new RomFile(i, i / PAGE_SIZE); + RomFetchList[i] = new RomFile(i, i / PAGE_SIZE, m_platform); } SaveRomInfoFromWeb(romList); diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Utility.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Utility.cs index f693ca3e..99a76630 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Utility.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Utility.cs @@ -46,7 +46,7 @@ namespace AxibugEmuOnline.Client 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); s_RomFileCahcesInRoomInfo[roomInfo.GameRomID] = _romFile;