Add "BACK TO MENU" button to END-screen

This commit is contained in:
Artur Savitskiy 2024-09-09 20:36:13 +02:00
parent a48fc1176e
commit 08591c71f6
1 changed files with 8 additions and 4 deletions

View File

@ -159,6 +159,8 @@ def next_game_mode():
game_mode = GameMode.BATTLE
elif game_mode == GameMode.BATTLE:
game_mode = GameMode.END
elif game_mode == GameMode.END:
game_mode = GameMode.MENU
update_game_mode()
@ -181,6 +183,8 @@ def update_game_mode():
load_game_button.grid(column=start_column_enemy_field, row=load_button_row + 1, columnspan=4)
exit_button.grid(column=start_column_enemy_field, row=load_button_row + 2, columnspan=4)
end_button.grid_forget()
hide_view(my_view)
hide_view(enemy_view)
@ -201,6 +205,7 @@ def update_game_mode():
start_button.grid(column=start_column_my_field + 11, row=load_button_row, columnspan=4)
load_game_button.grid_forget()
exit_button.grid_forget()
end_button.grid_forget()
show_view(my_view, start_column_my_field, start_row_my_field)
show_view(enemy_view, start_column_enemy_field, start_row_enemy_field)
@ -219,6 +224,7 @@ def update_game_mode():
start_button.grid_forget()
load_game_button.grid_forget()
exit_button.grid_forget()
end_button.grid_forget()
show_view(my_view, start_column_my_field, start_row_my_field)
show_view(enemy_view, start_column_enemy_field, start_row_enemy_field)
@ -237,6 +243,7 @@ def update_game_mode():
start_button.grid_forget()
load_game_button.grid_forget()
exit_button.grid_forget()
end_button.grid(column=start_column_enemy_field, row=load_button_row, columnspan=4)
hide_view(my_view)
hide_view(enemy_view)
@ -268,19 +275,16 @@ lbl_left_vertical = Label(window, text='', width=5, height=2)
lbl_center_vertical = Label(window, text='', width=5, height=2)
lbl_upper_horizontal = Label(window, text='', width=5, height=2)
lbl_lower_horizontal = Label(window, text='', width=50, height=2, textvariable=my_view.remaining_ship_text)
lbl_lower_enemy_horizontal = Label(window, text='', width=50, height=2, textvariable=enemy_view.remaining_ship_text)
savebutton = Button(window, text='Save', width=20, height=2, command=lambda: savebutton_click(my_view))
loadbutton = Button(window, text='Load', width=20, height=2, command=lambda: loadbutton_click(my_view))
start_button = Button(window, text='START', width=20, height=2, command=next_game_mode)
load_game_button = Button(window, text='LOAD', width=20, height=2)
exit_button = Button(window, text='EXIT', width=20, height=2)
end_button = Button(window, text='BACK TO MENU', width=20, height=2, command=next_game_mode)
game_mode = GameMode.MENU
update_game_mode()