def operate(self, current_situation): self.page = 0 self.finished = False self.backbutton = gui.make_menu((650,600),[("Regress","back")],200) self.next_mode = "Introductory" self.draw_current_page() while not self.finished: ms = self.clock.tick(60) self.respond_to_the_will_of_the_operator() return self.next_mode
def prepare_load_menu(self): savedir = self.situation.get_save_dir() saves = [os.path.join(savedir,save) for save in os.listdir(savedir)] saves.sort(key=os.path.getmtime, reverse=True) saves = [os.path.basename(s) for s in saves][:8] savenames = ["%s: Chapter %d"%(s.split("-")[0],int(s.split("-")[1])+1) for s in saves] self.load_menu = gui.make_menu((300,150), zip(savenames,saves)+[("Regress","back")],400, prompt="Select Situation") return self.load_menu
def initialize(self): self.title = typefaces.prepare_title("Blastosaurus Rex") self.subtitle = typefaces.prepare_subtitle("Adventures in the Land of No Return") self.ribbon = chromographs.obtain("flourish/ribbon-white.png") self.title_top = PAGEMARGIN self.subtitle_top = PAGEMARGIN + self.title_top + self.title.get_height() scroll_top = PAGEMARGIN + self.subtitle_top + self.subtitle.get_height() width = 800 height = 480 location = pygame.Rect(PAGEMARGIN, scroll_top, width, height) self.exposition = gui.SelfAdvancingScroll(PREMISE.format(self.name), location, 30) self.backbutton = gui.make_menu((700, 655), [("Bypass", "skip")], 150)
def initialize(self): situation = self.situation chapter = chapters.open_chapter(situation.chapter) self.ribbon = chromographs.obtain("flourish/ribbon-white.png") self.portrait = chromographs.obtain("illustrations/%s"%chapter.illustration) self.title = typefaces.prepare_title("Chapter %s:"% chapter.number) self.summary = gui.make_titledbox((400,100), chapter.subtitle, chapter.summary, 500,gap=12) self.menu = gui.make_menu((700,550), [("We are prepared!","begin"), ("We are scared!","back"), ("Consult Encyclopaedia", "encyclopaedia"), ],300) new_inventions = [] situation.death_stats = defaultdict(int) for name in chapter.inventions: if name not in situation.unit_plans: new_inventions.append(name) for name in chapter.fences: if name not in situation.fence_plans: new_inventions.append(name) for name in chapter.facilities: if name not in situation.facility_plans: new_inventions.append(name) invention_names = [all_things_known.find_by_name(n) for n in new_inventions] dinos_in_chapter = chapter.beasts_in_this_chapter() dino_names = [] for name in dinos_in_chapter: if name in self.situation.seen_dinosaurs: continue information = all_things_known.find_by_name(name) if information: dino_names.append(information.name) tabulation = [] if new_inventions: tabulation.append(["NEW INVENTIONS:"]) tabulation.extend([" " + n] for n in new_inventions) if dino_names: tabulation.append(["WATCH OUT FOR:"]) tabulation.extend([" " + n] for n in dino_names) self.table = None if tabulation: self.table = typefaces.prepare_table(tabulation)
def initialize(self): if self.situation.args.sheep: bestiary.wooly_retribution() self.situation.args.sheep = False self.header = gui.make_textbox((250,PAGEMARGIN), "BLASTOSAURUS REX",500, size="title") self.main_menu = gui.make_menu((300,400), [("Initiation","new"), ("Continuation","load"), ("Information","information"), ("Education","encyclopaedia"), ("Termination","quit")],400) self.load_menu = self.prepare_load_menu() self.name_menu = gui.PunchCard((300,400)) self.name_prompt = gui.make_textbox( (300,200), "Punch a card with your name, for the analytical engine:\n", 400, ) self.menu = self.main_menu self.ribbon = chromographs.obtain("flourish/ribbon-white.png") phonographs.orchestrate("intromusic.ogg")