Add new GameControls

This commit is contained in:
Lucas Lima 2020-06-26 00:35:35 -03:00
parent e91cbf285e
commit 41678fd2e4
No known key found for this signature in database
GPG key ID: C5EEF4C30BFBF8D7
3 changed files with 33 additions and 6 deletions

View file

@ -98,7 +98,8 @@ class LevelFacade {
if (minesAround != 0) highlight() else 0
}
Action.OpenNeighbors -> {
if (!isCovered) { openNeighbors() } else { 0 }
openNeighbors()
8
}
else -> 0
}

View file

@ -26,7 +26,10 @@ class AreaView : View {
private var area: Area? = null
private lateinit var paintSettings: AreaPaintSettings
private lateinit var palette: AreaPalette
private var gestureDetector: GestureDetector? = null
private val gestureDetector: GestureDetector by lazy {
GestureDetector(context, GestureDetector.SimpleOnGestureListener())
}
constructor(context: Context) : super(context)
@ -39,10 +42,7 @@ class AreaView : View {
}
fun setOnDoubleClickListener(listener: GestureDetector.OnDoubleTapListener) {
if (gestureDetector == null) {
gestureDetector = GestureDetector(context, GestureDetector.SimpleOnGestureListener())
}
gestureDetector?.setOnDoubleTapListener(listener)
gestureDetector.setOnDoubleTapListener(listener)
}
fun bindField(area: Area, isAmbientMode: Boolean, isLowBitAmbient: Boolean, paintSettings: AreaPaintSettings) {

View file

@ -29,6 +29,32 @@ sealed class GameControl(
doubleClick = null
)
)
object FastFlag : GameControl(
onCovered = Actions(
singleClick = Action.SwitchMark,
longPress = Action.OpenTile,
doubleClick = null
),
onOpen = Actions(
singleClick = Action.OpenNeighbors,
longPress = Action.HighlightNeighbors,
doubleClick = null
)
)
object DoubleClick : GameControl(
onCovered = Actions(
singleClick = Action.SwitchMark,
longPress = null,
doubleClick = Action.OpenTile
),
onOpen = Actions(
singleClick = Action.HighlightNeighbors,
longPress = null,
doubleClick = Action.OpenNeighbors
)
)
}
data class ActionFeedback(