|
@@ -99,28 +99,42 @@ func (room_info *RoomInfoWrapper) findNextColor() msg.RoleType {
|
|
|
cur := room_info.CurRoundColor
|
|
|
colors := room_info.getColors()
|
|
|
|
|
|
- i := roleIndexOf(colors, room_info.getColorDataByColor(cur))
|
|
|
- if i == (len(colors) - 1) {
|
|
|
- i = 0
|
|
|
- } else {
|
|
|
- i = (i + 1)
|
|
|
- }
|
|
|
+ if room_info.RoomType == msg.RoomType_SHUANG_REN {
|
|
|
+ i := roleIndexOf(colors, room_info.getColorDataByColor(cur))
|
|
|
+ if i == (len(colors) - 1) {
|
|
|
+ i = 0
|
|
|
+ } else {
|
|
|
+ i = (i + 1)
|
|
|
+ }
|
|
|
|
|
|
- for index := i; index < len(colors); index++ {
|
|
|
- element := colors[index]
|
|
|
- if !element.IsFinish && !element.IsKick {
|
|
|
- return element.MColor
|
|
|
+ for index := i; index < len(colors); index++ {
|
|
|
+ element := colors[index]
|
|
|
+ if !element.IsFinish && !element.IsKick {
|
|
|
+ return element.MColor
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- for index := 0; index < i; index++ {
|
|
|
- element := colors[index]
|
|
|
- if !element.IsFinish && !element.IsKick {
|
|
|
- return element.MColor
|
|
|
+ for index := 0; index < i; index++ {
|
|
|
+ element := colors[index]
|
|
|
+ if !element.IsFinish && !element.IsKick {
|
|
|
+ return element.MColor
|
|
|
+ }
|
|
|
}
|
|
|
+ } else if room_info.RoomType == msg.RoomType_SIREN_REN {
|
|
|
+ return room_info.getNextColor()
|
|
|
}
|
|
|
+
|
|
|
return msg.RoleType_ROLE_TYPE_UNKNOWN
|
|
|
}
|
|
|
+func (room_info *RoomInfoWrapper) getNextColor() msg.RoleType {
|
|
|
+ cur := room_info.CurRoundColor
|
|
|
+ next_color := GetNextRole(cur)
|
|
|
+ nex_color_data := room_info.getColorDataByColor(next_color)
|
|
|
+ if nex_color_data.IsFinish || nex_color_data.IsKick {
|
|
|
+ return room_info.getNextColor()
|
|
|
+ }
|
|
|
+ return next_color
|
|
|
+}
|
|
|
|
|
|
// 当前玩家是否是机器人
|
|
|
func (room_info *RoomInfoWrapper) containsRobot(color msg.RoleType) bool {
|