Browse Source

Translate Tutorials/Misc/HandlingQuitRequests to C#

Paul Joannon 7 years ago
parent
commit
c0a72f7745
1 changed files with 16 additions and 2 deletions
  1. 16 2
      tutorials/misc/handling_quit_requests.rst

+ 16 - 2
tutorials/misc/handling_quit_requests.rst

@@ -20,18 +20,32 @@ requested: MainLoop.NOTIFICATION_WM_QUIT.
 
 
 Handling it is done as follows (on any node):
 Handling it is done as follows (on any node):
 
 
-::
+.. tabs::
+ .. code-tab:: gdscript GDScript
 
 
     func _notification(what):
     func _notification(what):
         if what == MainLoop.NOTIFICATION_WM_QUIT_REQUEST:
         if what == MainLoop.NOTIFICATION_WM_QUIT_REQUEST:
             get_tree().quit() # default behavior
             get_tree().quit() # default behavior
 
 
+ .. code-tab:: csharp
+
+    public override void _Notification(int what)
+    {
+        if (what == MainLoop.NotificationWmQuitRequest)
+            GetTree().Quit(); // default behavior
+    }
+
 When developing mobile apps, quitting is not desired unless the user is
 When developing mobile apps, quitting is not desired unless the user is
 on the main screen, so the behavior can be changed.
 on the main screen, so the behavior can be changed.
 
 
 It is important to note that by default, Godot apps have the built-in
 It is important to note that by default, Godot apps have the built-in
 behavior to quit when quit is requested, this can be changed:
 behavior to quit when quit is requested, this can be changed:
 
 
-::
+.. tabs::
+ .. code-tab:: gdscript GDScript
 
 
     get_tree().set_auto_accept_quit(false)
     get_tree().set_auto_accept_quit(false)
+
+ .. code-tab:: csharp
+
+    GetTree().SetAutoAcceptQuit(false);