|
Survivalcraft API 1.8.2.3 v1.8.2.3
Survivalcraft 2.4
|


类 | |
| class | UpdateTask |
| class | SetCursorPositionTask |
| class | TextDrawItem |
| class | NormalDrawItem |
| class | CompositionTextDrawItem |
| class | CaretDrawItem |
| class | SelectionDrawItem |
| class | EndOfLineDrawItem |
Public 成员函数 | |
| void | ChangeTextNoEvent (string value) |
| void | EnterCharacter (char value, int position=-1, bool moveCaret=true) |
| void | DeleteSelection () |
| void | EnterText (string value) |
| void | EnterText (string value, int index) |
| void | BackSpace (char? character=null, int count=1, bool moveCaret=true) |
| void | Delete (char? character=null, int count=1) |
| override void | UpdateCeases () |
| override void | Update () |
| void | LimitScrollValue () |
| 限制 Scroll 属性的值。 | |
| TextBoxWidget () | |
| override void | Overdraw (DrawContext dc) |
| override void | Draw (DrawContext dc) |
| virtual void | Draw_ (DrawContext dc) |
| override void | MeasureOverride (Vector2 parentAvailableSize) |
| Public 成员函数 继承自 Game.Widget | |
| Widget () | |
| virtual void | LoadContents (object eventsTarget, XElement node) |
| virtual void | LoadProperties (object eventsTarget, XElement node) |
| virtual void | LoadChildren (object eventsTarget, XElement node) |
| virtual bool | IsChildWidgetOf (ContainerWidget containerWidget) |
| virtual void | ChangeParent (ContainerWidget parentWidget) |
| virtual void | Measure (Vector2 parentAvailableSize) |
| virtual void | Arrange (Vector2 position, Vector2 parentActualSize) |
| virtual void | ArrangeOverride () |
| virtual bool | HitTest (Vector2 point) |
| virtual Widget | HitTestGlobal (Vector2 point, Func< Widget, bool > predicate=null) |
| virtual Vector2 | ScreenToWidget (Vector2 p) |
| virtual Vector2 | WidgetToScreen (Vector2 p) |
| virtual void | Dispose () |
| virtual BoundingRectangle | TransformBoundsToParent (Vector2 size) |
| virtual BoundingRectangle | TransformBoundsToGlobal (Vector2 size) |
静态 Public 成员函数 | |
| static string[] | SplitStringAt (string str, int splitPosition) |
| static void | ShowInputMethod () |
| static void | CloseInputMethod () |
| 静态 Public 成员函数 继承自 Game.Widget | |
| static Widget | LoadWidget (object eventsTarget, XElement node, ContainerWidget parentWidget) |
| static bool | TestOverlap (Widget w1, Widget w2) |
| static bool | IsNodeIncludedOnCurrentPlatform (XElement node) |
| static void | UpdateWidgetsHierarchy (Widget rootWidget) |
| static void | LayoutWidgetsHierarchy (Widget rootWidget, Vector2 availableSize) |
| static void | DrawWidgetsHierarchy (Widget rootWidget) |
| static Type | FindTypeFromXmlName (string name, string namespaceName) |
| static Widget | HitTestGlobal (Widget widget, Vector2 point, Func< Widget, bool > predicate) |
| static void | UpdateWidgetsHierarchy (Widget widget, ref bool isMouseCursorVisible) |
Public 属性 | |
| bool | JustOpened |
| bool | MoveNextFlag |
| int | m_caretPosition |
| bool | m_hasFocus |
| Vector2? | m_size |
| float | m_focusStartTime = 0 |
| string | m_text = "" |
| int | m_caret |
| int | m_maximumLength = 512 |
| int | m_maximumLinesCount = 1 |
| float | m_scroll |
| Vector2 | m_sizeValue |
| Public 属性 继承自 Game.Widget | |
| Action< Vector2 > | MeasureOverride1 |
| Action | Update1 |
| bool | m_isVisible |
| bool | m_isEnabled |
| Vector2 | m_actualSize |
| Vector2 | m_desiredSize |
| Vector2 | m_parentDesiredSize |
| BoundingRectangle | m_globalBounds |
| Vector2 | m_parentOffset |
| bool | m_isLayoutTransformIdentity = true |
| bool | m_isRenderTransformIdentity = true |
| Matrix | m_layoutTransform = Matrix.Identity |
| Matrix | m_renderTransform = Matrix.Identity |
| Matrix | m_globalTransform = Matrix.Identity |
| Matrix? | m_invertedGlobalTransform |
| float? | m_globalScale |
| Color | m_colorTransform = Color.White |
| Color | m_globalColorTransform |
| WidgetInput | m_widgetsHierarchyInput |
静态 Public 属性 | |
| static string[] | CharacterKindsMap = ["abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", "0123456789"] |
| 静态 Public 属性 继承自 Game.Widget | |
| static Queue< DrawContext > | m_drawContextsCache = new() |
| static int | LayersLimit = -1 |
| static bool | DrawWidgetBounds = false |
属性 | |
| string | Description [get, set] |
| string | Title [get, set] |
| int | CaretPosition [get, set] |
| string | SelectionString [get] |
| string | FullText [get] |
| string | Text [get, set] |
| string | CompositionText [get, set] |
| int | CompositionTextCaret [get, set] |
| int | Caret [get, set] |
| Queue< UpdateTask > | TasksQueue = [] [get] |
| 每帧执行一次的任务队列。 | |
| int | SelectionLength [get, set] |
| bool | SelectionStarted [get, set] |
| bool | ScrollStarted [get, set] |
| static TextBoxWidget | FocusedTextBox [get, set] |
| double | FocusStartTime [get, set] |
| bool | HasFocus [get, set] |
| double | DragStartTime = -1 [get, set] |
| Vector2? | LastDragPosition [get, set] |
| bool | DragStartedInsideTextBox [get, set] |
| static bool | ShowCandidatesWindow = true [get, set] |
| bool | IndentAsSpace = false [get, set] |
| bool | EnterAsNewLine = false [get, set] |
| int | IndentWidth = 4 [get, set] |
| int | MaximumLength [get, set] |
| int | MaximumLinesCount [get, set] |
| bool | PasswordMode [get, set] |
| bool | OverwriteMode [get, set] |
| bool | SwitchTextBoxWhenTabbed = true [get, set] |
| Color | Color = Color.White [get, set] |
| float | Scroll [get, set] |
| Color | OutlineColor = Color.White [get, set] |
| Color | CandidateSelectionColor = Color.Red [get, set] |
| Color | CandidateTextColor = Color.White [get, set] |
| bool | AutoSize = true [get, set] |
| Vector2 | Size [get, set] |
| Vector2 | FontSpacing [get, set] |
| float | FontScale = 1 [get, set] |
| bool | TextureLinearFilter = true [get, set] |
| Vector2 | CandidateListOffset = new(0, 16) [get, set] |
| float | CandidatesSpacing = 4 [get, set] |
| BitmapFont | Font = ContentManager.Get<BitmapFont>("Fonts/Pericles") [get, set] |
| float | CandidateWindowLength = 128 [get, set] |
| Color | CandidateWindowColor = Color.DarkGray [get, set] |
| static bool | InputMethodEnabled [get, set] |
| static string[] | CandidatesList [get] |
| static int | CandidatesSelection [get] |
| static int | CandidatesPageSize [get] |
| 属性 继承自 Game.Widget | |
| WidgetInput | WidgetsHierarchyInput [get, set] |
| WidgetInput | Input [get] |
| Matrix | LayoutTransform [get, set] |
| Matrix | RenderTransform [get, set] |
| Matrix | GlobalTransform [get] |
| float | GlobalScale [get] |
| Matrix | InvertedGlobalTransform [get] |
| BoundingRectangle | GlobalBounds [get] |
| Color | ColorTransform [get, set] |
| Color | GlobalColorTransform [get] |
| virtual string | Name [get, set] |
| object | Tag [get, set] |
| object | ExtraData [get, set] |
| virtual bool | IsVisible [get, set] |
| virtual bool | IsEnabled [get, set] |
| virtual bool | IsHitTestVisible [get, set] |
| bool | IsVisibleGlobal [get] |
| bool | IsEnabledGlobal [get] |
| bool | ClampToBounds [get, set] |
| virtual Vector2 | Margin [get, set] |
| virtual float | MarginLeft [get, set] |
| virtual float | MarginRight [get, set] |
| virtual float | MarginTop [get, set] |
| virtual float | MarginBottom [get, set] |
| virtual Vector4 | Margin4 [get, set] |
| virtual float | MarginHorizontalSum [get] |
| virtual float | MarginVerticalSum [get] |
| virtual Vector2 | MarginHorizontalSumAndVerticalSum [get] |
| virtual WidgetAlignment | HorizontalAlignment [get, set] |
| virtual WidgetAlignment | VerticalAlignment [get, set] |
| Vector2 | ActualSize [get] |
| Vector2 | DesiredSize [get, set] |
| Vector2 | ParentDesiredSize [get] |
| bool | IsUpdateEnabled = true [get, set] |
| bool | IsDrawEnabled = true [get, set] |
| bool | IsDrawRequired [get, set] |
| bool | IsOverdrawRequired [get, set] |
| XElement | Style [set] |
| ContainerWidget | ParentWidget [get, set] |
| Widget | RootWidget [get] |
事件 | |
| Action< TextBoxWidget > | FocusLost |
| Action< TextBoxWidget > | OnFocus |
| Action< TextBoxWidget > | Enter |
| Action< TextBoxWidget > | Escape |
| Action< TextBoxWidget > | TextChanged |
静态 Private 成员函数 | |
| static | TextBoxWidget () |
| static void | SetCursorPosition (TextBoxWidget widget) |
Survivalcraft Api 所添加的文本框 (支持 Windows IME 输入法, Android IME 适配待开发)。
A text box widget that added by Survivalcraft Api (Support Windows IME, and Android IME support is pending development).
在文件 TextBoxWidget.cs 第 22 行定义.
|
staticprivate |
| Game.TextBoxWidget.TextBoxWidget | ( | ) |
在文件 TextBoxWidget.cs 第 1441 行定义.
| void Game.TextBoxWidget.BackSpace | ( | char? | character = null, |
| int | count = 1, | ||
| bool | moveCaret = true ) |
向左删除字符。
Delete the character on the left of the caret.
| character | 删除的字符,可为 null (为 null 则匹配所有字符)。 Character to delete, can be null (if null then match all characters). |
| count | 删除字符的数量 为 -1 则表示删除所有匹配字符 Number of characters to delete, if -1 then delete all matching characters. |
| moveCaret | 是否移动光标。 Whether to move the caret. |
在文件 TextBoxWidget.cs 第 605 行定义.


| void Game.TextBoxWidget.ChangeTextNoEvent | ( | string | value | ) |
|
static |
| void Game.TextBoxWidget.Delete | ( | char? | character = null, |
| int | count = 1 ) |
向右删除字符。
Delete character on the right of the caret.
| character | 删除的字符,可为 null (为 null 则匹配所有字符)。 Character to delete, can be null (if null then match all characters). |
| count | 删除字符的数量 为 -1 则表示删除所有匹配字符. Number of characters to delete, if -1 then delete all matching characters. |
在文件 TextBoxWidget.cs 第 650 行定义.


| void Game.TextBoxWidget.DeleteSelection | ( | ) |
|
virtual |
|
virtual |
| void Game.TextBoxWidget.EnterCharacter | ( | char | value, |
| int | position = -1, | ||
| bool | moveCaret = true ) |
插入字符。
Enter character.
| value | 插入的字符。 Character to enter. |
| position | 插入的位置,默认为 -1 (-1 表示插入到光标位置)。 Position to enter, default is -1 (-1 means insert at caret position) |
| moveCaret | 是否移动光标。 Whether to move caret. |
在文件 TextBoxWidget.cs 第 453 行定义.


| void Game.TextBoxWidget.EnterText | ( | string | value | ) |
| void Game.TextBoxWidget.EnterText | ( | string | value, |
| int | index ) |
| void Game.TextBoxWidget.LimitScrollValue | ( | ) |
|
virtual |
重载 Game.Widget .
在文件 TextBoxWidget.cs 第 1817 行定义.
|
virtual |
|
staticprivate |
|
static |
|
static |
供 TextBoxWidget 内部使用。
For internal use by TextBoxWidget.
| str | |
| splitPosition |
在文件 TextBoxWidget.cs 第 415 行定义.

|
virtual |
|
virtual |
|
static |
| bool Game.TextBoxWidget.JustOpened |
| int Game.TextBoxWidget.m_caret |
在文件 TextBoxWidget.cs 第 279 行定义.
| int Game.TextBoxWidget.m_caretPosition |
| float Game.TextBoxWidget.m_focusStartTime = 0 |
等效于 FocusStartTime, 现版本不再使用,请用 FocusStartTime 替代。
Is the same as FocusStartTime, now is deprecated, use FocusStartTime instead.
在文件 TextBoxWidget.cs 第 158 行定义.
| bool Game.TextBoxWidget.m_hasFocus |
LegacyTextBoxWidget.HasFocus 的后台字段,现版本不再使用,请用 HasFocus 替代。
The backend field of LegacyTextBoxWidget.HasFocus, now is deprecated, use HasFocus instead.
在文件 TextBoxWidget.cs 第 134 行定义.
| int Game.TextBoxWidget.m_maximumLength = 512 |
MaximumLength 的后台字段, 不推荐直接使用此值,请使用 MaximumLength。
The backend field of MaximumLength, This is not safe to use this field directly, use MaximumLength instead
在文件 TextBoxWidget.cs 第 1168 行定义.
| int Game.TextBoxWidget.m_maximumLinesCount = 1 |
在文件 TextBoxWidget.cs 第 1195 行定义.
| float Game.TextBoxWidget.m_scroll |
在文件 TextBoxWidget.cs 第 1258 行定义.
| Vector2? Game.TextBoxWidget.m_size |
LegacyTextBoxWidget.Size 的后台字段,现版本不再使用。
The backend field of old LegacyTextBoxWidget.Size, now is deprecated.
在文件 TextBoxWidget.cs 第 145 行定义.
| Vector2 Game.TextBoxWidget.m_sizeValue |
| string Game.TextBoxWidget.m_text = "" |
| bool Game.TextBoxWidget.MoveNextFlag |
在文件 TextBoxWidget.cs 第 39 行定义.
|
getset |
如果为 true 则每帧都会由 MeasureOverride 自动确定 Size 的值。
If true, the size will be set by MeasureOverride every frame.
在文件 TextBoxWidget.cs 第 1325 行定义.
|
getset |
候选窗位置偏移量, 原点为光标延长线与文本框下边缘的交点。
Position offset of the candidate list, zero means the intersection point of the bottom outline and the extended line of caret.
在文件 TextBoxWidget.cs 第 1393 行定义.
|
getset |
|
staticget |
所有候选词。 请结合 CandidatesSelection 和 CandidatesPageSize 以获取当前候选词页的候选词。
All candidates. Please get current candidates page's candidates with CandidatesSelection and CandidatesPageSize.
在文件 TextBoxWidget.cs 第 1499 行定义.
|
staticget |
|
staticget |
|
getset |
|
getset |
|
getset |
|
getset |
|
getset |
光标的位置,可被视为 Text 的索引。 绘制时位置为索引对应的字符的左侧,可以与 Text 的长度相等(表示光标在文本末尾)。
Text caret, can be considered as the index of Text. The caret is drawn at the left of the character that corresponds to the index.
在文件 TextBoxWidget.cs 第 291 行定义.
|
getset |
LegacyTextBoxWidget 里的旧版 Caret 属性,现版本不再使用。
Old property of Caret in LegacyTextBoxWidget, now is deprecated.
在文件 TextBoxWidget.cs 第 120 行定义.
|
getset |
在文件 TextBoxWidget.cs 第 1256 行定义.
|
getset |
输入法 “组合窗” 的文本, 可能为 null。
仅在 Windows 平台下可用(Android 平台始终为null)。
IME composition text, may be null.
Windows only (Always null on Android).
在文件 TextBoxWidget.cs 第 257 行定义.
|
getset |
“组合窗” 中光标的位置,可被视为 CompositionText 的索引, 等效于 Caret,但是对应的字符串从 Text 变为了 CompositionText, 若需要使用相对于 FullText 的光标(字符索引),请将此值与 Caret 相加。
仅在 Windows 平台下可用(Android 平台始终为 0)。
IME composition text caret position, can be considered as the index of CompositionText, Is the same as Caret, but replaces Text to CompositionText, To get the index to FullText, add this value and Caret.
Windows only.
在文件 TextBoxWidget.cs 第 277 行定义.
|
getset |
Android 文本框的 Description。
This is the description of android text box.
在文件 TextBoxWidget.cs 第 53 行定义.
|
getset |
|
getset |
Drag 操作开始时 Time.RealTime 的值。
Value of Time.RealTime when drag started.
在文件 TextBoxWidget.cs 第 778 行定义.
|
getset |
是否把回车键视为换行符,而不是视为“输入完毕”的操作。
Considered as new line when typing enter when true, otherwise as “input completed”.
在文件 TextBoxWidget.cs 第 1140 行定义.
|
staticgetset |
|
getset |
最后一次获取焦点的时间(Time.RealTime), 用于绘制光标(请见Draw方法)。
Last focus time(Time.RealTime), used to draw caret(see Draw method).
在文件 TextBoxWidget.cs 第 372 行定义.
|
getset |
|
getset |
|
getset |
|
get |
文本框里包括 Text 和 CompositionText 的完整文本。
The full text of this text box, including CompositionText and Text.
在文件 TextBoxWidget.cs 第 194 行定义.
|
getset |
|
getset |
是否把输入的制表符替换为空格 (不会影响已经输入过的制表符)。
注意:此属性和 SwitchTextBoxWhenTabbed 冲突,二者不能同时为 true,否则只有一个生效。
Whether replace indent with spaces when typing (doesn't change the already inputted).
NOTICE: This property conflicts with SwitchTextBoxWhenTabbed, they cannot be set to true at the same time, otherwise only one will take effect.
在文件 TextBoxWidget.cs 第 1130 行定义.
|
getset |
当 IndentAsSpace 为 true 时,输入的制表符会被替换为空格,空格数量由 IndentWidth 决定。
在绘制时,制表符会被视为这个数量的空格。
When IndentAsSpace is true, inputted indents will be replaced with this number of spaces.
When drawing, indents will be considered as this number of spaces.
在文件 TextBoxWidget.cs 第 1156 行定义.
|
staticgetset |
|
getset |
上一次 Update 方法被执行时 WidgetInput.Drag 的值。
在文件 TextBoxWidget.cs 第 785 行定义.
|
getset |
文本长度限制,设置此属性时会截断超过长度的文本,不可小于 0,若需要设置为无限,请使用 int.MaxValue。
Maximum length of text, the text will be cut when it is longer than this value, the value cannot be less than 0, to set it to infinite, please use int.MaxValue.
在文件 TextBoxWidget.cs 第 1179 行定义.
|
getset |
在文件 TextBoxWidget.cs 第 1197 行定义.
|
getset |
|
getset |
为 true 时,文本框中输入的字符将覆盖已有文本。
When true, characters inputted will overwrite existing text.
在文件 TextBoxWidget.cs 第 1231 行定义.
|
getset |
密码模式,开启后所有文本都会被显示为 *(组合窗除外)。
Password mode, all text but composition text ill be drawn as "*".
在文件 TextBoxWidget.cs 第 1221 行定义.
|
getset |
在文件 TextBoxWidget.cs 第 1260 行定义.
|
getset |
是否正在滚动。(注意:仅指 Drag 引发的滚动)
Whether the text is scrolling.(NOTICE: Only means drag scroll)
在文件 TextBoxWidget.cs 第 350 行定义.
|
getset |
当前选中的文本长度,为 0 则表示不选择任何文本,可以小于 0.
The length of the selected text, 0 means no text is selected, can be less than 0.
在文件 TextBoxWidget.cs 第 330 行定义.
|
getset |
|
get |
选中的字符,当 SelectionLength 为 0 时返回 null。
在文件 TextBoxWidget.cs 第 171 行定义.
|
staticgetset |
|
getset |
输入框大小(不一定是输入框的真实大小,真实大小请见 Widget.ActualSize)。
Text box size (may not be the actual size of the text box, the actual size is Widget.ActualSize)
在文件 TextBoxWidget.cs 第 1345 行定义.
|
getset |
当用户按下 Tab 键时,是否切换到下一个文本框
注意:此属性和 SwitchTextBoxWhenTabbed 冲突,二者不能同时为 true,否则只有一个生效。
If true, when the user presses the tab key, the focus will be switched to the next text box.
NOTICE: This property conflicts with SwitchTextBoxWhenTabbed, they cannot be set to true at the same time, otherwise only one will take effect.
在文件 TextBoxWidget.cs 第 1248 行定义.
|
get |
每帧执行一次的任务队列。
在文件 TextBoxWidget.cs 第 320 行定义.
|
getset |
|
getset |
如果为 true,则字体使用线性过滤。
If true, font will use linear texture filtering.
在文件 TextBoxWidget.cs 第 1381 行定义.
|
getset |
| Action<TextBoxWidget> Game.TextBoxWidget.Enter |
| Action<TextBoxWidget> Game.TextBoxWidget.Escape |
| Action<TextBoxWidget> Game.TextBoxWidget.FocusLost |
| Action<TextBoxWidget> Game.TextBoxWidget.OnFocus |
| Action<TextBoxWidget> Game.TextBoxWidget.TextChanged |