File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
app/src/main/java/com/example/superslidegame Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import android.view.ViewGroup
88import android.widget.Button
99import androidx.fragment.app.DialogFragment
1010import com.example.superslidegame.databinding.FragmentPopUpBinding
11+ import com.example.superslidegame.game.screen.GameScreen
1112import com.example.superslidegame.game.screen.SelectLevel
1213import com.example.superslidegame.log.screen.LogScreen
1314
@@ -33,6 +34,12 @@ class PopUpFragment : DialogFragment() {
3334 val nextLevelButton : Button = binding.nextLevelButtonWin
3435 val logButton : Button = binding.logButtonWin
3536
37+ if ((activity as GameScreen ).isLastLevel()) {
38+ nextLevelButton.visibility = View .GONE
39+ } else {
40+ nextLevelButton.visibility = View .VISIBLE
41+ }
42+
3643 menuButton.setOnClickListener {
3744 activity?.finish()
3845 dismiss()
Original file line number Diff line number Diff line change @@ -118,6 +118,13 @@ class GameScreen : AppCompatActivity() {
118118 return gameState.level
119119 }
120120
121+ /* *
122+ * isLastLevel returns true if the game is in the last level.
123+ */
124+ fun isLastLevel () : Boolean {
125+ return gameState.level == GameLevel .MAX_LEVEL
126+ }
127+
121128 /* *
122129 * getPlayingDifficulty returns the difficulty of the game.
123130 */
You can’t perform that action at this time.
0 commit comments