From 15e8db10e7f2dc3284bc2317bc85cdb606efe093 Mon Sep 17 00:00:00 2001 From: fheinrich <fheinrich@techfak.uni-bielefeld.de> Date: Thu, 21 Mar 2024 16:14:48 +0100 Subject: [PATCH] Adjusted colors, change back to black only once --- cooperative_cuisine/pygame_2d_vis/gui.py | 27 +++++++++++++----------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/cooperative_cuisine/pygame_2d_vis/gui.py b/cooperative_cuisine/pygame_2d_vis/gui.py index 19495f7e..c74bf0f4 100644 --- a/cooperative_cuisine/pygame_2d_vis/gui.py +++ b/cooperative_cuisine/pygame_2d_vis/gui.py @@ -831,13 +831,12 @@ class PyGameGUI: anchors={"centerx": "centerx", "top_target": self.level_name_label}, ) - scroll_height = ( + self.scroll_height = ( self.continue_button.get_abs_rect().top - self.text_recipes_label.get_abs_rect().bottom ) - self.scroll_width = self.window_width self.scroll_space_recipes = pygame_gui.elements.UIScrollingContainer( - relative_rect=pygame.Rect((0, 0), (self.scroll_width, scroll_height)), + relative_rect=pygame.Rect((0, 0), (self.window_width, self.scroll_height)), manager=self.manager, anchors={"centerx": "centerx", "top_target": self.text_recipes_label}, ) @@ -951,7 +950,7 @@ class PyGameGUI: ) self.scroll_width_completed_meals = self.window_width self.scroll_space_completed_meals = pygame_gui.elements.UIScrollingContainer( - relative_rect=pygame.Rect((0, 0), (self.scroll_width, scroll_height)), + relative_rect=pygame.Rect((0, 0), (self.window_width, scroll_height)), manager=self.manager, anchors={ "centerx": "centerx", @@ -1432,19 +1431,24 @@ class PyGameGUI: if self.switch_score_color: self.count_frames_score_label += 1 - duration_color_change = 40 + duration_color_change = 90 if score > self.last_score: - self.score_label.update_theming('{"colours": {"normal_text": "#00FF00"}}') + self.score_label.update_theming( + '{"colours": {"normal_text": "#03b706"}, "font": { "size": 22, "bold": 1}}' + ) + self.count_frames_score_label = 0 self.switch_score_color = True elif score < self.last_score: - self.score_label.update_theming('{"colours": {"normal_text": "#FF0000"}}') + self.score_label.update_theming( + '{"colours": {"normal_text": "#e22312"}, "font": { "size": 22, "bold": 1}}' + ) self.count_frames_score_label = 0 self.switch_score_color = True - else: + elif self.switch_score_color: if self.count_frames_score_label >= duration_color_change: self.score_label.update_theming( - '{"colours": {"normal_text": "#000000"}}' + '{"colours": {"normal_text": "#000000"}, "font": { "size": 20, "bold": 0}}' ) self.count_frames_score_label = 0 self.switch_score_color = False @@ -1545,7 +1549,7 @@ class PyGameGUI: for rg in self.level_info["recipe_graphs"]: rows += len(np.unique(np.array(list(rg["layout"].values()))[:, 1])) row_height = self.window_height / 14 - container_width = self.scroll_width * 0.9 + container_width = self.window_width * 0.9 container_height = rows * row_height icon_size = row_height * 0.9 @@ -1626,11 +1630,10 @@ class PyGameGUI: container=container, anchors={"centery": "centery", "right": "right"}, ) - last_recipes_labels.append(container) self.scroll_space_recipes.set_scrollable_area_dimensions( - (self.scroll_width * 0.95, container_height) + (self.window_width * 0.95, container_height) ) def setup_tutorial(self): -- GitLab