namespace TEngine
{
///
/// 加载场景回调函数集。
///
public sealed class LoadSceneCallbacks
{
private readonly LoadSceneSuccessCallback _loadSceneSuccessCallback;
private readonly LoadSceneFailureCallback _loadSceneFailureCallback;
private readonly LoadSceneUpdateCallback _loadSceneUpdateCallback;
///
/// 初始化加载场景回调函数集的新实例。
///
/// 加载场景成功回调函数。
public LoadSceneCallbacks(LoadSceneSuccessCallback loadSceneSuccessCallback)
: this(loadSceneSuccessCallback, null, null)
{
}
///
/// 初始化加载场景回调函数集的新实例。
///
/// 加载场景成功回调函数。
/// 加载场景失败回调函数。
public LoadSceneCallbacks(LoadSceneSuccessCallback loadSceneSuccessCallback, LoadSceneFailureCallback loadSceneFailureCallback)
: this(loadSceneSuccessCallback, loadSceneFailureCallback, null)
{
}
///
/// 初始化加载场景回调函数集的新实例。
///
/// 加载场景成功回调函数。
/// 加载场景更新回调函数。
public LoadSceneCallbacks(LoadSceneSuccessCallback loadSceneSuccessCallback, LoadSceneUpdateCallback loadSceneUpdateCallback)
: this(loadSceneSuccessCallback, null, loadSceneUpdateCallback)
{
}
///
/// 初始化加载场景回调函数集的新实例。
///
/// 加载场景成功回调函数。
/// 加载场景失败回调函数。
/// 加载场景更新回调函数。
public LoadSceneCallbacks(LoadSceneSuccessCallback loadSceneSuccessCallback, LoadSceneFailureCallback loadSceneFailureCallback, LoadSceneUpdateCallback loadSceneUpdateCallback)
{
if (loadSceneSuccessCallback == null)
{
throw new GameFrameworkException("Load scene success callback is invalid.");
}
_loadSceneSuccessCallback = loadSceneSuccessCallback;
_loadSceneFailureCallback = loadSceneFailureCallback;
_loadSceneUpdateCallback = loadSceneUpdateCallback;
}
///
/// 获取加载场景成功回调函数。
///
public LoadSceneSuccessCallback LoadSceneSuccessCallback
{
get
{
return _loadSceneSuccessCallback;
}
}
///
/// 获取加载场景失败回调函数。
///
public LoadSceneFailureCallback LoadSceneFailureCallback
{
get
{
return _loadSceneFailureCallback;
}
}
///
/// 获取加载场景更新回调函数。
///
public LoadSceneUpdateCallback LoadSceneUpdateCallback
{
get
{
return _loadSceneUpdateCallback;
}
}
}
}