浏览代码

Merge pull request #6085 from wouldntsavezion/patch-1

Small edit to quit requests handling
Max Hilbrunner 2 年之前
父节点
当前提交
ece7e495d5
共有 1 个文件被更改,包括 6 次插入7 次删除
  1. 6 7
      tutorials/inputs/handling_quit_requests.rst

+ 6 - 7
tutorials/inputs/handling_quit_requests.rst

@@ -14,9 +14,8 @@ to go back otherwise).
 Handling the notification
 Handling the notification
 -------------------------
 -------------------------
 
 
-On desktop platforms, the :ref:`MainLoop <class_MainLoop>`
-has a special ``MainLoop.NOTIFICATION_WM_QUIT_REQUEST`` notification that is
-sent to all nodes when quitting is requested.
+On desktop and web platforms, :ref:`Node <class_Node>`
+receives a special ``NOTIFICATION_WM_CLOSE_REQUEST`` notification when quitting is requested.
 
 
 On Android, ``MainLoop.NOTIFICATION_WM_GO_BACK_REQUEST`` is sent instead.
 On Android, ``MainLoop.NOTIFICATION_WM_GO_BACK_REQUEST`` is sent instead.
 Pressing the Back button will exit the application if
 Pressing the Back button will exit the application if
@@ -34,14 +33,14 @@ Handling the notification is done as follows (on any node):
  .. code-tab:: gdscript GDScript
  .. code-tab:: gdscript GDScript
 
 
     func _notification(what):
     func _notification(what):
-        if what == MainLoop.NOTIFICATION_WM_QUIT_REQUEST:
+        if what == NOTIFICATION_WM_CLOSE_REQUEST:
             get_tree().quit() # default behavior
             get_tree().quit() # default behavior
 
 
  .. code-tab:: csharp
  .. code-tab:: csharp
 
 
     public override void _Notification(int what)
     public override void _Notification(int what)
     {
     {
-        if (what == MainLoop.NotificationWmQuitRequest)
+        if (what == NotificationWmCloseRequest)
             GetTree().Quit(); // default behavior
             GetTree().Quit(); // default behavior
     }
     }
 
 
@@ -75,8 +74,8 @@ Instead, you should send a quit request:
 .. tabs::
 .. tabs::
  .. code-tab:: gdscript GDScript
  .. code-tab:: gdscript GDScript
 
 
-    get_tree().notification(MainLoop.NOTIFICATION_WM_QUIT_REQUEST)
+    get_tree().notification(NOTIFICATION_WM_CLOSE_REQUEST)
 
 
  .. code-tab:: csharp
  .. code-tab:: csharp
 
 
-    GetTree().Notification(MainLoop.NotificationWmQuitRequest)
+    GetTree().Notification(NotificationWmCloseRequest)