示例#1
0
 private void OnShowEntityDependencyAsset(object sender, GameFramework.Entity.ShowEntityDependencyAssetEventArgs e)
 {
     if (m_EnableShowEntityDependencyAssetEvent)
     {
         m_EventComponent.Fire(this, new ShowEntityDependencyAssetEventArgs(e));
     }
 }
 //显示实体时加载依赖资源的回调
 private void OnShowEntityDependencyAsset(object sender, GameFramework.Entity.ShowEntityDependencyAssetEventArgs e)
 {
     if (m_EnableShowEntityDependencyAssetEvent)
     {
         m_EventComponent.Fire(this, ReferencePool.Acquire <ShowEntityDependencyAssetEventArgs>().Fill(e));
     }
 }
        /// <summary>
        /// 创建显示实体时加载依赖资源事件。
        /// </summary>
        /// <param name="entityId">实体编号。</param>
        /// <param name="entityAssetName">实体资源名称。</param>
        /// <param name="entityGroupName">实体组名称。</param>
        /// <param name="dependencyAssetName">被加载的依赖资源名称。</param>
        /// <param name="loadedCount">当前已加载依赖资源数量。</param>
        /// <param name="totalCount">总共加载依赖资源数量。</param>
        /// <param name="userData">用户自定义数据。</param>
        /// <returns>创建的显示实体时加载依赖资源事件。</returns>
        public static ShowEntityDependencyAssetEventArgs Create(int entityId, string entityAssetName, string entityGroupName, string dependencyAssetName, int loadedCount, int totalCount, object userData)
        {
            ShowEntityDependencyAssetEventArgs showEntityDependencyAssetEventArgs = ReferencePool.Acquire <ShowEntityDependencyAssetEventArgs>();

            showEntityDependencyAssetEventArgs.EntityId            = entityId;
            showEntityDependencyAssetEventArgs.EntityAssetName     = entityAssetName;
            showEntityDependencyAssetEventArgs.EntityGroupName     = entityGroupName;
            showEntityDependencyAssetEventArgs.DependencyAssetName = dependencyAssetName;
            showEntityDependencyAssetEventArgs.LoadedCount         = loadedCount;
            showEntityDependencyAssetEventArgs.TotalCount          = totalCount;
            showEntityDependencyAssetEventArgs.UserData            = userData;
            return(showEntityDependencyAssetEventArgs);
        }
示例#4
0
        private void LoadAssetDependencyAssetCallback(string entityAssetName, string dependencyAssetName, int loadedCount, int totalCount, object userData)
        {
            ShowEntityInfo showEntityInfo = (ShowEntityInfo)userData;

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

            if (m_ShowEntityDependencyAssetEventHandler != null)
            {
                ShowEntityDependencyAssetEventArgs showEntityDependencyAssetEventArgs = ShowEntityDependencyAssetEventArgs.Create(showEntityInfo.EntityId, entityAssetName, showEntityInfo.EntityGroup.Name, dependencyAssetName, loadedCount, totalCount, showEntityInfo.UserData);
                m_ShowEntityDependencyAssetEventHandler(this, showEntityDependencyAssetEventArgs);
                ReferencePool.Release(showEntityDependencyAssetEventArgs);
            }
        }
示例#5
0
 private void OnShowEntityDependencyAsset(object sender, GameFramework.Entity.ShowEntityDependencyAssetEventArgs e)
 {
     m_EventComponent.Fire(this, ShowEntityDependencyAssetEventArgs.Create(e));
 }