github.com/lianghucheng/zrddz@v0.0.0-20200923083010-c71f680932e2/src/game/internal/user_game.go (about) 1 package internal 2 3 func (user *User) doPrepare(r interface{}, showCards bool) { 4 landlordRoom := r.(*LandlordRoom) 5 if landlordRoom.state == roomGame { 6 landlordRoom.reconnect(user) 7 } else { 8 landlordRoom.doPrepare(user.baseData.userData.UserID, showCards) 9 } 10 } 11 12 func (user *User) doBid(r interface{}, bid bool) { 13 landlordRoom := r.(*LandlordRoom) 14 if landlordRoom.state == roomGame { 15 landlordRoom.doBid(user.baseData.userData.UserID, bid) 16 } 17 } 18 19 func (user *User) doGrab(r interface{}, grab bool) { 20 landlordRoom := r.(*LandlordRoom) 21 if landlordRoom.state == roomGame { 22 landlordRoom.doGrab(user.baseData.userData.UserID, grab) 23 } 24 } 25 26 func (user *User) doDouble(r interface{}, double bool) { 27 landlordRoom := r.(*LandlordRoom) 28 if landlordRoom.state == roomGame { 29 landlordRoom.doDouble(user.baseData.userData.UserID, double) 30 } 31 } 32 33 func (user *User) doShowCards(r interface{}, showCards bool) { 34 landlordRoom := r.(*LandlordRoom) 35 if landlordRoom.state == roomGame { 36 landlordRoom.doShowCards(user.baseData.userData.UserID, showCards) 37 } 38 } 39 40 func (user *User) doDiscard(r interface{}, cards []int) { 41 landlordRoom := r.(*LandlordRoom) 42 if landlordRoom.state == roomGame { 43 landlordRoom.doDiscard(user.baseData.userData.UserID, cards) 44 } 45 } 46 47 func (user *User) doSystemHost(r interface{}, host bool) { 48 landlordRoom := r.(*LandlordRoom) 49 if landlordRoom.state == roomGame { 50 landlordRoom.doSystemHost(user.baseData.userData.UserID, host) 51 } 52 } 53 54 func (user *User) doChangeTable(r interface{}) { 55 landlordRoom := r.(*LandlordRoom) 56 if landlordRoom.state == roomIdle { 57 switch landlordRoom.rule.RoomType { 58 case roomPractice, roomBaseScoreMatching, roomRedPacketMatching: 59 landlordRoom.changeTable(user) 60 } 61 } 62 }