[go: up one dir, main page]

Refactor InSim button handling

The API for button handling is now the following:

  • InSimButton becomes a base class for InSimButtonSingle and InSimButtonMulti.
  • Adding and updating buttons is limited to a single method per button type (add_button() and add_button_multi() for adding, update_button() and update_button_multi() for updating).
  • Deleting buttons requires one or more references to InSimButton objects.
  • Getting buttons returns a single InSimButton or an array of them.

Note that some renames may still happen to better represent single buttons vs multi-buttons, e.g. add_single_button() and update_single_button(), since those only work with InSimButtonSingle. Button classes would be renamed to InSimSingleButton and InSimMultiButton along with this change.

Global buttons are InSimButtonMulti objects assigned to all UCIDs on the server (created with an empty UCID array, or set to global with set_global_button()), the mapped UCIDs are added and removed automatically from people joining or leaving the server, and the global_buttons_restored signal can be used to update newly added global buttons.

Broadcast buttons are InSimButtonSingle objects assigned to UCID 255. They are automatically sent when a player joins the server or when a player requests buttons after hiding them. Since they use UCID 255, they bypass the request to hide buttons, and will be displayed whenever they are sent. Sending broadcast buttons as soon as a player hides buttons is not desirable, as it would effectively prevent them from restoring their own buttons.

Closes #7 (closed).

Note

Renames were applied:

  • Button classes are now InSimSoloButton and InsimMultiButton.
  • Button methods are add_solo_button(), add_multi_button(), update_solo_button(), and update_multi_button().
Edited by Cyril Bissey

Merge request reports

Loading