From 019ca9e9a9f6877063eebc8c8a0c6b42ae274920 Mon Sep 17 00:00:00 2001 From: Gouvernathor <44340603+Gouvernathor@users.noreply.github.com> Date: Sat, 18 Nov 2023 05:00:01 +0100 Subject: [PATCH] Allow several achievements to be displayed at the same time like in steam the change to popup_animation is not thoroughly tested (cherry picked from commit f714e482f6bdca4d419eb077eb5b3f500c44ce51) --- game/scripts/interface/achievements.rpy | 19 +++++++++++++++++-- game/scripts/interface/popup.rpy | 11 ++++------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/game/scripts/interface/achievements.rpy b/game/scripts/interface/achievements.rpy index 7cad9f44..18bdb765 100644 --- a/game/scripts/interface/achievements.rpy +++ b/game/scripts/interface/achievements.rpy @@ -60,7 +60,7 @@ init python: class Achievements(object): """ - Useless class, to be rolled out. + Useless class, can't be rolled out because of pickle and save compatibility. """ @staticmethod @@ -84,7 +84,7 @@ init python: if not silent: renpy.play('sounds/achievement.ogg') - renpy.show_screen("achievement_window", msg=achievements_db[id].title, title="Achievement unlocked!", icon=achievements_db[id].icon) + __popup_stack.append(id) @staticmethod def lock(self, id): @@ -118,6 +118,21 @@ default achievements = Achievements() ### +init python: + # intentionaly not a define nor a default + __popup_stack = [] + + config.after_default_callbacks.append(__popup_stack.clear) + config.always_shown_screens.append("achievement_main") + +screen achievement_main(): + layer "interface" + + vbox: + for id index id in __popup_stack[:3]: + use achievement_window(msg=achievements_db[id].title, title="Achievement unlocked!", icon=achievements_db[id].icon) + timer 6 action Function(__popup_stack.remove, id) + label popup(msg="", title="", icon=None, xpos=0, ypos=60, sound=True, soundfile='sounds/achievement.ogg'): if sound: play sound soundfile diff --git a/game/scripts/interface/popup.rpy b/game/scripts/interface/popup.rpy index 38eddb1a..09be4cc2 100644 --- a/game/scripts/interface/popup.rpy +++ b/game/scripts/interface/popup.rpy @@ -1,11 +1,8 @@ transform popup_animation(time=4.0, xx=-200): - on start: - xoffset xx - on show: - xoffset xx - linear 0.5 xoffset absolute(0) - pause time - linear 0.5 xoffset absolute(xx) + xoffset xx + linear 0.5 xoffset absolute(0) + pause time + linear 0.5 xoffset absolute(xx) screen popup_window(msg="", xpos=0, ypos=60): tag popup_window