Skip to content

Commit 0dd6011

Browse files
authored
Merge pull request #13 from SuperSlide-Game/dev
First delivery PR
2 parents 4a4d1cd + 7bd3bdf commit 0dd6011

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

app/src/main/java/com/example/superslidegame/fragments/PopUpFragment.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import android.view.ViewGroup
88
import android.widget.Button
99
import androidx.fragment.app.DialogFragment
1010
import com.example.superslidegame.databinding.FragmentPopUpBinding
11+
import com.example.superslidegame.game.screen.GameScreen
1112
import com.example.superslidegame.game.screen.SelectLevel
1213
import 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()

app/src/main/java/com/example/superslidegame/game/screen/GameScreen.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff 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
*/

0 commit comments

Comments
 (0)