66package net.ccbluex.liquidbounce.ui.client.hud.element.elements
77
88import net.ccbluex.liquidbounce.FDPClient.hud
9- import net.ccbluex.liquidbounce.config.IntValue
10- import net.ccbluex.liquidbounce.config.ListValue
119import net.ccbluex.liquidbounce.ui.client.hud.designer.GuiHudDesigner
1210import net.ccbluex.liquidbounce.ui.client.hud.element.Border
1311import net.ccbluex.liquidbounce.ui.client.hud.element.Element
1412import net.ccbluex.liquidbounce.ui.client.hud.element.ElementInfo
1513import net.ccbluex.liquidbounce.ui.client.hud.element.Side
16- import net.ccbluex.liquidbounce.ui.client.hud.element.elements.Notifications.Companion.blue2Value
17- import net.ccbluex.liquidbounce.ui.client.hud.element.elements.Notifications.Companion.blueValue
18- import net.ccbluex.liquidbounce.ui.client.hud.element.elements.Notifications.Companion.green2Value
19- import net.ccbluex.liquidbounce.ui.client.hud.element.elements.Notifications.Companion.greenValue
20- import net.ccbluex.liquidbounce.ui.client.hud.element.elements.Notifications.Companion.red2Value
21- import net.ccbluex.liquidbounce.ui.client.hud.element.elements.Notifications.Companion.redValue
2214import net.ccbluex.liquidbounce.ui.font.Fonts
23- import net.ccbluex.liquidbounce.ui.font.Fonts.fontSemibold35
2415import net.ccbluex.liquidbounce.ui.font.Fonts.fontIconXD85
2516import net.ccbluex.liquidbounce.ui.font.Fonts.fontNovoAngularIcon85
17+ import net.ccbluex.liquidbounce.ui.font.Fonts.fontSFUI35
18+ import net.ccbluex.liquidbounce.ui.font.Fonts.fontSFUI40
19+ import net.ccbluex.liquidbounce.ui.font.Fonts.fontSemibold35
2620import net.ccbluex.liquidbounce.utils.io.APIConnectorUtils
27- import net.ccbluex.liquidbounce.utils.render.shader.UIEffectRenderer.drawShadowWithCustomAlpha
2821import net.ccbluex.liquidbounce.utils.render.RenderUtils
2922import net.ccbluex.liquidbounce.utils.render.RenderUtils.drawRect
3023import net.ccbluex.liquidbounce.utils.render.Stencil
3124import net.ccbluex.liquidbounce.utils.render.animation.AnimationUtil.easeInBackNotify
3225import net.ccbluex.liquidbounce.utils.render.animation.AnimationUtil.easeOutBackNotify
33- import net.ccbluex.liquidbounce.ui.font.Fonts.fontSFUI35
34- import net.ccbluex.liquidbounce.ui.font.Fonts.fontSFUI40
26+ import net.ccbluex.liquidbounce.utils.render.ColorUtils.fade
27+ import net.ccbluex.liquidbounce.utils.client.ClientThemesUtils.getColor
28+ import net.ccbluex.liquidbounce.utils.render.shader.UIEffectRenderer.drawShadowWithCustomAlpha
3529import net.minecraft.client.renderer.GlStateManager
3630import net.minecraft.client.renderer.GlStateManager.resetColor
3731import org.lwjgl.opengl.GL11
@@ -57,24 +51,20 @@ class Notifications(
5751 */
5852 private val exampleNotification = Notification (" Notification" , " This is an example notification." , Type .INFO )
5953
60- companion object {
61- val styleValue by ListValue (" Mode" , arrayOf(" ZAVZ" , " CLASSIC" , " IDE" ), " ZAVZ" )
62- val redValue by IntValue (" Red" , 255 , 0 .. 255 ).apply {
63- setSupport { styleValue == " ZAVZ" } }
64- val greenValue by IntValue (" Green" , 0 , 0 .. 255 ).apply {
65- setSupport { styleValue == " ZAVZ" } }
66- val blueValue by IntValue (" Blue" , 84 , 0 .. 255 ).apply {
67- setSupport { styleValue == " ZAVZ" } }
68- val red2Value by IntValue (" Red2" , 0 , 0 .. 255 ).apply {
69- setSupport { styleValue == " ZAVZ" } }
70- val green2Value by IntValue (" Green2" , 19 , 0 .. 255 ).apply {
71- setSupport { styleValue == " ZAVZ" } }
72- val blue2Value by IntValue (" Blue2" , 0 , 0 .. 255 ).apply {
73- setSupport { styleValue == " ZAVZ" } }
74-
75- val alphaValue by IntValue (" Alpha" , 0 , 0 .. 255 ).apply {
76- setSupport { styleValue == " ZAVZ" } }
77- }
54+ private val styleValue by choices(
55+ " Mode" , arrayOf(" ZAVZ" , " CLASSIC" , " IDE" ), " ZAVZ"
56+ )
57+
58+ private val colorMode by choices(
59+ " Color-Mode" , arrayOf(" Custom" , " Fade" , " Theme" ), " Custom"
60+ )
61+
62+ private val customColor1 by color(" Custom-Color-1" , Color (0xFF0054 ).rgb) { colorMode == " Custom" }
63+ private val customColor2 by color(" Custom-Color-2" , Color (0x001300 ).rgb) { colorMode == " Custom" }
64+
65+ private val fadeColor1 by color(" Fade-Color-1" , Color (0xFF0054 ).rgb) { colorMode == " Fade" }
66+ private val fadeColor2 by color(" Fade-Color-2" , Color (0x001300 ).rgb) { colorMode == " Fade" }
67+ private val fadeDistance by int(" Fade-Distance" , 50 , 0 .. 100 ) { colorMode == " Fade" }
7868
7969 /* *
8070 * Draw element
@@ -84,7 +74,30 @@ class Notifications(
8474 for ((index, notification) in hud.notifications.withIndex()) {
8575 GL11 .glPushMatrix()
8676
87- if (notification.drawNotification(index, Companion , renderX.toFloat(), renderY.toFloat())) {
77+ val color1: Int
78+ val color2: Int
79+
80+ when (colorMode) {
81+ " Custom" -> {
82+ color1 = customColor1.rgb
83+ color2 = customColor2.rgb
84+ }
85+ " Fade" -> {
86+ color1 = fade(fadeColor1, index * fadeDistance, 100 ).rgb
87+ color2 = fade(fadeColor2, index * fadeDistance, 100 ).rgb
88+ }
89+ " Theme" -> {
90+ val themeColor = getColor(index).rgb
91+ color1 = themeColor
92+ color2 = themeColor
93+ }
94+ else -> {
95+ color1 = customColor1.rgb
96+ color2 = customColor2.rgb
97+ }
98+ }
99+
100+ if (notification.drawNotification(index, styleValue, color1, color2)) {
88101 notificationsToRemove.add(notification)
89102 }
90103
@@ -104,7 +117,7 @@ class Notifications(
104117 " IDE" -> Border (- 180F , - 30F , 0F , 0F )
105118 " ZAVZ" -> Border (- 185F , - 30F , 0F , 0F )
106119 " CLASSIC" -> Border (0F , - 30F , 135F , 0F )
107- else -> Border (- exampleNotification.width.toFloat(), exampleNotification.height.toFloat(), 0F , 0F )
120+ else -> Border (- exampleNotification.width.toFloat(), - exampleNotification.height.toFloat(), 0F , 0F )
108121 }
109122 }
110123
@@ -137,12 +150,11 @@ class Notification(
137150 /* *
138151 * Draw notification
139152 */
140- fun drawNotification (index : Int , parent : Notifications . Companion , originalX : Float , originalY : Float ): Boolean {
153+ fun drawNotification (index : Int , style : String , colorValue1 : Int , colorValue2 : Int ): Boolean {
141154 resetColor()
142155 glColor4f(1f , 1f , 1f , 1f )
143156
144157 val nowTime = System .currentTimeMillis()
145- val style = parent.styleValue
146158 val realY = - (index + 1 ) * height
147159 var pct = (nowTime - animeXTime) / animeTime.toDouble()
148160
@@ -193,7 +205,7 @@ class Notification(
193205 }
194206 }
195207
196- drawRect(0F , 0F , width.toFloat(), height.toFloat(), Color (0 , 0 , 0 , parent.alphaValue))
208+ drawRect(0F , 0F , width.toFloat(), height.toFloat(), Color (0 , 0 , 0 , 150 )) // Reduced alpha for better visibility
197209 drawShadowWithCustomAlpha(0F , 0F , width.toFloat(), height.toFloat(), 240f )
198210 drawRect(
199211 0F ,
@@ -395,7 +407,7 @@ class Notification(
395407
396408 // Rendering shapes and elements
397409 RenderUtils .drawShadow(1F , 0F , width.toFloat() - 1 , height.toFloat())
398- drawRect(1F , 0F , width.toFloat(), height.toFloat(), Color (0 , 0 , 0 , 50 ))
410+ drawRect(1F , 0F , width.toFloat(), height.toFloat(), Color (0 , 0 , 0 , 150 )) // Reduced alpha for better visibility
399411
400412 // Draw Circle Function
401413 fun drawCircle (x : Float , y : Float , radius : Float , start : Int , end : Int ) {
@@ -413,8 +425,8 @@ class Notification(
413425 var i = end.toFloat()
414426 while (i >= start) {
415427 val c = RenderUtils .getGradientOffset(
416- Color (redValue, greenValue, blueValue ),
417- Color (red2Value, green2Value, blue2Value, 1 ),
428+ Color (colorValue1 ),
429+ Color (colorValue2, true ),
418430 (abs(System .currentTimeMillis() / 360.0 + (i * 34 / 360 ) * 56 / 100 ) / 10 )
419431 ).rgb
420432 val f2 = (c shr 24 and 255 ).toFloat() / 255.0f
@@ -441,8 +453,8 @@ class Notification(
441453 height.toFloat() + 0.0 ,
442454 width * ((nowTime - displayTime) / (animeTime * 2F + time)) + 0.0 ,
443455 height.toFloat() + 2.0 ,
444- Color (redValue, greenValue, blueValue).rgb ,
445- Color (red2Value, green2Value, blue2Value).rgb
456+ colorValue1 ,
457+ colorValue2
446458 )
447459 drawCircle(16f , 15f , 13f , 0 , 360 )
448460
@@ -483,4 +495,4 @@ enum class Type(var renderColor: Color) {
483495 SUCCESS (Color (0x60E066 )), ERROR (Color (0xFF2F3A )), WARNING (Color (0xF5FD00 )), INFO (Color (106 , 106 , 220 ));
484496}
485497
486- enum class FadeState { IN , STAY , OUT , END }
498+ enum class FadeState { IN , STAY , OUT , END }
0 commit comments