浏览代码

Translate Tutorials/Misc/PausingGames to C#

Paul Joannon 7 年之前
父节点
当前提交
bd8cefdaa7
共有 1 个文件被更改,包括 26 次插入3 次删除
  1. 26 3
      tutorials/misc/pausing_games.rst

+ 26 - 3
tutorials/misc/pausing_games.rst

@@ -23,10 +23,15 @@ To set pause mode, the pause state must be set. This is done by assigning
 "true" to the :ref:`SceneTree.paused <class_SceneTree_paused>` member
 "true" to the :ref:`SceneTree.paused <class_SceneTree_paused>` member
 variable:
 variable:
 
 
-::
+.. tabs::
+ .. code-tab:: gdscript GDScript
 
 
     get_tree().paused = true
     get_tree().paused = true
 
 
+ .. code-tab:: csharp
+
+    GetTree().Paused = true;
+
 Doing so will have the following behavior:
 Doing so will have the following behavior:
 
 
 -  2D and 3D physics will be stopped.
 -  2D and 3D physics will be stopped.
@@ -78,19 +83,37 @@ scene tree will continue working when paused.
 Finally, make it so when a pause button is pressed (any button will do),
 Finally, make it so when a pause button is pressed (any button will do),
 enable the pause and show the pause screen.
 enable the pause and show the pause screen.
 
 
-::
+.. tabs::
+ .. code-tab:: gdscript GDScript
 
 
     func _on_pause_button_pressed():
     func _on_pause_button_pressed():
         get_tree().paused = true
         get_tree().paused = true
         $pause_popup.show()
         $pause_popup.show()
 
 
+ .. code-tab:: csharp
+
+    public void _on_pause_button_pressed()
+    {
+        GetTree().Paused = true;
+        ((Control)GetNode("pause_popup")).Show();
+    }
+
 To remove the pause, just do the opposite when the pause screen is
 To remove the pause, just do the opposite when the pause screen is
 closed:
 closed:
 
 
-::
+.. tabs::
+ .. code-tab:: gdscript GDScript
 
 
     func _on_pause_popup_close_pressed():
     func _on_pause_popup_close_pressed():
         $pause_popup.hide()
         $pause_popup.hide()
         get_tree().paused = false
         get_tree().paused = false
 
 
+ .. code-tab:: csharp
+
+    public void _on_pause_popup_close_pressed()
+    {
+        ((Control)GetNode("pause_popup")).Hide();
+        GetTree().Paused = false;
+    }
+
 And that should be all!
 And that should be all!