Skip to content

Commit

Permalink
Merge branch 'main' of lupa.github.com:LupaDevStudio/Postrias
Browse files Browse the repository at this point in the history
  • Loading branch information
LupaDevStudio committed Dec 23, 2023
2 parents a6884f8 + 911603b commit 4c451ee
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
30 changes: 17 additions & 13 deletions screens/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
### Kivy imports ###

from kivy.clock import Clock
from kivy.properties import StringProperty, NumericProperty
from kivy.properties import StringProperty
from kivy.loader import Loader, ProxyImage

### Module imports ###
Expand All @@ -26,6 +26,9 @@
PATH_MUSICS,
PATH_SOUNDS
)
from tools.constants import (
NUMBER_ADS_CREDITS
)
from tools import (
music_mixer,
sound_mixer,
Expand All @@ -49,8 +52,7 @@
if platform == "android":
from kivads import (
RewardedInterstitial,
InterstitialAd,
TestID
InterstitialAd
)


Expand Down Expand Up @@ -218,17 +220,17 @@ def on_enter(self, *args):
# Launch the start day function
Clock.schedule_once(self.start_day)

# Load an add
if platform == "android":
self.reward_interstitial = RewardedInterstitial(
REWARD_INTERSTITIAL, self.schedule_reward
)
self.reward_static = InterstitialAd(
INTERSTITIAL
)
# Allocate the number of credits
self.credit = NUMBER_ADS_CREDITS

# Allocate the number of credits
self.credit = 1
# Load an add
if platform == "android":
self.reward_interstitial = RewardedInterstitial(
REWARD_INTERSTITIAL, self.schedule_reward
)
self.reward_static = InterstitialAd(
INTERSTITIAL
)

else:
self.help_mode = False
Expand Down Expand Up @@ -432,6 +434,7 @@ def save_game(self):
save_dict["civilian"] = game.civilian
save_dict["paleo"] = game.paleo
save_dict["order"] = game.order
save_dict["credit"] = self.credit
USER_DATA.saved_data = save_dict
USER_DATA.save_changes()

Expand All @@ -447,6 +450,7 @@ def load_game(self):
game.civilian = save_dict["civilian"]
game.paleo = save_dict["paleo"]
game.order = save_dict["order"]
self.credit = save_dict["credit"]
game.extract_texts()
self.hide_cards()
self.enable_widget("back_button")
Expand Down
3 changes: 3 additions & 0 deletions tools/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@

# Load the data of the user

NUMBER_ADS_CREDITS = 1

class UserData():
"""
Expand All @@ -111,6 +112,8 @@ def __init__(self) -> None:
self.saved_data = None
else:
self.saved_data = data["saved_data"]
if not "credit" in self.saved_data:
self.saved_data["credit"] = NUMBER_ADS_CREDITS

def save_changes(self) -> None:
"""
Expand Down

0 comments on commit 4c451ee

Please sign in to comment.