using System;
namespace XGame.Framework.Asyncs
{
///
/// 异步完成回调方法
///
///
public delegate void OnAsyncCompleted(IAsync aAsync);
///
/// 异步核心接口
///
public interface IAsync
{
///
/// 是否完成
///
bool IsCompleted { get; }
///
/// 进度
///
float Progress { get; }
///
/// 用户自定义对象
///
object State { get; set; }
///
/// 异常(如果发生)
///
Exception Exception { get; }
///
/// 异步完成的监听,
/// 无论是否发生异常都会回调回来,
/// 此版本回调会无序执行
///
///
///
IAsync On(OnAsyncCompleted action);
///
/// 异步完成的监听,
/// 无论是否发生异常都会回调回来,
/// listener会按order排序,数值越小越先执行, 小于0会先于回调函数版本执行
///
///
///
///
IAsync On(IAsyncListener listener, int order = 0);
///
/// 移除监听
///
///
///
IAsync RemoveOn(OnAsyncCompleted action);
///
/// 移除监听
///
///
///
IAsync RemoveOn(IAsyncListener listener);
///
/// 移除所有监听
///
///
IAsync RemoveAll();
}
}