private void InternalHideItem(ItemInfo itemInfo, object userData) { IItem item = itemInfo.Item; if (itemInfo.Status == ItemStatus.Hidden) { return; } itemInfo.Status = ItemStatus.WillHide; item.OnHide(m_IsShutdown, userData); itemInfo.Status = ItemStatus.Hidden; ItemGroup itemGroup = (ItemGroup)item.ItemGroup; if (itemGroup == null) { throw new GameFrameworkException("Item group is invalid."); } itemGroup.RemoveItem(item); if (!m_ItemInfos.Remove(item.Id)) { throw new GameFrameworkException("Item info is unmanaged."); } if (m_HideItemCompleteEventHandler != null) { HideItemCompleteEventArgs hideItemCompleteEventArgs = HideItemCompleteEventArgs.Create(item.Id, item.ItemAssetName, itemGroup, userData); m_HideItemCompleteEventHandler(this, hideItemCompleteEventArgs); ReferencePool.Release(hideItemCompleteEventArgs); } m_RecycleQueue.Enqueue(itemInfo); }
/// <summary> /// 创建隐藏物体完成事件。 /// </summary> /// <param name="e">内部事件。</param> /// <returns>创建的隐藏物体完成事件。</returns> public static HideItemCompleteEventArgs Create(GameFramework.Item.HideItemCompleteEventArgs e) { HideItemCompleteEventArgs hideItemCompleteEventArgs = ReferencePool.Acquire <HideItemCompleteEventArgs>(); hideItemCompleteEventArgs.ItemId = e.ItemId; hideItemCompleteEventArgs.ItemAssetName = e.ItemAssetName; hideItemCompleteEventArgs.ItemGroup = e.ItemGroup; hideItemCompleteEventArgs.UserData = e.UserData; return(hideItemCompleteEventArgs); }
private void OnHideItemComplete(object sender, GameFramework.Item.HideItemCompleteEventArgs e) { m_EventComponent.Fire(this, HideItemCompleteEventArgs.Create(e)); }