コード例 #1
0
        private void LoadDictionaryFailureCallback(string dictionaryAssetName, LoadResourceStatus status, string errorMessage, object userData)
        {
            //派发加载字典失败事件
            LoadDictionaryFailureEventArgs fe = ReferencePool.Acquire <LoadDictionaryFailureEventArgs>();

            m_EventManager.Fire(this, fe.Fill(userData, dictionaryAssetName, errorMessage));
        }
コード例 #2
0
        private void LoadDictionarySuccessCallback(string dictionaryAssetName, object dictionaryAsset, float duration, object userData)
        {
            try
            {
                //这里的userData是LoadDictionaryInfo对象
                if (!m_LocalizationHelper.LoadDictionary(dictionaryAsset, userData))
                {
                    throw new Exception("辅助器加载字典失败:" + dictionaryAssetName);
                }
            }
            catch (Exception exception)
            {
                //派发加载字典失败事件
                LoadDictionaryFailureEventArgs fe = ReferencePool.Acquire <LoadDictionaryFailureEventArgs>();
                m_EventManager.Fire(this, fe.Fill(userData, dictionaryAssetName, exception.Message));
            }
            finally
            {
                m_LocalizationHelper.ReleaseDictionaryAsset(dictionaryAsset);
            }

            //派发加载字典成功事件
            LoadDictionarySuccessEventArgs se = ReferencePool.Acquire <LoadDictionarySuccessEventArgs>();

            m_EventManager.Fire(this, se.Fill(userData, dictionaryAssetName, duration));
        }