示例#1
0
        private void LoadAssetOrBinaryFailureCallback(string dataAssetName, LoadResourceStatus status, string errorMessage, object userData)
        {
            string appendErrorMessage = Utility.Text.Format("Load data failure, data asset name '{0}', status '{1}', error message '{2}'.", dataAssetName, status.ToString(), errorMessage);

            Log.Warning(dataAssetName + appendErrorMessage);
            //throw new Exception(appendErrorMessage);
        }
示例#2
0
        private void LoadSoundFailureCallback(string soundAssetName, LoadResourceStatus status, string errorMessage, object userData)
        {
            PlaySoundInfo playSoundInfo = (PlaySoundInfo)userData;

            if (playSoundInfo == null)
            {
                throw new GameFrameworkException("Play sound info is invalid.");
            }

            if (m_SoundsToReleaseOnLoad.Contains(playSoundInfo.SerialId))
            {
                m_SoundsToReleaseOnLoad.Remove(playSoundInfo.SerialId);
                ReferencePool.Release(playSoundInfo);
                return;
            }

            m_SoundsBeingLoaded.Remove(playSoundInfo.SerialId);
            string appendErrorMessage = Utility.Text.Format("Load sound failure, asset name '{0}', status '{1}', error message '{2}'.", soundAssetName, status.ToString(), errorMessage);

            if (m_PlaySoundFailureEventHandler != null)
            {
                m_PlaySoundFailureEventHandler(this, new PlaySoundFailureEventArgs(playSoundInfo.SerialId, soundAssetName, playSoundInfo.SoundGroup.Name, playSoundInfo.PlaySoundParams, PlaySoundErrorCode.LoadAssetFailure, appendErrorMessage, playSoundInfo.UserData));
                ReferencePool.Release(playSoundInfo);
                return;
            }

            ReferencePool.Release(playSoundInfo);
            throw new GameFrameworkException(appendErrorMessage);
        }
示例#3
0
 private void OnLoadLuaFilesConfigFailure(string assetName, LoadResourceStatus status, string errorMessage,
                                          object userData)
 {
     Log.Info("Load LuaFilesConfig: '{0}' failure.", assetName);
     m_EventComponent.Fire(this,
                           ReferencePool.Acquire <LoadLuaFilesConfigFailureEventArgs>().Fill(assetName, errorMessage));
 }
示例#4
0
        private void LoadAssetFailureCallback(string entityAssetName, LoadResourceStatus status, string errorMessage, object userData)
        {
            ShowEntityInfo showEntityInfo = (ShowEntityInfo)userData;

            if (showEntityInfo == null)
            {
                throw new GameFrameworkException("Show entity info is invalid.");
            }

            if (m_EntitiesToReleaseOnLoad.Contains(showEntityInfo.SerialId))
            {
                m_EntitiesToReleaseOnLoad.Remove(showEntityInfo.SerialId);
                return;
            }

            m_EntitiesBeingLoaded.Remove(showEntityInfo.EntityId);
            string appendErrorMessage = Utility.Text.Format("Load entity failure, asset name '{0}', status '{1}', error message '{2}'.", entityAssetName, status.ToString(), errorMessage);

            if (m_ShowEntityFailureEventHandler != null)
            {
                ShowEntityFailureEventArgs showEntityFailureEventArgs = ShowEntityFailureEventArgs.Create(showEntityInfo.EntityId, entityAssetName, showEntityInfo.EntityGroup.Name, appendErrorMessage, showEntityInfo.UserData);
                m_ShowEntityFailureEventHandler(this, showEntityFailureEventArgs);
                ReferencePool.Release(showEntityFailureEventArgs);
                return;
            }

            throw new GameFrameworkException(appendErrorMessage);
        }
示例#5
0
        private void LoadLuaScriptFailureCallback(string luaScriptAssetName, LoadResourceStatus status, string errorMessage, object userData)
        {
            LuaScriptInfo luaScriptInfo      = (LuaScriptInfo)userData;
            string        appendErrorMessage = string.Format("Load lua script failure, asset name '{0}', status '{1}', error message '{2}'.", luaScriptAssetName, status.ToString(), errorMessage);

            GameEntry.Event.Fire(this, ReferencePool.Acquire <LoadLuaScriptFailureEventArgs>().Fill(luaScriptInfo.LuaScriptName, luaScriptAssetName, appendErrorMessage, luaScriptInfo.UserData));
        }
        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));
        }
示例#7
0
 void LoadDataTableFailureCallBack(string assetName, LoadResourceStatus status, string errorMessage, object userData)
 {
     if (m_OnLoadFailureCallback != null)
     {
         m_OnLoadFailureCallback();
     }
 }
示例#8
0
        private void LoadUIFormFailureCallback(string uiFormAssetName, LoadResourceStatus status, string errorMessage, object userData)
        {
            OpenUIFormInfo openUIFormInfo = (OpenUIFormInfo)userData;

            if (openUIFormInfo == null)
            {
                throw new GameFrameworkException("Open UI form info is invalid.");
            }

            if (m_UIFormsToReleaseOnLoad.Contains(openUIFormInfo.SerialId))
            {
                m_UIFormsToReleaseOnLoad.Remove(openUIFormInfo.SerialId);
                ReferencePool.Release(openUIFormInfo);
                return;
            }

            m_UIFormsBeingLoaded.Remove(openUIFormInfo.SerialId);
            string appendErrorMessage = Utility.Text.Format("Load UI form failure, asset name '{0}', status '{1}', error message '{2}'.", uiFormAssetName, status.ToString(), errorMessage);

            if (m_OpenUIFormFailureEventHandler != null)
            {
                OpenUIFormFailureEventArgs openUIFormFailureEventArgs = OpenUIFormFailureEventArgs.Create(openUIFormInfo.SerialId, uiFormAssetName, openUIFormInfo.UIGroup.Name, openUIFormInfo.PauseCoveredUIForm, appendErrorMessage, openUIFormInfo.UserData);
                m_OpenUIFormFailureEventHandler(this, openUIFormFailureEventArgs);
                ReferencePool.Release(openUIFormFailureEventArgs);
                ReferencePool.Release(openUIFormInfo);
                return;
            }

            ReferencePool.Release(openUIFormInfo);
            throw new GameFrameworkException(appendErrorMessage);
        }
示例#9
0
        private void LoadAssetFailureCallback(string soundAssetName, LoadResourceStatus status, string errorMessage, object userData)
        {
            PlaySoundInfo playSoundInfo = (PlaySoundInfo)userData;

            if (playSoundInfo == null)
            {
                throw new Exception("Play sound info is invalid.");
            }

            if (m_SoundsToReleaseOnLoad.Contains(playSoundInfo.SerialId))
            {
                m_SoundsToReleaseOnLoad.Remove(playSoundInfo.SerialId);
                if (playSoundInfo.PlaySoundParams.Referenced)
                {
                    ReferencePool.Release(playSoundInfo.PlaySoundParams);
                }

                return;
            }

            m_SoundsBeingLoaded.Remove(playSoundInfo.SerialId);
            string appendErrorMessage = Utility.Text.Format("Load sound failure, asset name '{0}', status '{1}', error message '{2}'.", soundAssetName, status.ToString(), errorMessage);

            if (playSoundInfo.PlaySoundParams.Referenced)
            {
                ReferencePool.Release(playSoundInfo.PlaySoundParams);
            }
            throw new Exception(appendErrorMessage);
        }
示例#10
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)));
        }
 public override void OnLoadFailure(LoadResourceAgent agent, LoadResourceStatus status, string errorMessage)
 {
     base.OnLoadFailure(agent, status, errorMessage);
     if (m_InstantiateAssetCallbacks.InstantiateAssetFailureCallback != null)
     {
         m_InstantiateAssetCallbacks.InstantiateAssetFailureCallback(AssetName, status, errorMessage, UserData);
     }
 }
示例#12
0
 void LoadAssetFail(string assetName, LoadResourceStatus status, string errorMessage, object userData)
 {
     if (m_EventManager != null)
     {
         string appendErrorMessage = Utility.Text.Format("Load UI form failure, asset name '{0}', status '{1}', error message '{2}'.", assetName, status.ToString(), errorMessage);
         m_EventManager.Fire(this, OpenUIFormFailureEventArgs.Create(assetName, appendErrorMessage, userData));
     }
 }
        private void LoadSceneFailureCallback(string sceneAssetName, LoadResourceStatus status, string errorMessage, object userData)
        {
            m_LoadingSceneAssetNames.Remove(sceneAssetName);
            //派发加载场景失败事件
            LoadSceneFailureEventArgs e = ReferencePool.Acquire <LoadSceneFailureEventArgs>();

            m_EventManager.Fire(this, e.Fill(sceneAssetName, string.Format("加载场景{0}失败:{1}", sceneAssetName, errorMessage), userData));
        }
示例#14
0
 private void OnLoadAssetFail(string assetName, LoadResourceStatus status, string errorMessage, object userData)
 {
     if (userData != this)
     {
         return;
     }
     Debug.Log("OnLoadAssetFail  " + assetName + "  " + errorMessage);
 }
示例#15
0
 private void OnError(LoadResourceStatus status, string errorMessage)
 {
     m_Helper.Reset();
     m_Task.OnLoadAssetFailure(this, status, errorMessage);
     s_LoadingAssetNames.Remove(m_Task.AssetName);
     s_LoadingResourceNames.Remove(m_Task.ResourceInfo.ResourceName.Name);
     m_Task.Done = true;
 }
        /// <summary>
        /// 创建加载资源代理辅助器错误事件。
        /// </summary>
        /// <param name="status">加载资源状态。</param>
        /// <param name="errorMessage">错误信息。</param>
        /// <returns>创建的加载资源代理辅助器错误事件。</returns>
        public static InnerLoadResourceAgentHelperErrorEventArgs Create(LoadResourceStatus status, string errorMessage)
        {
            InnerLoadResourceAgentHelperErrorEventArgs loadResourceAgentHelperErrorEventArgs = ReferencePool.Acquire <InnerLoadResourceAgentHelperErrorEventArgs>();

            loadResourceAgentHelperErrorEventArgs.Status       = status;
            loadResourceAgentHelperErrorEventArgs.ErrorMessage = errorMessage;
            return(loadResourceAgentHelperErrorEventArgs);
        }
 public override void OnLoadAssetFailure(LoadResourceAgent agent, LoadResourceStatus status, string errorMessage)
 {
     base.OnLoadAssetFailure(agent, status, errorMessage);
     if (m_LoadAssetBundleCallbacks.LoadAssetBundleFailureCallback != null)
     {
         m_LoadAssetBundleCallbacks.LoadAssetBundleFailureCallback(AssetBundleName, status, errorMessage, UserData);
     }
 }
示例#18
0
 private void OnError(LoadResourceStatus status, string errorMessage)
 {
     ToReset();
     m_Task.OnLoadAssetFailure(status, errorMessage);
     s_LoadingAssetNames.Remove(m_Task.AssetName);
     s_LoadingResourceNames.Remove(m_Task.AssetBundleName);
     m_Task.Done = true;
 }
示例#19
0
        /// <summary>
        /// 异步回调消息创建
        /// </summary>
        /// <param name="assetName"></param>
        /// <param name="status"></param>
        /// <param name="errorMessage"></param>
        /// <param name="userData"></param>
        public void CreateCallbackFailed(string assetName, LoadResourceStatus status, string errorMessage, object userData)
        {
            m_LoadAssetStatus    = LoadAssetStatus.Failed;
            m_AssetName          = assetName;
            m_LoadResourceStatus = status;
            m_ErrorMessage       = errorMessage;
            m_UserData           = userData;

            m_LoadAssetFailureCallback?.Invoke(m_AssetName, m_LoadResourceStatus, m_ErrorMessage, m_UserData);
        }
示例#20
0
 private void OnLoadHotfixDLLFailure(string assetName, LoadResourceStatus status, string errorMessage, object userData)
 {
     if ((int)userData == 1)
     {
         Log.Error("Hotfix.dll加载失败:{0}", errorMessage);
     }
     else
     {
         Log.Error("Hotfix.pdb加载失败:{0}", errorMessage);
     }
 }
        private void LoadDictionaryFailureCallback(string dictionaryAssetName, LoadResourceStatus status, string errorMessage, object userData)
        {
            string appendErrorMessage = Utility.Text.Format("Load dictionary failure, asset name '{0}', status '{1}', error message '{2}'.", dictionaryAssetName, status.ToString(), errorMessage);

            if (m_LoadDictionaryFailureEventHandler != null)
            {
                m_LoadDictionaryFailureEventHandler(this, new LoadDictionaryFailureEventArgs(dictionaryAssetName, appendErrorMessage, userData));
                return;
            }

            throw new GameFrameworkException(appendErrorMessage);
        }
示例#22
0
        private void LoadConfigFailureCallback(string configAssetName, LoadResourceStatus status, string errorMessage, object userData)
        {
            string appendErrorMessage = string.Format("Load config failure, asset name '{0}', status '{1}', error message '{2}'.", configAssetName, status.ToString(), errorMessage);

            if (m_LoadConfigFailureEventHandler != null)
            {
                m_LoadConfigFailureEventHandler(this, new LoadConfigFailureEventArgs(configAssetName, appendErrorMessage, userData));
                return;
            }

            throw new GameFrameworkException(appendErrorMessage);
        }
示例#23
0
        private void LoadDataTableFailureCallback(string dataTableAssetName, LoadResourceStatus status, string errorMessage, object userData)
        {
            string appendErrorMessage = string.Format("Load data table failure, asset name '{0}', status '{1}', error message '{2}'.", dataTableAssetName, status.ToString(), errorMessage);

            if (m_LoadDataTableFailureEventHandler != null)
            {
                m_LoadDataTableFailureEventHandler(this, new LoadDataTableFailureEventArgs(dataTableAssetName, appendErrorMessage, userData));
                return;
            }

            throw new AshException(appendErrorMessage);
        }
示例#24
0
        private void LoadSceneFailureCallback(string sceneAssetName, LoadResourceStatus status, string errorMessage, object userData)
        {
            m_LoadingSceneAssetNames.Remove(sceneAssetName);
            string appendErrorMessage = string.Format("Load scene failure, scene asset name '{0}', status '{1}', error message '{2}'.", sceneAssetName, status.ToString(), errorMessage);

            if (m_LoadSceneFailureEventHandler != null)
            {
                m_LoadSceneFailureEventHandler(this, new LoadSceneFailureEventArgs(sceneAssetName, appendErrorMessage, userData));
                return;
            }

            throw new GameFrameworkException(appendErrorMessage);
        }
示例#25
0
 public void OnLoadAssetFailure(LoadResourceStatus status, string errorMessage)
 {
     if (m_MainTask != null)
     {
         m_MainTask.OnLoadAssetFailure(LoadResourceStatus.DependencyError,
                                       string.Format("Can not load dependency asset '{0}', internal status '{1}', internal error message '{2}'.", AssetBundleName, status.ToString(), errorMessage));
         return;
     }
     if (m_LoadAssetCallbacks.LoadAssetFailureCallback != null)
     {
         m_LoadAssetCallbacks.LoadAssetFailureCallback(AssetBundleName, errorMessage, UserData);
     }
 }
示例#26
0
        private void LoadLuaFailureCallback(string assetName, LoadResourceStatus status, string errorMessage, object userData)
        {
            LuaFileInfo luaFileInfo = (LuaFileInfo)userData;

            if (luaFileInfo == null)
            {
                throw new GameFrameworkException("Load lua file info is invalid.");
            }
            string str = Utility.Text.Format("Load lua file failure, asset name '{0}', status '{1}', error message '{2}'.", (object)assetName, (object)status.ToString(), (object)errorMessage);
            //TODO:处理载入错误
//            if (this.m_LoadDataTableFailureEventHandler == null)
//                throw new GameFrameworkException(str);
        }
        private void LoadAssetOrBinaryFailureCallback(string dataTableAssetName, LoadResourceStatus status, string errorMessage, object userData)
        {
            string appendErrorMessage = Utility.Text.Format("Load data table failure, asset name '{0}', status '{1}', error message '{2}'.", dataTableAssetName, status.ToString(), errorMessage);

            if (m_LoadDataTableFailureEventHandler != null)
            {
                LoadDataTableFailureEventArgs loadDataTableFailureEventArgs = LoadDataTableFailureEventArgs.Create(dataTableAssetName, appendErrorMessage, userData);
                m_LoadDataTableFailureEventHandler(this, loadDataTableFailureEventArgs);
                ReferencePool.Release(loadDataTableFailureEventArgs);
                return;
            }

            throw new GameFrameworkException(appendErrorMessage);
        }
        private void OnLoadAssetFailure(string assetName, LoadResourceStatus status, string errorMessage, object userData)
        {
            var myUserData = userData as LoadLuaScriptUserData;

            if (myUserData == null)
            {
                return;
            }

            if (myUserData.OnFailure != null)
            {
                myUserData.OnFailure(myUserData.FileName, status, errorMessage);
            }
        }
示例#29
0
        private void LoadSceneFailureCallback(string sceneAssetName, LoadResourceStatus status, string errorMessage, object userData)
        {
            m_LoadingSceneAssetNames.Remove(sceneAssetName);
            string appendErrorMessage = Utility.Text.Format("Load scene failure, scene asset name '{0}', status '{1}', error message '{2}'.", sceneAssetName, status.ToString(), errorMessage);

            if (m_LoadSceneFailureEventHandler != null)
            {
                LoadSceneFailureEventArgs loadSceneFailureEventArgs = LoadSceneFailureEventArgs.Create(sceneAssetName, appendErrorMessage, userData);
                m_LoadSceneFailureEventHandler(this, loadSceneFailureEventArgs);
                ReferencePool.Release(loadSceneFailureEventArgs);
                return;
            }

            throw new GXException(appendErrorMessage);
        }
示例#30
0
        public override void OnLoadAssetFailure(LoadResourceAgent agent, LoadResourceStatus status, string errorMessage)
        {
            base.OnLoadAssetFailure(agent, status, errorMessage);

            //加载失败 这边可以直接异步回调
            if (m_LoadAssetCallbacks.AsyncAction != null)
            {
                m_LoadAssetCallbacks.CreateCallbackFailed(AssetName, status, errorMessage, UserData);

                m_LoadAssetCallbacks.AsyncAction.Invoke(m_LoadAssetCallbacks);
            }
            else
            {
                m_LoadAssetCallbacks.LoadAssetFailureCallback?.Invoke(AssetName, status, errorMessage, UserData);
            }
        }