def exit_game(screen: Af.Surface): Af.play(exit_sound) buttons = [ mc.Button(240, 410, f"menu/buttons/3/1.png", False), mc.Button(580, 410, f"menu/buttons/3/2.png", True) ] if not mc.Exit("menu/exit/exit_game.png", screen, buttons).display_menu(): Af.terminate_execution() return "main_menu"
def add_text(screen: Af.Surface): Af.play(change_menu_sound) buttons = [ mc.Button(335, 495, "/menu/buttons/5/1.png", False), mc.Button(573, 495, "/menu/buttons/5/2.png", True) ] at = mc.Add_Text(screen, buttons) at.display_menu() return "manage_gp"
def exit_game_menu(screen: Af.Surface): Af.play(exit_sound) buttons = [ mc.Button(240, 410, f"menu/buttons/3/1.png", False), mc.Button(580, 410, f"menu/buttons/3/2.png", True) ] if not mc.Exit("menu/exit/exit_menu.png", screen, buttons).display_menu(): Af.erase_active_user_data() return "main_menu" return "game_menu"
def change_password(screen: Af.Surface): Af.play(change_menu_sound) buttons = [ mc.Button(335, 210, "/menu/buttons/5/0.png", None), mc.Button(335, 356, "/menu/buttons/5/0.png", None), mc.Button(335, 495, "/menu/buttons/9/1.png", False), mc.Button(573, 495, "/menu/buttons/9/2.png", True) ] cma = mc.Create_Modify_Account("menu/interfaces/Main/change password.png", screen, buttons, True) effect = cma.display_menu() if effect == "change_password": return effect return "manage_us"
def create_table(screen): x_value = (1150 - 260) // 2 exit_button = mc.Button(x_value + 55, 650, "images/Buttons/Create_Table/exit.png", "exit1", 3) create_button2 = mc.Button(x_value, 550, "images/Buttons/Create_Table/create_2.png", "create2", 2) create_button1 = mc.Button(x_value, 450, "images/Buttons/Create_Table/create_1.png", "create1", 1) buttons_tc = [create_button1, create_button2, exit_button] tc = mc.Table_Creator(buttons_tc, screen) next_link = tc.display_menu() return next_link
def delete_statistics(screen: Af.Surface): Af.play(change_menu_sound) buttons = [ mc.Button(240, 410, f"menu/buttons/3/1.png", True), mc.Button(580, 410, f"menu/buttons/3/2.png", False) ] if mc.Exit("menu/exit/delete_account.png", screen, buttons).display_menu(): user_name = Af.read_file_content("saves/active_user.txt", 1)[0].split(" ")[0] verification_password = mc.Enter_Password(screen, True).display_menu() if verification_password == "main_menu": Af.play(delete_account_sound) Af.delete_user_account(user_name) return verification_password return "manage_us"
def tutorial(screen: Af.Surface): Af.play(change_menu_sound) position_x_tutorial = (1080 - 260) // 2 position_y_tutorial = [y for y in range(110, 600, 100)] effects_tutorial = ["controls", "save", "enemy", "level_up", "game_menu"] buttons = [ mc.Button(position_x_tutorial, y, f"menu/buttons/4/{position_y_tutorial.index(y) + 1}.png", effects_tutorial[position_y_tutorial.index(y)]) for y in position_y_tutorial[:len(effects_tutorial)] ] button_coo = { 0: (680, 90), 1: (680, 90), 2: (698, 192), 3: (685, 178), 4: (685, 178) } effects = [Af.load_image(f"menu/effects/1/{i + 1}.png") for i in range(4)] user = mc.User() user.get_active_user() user.get_texts() tutorial_menu = mc.User_Menu(screen, f"menu/interfaces/Main/tutorial.png", buttons, button_coo, effects, user) Af.write_file_content( "parameters/prev_men.txt", "game_menu") # make sure any submenu returns to Game Menu after return tutorial_menu.display_menu()
def create_new_account(screen: Af.Surface): Af.play(change_menu_sound) if len(Af.list_users()) == 7: Af.show_error_message(screen, 6) return "main_menu" buttons = [ mc.Button(335, 210, "/menu/buttons/5/0.png", None), mc.Button(335, 356, "/menu/buttons/5/0.png", None), mc.Button(335, 495, "/menu/buttons/5/1.png", False), mc.Button(573, 495, "/menu/buttons/5/2.png", True) ] ac = mc.Create_Modify_Account("menu/interfaces/Main/create account.png", screen, buttons) effect = ac.display_menu() if effect == "new": return effect elif effect: return "game_menu" return "main_menu"
def main_menu(screen): # f.stop_all_sounds() # f.play(change_menu_sound) position_x_main = (1150 - 260) // 2 position_y_main = [y for y in range(150, 600, 150)] effects_main = ["new_table", "tutorial", "exit1"] buttons_main = [ mc.Button(position_x_main, y, f"images/Buttons/Main/{position_y_main.index(y) + 1}.png", effects_main[position_y_main.index(y)], position_y_main.index(y)) for y in position_y_main[:len(effects_main)] ] m_m = mc.Menu(buttons_main, f"images/Menu/main_menu.png", screen) return m_m.display_menu()
def management(screen: Af.Surface): Af.play(change_menu_sound) position_x = (1080 - 260) // 2 position_y = [y for y in range(155, 600, 70)] effects = ["", "", "manage_gp", "manage_ch", "manage_us", "game_menu"] buttons = [ mc.Button(position_x, y + 20, f"menu/buttons/8/{position_y.index(y) + 1}.png", effects[position_y.index(y)]) for y in position_y[:len(effects)] ] position_x -= 55 button1 = mc.Button2(position_x, 130, f"menu/buttons/8/{0 + 1}.png", effects[0], 0) button2 = mc.Button2(position_x, 230, f"menu/buttons/8/{1 + 1}.png", effects[1], 1) buttons = [button1, button2] + buttons[2:] user = mc.User() user.get_active_user() user.get_texts() m = mc.Management(buttons, f"menu/interfaces/Main/management.png", screen, user) return m.display_menu()