summaryrefslogtreecommitdiff
path: root/game
diff options
context:
space:
mode:
Diffstat (limited to 'game')
-rw-r--r--game/04_init.rpy20
-rw-r--r--game/screens.rpy41
-rw-r--r--game/script.rpy3
3 files changed, 57 insertions, 7 deletions
diff --git a/game/04_init.rpy b/game/04_init.rpy
index 9f09454..482f85e 100644
--- a/game/04_init.rpy
+++ b/game/04_init.rpy
@@ -31,13 +31,15 @@ init python:
try:
if (message.split(':')[0] == "NOTICE"):
# FIXME
- renpy.notify(str(":".join(message.split(':')[1:])))
- raise NotImplemented("You cannot call screens from threads!")
- renpy.call_screen("msgbox",
+ #renpy.notify(str(":".join(message.split(':')[1:])))
+ display_msgbox(str(":".join(message.split(':')[1:])))
+ #raise NotImplemented("You cannot call screens from threads!")
+ #renpy.call_screen("msgbox",
#renpy.call_in_new_context("msgbox_label",
- "{b}SERVER NOTICE{b}\n\n%s" % str(":".join(message.split(':')[1:])))
+ # "{b}SERVER NOTICE{b}\n\n%s" % str(":".join(message.split(':')[1:])))
return
except:
+ raise
stdout("Error displaying SERVNOTICE")
return
@@ -71,6 +73,9 @@ init python:
send_packet_now("PING")
def onerror(self, err):
+ if err == "Quit":
+ return
+
stdout("ERROR RECEIVED")
stdout("More details: %s" % repr(err))
stdout("An error happened: %s" % str(err))
@@ -91,7 +96,7 @@ init python:
#renpy.quit(relaunch=True, status=1)
except:
pass
- return 1
+ return
class GameClient(WebSocketClient):
def opened(self):
@@ -100,7 +105,10 @@ init python:
# FIXME This is also onerror
def closed(self, code, reason=None):
print "Closed down", code, reason
- onerror(self, "%s" % str(reason))
+ if reason is None:
+ reason="Connection died"
+ if reason != "Quit":
+ onerror(self, "%s" % str(reason))
def received_message(self, m):
onmsg(self, str(m))
diff --git a/game/screens.rpy b/game/screens.rpy
index e6e31fc..4b544bf 100644
--- a/game/screens.rpy
+++ b/game/screens.rpy
@@ -1392,3 +1392,44 @@ screen input_box(ib_message=_("Please write it down here: "), baloney=""):
text_size 54
text_outlines [ (1, "#000", 0, 0) ]
+
+
+screen notabox(message):
+
+ zorder 100
+ #style_prefix "notify"
+ style_prefix "confirm"
+
+ frame at notify_appear:
+ vbox:
+ xalign 0.5
+ yalign 0.5
+ spacing 30
+
+ label "{b}SERVER NOTICE{/b}":
+ xalign 0.5
+
+ label "[message!tq]":
+ style "confirm_prompt"
+ xalign 0.5
+
+ hbox:
+ xalign 0.5
+ spacing 100
+
+ textbutton _("Ok") action Hide('notabox')
+
+ timer 20.00 action Hide('notabox')
+
+init python:
+ def display_msgbox(message):
+ """
+ :doc: other
+
+ The default implementation of :func:`renpy.notify`.
+ """
+
+ renpy.hide_screen('notabox')
+ renpy.show_screen('notabox', message=message)
+ renpy.restart_interaction()
+
diff --git a/game/script.rpy b/game/script.rpy
index e910d89..5752f44 100644
--- a/game/script.rpy
+++ b/game/script.rpy
@@ -288,9 +288,10 @@ label quit:
except:
pass
+ # FIXME
# If needed, close the socket
try:
- ws.close()
+ ws.close(reason="Quit")
except:
pass