From 433879648362c695bcdf2b82633f4eb75c75799a Mon Sep 17 00:00:00 2001 From: coolestskinnieinthejungle Date: Fri, 2 Jul 2021 14:17:34 -0500 Subject: [PATCH] at long last, update + autoupdate working as intended --- game/screens.rpy | 27 +++++++++++++++------------ game/script.rpy | 7 +++++++ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/game/screens.rpy b/game/screens.rpy index ed2710a..41afedd 100644 --- a/game/screens.rpy +++ b/game/screens.rpy @@ -1,14 +1,18 @@ ###Updater Python stuff### init python: + if persistent.updateresult is None: + persistent.updateresult = "No new version is available" + if persistent.autoup is None: + persistent.autoup = False + + updateWebServer = "http://updates.snootgame.xyz/updates.json" + def UpdateCheck(): - renpy.notify("Updater Ran") - pendingVersion = updater.UpdateVersion("https://updates.snootgame.xyz/updates.json") + pendingVersion = updater.UpdateVersion(updateWebServer) if pendingVersion == None: - persistent.updateresult = "No New Version is Available" - renpy.notify(persistent.updateresult) + persistent.updateresult = "No new version is available" else: - renpy.notify(persistent.updateresult + "can be downloaded") - updater.Update("https://updates.snootgame.xyz/updates.json", force=True) + persistent.updateresult = pendingVersion ################################################################################ ## Initialization @@ -16,7 +20,6 @@ init python: init offset = -1 - ################################################################################ ## Styles ################################################################################ @@ -397,7 +400,6 @@ screen main_menu(): imagebutton auto "gui/button/menubuttons/extrasbutton_%s.png" action ShowMenu("extras") imagebutton auto "gui/button/menubuttons/quitbutton_%s.png" action Quit(confirm=not main_menu) - style main_menu_frame is empty style main_menu_vbox is vbox style main_menu_text is gui_text @@ -731,11 +733,12 @@ screen updates(): label "[config.name!t]" text _("Your Version is [config.version!t]\n") ##style_prefix "check" - label _("Auto Update") - #textbutton _("Enable Automatic Updates") action ToggleVariable("persistent.autoup", True, False) - textbutton _("Update Now!") action Function(UpdateCheck) - label _("Update Result:\n") + textbutton _("Enable Automatic Updates") action [Notify("Toggling Automatic Updates..."), ToggleVariable("persistent.autoup", True, False)] + text _("Automatic Updates: [persistent.autoup!t]\n") + textbutton _("Check for Update!") action [Notify("Checking for update..."), Function(UpdateCheck)] + label _("Update Check Result:\n") text _("[persistent.updateresult!t]\n") + textbutton _("Update Now!") action updater.Update(updateWebServer, force=True) textbutton "Back to Extras" action ShowMenu("extras") vbox: xpos 1942 diff --git a/game/script.rpy b/game/script.rpy index 41c55d3..4b9fc13 100644 --- a/game/script.rpy +++ b/game/script.rpy @@ -292,6 +292,13 @@ image black = "#000" label splashscreen: $ persistent.splashtype = random.randint(0,2000 - 1) $ renpy.movie_cutscene("images/intros/CaveManonProductions.webm") + + if persistent.autoup: + python: + UpdateCheck() + if persistent.updateresult != "No new version is available": + updater.update(updateWebServer, force=True) + stop sound return