From 9d66798163e6f30b3dab9082e670d2d1d7121e12 Mon Sep 17 00:00:00 2001 From: xzb <223@qq.com> Date: Wed, 11 Oct 2023 13:22:14 +0800 Subject: [PATCH] =?UTF-8?q?=E7=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- component/Light.go | 22 ++++++++++++++++++++++ entity/light.go | 5 +++++ examples/signal_3xh1/main.go | 5 ++++- jl-ecs-go | 2 +- 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 component/Light.go create mode 100644 entity/light.go diff --git a/component/Light.go b/component/Light.go new file mode 100644 index 0000000..37d70cc --- /dev/null +++ b/component/Light.go @@ -0,0 +1,22 @@ +package component + +import "joylink.club/ecs" + +// LightDrive 灯驱动 +type LightDrive struct { + Td bool +} + +// 灯色标签 +var ( + LdTag = ecs.NewTag() //绿 + HdTag = ecs.NewTag() //红 + UdTag = ecs.NewTag() //黄 + Bdtag = ecs.NewTag() //白 + AdTag = ecs.NewTag() //蓝 +) + +// 组件 +var ( + LightDriveType = ecs.NewComponentType[LightDrive]() +) diff --git a/entity/light.go b/entity/light.go new file mode 100644 index 0000000..faaefde --- /dev/null +++ b/entity/light.go @@ -0,0 +1,5 @@ +package entity + +func NewLightEntity() { + +} diff --git a/examples/signal_3xh1/main.go b/examples/signal_3xh1/main.go index 658e54a..ae66216 100644 --- a/examples/signal_3xh1/main.go +++ b/examples/signal_3xh1/main.go @@ -43,9 +43,12 @@ func main() { worldLog(sim, "===>>亮灯 .....") fi.DriveSignal3XH1Dd(sim, IdSignal3XH1, true) // - time.Sleep(1 * time.Second) + time.Sleep(2 * time.Second) worldLog(sim, "===>>开通引导信号 .....") fi.DriveSignal3XH1Yx(sim, IdSignal3XH1) + time.Sleep(2 * time.Second) + worldLog(sim, "===>>开通列车信号 .....") + fi.DriveSignal3XH1Lx(sim, IdSignal3XH1, true) // time.Sleep(3 * time.Second) sim.Close() diff --git a/jl-ecs-go b/jl-ecs-go index e779734..af60502 160000 --- a/jl-ecs-go +++ b/jl-ecs-go @@ -1 +1 @@ -Subproject commit e7797346722a572814539d9a453789b89ffe6bf4 +Subproject commit af605020f1bccf1f1b2ab5a4ae4966d1c6c9776c