//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 loyalsoft. All rights reserved.
// Homepage: http://www.game7000.com/
// Feedback: http://www.game7000.com/
//------------------------------------------------------------
using GameFramework;
using GameFramework.Event;
using System;
namespace UnityGameFramework.Runtime
{
///
/// 显示实体时加载依赖资源事件。
///
public sealed class ShowEntityDependencyAssetEventArgs : GameEventArgs
{
///
/// 显示实体时加载依赖资源事件编号。
///
public static readonly int EventId = typeof(ShowEntityDependencyAssetEventArgs).GetHashCode();
///
/// 初始化显示实体时加载依赖资源事件的新实例。
///
public ShowEntityDependencyAssetEventArgs()
{
EntityId = 0;
EntityLogicType = null;
EntityAssetName = null;
EntityGroupName = null;
DependencyAssetName = null;
LoadedCount = 0;
TotalCount = 0;
UserData = null;
}
///
/// 获取显示实体时加载依赖资源事件编号。
///
public override int Id
{
get
{
return EventId;
}
}
///
/// 获取实体编号。
///
public int EntityId
{
get;
private set;
}
///
/// 获取实体逻辑类型。
///
public Type EntityLogicType
{
get;
private set;
}
///
/// 获取实体资源名称。
///
public string EntityAssetName
{
get;
private set;
}
///
/// 获取实体组名称。
///
public string EntityGroupName
{
get;
private set;
}
///
/// 获取被加载的依赖资源名称。
///
public string DependencyAssetName
{
get;
private set;
}
///
/// 获取当前已加载依赖资源数量。
///
public int LoadedCount
{
get;
private set;
}
///
/// 获取总共加载依赖资源数量。
///
public int TotalCount
{
get;
private set;
}
///
/// 获取用户自定义数据。
///
public object UserData
{
get;
private set;
}
///
/// 创建显示实体时加载依赖资源事件。
///
/// 内部事件。
/// 创建的显示实体时加载依赖资源事件。
public static ShowEntityDependencyAssetEventArgs Create(GameFramework.Entity.ShowEntityDependencyAssetEventArgs e)
{
ShowEntityInfo showEntityInfo = (ShowEntityInfo)e.UserData;
ShowEntityDependencyAssetEventArgs showEntityDependencyAssetEventArgs = ReferencePool.Acquire();
showEntityDependencyAssetEventArgs.EntityId = e.EntityId;
showEntityDependencyAssetEventArgs.EntityLogicType = showEntityInfo.EntityLogicType;
showEntityDependencyAssetEventArgs.EntityAssetName = e.EntityAssetName;
showEntityDependencyAssetEventArgs.EntityGroupName = e.EntityGroupName;
showEntityDependencyAssetEventArgs.DependencyAssetName = e.DependencyAssetName;
showEntityDependencyAssetEventArgs.LoadedCount = e.LoadedCount;
showEntityDependencyAssetEventArgs.TotalCount = e.TotalCount;
showEntityDependencyAssetEventArgs.UserData = showEntityInfo.UserData;
return showEntityDependencyAssetEventArgs;
}
///
/// 清理显示实体时加载依赖资源事件。
///
public override void Clear()
{
EntityId = 0;
EntityLogicType = null;
EntityAssetName = null;
EntityGroupName = null;
DependencyAssetName = null;
LoadedCount = 0;
TotalCount = 0;
UserData = null;
}
}
}