resent-1.8/src/main/java/dev/resent/visual/ui/Theme.java

87 lines
2.5 KiB
Java
Raw Normal View History

2023-02-24 09:16:21 -08:00
package dev.resent.visual.ui;
2023-01-19 07:46:26 -08:00
import dev.resent.module.impl.misc.HUD;
2023-02-02 15:03:08 -08:00
import dev.resent.util.render.RenderUtils;
2023-02-24 09:16:21 -08:00
import dev.resent.visual.ui.animation.Animation;
import dev.resent.visual.ui.animation.impl.DecelerateAnimation;
import dev.resent.visual.ui.animation.impl.EaseBackIn;
import dev.resent.visual.ui.animation.impl.EaseInOutQuad;
import dev.resent.visual.ui.animation.impl.ElasticAnimation;
import dev.resent.visual.ui.animation.impl.SmoothStepAnimation;
2023-01-19 07:46:26 -08:00
public class Theme {
2023-02-19 09:39:01 -08:00
public static int getFontColor(int id) {
2023-02-27 18:40:57 -08:00
return getFontColor(getFontId(), 255);
2023-01-19 07:46:26 -08:00
}
2023-02-19 09:39:01 -08:00
public static int getFontColor(int id, int opacity) {
switch (id) {
2023-01-19 07:46:26 -08:00
case 1:
2023-01-19 18:43:42 -08:00
return -1;
2023-01-19 07:46:26 -08:00
case 50:
2023-02-02 15:03:08 -08:00
return RenderUtils.getRainbow(4f, 0.8f, 0.85f);
2023-01-30 18:12:55 -08:00
case 6942069:
return 6942069;
2023-01-19 07:46:26 -08:00
}
return -1;
}
2023-02-19 09:39:01 -08:00
public static Animation getAnimation(int id, int ms, int endpoint, float easeAmount, float elasticity, float smooth, boolean moreElasticity) {
2023-02-27 18:40:57 -08:00
switch (getAnimationId()) {
2023-01-30 15:40:55 -08:00
case 1:
2023-01-30 15:54:29 -08:00
return new EaseBackIn(ms, endpoint, easeAmount);
2023-01-30 15:40:55 -08:00
case 2:
2023-01-30 15:54:29 -08:00
return new ElasticAnimation(ms, endpoint, elasticity, smooth, moreElasticity);
2023-01-30 15:40:55 -08:00
case 3:
return new EaseInOutQuad(ms, endpoint);
case 4:
return new DecelerateAnimation(ms, endpoint);
case 5:
return new SmoothStepAnimation(ms, endpoint);
2023-02-27 18:40:57 -08:00
case 0:
return null;
2023-01-30 15:40:55 -08:00
}
return null;
}
2023-02-19 09:39:01 -08:00
public static int getFontId() {
switch (HUD.fontTheme.getValue()) {
2023-01-19 07:46:26 -08:00
case "Classic":
return 1;
case "Rainbow":
return 50;
2023-01-30 16:41:01 -08:00
case "Chroma":
return 6942069;
2023-01-19 07:46:26 -08:00
}
return -1;
}
2023-01-30 12:26:42 -08:00
2023-02-19 09:39:01 -08:00
public static int getAnimationId() {
switch (HUD.animationTheme.getValue()) {
2023-01-30 15:40:55 -08:00
case "Ease back in":
return 1;
case "Elastic":
return 2;
case "Ease in out quad":
return 3;
case "Decelerate":
return 4;
case "Smooth step":
return 5;
2023-02-27 18:40:57 -08:00
case "None":
return 0;
2023-01-30 15:40:55 -08:00
}
return -1;
}
2023-02-19 09:39:01 -08:00
public static boolean getRounded() {
2023-01-30 12:26:42 -08:00
return HUD.round.getValue();
}
2023-01-30 16:41:01 -08:00
2023-02-19 09:39:01 -08:00
public static boolean getTextShadow() {
2023-01-30 16:41:01 -08:00
return HUD.tshadow.getValue();
}
2023-01-19 07:46:26 -08:00
}