Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…ug-and-template-VSCode-renpy into vscode-template
  • Loading branch information
BlackRam-oss committed Oct 28, 2022
2 parents ea76eea + 3d2ecfc commit 5101a3a
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 15 deletions.
20 changes: 19 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,25 @@
"settings": {
"foreground": "#e59400"
}
},
{
"scope": "renpy.meta.color.#00ccff",
"settings": {
"foreground": "#00ccff"
}
},
{
"scope": "renpy.meta.color.#f5bc02",
"settings": {
"foreground": "#f5bc02"
}
},
{
"scope": "renpy.meta.color.#00ccff",
"settings": {
"foreground": "#00ccff"
}
}
]
}
}
}
15 changes: 9 additions & 6 deletions game/tool/log_system.rpy
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
init -998 python:
# 'define config.log' is in core.rpy
error_notify = __("Where was an ERROR. Please send the developer the logs found in: [config.log]")
warn_notify = _("Where was an WARN. Please send the developer the logs found in: [config.log]")
error_notify = __("Where was an {color=#f00}{b}ERROR{/b}{/color}. Please send the developer the logs found in: {color=#00ccff}[config.log]{/color}")
warn_notify = _("Where was an {color=#f5bc02}{b}WARN{/b}{/color}. Please send the developer the logs found in: {color=#00ccff}[config.log]{/color}")
info_notify = False

def log_error(msg: str, filename_line = None):
renpy.log("Error: " + msg)
log_filename_line(filename_line)
if error_notify:
notifyEx(msg = error_notify)
notifyExPreventsLoops(msg = error_notify)
renpy.log("")
return

def log_warn(msg: str, filename_line = None):
renpy.log("Warn: " + msg)
log_filename_line(filename_line)
if not IsNullOrWhiteSpace(warn_notify):
notifyEx(msg = warn_notify)
notifyExPreventsLoops(msg = warn_notify)
renpy.log("")
return

def log_info(msg: str, filename_line = None):
renpy.log("Info: " + msg)
log_filename_line(filename_line)
if not IsNullOrWhiteSpace(info_notify):
notifyEx(msg = info_notify)
notifyExPreventsLoops(msg = info_notify)
renpy.log("")
return

def log_filename_line(filename_line = None):
if filename_line:
renpy.log("filename_line: [filename_line]")
renpy.log("filename_line: " + str(filename_line))
return
26 changes: 18 additions & 8 deletions game/tool/notify.rpy
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@

# Width of the images.
define gui.notifyEx_width = 64
define gui.notifyEx_width = gui.label_text_size
# Height of the images.
define gui.notifyEx_height = 64
define gui.notifyEx_height = gui.label_text_size

define gui.notifyEx_color = "#000000"
define gui.notifyEx_text_color = "#ffffff"

label enable_notifyEx:
show screen notifyEx
return
label disable_notifyEx:
hide notifyEx
return

init -999 python:
notifications = []
Expand All @@ -28,21 +36,23 @@ init -999 python:
renpy.show_screen("notifyEx")
return

def notifyExPreventsLoops(msg: str = None, img: str = None):
if len(store.notifications) > 1:
notifications[0] = NotifyEx(msg, img)
else:
notifications.append(NotifyEx(msg, img))
return

def notifyExClean(value):
if value in store.notifications:
store.notifications.remove(value)
if len(store.notifications) == 0:
renpy.hide_screen("notifyEx")
return


def notify(notific):
"""View defined notifications.
"""View defined notifications.6
to use: $ notify(...)"""
notifications.append(NotifyEx(notific.msg, notific.img))
if len(store.notifications) == 1:
renpy.show_screen("notifyEx")
return

style notify_text is default:
Expand Down Expand Up @@ -80,6 +90,6 @@ screen notifyExInternal( n ):
null width 5

if not n.msg is None:
text n.msg
text n.msg color gui.notifyEx_text_color

timer 0.05 repeat True action [ SetField( n, "remain", n.remain - 0.05 ), If( n.remain <= 0, Function( notifyExClean, n ), NullAction() ) ]

0 comments on commit 5101a3a

Please sign in to comment.