forked from SilverStudioGames/WTS
Bug fixes and updater improvements
* Added feedback hints when clicking 'check for updates' button in the main menu * Updated methods to reflect the new changes * Fixed updater crashing with `u` parameter due to explicit no-parameter screen definition, while renpy expects the (lax) implicit definition * Fixed server url
This commit is contained in:
parent
c42306f320
commit
3a853c8e60
@ -249,16 +249,17 @@ screen navigation(title=None):
|
||||
|
||||
transclude
|
||||
|
||||
null height 14 # Half button height
|
||||
null height 28 # Half button height
|
||||
|
||||
if main_menu:
|
||||
if not title:
|
||||
|
||||
if not renpy.mobile:
|
||||
if UPDATE_VER:
|
||||
if version_float(UPDATE_VER) < version_float():
|
||||
textbutton "Install updates" action InstallUpdates() style_prefix "update_available" sensitive (not prerelease)
|
||||
else:
|
||||
textbutton "Check for updates" action CheckUpdates(300) sensitive (not prerelease)
|
||||
text "[UPDATE_HINT]" size 8 color "#fff" xalign 0.5
|
||||
|
||||
if show_quick_start:
|
||||
textbutton _("Quick Start") action Start("start_quick") sensitive is_sensitive
|
||||
|
@ -1,8 +1,9 @@
|
||||
init python:
|
||||
import requests
|
||||
|
||||
UPDATE_URL = bytes.fromhex("687474703a2f2f757064617465732e73696c76657273747564696f67616d65732e6f72672f757064617465732e6a736f6e").decode()
|
||||
UPDATE_VER = ""
|
||||
UPDATE_URL = bytes.fromhex("687474703a2f2f757064617465732e73696c76657273747564696f67616d65732e6f72672f6173736574732f757064617465732e6a736f6e").decode()
|
||||
UPDATE_VER = None
|
||||
UPDATE_HINT = ""
|
||||
|
||||
@renpy.pure
|
||||
class CheckUpdates(Action):
|
||||
@ -19,12 +20,18 @@ init python:
|
||||
# we need to forbid updater from affecting
|
||||
# GIT-supplied versions of the game to avoid bugs.
|
||||
|
||||
global UPDATE_VER, UPDATE_HINT
|
||||
|
||||
if (not updater.can_update() or config.developer) and not self.simulate:
|
||||
return
|
||||
|
||||
check = True
|
||||
url = self.url
|
||||
|
||||
if not self.onetime:
|
||||
UPDATE_HINT = "Checking for updates..."
|
||||
renpy.restart_interaction()
|
||||
|
||||
if self.onetime and url in updater.checked:
|
||||
check = False
|
||||
|
||||
@ -36,11 +43,19 @@ init python:
|
||||
persistent._update_last_checked[url] = time.time()
|
||||
updater.Updater(url, check_only=True, simulate=self.simulate, **self.kwargs)
|
||||
|
||||
global UPDATE_VER
|
||||
UPDATE_VER = persistent._update_version.get(url, "")
|
||||
UPDATE_VER = persistent._update_version.get(url, None)
|
||||
|
||||
if self.autostart:
|
||||
renpy.invoke_in_new_context(updater.update, self.url, simulate=self.simulate, **self.kwargs)
|
||||
if version_float(UPDATE_VER) < version_float():
|
||||
if not self.onetime:
|
||||
UPDATE_HINT = "New game version available!"
|
||||
renpy.restart_interaction()
|
||||
|
||||
if self.autostart:
|
||||
renpy.invoke_in_new_context(updater.update, self.url, simulate=self.simulate, **self.kwargs)
|
||||
elif not UPDATE_VER:
|
||||
ui.timer(2.0, SetVariable("UPDATE_HINT", "Server is not responding."))
|
||||
elif not self.onetime:
|
||||
ui.timer(2.0, SetVariable("UPDATE_HINT", "You are already up-to-date."))
|
||||
|
||||
@renpy.pure
|
||||
class InstallUpdates(Action):
|
||||
@ -62,8 +77,10 @@ init python:
|
||||
|
||||
renpy.set_return_stack(("main_room",))
|
||||
|
||||
def version_float():
|
||||
control, major, *minor = config.version.split(" ")[0].split(".")
|
||||
def version_float(version=None):
|
||||
version = version or config.version
|
||||
|
||||
control, major, *minor = version.split(" ")[0].split(".")
|
||||
return float("{}.{}{}".format(control, major, "".join(minor)))
|
||||
|
||||
def version_patch():
|
||||
@ -208,7 +225,8 @@ define update_message_list = [
|
||||
"Insert disc 2",
|
||||
]
|
||||
|
||||
screen updater():
|
||||
# Do not add parenthesis to the updater screen, otherwise it will break screen parameter interpolation.
|
||||
screen updater:
|
||||
|
||||
tag menu
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user