为PocketMine-MP构建的小型表单库

0.7.2 2022-07-23 06:20 UTC

This package is auto-updated.

Last update: 2024-09-16 05:57:32 UTC


README

为PocketMine-MP构建的小型表单库

安装

此库可以使用Composer进行安装

Composer

composer require valiant-bedrock/libforms

Virion (Poggit)

通过Poggit使用此链接可以访问Virion支持。

基本示例

以下是如何使用此库的示例

$form = new \libforms\SimpleForm(
    title: "Hello, World!",
    content: "This is our simple, little form.",
    buttons: [
        new \libforms\buttons\Button(
            text: "Click me!",
            onClick: function (Player $player): void { $player->sendMessage("You clicked it!"); }
        ),
        new \libforms\buttons\ImageButton(
            text: "I'm shinier! Click me!",
            type: \libforms\buttons\image\ImageType::PATH(),
            source: "textures/items/diamond",
            onClick: function (Player $player): void {
                $player->sendMessage("Ooh! Shiny!");
                $player->getInventory()->add(VanillaItems::DIAMOND());
            }
        )
    ]
);

assert($player instanceof \pocketmine\player\Player);
$form->send($player);

Wiki

要了解更多关于此库的信息以及如何使用它,请使用此链接查阅Wiki。

问题/建议

有关此库的问题或建议可以通过此处报告。