mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-22 19:03:29 +08:00
- 添加协程上下文、句柄、调度器和作用域管理类 - 实现协程等待指令包括 WaitForSeconds、WaitUntil 和 WaitWhile - 创建协程系统和全局协程作用域管理器 - 定义协程相关抽象接口 ICoroutineScheduler、ICoroutineScope 等 - 升级 Meziantou.Analyzer 依赖版本至 2.0.283 - 升级 Meziantou.Polyfill 依赖版本至 1.0.100
27 lines
852 B
C#
27 lines
852 B
C#
using GFramework.Game.Abstractions.coroutine;
|
||
|
||
namespace GFramework.Game.coroutine;
|
||
|
||
/// <summary>
|
||
/// 协程上下文类,用于封装协程执行所需的环境信息
|
||
/// </summary>
|
||
/// <param name="scope">协程作用域接口实例</param>
|
||
/// <param name="scheduler">协程调度器实例</param>
|
||
/// <param name="owner">协程的所有者对象,默认为null</param>
|
||
public class CoroutineContext(ICoroutineScope scope, CoroutineScheduler scheduler, object? owner = null)
|
||
{
|
||
/// <summary>
|
||
/// 获取协程作用域
|
||
/// </summary>
|
||
public ICoroutineScope Scope { get; } = scope;
|
||
|
||
/// <summary>
|
||
/// 获取协程调度器
|
||
/// </summary>
|
||
public CoroutineScheduler Scheduler { get; } = scheduler;
|
||
|
||
/// <summary>
|
||
/// 获取协程所有者对象
|
||
/// </summary>
|
||
public object? Owner { get; } = owner;
|
||
} |