You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
761 B
33 lines
761 B
package event |
|
|
|
import ( |
|
"texas-poker-bk/internal/logic/store" |
|
"texas-poker-bk/tool/watcher" |
|
) |
|
|
|
// OnlineWatcher 上线动作 |
|
var OnlineWatcher *watcher.Watcher[int64, bool] |
|
|
|
func init() { |
|
OnlineWatcher = watcher.NewWatcher(128, handleOnline) |
|
go OnlineWatcher.Run() |
|
} |
|
|
|
// handleOnline 玩家上线了,取消一些自动操作动作 |
|
func handleOnline(e *watcher.Event[int64, bool]) { |
|
account := store.NetAccounts.Get(e.Publisher) |
|
if account == nil { |
|
return |
|
} |
|
if account.OfflineDelayCanceler != nil { |
|
account.OfflineDelayCanceler.Cancel() |
|
} |
|
if account.Player == nil { |
|
return |
|
} |
|
// 取消自动下注 |
|
if account.Player.AutoBetDelayCanceler != nil { |
|
account.Player.AutoBetDelayCanceler.Cancel() |
|
account.Player.AutoBetDelayCanceler = nil |
|
} |
|
}
|
|
|