From 63e2fa46e345ec047ff12b0ea8fb2716464c07d8 Mon Sep 17 00:00:00 2001 From: Pablo Moleri Date: Mon, 07 Feb 2011 01:50:11 +0000 Subject: Changes in drawing system, now the tracking of dirty areas is more accurate achieving better performance. Buttons brighten when mouse is over them. External characters added. --- diff --git a/Saludame.activity/actions.py b/Saludame.activity/actions.py index 75d9f03..4772464 100755 --- a/Saludame.activity/actions.py +++ b/Saludame.activity/actions.py @@ -2,6 +2,7 @@ import status_bars import events +import pygame class Action: @@ -34,6 +35,9 @@ class Action: self.sound_loop_times = sound_loop_times def perform(self): + if self.sound_path: + pygame.mixer.Sound(self.sound_path).play() + if self.time_span == -1: # Perpetual self.effect.activate() diff --git a/Saludame.activity/actions_creator.py b/Saludame.activity/actions_creator.py index 56c8574..f6f7079 100755 --- a/Saludame.activity/actions_creator.py +++ b/Saludame.activity/actions_creator.py @@ -6,8 +6,12 @@ import os BARS_DECREASE_RATE = -0.1 -#ANIMATIONS +#SOUNDS BLIP_PATH = os.path.normpath("assets/sound/blip.ogg") +CHANGE_PLACE_PATH = os.path.normpath("assets/sound/place_change.ogg") +CHANGE_CLOTHES_PATH = os.path.normpath("assets/sound/clothes_change.ogg") + +#ANIMATIONS APPLE_PATH = os.path.normpath("assets/food/apple") STEW_PATH = os.path.normpath("assets/food/stew") CHEW_PATH = os.path.normpath("assets/kid/actions/eat") @@ -127,53 +131,53 @@ actions_list = [ ), # Sports - ("sport_football", 0.3, 8, 0, 0, None, 3, 1, None, 4, "sound_path", + ("sport_football", 0.3, 8, 0, 0, None, 3, 1, None, 4, None, effects.Effect(None, [("energy", 0.5), ("sports", 2.0), ("shower", -0.5), ("fun", 2.0)]), None, None, None ), - ("sport_run", 0.3, 8, 0, 0, None, 3, 1, None, 4, "sound_path", + ("sport_run", 0.3, 8, 0, 0, None, 3, 1, None, 4, None, effects.Effect(None, [("energy", 0.5), ("sports", 2.0), ("shower", -0.5), ("fun", 2.0)]), None, None, None ), - ("sport_hide_seek", 0.3, 8, 0, 0, None, 3, 1, None, 4, "sound_path", + ("sport_hide_seek", 0.3, 8, 0, 0, None, 3, 1, None, 4, None, effects.Effect(None, [("energy", 0.5), ("sports", 2.0), ("shower", -0.5), ("fun", 2.0)]), None, None, None ), - ("sport_jump", 0.3, 8, 0, 0, JUMP_ROPE_PATH, 3, 1, None, 4, "sound_path", + ("sport_jump", 0.3, 8, 0, 0, JUMP_ROPE_PATH, 3, 1, None, 4, None, effects.Effect(None, [("energy", 0.5), ("sports", 2.0), ("shower", -0.5), ("fun", 2.0)]), None, None, None ), # Tiempo Libre - ("sp_sleep", 0.3, 8, 0, 0, None, 3, 1, None, 4, "sound_path", + ("sp_sleep", 0.3, 8, 0, 0, None, 3, 1, None, 4, None, effects.Effect(None, [("energy", 1.0), ("relaxing", 2.0)]), None, None, None ), - ("sp_talk", 0.3, 8, 0, 0, None, 3, 1, None, 4, "sound_path", + ("sp_talk", 0.3, 8, 0, 0, None, 3, 1, None, 4, None, effects.Effect(None, [("fun", 0.5)]), None, None, None ), - ("sp_study", 0.3, 8, 0, 0, None, 3, 1, None, 4, "sound_path", + ("sp_study", 0.3, 8, 0, 0, None, 3, 1, None, 4, None, effects.Effect(None, [("energy", -0.5), ("responsability", 2.0)]), None, None, None ), - ("sp_clean", 0.3, 8, 0, 0, None, 3, 1, None, 4, "sound_path", + ("sp_clean", 0.3, 8, 0, 0, None, 3, 1, None, 4, None, effects.Effect(None, [("energy", -0.5), ("responsability", 2.0)]), None, None, None ), # Higiene - ("shower", 0.3, 8, 0, 0, None, 3, 1, None, 4, "sound_path", + ("shower", 0.3, 8, 0, 0, None, 3, 1, None, 4, None, effects.Effect(None, [("shower", 5.0)]), None, None, None ), - ("brush_teeth", 0.3, 8, 0, 0, None, 3, 1, None, 4, "sound_path", + ("brush_teeth", 0.3, 8, 0, 0, None, 3, 1, None, 4, None, effects.Effect(None, [("b_teeth", 0.5)]), None, None, None, 1, "un link" ), - ("wash_hands", 0.3, 8, 0, 0, None, 3, 1, None, 4, "sound_path", + ("wash_hands", 0.3, 8, 0, 0, None, 3, 1, None, 4, None, effects.Effect(None, [("w_hands", 3.0)]), None, None, None ), - ("toilet", 0.3, 1.9, 0, 1, "assets/kid/actions/toilet", 3, 1, None, 4, "sound_path", + ("toilet", 0.3, 1.9, 0, 1, "assets/kid/actions/toilet", 3, 1, None, 4, None, effects.Effect(None, [("toilet", 4.0)]), None, None, None, 1, "un link" ), @@ -183,21 +187,21 @@ actions_list = [ ### ACTIONS THAT SET CHARACTER LOCATION -locations_ac_list = [("goto_schoolyard", None, 1, None, None, None, None, None, None, None, None, effects.LocationEffect(None, "schoolyard"), None, None, None), - ("goto_country", None, 1, None, None, None, None, None, None, None, None, effects.LocationEffect(None, "country"), None, None, None), - ("goto_classroom", None, 1, None, None, None, None, None, None, None, None, effects.LocationEffect(None, "classroom"), None, None, None), - ("goto_square", None, 1, None, None, None, None, None, None, None, None, effects.LocationEffect(None, "square"), None, None, None), - ("goto_living", None, 1, None, None, None, None, None, None, None, None, effects.LocationEffect(None, "home"), None, None, None), - ("goto_bedroom", None, 1, None, None, None, None, None, None, None, None, effects.LocationEffect(None, "home"), None, None, None), - ("goto_kitchen", None, 1, None, None, None, None, None, None, None, None, effects.LocationEffect(None, "home"), None, None, None), - ("goto_bathroom", None, 1, None, None, None, None, None, None, None, None, effects.LocationEffect(None, "home"), None, None, None) +locations_ac_list = [("goto_schoolyard", None, 1, None, None, None, None, None, None, None, CHANGE_PLACE_PATH, effects.LocationEffect(None, "schoolyard"), None, None, None), + ("goto_country", None, 1, None, None, None, None, None, None, None, CHANGE_PLACE_PATH, effects.LocationEffect(None, "country"), None, None, None), + ("goto_classroom", None, 1, None, None, None, None, None, None, None, CHANGE_PLACE_PATH, effects.LocationEffect(None, "classroom"), None, None, None), + ("goto_square", None, 1, None, None, None, None, None, None, None, CHANGE_PLACE_PATH, effects.LocationEffect(None, "square"), None, None, None), + ("goto_living", None, 1, None, None, None, None, None, None, None, CHANGE_PLACE_PATH, effects.LocationEffect(None, "home"), None, None, None), + ("goto_bedroom", None, 1, None, None, None, None, None, None, None, CHANGE_PLACE_PATH, effects.LocationEffect(None, "home"), None, None, None), + ("goto_kitchen", None, 1, None, None, None, None, None, None, None, CHANGE_PLACE_PATH, effects.LocationEffect(None, "home"), None, None, None), + ("goto_bathroom", None, 1, None, None, None, None, None, None, None, CHANGE_PLACE_PATH, effects.LocationEffect(None, "home"), None, None, None) ] ### ACTIONS THAT SET CHARACTER CLOTHES -clothes_ac_list = [("change_school_clothes", None, 1, None, None, None, None, None, None, None, None, effects.ClothesEffect(None, "school"), None, None, None), - ("change_sunny_clothes", None, 1, None, None, None, None, None, None, None, None, effects.ClothesEffect(None, "sunny"), None, None, None), - ("change_rainy_clothes", None, 1, None, None, None, None, None, None, None, None, effects.ClothesEffect(None, "rainy"), None, None, None), +clothes_ac_list = [("change_school_clothes", None, 1, None, None, None, None, None, None, None, CHANGE_CLOTHES_PATH, effects.ClothesEffect(None, "school"), None, None, None), + ("change_sunny_clothes", None, 1, None, None, None, None, None, None, None, CHANGE_CLOTHES_PATH, effects.ClothesEffect(None, "sunny"), None, None, None), + ("change_rainy_clothes", None, 1, None, None, None, None, None, None, None, CHANGE_CLOTHES_PATH, effects.ClothesEffect(None, "rainy"), None, None, None), ] class ActionsLoader: diff --git a/Saludame.activity/animation.py b/Saludame.activity/animation.py index c78fcb1..69f27ca 100755 --- a/Saludame.activity/animation.py +++ b/Saludame.activity/animation.py @@ -17,10 +17,10 @@ BLACK = pygame.Color("black") BLUE = pygame.Color("blue") WHITE = pygame.Color("white") -class Kid(gui.Window): +class Kid(gui.Widget): def __init__(self, container, rect, frame_rate, windows_controller, game_man, mood): - gui.Window.__init__(self, container, rect, frame_rate, windows_controller, "character_window") + gui.Widget.__init__(self, container, rect, frame_rate, windows_controller) self.character = game_man.character @@ -74,27 +74,41 @@ class Kid(gui.Window): directory = "%s/%s/%s" % (self.mood.kid_animation_path, sex, clothes) self.file_list = get_image_list(directory) + ##### Draw ##### - def pre_draw(self, screen): + def update(self, frames): filename = self.file_list[self.index] self.sprite = load_animation(self.sprite, filename) + self.background = self.sprite.copy() maps = self.character.mappings self.change_color(COLORS_TO_MAP, maps["hair"] + maps["skin"] + maps["socks"] + maps["shoes"]) - screen.blit(self.bg_image, self.rect) - screen.blit(self.sprite, self.rect) - self.index = (self.index + 1) % len(self.file_list) - return [self.rect] + self.set_dirty() + + ###### Draw ##### + #def pre_draw(self, screen): + #filename = self.file_list[self.index] + #self.sprite = load_animation(self.sprite, filename) + + #maps = self.character.mappings + #self.change_color(COLORS_TO_MAP, maps["hair"] + maps["skin"] + maps["socks"] + maps["shoes"]) + + ##screen.blit(self.bg_image, self.rect) + #screen.blit(self.sprite, self.rect) + + #self.index = (self.index + 1) % len(self.file_list) + + #return [self.rect] ##### Colors ##### def change_color(self, old, new): index = 0 for old_color in old: new_color = new[index] - utilities.change_color(self.sprite, old_color, new_color) + utilities.change_color(self.background, old_color, new_color) index += 1 @@ -114,60 +128,41 @@ class ActionAnimation(gui.Widget): self.index = 0 - self.blip = pygame.mixer.Sound(sound_path) - - def draw(self, screen): - file = self.file_list[self.index] - self.sprite = pygame.image.load(file) - rect = self.sprite.get_rect() - rect.center = self.rect_absolute.center - - screen.fill(WHITE, rect) - screen.blit(self.sprite, rect) - - self.index = (self.index + 1) % len(self.file_list) - self.blip.play() - - return self.rect_absolute + def update(self, frames): + if frames % self.frame_rate == 0: + filename = self.file_list[self.index] + self.background = pygame.image.load(filename) + self.index = (self.index + 1) % len(self.file_list) + self.set_dirty() -class FPS: +class FPS(gui.Widget): def __init__(self, container, rect, frame_rate, clock): - self.register_id = "" - self.buttons = [] - self.rect = rect - self.frame_rate = frame_rate + + gui.Widget.__init__(self, container, rect, frame_rate) + self.clock = clock - + self.font = pygame.font.Font(None, 16) - def draw(self, screen, frames): - screen.fill(BLACK, self.rect) + def draw(self, screen): + screen.fill(BLACK, self.rect_absolute) text = str(round(self.clock.get_fps())) text_surf = self.font.render(text, False, (255, 255, 255)) - screen.blit(text_surf, self.rect) - return [self.rect] + screen.blit(text_surf, self.rect_absolute) + return self.rect_absolute def get_image_list(directory): dirList = os.listdir(directory) dirList.sort() return [os.path.join(directory, fname) for fname in dirList if fname.endswith('.png') or fname.endswith('.diff.gz') or fname.endswith('.diff.zlib')] - + + import zlib import imagepatch def load_animation(last_image, new_filename): if new_filename.endswith('.png'): new = pygame.image.load(new_filename) - #elif new_filename.endswith('.diff.gz'): - #f = gzip.open(new_filename, 'r') - #diff = f.read() - #f.close() - - #new_buffer = imagepatch.patch(last_image.get_buffer().raw, diff) - - #new = last_image # both point to the same surface - #new.get_buffer().write(new_buffer, 0) # Instead of using a copy modifies the same surface - elif new_filename.endswith('.diff.zlib'): f = open(new_filename, 'r') diff = zlib.decompress(f.read()) diff --git a/Saludame.activity/app_init.py b/Saludame.activity/app_init.py index 96194e2..a613e47 100755 --- a/Saludame.activity/app_init.py +++ b/Saludame.activity/app_init.py @@ -31,14 +31,20 @@ class AppLoader: #moods self.moods_list = self.__load_moods() + # Environments + self.places = self.__load_places() + self.weathers = ["rainy", "sunny", "cold", "windy"] + self.environments_dictionary = self.__load_environments() + self.weather_effects = self.__load_weather_effects() + ### game manager - self.game_man = game_manager.GameManager(self.character, self.status_bars_controller, None, self.events_list, character_loader.get_places(), character_loader.get_environments_dictionary(), character_loader.get_weather_effects(), self.moods_list, windows_controller) + self.game_man = game_manager.GameManager(self.character, self.status_bars_controller, None, self.events_list, self.get_places(), self.weathers, self.get_environments_dictionary(), self.get_weather_effects(), self.moods_list, windows_controller) actions_loader = actions_creator.ActionsLoader(self.bars_loader.get_bar_controller(), self.game_man) self.actions_list = actions_loader.get_actions_list() self.game_man.actions_list = self.actions_list self.game_man.add_background_action("BARS_DEC") #acción de decrementar las barras - + ### menu #self.menu = menu_creator.load_menu(self.character, (100, 100)) ### visuals @@ -65,6 +71,14 @@ class AppLoader: def get_events(self): return self.events_list + def get_environments_dictionary(self): + return self.environments_dictionary + + def get_places(self): + return self.places + + def get_weather_effects(self): + return self.weather_effects def __load_events(self, bars_controller): #Events constructor params: @@ -105,15 +119,15 @@ class AppLoader: probability = [("b_teeth", "indirect", 50.0, 70.0), ("dulces", "direct", 75.0, 30.0)] #editar parametros: - event = events.SocialEvent("caries.jpg", "assets/characters/teacher.png", "p_caries", _("Prevenir caries"), 5.0, 15, probability, u"Deberías lavarte los \ndientes", None, 100) + event = events.SocialEvent("caries.jpg", "assets/characters/mother.png", "p_caries", _("Prevenir caries"), 5.0, 15, probability, u"Deberías lavarte los \ndientes", None, 100) _events.append(event) probability = [("responsability", "indirect", 60.0, 70.0)] - event = events.SocialEvent("unkown.png", "assets/characters/teacher.png", "study", _("Estudiar"), 5.0, 20, probability, u"¿Hiciste los deberes?", None, 100) + event = events.SocialEvent("unkown.png", "assets/characters/father.png", "study", _("Estudiar"), 5.0, 20, probability, u"¿Hiciste los deberes?", None, 100) _events.append(event) probability = [("responsability", "indirect", 70.0, 70.0)] - event = events.SocialEvent("unkown.png", "assets/characters/teacher.png", "health_check", _("Control médico"), 5.0, 30, probability, u"¿Este año fuiste al doctor?", None, 100) + event = events.SocialEvent("unkown.png", "assets/characters/doctor.png", "health_check", _("Control médico"), 5.0, 30, probability, u"¿Este año fuiste al doctor?", None, 100) _events.append(event) return _events @@ -149,3 +163,89 @@ class AppLoader: return moods_list + def __load_weather_effects(self): + weather_effects = { + # (clothes_id, weather_id, boolean indoor outdoor) : list of tuples [(id_bar, rate)] + #school clothes + ("school", "sunny", True) : [("fun", 1.0)], + ("school", "sunny", False) : [("physica", 1.0)], + ("school", "rainy", True) : [("physica", 1.0)], + ("school", "rainy", False) : [("physica", 1.0)], + ("school", "windy", True) : [("physica", 1.0)], + ("school", "windy", False) : [("physica", 1.0)], + ("school", "cold", True) : [("physica", 1.0)], + ("school", "cold", False) : [("physica", 1.0)], + #sunny clothes + ("sunny", "sunny", True) : [("physica", 1.0)], + ("sunny", "sunny", False) : [("physica", 1.0)], + ("sunny", "rainy", True) : [("physica", 1.0)], + ("sunny", "rainy", False) : [("physica", 1.0)], + ("sunny", "windy", True) : [("physica", 1.0)], + ("sunny", "windy", False) : [("physica", 1.0)], + ("sunny", "cold", True) : [("physica", 1.0)], + ("sunny", "cold", False) : [("physica", 1.0)], + #rainy clothes + ("rainy", "sunny", True) : [("physica", 1.0)], + ("rainy", "sunny", False) : [("physica", 1.0)], + ("rainy", "rainy", True) : [("physica", 1.0)], + ("rainy", "rainy", False) : [("physica", 1.0)], + ("rainy", "windy", True) : [("physica", 1.0)], + ("rainy", "windy", False) : [("physica", 1.0)], + ("rainy", "cold", True) : [("physica", 1.0)], + ("rainy", "cold", False) : [("physica", 1.0)], + } + return weather_effects + + def __load_places(self): + places = { #schoolyard + "schoolyard" : {"outdoor": True}, + #square + "square" : {"outdoor": True}, + #classroom + "classroom" : {"outdoor": False}, + #home + "home": {"outdoor": False}, + #country + "country": {"outdoor": True} + } + return places + + + def __load_environments(self): + environments = {#schoolyard + ("schoolyard", "sunny") : Environment("assets/background/schoolyard_sunny.png"), + ("schoolyard", "rainy") : Environment("assets/background/schoolyard_rainy.png"), + ("schoolyard", "windy") : Environment("assets/background/schoolyard_windy.png"), + ("schoolyard", "cold") : Environment("assets/background/schoolyard_cold.png"), + #square + ("square", "sunny") : Environment("assets/background/square_sunny.png"), + ("square", "rainy") : Environment("assets/background/square_rainy.png"), + ("square", "windy") : Environment("assets/background/square_windy.png"), + ("square", "cold") : Environment("assets/background/square_cold.png"), + #classroom + ("classroom", "sunny") : Environment("assets/background/classroom_sunny.png"), + ("classroom", "rainy") : Environment("assets/background/classroom_rainy.png"), + ("classroom", "windy") : Environment("assets/background/classroom_windy.png"), + ("classroom", "cold") : Environment("assets/background/classroom_cold.png"), + #home + ("home", "sunny") : Environment("assets/background/home_sunny.png"), + ("home", "rainy") : Environment("assets/background/home_rainy.png"), + ("home", "windy") : Environment("assets/background/home_windy.png"), + ("home", "cold") : Environment("assets/background/home_cold.png"), + #country + ("country", "sunny") : Environment("assets/background/country_sunny.png"), + ("country", "rainy") : Environment("assets/background/country_rainy.png"), + ("country", "windy") : Environment("assets/background/country_windy.png"), + ("country", "cold") : Environment("assets/background/country_cold.png"), + } + + return environments + +class Environment: + + def __init__(self, background_path): + self.background_path = background_path + + def get_background_path(self): + return self.background_path + \ No newline at end of file diff --git a/Saludame.activity/assets/background/classroom_normal.png b/Saludame.activity/assets/background/classroom_windy.png index 6a048ce..6a048ce 100755 --- a/Saludame.activity/assets/background/classroom_normal.png +++ b/Saludame.activity/assets/background/classroom_windy.png Binary files differ diff --git a/Saludame.activity/assets/background/country_normal.png b/Saludame.activity/assets/background/country_windy.png index 17acc3f..17acc3f 100755 --- a/Saludame.activity/assets/background/country_normal.png +++ b/Saludame.activity/assets/background/country_windy.png Binary files differ diff --git a/Saludame.activity/assets/background/home_normal.png b/Saludame.activity/assets/background/home_windy.png index d105786..d105786 100644 --- a/Saludame.activity/assets/background/home_normal.png +++ b/Saludame.activity/assets/background/home_windy.png Binary files differ diff --git a/Saludame.activity/assets/background/schoolyard_normal.png b/Saludame.activity/assets/background/schoolyard_windy.png index 288c8bf..288c8bf 100755 --- a/Saludame.activity/assets/background/schoolyard_normal.png +++ b/Saludame.activity/assets/background/schoolyard_windy.png Binary files differ diff --git a/Saludame.activity/assets/background/square_normal.png b/Saludame.activity/assets/background/square_windy.png index f2a6c19..f2a6c19 100755 --- a/Saludame.activity/assets/background/square_normal.png +++ b/Saludame.activity/assets/background/square_windy.png Binary files differ diff --git a/Saludame.activity/assets/characters/doctor.png b/Saludame.activity/assets/characters/doctor.png new file mode 100644 index 0000000..97b46af --- /dev/null +++ b/Saludame.activity/assets/characters/doctor.png Binary files differ diff --git a/Saludame.activity/assets/characters/father.png b/Saludame.activity/assets/characters/father.png new file mode 100644 index 0000000..2356b8e --- /dev/null +++ b/Saludame.activity/assets/characters/father.png Binary files differ diff --git a/Saludame.activity/assets/characters/mother.png b/Saludame.activity/assets/characters/mother.png new file mode 100644 index 0000000..961cddc --- /dev/null +++ b/Saludame.activity/assets/characters/mother.png Binary files differ diff --git a/Saludame.activity/assets/characters/teacher.png b/Saludame.activity/assets/characters/teacher.png index abac635..d84548b 100644 --- a/Saludame.activity/assets/characters/teacher.png +++ b/Saludame.activity/assets/characters/teacher.png Binary files differ diff --git a/Saludame.activity/assets/events/balloon.png b/Saludame.activity/assets/events/balloon.png index ebf2951..2225c4a 100644 --- a/Saludame.activity/assets/events/balloon.png +++ b/Saludame.activity/assets/events/balloon.png Binary files differ diff --git a/Saludame.activity/assets/events/balloonB.png b/Saludame.activity/assets/events/balloonB.png new file mode 100644 index 0000000..b5823d3 --- /dev/null +++ b/Saludame.activity/assets/events/balloonB.png Binary files differ diff --git a/Saludame.activity/assets/events/go-back.png b/Saludame.activity/assets/events/go-back.png index 194fd00..21c3248 100644 --- a/Saludame.activity/assets/events/go-back.png +++ b/Saludame.activity/assets/events/go-back.png Binary files differ diff --git a/Saludame.activity/assets/events/go-next.png b/Saludame.activity/assets/events/go-next.png index 857a196..1dd702c 100644 --- a/Saludame.activity/assets/events/go-next.png +++ b/Saludame.activity/assets/events/go-next.png Binary files differ diff --git a/Saludame.activity/assets/events/weather/cloudy.png b/Saludame.activity/assets/events/weather/cold.png index 733a719..733a719 100644 --- a/Saludame.activity/assets/events/weather/cloudy.png +++ b/Saludame.activity/assets/events/weather/cold.png Binary files differ diff --git a/Saludame.activity/assets/layout/icon_physica.png b/Saludame.activity/assets/layout/icon_physica.png index 0a361c5..7dbe0e5 100644 --- a/Saludame.activity/assets/layout/icon_physica.png +++ b/Saludame.activity/assets/layout/icon_physica.png Binary files differ diff --git a/Saludame.activity/assets/sound/blip.wav b/Saludame.activity/assets/sound/blip.wav deleted file mode 100755 index 587c32b..0000000 --- a/Saludame.activity/assets/sound/blip.wav +++ /dev/null Binary files differ diff --git a/Saludame.activity/assets/sound/click.ogg b/Saludame.activity/assets/sound/click.ogg new file mode 100644 index 0000000..0a98929 --- /dev/null +++ b/Saludame.activity/assets/sound/click.ogg Binary files differ diff --git a/Saludame.activity/assets/sound/clothes_change.ogg b/Saludame.activity/assets/sound/clothes_change.ogg new file mode 100644 index 0000000..79fbcac --- /dev/null +++ b/Saludame.activity/assets/sound/clothes_change.ogg Binary files differ diff --git a/Saludame.activity/assets/sound/menu_back.ogg b/Saludame.activity/assets/sound/menu_back.ogg new file mode 100644 index 0000000..b452699 --- /dev/null +++ b/Saludame.activity/assets/sound/menu_back.ogg Binary files differ diff --git a/Saludame.activity/assets/sound/open_bars.ogg b/Saludame.activity/assets/sound/open_bars.ogg new file mode 100644 index 0000000..1845f88 --- /dev/null +++ b/Saludame.activity/assets/sound/open_bars.ogg Binary files differ diff --git a/Saludame.activity/assets/sound/place_change.ogg b/Saludame.activity/assets/sound/place_change.ogg new file mode 100644 index 0000000..cc2dc19 --- /dev/null +++ b/Saludame.activity/assets/sound/place_change.ogg Binary files differ diff --git a/Saludame.activity/assets/sound/popup.ogg b/Saludame.activity/assets/sound/popup.ogg new file mode 100644 index 0000000..56801ac --- /dev/null +++ b/Saludame.activity/assets/sound/popup.ogg Binary files differ diff --git a/Saludame.activity/assets/sound/time_change.ogg b/Saludame.activity/assets/sound/time_change.ogg new file mode 100644 index 0000000..e4e4075 --- /dev/null +++ b/Saludame.activity/assets/sound/time_change.ogg Binary files differ diff --git a/Saludame.activity/challenges.py b/Saludame.activity/challenges.py index 85b31ef..308e1a7 100755 --- a/Saludame.activity/challenges.py +++ b/Saludame.activity/challenges.py @@ -77,8 +77,7 @@ class MultipleChoice(gui.Window): y += 30 b = gui.TextButton(self.rect, pygame.Rect((x, y), (1, 1)), 1, ans, TEXT_FONT_SIZE, ANSWER_COLOR, self._cb_button_click_choice, self._cb_button_over_choice, self._cb_button_out_choice) self.choices.append(b) - self.buttons.append(b) - self.add_child(b) + self.add_button(b) def set_image(self, image): if not isinstance(image, pygame.Surface): @@ -122,13 +121,11 @@ class MultipleChoice(gui.Window): def _cb_button_over_choice(self, button): if not FIN_MC: button.switch_color_text(MOUSE_OVER_COLOR) - button.force_update() self.s_over.play() def _cb_button_out_choice(self, button): if not FIN_MC: button.switch_color_text(ANSWER_COLOR) - button.force_update() def _cb_button_click_close(self, button): self.windows_controller.close_active_window() @@ -140,9 +137,9 @@ class MultipleChoice(gui.Window): Delete question and answers and repaint. Set FIN_MC false """ self.choices = [] - self.widgets = [self.btn_close] #, self.btn_view_answer] - self.buttons = [self.btn_close] #, self.btn_view_answer] - self.repaint = True + self.clear_childs() + self.add_button(self.btn_close) + self.set_dirty_background() self.wait = 0 global FIN_MC FIN_MC = False diff --git a/Saludame.activity/character.py b/Saludame.activity/character.py index 40f0e71..0f86f53 100755 --- a/Saludame.activity/character.py +++ b/Saludame.activity/character.py @@ -69,18 +69,6 @@ class Character: self.clothes = 'school' self.current_place = 'schoolyard' self.mappings = DEFAULT_MAPPINGS.copy() - -class Environment: - - def __init__(self, background_path, background_music): - self.background_path = background_path - self.background_music = background_music - - def get_background_path(self): - return self.background_path - - def get_background_music(self): - return self.background_music class Place: diff --git a/Saludame.activity/character_creator.py b/Saludame.activity/character_creator.py index 0fbad62..d1181e5 100755 --- a/Saludame.activity/character_creator.py +++ b/Saludame.activity/character_creator.py @@ -29,22 +29,10 @@ class CharacterLoader: def __init__(self): self.character = self.__load_character(SEX, NAME, LEVEL, SCORE, "school") - self.environments_dictionary = self.__load_environments() - self.places = self.__load_places() - self.weather_effects = self.__load_weather_effects() def get_character(self): return self.character - - def get_environments_dictionary(self): - return self.environments_dictionary - - def get_places(self): - return self.places - - def get_weather_effects(self): - return self.weather_effects - + def __load_character(self, sex, name, level, score, clothes): hair_color = [pygame.Color(color) for color in HAIR_COLOR] skin_color = [pygame.Color(color) for color in SKIN_COLOR] @@ -53,80 +41,4 @@ class CharacterLoader: char = character.Character(sex, name, level, score, hair_color, socks_color, skin_color, shoes_color, clothes) return char - - def __load_weather_effects(self): - weather_effects = { - # (clothes_id, weather_id, boolean indoor outdoor) : list of tuples [(id_bar, rate)] - #school clothes - ("school", "sunny", True) : [("fun", 1.0)], - ("school", "sunny", False) : [("physica", 1.0)], - ("school", "rainy", True) : [("physica", 1.0)], - ("school", "rainy", False) : [("physica", 1.0)], - ("school", "normal", True) : [("physica", 1.0)], - ("school", "normal", False) : [("physica", 1.0)], - ("school", "cold", True) : [("physica", 1.0)], - ("school", "cold", False) : [("physica", 1.0)], - #sunny clothes - ("sunny", "sunny", True) : [("physica", 1.0)], - ("sunny", "sunny", False) : [("physica", 1.0)], - ("sunny", "rainy", True) : [("physica", 1.0)], - ("sunny", "rainy", False) : [("physica", 1.0)], - ("sunny", "normal", True) : [("physica", 1.0)], - ("sunny", "normal", False) : [("physica", 1.0)], - ("sunny", "cold", True) : [("physica", 1.0)], - ("sunny", "cold", False) : [("physica", 1.0)], - #rainy clothes - ("rainy", "sunny", True) : [("physica", 1.0)], - ("rainy", "sunny", False) : [("physica", 1.0)], - ("rainy", "rainy", True) : [("physica", 1.0)], - ("rainy", "rainy", False) : [("physica", 1.0)], - ("rainy", "normal", True) : [("physica", 1.0)], - ("rainy", "normal", False) : [("physica", 1.0)], - ("rainy", "cold", True) : [("physica", 1.0)], - ("rainy", "cold", False) : [("physica", 1.0)], - } - return weather_effects - - def __load_places(self): - places = { #schoolyard - "schoolyard" : {"outdoor": True}, - #square - "square" : {"outdoor": True}, - #classroom - "classroom" : {"outdoor": False}, - #home - "home": {"outdoor": False}, - #country - "country": {"outdoor": True} - } - return places - - def __load_environments(self): - environments = {#schoolyard - "schoolyard_sunny" : character.Environment("assets/background/schoolyard_sunny.png", "music_path"), - "schoolyard_rainy" : character.Environment("assets/background/schoolyard_rainy.png", "music_path"), - "schoolyard_normal" : character.Environment("assets/background/schoolyard_normal.png", "music_path"), - "schoolyard_cold" : character.Environment("assets/background/schoolyard_cold.png", "music_path"), - #square - "square_sunny" : character.Environment("assets/background/square_sunny.png", "music_path"), - "square_rainy" : character.Environment("assets/background/square_rainy.png", "music_path"), - "square_normal" : character.Environment("assets/background/square_normal.png", "music_path"), - "square_cold" : character.Environment("assets/background/square_cold.png", "music_path"), - #classroom - "classroom_sunny" : character.Environment("assets/background/classroom_sunny.png", "music_path"), - "classroom_rainy" : character.Environment("assets/background/classroom_rainy.png", "music_path"), - "classroom_normal" : character.Environment("assets/background/classroom_normal.png", "music_path"), - "classroom_cold" : character.Environment("assets/background/classroom_cold.png", "music_path"), - #home - "home_sunny" : character.Environment("assets/background/home_sunny.png", "music_path"), - "home_rainy" : character.Environment("assets/background/home_rainy.png", "music_path"), - "home_normal" : character.Environment("assets/background/home_normal.png", "music_path"), - "home_cold" : character.Environment("assets/background/home_cold.png", "music_path"), - #country - "country_sunny" : character.Environment("assets/background/country_sunny.png", "music_path"), - "country_rainy" : character.Environment("assets/background/country_rainy.png", "music_path"), - "country_normal" : character.Environment("assets/background/country_normal.png", "music_path"), - "country_cold" : character.Environment("assets/background/country_cold.png", "music_path"), - } - - return environments + diff --git a/Saludame.activity/customization.py b/Saludame.activity/customization.py index 329d762..4156ccd 100755 --- a/Saludame.activity/customization.py +++ b/Saludame.activity/customization.py @@ -59,7 +59,6 @@ class CustomizationWindow(gui.Window): self.kid = CustomizatedKid(self.rect, kid_rect, 1, character) self.add_child(self.kid) - #self.btn_close = gui.TextButton(self.rect, pygame.Rect((910, 2), (30, 30)), 1, "X", 30, (0, 0, 0), self._cb_button_click_close) self.btn_close = utilities.get_accept_button(self.rect, pygame.Rect((400, 500), (1, 1)), _("Continue"), self._cb_button_click_close) button_back = pygame.image.load("customization/customization_button.png").convert() @@ -67,8 +66,7 @@ class CustomizationWindow(gui.Window): self.btn_skin = gui.TextButton2(self.rect, pygame.Rect((500, 200), (70, 30)), 1, _("Skin"), 30, (255, 255, 255), button_back, self._cb_button_skin) self.btn_socks = gui.TextButton2(self.rect, pygame.Rect((500, 280), (70, 30)), 1, _("Socks"), 30, (255, 255, 255), button_back, self._cb_button_socks) self.btn_shoes = gui.TextButton2(self.rect, pygame.Rect((500, 360), (70, 30)), 1, _("Shoes"), 30, (255, 255, 255), button_back, self._cb_button_shoes) - self.buttons += [self.btn_close, self.btn_hair, self.btn_skin, self.btn_socks, self.btn_shoes] - self.widgets += [self.btn_close, self.btn_hair, self.btn_skin, self.btn_socks, self.btn_shoes] + map(self.add_button, [self.btn_close, self.btn_hair, self.btn_skin, self.btn_socks, self.btn_shoes]) self.hair_color_index = 0 self.skin_color_index = 0 @@ -116,7 +114,7 @@ class CustomizatedKid(gui.Widget): self.character = character self.set_gender("male") # Sets the correct picture and applies color mappings - self.dirty = True + self.dirty_mappings = True # Only for the first update def set_mapping(self, key, colors): self.character.mappings[key] = tuple(colors) @@ -126,6 +124,7 @@ class CustomizatedKid(gui.Widget): self.background = self.kid.copy() maps = self.character.mappings self.change_color(animation.COLORS_TO_MAP, maps["hair"] + maps["skin"] + maps["socks"] + maps["shoes"]) + self.set_dirty() def change_color(self, old, new): index = 0 @@ -148,9 +147,9 @@ class CustomizatedKid(gui.Widget): self.set_rect_size(self.kid.get_size()) self.apply_mappings() - # Override - def draw(self, screen): - if self.dirty: - self.dirty = False + def update(self, frames): + if self.dirty_mappings: + self.dirty_mappings = False self.apply_mappings() - return gui.Widget.draw(self, screen) + self.set_dirty() + \ No newline at end of file diff --git a/Saludame.activity/game.py b/Saludame.activity/game.py index bbf0548..87fe9e8 100755 --- a/Saludame.activity/game.py +++ b/Saludame.activity/game.py @@ -48,7 +48,7 @@ class Main(): global running, pauses if from_sugar: - import gtk + import gtk import app_init import challenges_creator @@ -66,7 +66,7 @@ class Main(): pygame.init() if not from_sugar: - target_size = (1200, 800)#(1000, 650) # In regular computers the native resolution is too high (5/6) + target_size = (1000, 650) #(1200, 800) # In regular computers the native resolution is too high (5/6) screen = pygame.display.set_mode(target_size) screen = pygame.display.get_surface() diff --git a/Saludame.activity/game_manager.py b/Saludame.activity/game_manager.py index d1d325b..6bfb092 100755 --- a/Saludame.activity/game_manager.py +++ b/Saludame.activity/game_manager.py @@ -22,7 +22,7 @@ class GameManager: y los eventos del juego. """ - def __init__(self, character, bars_controller, actions_list, events_list, places_dictionary, environments_dictionary, weather_effects, moods_list, windows_controller): + def __init__(self, character, bars_controller, actions_list, events_list, places_dictionary, weathers, environments_dictionary, weather_effects, moods_list, windows_controller): """ Constructor de la clase """ @@ -50,9 +50,10 @@ class GameManager: self.active_events = [] self.active_social_events = [] self.active_mood = None - self.__check_active_mood() # sets active_mood + #self.__check_active_mood() # sets active_mood -> doesn't work because status bars aren't ready self.places_dictionary = places_dictionary + self.weathers = weathers #for events handling: self.events_interval = EVENTS_OCCURRENCE_INTERVAL @@ -72,8 +73,7 @@ class GameManager: # menu handling self.menu_active = False - #for weather - self.p_i = 0 + # weather self.weather_effects = weather_effects self.environment_effect = None # this is an Effect that represents the effect on the character by the environment: weather + place + clothes self.update_environment_effect() @@ -113,10 +113,10 @@ class GameManager: Sets the character environment and send a message to the windows_controller """ - environment_id = self.character.current_place + "_" + self.current_weather + environment_id = (self.character.current_place, self.current_weather) self.environment = self.environments_dictionary[environment_id] - self.windows_controller.set_environment(self.environment) + self.windows_controller.set_environment(self.environment, self.current_time) def update_environment_effect(self): """ @@ -134,6 +134,8 @@ class GameManager: def __handle_time(self): if not self.hour_count: + sound_manager.instance.play_time_change() + self.hour_count = HOUR_COUNT_CYCLE self.hour += 1 @@ -165,16 +167,12 @@ class GameManager: """ Returns a random weather, never returns the previous weather. """ - l = ["rainy", "sunny", "cold", "normal"] - i = random.randint(0, 3) - if i == self.p_i: - return self.get_random_weather() - else: - self.p_i = i + random_weather = self.current_weather + while random_weather == self.current_weather: + random_weather = random.choice(self.weathers) - print "se genero el clima: ", l[i] - - return l[i] + print "se genero el clima: ", random_weather + return random_weather ### location @@ -311,15 +309,15 @@ class GameManager: elif overall_bar_percent > 0.66: overall_bar_mood = 10 #set mood in happy 3 + mood = self.moods_list[overall_bar_mood] + event_preferred_moods = [event.preferred_mood for event in self.active_events] #event_preferred_moods += [event.preferred_mood for event in self.active_social_events] if event_preferred_moods: event_preferred_mood = min(event_preferred_moods) - if event_preferred_mood <= overall_bar_mood: # choose the lowest value - mood = self.moods_list[event_preferred_mood] - else: - mood = self.moods_list[overall_bar_mood] + if event_preferred_mood <= overall_bar_mood: # choose the lowest value + mood = self.moods_list[event_preferred_mood] if mood <> self.active_mood: self.active_mood = mood diff --git a/Saludame.activity/gui/utilities.py b/Saludame.activity/gui/utilities.py index 519b230..d4fcb7a 100644 --- a/Saludame.activity/gui/utilities.py +++ b/Saludame.activity/gui/utilities.py @@ -42,7 +42,8 @@ class Text(Widget): def refresh(self): background = self.get_background_rect().copy() self.background = self.font.render(self.text, False, self.color) - + self.set_dirty() + def switch_color_text(self, color): self.color = color self.refresh() @@ -73,27 +74,31 @@ class Button(Widget): self.function_on_mouse_over = cb_over self.function_on_mouse_out = cb_out - self.over = False self.enable = True - - def set_tooltip(self, text): - self.tooltip = text - def set_super_tooltip(self, text): - self.super_tooltip = text + self.set_click_sound_path("assets/sound/click.ogg") + # Override def on_mouse_click(self): + Widget.on_mouse_click(self) # Super + if self.function_on_mouse_click and self.enable: # if there's a callback setted makes the call self.function_on_mouse_click(self) - + + # Override def on_mouse_over(self): + self.over = True + self.set_dirty() if self.function_on_mouse_over and self.enable: # if there's a callback setted makes the call self.function_on_mouse_over(self) + # Override def on_mouse_out(self): + self.over = False + self.set_dirty() if self.function_on_mouse_out and self.enable: # if there's a callback setted makes the call self.function_on_mouse_out(self) - + def set_on_mouse_click(self, fn): self.function_on_mouse_click = fn @@ -101,13 +106,20 @@ class Button(Widget): self.function_on_mouse_over = fn def set_on_mouse_out(self, fn): - self.function_on_mouse_out = fn - + self.function_on_mouse_out = fn + + def draw(self, screen): + updates = Widget.draw(self, screen) + if self.visible and self.background and self.over: + copy = self.background.convert_alpha() + copy.fill((40,40,40), None, pygame.BLEND_ADD) # Makes the widget brighter + screen.blit(copy, self.rect_absolute) + return updates + class ImageButton(Button): def __init__(self, container, rect, frame_rate, image, cb_click=None, cb_over=None, cb_out=None): - self.image = image if not isinstance(image, pygame.Surface): image = pygame.image.load(image) if image.get_bitsize() == 8: @@ -115,14 +127,21 @@ class ImageButton(Button): else: self.image = image.convert_alpha() - rect.size = self.image.get_rect().size - Button.__init__(self, container, rect, frame_rate, self.image, cb_click, cb_over, cb_out) + rect.size = image.get_rect().size + Button.__init__(self, container, rect, frame_rate, image, cb_click, cb_over, cb_out) def switch_image_background(self, image): if not isinstance(image, pygame.Surface): - image = pygame.imaself.text_intro.visible = True - self.text_result.visible = Falsege.load(image).convert_alpha() + image = pygame.image.load(image).convert_alpha() + if image.get_bitsize() == 8: + image = image.convert() + else: + image = image.convert_alpha() + self.text_intro.visible = True + + self.text_result.visible = False self.background = image + self.set_dirty() class TextButton(ImageButton): def __init__(self, container, rect, frame_rate, text, size, color, cb_click=None, cb_over=None, cb_out=None): @@ -131,6 +150,7 @@ class TextButton(ImageButton): def switch_color_text(self, color): self.background = self.text.switch_color_text(color).background + self.set_dirty() class TextButton2(ImageButton): @@ -147,6 +167,7 @@ class TextButton2(ImageButton): def switch_color_text(self, color): self.color = color self.background = self.get_surface() + self.set_dirty() def get_surface(self): font = get_font(self.size) diff --git a/Saludame.activity/gui/widget.py b/Saludame.activity/gui/widget.py index 3f5b582..3f013b2 100755 --- a/Saludame.activity/gui/widget.py +++ b/Saludame.activity/gui/widget.py @@ -4,32 +4,52 @@ import pygame class Widget: - # Un widget representa cualquier cosa "pintable" + """ A widget represents anything drawable on the screen """ def __init__(self, container, rect_in_container, frame_rate, surface=None, tooltip=None): - self.container = container # Ventana (Rect) que "contiene" al widget + self.container = container # Rect, containing the widget self.set_rect_in_container(rect_in_container) self.frame_rate = frame_rate self.background = surface self.parent = None - # El widget puede (opcionalmente) tener un tooltip + # Tooltip self.tooltip = tooltip self.super_tooltip = None self.showing_tooltip = False + # Click Sound + self.click_sound_path = None + self.visible = True + + self.over = False + + # A widget it's dirty when it changes somehow, for example an animation will be dirty after every new sprite + # A widget should change in the update method (before draw) + self.dirty = True + + # When this flag it's on, the widget it's always dirty, unless the update method is overriden + self.keep_dirty = False + + def update(self, frames): + """ Abstract. This method is called before draw, the purpose is to override it to alter the widget and let + know the application that the widget became dirty, for example when an animation changes its image or its position.""" + if self.keep_dirty: + self.set_dirty() def draw(self, screen): + self.dirty = False if self.visible: if self.background: screen.blit(self.background, self.rect_absolute) return self.rect_absolute - def force_update(self): # Forzamos la actualizacion del widget independientemente del frame_rate - #screen.blit(self.background, self.rect_in_container) - #pygame.display.update(self.rect_in_container) - pass + def set_image(self, image): + self.background = image + + def get_image(self): + return self.background def set_rect_in_container(self, rect): # Rect del widget (relativo al container) @@ -44,7 +64,35 @@ class Widget: # Rect del widget (absoluto al screen) self.rect_absolute.size = size - + + def set_click_sound_path(self, path): + self.click_sound_path = path + + def set_tooltip(self, text): + self.tooltip = text + + def set_super_tooltip(self, text): + self.super_tooltip = text + + def handle_mouse_down(self, (x, y)): + self.on_mouse_click() + + def on_mouse_click(self): + if self.click_sound_path: + sound = pygame.mixer.Sound(self.click_sound_path) + sound.play() + + def on_mouse_over(self): + self.over = True + + def on_mouse_out(self): + self.over = False + + def set_dirty(self): + self.dirty = True + if self.parent: + self.parent.set_dirty() + def get_background_and_owner(self): if self.background: return (self.background, self) diff --git a/Saludame.activity/gui/window.py b/Saludame.activity/gui/window.py index b130dde..e3e10c8 100755 --- a/Saludame.activity/gui/window.py +++ b/Saludame.activity/gui/window.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- import pygame +import widget class Window: @@ -20,16 +21,23 @@ class Window: self.register_id = register_id self.windows_controller.register_new_window(register_id, self) - self.widgets = [] # Lista de widgets que contiene la ventana - self.windows = [] # Lista de ventanas que contiene la ventana - self.buttons = [] # Lista de botones que contiene la ventana + self.widgets = [] # Widgets contained in the window + self.windows = [] # SubWindows contained in the window + self.buttons = [] # Buttons contained in the window + self.childs = [] # The sum of widgets, buttons and subwindows, usefull to keep adding order self.repaint = True + self.visible = True + self.__erased = True # after hidding a window it's background should be restored, that's why we need this flag + + self.dirty_background = True # Indicates the background its dirty, so it must be redrawn and so every child. + self.dirty = True # Indicates the window has at least a dirty child + def get_register_id(self): return self.register_id - def set_bg_image(self, image): + def set_bg_image(self, image, alpha=True): if not isinstance(image, pygame.Surface): # Is a path, convert it to a surface self.bg_image = pygame.image.load(image).convert_alpha() @@ -42,47 +50,110 @@ class Window: def dispose(self): self.windows_controller.unregister_window(self) + def update(self, frames): + if self.visible: + for win in self.windows: + if frames % win.frame_rate == 0: + win.update(frames) + + for widget in self.widgets: + if frames % widget.frame_rate == 0: + widget.update(frames) + # Abstract function. def pre_draw(self, screen): return [] # Logica de pintado de cualquier ventana - def draw(self, screen, frames): + def draw(self, screen, frames, forced=False): changes = [] - changes += self.pre_draw(screen) - - if self.repaint: # Solo actualizamos el fondo de la ventana cuando hagamos un 'repaint' - # De otra forma solo actualizamos los widgets y subventanas + if self.visible: - if self.bg_image != None: - screen.blit(self.bg_image, self.rect) # Pintamos el "fondo" de la ventana - else: - if self.bg_color: - screen.fill(self.bg_color, self.rect) + if self.repaint: # repaint is old, keep it for compatibility + self.dirty_background = True + + if self.dirty_background: + forced = True + + # Restores the regions where dirty windows/widgets are + changes += self._restore_background(screen, forced) + self.repaint = self.dirty = self.dirty_background = False - changes.append(self.rect) + changes += self.pre_draw(screen) - self.repaint = False - - for win in self.windows: - if frames % win.frame_rate == 0: - changes.extend(win.draw(screen, frames)) # Le decimos a cada ventana que se pinte - - for widget in self.widgets: - if frames % widget.frame_rate == 0: - changes.append(widget.draw(screen)) # Pintamos los widgets que "contiene" la ventana + for child in self.childs: + if isinstance(child, Window): + if child.dirty or child.dirty_background or forced: + changes.extend(child.draw(screen, frames, forced)) + else: + if child.dirty or forced: + changes.append(child.draw(screen)) + + if forced: + changes = [self.rect] # When the whole window was forced, the changes are the whole window + + return changes + + def _restore_background(self, screen, forced): + """ Restores the background in the dirty regions""" + changes = [] + if self.bg_image: + if forced: + screen.blit(self.bg_image, self.rect.topleft) + else: + for win in self.windows: + + if win.bg_image: + # No need to restore the screen, the subwindow will be redrawn over it + pass + + elif win.visible and (win.dirty or win.dirty_background): + relative_rect = win.rect.move([-coord for coord in self.rect.topleft]) + screen.blit(self.bg_image, win.rect.topleft, relative_rect) + + elif not win.visible and not win.__erased: + win.__erased = True + relative_rect = win.rect.move([-coord for coord in self.rect.topleft]) + screen.blit(self.bg_image, win.rect.topleft, relative_rect) + changes.append(win.rect) + + for widget in self.widgets: + if widget.dirty: + screen.blit(self.bg_image, widget.rect_absolute.topleft, widget.rect_in_container) return changes + + def set_dirty(self): + self.dirty = True + if self.parent and not self.parent.dirty: + self.parent.set_dirty() + + def set_dirty_background(self): + self.dirty_background = True + if self.parent and not self.parent.dirty: + self.parent.set_dirty() + def hide(self): + if self.visible: + self.visible = False + self.__erased = False + self.set_dirty_background() + + def show(self): + self.visible = True + def add_child(self, widget): self.widgets.append(widget) + self.childs.append(widget) widget.parent = self def remove_child(self, widget): if widget in self.widgets: self.widgets.remove(widget) + self.childs.remove(widget) + self.set_dirty_background() def add_button(self, button): self.add_child(button) @@ -94,64 +165,83 @@ class Window: self.buttons.remove(button) self.remove_child(button) button.parent = None + self.set_dirty_background() + def clear_childs(self): + for widget in self.widgets: + widget.parent = None + self.childs.remove(widget) + self.buttons = [] + self.widgets = [] + self.set_dirty_background() + def add_window(self, window): self.windows.append(window) + self.childs.append(window) window.parent = self def remove_window(self, window): self.windows.remove(window) - + self.childs.remove(window) + self.set_dirty_background() + def enable_repaint(self): self.repaint = True for win in self.windows: win.enable_repaint() - def handle_mouse_down(self, (x, y)): - for button in self.buttons: - if button.contains_point(x, y): - # Tooltips - if button.showing_tooltip: - self.windows_controller.hide_active_tooltip() - button.showing_tooltip = False - button.on_mouse_click() - return # No seguimos buscando el botón + def is_transparent(self): + return (self.bg_image or self.bg_color) - for win in self.windows: - if win.rect.collidepoint(x, y): - win.handle_mouse_down((x, y)) + def contains_point(self, x, y): + return self.rect.collidepoint(x,y) + def handle_mouse_down(self, (x, y)): + stop = False + + for child in reversed(self.childs): + + if child.contains_point(x, y): + if isinstance(child, widget.Widget): + # Tooltips + if child.showing_tooltip: + self.windows_controller.hide_active_tooltip() + child.showing_tooltip = False + stop = child.handle_mouse_down((x, y)) + if stop: + break + + return stop + def handle_mouse_over(self, (x, y)): - buttons = [] - buttons += self.buttons for win in self.windows: - buttons += win.buttons - - for button in buttons: - if button.contains_point(x, y): - if not button.over: + if win.rect.collidepoint(x, y): + win.handle_mouse_over((x,y)) + + for widget in self.widgets: + if widget.contains_point(x, y): + if not widget.over: # Tooltips - if button.tooltip: # Si el boton tiene tooltip entonces lo mostramos + if widget.tooltip: # Si el boton tiene tooltip entonces lo mostramos self.windows_controller.hide_active_tooltip() - self.windows_controller.show_tooltip(button.tooltip) - button.showing_tooltip = True - if button.super_tooltip: + self.windows_controller.show_tooltip(widget.tooltip) + widget.showing_tooltip = True + if widget.super_tooltip: self.windows_controller.hide_active_tooltip() - self.windows_controller.show_super_tooltip(button.super_tooltip) - button.showing_tooltip = True - button.on_mouse_over() - button.over = True + self.windows_controller.show_super_tooltip(widget.super_tooltip) + widget.showing_tooltip = True + widget.on_mouse_over() return # No seguimos buscando el botón else: # Ineficiente! Por ahora lo dejo asi para PROBAR # Esta todo el tiempo haciendo esto! Cambiar - if button.showing_tooltip: + if widget.showing_tooltip: # Si estabamos mostrando el tooltip ahora debemos esconderlo self.windows_controller.hide_active_tooltip() - button.showing_tooltip = False - button.over = False - button.on_mouse_out() + widget.showing_tooltip = False + if widget.over: + widget.on_mouse_out() # It will be overridden by cooking challenge or other D&D challenge def handle_mouse_motion(self, (x, y)): diff --git a/Saludame.activity/gui/windows_controller.py b/Saludame.activity/gui/windows_controller.py index fb05aa4..eca558a 100755 --- a/Saludame.activity/gui/windows_controller.py +++ b/Saludame.activity/gui/windows_controller.py @@ -130,6 +130,8 @@ class WindowsController: pygame.display.flip() # Actualizamos el screen para hacer visibles los efectos self.reload_main = False + self.windows_stack[-1].update(frames) + changes = [] if frames % self.windows_stack[-1].frame_rate == 0: changes.extend(self.windows_stack[-1].draw(self.screen, frames)) diff --git a/Saludame.activity/kid_window.py b/Saludame.activity/kid_window.py index 578d187..fe6a6ed 100644 --- a/Saludame.activity/kid_window.py +++ b/Saludame.activity/kid_window.py @@ -19,10 +19,8 @@ class KidWindow(gui.Window): self.mood = "normal" self.kid = animation.Kid(rect, self.kid_rect, 1, windows_controller, game_man, self.mood) + self.add_child(self.kid) - self.add_window(self.kid) - self.kid.set_bg_image(self.bg_image.subsurface(self.kid_rect)) - self.balloon = None ### Events ### @@ -38,10 +36,15 @@ class KidWindow(gui.Window): self.last_repaint = False ##### Environment ##### - def set_environment(self, environment): - self.set_bg_image(pygame.image.load(environment.background_path).convert()) - self.kid.set_bg_image(self.bg_image.subsurface(self.kid_rect)) - self.repaint = True + def set_environment(self, environment, time): + image = pygame.image.load(environment.background_path).convert(24) + if time == "night": + _filter = pygame.Surface(image.get_size()) + _filter.fill((30, 30, 100)) + _filter.set_alpha(50) + image.blit(_filter, (0,0)) + self.set_bg_image(image.convert()) + self.set_dirty_background() ##### Clothes ##### def update_clothes(self): @@ -64,7 +67,7 @@ class KidWindow(gui.Window): ##### Events ##### def add_social_event(self, event): self.social_event = event - self.external_character = ExternalCharacter(self.rect, pygame.Rect(700, 170, 1, 1), 1, self.windows_controller, event) + self.external_character = ExternalCharacter(self.rect, (30, 609), 1, self.windows_controller, event) self.add_window(self.external_character) def remove_social_event(self): @@ -72,33 +75,24 @@ class KidWindow(gui.Window): if self.external_character: self.remove_window(self.external_character) self.external_character = None + self.set_dirty_background() ##### Kid ballon ##### def show_kid_balloon(self, message, time_span): - self.balloon = MessageBalloon(self.rect, pygame.Rect(80, 80, 1, 1), 1, self.windows_controller) + self.balloon = MessageBalloon(self.rect, pygame.Rect(580, 80, 1, 1), 1, self.windows_controller, 'A') self.balloon.set_text(message) self.balloon.set_time_span(time_span) self.add_window(self.balloon) def remove_kid_balloon(self): - self.windows.remove(self.balloon) + if self.balloon: + self.remove_window(self.balloon) self.balloon = None - def draw(self, screen, frames): + def update(self, frames): - changes = [] - - if self.last_repaint: - self.repaint = True - self.last_repaint = False - - # If the menu is showing repaint the whole window - if self.menu.show: - self.last_repaint = True - self.repaint = True + gui.Window.update(self, frames) - changes += gui.Window.draw(self, screen, frames) - if self.balloon: if not self.balloon.visible: self.remove_kid_balloon() @@ -106,59 +100,58 @@ class KidWindow(gui.Window): if self.external_character: if not self.external_character.visible: self.remove_social_event() - - return changes - + + class ExternalCharacter(gui.Window): - def __init__(self, container, rect, frame_rate, windows_controller, event): - - self.character = pygame.image.load(event.person_path).convert() - rect.size = self.character.get_size() + + def __init__(self, container, left_bottom, frame_rate, windows_controller, event): + + rect = pygame.Rect((0,0), (300, 559)) + rect.bottomleft = left_bottom gui.Window.__init__(self, container, rect, frame_rate, windows_controller, "external_character") - self.set_bg_image(self.character) - - self.visible = True self.time_span = event.message_time_span + + character = gui.Image(self.rect, pygame.Rect((13, 179), (273, 380)), 1, event.person_path) + character.keep_dirty = True + self.add_child(character) - self.message_balloon = MessageBalloon(self.container, pygame.Rect(580, 80, 1, 1), 1, self.windows_controller) - self.message_balloon.set_text(event.person_message) - self.message_balloon.set_time_span(self.time_span) # same time_span as character - - self.bg1 = (self.windows_controller.screen.subsurface(self.rect).copy()) - self.bg2 = (self.windows_controller.screen.subsurface(self.message_balloon.rect).copy()) - + message_balloon = MessageBalloon(self.rect, pygame.Rect(0, 0, 1, 1), 1, self.windows_controller, 'B') + message_balloon.set_text(event.person_message) + self.add_window(message_balloon) + # Override handle_mouse_down def handle_mouse_down(self, (x, y)): - self.visible = False + self.hide() + return True - def draw(self, screen, frames): - if not self.time_span: - self.visible = False - if self.visible: - changes = [] - self.time_span -= 1 - self.repaint = True - changes += gui.Window.draw(self, screen, frames) - changes += self.message_balloon.draw(screen, frames) - return changes - else: - screen.blit(self.bg1, self.rect) - screen.blit(self.bg2, self.message_balloon.rect) + def update(self, frames): + self.time_span -= 1 + if self.time_span == 0: + self.hide() self.dispose() - return [self.rect, self.message_balloon.rect] + if self.visible: + # This shouldn't be neccesary but it's not working without it. + self.set_dirty_background() # Always draws it because it collides with the character rectangle + class MessageBalloon(gui.Window): - def __init__(self, container, rect, frame_rate, windows_controller): + def __init__(self, container, rect, frame_rate, windows_controller, b_type): - background = pygame.image.load("assets/events/balloon.png").convert() - rect.size = background.get_size() + self.b_type = b_type - gui.Window.__init__(self, container, rect, frame_rate, windows_controller, "balloon") + if b_type == 'A': + # Thinking balloon + background = pygame.image.load("assets/events/balloon.png").convert() + else: + # Saying balloon + background = pygame.image.load("assets/events/balloonB.png").convert() + + rect.size = background.get_size() - self.bg = (self.windows_controller.screen.subsurface(self.rect).copy()) + gui.Window.__init__(self, container, rect, frame_rate, windows_controller, "balloon") self.set_bg_image(background) self.text = None @@ -168,23 +161,25 @@ class MessageBalloon(gui.Window): # Override handle_mouse_down def handle_mouse_down(self, (x, y)): - self.visible = False + self.hide() + return True def set_text(self, text): - self.text = gui.TextBlock(self.rect, 35, 40, 1, text, 18, pygame.Color("black")) + if self.b_type == 'A': + self.text = gui.TextBlock(self.rect, 135, 40, 1, text, 18, pygame.Color("black")) + else: + self.text = gui.TextBlock(self.rect, 40, 40, 1, text, 18, pygame.Color("black")) + self.text.keep_dirty = True self.add_child(self.text) def set_time_span(self, time_span): self.time_span = time_span - def draw(self, screen, frames): - if not self.time_span: - self.visible = False - if self.visible: - self.time_span -= 1 - self.repaint = True - return gui.Window.draw(self, screen, frames) - else: - screen.blit(self.bg, self.rect) + def update(self, frames): + if self.time_span == 0: + self.hide() self.dispose() - return [self.rect] + + if self.visible: + self.set_dirty_background() # Always draws it because it collides with the character rectangle + \ No newline at end of file diff --git a/Saludame.activity/locale/es/LC_MESSAGES/org.ceibaljam.Saludame.mo b/Saludame.activity/locale/es/LC_MESSAGES/org.ceibaljam.Saludame.mo index 6e4dacc..23c2c9d 100644 --- a/Saludame.activity/locale/es/LC_MESSAGES/org.ceibaljam.Saludame.mo +++ b/Saludame.activity/locale/es/LC_MESSAGES/org.ceibaljam.Saludame.mo Binary files differ diff --git a/Saludame.activity/main_window.py b/Saludame.activity/main_window.py index 1224789..09b90d9 100755 --- a/Saludame.activity/main_window.py +++ b/Saludame.activity/main_window.py @@ -21,37 +21,42 @@ class MainWindow(gui.Window): self.game_manager = game_man self.windows = [] # Lista de ventanas que 'componen' la ventana principal - + self.panel_win = PanelWindow(container, pygame.Rect((180, 609), (1015, 200)), 1, windows_controller) - self.windows.append(self.panel_win) + self.add_window(self.panel_win) self.kidW = KidWindow(container, pygame.Rect((227, 0), (973, 609)), 1, windows_controller, game_man) - self.windows.append(self.kidW) + self.add_window(self.kidW) - self.windows.append(animation.FPS(container, pygame.Rect((1150, 0), (50, 20)), 15, self.clock)) - self.windows.append(status_bars.BarsWindow(container, pygame.Rect(0, 0, 227, 590), 5, windows_controller, bars_loader)) + self.add_child(animation.FPS(container, pygame.Rect((1150, 0), (50, 20)), 15, self.clock)) + self.add_window(status_bars.BarsWindow(container, pygame.Rect(0, 0, 227, 590), 5, windows_controller, bars_loader)) self.add_child(Clock(container, pygame.Rect(0, 528, 1, 1), 1, game_man)) # Challenges challenges_button = gui.ImageButton(self.rect, pygame.Rect((1120, 400), (60, 60)), 1, "challenges/trophy.png", self._cb_button_click_mc_challenges) challenges_button.set_tooltip(_("Multiple choice")) + challenges_button.keep_dirty = True self.add_button(challenges_button) challenges_button2 = gui.ImageButton(self.rect, pygame.Rect((1120, 500), (60, 60)), 1, "challenges/trophy.png", self._cb_button_click_tf_challenges) challenges_button2.set_tooltip(_("True or false")) + challenges_button2.keep_dirty = True self.add_button(challenges_button2) challenges_button3 = gui.ImageButton(self.rect, pygame.Rect((1120, 300), (60, 60)), 1, "challenges/trophy.png", self._cb_button_click_master_challenge) challenges_button3.set_tooltip(_("Master challenge")) + challenges_button3.keep_dirty = True self.add_button(challenges_button3) challenges_button4 = gui.ImageButton(self.rect, pygame.Rect((1120, 200), (60, 60)), 1, "challenges/trophy.png", self._cb_button_click_cooking_challenge) challenges_button4.set_tooltip(_("Cooking")) + challenges_button4.keep_dirty = True self.add_button(challenges_button4) button_back = pygame.image.load("customization/customization_button.png").convert() btn_reset = gui.TextButton2(self.rect, pygame.Rect((1000, 20), (70, 30)), 1, _("Reset"), 30, (255, 255, 255), button_back, self._cb_reset_game) + btn_reset.keep_dirty = True self.add_button(btn_reset) #btn_change_mood = gui.ImageButton(self.rect, pygame.Rect((1120, 500), (60, 60)), 1, "assets/icons/change.png", self._cb_button_click_change_mood) @@ -108,17 +113,15 @@ class Clock(gui.Widget): self.set_frame() def set_frame(self): - self.frame = pygame.image.load(self.frame_paths[self.frame_index]).convert() - - def draw(self, screen): - change = gui.Widget.draw(self, screen) + image = pygame.image.load(self.frame_paths[self.frame_index]).convert() + rect = pygame.Rect((0,0), image.get_size()) + rect.center = self.rect_absolute.width/2, self.rect_absolute.height/2 + self.background.blit(image, rect) + def update(self, frames): if self.game_manager.hour <> self.frame_index: self.frame_index = self.game_manager.hour self.set_frame() - - rect = pygame.Rect((0, 0), self.frame.get_size()) - rect.center = self.rect_absolute.center - screen.blit(self.frame, rect) - - return change + + self.set_dirty() # Always dirty because it draws over the panel_window + \ No newline at end of file diff --git a/Saludame.activity/menu.py b/Saludame.activity/menu.py index 2b14895..1e7025b 100755 --- a/Saludame.activity/menu.py +++ b/Saludame.activity/menu.py @@ -15,13 +15,14 @@ import effects import random from gettext import gettext as _ -SIZE = 600, 280 +SIZE = 700, 300 EXP_SPEED = 15.0 #expansion speed, in pixels per frame MAX_ITEMS = 8 #max items quantity per selection RADIUS = 90.0 #fonts -LARGE_TEXT = 10 #fewer mean small text +LARGE_TEXT = 10 # larger than this will use large button + #buttons SMALL_BUTTON = "assets/menu/A.png" LARGE_BUTTON = "assets/menu/B.png" @@ -37,8 +38,8 @@ class Menu(gui.Window): rect = pygame.Rect((0, 0), SIZE) rect.center = center - self.windows_controller = windows_controller self.game_manager = game_manager + gui.Window.__init__(self, container, rect, frame_rate, windows_controller, "menu_window") self.depth = 0 #it means we are in the root of the menu, mayor values means we are not. @@ -60,7 +61,7 @@ class Menu(gui.Window): self.current_selection = self.item_list #list of current subitems selection self.radius = RADIUS - self.show = False + self.hide() self.on_expansion = False self.calculate() @@ -73,28 +74,16 @@ class Menu(gui.Window): self.item_list = items_list - def pre_draw(self, screen): - changes = [] - if self.show: - if self.on_expansion: - if self.radius < 90: - self.radius += EXP_SPEED - self.__calculate_items_position(self.current_selection) - else: - self.on_expansion = False - - for item in self.current_selection: - item.draw_item(screen) - changes.append(item.rect_absolute) - - if self.depth == 0: - self.exit.draw_item(screen) - changes.append(self.exit.rect_absolute) + def update(self, frames): + if self.visible and self.on_expansion: + if self.radius < 90: + self.radius += EXP_SPEED + self.__calculate_items_position(self.current_selection) else: - self.back.draw_item(screen) - changes.append(self.back.rect_absolute) + self.on_expansion = False - return changes + if self.visible: + self.set_dirty_background() # Sets the background as dirty, cause the menú is animated def send_action(self, action_id): """ @@ -122,6 +111,15 @@ class Menu(gui.Window): # self.on_expansion = True #if the selection changes, display the animation self.radius = 0 + + self.clear_childs() + map(self.add_button, self.current_selection) + + if self.depth == 0: + self.add_button(self.exit) + else: + self.add_button(self.back) + def get_allowed_items(self, items_list): """ @@ -214,10 +212,11 @@ class Menu(gui.Window): """ Close the Menu Window """ - self.show = False + self.hide() self.depth = 0 self.previous_items = [] self.current_selection = [] + self.clear_childs() self.game_manager.menu_active = False def back_to_previous_selection(self): @@ -240,7 +239,7 @@ class Menu(gui.Window): #handlers def handle_mouse_down(self, coord): - if self.show and not self.on_expansion: + if self.visible and not self.on_expansion: if self.exit.rect_absolute.collidepoint(coord) and self.depth == 0: self.close() elif self.exit.rect_absolute.collidepoint(coord) and self.depth > 0: #click on back item, it's in the same position of exit item @@ -253,7 +252,7 @@ class Menu(gui.Window): else: self.set_current_selection(self.item_list) - self.show = True + self.show() self.game_manager.menu_active = True #privates @@ -302,7 +301,7 @@ class Menu(gui.Window): item.set_rect_in_container(rect) # Recalculates the absolute coordinates -class Item(gui.Widget): +class Item(gui.Button): """ Entity that represent an item """ @@ -332,11 +331,11 @@ class Item(gui.Widget): self.help_image = pygame.image.load(HELP_BUTTON).convert() self.help_rect = self.help_image.get_rect() - size_and_surface = self.get_surface(20, self.name, self.bg_image, self.help_image) + size, surface = self.get_surface(20, self.name, self.bg_image, self.help_image) - self.rect = pygame.Rect((0, 0), size_and_surface[0]) + self.rect = pygame.Rect((0, 0), size) - gui.Widget.__init__(self, container, self.rect, frame_rate, size_and_surface[1]) + gui.Button.__init__(self, container, self.rect, frame_rate, surface) def get_surface(self, font_size, text, bg_image, help_image): font = utilities.get_font(font_size) @@ -360,19 +359,6 @@ class Item(gui.Widget): """ self.subitems_list.append(item) - - def draw_item(self, screen): - """ - draw the item in the screen - """ - screen.blit(self.background, self.rect_absolute) - - def on_mouse_over(self): - return - - def on_mouse_out(self): - return - def on_mouse_click(self): """ Handle mouse click diff --git a/Saludame.activity/panel_window.py b/Saludame.activity/panel_window.py index 8686099..fe0a314 100644 --- a/Saludame.activity/panel_window.py +++ b/Saludame.activity/panel_window.py @@ -24,7 +24,7 @@ class PanelWindow(gui.Window): self.timing = 1 # la idea de timing es llevar una cuenta adentro, de los frames que fueron pasando gui.Window.__init__(self, container, rect, frame_rate, windows_controller, "panel_window") - self.set_bg_image(PANEL_BG_PATH) + self.set_bg_image(PANEL_BG_PATH, False) # Actions self.rect_action = pygame.Rect((560, 36), (310, 124)) @@ -79,18 +79,31 @@ class PanelWindow(gui.Window): self.add_button(info_button) # Environment - self.weather_button = None + self.weather_widget = None self.set_weather() def set_weather(self): - if self.weather_button: - self.buttons.remove(self.weather_button) - self.widgets.remove(self.weather_button) + if self.weather_widget: + self.remove_child(self.weather_widget) weather = self.windows_controller.game_man.current_weather file_path = "assets/events/weather/" + weather + ".png" - self.weather_button = gui.ImageButton(self.rect, pygame.Rect(51, 34, 1, 1), 1, file_path) - self.add_button(self.weather_button) + self.weather_widget = gui.Image(self.rect, pygame.Rect(51, 34, 1, 1), 1, file_path) + self.add_child(self.weather_widget) + self.weather_widget.set_dirty() + + info = "%s \n" % (weather) + + effect = self.windows_controller.game_man.environment_effect + if effect: + for eff in effect.effect_status_list: + bar_label = effect.bars_controller.get_bar_label(eff[0]) + if eff[1] > 0: + info += "+ %s \n" % (bar_label) + else: + info += "- %s \n" % (bar_label) + + self.weather_widget.set_super_tooltip(info) # Actions def set_active_action(self, action): @@ -144,6 +157,7 @@ class PanelWindow(gui.Window): self.remove_button(self.b_event_personal) self.b_event_personal = b_event_personal self.add_button(self.b_event_personal) + self.b_event_personal.set_dirty() self.index_personal_event = len(self.active_personal_events) - 1 self.refresh_count_personal_events() @@ -189,6 +203,7 @@ class PanelWindow(gui.Window): self.remove_button(self.b_event_social) self.b_event_social = b_event_social self.add_button(self.b_event_social) + self.b_event_social.set_dirty() self.index_social_event = len(self.active_social_events) - 1 self.refresh_count_social_events() @@ -230,25 +245,17 @@ class PanelWindow(gui.Window): self.count_social_events.text = "0/0" self.count_social_events.refresh() - def pre_draw(self, screen): - + def update(self, frames): + self.timing += 1 # Actions if self.on_animation and self.current_animation and self.timing % self.current_animation.frame_rate == 0: if self.timing > 12: self.timing = 0 - - # Events - self.surf_personal.fill(WHITE) - self.surf_social.fill(WHITE) - - # Blit the personal and social surfaces with screen - screen.blit(self.surf_personal, self.rect_personal) - screen.blit(self.surf_social, self.rect_social) - - return [self.rect] + gui.Window.update(self, frames) + # Buttons Callbacks def _cb_button_click_personal(self, button): if game.set_library_function: @@ -307,8 +314,8 @@ class ActionProgressBar(gui.Widget): gui.Widget.__init__(self, container, rect_in_container, frame_rate) - self.background = surface # Borders of the bar - self.surface = surface.copy() # Actual surface to blit in the screen, _prepare_surface + self.borders = surface # Borders of the bar + self.background = surface.copy() # Actual surface to blit in the screen, _prepare_surface self.decrease = action.time_span self._prepare_surface() @@ -318,17 +325,16 @@ class ActionProgressBar(gui.Widget): charged_rect.width = ((float)(self.decrease) / self.action.time_span) * rect.width - self.surface.fill(BAR_BACK_COLOR, rect) - self.surface.fill(BAR_FILL_COLOR, charged_rect) - self.surface.blit(self.background, (0, 0)) # Background blits over the charge, because it has the propper alpha + self.background.fill(BAR_BACK_COLOR, rect) + self.background.fill(BAR_FILL_COLOR, charged_rect) + self.background.blit(self.borders, (0, 0)) # Background blits over the charge, because it has the propper alpha self.decrease = self.action.time_left - - def draw(self, screen): + self.set_dirty() + + def update(self, frames): """ - Draw the progress bar (if the action is still active), override widget draw + Updates the progress bar (if the action is still active) """ if self.decrease > 0: self._prepare_surface() - screen.blit(self.surface, self.rect_absolute) - return self.rect_absolute diff --git a/Saludame.activity/po/Saludame.pot b/Saludame.activity/po/Saludame.pot index 59a206c..1baeb3a 100644 --- a/Saludame.activity/po/Saludame.pot +++ b/Saludame.activity/po/Saludame.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-12-17 19:17-0200\n" +"POT-Creation-Date: 2011-01-22 18:20-0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -52,370 +52,378 @@ msgstr "" msgid "Control médico" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:11 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:12 msgid "Eat..." msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:13 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:14 msgid "Comidas completas..." msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:15 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:16 msgid "Stew" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:16 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:17 msgid "Currasco" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:18 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:19 msgid "Milanesa" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:19 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:20 msgid "Torta frita" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:20 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:21 msgid "Ensalada" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:21 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:22 msgid "Pascualina" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:26 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:27 msgid "Fruta..." msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:28 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:29 msgid "Manzana" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:29 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:30 msgid "Naranja" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:30 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:31 msgid "Banana" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:31 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:32 msgid "Kiwi" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:35 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:36 msgid "Desayuno y merienda..." msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:37 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:38 msgid "Tostadas con membrillo" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:38 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:39 msgid "Queso" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:39 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:40 msgid "Galletitas saladas" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:40 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:41 msgid "Galletitas dulces" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:41 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:42 msgid "Galletitas con dulce de leche" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:42 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:43 msgid "Leche chocolatada" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:43 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:44 msgid "Café con leche" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:44 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:45 msgid "Leche" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:45 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:46 msgid "Leche con cereales" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:48 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:50 msgid "Líquidos..." msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:50 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:52 #: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:35 msgid "Agua" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:51 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:53 msgid "Limonada" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:52 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:54 msgid "Jugo de naranja" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:53 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:55 msgid "Jugo de peras" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:54 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:56 msgid "Jugo de zanahorias" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:60 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:62 msgid "Deportes..." msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:61 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:63 msgid "Run" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:62 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:64 msgid "Jump the rope" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:63 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:65 msgid "Play footbal" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:64 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:66 msgid "Hide and Seek" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:67 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:69 msgid "Tiempo libre..." msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:68 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:70 msgid "Go to sleep" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:69 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:71 msgid "Talk with a friend" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:70 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:72 msgid "Do homework" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:71 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:73 msgid "Clean up the bedroom" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:74 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:76 msgid "Ir a..." msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:75 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:77 msgid "Schoolyard" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:76 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:78 msgid "Country" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:77 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:79 msgid "Classroom" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:78 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:80 msgid "Square" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:79 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:81 msgid "Home..." msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:80 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:82 msgid "Living room" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:81 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:83 msgid "Bedroom" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:82 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:84 msgid "Kitchen" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:86 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:88 msgid "Cambiar de ropa" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:87 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:89 msgid "School" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:88 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:90 msgid "Sunny" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:89 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:91 msgid "Rainy" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:92 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:94 msgid "Higiene..." msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:93 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:95 msgid "Bañarse" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:94 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:96 msgid "Lavarse los dientes" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:95 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:97 msgid "Lavarse las manos" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:96 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:98 msgid "Ir al baño" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/challenges.py:243 +#: /home/pmoleri/saludame/Saludame.activity/challenges.py:272 #: /home/pmoleri/saludame/Saludame.activity/customization.py:63 msgid "Continue" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/main_window.py:39 +#: /home/pmoleri/saludame/Saludame.activity/main_window.py:38 msgid "Multiple choice" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/main_window.py:43 +#: /home/pmoleri/saludame/Saludame.activity/main_window.py:42 msgid "True or false" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/main_window.py:47 +#: /home/pmoleri/saludame/Saludame.activity/main_window.py:46 +msgid "Master challenge" +msgstr "" + +#: /home/pmoleri/saludame/Saludame.activity/main_window.py:50 +msgid "Cooking" +msgstr "" + +#: /home/pmoleri/saludame/Saludame.activity/main_window.py:54 msgid "Reset" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:40 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:41 msgid "Which foods do we need to eat every day?" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:40 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:41 msgid "Some food from each group every day" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:40 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:41 msgid "Some fruits and vegetables only" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:40 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:41 msgid "Some food from all the groups but not fats and sugar" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:41 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:42 msgid "What is the most important meal of the day?" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:41 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:42 msgid "Breakfast" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:41 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:42 msgid "Lunch" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:41 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:42 msgid "Tea" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:41 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:42 msgid "Dinner" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:42 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:43 msgid "How regularly should children exercise?" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:42 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:43 msgid "Once a month" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:42 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:43 msgid "Once a week" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:42 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:43 msgid "Once a day" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:43 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:44 msgid "What percentage of the body is made up of water?" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:49 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:50 msgid "" "La alimentación adecuada previene muchas enfermedades \n" "importantes" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:50 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:51 msgid "" "Si no nos vacunamos con las vacunas obligatorias podemos \n" "enfermarnos" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:51 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:52 msgid "" "Cuando estamos ingiriendo alimentos en menor proporción \n" "a lo que necesitamos, podemos volvernos más \n" "susceptibles a las infecciones " msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:54 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:55 msgid "" "Muchos alimentos pueden estar contaminados con agroquímicos, \n" "y pesticidas porque son frecuentemente usados" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:55 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:56 msgid "Si no voy a comer no necesito lavarme las manos " msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:56 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:57 msgid "" "Lo primero que hay que hay que hacer cuando vamos a lavarnos \n" "las manos es ponernos jabón" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:59 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:60 msgid "" "Cuando aprendemos hábitos saludables estamos cuidando nuestra \n" "salud" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:60 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:61 msgid "" "Tomar mucha agua, hacer ejercicio y comer frutas y verduras \n" "ayuda a mover el intestino sin dificultad" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:61 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:62 msgid "El desayuno no es importante en nuestra alimentación" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:64 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:65 msgid "La actividad física mejora nuestra imagen" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:65 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:66 msgid "" "La actividad física no nos ayuda prevenir enfermedades \n" "como el sobrepeso y la obesidad " msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:66 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:67 msgid "" "Ser sedentarios no tiene importancia y no afecta nuestra \n" "salud" @@ -453,7 +461,7 @@ msgstr "" msgid "Next >" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/panel_window.py:76 +#: /home/pmoleri/saludame/Saludame.activity/panel_window.py:74 msgid "Customization module" msgstr "" @@ -485,31 +493,31 @@ msgstr "" msgid "Credits" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/content_window.py:118 +#: /home/pmoleri/saludame/Saludame.activity/content_window.py:116 msgid "Library" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/status_bars.py:58 +#: /home/pmoleri/saludame/Saludame.activity/status_bars.py:59 msgid "TOTAL" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/status_bars.py:61 +#: /home/pmoleri/saludame/Saludame.activity/status_bars.py:62 msgid "ESTADO FÍSICO" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/status_bars.py:64 +#: /home/pmoleri/saludame/Saludame.activity/status_bars.py:65 msgid "HIGIENE" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/status_bars.py:67 +#: /home/pmoleri/saludame/Saludame.activity/status_bars.py:68 msgid "ALIMENTACIÓN" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/status_bars.py:70 +#: /home/pmoleri/saludame/Saludame.activity/status_bars.py:71 msgid "TIEMPO LIBRE" msgstr "" -#: /home/pmoleri/saludame/Saludame.activity/status_bars.py:349 +#: /home/pmoleri/saludame/Saludame.activity/status_bars.py:352 msgid "LEVEL" msgstr "" @@ -596,3 +604,11 @@ msgstr "" #: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:42 msgid "Tiempo Libre" msgstr "" + +#: /home/pmoleri/saludame/Saludame.activity/menu.py:53 +msgid "exit" +msgstr "" + +#: /home/pmoleri/saludame/Saludame.activity/menu.py:57 +msgid "back" +msgstr "" diff --git a/Saludame.activity/po/es.po b/Saludame.activity/po/es.po index c270bf5..a3f1df2 100755 --- a/Saludame.activity/po/es.po +++ b/Saludame.activity/po/es.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-12-07 18:49-0200\n" +"POT-Creation-Date: 2011-01-22 18:20-0200\n" "PO-Revision-Date: 2010-11-07 20:45-0200\n" "Last-Translator: Pablo Moleri \n" "Language-Team: Spanish\n" @@ -53,291 +53,383 @@ msgstr "Estudiar" msgid "Control médico" msgstr "Control médico" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:11 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:12 msgid "Eat..." msgstr "Comer..." -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:13 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:14 msgid "Comidas completas..." msgstr "Comidas completas..." -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:15 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:16 msgid "Stew" msgstr "Guiso" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:16 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:17 msgid "Currasco" msgstr "Churrasco" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:18 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:19 msgid "Milanesa" msgstr "Milanesa" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:19 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:20 msgid "Torta frita" msgstr "Torta frita" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:20 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:21 msgid "Ensalada" msgstr "Ensalada" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:21 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:22 msgid "Pascualina" msgstr "Pascualina" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:26 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:27 msgid "Fruta..." msgstr "Fruta..." -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:28 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:29 msgid "Manzana" msgstr "Manzana" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:29 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:30 msgid "Naranja" msgstr "Naranja" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:30 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:31 msgid "Banana" msgstr "Banana" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:31 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:32 msgid "Kiwi" msgstr "Kiwi" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:35 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:36 msgid "Desayuno y merienda..." msgstr "Desayuno y merienda..." -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:37 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:38 msgid "Tostadas con membrillo" msgstr "Tostadas con membrillo" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:38 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:39 msgid "Queso" msgstr "Queso" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:39 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:40 msgid "Galletitas saladas" msgstr "Galletitas saladas" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:40 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:41 msgid "Galletitas dulces" msgstr "Galletitas dulces" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:41 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:42 msgid "Galletitas con dulce de leche" msgstr "Galletitas con dulce de leche" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:42 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:43 msgid "Leche chocolatada" msgstr "Leche chocolatada" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:43 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:44 msgid "Café con leche" msgstr "Café con leche" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:44 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:45 msgid "Leche" msgstr "Leche" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:45 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:46 msgid "Leche con cereales" msgstr "Leche con cereales" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:49 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:50 msgid "Líquidos..." msgstr "Líquidos..." -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:51 -#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:33 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:52 +#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:35 msgid "Agua" msgstr "Agua" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:52 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:53 msgid "Limonada" msgstr "Limonada" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:53 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:54 msgid "Jugo de naranja" msgstr "Jugo de naranja" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:54 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:55 msgid "Jugo de peras" msgstr "Jugo de peras" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:55 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:56 msgid "Jugo de zanahorias" msgstr "Jugo de zanahorias" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:61 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:62 msgid "Deportes..." msgstr "Deportes..." -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:62 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:63 msgid "Run" msgstr "Correr" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:63 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:64 msgid "Jump the rope" msgstr "Saltar la cuerda" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:64 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:65 msgid "Play footbal" msgstr "Jugar al fútbol" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:65 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:66 msgid "Hide and Seek" msgstr "Escondidas" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:68 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:69 msgid "Tiempo libre..." msgstr "Tiempo libre..." -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:69 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:70 msgid "Go to sleep" msgstr "Ir a dormir" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:70 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:71 msgid "Talk with a friend" msgstr "Hablar con un amigo" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:71 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:72 msgid "Do homework" msgstr "Hacer deberes" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:72 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:73 msgid "Clean up the bedroom" msgstr "Limpiar el cuarto" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:75 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:76 msgid "Ir a..." msgstr "Ir a..." -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:76 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:77 msgid "Schoolyard" msgstr "Patio de la escuela" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:77 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:78 msgid "Country" msgstr "Campo" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:78 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:79 msgid "Classroom" msgstr "Clase" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:79 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:80 msgid "Square" msgstr "Plaza" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:80 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:81 msgid "Home..." msgstr "Casa..." -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:81 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:82 msgid "Living room" msgstr "Living" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:82 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:83 msgid "Bedroom" msgstr "Dormitorio" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:83 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:84 msgid "Kitchen" msgstr "Cocina" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:87 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:88 msgid "Cambiar de ropa" msgstr "Cambiar de ropa" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:88 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:89 msgid "School" msgstr "Escuela" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:89 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:90 msgid "Sunny" msgstr "Caluroso" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:90 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:91 msgid "Rainy" msgstr "Luvioso" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:93 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:94 msgid "Higiene..." msgstr "Higiene..." -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:94 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:95 msgid "Bañarse" msgstr "Bañarse" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:95 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:96 msgid "Lavarse los dientes" msgstr "Lavarse los dientes" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:96 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:97 msgid "Lavarse las manos" msgstr "Lavarse las manos" -#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:97 +#: /home/pmoleri/saludame/Saludame.activity/menu_creator.py:98 msgid "Ir al baño" msgstr "Ir al baño" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:27 +#: /home/pmoleri/saludame/Saludame.activity/challenges.py:272 +#: /home/pmoleri/saludame/Saludame.activity/customization.py:63 +msgid "Continue" +msgstr "Continuar" + +#: /home/pmoleri/saludame/Saludame.activity/main_window.py:38 +msgid "Multiple choice" +msgstr "Múltiple opción" + +#: /home/pmoleri/saludame/Saludame.activity/main_window.py:42 +msgid "True or false" +msgstr "Verdadero o Falso" + +#: /home/pmoleri/saludame/Saludame.activity/main_window.py:46 +msgid "Master challenge" +msgstr "Gran desafío" + +#: /home/pmoleri/saludame/Saludame.activity/main_window.py:50 +msgid "Cooking" +msgstr "Cocina" + +#: /home/pmoleri/saludame/Saludame.activity/main_window.py:54 +msgid "Reset" +msgstr "Reiniciar" + +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:41 msgid "Which foods do we need to eat every day?" msgstr "¿Qué comidas necesitamos comer todos los días?" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:27 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:41 msgid "Some food from each group every day" msgstr "Algo de cada grupo todos los días" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:27 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:41 msgid "Some fruits and vegetables only" msgstr "Solo frutas y vegetales" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:27 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:41 msgid "Some food from all the groups but not fats and sugar" msgstr "Algo de fruta de todos los grupos pero no grasas y azucar" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:28 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:42 msgid "What is the most important meal of the day?" msgstr "¿Cual es la comida más importante del día?" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:28 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:42 msgid "Breakfast" msgstr "Desayuno" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:28 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:42 msgid "Lunch" msgstr "Almuerzo" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:28 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:42 msgid "Tea" msgstr "Té" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:28 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:42 msgid "Dinner" msgstr "Cena" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:29 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:43 msgid "How regularly should children exercise?" msgstr "¿Cuán a menudo deben ejercitarse los niños?" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:29 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:43 msgid "Once a month" msgstr "Al menos una vez al mes" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:29 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:43 msgid "Once a week" msgstr "Al menos una vez a la semana" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:29 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:43 msgid "Once a day" msgstr "Al menos una vez al día" -#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:30 +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:44 msgid "What percentage of the body is made up of water?" msgstr "¿Qué porcentaje del cuerpo está hecho de agua?" +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:50 +msgid "" +"La alimentación adecuada previene muchas enfermedades \n" +"importantes" +msgstr "" + +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:51 +msgid "" +"Si no nos vacunamos con las vacunas obligatorias podemos \n" +"enfermarnos" +msgstr "" + +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:52 +msgid "" +"Cuando estamos ingiriendo alimentos en menor proporción \n" +"a lo que necesitamos, podemos volvernos más \n" +"susceptibles a las infecciones " +msgstr "" + +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:55 +msgid "" +"Muchos alimentos pueden estar contaminados con agroquímicos, \n" +"y pesticidas porque son frecuentemente usados" +msgstr "" + +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:56 +msgid "Si no voy a comer no necesito lavarme las manos " +msgstr "" + +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:57 +msgid "" +"Lo primero que hay que hay que hacer cuando vamos a lavarnos \n" +"las manos es ponernos jabón" +msgstr "" + +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:60 +msgid "" +"Cuando aprendemos hábitos saludables estamos cuidando nuestra \n" +"salud" +msgstr "" + +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:61 +msgid "" +"Tomar mucha agua, hacer ejercicio y comer frutas y verduras \n" +"ayuda a mover el intestino sin dificultad" +msgstr "" + +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:62 +msgid "El desayuno no es importante en nuestra alimentación" +msgstr "" + +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:65 +msgid "La actividad física mejora nuestra imagen" +msgstr "" + +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:66 +msgid "" +"La actividad física no nos ayuda prevenir enfermedades \n" +"como el sobrepeso y la obesidad " +msgstr "" + +#: /home/pmoleri/saludame/Saludame.activity/challenges_creator.py:67 +msgid "" +"Ser sedentarios no tiene importancia y no afecta nuestra \n" +"salud" +msgstr "" + #: /home/pmoleri/saludame/Saludame.activity/startup_window.py:52 msgid "New game" msgstr "Nuevo juego" @@ -370,14 +462,10 @@ msgstr "< Atrás" msgid "Next >" msgstr "Siguiente >" -#: /home/pmoleri/saludame/Saludame.activity/panel_window.py:76 +#: /home/pmoleri/saludame/Saludame.activity/panel_window.py:74 msgid "Customization module" msgstr "Personalización" -#: /home/pmoleri/saludame/Saludame.activity/customization.py:63 -msgid "Continue" -msgstr "Continuar" - #: /home/pmoleri/saludame/Saludame.activity/customization.py:66 msgid "Hair" msgstr "Pelo" @@ -406,31 +494,31 @@ msgstr "Biblioteca" msgid "Credits" msgstr "Créditos" -#: /home/pmoleri/saludame/Saludame.activity/content_window.py:118 +#: /home/pmoleri/saludame/Saludame.activity/content_window.py:116 msgid "Library" msgstr "Biblioteca" -#: /home/pmoleri/saludame/Saludame.activity/status_bars.py:56 +#: /home/pmoleri/saludame/Saludame.activity/status_bars.py:59 msgid "TOTAL" msgstr "TOTAL" -#: /home/pmoleri/saludame/Saludame.activity/status_bars.py:59 +#: /home/pmoleri/saludame/Saludame.activity/status_bars.py:62 msgid "ESTADO FÍSICO" msgstr "ESTADO FÍSICO" -#: /home/pmoleri/saludame/Saludame.activity/status_bars.py:62 +#: /home/pmoleri/saludame/Saludame.activity/status_bars.py:65 msgid "HIGIENE" msgstr "HIGIENE" -#: /home/pmoleri/saludame/Saludame.activity/status_bars.py:65 +#: /home/pmoleri/saludame/Saludame.activity/status_bars.py:68 msgid "ALIMENTACIÓN" msgstr "ALIMENTACIÓN" -#: /home/pmoleri/saludame/Saludame.activity/status_bars.py:68 +#: /home/pmoleri/saludame/Saludame.activity/status_bars.py:71 msgid "TIEMPO LIBRE" msgstr "TIEMPO LIBRE" -#: /home/pmoleri/saludame/Saludame.activity/status_bars.py:342 +#: /home/pmoleri/saludame/Saludame.activity/status_bars.py:352 msgid "LEVEL" msgstr "NIVEL" @@ -450,74 +538,82 @@ msgstr "Energía" msgid "Defenses" msgstr "Defensas" -#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:21 +#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:24 msgid "Peso" msgstr "Peso" -#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:27 +#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:29 msgid "Ducha" msgstr "Ducha" -#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:27 +#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:29 msgid "Manos" msgstr "Manos" -#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:27 +#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:29 msgid "Dientes" msgstr "Dientes" -#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:27 +#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:29 msgid "Baño" msgstr "Baño" -#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:33 +#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:35 msgid "Cereales y leguminosas" msgstr "Cereales y leguminosas" -#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:33 +#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:35 msgid "Verduras y frutas" msgstr "Verduras y frutas" -#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:33 +#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:35 msgid "Carnes y huevos" msgstr "Carnes y huevos" -#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:33 +#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:35 msgid "Dulces" msgstr "Dulces" -#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:33 +#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:35 msgid "Grasas y aceites" msgstr "Grasas y aceites" -#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:33 +#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:35 msgid "Leches y quesos" msgstr "Leches y quesos" -#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:34 +#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:36 msgid "Alimentation" msgstr "Alimentación" -#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:39 +#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:41 msgid "Deportes" msgstr "Deportes" -#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:39 +#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:41 msgid "Diversión" msgstr "Diversión" -#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:39 +#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:41 msgid "Descanso" msgstr "Descanso" -#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:39 +#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:41 msgid "Responsabilidad" msgstr "Responsabilidad" -#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:40 +#: /home/pmoleri/saludame/Saludame.activity/status_bars_creator.py:42 msgid "Tiempo Libre" msgstr "Tiempo libre" +#: /home/pmoleri/saludame/Saludame.activity/menu.py:53 +msgid "exit" +msgstr "Salir" + +#: /home/pmoleri/saludame/Saludame.activity/menu.py:57 +msgid "back" +msgstr "Atrás" + #~ msgid "Accept" #~ msgstr "Aceptar" diff --git a/Saludame.activity/saludame_windows_controller.py b/Saludame.activity/saludame_windows_controller.py index 9a128c4..e441908 100644 --- a/Saludame.activity/saludame_windows_controller.py +++ b/Saludame.activity/saludame_windows_controller.py @@ -42,8 +42,9 @@ class SaludameWindowsController(gui.WindowsController): self.set_active_window("customization_window") # BACKGROUND - def set_environment(self, environment): - self.windows["kid"].set_environment(environment) + def set_environment(self, environment, time): + self.windows["kid"].set_environment(environment, time) + self.windows["panel_window"].set_weather() # CLOTHES diff --git a/Saludame.activity/sound_manager.py b/Saludame.activity/sound_manager.py index 479fe42..6003aba 100644 --- a/Saludame.activity/sound_manager.py +++ b/Saludame.activity/sound_manager.py @@ -37,6 +37,7 @@ class SoundManager: if name <> self.current_music_name: self.state = SoundManager.FADE_OUT self.next_music_name = name + pygame.mixer.music.fadeout(1000) elif self.state == SoundManager.FADE_OUT: if name == self.current_music_name: @@ -52,6 +53,15 @@ class SoundManager: def start_playing(self): global music + + if self.next_music_name: + self.current_music_name = self.next_music_name + self.next_music_name = None + path = music[self.current_music_name] pygame.mixer.music.load(path) pygame.mixer.music.play() + + # Sounds + def play_time_change(self): + pygame.mixer.Sound("assets/sound/time_change.ogg").play() diff --git a/Saludame.activity/status_bars.py b/Saludame.activity/status_bars.py index b283a50..b2048ed 100755 --- a/Saludame.activity/status_bars.py +++ b/Saludame.activity/status_bars.py @@ -18,7 +18,7 @@ SECTION_TOP_PADDING = 18 BAR_OFFSET_X = 30 BAR_WIDTH = 182 -BAR_HEIGHT = 26 +BAR_HEIGHT = 24 SCORE_BAR_HEIGHT = 36 SCORE_BAR_WIDTH = 118 @@ -49,34 +49,40 @@ class BarsWindow(gui.Window): self.rect.size = (227, 590) # game bars - self.bars = bars_loader.get_second_level_bars() + bars = bars_loader.get_second_level_bars() # sections score_section_width = SECTION_WIDTH - 20 - self.score_section = ScoreSection(bars_loader.get_score_bar(), self.rect, (score_section_width, 40), (SECTION_OFFSET_X + 25, 4), 1) + score_section = ScoreSection(bars_loader.get_score_bar(), self.rect, (score_section_width, 40), (SECTION_OFFSET_X + 25, 4), 1) y = 50 - self.overall_section = BarSection(windows_controller, self.rect, _(u"TOTAL"), bars_loader.get_overall_bar(), [] , (SECTION_WIDTH, SECTION_MIN_HEIGHT), (SECTION_OFFSET_X, y), "assets/layout/icon_total.png") + overall_section = BarSection(windows_controller, self.rect, _(u"TOTAL"), bars_loader.get_overall_bar(), [] , (SECTION_WIDTH, SECTION_MIN_HEIGHT), (SECTION_OFFSET_X, y), "assets/layout/icon_total.png") y = 110 - self.physica_section = BarSection(windows_controller, self.rect, _(u"ESTADO FÍSICO"), self.bars[0], self.bars[0].children_list, (SECTION_WIDTH, SECTION_MIN_HEIGHT), (SECTION_OFFSET_X, y), "assets/layout/icon_physica.png") + physica_section = BarSection(windows_controller, self.rect, _(u"ESTADO FÍSICO"), bars[0], bars[0].children_list, (SECTION_WIDTH, SECTION_MIN_HEIGHT), (SECTION_OFFSET_X, y), "assets/layout/icon_physica.png") y += SECTION_MIN_HEIGHT - self.hygiene_section = BarSection(windows_controller, self.rect, _(u"HIGIENE"), self.bars[1], self.bars[1].children_list, (SECTION_WIDTH, SECTION_MIN_HEIGHT), (SECTION_OFFSET_X, y), "assets/layout/icon_hygiene.png") + hygiene_section = BarSection(windows_controller, self.rect, _(u"HIGIENE"), bars[1], bars[1].children_list, (SECTION_WIDTH, SECTION_MIN_HEIGHT), (SECTION_OFFSET_X, y), "assets/layout/icon_hygiene.png") y += SECTION_MIN_HEIGHT - self.nutrition_section = BarSection(windows_controller, self.rect, _(u"ALIMENTACIÓN"), self.bars[2], self.bars[2].children_list, (SECTION_WIDTH, SECTION_MIN_HEIGHT), (SECTION_OFFSET_X, y), "assets/layout/icon_nutrition.png") + nutrition_section = BarSection(windows_controller, self.rect, _(u"ALIMENTACIÓN"), bars[2], bars[2].children_list, (SECTION_WIDTH, SECTION_MIN_HEIGHT), (SECTION_OFFSET_X, y), "assets/layout/icon_nutrition.png") y += SECTION_MIN_HEIGHT - self.spare_time_section = BarSection(windows_controller, self.rect, _(u"TIEMPO LIBRE"), self.bars[3], self.bars[3].children_list, (SECTION_WIDTH, SECTION_MIN_HEIGHT), (SECTION_OFFSET_X, y), "assets/layout/icon_spare_time.png") + spare_time_section = BarSection(windows_controller, self.rect, _(u"TIEMPO LIBRE"), bars[3], bars[3].children_list, (SECTION_WIDTH, SECTION_MIN_HEIGHT), (SECTION_OFFSET_X, y), "assets/layout/icon_spare_time.png") - self.sections_list = [self.score_section, self.overall_section, self.physica_section, self.hygiene_section, self.nutrition_section, self.spare_time_section] - self.accordeon = Accordeon([self.physica_section, self.hygiene_section, self.nutrition_section, self.spare_time_section]) + y += SECTION_MIN_HEIGHT + farm_section = BarSection(windows_controller, self.rect, _(u"HUERTA"), bars[4], bars[4].children_list, (SECTION_WIDTH, SECTION_MIN_HEIGHT), (SECTION_OFFSET_X, y), "assets/layout/icon_nutrition.png") + + self.sections_list = [score_section, overall_section, physica_section, hygiene_section, nutrition_section, spare_time_section, farm_section] + self.accordeon = Accordeon([physica_section, hygiene_section, nutrition_section, spare_time_section, farm_section]) self.set_bg_image("assets/layout/status.png") - self.windows += [section for section in self.sections_list if section != self.score_section] # Score section no va porque no está convertida a window - self.add_child(self.score_section) + for section in self.sections_list: + if section != score_section: # Score section no va porque es Widget + self.add_window(section) + + self.add_child(score_section) def on_mouse_over(self): return @@ -91,8 +97,9 @@ class BarsWindow(gui.Window): self.accordeon.compress_sections() else: self.accordeon.expand_section(section) + pygame.mixer.Sound("assets/sound/open_bars.ogg").play() + self.set_dirty_background() # Makes the window repaint its background break - self.repaint = True # Makes the window repaint its background class Accordeon: """ @@ -133,6 +140,7 @@ class Accordeon: for section in self.sections_list: # move up the sections section.move_up() section.compress() + section.set_dirty() class BarSection(gui.Window): """ @@ -169,15 +177,15 @@ class BarSection(gui.Window): if icon_path: icon = pygame.image.load(icon_path).convert() self.icon = gui.Widget(self.rect, pygame.Rect((0, 0), icon.get_size()), 1, icon) + self.icon.keep_dirty = True self.fixed_widgets.append(self.icon) else: self.icon = None - # visuals constant self.init_top = self.rect[1] self.init_height = size[1] - self.max_expand = len(children_bar) * (BAR_HEIGHT + 1) + self.max_expand = len(children_bar) * BAR_HEIGHT self.expanded = False # Este flag se activa cuando se están mostrando las sub-barras self.__calculate() # calculo la posición de cada barra en la sección @@ -225,19 +233,20 @@ class BarSection(gui.Window): self.root_bar_display.container = self.rect self.root_bar_display.set_rect_in_container(self.root_bar_display.rect_in_container) - self.widgets = [] - self.widgets.extend(self.fixed_widgets) + self.clear_childs() + for widget in self.fixed_widgets: + self.add_child(widget) if self.expanded: y = SECTION_TOP_PADDING for display in self.displays_list: - y += (BAR_HEIGHT + 1) + y += BAR_HEIGHT display.container = self.rect display.rect_in_container.top = y display.set_rect_in_container(display.rect_in_container) - self.widgets.append(display) + self.add_child(display) def __get_displays(self): """ @@ -281,30 +290,36 @@ class BarDisplay(gui.Widget): self.show_name = True + def update(self, frames): + if self.last_value != self.status_bar.value: + self.set_dirty() + def draw(self, screen): - if self.last_value != self.status_bar.value: - if isinstance(self.status_bar, WeightBar): - position = self.status_bar.value * (self.rect_in_container.width) / (BAR_WIDTH) - arrow_position = min([position, BAR_WIDTH + BAR_OFFSET_X]) - self.surface.blit(self.background, (0, 0)) - self.surface.blit(self.arrow, (arrow_position, 14)) - elif isinstance(self.status_bar, StatusBar): - rect = pygame.Rect((1, 2), (self.rect_in_container.width - 2, self.rect_in_container.height - 4)) - charged_rect = pygame.Rect(rect) # create a copy - charged_rect.width = self.status_bar.value * rect.width / self.status_bar.max - - color = self.get_color() - - self.surface.fill(BAR_BACK_COLOR, rect) - self.surface.fill(color, charged_rect) - self.surface.blit(self.background, (0, 0)) # Background blits over the charge, because it has the propper alpha + if isinstance(self.status_bar, WeightBar): + position = self.status_bar.value * (self.rect_in_container.width) / (BAR_WIDTH) + arrow_position = min([position, BAR_WIDTH + BAR_OFFSET_X]) + self.surface.blit(self.background, (0, 0)) + self.surface.blit(self.arrow, (arrow_position, 14)) + + elif isinstance(self.status_bar, StatusBar): + rect = pygame.Rect((1, 2), (self.rect_in_container.width - 2, self.rect_in_container.height - 4)) + charged_rect = pygame.Rect(rect) # create a copy + charged_rect.width = self.status_bar.value * rect.width / self.status_bar.max - if self.show_name: - self.surface.blit(self.font.render(self.label, 1, pygame.Color(SUB_BAR_TEXT_COLOR)), (8, 4)) + color = self.get_color() + + self.surface.fill(BAR_BACK_COLOR, rect) + self.surface.fill(color, charged_rect) + self.surface.blit(self.background, (0, 0)) # Background blits over the charge, because it has the propper alpha + if self.show_name: + self.surface.blit(self.font.render(self.label, 1, pygame.Color(SUB_BAR_TEXT_COLOR)), (8, 4)) + screen.blit(self.surface, self.rect_absolute) + self.dirty = False + return self.rect_absolute def get_color(self): @@ -331,7 +346,6 @@ class ScoreSection(gui.Widget): self.score_bar_display = BarDisplay(score_background.get_height(), score_background.get_width(), (SCORE_BAR_X_OFFSET, 12), self.score_bar, SCORE_BAR_PARTITIONS) self.score_bar_display.background = score_background - #self.surface = self.get_background().subsurface(self.rect_in_container) self.surface = pygame.Surface(self.rect_in_container.size) self.surface.set_alpha(255) diff --git a/Saludame.activity/status_bars_creator.py b/Saludame.activity/status_bars_creator.py index 2577a4b..190a17e 100755 --- a/Saludame.activity/status_bars_creator.py +++ b/Saludame.activity/status_bars_creator.py @@ -37,14 +37,20 @@ class BarsLoader: nutrition_children_bar = [status_bars.StatusBar(id[0], id[1], nutrition, [], hard_level[0], hard_level[1]) for id in nutrition_children_id] nutrition.children_list = nutrition_children_bar - ### fun + ### spare time fun_children_id = [("sports", _("Deportes")), ("fun", _(u"Diversión")), ("relaxing", _("Descanso")), ("responsability", _("Responsabilidad"))] fun = status_bars.StatusBar("spare_time", _("Tiempo Libre"), self.overall_bar, [], hard_level[0], hard_level[1]) fun_children_bar = [status_bars.StatusBar(id[0], id[1], fun, [], hard_level[0], hard_level[1]) for id in fun_children_id] fun.children_list = fun_children_bar - - self.second_level = [physica, hygiene, nutrition, fun] - self.third_level = physica.children_list + hygiene.children_list + nutrition.children_list + fun.children_list + + ### farm + farm_children_id = [("riego", _("Riego")), ("siembra", _(u"Siembra")), ("cosecha", _("Cosecha"))] + farm = status_bars.StatusBar("farm", _("Huerta"), self.overall_bar, [], hard_level[0], hard_level[1]) + farm_children_bar = [status_bars.StatusBar(id[0], id[1], fun, [], hard_level[0], hard_level[1]) for id in farm_children_id] + farm.children_list = farm_children_bar + + self.second_level = [physica, hygiene, nutrition, fun, farm] + self.third_level = physica.children_list + hygiene.children_list + nutrition.children_list + fun.children_list + farm.children_list self.overall_bar.children_list = self.second_level diff --git a/Saludame.activity/utilities.py b/Saludame.activity/utilities.py index 104c802..5029926 100755 --- a/Saludame.activity/utilities.py +++ b/Saludame.activity/utilities.py @@ -58,6 +58,6 @@ def verify_path(action, game_manager): return check_directory("%s/%s/%s" % (game_manager.character.mood.kid_animation_path, game_manager.character.sex, action.effect.clothes_id)) if isinstance(action.effect, effects.LocationEffect): # If the action has location effects - return check_image(game_manager.environments_dictionary[action.effect.place_id + "_" + game_manager.current_weather].background_path) + return check_image(game_manager.environments_dictionary[(action.effect.place_id, game_manager.current_weather)].background_path) return True -- cgit v0.9.1