public static LoadDictionaryInfo Create(string dictionaryName, object userData)
        {
            LoadDictionaryInfo loadDictionaryInfo = ReferencePool.Acquire <LoadDictionaryInfo>();

            loadDictionaryInfo.m_DictionaryName = dictionaryName;
            loadDictionaryInfo.m_UserData       = userData;
            return(loadDictionaryInfo);
        }
        /// <summary>
        /// 初始化加载字典成功事件的新实例。
        /// </summary>
        /// <param name="e">内部事件。</param>
        public LoadDictionarySuccessEventArgs(GameFramework.Localization.LoadDictionarySuccessEventArgs e)
        {
            LoadDictionaryInfo loadDictionaryInfo = e.UserData as LoadDictionaryInfo;

            DictionaryName      = loadDictionaryInfo.DictionaryName;
            DictionaryAssetName = e.DictionaryAssetName;
            UserData            = loadDictionaryInfo.UserData;
        }
        /// <summary>
        /// 初始化加载字典更新事件的新实例。
        /// </summary>
        /// <param name="e">内部事件。</param>
        public LoadDictionaryUpdateEventArgs(GameFramework.Localization.LoadDictionaryUpdateEventArgs e)
        {
            LoadDictionaryInfo loadDictionaryInfo = e.UserData as LoadDictionaryInfo;

            DictionaryName      = loadDictionaryInfo.DictionaryName;
            DictionaryAssetName = e.DictionaryAssetName;
            Progress            = e.Progress;
            UserData            = loadDictionaryInfo.UserData;
        }
        /// <summary>
        /// 初始化加载字典失败事件的新实例。
        /// </summary>
        /// <param name="e">内部事件。</param>
        public LoadDictionaryFailureEventArgs(GameFramework.Localization.LoadDictionaryFailureEventArgs e)
        {
            LoadDictionaryInfo loadDictionaryInfo = e.UserData as LoadDictionaryInfo;

            DictionaryName      = loadDictionaryInfo.DictionaryName;
            DictionaryAssetName = e.DictionaryAssetName;
            ErrorMessage        = e.ErrorMessage;
            UserData            = loadDictionaryInfo.UserData;
        }
        /// <summary>
        /// 加载字典。
        /// </summary>
        /// <param name="dictionaryName">字典名称。</param>
        /// <param name="dictionaryAssetName">字典资源名称。</param>
        /// <param name="priority">加载字典资源的优先级。</param>
        /// <param name="userData">用户自定义数据。</param>
        public void LoadDictionary(string dictionaryName, string dictionaryAssetName, int priority, object userData)
        {
            if (string.IsNullOrEmpty(dictionaryName))
            {
                Log.Error("Dictionary name is invalid.");
                return;
            }

            m_LocalizationManager.LoadDictionary(dictionaryAssetName, priority, LoadDictionaryInfo.Create(dictionaryName, userData));
        }
        /// <summary>
        /// 填充加载字典更新事件。
        /// </summary>
        /// <param name="e">内部事件。</param>
        /// <returns>加载字典更新事件。</returns>
        public LoadDictionaryUpdateEventArgs Fill(GameFramework.Localization.LoadDictionaryUpdateEventArgs e)
        {
            LoadDictionaryInfo loadDictionaryInfo = (LoadDictionaryInfo)e.UserData;

            DictionaryName      = loadDictionaryInfo.DictionaryName;
            DictionaryAssetName = e.DictionaryAssetName;
            Progress            = e.Progress;
            UserData            = loadDictionaryInfo.UserData;

            return(this);
        }
Example #7
0
        /// <summary>
        /// 创建加载字典更新事件。
        /// </summary>
        /// <param name="e">内部事件。</param>
        /// <returns>创建的加载字典更新事件。</returns>
        public static LoadDictionaryUpdateEventArgs Create(GameFramework.Localization.LoadDictionaryUpdateEventArgs e)
        {
            LoadDictionaryInfo            loadDictionaryInfo            = (LoadDictionaryInfo)e.UserData;
            LoadDictionaryUpdateEventArgs loadDictionaryUpdateEventArgs = ReferencePool.Acquire <LoadDictionaryUpdateEventArgs>();

            loadDictionaryUpdateEventArgs.DictionaryName      = loadDictionaryInfo.DictionaryName;
            loadDictionaryUpdateEventArgs.DictionaryAssetName = e.DictionaryAssetName;
            loadDictionaryUpdateEventArgs.Progress            = e.Progress;
            loadDictionaryUpdateEventArgs.UserData            = loadDictionaryInfo.UserData;
            return(loadDictionaryUpdateEventArgs);
        }
Example #8
0
        /// <summary>
        /// 填充加载字典成功事件。
        /// </summary>
        /// <param name="e">内部事件。</param>
        /// <returns>加载字典成功事件。</returns>
        public LoadDictionarySuccessEventArgs Fill(GameFramework.Localization.LoadDictionarySuccessEventArgs e)
        {
            LoadDictionaryInfo loadDictionaryInfo = (LoadDictionaryInfo)e.UserData;

            DictionaryName      = loadDictionaryInfo.DictionaryName;
            DictionaryAssetName = e.DictionaryAssetName;
            Duration            = e.Duration;
            UserData            = loadDictionaryInfo.UserData;

            return(this);
        }
        /// <summary>
        /// 填充加载字典失败事件。
        /// </summary>
        /// <param name="e">内部事件。</param>
        /// <returns>加载字典失败事件。</returns>
        public LoadDictionaryFailureEventArgs Fill(GameFramework.Localization.LoadDictionaryFailureEventArgs e)
        {
            LoadDictionaryInfo loadDictionaryInfo = (LoadDictionaryInfo)e.UserData;

            DictionaryName      = loadDictionaryInfo.DictionaryName;
            DictionaryAssetName = e.DictionaryAssetName;
            ErrorMessage        = e.ErrorMessage;
            UserData            = loadDictionaryInfo.UserData;

            return(this);
        }
        /// <summary>
        /// 初始化加载字典时加载依赖资源事件的新实例。
        /// </summary>
        /// <param name="e">内部事件。</param>
        public LoadDictionaryDependencyAssetEventArgs(GameFramework.Localization.LoadDictionaryDependencyAssetEventArgs e)
        {
            LoadDictionaryInfo loadDictionaryInfo = e.UserData as LoadDictionaryInfo;

            DictionaryName      = loadDictionaryInfo.DictionaryName;
            DictionaryAssetName = e.DictionaryAssetName;
            DependencyAssetName = e.DependencyAssetName;
            LoadedCount         = e.LoadedCount;
            TotalCount          = e.TotalCount;
            UserData            = loadDictionaryInfo.UserData;
        }
Example #11
0
        /// <summary>
        /// 创建加载字典成功事件。
        /// </summary>
        /// <param name="e">内部事件。</param>
        /// <returns>创建的加载字典成功事件。</returns>
        public static LoadDictionarySuccessEventArgs Create(GameFramework.Localization.LoadDictionarySuccessEventArgs e)
        {
            LoadDictionaryInfo             loadDictionaryInfo             = (LoadDictionaryInfo)e.UserData;
            LoadDictionarySuccessEventArgs loadDictionarySuccessEventArgs = ReferencePool.Acquire <LoadDictionarySuccessEventArgs>();

            loadDictionarySuccessEventArgs.DictionaryName      = loadDictionaryInfo.DictionaryName;
            loadDictionarySuccessEventArgs.DictionaryAssetName = e.DictionaryAssetName;
            loadDictionarySuccessEventArgs.Duration            = e.Duration;
            loadDictionarySuccessEventArgs.UserData            = loadDictionaryInfo.UserData;
            ReferencePool.Release(loadDictionaryInfo);
            return(loadDictionarySuccessEventArgs);
        }
Example #12
0
        /// <summary>
        /// 填充加载字典时加载依赖资源事件。
        /// </summary>
        /// <param name="e">内部事件。</param>
        /// <returns>加载字典时加载依赖资源事件。</returns>
        public LoadDictionaryDependencyAssetEventArgs Fill(GameFramework.Localization.LoadDictionaryDependencyAssetEventArgs e)
        {
            LoadDictionaryInfo loadDictionaryInfo = (LoadDictionaryInfo)e.UserData;

            DictionaryName      = loadDictionaryInfo.DictionaryName;
            DictionaryAssetName = e.DictionaryAssetName;
            DependencyAssetName = e.DependencyAssetName;
            LoadedCount         = e.LoadedCount;
            TotalCount          = e.TotalCount;
            UserData            = loadDictionaryInfo.UserData;

            return(this);
        }
        /// <summary>
        /// 创建加载字典时加载依赖资源事件。
        /// </summary>
        /// <param name="e">内部事件。</param>
        /// <returns>创建的加载字典时加载依赖资源事件。</returns>
        public static LoadDictionaryDependencyAssetEventArgs Create(GameFramework.Localization.LoadDictionaryDependencyAssetEventArgs e)
        {
            LoadDictionaryInfo loadDictionaryInfo = (LoadDictionaryInfo)e.UserData;
            LoadDictionaryDependencyAssetEventArgs loadDictionaryDependencyAssetEventArgs = ReferencePool.Acquire <LoadDictionaryDependencyAssetEventArgs>();

            loadDictionaryDependencyAssetEventArgs.DictionaryName      = loadDictionaryInfo.DictionaryName;
            loadDictionaryDependencyAssetEventArgs.DictionaryAssetName = e.DictionaryAssetName;
            loadDictionaryDependencyAssetEventArgs.DependencyAssetName = e.DependencyAssetName;
            loadDictionaryDependencyAssetEventArgs.LoadedCount         = e.LoadedCount;
            loadDictionaryDependencyAssetEventArgs.TotalCount          = e.TotalCount;
            loadDictionaryDependencyAssetEventArgs.UserData            = loadDictionaryInfo.UserData;
            return(loadDictionaryDependencyAssetEventArgs);
        }
        /// <summary>
        /// 创建加载字典失败事件。
        /// </summary>
        /// <param name="e">内部事件。</param>
        /// <returns>创建的加载字典失败事件。</returns>
        public static LoadDictionaryFailureEventArgs Create(GameFramework.Localization.LoadDictionaryFailureEventArgs e)
        {
            LoadDictionaryInfo             loadDictionaryInfo             = (LoadDictionaryInfo)e.UserData;
            LoadDictionaryFailureEventArgs loadDictionaryFailureEventArgs = ReferencePool.Acquire <LoadDictionaryFailureEventArgs>();

            loadDictionaryFailureEventArgs.DictionaryName      = loadDictionaryInfo.DictionaryName;
            loadDictionaryFailureEventArgs.DictionaryAssetName = e.DictionaryAssetName;
            loadDictionaryFailureEventArgs.LoadType            = e.LoadType;
            loadDictionaryFailureEventArgs.ErrorMessage        = e.ErrorMessage;
            loadDictionaryFailureEventArgs.UserData            = loadDictionaryInfo.UserData;
            ReferencePool.Release(loadDictionaryInfo);
            return(loadDictionaryFailureEventArgs);
        }
Example #15
0
        /// <summary>
        /// 填充加载字典成功事件。
        /// </summary>
        /// <param name="e">内部事件。</param>
        /// <returns>加载字典成功事件。</returns>
        public LoadDictionarySuccessEventArgs Fill(GameFramework.Localization.LoadDictionarySuccessEventArgs e)
        {
            LoadDictionaryInfo loadDictionaryInfo = (LoadDictionaryInfo)e.UserData;

            DictionaryName      = loadDictionaryInfo.DictionaryName;
            DictionaryAssetName = e.DictionaryAssetName;
            LoadType            = e.LoadType;
            Duration            = e.Duration;
            UserData            = loadDictionaryInfo.UserData;

            ReferencePool.Release(loadDictionaryInfo);
            return(this);
        }
        /// <summary>
        /// 加载字典。
        /// </summary>
        /// <param name="dictionaryName">字典名称。</param>
        /// <param name="dictionaryAssetName">字典资源名称。</param>
        /// <param name="loadType">字典加载方式。</param>
        /// <param name="priority">加载字典资源的优先级。</param>
        /// <param name="userData">用户自定义数据。</param>
        public void LoadDictionary(string dictionaryName, string dictionaryAssetName, LoadType loadType, int priority, object userData)
        {
            if (string.IsNullOrEmpty(dictionaryName))
            {
                Log.Error("Dictionary name is invalid.");
                return;
            }

            LoadDictionaryInfo loadDictionaryInfo = ReferencePool.Acquire <LoadDictionaryInfo>();

            loadDictionaryInfo.Initialize(dictionaryName, userData);
            m_LocalizationManager.LoadDictionary(dictionaryAssetName, loadType, priority, loadDictionaryInfo);
        }
        /// <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));
        }