diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 69b61bb..32b9b84 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -3,8 +3,7 @@ // for the documentation about the extensions.json format "recommendations": [ "luquedaniel.languague-renpy", - "spmeesseman.vscode-taskexplorer", "ms-python.python", - "ms-vscode.PowerShell", + "ms-vscode.powershell" ] } \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 1db019c..0d6800d 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,18 +5,52 @@ "version": "0.2.0", "configurations": [ { - "name": "Ren'Py Windows: Run", + "name": "Ren'Py: Setup", "type": "PowerShell", "request": "launch", - "script": "bin/renpy.ps1 -Command run", - "cwd": "${workspaceFolder}" + "script": "echo \"${input:RenPySdk}\" > .renpy-sdk", }, { - "name": "Ren'Py MacOS/Linux: Run", + "name": "Ren'Py: Run", "type": "PowerShell", "request": "launch", "script": "bin/renpy run", "cwd": "${workspaceFolder}" }, + { + "name": "Ren'Py: Recompile & Run", + "type": "PowerShell", + "request": "launch", + "script": "bin/renpy compile; bin/renpy run", + "cwd": "${workspaceFolder}" + }, + { + "name": "Ren'Py: Delete Persistent", + "type": "PowerShell", + "request": "launch", + "script": "bin/renpy rmpersistent", + "cwd": "${workspaceFolder}" + }, + { + "name": "Ren'Py: Lint", + "type": "PowerShell", + "request": "launch", + "script": "bin/renpy lint", + "cwd": "${workspaceFolder}" + }, + { + "name": "Ren'Py: Distribute", + "type": "PowerShell", + "request": "launch", + "script": "bin/renpy distribute", + "cwd": "${workspaceFolder}" + }, + ], + "inputs": [ + { + "id": "RenPySdk", + "description": "Paste the path to your Ren'Py SDK folder", + "type": "promptString", + } ] } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json deleted file mode 100644 index fd84a41..0000000 --- a/.vscode/tasks.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - // See https://go.microsoft.com/fwlink/?LinkId=733558 - // for the documentation about the tasks.json format - "version": "2.0.0", - "tasks": [ - { - "label": "Ren'Py Setup: Set .renpy-sdk path", - "type": "shell", - "command": "echo \"${input:RenPySdk}\" > .renpy-sdk", - }, - { - "label": "Ren'Py MacOS/Linux: Run", - "type": "shell", - "command": "bin/renpy run", - "group": "build" - }, - { - "label": "Ren'Py MacOS/Linux: Delete Persistent", - "type": "shell", - "command": "bin/renpy rmpersistent" - }, - { - "label": "Ren'Py MacOS/Linux: Force Recompile", - "type": "shell", - "command": "bin/renpy compile" - }, - { - "label": "Ren'Py MacOS/Linux: Lint", - "type": "shell", - "command": "bin/renpy lint" - }, - { - "label": "Ren'Py MacOS/Linux: Distribute", - "type": "shell", - "command": "bin/renpy distribute", - "group": "build", - "problemMatcher": [] - }, - { - "label": "Ren'Py Windows: Run", - "type": "shell", - "command": "bin/renpy.ps1 -Command run", - "group": "build" - }, - { - "label": "Ren'Py Windows: Delete Persistent", - "type": "shell", - "command": "bin/renpy.ps1 -Command rmpersistent" - }, - { - "label": "Ren'Py Windows: Force Recompile", - "type": "shell", - "command": "bin/renpy.ps1 -Command compile" - }, - { - "label": "Ren'Py Windows: Lint", - "type": "shell", - "command": "bin/renpy.ps1 -Command lint" - }, - { - "label": "Ren'Py Windows: Distribute", - "type": "shell", - "command": "bin/renpy.ps1 -Command distribute", - "group": "build", - "problemMatcher": [] - }, - ], - "inputs": [ - { - "id": "RenPySdk", - "description": "Paste the path to your Ren'Py SDK folder", - "type": "promptString" - } - ] -} \ No newline at end of file diff --git a/game/tool/notify.rpy b/game/tool/notify.rpy new file mode 100644 index 0000000..221e364 --- /dev/null +++ b/game/tool/notify.rpy @@ -0,0 +1,82 @@ +init python: + class NotifyEx(renpy.python.RevertableObject): + """Notifications, to use: default ... = NotifyEx(msg="...", img="...")""" + def __init__(self, + msg: str, + img: str + ): + super(NotifyEx, self).__init__() + self.msg = msg + self.img = img + self.remain = gui.notifyEx_delay + + + def notifyEx(msg: str = None, img: str = None): + notifications.append(NotifyEx(msg, img)) + if len(store.notifications) == 1: + renpy.show_screen("notifyEx") + + + def notifyExClean(value): + if value in store.notifications: + store.notifications.remove(value) + if len(store.notifications) == 0: + renpy.hide_screen("notifyEx") + + + def notify(notific): + """View defined notifications. + to use: $ notify(...)""" + notifications.append(NotifyEx(notific.msg, notific.img)) + if len(store.notifications) == 1: + renpy.show_screen("notifyEx") + +# Delay of visibility of a notification. +define gui.notifyEx_delay = 10.0 +# Width of the images. +define gui.notifyEx_width = 64 +# Height of the images. +define gui.notifyEx_height = 64 + +define gui.notifyEx_color = "#000000" + +default notifications = [] + +style notify_text is default: + color gui.notifyEx_color + yalign 0.5 + +style notify_hbox is default: + ysize gui.notifyEx_height + +screen notifyEx(): + + zorder 100 + + style_prefix "notify" + + vbox: + for d in notifications: + use notifyExInternal( d ) + # aerate a little. + null height 5 + +screen notifyExInternal( n ): + + style_prefix "notify" + + frame at notify_appear: + hbox: + if not n.img is None: + add n.img + else: + # Ensure that all the texts will be aligned. + null width gui.notifyEx_width + + # aerate a little. + null width 5 + + if not n.msg is None: + text n.msg + + timer 0.05 repeat True action [ SetField( n, "remain", n.remain - 0.05 ), If( n.remain <= 0, Function( notifyExClean, n ), NullAction() ) ]