feat: lockstep 支持获取帧同步客户端数量
This commit is contained in:
parent
f475aac387
commit
589a424491
|
@ -87,6 +87,13 @@ func (slf *Lockstep[ClientID, Command]) JoinClientWithFrame(client Client[Client
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetClientCount 获取客户端数量
|
||||||
|
func (slf *Lockstep[ClientID, Command]) GetClientCount() int {
|
||||||
|
slf.clientLock.RLock()
|
||||||
|
defer slf.clientLock.RUnlock()
|
||||||
|
return len(slf.clients)
|
||||||
|
}
|
||||||
|
|
||||||
// DropCache 丢弃特定帧的缓存,当 handler 返回 true 时将丢弃缓存
|
// DropCache 丢弃特定帧的缓存,当 handler 返回 true 时将丢弃缓存
|
||||||
func (slf *Lockstep[ClientID, Command]) DropCache(handler func(frame int64) bool) {
|
func (slf *Lockstep[ClientID, Command]) DropCache(handler func(frame int64) bool) {
|
||||||
slf.frameCacheLock.Lock()
|
slf.frameCacheLock.Lock()
|
||||||
|
|
Loading…
Reference in New Issue