Skip to content

Commit

Permalink
working change colors button
Browse files Browse the repository at this point in the history
  • Loading branch information
LupaDevStudio committed Dec 21, 2023
1 parent 642d1dd commit fd05e7e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
4 changes: 2 additions & 2 deletions data.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"music_volume": 0.5,
"current_theme_image": "lake",
"current_music": "",
"current_theme_colors": ""
"current_theme_colors": "japanese_1"
},
"unlocked_themes": {
"japanese_1": {
Expand All @@ -27,7 +27,7 @@
},
"japanese_3": {
"image": true,
"colors": false
"colors": true
}
},
"unlocked_musics": {
Expand Down
16 changes: 11 additions & 5 deletions screens/custom_widgets/theme_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,15 @@ def click_image(self):

def click_colors(self):
if not self.has_bought_colors:
USER_DATA.buy_item(self.theme_key, "colors", self.colors_price)
self.get_root_window().children[0].get_screen(
"customization").update_coins()
elif not self.is_using_colors:
pass
bought_sucessfully = USER_DATA.buy_item(
self.theme_key, "colors", self.colors_price)
if bought_sucessfully:
self.get_root_window().children[0].get_screen(
"customization").update_coins()
self.has_bought_colors = True
self.update_display()
elif self.has_bought_colors and not self.is_using_colors:
USER_DATA.change_theme_colors(self.theme_key)
self.update_display()
self.get_root_window().children[0].get_screen(
"customization").update_theme_layouts_display()
2 changes: 0 additions & 2 deletions screens/customization.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ def update_theme_layouts_display(self):
for theme in self.THEME_LAYOUT_DICT:
self.THEME_LAYOUT_DICT[theme].update_display()
current_theme_image = USER_DATA.settings["current_theme_image"]
# self.set_back_image_path(
# PATH_BACKGROUNDS + THEMES_DICT[current_theme_image]["image"])
self.manager.change_all_background_images(
PATH_BACKGROUNDS + THEMES_DICT[current_theme_image]["image"])

Expand Down
4 changes: 4 additions & 0 deletions tools/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ def change_theme_image(self, theme):
USER_DATA.settings["current_theme_image"] = theme
self.save_changes()

def change_theme_colors(self, theme):
USER_DATA.settings["current_theme_colors"] = theme
self.save_changes()

def buy_item(self, theme, item_type, price):
if self.user_profile["coins"] >= price:
self.user_profile["coins"] = self.user_profile["coins"] - price
Expand Down

0 comments on commit fd05e7e

Please sign in to comment.