You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- If the return value is `Null`, it means the sending failed.
31
+
- If the return value is `Null`, it means the sending failed.
31
32
32
-
- Parameter `callback` The callback function prototype: `function(player,result)`
33
-
34
-
- player : `Player`
35
-
The player object that interacts with the form.
36
-
37
-
- result : `Boolean`
38
-
Player clicks **Confirm** button is `true`, **Cancel** button is `false`.
39
-
40
-
If the id is `Null`, the player cancels the form.
41
-
42
-
43
-
44
-
### Send a Normal Form to the Player
45
-
46
-
A normal form contains a title, a text display box and several buttons, and the icon displayed on the button can be set.
47
-
Due to the relatively complex content setup of buttons, it is recommended to use the form builder API in the next section to better accomplish this task.
33
+
Parameter `callback` The callback function prototype: `function(player,result,reason)`
34
+
- player : `Player`
35
+
The player object that interacts with the form.
36
+
- result : `Boolean`
37
+
Player clicks **Confirm** button is `true`, **Cancel** button is `false`.
38
+
If the id is `Null`, the player cancels the form.
39
+
- reason : `Integer`
40
+
The reason why the form is closed.
41
+
0 = UserClosed, 1 = UserBusy
42
+
The reason may be `null`.
43
+
44
+
### Send a Normal Form to the Player
45
+
46
+
A normal form contains a title, a text display box and several buttons, and the icon displayed on the button can be
47
+
set.
48
+
Due to the relatively complex content setup of buttons, it is recommended to use the form builder API in the next
The function called after the player clicks a button.
63
-
- Return value: The sent form ID.
53
+
- Parameters:
54
+
55
+
- title : `String`
56
+
Form title.
57
+
- content : `String`
58
+
Form Content.
59
+
- buttons : `Array<String,String,...>`
60
+
String array of individual button texts.
61
+
- images : `Array<String,String,...>`
62
+
Image path corresponding to each button.
63
+
- callback : `Function`
64
+
The function called after the player clicks a button.
65
+
- Return value: The sent form ID.
64
66
- Return value type: `Integer`
65
-
- If the return value is `Null`, it means the sending failed.
66
-
67
-
Parameter `callback` The callback function prototype: `function(player,id)`
67
+
- If the return value is `Null`, it means the sending failed.
68
68
69
+
Parameter `callback` The callback function prototype: `function(player,id,reason)`
69
70
- player : `Player`
70
-
The player object that interacts with the form.
71
+
The player object that interacts with the form.
71
72
- id : `Integer`
72
-
The serial number of the form button that the player clicked, starting from 0.
73
-
If the id is `Null`, the player cancels the form.
74
-
75
-
73
+
The serial number of the form button that the player clicked, starting from 0.
74
+
If the id is `Null`, the player cancels the form.
75
+
- reason : `Integer`
76
+
The reason why the form is closed.
77
+
0 = UserClosed, 1 = UserBusy
78
+
The reason may be `null`.
76
79
77
80
Use the texture pack path or URL `images` to identify the icon corresponding to the button.
78
81
For each button on the form, set the corresponding icon as follows:
@@ -81,30 +84,33 @@ For each button on the form, set the corresponding icon as follows:
81
84
2. If you use a URL path, you can put the full URL here, like `https://www.baidu.com/img/flexible/logo/pc/result.png`
82
85
3. If you don't need to display an image for this button, set the corresponding image path to an empty string.
83
86
84
-
85
-
86
-
### Send Custom Form to Player (JSON Format)
87
+
### Send Custom Form to Player (JSON Format)
87
88
88
89
Custom forms can contain rich custom controls.
89
-
Since the relevant JSON definition format is relatively complex, it is recommended to use the form builder API in the next section to better accomplish this task.
90
+
Since the relevant JSON definition format is relatively complex, it is recommended to use the form builder API in the
91
+
next section to better accomplish this task.
90
92
91
93
`pl.sendCustomForm(json,callback)`
92
94
93
-
- Parameters:
94
-
- json : `String`
95
-
Custom form JSON string.
96
-
- callback : `Function`
97
-
Callback function to be called after the player submits the form.
98
-
- Return value: The sent form ID.
99
-
- Return value type: `Integer`
100
-
- If the return value is Null, it means the sending failed.
101
-
102
-
Parameter `callback` The callback function prototype: `function(player,data)`
95
+
- Parameters:
96
+
- json : `String`
97
+
Custom form JSON string.
98
+
- callback : `Function`
99
+
Callback function to be called after the player submits the form.
100
+
- Return value: The sent form ID.
101
+
- Return value type: `Integer`
102
+
- If the return value is Null, it means the sending failed.
103
103
104
+
Parameter `callback` The callback function prototype: `function(player,data)`
104
105
- player : `Player`
105
-
The player object that interacts with the form.
106
+
The player object that interacts with the form.
106
107
- data : `Array<...>`
107
-
The returned form content array.
108
-
In the array, the first item must be `Null`, starting from the second item, the content of each control is stored in the order of the controls on the form.
109
-
If data is only `Null`, the player cancels the form.
110
-
108
+
The returned form content array.
109
+
In the array, the first item must be `Null`, starting from the second item, the content of each control is stored
110
+
in
111
+
the order of the controls on the form.
112
+
If data is only `Null`, the player cancels the form.
0 commit comments