summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-12-16 14:51:01 -0300
committerJesusaves <cpntb1@ymail.com>2020-12-16 14:51:01 -0300
commit64a9b291096910252cdb1f00b59e02e342f4edf8 (patch)
tree865593391144bf4d4f80e4081bec9ff3f3df130e
parent11635c323a577bafe10b960c1127614086de9641 (diff)
downloadclient-64a9b291096910252cdb1f00b59e02e342f4edf8.tar.gz
client-64a9b291096910252cdb1f00b59e02e342f4edf8.tar.bz2
client-64a9b291096910252cdb1f00b59e02e342f4edf8.tar.xz
client-64a9b291096910252cdb1f00b59e02e342f4edf8.zip
Improve logging.
Re-optimize download & loading sequences
-rw-r--r--game/defs.rpy19
-rw-r--r--game/screens.rpy48
-rw-r--r--game/script.rpy27
3 files changed, 46 insertions, 48 deletions
diff --git a/game/defs.rpy b/game/defs.rpy
index 2fa2ef2..ae53c57 100644
--- a/game/defs.rpy
+++ b/game/defs.rpy
@@ -225,7 +225,6 @@ init -3 python:
# File Managment Functions
def get_path(path):
if True or renpy.android:
- #print "Android detected"
path=path.replace("/", "_")
#return renpy.loader.get_path(path)
return renpy.config.savedir + "/" + path
@@ -234,7 +233,6 @@ init -3 python:
def get_path_if_exists(path):
if True or renpy.android:
- print "Android detected, not checking"
path=path.replace("/", "_")
#return renpy.loader.get_path(path)
return renpy.config.savedir + "/" + path
@@ -262,6 +260,7 @@ init -3 python:
if (int(persistent.version) < ver):
# TODO: Check if the server have SSL support
+ stdout("Downloading updated game data...")
# Download quests.json
f=open(get_path("quests.json"), "w")
@@ -335,7 +334,7 @@ init -1 python:
# wsock already imported
- print("======================= %s %s %s" % (config.name, config.version, persistent.release_name))
+ stdout("======================= %s %s %s" % (config.name, config.version, persistent.release_name))
print "[STDBY] Loading Basic functions......."
# Search for array[?][key]==search in an array of dicts
@@ -459,7 +458,7 @@ init -1 python:
renpy.show("spinner", at_list=[truecenter])
renpy.invoke_in_thread(send_packet_now, packet, args)
while not tr_load:
- renpy.pause(0.1)
+ renpy.pause(0.1) # FIXME: This can cause errors in mobile
timeout+=0.1
if timeout >= TIMEOUT_INTERVAL:
@@ -488,12 +487,10 @@ init -1 python:
tr_load=False
# Load unit data
- if renpy.android:
- allunitsbase=json.loads(requests.get("http://"+HOST+'/units.json').text)
- else:
- f=open(get_path_if_exists("units.json"), "r")
- allunitsbase=json.load(f)
- f.close()
+ allunitsbase=json.loads(requests.get("http://"+HOST+'/units.json').text)
+ # f=open(get_path_if_exists("units.json"), "r")
+ # allunitsbase=json.load(f)
+ # f.close()
# Reorder unit data
allunits={}
@@ -532,7 +529,7 @@ init -1 python:
allnews=[]
pass
- print "[OK] Basic functions loaded"
+ stdout("[OK] Game data loaded to memory")
tr_load=True
return tr_load
diff --git a/game/screens.rpy b/game/screens.rpy
index d9e239b..720ea42 100644
--- a/game/screens.rpy
+++ b/game/screens.rpy
@@ -1592,9 +1592,9 @@ style nvl_button_text:
## Mobile Variants
################################################################################
-style pref_vbox:
- variant "medium"
- xsize 450
+#style pref_vbox:
+# variant "medium"
+# xsize 450
style window:
variant "small"
@@ -1608,29 +1608,29 @@ style check_button:
variant "small"
foreground "gui/phone/button/check_[prefix_]foreground.png"
-style nvl_window:
- variant "small"
- background Frame("gui/phone/nvl.png", 0, 0)
+#style nvl_window:
+# variant "small"
+# background Frame("gui/phone/nvl.png", 0, 0)
-style main_menu_frame:
- variant "small"
- background "gui/phone/overlay/main_menu.png"
+#style main_menu_frame:
+# variant "small"
+# background "gui/phone/overlay/main_menu.png"
-style game_menu_outer_frame:
- variant "small"
- background "gui/phone/overlay/game_menu.png"
+#style game_menu_outer_frame:
+# variant "small"
+# background "gui/phone/overlay/game_menu.png"
-style game_menu_navigation_frame:
- variant "small"
- xsize 340
+#style game_menu_navigation_frame:
+# variant "small"
+# xsize 340
-style game_menu_content_frame:
- variant "small"
- top_margin 0
+#style game_menu_content_frame:
+# variant "small"
+# top_margin 0
-style pref_vbox:
- variant "small"
- xsize 400
+#style pref_vbox:
+# variant "small"
+# xsize 400
style bar:
variant "small"
@@ -1668,9 +1668,9 @@ style vslider:
base_bar Frame("gui/phone/slider/vertical_[prefix_]bar.png", gui.vslider_borders, tile=gui.slider_tile)
thumb "gui/phone/slider/vertical_[prefix_]thumb.png"
-style slider_pref_vbox:
- variant "small"
- xsize None
+#style slider_pref_vbox:
+# variant "small"
+# xsize None
style slider_pref_slider:
variant "small"
diff --git a/game/script.rpy b/game/script.rpy
index c87def8..bf0c10b 100644
--- a/game/script.rpy
+++ b/game/script.rpy
@@ -77,9 +77,9 @@ label start:
tr_load=False
session_id=uuid.uuid4().hex
- "We shall now begin testing a websocket"
+ #"We shall now begin testing a websocket"
python:
-
+ # FIXME: Broken code
ws=persistent.ws
if (ws is not None):
stdout("Socket exists, trying to reuse connection...")
@@ -111,27 +111,20 @@ label start:
on_message=onmsg)
ws.on_open = onopen
renpy.invoke_in_thread(ws.run_forever)
- #ws.connect("wss://localhost:61000")
while not tr_load:
renpy.pause(0.02)
- hide spinner
- "Connection established!"
- $ send_packet("Hello world")
- "Message sent!"
- return
+ $ stdout("Connection established!")
+
# Run updater
python:
tr_load=False
renpy.invoke_in_thread(GAME_UPDATER)
while not tr_load:
- renpy.pause(0.1)
+ renpy.pause(0.02)
- tr_load=False
- renpy.invoke_in_thread(GAME_LOADER)
- while not tr_load:
- renpy.pause(0.1)
+ hide spinner
# Open game
scene bg town with Dissolve(0.3)
@@ -222,6 +215,14 @@ label login:
return
# Successful login? Update client data and begin routines
+
+ # Load game to memory
+ python:
+ tr_load=False
+ renpy.invoke_in_thread(GAME_LOADER)
+ while not tr_load:
+ renpy.pause(0.02)
+
$ persistent.password=password
$ dlcode-=5000
#$ ping_routine()