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
28 lines
839 B
C#
28 lines
839 B
C#
using GFramework.Core.system;
|
|
using GFramework.Game.Abstractions.coroutine;
|
|
|
|
namespace GFramework.Game.coroutine;
|
|
|
|
/// <summary>
|
|
/// 协程系统类,负责管理和更新协程调度器
|
|
/// </summary>
|
|
/// <param name="scheduler">协程调度器实例</param>
|
|
public class CoroutineSystem(CoroutineScheduler scheduler) : AbstractSystem, ICoroutineSystem
|
|
{
|
|
/// <summary>
|
|
/// 更新协程系统,驱动协程调度器执行协程逻辑
|
|
/// </summary>
|
|
/// <param name="deltaTime">时间间隔,表示自上一帧以来经过的时间(秒)</param>
|
|
public void OnUpdate(float deltaTime)
|
|
{
|
|
// 更新协程调度器,处理等待中的协程
|
|
scheduler.Update(deltaTime);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 初始化协程系统
|
|
/// </summary>
|
|
protected override void OnInit()
|
|
{
|
|
}
|
|
} |