Skip to content

Commit

Permalink
Merge pull request #13 from SuperSlide-Game/dev
Browse files Browse the repository at this point in the history
First delivery PR
  • Loading branch information
peremunoz authored May 7, 2023
2 parents 4a4d1cd + 7bd3bdf commit 0dd6011
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import android.view.ViewGroup
import android.widget.Button
import androidx.fragment.app.DialogFragment
import com.example.superslidegame.databinding.FragmentPopUpBinding
import com.example.superslidegame.game.screen.GameScreen
import com.example.superslidegame.game.screen.SelectLevel
import com.example.superslidegame.log.screen.LogScreen

Expand All @@ -33,6 +34,12 @@ class PopUpFragment : DialogFragment() {
val nextLevelButton : Button = binding.nextLevelButtonWin
val logButton : Button = binding.logButtonWin

if ((activity as GameScreen).isLastLevel()) {
nextLevelButton.visibility = View.GONE
} else {
nextLevelButton.visibility = View.VISIBLE
}

menuButton.setOnClickListener {
activity?.finish()
dismiss()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,13 @@ class GameScreen : AppCompatActivity() {
return gameState.level
}

/**
* isLastLevel returns true if the game is in the last level.
*/
fun isLastLevel() : Boolean {
return gameState.level == GameLevel.MAX_LEVEL
}

/**
* getPlayingDifficulty returns the difficulty of the game.
*/
Expand Down

0 comments on commit 0dd6011

Please sign in to comment.