From b9058b8309b05c9540b4873fe2c5641e4d0dee37 Mon Sep 17 00:00:00 2001 From: fheinrich <fheinrich@techfak.uni-bielefeld.de> Date: Thu, 18 Jan 2024 11:58:40 +0100 Subject: [PATCH] Fix commits, label for orders --- overcooked_simulator/gui_2d_vis/gui_theme.json | 11 ++++++++++- .../gui_2d_vis/overcooked_gui.py | 18 +++++++++++++----- .../gui_2d_vis/visualization.yaml | 2 ++ 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/overcooked_simulator/gui_2d_vis/gui_theme.json b/overcooked_simulator/gui_2d_vis/gui_theme.json index 4683e4e3..862d3d96 100644 --- a/overcooked_simulator/gui_2d_vis/gui_theme.json +++ b/overcooked_simulator/gui_2d_vis/gui_theme.json @@ -56,7 +56,7 @@ }, "font": { "size": 20, - "bold": 1 + "bold": 0 } }, "#score_label": { @@ -68,6 +68,15 @@ "bold": 1 } }, + "#orders_label": { + "colours": { + "normal_text": "#000000" + }, + "font": { + "size": 20, + "bold": 0 + } + }, "#quit_button": { "colours": { "normal_bg": "#f71b29", diff --git a/overcooked_simulator/gui_2d_vis/overcooked_gui.py b/overcooked_simulator/gui_2d_vis/overcooked_gui.py index b458164e..d7375be7 100644 --- a/overcooked_simulator/gui_2d_vis/overcooked_gui.py +++ b/overcooked_simulator/gui_2d_vis/overcooked_gui.py @@ -550,7 +550,7 @@ class PyGameGUI: def draw_orders(self, state): orders = [ - "Tomato", + "Burger", "TomatoSoupPlate", "OnionSoupPlate", "OnionSoupPlate", @@ -564,9 +564,8 @@ class PyGameGUI: (orders_width, orders_height), ) - pygame.draw.rect( - self.orders_screen, colors["green"], self.orders_screen.get_rect() - ) + bg_color = colors[self.visualization_config["GameWindow"]["background_color"]] + pygame.draw.rect(self.orders_screen, bg_color, self.orders_screen.get_rect()) order_rects_start = (orders_height // 2) - (self.grid_size // 2) @@ -607,6 +606,13 @@ class PyGameGUI: ] self.main_window.blit(self.orders_screen, orders_rect) + self.orders_label = pygame_gui.elements.UILabel( + text="Orders:", + relative_rect=pygame.Rect(0, 0, self.screen_margin, self.screen_margin), + manager=self.manager, + object_id="#orders_label", + ) + def draw(self, state): """Main visualization function. @@ -871,7 +877,9 @@ class PyGameGUI: state = self.simulator.get_state() - self.main_window.fill(colors["lemonchiffon1"]) + self.main_window.fill( + colors[self.visualization_config["GameWindow"]["background_color"]] + ) self.manager.draw_ui(self.main_window) match self.menu_state: diff --git a/overcooked_simulator/gui_2d_vis/visualization.yaml b/overcooked_simulator/gui_2d_vis/visualization.yaml index 626bda9a..bef233b6 100644 --- a/overcooked_simulator/gui_2d_vis/visualization.yaml +++ b/overcooked_simulator/gui_2d_vis/visualization.yaml @@ -12,6 +12,8 @@ GameWindow: order_bar_height: 100 order_size: 50 + background_color: lemonchiffon1 + Kitchen: ground_tiles_color: sgigray76 background_lines: gray79 -- GitLab