gamesink.go 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. package gamelogic
  2. import (
  3. "math/rand"
  4. "bet24.com/servers/games/fish/config"
  5. common "bet24.com/servers/games/fish/fishcommon"
  6. "bet24.com/servers/insecureframe/frame"
  7. )
  8. var gs *gamesink
  9. func newGameSink() *gamesink {
  10. gs = new(gamesink)
  11. return gs
  12. }
  13. type gamesink struct {
  14. }
  15. func (gs *gamesink) GetServerPort() int {
  16. return config.Server.ServerPort
  17. }
  18. func (gs *gamesink) GetGameID() int {
  19. return common.GAMEID
  20. }
  21. func (gs *gamesink) GetGameName() string {
  22. return common.GAME_NAME
  23. }
  24. func (gs *gamesink) GetRoomName() string {
  25. return config.Server.ServerName
  26. }
  27. func (gs *gamesink) CreateTableSink(table frame.Table, data string) frame.TableSink {
  28. return newTableSink(table, data)
  29. }
  30. func (gs *gamesink) GetOfflineSeconds() int64 {
  31. return 0
  32. }
  33. func (gs *gamesink) GetCertFile() string {
  34. return config.Server.CertFile
  35. }
  36. func (gs *gamesink) GetKeyFile() string {
  37. return config.Server.KeyFile
  38. }
  39. func (gs *gamesink) GetServerAddr() string {
  40. return config.Rooms.Rooms[0].ServerIP
  41. }
  42. func (gs *gamesink) GetRobotCount() int {
  43. return 0
  44. }
  45. func (gs *gamesink) GetRobotGoldLimit() (min, max int) {
  46. return
  47. }
  48. func (gs *gamesink) GetRobotOnlineSec() int {
  49. return 0
  50. }
  51. func (gs *gamesink) GetRoomDatas() []string {
  52. var ret []string
  53. for _, v := range config.Rooms.Rooms {
  54. ret = append(ret, v.RoomName)
  55. }
  56. return ret
  57. }
  58. func (gs *gamesink) GetMinRoomCount(roomData string) int {
  59. return 0
  60. }
  61. func (gs *gamesink) GetRoomRobotCount(roomName string) int {
  62. return 0
  63. }
  64. func (gs *gamesink) GetRoomRobotGoldLimit(roomName string) (min, max int) {
  65. return 0, 0
  66. }
  67. func (gs *gamesink) IsChipRoom() bool {
  68. return config.Server.IsChipRoom
  69. }
  70. func (gs *gamesink) OnPlatformConfig(key string) {
  71. config.OnConfigChanged(key)
  72. }
  73. func (gs *gamesink) IsPrivateRoom() bool {
  74. return config.Server.IsPrivateRoom
  75. }
  76. func (gs *gamesink) GetChairCount() int {
  77. return common.SEAT_COUNT
  78. }
  79. func (gs *gamesink) IsTableCloseByLogic() bool {
  80. return true
  81. }
  82. func (gs *gamesink) IgnoreSameIP() bool {
  83. return true
  84. }
  85. func (gs *gamesink) EnterPlayingRoomFirst() bool {
  86. return true
  87. }
  88. func (gs *gamesink) getRandom(min, max int) int {
  89. if min >= max {
  90. return min
  91. }
  92. return min + rand.Intn(max-min)
  93. }
  94. func (gs gamesink) isBetween(p, min, max int) bool {
  95. return p >= min && p <= max
  96. }
  97. func (gs *gamesink) GetRoomLevel(data string) int {
  98. return 0
  99. }
  100. func (gs *gamesink) GetVersionID() int {
  101. return config.Server.VersionID
  102. }