Пример #1
0
 def __init__(self, useHintBox=False):
     Menu.__init__(self)
     self.rect = (570, 300, 150, 300)
     playText = TextBox(["Confirm your move,", "returns your tiles if",
                         "your move is illegal."], (570, 480), (55, 46, 40), (255, 255, 255))
     self.buttons[GameMenu.PLAY_TURN] = Button(
         "PLAY", (570, 300, 150, 30), textBox=playText)
     shuffleText = TextBox(["Forfeit your turn",
                            "and draw new tiles for",
                            "the next turn."], (570, 480), (55, 46, 40), (255, 255, 255))
     self.buttons[GameMenu.RESHUFFLE] = Button(
         "REDRAW", (570, 340, 150, 30), textBox=shuffleText)
     if useHintBox:
         hintText = TextBox(["The AI will put your",
                             "pieces down. Just hit",
                             "PLAY to confirm it."],
                            (570,
                             480),
                            (55,
                             46,
                             40),
                            (255,
                             255,
                             255))
         self.buttons[
             GameMenu.HINT_TURN] = Button(
             "HINT", (570, 380, 150, 30), textBox=hintText, color=(
                 255, 255, 100), backColor=(
                 255, 170, 50))
         self.buttons[GameMenu.MAIN_MENU] = Button(
             "QUIT", (570, 420, 150, 30))
     else:
         self.buttons[GameMenu.MAIN_MENU] = Button(
             "QUIT", (570, 380, 150, 30))
     DISPLAYSURF.fill((255, 255, 255))
Пример #2
0
	def draw(self, backColor):
		pygame.draw.rect(DISPLAYSURF, backColor, self.rect)
		(left, top, width, height) = self.rect	
		text = Button.FONT.render(self.name, True, Button.FONT_COLOR, backColor)
		rect = text.get_rect()
		rect.center = (left+width/2, top+height/2)
		DISPLAYSURF.blit(text, rect)
Пример #3
0
 def draw(self):
     i = 0
     for line in self.text:
         left = self.pos[0]
         top = self.pos[1] + TextBox.MARGIN * i
         text = TextBox.FONT.render(line, True, self.color, self.backColor)
         rect = text.get_rect()
         if self.horzCentered:
             rect.centerx = left
         else:
             rect.left = left
         rect.top = top
         if rect.width > self.width:
             self.width = rect.width
         DISPLAYSURF.blit(text, rect)
         i += 1
Пример #4
0
	def __init__(self, userdata):
		Menu.__init__(self)
		trainerText = TextBox(["Practice your Scrabble skills with a built-in HINT",
								"box, which lets you know how the AI would have played",
								"your move. But you can't get ACHIEVEMENTS while training."], (400, 400), 
							(55, 46, 40), (255, 255, 255), horzCenter = True)
		newGameText = TextBox(["Play one-on-one against Wordsmith, the Scrabble AI.",
							    "No hints allowed, try to beat your best score!"], (400, 400), 
							(55, 46, 40), (255, 255, 255), horzCenter = True)
		achieveText = TextBox(self.createAchievementText(userdata), (400, 400), 
							(55, 46, 40), (255, 255, 255), horzCenter = True)
		self.buttons[MainMenu.TRAINING] = Button("Training", (250, 135, 300, 50), trainerText)
		self.buttons[MainMenu.NEW_GAME] = Button("Challenge", (250, 190, 300, 50), newGameText)
		self.buttons[MainMenu.ACHIEVEMENT] = Button("Achievements", (250, 245, 300, 50), achieveText)
		self.buttons[MainMenu.EXIT_GAME] = Button("Exit", (250, 300, 300, 50))
		DISPLAYSURF.fill((255,255,255))
Пример #5
0
	def draw(self):	
		i = 0
		for	line in self.text:
			left = self.pos[0]
			top = self.pos[1] + TextBox.MARGIN * i
			text = TextBox.FONT.render(line, True, self.color, self.backColor)
			rect = text.get_rect()
			if self.horzCentered:
				rect.centerx = left
			else:
				rect.left = left
			rect.top = top
			if rect.width > self.width:
				self.width = rect.width
			DISPLAYSURF.blit(text, rect)		
			i+=1
Пример #6
0
	def __init__(self, useHintBox = False):
		Menu.__init__(self)
		self.rect = (570, 300, 150, 300)
		playText = TextBox(["Confirm your move,",
							"returns your tiles if",
							"your move is illegal."], (570, 480), (55, 46, 40), (255, 255, 255))
		self.buttons[GameMenu.PLAY_TURN] = Button("PLAY", (570, 300, 150, 30), textBox = playText)
		shuffleText = TextBox(["Forfeit your turn",
							"and draw new tiles for",
							"the next turn."], (570, 480), (55, 46, 40), (255, 255, 255))
		self.buttons[GameMenu.RESHUFFLE] = Button("REDRAW", (570, 340, 150, 30), textBox = shuffleText)
		if useHintBox:
			hintText = TextBox(["The AI will put your",
								"pieces down. Just hit",
								"PLAY to confirm it."], (570, 480), (55, 46, 40), (255, 255, 255))
			self.buttons[GameMenu.HINT_TURN] = Button("HINT", (570, 380, 150, 30), textBox = hintText, color = (255, 255, 100), backColor = (255, 170, 50))
			self.buttons[GameMenu.MAIN_MENU] = Button("QUIT", (570, 420, 150, 30))
		else:
			self.buttons[GameMenu.MAIN_MENU] = Button("QUIT", (570, 380, 150, 30))
		DISPLAYSURF.fill((255,255,255))