multipleslotcounts.go 996 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package wildapeslot
  2. import (
  3. "bet24.com/log"
  4. )
  5. type mulcounts struct {
  6. WinAmount int
  7. SlotCounts [][][]int
  8. }
  9. type MultipleSlotCountManager struct {
  10. mgr_list []*SlotCountManager
  11. testCount []int
  12. }
  13. func newMultipleSlotCountManager() *MultipleSlotCountManager {
  14. ret := new(MultipleSlotCountManager)
  15. ret.loadData()
  16. return ret
  17. }
  18. func (mscm *MultipleSlotCountManager) loadData() {
  19. defer func() {
  20. log.Debug("MultipleSlotCountManager.loadData manager count = %d", len(mscm.mgr_list))
  21. }()
  22. mscm.mgr_list = append(mscm.mgr_list, newSlotCountManager("nofile"))
  23. }
  24. func (mscm *MultipleSlotCountManager) getMgr(winAmount int) *SlotCountManager {
  25. count := len(mscm.mgr_list)
  26. if count == 0 {
  27. return nil
  28. }
  29. if count == 1 {
  30. return mscm.mgr_list[0]
  31. }
  32. for i := 0; i < len(mscm.mgr_list); i++ {
  33. if winAmount >= mscm.mgr_list[i].WinAmount {
  34. mscm.testCount[i]++
  35. return mscm.mgr_list[i]
  36. }
  37. }
  38. //mscm.testCount[len(mscm.mgr_list)-1]++
  39. return mscm.mgr_list[len(mscm.mgr_list)-1]
  40. }