def draw_action(view, path): rolls = outcome.Outcome() rolls.set_suboutcome(Position(3, 7), outcome.rolls(2, 1)) gamestate = Gamestate.from_file(path + "Gamestate.json") units = gamestate.all_units() action = Action.from_document( units, json.loads(open(path + "Action.json").read())) view.draw_action_tutorial(action, rolls)
def show_upgrades(view, folder): unit = menu_choice(view, sorted([unit for unit in Unit.name.values()])) gamestate = Gamestate.from_file(folder + "/Gamestate.json") gamestate.player_units["C2"] = unit unit = getattr(units_module, unit.replace(" ", "_"))() view.show_unit_zoomed_tutorial(unit, None) show_upgrade_list(view, unit) while 1: event = pygame.event.wait() if event.type == pygame.MOUSEBUTTONDOWN: if within(event.pos, view.interface.help_area): break if event.type == pygame.MOUSEBUTTONDOWN: if within(event.pos, view.interface.to_help_menu_area): run_tutorial(view) break if quit_game_requested(event): sys.exit()
def draw_scenario(view, path, number, total): if os.path.exists(path + "Gamestate.json"): gamestate = Gamestate.from_file(path + "Gamestate.json") else: gamestate = Gamestate({}, {}, 2) players = [Player("Green", "Human"), Player("Red", "Human")] game = Game(players, gamestate) view.draw_game_tutorial(game) view.draw_tutorial_page_number(number, total) if os.path.exists(path + "Blue.marked"): marked_blue = [ Position.from_string(position) for position in json.loads(open(path + "Blue.marked").read())["tiles"] ] view.shade_positions(marked_blue, shading_blue) if os.path.exists(path + "Red.marked"): marked_red = [ Position.from_string(position) for position in json.loads(open(path + "Red.marked").read())["tiles"] ] view.shade_positions(marked_red, shading_red) if os.path.exists(path + "Unit.txt"): unit_name = open(path + "Unit.txt").readline() unit = getattr(units_module, unit_name.replace(" ", "_"))() view.show_unit_zoomed_tutorial(unit, None) draw_unit = True else: draw_unit = False if os.path.exists(path + "Description.txt"): description = open(path + "Description.txt").readlines() view.draw_tutorial_message(description, draw_unit)