Make ProfilePage more generic

This commit is contained in:
nea
2023-06-02 00:27:53 +02:00
parent 7c60db4fbf
commit b61476608e
3 changed files with 20 additions and 12 deletions

View File

@@ -1,18 +1,10 @@
package moe.nea.firmament.gui.profileviewer
import io.github.cottonmc.cotton.gui.client.LightweightGuiDescription
import io.github.cottonmc.cotton.gui.widget.WGridPanel
import io.github.cottonmc.cotton.gui.widget.WTabPanel
import io.github.cottonmc.cotton.gui.widget.data.Insets
import io.github.cottonmc.cotton.gui.widget.icon.ItemIcon
import java.util.UUID
import net.minecraft.item.Items
import net.minecraft.text.Text
import net.minecraft.util.DyeColor
import moe.nea.firmament.apis.Member
import moe.nea.firmament.apis.Profile
import moe.nea.firmament.gui.WBar
import moe.nea.firmament.util.toShedaniel
class ProfileViewer(
val primaryPlayer: UUID,
@@ -26,10 +18,13 @@ class ProfileViewer(
init {
val panel = WTabPanel().also { rootPanel = it }
panel.backgroundPainter
panel.add(SkillPage.getElements(this)) {
it.icon(ItemIcon(Items.IRON_SWORD))
it.title(Text.translatable("firmament.pv.skills"))
}
listOf<ProfilePage>(SkillPage)
.forEach { page ->
panel.add(page.getElements(this)) {
it.icon(page.icon)
it.tooltip(page.text)
}
}
}
}