diff options
author | Jesusaves <cpntb1@ymail.com> | 2021-05-08 02:00:22 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2021-05-08 02:00:22 -0300 |
commit | 04e733c5b536af82b9e68ca41b54d299b52d482c (patch) | |
tree | 7e470cb2d8ac076c5389bae7510f209c9449309a /game | |
parent | ed5ad3e38bccc850203c442cdf4f2fb30288f2a9 (diff) | |
download | renpy-04e733c5b536af82b9e68ca41b54d299b52d482c.tar.gz renpy-04e733c5b536af82b9e68ca41b54d299b52d482c.tar.bz2 renpy-04e733c5b536af82b9e68ca41b54d299b52d482c.tar.xz renpy-04e733c5b536af82b9e68ca41b54d299b52d482c.zip |
Move client checking loop elsewhere
Diffstat (limited to 'game')
-rw-r--r-- | game/client.rpy | 40 | ||||
-rw-r--r-- | game/core.rpy | 5 | ||||
-rw-r--r-- | game/screens.rpy | 10 | ||||
-rw-r--r-- | game/update.rpy | 21 |
4 files changed, 58 insertions, 18 deletions
diff --git a/game/client.rpy b/game/client.rpy new file mode 100644 index 0000000..eeb981f --- /dev/null +++ b/game/client.rpy @@ -0,0 +1,40 @@ +################################################################################# +# This file is part of Mana Launcher. +# Copyright (C) 2021 Jesusalva <jesusalva@tmw2.org> +# +# Distributed under the MIT license, except for Steam parts. +################################################################################# +init python: + def handle_client(CLIENT_NAME, launch=False): + f=False + if (CLIENT_NAME == "manaplus"): + f=cli_manaplus(launch) + elif (CLIENT_NAME == "mana"): + f=cli_mana(launch) + else: + stdout("ERROR, unrecognized client: %s" % CLIENT_NAME) + return f + +init -1 python: + def cli_manaplus(launch=False): + ## Check for ManaPlus + try: + MANAPLUS=os.path.exists(get_path("manaplus")) + except: + traceback.printexc() + MANAPLUS=False + + return True + + def cli_mana(launch=False): + stdout("ERROR, Mana Client is not implemented!") + ## Check for Mana + try: + MANA=os.path.exists(get_path("mana")) + except: + traceback.printexc() + MANA=False + return False + + + diff --git a/game/core.rpy b/game/core.rpy index 3869492..f95c289 100644 --- a/game/core.rpy +++ b/game/core.rpy @@ -24,11 +24,14 @@ init -3 python: if (PYTHON_VERSION < 2700 or PYTHON_VERSION > 3000): raise Exception("WARNING: Python version is not 2.7\nStrange bugs may happen on your client.\n\nClick on \"Ignore\" to continue.\nClick on \"Quit\" to exit.") - # Configuration + ############################################################################# + ## Configuration and Defaults config.autoreload = False config.save_on_mobile_background = False if (persistent.discord is None): persistent.discord = True + if (persistent.client is None): + persistent.client = "manaplus" ############################################################################# #, "themanaworld.org", "germantmw.de", "moubootaurlegends.org"] diff --git a/game/screens.rpy b/game/screens.rpy index 3d953e7..c364414 100644 --- a/game/screens.rpy +++ b/game/screens.rpy @@ -664,11 +664,11 @@ screen preferences(): _("Disabled")): action ToggleVariable("persistent.discord") null height 10 - label _("Preferred Client") - #textbutton "ManaPlus": - # action ifte(MANAPLUS, - # SetVariable("persistent.client", "manaplus"), - # None) + label _("Game Client") + textbutton _("ManaPlus"): + action SetVariable("persistent.client", "manaplus") + textbutton _("Mana"): + action SetVariable("persistent.client", "mana") vbox: diff --git a/game/update.rpy b/game/update.rpy index 89cbf62..033657b 100644 --- a/game/update.rpy +++ b/game/update.rpy @@ -139,20 +139,17 @@ init python: # Check for clients, this block is 60~80% status_update("Checking for installed clients...", 60) - ## Check for ManaPlus - try: - MANAPLUS=os.path.exists(get_path("manaplus")) - except: - traceback.printexc() - MANAPLUS=False + r=handle_client(persistent.client) + + ## Oh sh-- + if not r: + time.sleep(0.4) + status_update("{color=#F00}ERROR: \"%s\" client is NOT supported!{/color}" % persistent.client, 70) + responsive = False + return + status_update(pc=70) - ## Check for Mana - try: - MANA=os.path.exists(get_path("mana")) - except: - traceback.printexc() - MANA=False time.sleep(0.1) |