11<?php
2- declare (strict_types = 1 );
2+
3+ declare (strict_types=1 );
4+
35namespace Anders \PlayerJoinSettings \API ;
46
57use pocketmine \Player ;
68use pocketmine \network \mcpe \protocol \ModalFormRequestPacket ;
9+ use function json_encode ;
710
8- class ModalForm extends RootUIAPI
9- {
11+ class ModalForm extends RootUIAPI {
1012
1113 public $ id ;
12-
1314 private $ data = [];
14-
1515 private $ content = "" ;
16-
1716 public $ playerName ;
1817
1918 /**
20- * I创建选择性UI
19+ * I创建选择性UI
2120 *
2221 * @param int $id
2322 */
24- public function __construct (int $ id )
25- {
23+ public function __construct (int $ id ) {
2624 parent ::__construct ($ id );
2725 $ this ->data ["type " ] = "modal " ;
2826 $ this ->data ["title " ] = "" ;
@@ -32,13 +30,12 @@ public function __construct(int $id)
3230 }
3331
3432 /**
35- * UI表单发送至玩家
33+ * UI表单发送至玩家
3634 *
3735 * {@inheritdoc}
3836 * @see Anders\PlayerJoinSettings\API\RootUIAPI::sendToPlayer()
3937 */
40- public function sendToPlayer (Player $ player ): void
41- {
38+ public function sendToPlayer (Player $ player ): void {
4239 $ pk = new ModalFormRequestPacket ();
4340 $ pk ->formId = $ this ->id ;
4441 $ pk ->formData = json_encode ($ this ->data );
@@ -47,42 +44,39 @@ public function sendToPlayer(Player $player): void
4744 }
4845
4946 /**
50- * UI 标题
47+ * UI 标题
5148 *
5249 * @param string $title
5350 */
54- public function setTitle (string $ title ): void
55- {
51+ public function setTitle (string $ title ): void {
5652 $ this ->data ["title " ] = $ title ;
5753 }
5854
5955 /**
60- * UI标题
56+ * UI标题
6157 *
6258 * @param string $content
6359 */
64- public function setContent (string $ content ): void
65- {
60+ public function setContent (string $ content ): void {
6661 $ this ->data ["content " ] = $ content ;
6762 }
6863
6964 /**
70- * UI第一个按钮
65+ * UI第一个按钮
7166 *
7267 * @param string $text
7368 */
74- public function setButton1 (string $ text ): void
75- {
69+ public function setButton1 (string $ text ): void {
7670 $ this ->data ["button1 " ] = $ text ;
7771 }
7872
7973 /**
80- * UI 第二个按钮
74+ * UI 第二个按钮
8175 *
8276 * @param string $text
8377 */
84- public function setButton2 (string $ text ): void
85- {
78+ public function setButton2 (string $ text ): void {
8679 $ this ->data ["button2 " ] = $ text ;
8780 }
81+
8882}
0 commit comments