Add new GameControls
This commit is contained in:
parent
e91cbf285e
commit
41678fd2e4
3 changed files with 33 additions and 6 deletions
|
@ -98,7 +98,8 @@ class LevelFacade {
|
|||
if (minesAround != 0) highlight() else 0
|
||||
}
|
||||
Action.OpenNeighbors -> {
|
||||
if (!isCovered) { openNeighbors() } else { 0 }
|
||||
openNeighbors()
|
||||
8
|
||||
}
|
||||
else -> 0
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue