private void LoadAssetFailureCallback(string ItemAssetName, LoadResourceStatus status, string errorMessage, object userData)
        {
            ShowItemInfo showItemInfo = (ShowItemInfo)userData;

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

            if (m_ItemsToReleaseOnLoad.Contains(showItemInfo.SerialId))
            {
                m_ItemsToReleaseOnLoad.Remove(showItemInfo.SerialId);
                return;
            }

            m_ItemsBeingLoaded.Remove(showItemInfo.ItemId);
            string appendErrorMessage = Utility.Text.Format("Load Item failure, asset name '{0}', status '{1}', error message '{2}'.", ItemAssetName, status.ToString(), errorMessage);

            if (m_ShowItemFailureEventHandler != null)
            {
                ShowItemFailureEventArgs showItemFailureEventArgs = ShowItemFailureEventArgs.Create(showItemInfo.ItemId, ItemAssetName, showItemInfo.ItemGroup.Name, appendErrorMessage, showItemInfo.UserData);
                m_ShowItemFailureEventHandler(this, showItemFailureEventArgs);
                ReferencePool.Release(showItemFailureEventArgs);
                return;
            }

            throw new GameFrameworkException(appendErrorMessage);
        }
        private void InternalShowItem(int itemId, string itemAssetName, ItemGroup itemGroup, object itemInstance, bool isNewInstance, float duration, object userData)
        {
            try
            {
                IItem item = m_ItemHelper.CreateItem(itemInstance, itemGroup, userData);
                if (item == null)
                {
                    throw new GameFrameworkException("Can not create item in helper.");
                }

                ItemInfo itemInfo = ItemInfo.Create(item);
                m_ItemInfos.Add(itemId, itemInfo);
                itemInfo.Status = ItemStatus.WillInit;
                item.OnInit(itemId, itemAssetName, itemGroup, isNewInstance, userData);
                itemInfo.Status = ItemStatus.Inited;
                itemGroup.AddItem(item);
                itemInfo.Status = ItemStatus.WillShow;
                item.OnShow(userData);
                itemInfo.Status = ItemStatus.Showed;

                if (m_ShowItemSuccessEventHandler != null)
                {
                    ShowItemSuccessEventArgs showItemSuccessEventArgs = ShowItemSuccessEventArgs.Create(item, duration, userData);
                    m_ShowItemSuccessEventHandler(this, showItemSuccessEventArgs);
                    ReferencePool.Release(showItemSuccessEventArgs);
                }
            }
            catch (Exception exception)
            {
                if (m_ShowItemFailureEventHandler != null)
                {
                    ShowItemFailureEventArgs showItemFailureEventArgs = ShowItemFailureEventArgs.Create(itemId, itemAssetName, itemGroup.Name, exception.ToString(), userData);
                    m_ShowItemFailureEventHandler(this, showItemFailureEventArgs);
                    ReferencePool.Release(showItemFailureEventArgs);
                    return;
                }

                throw;
            }
        }
 private void OnShowItemFailure(object sender, GameFramework.Item.ShowItemFailureEventArgs e)
 {
     Log.Warning("Show item failure, item id '{0}', asset name '{1}', item group name '{2}', error message '{3}'.", e.ItemId.ToString(), e.ItemAssetName, e.ItemGroupName, e.ErrorMessage);
     m_EventComponent.Fire(this, ShowItemFailureEventArgs.Create(e));
 }