/// <summary> /// 填充加载字典更新事件 /// </summary> /// <returns>加载字典更新事件。</returns> public LoadDictionaryUpdateEventArgs Fill(object userData, string dictionaryAssetName, float progress) { LoadDictionaryInfo loadDictionaryInfo = (LoadDictionaryInfo)userData; DictionaryName = loadDictionaryInfo.DictionaryName; DictionaryAssetName = dictionaryAssetName; Progress = progress; UserData = loadDictionaryInfo.UserData; return(this); }
/// <summary> /// 填充加载字典成功事件。 /// </summary> /// <param name="e">内部事件。</param> /// <returns>加载字典成功事件。</returns> public LoadDictionarySuccessEventArgs Fill(object userData, string dictionaryAssetName, float duration) { LoadDictionaryInfo loadDictionaryInfo = (LoadDictionaryInfo)userData; DictionaryName = loadDictionaryInfo.DictionaryName; DictionaryAssetName = dictionaryAssetName; Duration = duration; UserData = loadDictionaryInfo.UserData; return(this); }
/// <summary> /// 填充加载字典失败事件 /// </summary> /// <returns>加载字典失败事件</returns> public LoadDictionaryFailureEventArgs Fill(object userData, string dictionaryAssetName, string errorMessage) { LoadDictionaryInfo loadDictionaryInfo = (LoadDictionaryInfo)userData; DictionaryName = loadDictionaryInfo.DictionaryName; DictionaryAssetName = dictionaryAssetName; ErrorMessage = errorMessage; UserData = loadDictionaryInfo.UserData; return(this); }
/// <summary> /// 填充加载字典时加载依赖资源事件 /// </summary> /// <returns>加载字典时加载依赖资源事件</returns> public LoadDictionaryDependencyAssetEventArgs Fill(object userData, string dictionaryAssetName, string dependencyAssetName, int loadedCount, int totalCount) { LoadDictionaryInfo loadDictionaryInfo = (LoadDictionaryInfo)userData; DictionaryName = loadDictionaryInfo.DictionaryName; DictionaryAssetName = dictionaryAssetName; DependencyAssetName = dependencyAssetName; LoadedCount = loadedCount; TotalCount = totalCount; UserData = loadDictionaryInfo.UserData; return(this); }
/// <summary> /// 加载字典 /// </summary> /// <param name="dictionaryName">字典名称</param> /// <param name="dictionaryAssetName">字典资源名称</param> /// <param name="userData">用户自定义数据</param> public void LoadDictionary(string dictionaryName, string dictionaryAssetName, object userData = null) { if (string.IsNullOrEmpty(dictionaryName)) { Debug.LogError("要加载的字典名称为空"); return; } if (m_ResourceManager == null) { Debug.LogError("资源管理器为空,无法加载字典"); return; } if (m_LocalizationHelper == null) { Debug.LogError("本地化辅助器为空,无法加载字典"); return; } LoadDictionaryInfo info = new LoadDictionaryInfo(dictionaryName, userData); m_ResourceManager.LoadAsset(dictionaryAssetName, m_LoadAssetCallbacks, info); }
/// <summary> /// 加载字典 /// </summary> /// <param name="dictionaryAsset">字典资源</param> /// <param name="userData">用户自定义数据</param> /// <returns>加载是否成功</returns> public bool LoadDictionary(object dictionaryAsset, object userData) { LoadDictionaryInfo loadDictionaryInfo = (LoadDictionaryInfo)userData; return(LoadDictionary(loadDictionaryInfo.DictionaryName, dictionaryAsset, loadDictionaryInfo.UserData)); }