81 lines
3.5 KiB
Go
81 lines
3.5 KiB
Go
package routers
|
|
|
|
import (
|
|
"context"
|
|
"sync"
|
|
)
|
|
|
|
var _ = sync.Mutex{}
|
|
var _ = context.Background
|
|
|
|
//
|
|
// ★★ 路口相位 / 红绿灯(2026-10-02 从捐赠端 PrivateServerPor 移植)—— **让灯柱真的亮起来**。
|
|
// 背景(详见 modules/红绿灯与路口相位.md):
|
|
// 主线以前 init 的 Intersections 恒为 []、运行期相位包
|
|
// SyncAetherAIIntersectionUpdateDa(68819947) **一次都没发过** ⇒ 客户端
|
|
// AetherIntersectionManager 建不出 IntersectionDataEntity ⇒ 不
|
|
// RegisterTrafficLight ⇒ 灯柱从来没被接管。trafficSignalEnabled 那套
|
|
// 只是服务端自己压车速,跟灯柱没关系。
|
|
// 捐赠端的三条腿(我们照搬):
|
|
// ① init 带真路口表 → GameAdminBridge 的 -donor 变体(另见该文件)
|
|
// ② 登录后全量推一次 → PushIntersectionUpdatesAsync
|
|
// ③ 之后周期切档 → TickIntersectionSignalsAsync(本文件的后台循环)
|
|
// ⛑⛑ 循环**不依赖车流开关**:用户 2026-10-02 19:38 把 trafficEnabled 关了,
|
|
// 灯仍然要亮 ⇒ 这里自己起 loop,不挂在 TrafficLoop 里。
|
|
//
|
|
func GameRouter_IntersectionSignals_SignalsOf(ctx context.Context, session *GameSession) any {
|
|
// Router implementation for GameRouter_IntersectionSignals_SignalsOf
|
|
var zero any; return zero
|
|
}
|
|
|
|
func GameRouter_IntersectionSignals_UseZoneIndex(ctx context.Context, ) bool {
|
|
// Router implementation for GameRouter_IntersectionSignals_UseZoneIndex
|
|
return true
|
|
}
|
|
|
|
//
|
|
// 登录后给每个路口推一次 68819947(初始相位)。
|
|
// ★ 这一步是「灯从灭到亮」的开关 —— 只发 init 不发它,客户端只知道有路口、不知道当前相位。
|
|
//
|
|
func GameRouter_IntersectionSignals_PushIntersectionUpdatesAsync(ctx context.Context, session *GameSession, token context.Context) int32 {
|
|
// Router implementation for GameRouter_IntersectionSignals_PushIntersectionUpdatesAsync
|
|
return 0
|
|
}
|
|
|
|
// 启动(或确认已在跑)路口相位循环。与车流开关无关。
|
|
func GameRouter_IntersectionSignals_StartIntersectionSignals(ctx context.Context, session *GameSession) any {
|
|
// Router implementation for GameRouter_IntersectionSignals_StartIntersectionSignals
|
|
var zero any; return zero
|
|
}
|
|
|
|
// 断开 / 切场景时停掉循环。
|
|
func GameRouter_IntersectionSignals_StopIntersectionSignals(ctx context.Context, session *GameSession) any {
|
|
// Router implementation for GameRouter_IntersectionSignals_StopIntersectionSignals
|
|
var zero any; return zero
|
|
}
|
|
|
|
func GameRouter_IntersectionSignals_RunIntersectionSignalLoopAsync(ctx context.Context, session *GameSession, token context.Context) any {
|
|
// Router implementation for GameRouter_IntersectionSignals_RunIntersectionSignalLoopAsync
|
|
var zero any; return zero
|
|
}
|
|
|
|
//
|
|
// 体检用:路口数 / 多相位路口数 / 涉及车道数 / 首行摘要(启动时打一行,便于对账)。
|
|
//
|
|
func GameRouter_IntersectionSignals_ProbeIntersections(ctx context.Context, ) any {
|
|
// Router implementation for GameRouter_IntersectionSignals_ProbeIntersections
|
|
var zero any; return zero
|
|
}
|
|
|
|
type IntersectionSignalState struct {
|
|
// 每个路口当前处在第几相位(下标与 IntersectionTable.All 对齐)。
|
|
PeriodIndex []byte `json:"periodIndex"`
|
|
// 每个路口下一次切档的墙钟秒(TickCount64/1000);0 = 还没排。
|
|
NextSwitchAt []float64 `json:"nextSwitchAt"`
|
|
// 这个路口是否已经推过至少一次(玩家走进半径后要补推)。
|
|
Pushed []bool `json:"pushed"`
|
|
Cts *context.CancelFunc `json:"cts"`
|
|
Loop *any `json:"loop"`
|
|
}
|
|
|