Merge pull request 'updates branch/feature merging into patchy-patch5' (#52) from updates into Patchy-Patch5

Reviewed-on: https://git.snootgame.xyz/Cavemanon/SnootGame/pulls/52
This commit is contained in:
2021-07-09 04:29:22 +00:00
2 changed files with 1869 additions and 1850 deletions

View File

@ -1,10 +1,25 @@
################################################################################
###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
if persistent.updateWebServer is None:
persistent.updateWebServer = "http://updates.snootgame.xyz/updates.json"
def UpdateCheck():
pendingVersion = updater.UpdateVersion(persistent.updateWebServer)
if pendingVersion == None:
persistent.updateresult = "No new version is available"
else:
persistent.updateresult = pendingVersion
################################################################################
## Initialization
################################################################################
init offset = -1
################################################################################
## Styles
################################################################################
@ -385,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
@ -712,21 +726,19 @@ screen updates():
## The use statement includes another screen inside this one. The actual
## contents of the main menu are in the navigation screen.
##todo add size
##add gui.game_menu_background
vbox:
xpos 1040
# yalign 0.03
xpos 1140
ypos 800
text _("UPDATES")
#text _("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 ("persistent.autoup", True, False) This should also set the value of updateresults
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(persistent.updateWebServer, force=True)
textbutton "Back to Extras" action ShowMenu("extras")
vbox:
xpos 1942
@ -1244,11 +1256,11 @@ screen extrasnavigation():
# xpos 590
xalign 0.79
yalign 1.0 #0.9
imagebutton auto "gui/button/menubuttons/helpbutton_%s.png" action ShowMenu("help")
imagebutton auto "gui/button/menubuttons/aboutbutton_%s.png" action ShowMenu("about")
imagebutton auto "gui/button/menubuttons/updatesbutton_%s.png" action ShowMenu("updates")
imagebutton auto "gui/button/menubuttons/gallerybutton_%s.png" action ShowMenu("gallery")
imagebutton auto "gui/button/menubuttons/returnbutton_%s.png" action ShowMenu("main_menu")
imagebutton auto "gui/button/menubuttons/helpbutton_%s.png" action ShowMenu('help')
imagebutton auto "gui/button/menubuttons/aboutbutton_%s.png" action ShowMenu('about')
imagebutton auto "gui/button/menubuttons/updatesbutton_%s.png" action ShowMenu('updates')
imagebutton auto "gui/button/menubuttons/gallerybutton_%s.png" action ShowMenu('gallery')
imagebutton auto "gui/button/menubuttons/returnbutton_%s.png" action ShowMenu('main_menu')
## Help screen #################################################################

View File

@ -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(persistent.updateWebServer, force=True)
stop sound
return