def __init__(self, skippable=True): scenefactory.add_builder('story', lambda: CreditsScene()) self.next = self self.skippable = skippable self.counter = 0 self.credits = [["", "Credits", None, None], [ "Programming", "Blake O'Hare & Christopher Night", get_image('people/blake.png'), get_image('people/cosmo.png') ], [ "Sprite & Building Art", "Angel McLaughlin", get_image('people/spears.png'), None ], [ "Story & Title Art", "\"infinip\"", None, get_image('people/infinip.png') ], [ "Music", "Adrian Cline", get_image('people/ikanreed.png'), None ], [ "Writing & Voice", "Laura Freer", None, get_image('people/satyrane.png') ]] i = 0 while i < len(self.credits): img = self.credits[i][3] if img != None: self.credits[i][3] = pygame.transform.flip(img, True, False) i += 1
def __init__(self, skippable=True): scenefactory.add_builder('story', lambda:CreditsScene()) self.next = self self.skippable = skippable self.counter = 0 self.credits = [ ["", "Credits", None, None], ["Programming", "Blake O'Hare & Christopher Night", get_image('people/blake.png'), get_image('people/cosmo.png')], ["Sprite & Building Art", "Angel McLaughlin", get_image('people/spears.png'), None], ["Story & Title Art", "\"infinip\"", None, get_image('people/infinip.png')], ["Music", "Adrian Cline", get_image('people/ikanreed.png'), None], ["Writing & Voice", "Laura Freer", None, get_image('people/satyrane.png')] ] i = 0 while i < len(self.credits): img = self.credits[i][3] if img != None: self.credits[i][3] = pygame.transform.flip(img, True, False) i += 1
self.current = 0 self.counter = 0 def process_input(self, events, pressed): for event in events: if event.type == 'key': if event.down: if event.action in ('build', 'action', 'shoot', 'back'): self.current += 1 if self.current == len(self.text): self.current -= 1 from src import title self.next = CreditsScene(False) def update(self): self.counter += 1 def render(self, screen): screen.blit(self.pages[self.current], (0, 0)) y = 20 x = 10 for line in self.text[self.current]: img = get_text(util.trim(line), (0, 0, 0), 18) screen.blit(img, (x, y)) y += img.get_height() + 4 scenefactory.add_builder('story', lambda: StoryScene()) scenefactory.add_builder('credits', lambda x: CreditsScene(x))
] self.current = 0 self.counter = 0 def process_input(self, events, pressed): for event in events: if event.type == 'key': if event.down: if event.action in ('build', 'action', 'shoot', 'back'): self.current += 1 if self.current == len(self.text): self.current -= 1 from src import title self.next = CreditsScene(False) def update(self): self.counter += 1 def render(self, screen): screen.blit(self.pages[self.current], (0, 0)) y = 20 x = 10 for line in self.text[self.current]: img = get_text(util.trim(line), (0, 0, 0), 18) screen.blit(img, (x, y)) y += img.get_height() + 4 scenefactory.add_builder('story', lambda:StoryScene()) scenefactory.add_builder('credits', lambda x:CreditsScene(x))
raw_users = util.read_file("users.txt") if raw_users == None: users = [] raw_users = "" else: users = util.trim(raw_users).split("\n") user_lookup = {} for user in users: name = util.alphanums(util.trim(user[32:])) password = user[:32].lower() user_lookup[name] = password user = util.alphanums(self.username.text) password = user_lookup.get(user, None) if password == None: password = util.md5(str(time.time()) + "leprechauns") raw_users += "\n" + password + user util.write_file("users.txt", raw_users) self.auth_request = network.send_authenticate(user, password) self.password = password def process_input(self, events, pressed_keys): if pressed_keys["debug"]: from src import play self.next = play.PlayScene() UiScene.process_input(self, events, pressed_keys) scenefactory.add_builder("title", lambda: TitleScene())
def login_pressed(self): raw_users = util.read_file('users.txt') if raw_users == None: users = [] raw_users = '' else: users = util.trim(raw_users).split('\n') user_lookup = {} for user in users: name = util.alphanums(util.trim(user[32:])) password = user[:32].lower() user_lookup[name] = password user = util.alphanums(self.username.text) password = user_lookup.get(user, None) if password == None: password = util.md5(str(time.time()) + "leprechauns") raw_users += "\n" + password + user util.write_file('users.txt', raw_users) self.auth_request = network.send_authenticate(user, password) self.password = password def process_input(self, events, pressed_keys): if pressed_keys['debug']: from src import play self.next = play.PlayScene() UiScene.process_input(self, events, pressed_keys) scenefactory.add_builder('title', lambda: TitleScene())