private void LoadAssetSuccessCallback(string configAssetName, object configAsset, float duration, object userData) { LoadConfigInfo loadConfigInfo = (LoadConfigInfo)userData; if (loadConfigInfo == null) { throw new GXException("Load config info is invalid."); } try { if (!m_ConfigHelper.LoadConfig(configAsset, loadConfigInfo.LoadType, loadConfigInfo.UserData)) { throw new GXException(Utility.Text.Format("Load config failure in helper, asset name '{0}'.", configAssetName)); } if (m_LoadConfigSuccessEventHandler != null) { LoadConfigSuccessEventArgs loadConfigSuccessEventArgs = LoadConfigSuccessEventArgs.Create(configAssetName, loadConfigInfo.LoadType, duration, loadConfigInfo.UserData); m_LoadConfigSuccessEventHandler(this, loadConfigSuccessEventArgs); ReferencePool.Release(loadConfigSuccessEventArgs); } } catch (Exception exception) { if (m_LoadConfigFailureEventHandler != null) { LoadConfigFailureEventArgs loadConfigFailureEventArgs = LoadConfigFailureEventArgs.Create(configAssetName, loadConfigInfo.LoadType, exception.ToString(), loadConfigInfo.UserData); m_LoadConfigFailureEventHandler(this, loadConfigFailureEventArgs); ReferencePool.Release(loadConfigFailureEventArgs); return; } throw; } finally { ReferencePool.Release(loadConfigInfo); m_ConfigHelper.ReleaseConfigAsset(configAsset); } }
private void LoadAssetOrBinaryFailureCallback(string configAssetName, LoadResourceStatus status, string errorMessage, object userData) { LoadConfigInfo loadConfigInfo = (LoadConfigInfo)userData; if (loadConfigInfo == null) { throw new GXException("Load config info is invalid."); } string appendErrorMessage = Utility.Text.Format("Load config failure, asset name '{0}', status '{1}', error message '{2}'.", configAssetName, status.ToString(), errorMessage); if (m_LoadConfigFailureEventHandler != null) { LoadConfigFailureEventArgs loadConfigFailureEventArgs = LoadConfigFailureEventArgs.Create(configAssetName, loadConfigInfo.LoadType, appendErrorMessage, loadConfigInfo.UserData); m_LoadConfigFailureEventHandler(this, loadConfigFailureEventArgs); ReferencePool.Release(loadConfigFailureEventArgs); return; } throw new GXException(appendErrorMessage); }