Example #1
0
        private void LoadConfigFailureCallback(string configAssetName, LoadResourceStatus status, string errorMessage, object userData)
        {
            //派发加载配置失败事件
            LoadConfigFailureEventArgs e = ReferencePool.Acquire <LoadConfigFailureEventArgs>();

            m_EventManager.Fire(this, e.Fill(userData, configAssetName, string.Format("加载配置{0}失败:{1}", configAssetName, errorMessage)));
        }
Example #2
0
        private void LoadConfigSuccessCallback(string configAssetName, object configAsset, float duration, object userData)
        {
            try
            {
                //这里的userData是LoadConfigInfo对象
                if (!m_ConfigHelper.LoadConfig(configAsset, userData))
                {
                    throw new Exception(string.Format("加载配置失败: '{0}'.", configAssetName));
                }
            }
            catch (Exception exception)
            {
                //派发加载配置失败事件
                LoadConfigFailureEventArgs fe = ReferencePool.Acquire <LoadConfigFailureEventArgs>();
                m_EventManager.Fire(this, fe.Fill(userData, configAssetName, exception.ToString()));

                throw;
            }
            finally
            {
                m_ConfigHelper.ReleaseConfigAsset(configAsset);
            }

            //派发加载配置成功事件
            LoadConfigSuccessEventArgs se = ReferencePool.Acquire <LoadConfigSuccessEventArgs>();

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