1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- using XGame.Framework.i18n;
- using XGame.Framework.Quality;
- using XGame.Framework.Asset.Addressable.Data;
- using System.Collections.Generic;
- namespace XGame.Framework.Asset.Addressable
- {
- public static class AddressableUtils
- {
- public static void CopyI18nInfos(AddressableI18nInfo[] i18nInfos, ref Dictionary<long, Dictionary<LanguageType, long>> i18nInfoMap)
- {
- if (i18nInfos == null || i18nInfos.Length == 0)
- return;
- if (i18nInfoMap == null)
- i18nInfoMap = new Dictionary<long, Dictionary<LanguageType, long>>();
- foreach (var i18nInfo in i18nInfos)
- {
- var i18nDatas = i18nInfo.i18nDatas;
- if (i18nDatas == null || i18nDatas.Length == 0)
- continue;
- var langMap = new Dictionary<LanguageType, long>();
- foreach (var data in i18nDatas)
- {
- langMap.Add(data.langFlag, data.addressableId);
- }
- i18nInfoMap.Add(i18nInfo.addressableId, langMap);
- }
- }
- public static void CopyLodInfos(AddressableLodInfo[] lodInfos, ref Dictionary<long, Dictionary<XQualityLevel, long>> lodInfoMap)
- {
- if (lodInfos == null || lodInfos.Length == 0)
- return;
- if (lodInfoMap == null)
- lodInfoMap = new Dictionary<long, Dictionary<XQualityLevel, long>>();
- foreach (var lodInfo in lodInfos)
- {
- var lodDatas = lodInfo.lodDatas;
- if (lodDatas == null || lodDatas.Length == 0)
- continue;
- var qualityMap = new Dictionary<XQualityLevel, long>();
- foreach (var data in lodDatas)
- {
- qualityMap.Add(data.quality, data.addressableId);
- }
- lodInfoMap.Add(lodInfo.addressableId, qualityMap);
- }
- }
- }
- }
|