package net.shadowfacts.phycon.screen.console import net.minecraft.text.TranslatableText import net.shadowfacts.cacao.geometry.Axis import net.shadowfacts.cacao.util.Color import net.shadowfacts.cacao.view.Label import net.shadowfacts.cacao.view.StackView import net.shadowfacts.cacao.viewcontroller.ViewController import net.shadowfacts.kiwidsl.dsl import net.shadowfacts.phycon.network.DeviceBlockEntity /** * @author shadowfacts */ class DeviceDetailsViewController(val device: DeviceBlockEntity): ViewController() { override fun viewDidLoad() { super.viewDidLoad() val stack = StackView(Axis.VERTICAL, StackView.Distribution.LEADING, spacing = 4.0) view.addSubview(stack) val name = device.cachedState.block.name.styled { it.withBold(true) } val deviceNameLabel = Label(name).apply { textColor = Color.TEXT } stack.addArrangedSubview(deviceNameLabel) val ipLabel = Label(TranslatableText("gui.phycon.console.details.ip", device.ipAddress.toString())).apply { textColor = Color.TEXT } stack.addArrangedSubview(ipLabel) val macLabel = Label(TranslatableText("gui.phycon.console.details.mac", device.macAddress.toString())).apply { textColor = Color.TEXT } stack.addArrangedSubview(macLabel) view.solver.dsl { stack.leftAnchor equalTo view.leftAnchor stack.topAnchor equalTo view.topAnchor } } }