Update some GUI feature in readme.md (#52)

* Update readme.md

* Update readme.md
This commit is contained in:
shacha086
2022-07-26 20:01:14 +08:00
committed by GitHub
parent 987b1bf851
commit 45c4c0e81f

View File

@@ -54,26 +54,26 @@ firstAsync {
Inventories are great for viewing GUI information. However, they are not designed for developing GUIs. The KSpigot
Inventory GUI API provides an easy way to build inventory GUIs the way you would expect such an API to be. In addition,
it offers full type safety for slots.
it offers full type safety for slots. Attention, the Slots is designed from bottom to top, so the page button will be at the bottom of GUI
```kotlin
val gui = kSpigotGUI(GUIType.FIVE_BY_NINE) {
title = "Example Inventory"
title = literalText("Example Inventory")
page(0) {
page(1) {
// slot ranges like rectTo or linTo reduce the amount of code
placeholder(Slots.RowOneSlotOne rectTo Slots.RowFiveSlotNine, ItemStack(Material.RED_STAINED_GLASS))
nextPage(Slots.RowOneSlotNine, ItemStack(Material.PAPER))
}
page(1) {
page(2) {
// define fancy transitions
transitionFrom = PageChangeEffect.SLIDE_HORIZONTALLY
transitionTo = PageChangeEffect.SLIDE_HORIZONTALLY
// get special slot compounds easily with constants like Slots.Border
placeholder(Slots.Border, ItemStack(Material.GLASS_PANE))
// page change buttons
previousPage(Slots.RowTwoSlotTwo, ItemStack(Material.PAPER))
nextPage(Slots.RowTwoSlotEight, ItemStack(Material.PAPER))
@@ -88,7 +88,7 @@ val gui = kSpigotGUI(GUIType.FIVE_BY_NINE) {
freeSlot(Slots.RowTwoSlotFive)
}
page(2) {
page(3) {
// placeholders are there to block any player action while displaying a specific item
placeholder(Slots.RowOneSlotOne rectTo Slots.RowFiveSlotNine, ItemStack(Material.PINK_GLAZED_TERRACOTTA))