Skip to content
Snippets Groups Projects
Commit 15e8db10 authored by Fabian Heinrich's avatar Fabian Heinrich
Browse files

Adjusted colors, change back to black only once

parent 5a240ee7
No related branches found
No related tags found
1 merge request!91Resolve "Score green or red when changed"
Pipeline #49352 passed
......@@ -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):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment