rts-sim-module/components/common.go
2023-08-29 17:56:18 +08:00

61 lines
1.9 KiB
Go

package components
import (
"joylink.club/ecs"
"joylink.club/rtsssimulation/components/cstate"
)
// 系统时钟组件
var SystemTimerComponent = ecs.NewComponentType[cstate.SystemTimer]()
// 模型仓库引用组件,单例
var ModelStorageRefComponent = ecs.NewComponentType[cstate.ModelStorageRef]()
// 身份组件
var DeviceIdentityComponent = ecs.NewComponentType[cstate.DeviceIdentity]()
// 存储屏蔽门标签组件
var PsdTagHandlerComponent = ecs.NewComponentType[cstate.EntityTagHandler]()
// 存储继电器标签组件
var RelayTagHandlerComponent = ecs.NewComponentType[cstate.EntityTagHandler]()
// 可移动设备组件
var MovableDeviceStateComponent = ecs.NewComponentType[cstate.MovableDeviceState]()
// 比率设备组件
var PercentageDeviceStateComponent = ecs.NewComponentType[cstate.PercentageDeviceState]()
// 道岔继电器状态组件
var SwitchRelayStateComponent = ecs.NewComponentType[cstate.SwitchRelayState]()
// 物理区段状态组件
var PhysicalSectionStateComponent = ecs.NewComponentType[cstate.PhysicalSectionState]()
// 信号机状态组件
var SignalStateComponent = ecs.NewComponentType[cstate.SignalState]()
// 站台单侧屏蔽门状态组件
var PsdStateComponent = ecs.NewComponentType[cstate.PsdState]()
// 应答器状态组件
var BaliseStateComponent = ecs.NewComponentType[cstate.BaliseState]()
// 列车状态组件
var TrainStateComponent = ecs.NewComponentType[cstate.TrainState]()
// 两档按钮/旋钮状态组件
var TowPositionButtonStateComponent = ecs.NewComponentType[cstate.TowPositionButtonState]()
// 继电器状态组件
var RelayStateComponent = ecs.NewComponentType[cstate.RelayState]()
// 紧急停车按钮状态组件
var EmpStateComponent = ecs.NewComponentType[cstate.EmpState]()
// 生成标签组件
// 用于标记实体便于查找
func NewComponentTag() *ecs.ComponentType[struct{}] {
return ecs.NewComponentType[struct{}]()
}