extend_node_state.go 710 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package data
  2. func (p *nodeStateConfig) OnAfterLoad(_ bool) {
  3. if p.UpdateGameNodeInterval < 3 {
  4. p.UpdateGameNodeInterval = 3
  5. }
  6. }
  7. func (p *nodeStateConfig) IsMaxOfOnline(uidCount int64) bool {
  8. // 如果没有设置最大在线人数,则忽略检查
  9. if p.MaxOfOnline < 1 {
  10. return false
  11. }
  12. if uidCount >= p.MaxOfOnline {
  13. return true
  14. }
  15. return false
  16. }
  17. func (p *nodeStateConfig) IsMaxOfPlayer(count int64) bool {
  18. if p.MaxOfPlayer < 1 {
  19. return false
  20. }
  21. if count >= p.MaxOfPlayer {
  22. return true
  23. }
  24. return false
  25. }
  26. func (p *nodeStateConfig) InWhiteList(ip string, uid int64) bool {
  27. if p.UidList.Contains(uid) {
  28. return true
  29. }
  30. if p.IpList.Contains(ip) {
  31. return true
  32. }
  33. return false
  34. }