private void LoadBinarySuccessCallback(string dataTableAssetName, byte[] dataTableBytes, float duration, object userData)
        {
            try
            {
                if (!m_DataTableHelper.LoadDataTable(dataTableAssetName, dataTableBytes, userData))
                {
                    throw new GameFrameworkException(Utility.Text.Format("Load data table failure in helper, asset name '{0}'.", dataTableAssetName));
                }

                if (m_LoadDataTableSuccessEventHandler != null)
                {
                    LoadDataTableSuccessEventArgs loadDataTableSuccessEventArgs = LoadDataTableSuccessEventArgs.Create(dataTableAssetName, duration, userData);
                    m_LoadDataTableSuccessEventHandler(this, loadDataTableSuccessEventArgs);
                    ReferencePool.Release(loadDataTableSuccessEventArgs);
                }
            }
            catch (Exception exception)
            {
                if (m_LoadDataTableFailureEventHandler != null)
                {
                    LoadDataTableFailureEventArgs loadDataTableFailureEventArgs = LoadDataTableFailureEventArgs.Create(dataTableAssetName, exception.ToString(), userData);
                    m_LoadDataTableFailureEventHandler(this, loadDataTableFailureEventArgs);
                    ReferencePool.Release(loadDataTableFailureEventArgs);
                    return;
                }

                throw;
            }
        }
Beispiel #2
0
 private void OnLoadDataTableSuccess(object sender, GameFramework.DataTable.LoadDataTableSuccessEventArgs e)
 {
     if (m_EnableLoadDataTableSuccessEvent)
     {
         m_EventComponent.Fire(this, new LoadDataTableSuccessEventArgs(e));
     }
 }
Beispiel #3
0
 private void OnLoadDataTableSuccess(object sender, GameFramework.DataTable.LoadDataTableSuccessEventArgs e)
 {
     if (m_EnableLoadDataTableSuccessEvent)
     {
         m_EventComponent.Fire(this, ReferencePool.Acquire <LoadDataTableSuccessEventArgs>().Fill(e));
     }
 }
Beispiel #4
0
        private void LoadDataTableSuccessCallback(string dataTableAssetName, object dataTableAsset, float duration, object userData)
        {
            LoadDataTableInfo loadDataTableInfo = (LoadDataTableInfo)userData;

            if (loadDataTableInfo == null)
            {
                throw new GameFrameworkException("Load data table info is invalid.");
            }

            try
            {
                if (!m_DataTableHelper.LoadDataTable(dataTableAsset, loadDataTableInfo.LoadType, loadDataTableInfo.UserData))
                {
                    throw new GameFrameworkException(Utility.Text.Format("Load data table failure in helper, asset name '{0}'.", dataTableAssetName));
                }

                if (m_LoadDataTableSuccessEventHandler != null)
                {
                    LoadDataTableSuccessEventArgs loadDataTableSuccessEventArgs = LoadDataTableSuccessEventArgs.Create(dataTableAssetName, loadDataTableInfo.LoadType, duration, loadDataTableInfo.UserData);
                    m_LoadDataTableSuccessEventHandler(this, loadDataTableSuccessEventArgs);
                    ReferencePool.Release(loadDataTableSuccessEventArgs);
                }
            }
            catch (Exception exception)
            {
                if (m_LoadDataTableFailureEventHandler != null)
                {
                    LoadDataTableFailureEventArgs loadDataTableFailureEventArgs = LoadDataTableFailureEventArgs.Create(dataTableAssetName, loadDataTableInfo.LoadType, exception.ToString(), loadDataTableInfo.UserData);
                    m_LoadDataTableFailureEventHandler(this, loadDataTableFailureEventArgs);
                    ReferencePool.Release(loadDataTableFailureEventArgs);
                    return;
                }

                throw;
            }
            finally
            {
                ReferencePool.Release(loadDataTableInfo);
                m_DataTableHelper.ReleaseDataTableAsset(dataTableAsset);
            }
        }
 private void OnLoadDataTableSuccess(object sender, GameFramework.DataTable.LoadDataTableSuccessEventArgs e)
 {
     m_EventComponent.Fire(this, LoadDataTableSuccessEventArgs.Create(e));
 }