https://github.com/OnfireNetwork/dialogui
A very simple ui system for basic dialogs in Onset
https://github.com/OnfireNetwork/dialogui
gui html library lua onset ui
Last synced: about 2 months ago
JSON representation
A very simple ui system for basic dialogs in Onset
- Host: GitHub
- URL: https://github.com/OnfireNetwork/dialogui
- Owner: OnfireNetwork
- License: apache-2.0
- Created: 2019-10-24T18:14:09.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-01-10T16:08:20.000Z (over 4 years ago)
- Last Synced: 2024-11-12T15:43:18.989Z (7 months ago)
- Topics: gui, html, library, lua, onset, ui
- Language: Lua
- Homepage:
- Size: 501 KB
- Stars: 18
- Watchers: 4
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-onset - dialogui - A very simple ui system for basic dialogs in Onset. (Packages and Plugins / Libraries)
README
# DialogUI
A very simple ui system for basic dialogs in Onset## Example
*!!! Make sure to put dialogui before your gamemode in server_config.json or it won't work !!!*
```lua
local Dialog = ImportPackage("dialogui")local test = Dialog.create("New Character", "Choose your character information", "Create", "Cancel")
Dialog.addTextInput(test, 1, "First Name:")
Dialog.addTextInput(test, 1, "Last Name:")
Dialog.addSelect(test, 1, "Gender:", 1, "Male", "Female", "Apache Helicopter")Dialog.show(test)
AddEvent("OnDialogSubmit", function(dialog, button, firstName, lastName, gender)
if dialog ~= test then
return
end
if button == 1 then
AddPlayerChat("Character created:")
AddPlayerChat("First Name = "..firstName)
AddPlayerChat("Last Name = "..lastName)
AddPlayerChat("Gender = "..gender)
else
AddPlayerChat("Cancelled character creation!")
end
end)
```
## Available functions
```lua
create(title, text, ...buttons)
setButtons(dialog, column, ...buttons)
addTextInput(dialog, column, label)
addSelect(dialog, column, label, size, ...options)
setSelectOptions(dialog, column, input, ...options)
setSelectLabeledOptions(dialog, column, input, options)
addCheckbox(dialog, column, label)
setVariable(dialog, name, value)
setAutoclose(dialog, autoclose)
show(dialog)
close()
destroy(dialog)
getCurrent()
isVisible()
setDialogTheme(dialog, theme)
setGlobalTheme(theme)
```## Variables
In some strings you may use variables to dynamically change parts of the text of certain dialogs. This may also be used to dynamically hide or display buttons because buttons with a length of 0 aren't displayed. The syntax for variables is `{some_variable}`## Themes
There are multiple themes and you can create your own ones.
- default-dark
- saitama
- flatTo set the global theme:
```lua
Dialog.setGlobalTheme("flat")
```
To set a theme for just one dialog
```lua
Dialog.setDialogTheme(dialog, "flat")
```