package main import ( "fmt" "time" "joylink.club/ecs" ) func main() { sim := ecs.NewWorld(20) sim.StartUp() sim.Pause() go func() { time.Sleep(1 * time.Second) sim.Resume() }() // 超出channel缓冲区(超出后,会阻塞) for i := 0; i < 50; i++ { sim.Execute(func() { fmt.Println("测试执行") }) } // 请求功能测试 future := ecs.Request[int](sim, func() int { fmt.Println("执行请求") return 20 }) result := <-future fmt.Println("执行结果:", result) time.Sleep(2 * time.Second) }