@@ -4,24 +4,109 @@ import net.minecraft.client.gui.GuiScreen
44import org.polyfrost.oneconfig.api.ui.v1.OCPolyUIBuilder
55import org.polyfrost.oneconfig.api.ui.v1.UIManager
66import org.polyfrost.polyplus.PolyPlusConstants
7+ import org.polyfrost.polyui.animate.SetAnimation
8+ import org.polyfrost.polyui.component.Drawable
9+ import org.polyfrost.polyui.component.extensions.disable
10+ import org.polyfrost.polyui.component.extensions.named
11+ import org.polyfrost.polyui.component.extensions.onChange
12+ import org.polyfrost.polyui.component.extensions.onClick
13+ import org.polyfrost.polyui.component.extensions.onRightClick
14+ import org.polyfrost.polyui.component.extensions.setFont
15+ import org.polyfrost.polyui.component.extensions.withBorder
16+ import org.polyfrost.polyui.component.impl.Block
17+ import org.polyfrost.polyui.component.impl.Group
18+ import org.polyfrost.polyui.component.impl.Image
19+ import org.polyfrost.polyui.component.impl.Text
20+ import org.polyfrost.polyui.component.impl.TextInput
21+ import org.polyfrost.polyui.unit.Align
22+ import org.polyfrost.polyui.unit.Vec2
23+ import org.polyfrost.polyui.utils.image
24+ import kotlin.reflect.KMutableProperty0
725
826object FullscreenLockerUI {
9- private val INTENDED_WIDTH = 1920f
10- private val INTENDED_HEIGHT = 1080f
27+ private const val DESIGNED_WIDTH = 1920f
28+ private const val DESIGNED_HEIGHT = 1080f
29+
30+ private var backArrow: Drawable ? = null
31+ private var forwardArrow: Drawable ? = null
1132
1233 fun create (): GuiScreen {
1334 val uiManager = UIManager .INSTANCE
1435 val builder = OCPolyUIBuilder .create()
1536 .blurs()
16- .atResolution(INTENDED_WIDTH , INTENDED_HEIGHT )
37+ .atResolution(DESIGNED_WIDTH , DESIGNED_HEIGHT )
1738 .renderer(uiManager.renderer)
1839 .translatorDelegate(" assets/${PolyPlusConstants .ID } " )
1940
2041 val polyUI = builder.make(
42+ Group (
43+ // Header
44+ Group (
45+ // Left
46+ Group (
47+ // TODO: Implement navigation history
48+ Image (" assets/oneconfig/ico/left-arrow.svg" .image()).disable().onClick {
49+ // val prev = previous.removeLastOrNull() ?: return@onClick false
50+ // if (previous.isEmpty()) prevArrow?.disable()
51+ // val current = current
52+ // openPage(prev, SetAnimation.SlideRight, addToPrev = false, clearNext = false)
53+ // next.add(current ?: return@onClick false)
54+ // nextArrow?.disable(false)
55+ false
56+ }.named(" Back" ).bindTo(::backArrow),
57+ Image (" assets/oneconfig/ico/right-arrow.svg" .image()).disable().onClick {
58+ // val nextDrawable = next.removeLastOrNull() ?: return@onClick false
59+ // if (next.isEmpty()) nextArrow?.disable()
60+ // openPage(nextDrawable, clearNext = false)
61+ false
62+ }.named(" Forward" ).bindTo(::forwardArrow),
63+ Text (" polyplus.locker.title" , fontSize = 24f ).setFont { semiBold }.named(" Title" ),
64+ alignment = Align (pad = Vec2 (16f , 8f ), wrap = Align .Wrap .NEVER ),
65+ ).named(" Controls" ),
66+
67+ // Right
68+ Block (
69+ Image (" assets/oneconfig/ico/search.svg" .image()).named(" SearchIcon" ),
70+ TextInput (
71+ placeholder = " polyplus.search.placeholder" ,
72+ visibleSize = Vec2 (256f , 32f )
73+ ).onChange { text: String ->
74+ // TODO: Filter cosmetics list based on search input
75+ false
76+ }.named(" SearchInput" )
77+ ).onRightClick {
78+ (this [1 ] as TextInput ).text = " "
79+ }.withBorder(1f ) { page.border5 }.named(" SearchField" )
80+ ),
81+
82+ // Content
83+ Group (
84+ // Cosmetic list
85+ Group (),
86+
87+ // Sidebar
88+ Group (
89+ // Purchasing options
90+ Group (
91+
92+ ),
93+
94+ // Player preview
95+ Group ()
96+ ),
97+ ),
98+
99+ size = Vec2 (1499f , 1080f ),
100+ ),
21101 )
22102
23- val screen = uiManager.createPolyUIScreen(polyUI, INTENDED_WIDTH , INTENDED_HEIGHT , false , true ) { }
103+ val screen = uiManager.createPolyUIScreen(polyUI, DESIGNED_WIDTH , DESIGNED_HEIGHT , false , true ) { }
24104 polyUI.window = uiManager.createWindow()
25105 return screen
26106 }
107+
108+ private fun Drawable.bindTo (ref : KMutableProperty0 <Drawable ?>): Drawable {
109+ ref.set(this )
110+ return this
111+ }
27112}
0 commit comments