Skip to content

Commit 3ad2c03

Browse files
committed
docs: update gui api
1 parent ecac586 commit 3ad2c03

File tree

4 files changed

+39
-19
lines changed

4 files changed

+39
-19
lines changed

docs/apis/GuiAPI/Form.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ for a specific player object `pl`, the following form interfaces are available:
1313

1414
A modal form contains a title, a text display, and two buttons.
1515

16-
`pl.sendModalForm(title,content,confirmButton,cancelButton,callback,forUpdating)`
16+
`pl.sendModalForm(title,content,confirmButton,cancelButton,callback[,forUpdating])`
1717

1818
- Parameters:
1919
- title : `String`
@@ -27,7 +27,7 @@ A modal form contains a title, a text display, and two buttons.
2727
- callback : `Function`
2828
Function called after player clicks a button.
2929
- forUpdating : `Boolean`
30-
Whether the form is sent for updating.
30+
(Optional parameter) Whether the form is sent for updating. The default value is false, meaning it is not for form updating.
3131
- Return value: The ID of the sent form.
3232
- Return value type: `Integer`
3333
- If the return value is `Null`, it means the sending failed.
@@ -51,7 +51,7 @@ set.
5151
Due to the relatively complex content setup of buttons, it is recommended to use the form builder API in the next
5252
section to better accomplish this task.
5353

54-
`pl.sendSimpleForm(title,content,buttons,images,callback,forUpdating)`
54+
`pl.sendSimpleForm(title,content,buttons,images,callback[,forUpdating])`
5555

5656
- Parameters:
5757
- title : `String`
@@ -65,7 +65,7 @@ section to better accomplish this task.
6565
- callback : `Function`
6666
The function called after the player clicks a button.
6767
- forUpdating : `Boolean`
68-
Whether the form is sent for updating.
68+
(Optional parameter) Whether the form is sent for updating. The default value is false, meaning it is not for form updating.
6969
- Return value: The sent form ID.
7070
- Return value type: `Integer`
7171
- If the return value is `Null`, it means the sending failed.
@@ -95,15 +95,15 @@ Custom forms can contain rich custom controls.
9595
Since the relevant JSON definition format is relatively complex, it is recommended to use the form builder API in the
9696
next section to better accomplish this task.
9797

98-
`pl.sendCustomForm(json,callback,forUpdating)`
98+
`pl.sendCustomForm(json,callback[,forUpdating])`
9999

100100
- Parameters:
101101
- json : `String`
102102
Custom form JSON string.
103103
- callback : `Function`
104104
Callback function to be called after the player submits the form.
105105
- forUpdating : `Boolean`
106-
Whether the form is sent for updating.
106+
(Optional parameter) Whether the form is sent for updating. The default value is false, meaning it is not for form updating.
107107
- Return value: The sent form ID.
108108
- Return value type: `Integer`
109109
- If the return value is Null, it means the sending failed.

docs/apis/GuiAPI/Form.zh.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
模式表单包含一个标题、一个文本显示框以及两个按钮
1414

15-
`pl.sendModalForm(title,content,confirmButton,cancelButton,callback,forUpdating)`
15+
`pl.sendModalForm(title,content,confirmButton,cancelButton,callback[,forUpdating])`
1616

1717
- 参数:
1818
- title : `String`
@@ -26,7 +26,7 @@
2626
- callback : `Function`
2727
玩家点击按钮之后被调用的回调函数。
2828
- forUpdating : `Boolean`
29-
是否为表单更新
29+
(可选参数)是否为表单更新,默认值为false,即非表单更新
3030
- 返回值:发送的表单ID
3131
- 返回值类型:`Integer`
3232
- 如果返回值为`Null`,则代表发送失败
@@ -48,7 +48,7 @@
4848
普通表单包含一个标题、一个文本显示框以及若干按钮,可以设置按钮上显示的图标
4949
由于按钮的内容设置相对复杂,建议使用下一节的表单构建器API更好地完成这项任务。
5050

51-
`pl.sendSimpleForm(title,content,buttons,images,callback,forUpdating)`
51+
`pl.sendSimpleForm(title,content,buttons,images,callback[,forUpdating])`
5252

5353
- 参数:
5454
- title : `String`
@@ -62,7 +62,7 @@
6262
- callback : `Function`
6363
玩家点击按钮之后被调用的回调函数。
6464
- forUpdating : `Boolean`
65-
是否为表单更新
65+
(可选参数)是否为表单更新,默认值为false,即非表单更新
6666
- 返回值:发送的表单ID
6767
- 返回值类型:`Integer`
6868
- 如果返回值为`Null`,则代表发送失败
@@ -91,15 +91,15 @@
9191
自定义表单可以包含丰富的自定义控件。
9292
由于相关JSON定义格式相对复杂,建议使用下一节的表单构建器API更好地完成这项任务。
9393

94-
`pl.sendCustomForm(json,callback,forUpdating)`
94+
`pl.sendCustomForm(json,callback[,forUpdating])`
9595

9696
- 参数:
9797
- json : `String`
9898
自定义表单json字符串
9999
- callback : `Function`
100100
玩家提交表单之后被调用的回调函数。
101101
- forUpdating : `Boolean`
102-
是否为表单更新
102+
(可选参数)是否为表单更新,默认值为false,即非表单更新
103103
- 返回值:发送的表单ID
104104
- 返回值类型:`Integer`
105105
- 如果返回值为`Null`,则代表发送失败

docs/apis/GuiAPI/FormBuilder.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ For a player object `pl`, using the function:
101101
- callback : `Function`
102102
Callback function to be called after the player interacts with the form element.
103103
- forUpdating : `Boolean`
104-
Whether the form is sent for updating.
104+
(Optional parameter) Whether the form is sent for updating. The default value is false, meaning it is not for form updating.
105105
- Return value: The sent form ID.
106106
- Return value type: `Integer`
107107
- If the return value is `Null`, it means the sending failed.
@@ -256,6 +256,16 @@ For a specific form object `fm`, the following functions are available:
256256
- Return value: The processed form object (for other operations in the chain).
257257
- Return value type: `CustomForm`
258258

259+
#### Set the Text of the Submit Button
260+
261+
`fm.setSubmitButton(text)`
262+
263+
- Parameters:
264+
- text : `String`
265+
Text of the submit button.
266+
- Return value: The processed form object (for other operations in the chain).
267+
- Return value type: `CustomForm`
268+
259269
### Send Form
260270

261271
Finally, when everything is in place, you can send the configured form object to the player and listen for player
@@ -265,15 +275,15 @@ are called when there is player interaction, without fighting.
265275

266276
For a player object `pl`, using the function:
267277

268-
`pl.sendForm(fm,callback,forUpdating)`
278+
`pl.sendForm(fm,callback[,forUpdating])`
269279

270280
- Parameters:
271281
- fm : `CustomForm`
272282
Configured custom form object.
273283
- callback : `Function`
274284
Callback function to be called after the player submits the form.
275285
- forUpdating : `Boolean`
276-
Whether the form is sent for updating.
286+
(Optional parameter) Whether the form is sent for updating. The default value is false, meaning it is not for form updating.
277287
- Return value: The sent form ID.
278288
- Return value type: `Integer`
279289
- If the return value is `Null`, it means the sending failed.

docs/apis/GuiAPI/FormBuilder.zh.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,15 @@
9393

9494
对于某个玩家对象`pl`,使用函数:
9595

96-
`pl.sendForm(fm,callback,forUpdating)`
96+
`pl.sendForm(fm,callback[,forUpdating])`
9797

9898
- 参数:
9999
- fm : `SimpleForm`
100100
配置好的表单对象
101101
- callback : `Function`
102102
玩家与表单元素互动之后被调用的回调函数。
103103
- forUpdating : `Boolean`
104-
是否为表单更新
104+
(可选参数)是否为表单更新,默认值为false,即非表单更新
105105
- 返回值:发送的表单ID
106106
- 返回值类型:`Integer`
107107
- 如果返回值为`Null`,则代表发送失败
@@ -255,22 +255,32 @@ reason可能会是`null`.
255255
- 返回值:处理完毕的表单对象(便于连锁进行其他操作)
256256
- 返回值类型:`CustomForm`
257257

258+
#### 设置提交按钮的文本
259+
260+
`fm.setSubmitButton(text)`
261+
262+
- 参数:
263+
- text : `String`
264+
提交按钮的文本
265+
- 返回值:处理完毕的表单对象(便于连锁进行其他操作)
266+
- 返回值类型:`CustomForm`
267+
258268
### 发送表单
259269

260270
最后,在一切就绪之后,你可以将配置好的表单对象发送给玩家,并监听玩家的互动消息
261271
表单对象可以被反复发送,每次发送都会返回一个不同的表单ID,并在有玩家互动时调用各自设置的回调函数,不会打架。
262272

263273
对于某个玩家对象`pl`,使用函数:
264274

265-
`pl.sendForm(fm,callback,forUpdating)`
275+
`pl.sendForm(fm,callback[,forUpdating])`
266276

267277
- 参数:
268278
- fm : `CustomForm`
269279
配置好的自定义表单对象
270280
- callback : `Function`
271281
玩家提交表单之后被调用的回调函数。
272282
- forUpdating : `Boolean`
273-
是否为表单更新
283+
(可选参数)是否为表单更新,默认值为false,即非表单更新
274284
- 返回值:发送的表单ID
275285
- 返回值类型:`Integer`
276286
- 如果返回值为`Null`,则代表发送失败

0 commit comments

Comments
 (0)