Skip to content

presentkim-pm/libasynform

Repository files navigation

Poggit CI Stars License


Logo

libasynform

Provides form classes for await-generator!

Contact to me · Report a bug · Request a feature

About The Project

✔️ Provides form classes for await-generator

  • kim\present\libasynform\CustomForm
  • kim\present\libasynform\ModalForm
  • kim\present\libasynform\SimpleForm


Usage

  1. Use static method ::create() to create form object
  2. Fill in the contents using the methods of each form class
  3. Use member method ->send(Player) to send the form to the player

    Don't use Player::sendForm() method yourself

example)

use kim\present\libasynform\CustomForm;
use SOFe\AwaitGenerator\Await;

Await::f2c(function() use($player) : \Generator{
    $recieve = yield from CustomForm::create("OpenMenu")
        ->addToggle("I want open menu", true, "open")
        ->addToggle("I want close menu", false, "close")
        ->addDropdown("I want ", ["close menu", "open menu"], 1, "select")
        ->addInput("I want ", "what do you want", "open menu", "want")
        ->send($player);

    // if player close form, $recieve is null
    // else, below
    var_dump($recieve);
    /*
        array(4) {
            ["open"]=>
            bool(true)
            ["close"]=>
            bool(false)
            ["select"]=>
            int(1)
            ["want"]=>
            string(9) "open menu"
        }
    */
});


Installation

See Official Poggit Virion Documentation


How to use?

See Main Document


License

Distributed under the MIT. See LICENSE for more information


About

Provides form classes for await-generator!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages