Menu API: Difference between revisions
Appearance
Created page with "Influenced by SourceMod menu, allows to display menus, votes, options, confirmation prompts, alerts, and other interactive dialogs/menus. =MenuItemType enumeration= # '''Spacer'..." |
No edit summary |
||
| (7 intermediate revisions by the same user not shown) | |||
| Line 20: | Line 20: | ||
* string '''Message''' | * string '''Message''' | ||
* string '''CloseButtonLabel''' | * string '''CloseButtonLabel''' | ||
* bool '''CloseOnSelection''' - If enabled, client may close the menu immediately after selection. Otherwise, it should wait for CloseMenu packet. | |||
<br style="clear:both" /> | <br style="clear:both" /> | ||
===MenuYesNo=== | ===MenuYesNo=== | ||
[[Image:VoteConcept.png|frame|Vote dialog concept]][[Image:VoteConceptFallback.png|frame|Vote dialog fallback]] | [[Image:VoteConcept.png|frame|Vote dialog concept]][[Image:VoteConceptFallback.png|frame|Vote dialog fallback]] | ||
A plain-text message with two buttons - one for "Yes", and one for "No". Can be used for votes or confirmation prompts. | A plain-text message with two buttons - one for "Yes", and one for "No". Can be used for votes or confirmation prompts. No close button is shown. | ||
* byte '''OpCode''' | * byte '''OpCode''' | ||
* string '''Message''' | * string '''Message''' - Label to be shown above the two options. Not selectable. | ||
* string '''YesButtonLabel''' | * string '''YesButtonLabel''' - Option 1 | ||
* string '''NoButtonLabel''' | * string '''NoButtonLabel''' - Option 2 | ||
* | * bool '''CloseOnSelection''' - If enabled, client may close the menu immediately after selection. Otherwise, it should wait for CloseMenu packet. | ||
<br style="clear:both" /> | <br style="clear:both" /> | ||
| Line 36: | Line 37: | ||
Fully-featured way to construct menus. Allows customizing each line if the menu. | Fully-featured way to construct menus. Allows customizing each line if the menu. | ||
* byte '''OpCode''' | * byte '''OpCode''' | ||
* | * string '''Message''' | ||
* byte '''MenuItemCount''' | * byte '''MenuItemCount''' | ||
** byte '''MenuItemType''' | ** byte '''MenuItemType''' | ||
** string '''MenuItemLabel''' | ** string '''MenuItemLabel''' | ||
* string '''CloseButtonLabel''' | * string '''CloseButtonLabel''' | ||
* | * bool '''CloseOnSelection''' - If enabled, client may close the menu immediately after selection. Otherwise, it should wait for CloseMenu packet. | ||
===MenuClose=== | ===MenuClose=== | ||
Forces any open menu to close. | Forces any open menu to close. No reply is expected from the client. If no menu is currently open, client can ignore this. | ||
* byte '''OpCode''' | * byte '''OpCode''' | ||
=Packets (Client -> Server)= | =Packets (Client -> Server)= | ||
=== | ===MenuItemSelected=== | ||
* byte '''OpCode''' | * byte '''OpCode''' | ||
* sbyte '''ButtonIndex''' | * sbyte '''ButtonIndex''' | ||
[[Category:Protocol Extensions]] | |||
Latest revision as of 22:07, 9 July 2011
Influenced by SourceMod menu, allows to display menus, votes, options, confirmation prompts, alerts, and other interactive dialogs/menus.
MenuItemType enumeration
- Spacer = empty space
- PlainText = plain white text (cannot be selected)
- Button = button that can be selected
- DisabledButton = grayed-out button that cannot be selected
Button Index Codes
- -2 = Menu was closed by MenuClose packet
- -1 = Menu was closed by user hitting Escape
- 0 = Last button (bottom-most)
- 1, 2, 3.. = Other buttons, starting with the top button.
Packets (Server -> Client)
Notification


Simple plain-text message with a "close" button. Usable for showing server rules, world descriptions, global notifications, etc - any kind of information that the user just needs to read through and close.
- byte OpCode
- string Message
- string CloseButtonLabel
- bool CloseOnSelection - If enabled, client may close the menu immediately after selection. Otherwise, it should wait for CloseMenu packet.
MenuYesNo


A plain-text message with two buttons - one for "Yes", and one for "No". Can be used for votes or confirmation prompts. No close button is shown.
- byte OpCode
- string Message - Label to be shown above the two options. Not selectable.
- string YesButtonLabel - Option 1
- string NoButtonLabel - Option 2
- bool CloseOnSelection - If enabled, client may close the menu immediately after selection. Otherwise, it should wait for CloseMenu packet.
Menu

Fully-featured way to construct menus. Allows customizing each line if the menu.
- byte OpCode
- string Message
- byte MenuItemCount
- byte MenuItemType
- string MenuItemLabel
- string CloseButtonLabel
- bool CloseOnSelection - If enabled, client may close the menu immediately after selection. Otherwise, it should wait for CloseMenu packet.
MenuClose
Forces any open menu to close. No reply is expected from the client. If no menu is currently open, client can ignore this.
- byte OpCode
Packets (Client -> Server)
MenuItemSelected
- byte OpCode
- sbyte ButtonIndex