def __init__(self): super(ATMScreen, self).__init__() self.use_music_handler = False self.screen_rect = pg.Rect((0, 0), prepare.RENDER_SIZE) self.next = "lobby" self.states = { "MAINMENU": ATMMenu(), "DEPOSIT": DepositScreen(), "WITHDRAWAL": WithdrawalScreen(), "ADVANCE": AdvanceScreen(), "ACCOUNTSCREEN": AccountScreen(), "MESSAGESCREEN": MessageScreen() } self.state_name = "MAINMENU" self.state = self.states[self.state_name] self.frame = prepare.GFX["atm_frame"] topleft = self.screen_rect.left, self.screen_rect.bottom - 88 self.cash_icon = MoneyIcon(topleft, (195, 88))
class GutsState(object): font = prepare.FONTS["Saniretro"] deal_sounds = [prepare.SFX["cardshove{}".format(x)] for x in (1, 3, 4)] flip_sounds = [prepare.SFX["cardplace{}".format(x)] for x in (2, 3, 4)] cha_ching = prepare.SFX["coins"] screen_rect = pg.Rect((0, 0), prepare.RENDER_SIZE) money_icon = MoneyIcon((0, screen_rect.bottom - 75)) draw_group = pg.sprite.Group() move_animations = pg.sprite.Group() advisor = Advisor(draw_group, move_animations) advisor.active = True advisor_back = prepare.GFX["advisor_back"] advisor_front = prepare.GFX["advisor_front"] advisor_back_dim = prepare.GFX["advisor_back_dim"] advisor_front_dim = prepare.GFX["advisor_front_dim"] advisor_active = True window = None def __init__(self): self.done = False self.quit = False self.next = None rect = self.advisor_back.get_rect().union( self.advisor_front.get_rect()) self.advisor_button = Button(rect, call=self.toggle_advisor) self.buttons = ButtonGroup() pos = (self.screen_rect.right - (NeonButton.width + 10), self.screen_rect.bottom - (NeonButton.height + 10)) lobby_button = NeonButton(pos, "Lobby", self.back_to_lobby, None, self.buttons, bindings=[pg.K_ESCAPE]) self.animations = pg.sprite.Group() def warn(self, *args): warning = "Exiting the game will abandon the current pot!" GutsState.window = WarningWindow(self.screen_rect.center, warning, self.leave) def notice(self, msg): GutsState.window = NoticeWindow(self.screen_rect.center, msg) def back_to_lobby(self, *args): if self.game.pot: self.warn() else: self.leave() def leave(self): self.quit = True self.advisor.empty() def toggle_advisor(self, *args): GutsState.advisor_active = not GutsState.advisor_active def draw_advisor(self, surface): if self.advisor_active: surface.blit(self.advisor_back, (0, 0)) self.draw_group.draw(surface) surface.blit(self.advisor_front, (0, 0)) else: surface.blit(self.advisor_back_dim, (0, 0)) surface.blit(self.advisor_front_dim, (0, 0)) def general_update(self, dt, mouse_pos): if self.window: self.window.update(mouse_pos) if self.window.done: GutsState.window = None else: self.advisor_button.update(mouse_pos) self.animations.update(dt) self.buttons.update(mouse_pos) self.money_icon.update(self.game.player.cash) self.advisor_button.update(mouse_pos) if self.advisor_active: self.move_animations.update(dt) self.game.update() def startup(self, game): self.game = game def update(self, dt, scale): pass def get_event(self, event): pass def draw(self, surface): pass def play_deal_sound(self): choice(self.deal_sounds).play() def play_flip_sound(self): choice(self.flip_sounds).play() def play_stay_sound(self): choice(self.stay_sounds).play() def play_pass_sound(self): choice(self.fold_sounds).play()