# This file housese the different screens for the game.
# There will be a Main Menu screen, Main Game Screen, Pause screen, and Game Over screen.
import pyxel

class MainGame:
    """Class for the main game screen."""
    def __init__(self, game):
        self.game = game
        self.timer = 0
        self.score = 0
        pyxel.load("my_resource.pyxres")
        self.lives = [{"x": 30, "y": 4, "img": 0, "u": 1, "v": 209, "w": 5, "h": 7, "colkey": 0},
                      {"x": 36, "y": 4, "img": 0, "u": 1, "v": 209, "w": 5, "h": 7, "colkey": 0},
                      {"x": 42, "y": 4, "img": 0, "u": 1, "v": 209, "w": 5, "h": 7, "colkey": 0}
                      ]

    def draw(self):
        """Draws the main game screen."""
        pyxel.cls(0)
        pyxel.blt(0, 0, 0, 0, 0, 160, 144, 0)  # City1
        pyxel.blt(0, 0, 1, 0, 0, 160, 144, 0)  # City2
        pyxel.text(65, 5, "Time:" + str(self.timer // 30), 7)  # Display timer in seconds
        pyxel.text(115, 5, "Score: " + str(self.game.mg.score), 7)  # Display score
        pyxel.text(5, 5, "Lives:", 7)  # Display lives
        for life in self.lives:
            pyxel.blt(life["x"], life["y"], life["img"], life["u"], life["v"], life["w"], life["h"], life["colkey"])  # Draw lives
        self.timer += 1

class MainMenu:
    """Class for the main menu screen."""
    def __init__(self, game):
        self.game = game
        pyxel.load("my_resource.pyxres")

    def draw(self):
        """Draws the main menu screen."""
        pyxel.cls(0)
        pyxel.blt(0, 0, 0, 0, 0, 160, 144, 0)  # City1 background
        pyxel.blt(0, 0, 1, 0, 0, 160, 144, 0)  # City2 overlay
        pyxel.text(50, 20, "Delivery Drone", 7)  # Title with color cycling
        pyxel.text(40, 50, "Press Enter to Start", 7)  # Prompt with color cycling
        # pyxel.text(20, 70, "Press V to enable Voice Commands", 7)  # Enables voice commands
        # pyxel.rectb(70, 80, 10, 10, 7)  # White rectangle background for contrast
        # if self.game.enable_voice_commands:
        #     pyxel.fill(74, 84, 7)
        #     pyxel.fill(73, 83, 7)
        #     pyxel.fill(72, 83, 7)
        # else:
        #     pass
        # pyxel.text(15, 100, "'Red', 'Green','Blue', or 'Drop'", 7)
        pyxel.text(20, 110, "Use Arrow Keys or WASD to Move", 7)  # Instructions
        pyxel.text(25, 120, "Press Space to Drop Package", 7)  # Instructions

class PauseMenu:
    """Class to handle Pause Menu."""
    def __init__(self, game):
        self.game = game
        pyxel.load("my_resource.pyxres")

    def draw(self):
        """Draws the pause menu."""
        pyxel.cls(0)
        pyxel.blt(0, 0, 0, 0, 0, 160, 144, 0)  # City1 background
        pyxel.blt(0, 0, 1, 0, 0, 160, 144, 0)  # City2 overlay
        pyxel.text(50, 60, "Game Paused", 7)  # Pause Menu
        # pyxel.text(20, 100, "Press V to enable Voice Commands", 7)  # Enables voice commands
        # pyxel.rectb(70, 110, 10, 10, 7)  # White rectangle background for contrast
        # if self.game.enable_voice_commands:
        #     pyxel.fill(74, 114, 7)
        # else:
        #     pass
        # pyxel.text(20, 125, "'Red', 'Green','Blue', or 'Drop'", 7)


class GameOver:
    """Class for the game over screen."""
    def __init__(self, game):
        self.game = game
        pyxel.load("my_resource.pyxres")

    def draw(self):
        """Draws the game over screen."""
        pyxel.cls(0)
        pyxel.blt(0, 0, 0, 0, 0, 160, 144, 0)  # City1 background
        pyxel.blt(0, 0, 1, 0, 0, 160, 144, 0)  # City2 overlay
        pyxel.text(60, 50, "Game Over", 7)  # Game Over title
        pyxel.text(40, 70, "Press R to Restart", 7)  # Prompt
        pyxel.text(50, 90, "Final Score: " + str(self.game.mg.score), 7)