fun action(optionNumber: Int, btnselected: Button) {
if (playingplayer == PLAYINGPLAYER.FIRST_PLAYER) {
btnselected.setBackgroundResource(R.drawable.button_game_green)
buttonClicked.add(optionNumber)
playerOneLastClicked = true
btnselected.isEnabled = false
playingplayer = PLAYINGPLAYER.SECOND_PLAYER
} else if (playingplayer == PLAYINGPLAYER.SECOND_PLAYER) {
btnselected.setBackgroundResource(R.drawable.button_game_red)
buttonClicked.add(optionNumber)
playerOneLastClicked = false
btnselected.isEnabled = false
playingplayer = PLAYINGPLAYER.FIRST_PLAYER
}
imagebtnState()
}
我有一个包含2个玩家的游戏,我希望每个玩家在30秒钟内没有单击时,单击按钮转到另一个玩家