更改

翻译部分内容
第107行: 第107行:  
</syntaxhighlight>
 
</syntaxhighlight>
   −
You can also convert <samp>SButton</samp> to the other constants. This uses a <samp>TryGet</samp> approach since <samp>SButton</samp> is a superset of the others (''e.g.,'' you can't convert <samp>SButton.ControllerA</samp> to a keyboard value):
+
你也可以将 <samp>SButton</samp> 转换为其他常量。这将使用到 <samp>TryGet</samp> 的途径,因为 <samp>SButton</samp> 是其他常量的一个超集(比方说,你不能把 <samp>SButton.ControllerA</samp> 转换成一个 keyboard 值):
 
<syntaxhighlight lang="c#">
 
<syntaxhighlight lang="c#">
 
SButton value = SButton.A;
 
SButton value = SButton.A;
第118行: 第118行:  
</syntaxhighlight>
 
</syntaxhighlight>
   −
Two last extensions let you check how the button is mapped in the game:
+
最后两个扩展帮助你检查按键在游戏中如何布局:
 
<syntaxhighlight lang="c#">
 
<syntaxhighlight lang="c#">
 
SButton button = SButton.MouseLeft;
 
SButton button = SButton.MouseLeft;
 
if (button.IsUseToolButton())
 
if (button.IsUseToolButton())
   // use tool
+
   // 使用工具
 
else if (button.IsActionButton())
 
else if (button.IsActionButton())
   // perform action
+
   // 执行动作
 
</syntaxhighlight>
 
</syntaxhighlight>
   −
You can use <samp>SButton</samp> values directly in your [[../Config|config model]], but <samp>[[#KeybindList|KeybindList]]</samp> is recommended instead in most cases.
+
你可以在[[../Config|config model]] 中直接使用 <samp>SButton</samp> 的值,但是大部分情况下推荐使用 <samp>[[#KeybindList|KeybindList]]</samp>
    
===KeybindList===
 
===KeybindList===
第212行: 第212行:  
'''The pixel positions are ''not'' adjusted for [[Modding:Modder Guide/Game Fundamentals#UI scaling|UI scaling]]''' (''i.e.,'' they're non-UI mode). Whether you need UI or non-UI positions depends how you're using them, so you can use <samp>cursorPos.GetScaledAbsolutePixels()</samp> or <samp>cursorPos.GetScaledScreenPixels()</samp> to adjust them automatically for the current mode or <samp>Utility.ModifyCoordinatesForUIScale</samp> to always get UI mode coordinates.
 
'''The pixel positions are ''not'' adjusted for [[Modding:Modder Guide/Game Fundamentals#UI scaling|UI scaling]]''' (''i.e.,'' they're non-UI mode). Whether you need UI or non-UI positions depends how you're using them, so you can use <samp>cursorPos.GetScaledAbsolutePixels()</samp> or <samp>cursorPos.GetScaledScreenPixels()</samp> to adjust them automatically for the current mode or <samp>Utility.ModifyCoordinatesForUIScale</samp> to always get UI mode coordinates.
   −
==See also==
+
== 另见==
 
* [[../Events#Input|Input events]]
 
* [[../Events#Input|Input events]]
* [[Modding:Player Guide/Key Bindings]] for a list of valid <samp>SButton</samp> values
+
* [[Modding:Player Guide/Key Bindings]] 中有一个可用的 <samp>SButton</samp> 值列表
    
[[en:Modding:Modder Guide/APIs/Input]]
 
[[en:Modding:Modder Guide/APIs/Input]]
14

个编辑