Appearance
RpgGui
List of Prebuilt GUI
Summary
Prebuilt GUI
- Enum:
string
Tag | Description |
---|---|
PrebuiltGui.Dialog | rpg-dialog |
PrebuiltGui.MainMenu | rpg-main-menu |
PrebuiltGui.Shop | rpg-shop |
PrebuiltGui.Disconnect | rpg-disconnect |
PrebuiltGui.Gameover | rpg-gameover |
PrebuiltGui.Save | rpg-save |
PrebuiltGui.Controls | rpg-controls |
PrebuiltGui.Notification | rpg-notification |
- Usage:
Pre-made GUIs already exist. For example, the command player.showText()
displays the rpg-dialog component. It is up to you to customize the component or take advantage of the @rpgjs/default-gui
module which already contains ready-made components
RpgGui API
Get a GUI
- Method:
RpgGui.get(id)
- Arguments:
- {
string
}id
. (Optional:false
)
- {
- Return:
{ data: any, display: boolean }
- Usage:
Get a GUI. You retrieve GUI data and information whether it is displayed or not
ts
import { RpgGui } from '@rpgjs/client'
const gui = RpgGui.get('my-gui')
console.log(gui.display) // false
Get all GUI
- Method:
RpgGui.getAll()
- Return:
{ [guiName]: { data: any, display: boolean } }
- Usage:
Get all GUI. You retrieve GUI data and information whether it is displayed or not
ts
import { RpgGui } from '@rpgjs/client'
const gui = RpgGui.getAll()
console.log(gui) // { 'rpg-dialog': { data: {}, display: true } }
GUI Exists ?
- Method:
RpgGui.exists(id)
- Arguments:
- {
string
}id
. (Optional:false
)
- {
- Return:
boolean
- Usage:
Checks if the GUI exists RpgClient's gui array
ts
import { RpgGui } from '@rpgjs/client'
RpgGui.exists('my-gui') // true
Display GUI
- Method:
RpgGui.display(id,data)
- Arguments:
- {
string
}id
. (Optional:false
) - {
object
}data
. (Optional:true
)
- {
- Return:
void
- Usage:
Calls a GUI according to identifier. You can send retrievable data in the component
ts
import { RpgGui } from '@rpgjs/client'
RpgGui.display('my-gui')
Hide GUI
- Method:
RpgGui.hide(id)
- Arguments:
- {
string
}id
. (Optional:false
)
- {
- Return:
void
- Usage:
Hide a GUI according to its identifier
ts
import { RpgGui } from '@rpgjs/client'
RpgGui.hide('my-gui')