//------------------------------------------------------------
// 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 ShowEntityFailureEventArgs : GameEventArgs
{
///
/// 显示实体失败事件编号。
///
public static readonly int EventId = typeof(ShowEntityFailureEventArgs).GetHashCode();
///
/// 初始化显示实体失败事件的新实例。
///
public ShowEntityFailureEventArgs()
{
EntityId = 0;
EntityLogicType = null;
EntityAssetName = null;
EntityGroupName = null;
ErrorMessage = null;
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 ErrorMessage
{
get;
private set;
}
///
/// 获取用户自定义数据。
///
public object UserData
{
get;
private set;
}
///
/// 创建显示实体失败事件。
///
/// 内部事件。
/// 创建的显示实体失败事件。
public static ShowEntityFailureEventArgs Create(GameFramework.Entity.ShowEntityFailureEventArgs e)
{
ShowEntityInfo showEntityInfo = (ShowEntityInfo)e.UserData;
ShowEntityFailureEventArgs showEntityFailureEventArgs = ReferencePool.Acquire();
showEntityFailureEventArgs.EntityId = e.EntityId;
showEntityFailureEventArgs.EntityLogicType = showEntityInfo.EntityLogicType;
showEntityFailureEventArgs.EntityAssetName = e.EntityAssetName;
showEntityFailureEventArgs.EntityGroupName = e.EntityGroupName;
showEntityFailureEventArgs.ErrorMessage = e.ErrorMessage;
showEntityFailureEventArgs.UserData = showEntityInfo.UserData;
ReferencePool.Release(showEntityInfo);
return showEntityFailureEventArgs;
}
///
/// 清理显示实体失败事件。
///
public override void Clear()
{
EntityId = 0;
EntityLogicType = null;
EntityAssetName = null;
EntityGroupName = null;
ErrorMessage = null;
UserData = null;
}
}
}