Upload files to "src/openonyx/ui/internal"
This commit is contained in:
1 parent
3a145fea8f
commit
c4daafb043
5 files changed
+600
No files matched your search
@@ -0,0 +1,135 @@
|
|||||||
|
package openonyx.ui.internal;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
import openonyx.core.OnyxClient;
|
||||||
|
import openonyx.features.Module;
|
||||||
|
import openonyx.features.ModuleCategory;
|
||||||
|
import openonyx.render.Render2D;
|
||||||
|
import openonyx.render.group_e.FontStyle;
|
||||||
|
import openonyx.theme.Fonts;
|
||||||
|
import openonyx.ui.RenderContext;
|
||||||
|
import openonyx.ui.ScrollList;
|
||||||
|
import openonyx.ui.UiComponent;
|
||||||
|
|
||||||
|
public class ModuleList extends ScrollList {
|
||||||
|
private String f = "";
|
||||||
|
private final Consumer<Module> moduleConsumer;
|
||||||
|
private ModuleCategory moduleCategory;
|
||||||
|
|
||||||
|
public void L(String string) {
|
||||||
|
if (!(string = string.trim().toLowerCase(Locale.ROOT)).equals(this.f)) {
|
||||||
|
this.f = string;
|
||||||
|
this.d();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ModuleList(ModuleCategory moduleCategory, Consumer<Module> consumer) {
|
||||||
|
this.moduleConsumer = consumer;
|
||||||
|
this.moduleCategory = moduleCategoryx;
|
||||||
|
this.d();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static float h() {
|
||||||
|
return 5.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ModuleCategory getModuleCategory() {
|
||||||
|
return this.moduleCategory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int i() {
|
||||||
|
return this.uiComponents.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void L(ModuleCategory moduleCategory) {
|
||||||
|
if (this.moduleCategory != moduleCategoryx) {
|
||||||
|
this.moduleCategory = moduleCategoryx;
|
||||||
|
this.d();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(RenderContext renderContext) {
|
||||||
|
if (this.uiComponents.isEmpty()) {
|
||||||
|
Render2D render2D = renderContext.render2D;
|
||||||
|
FontStyle fontStyle = Fonts.getFontstylE15();
|
||||||
|
String string;
|
||||||
|
ModuleList moduleList1;
|
||||||
|
if (this.i()) {
|
||||||
|
string = "No modules match";
|
||||||
|
moduleList1 = this;
|
||||||
|
} else {
|
||||||
|
string = "No modules here yet";
|
||||||
|
moduleList1 = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
render2D.drawTextCenteredVCentered(
|
||||||
|
fontStyle, string, moduleList1.f + this.e / 2.0F, this.d + this.i / 2.0F, renderContext.palette().onSurfaceVariant()
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
super.render(renderContext);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int D() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int L() {
|
||||||
|
return D();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void i(RenderContext renderContext) {
|
||||||
|
ModuleList moduleList1 = this;
|
||||||
|
float k = ModuleRow.I();
|
||||||
|
float h = h();
|
||||||
|
int j = D();
|
||||||
|
float fx = (moduleList1.e - 9.0F - h * (j - 1)) / j;
|
||||||
|
float g = moduleList1.d - moduleList1.animation.getValue();
|
||||||
|
|
||||||
|
int i;
|
||||||
|
for (int l = i = 0; l < moduleList1.uiComponents.size(); l = i) {
|
||||||
|
UiComponent uiComponent = moduleList1.uiComponents.get(i);
|
||||||
|
float m = moduleList1.f + i % j * (fx + h);
|
||||||
|
float n = g + i / j * (k + h);
|
||||||
|
i++;
|
||||||
|
uiComponent.setBounds(m, n, fx, k);
|
||||||
|
}
|
||||||
|
|
||||||
|
moduleList1.I = (i = (moduleList1.uiComponents.size() + j - 1) / j) == 0 ? 0.0F : i * (k + h) - h;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean i() {
|
||||||
|
return !this.f.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Module L() {
|
||||||
|
ModuleList moduleList1 = this;
|
||||||
|
UiComponent uiComponent;
|
||||||
|
return (uiComponent = moduleList1.L()) instanceof ModuleRow ? ((ModuleRow)uiComponent).getModule() : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean L(Module module) {
|
||||||
|
return module.getName().toLowerCase(Locale.ROOT).contains(this.f)
|
||||||
|
|| module.getDescription().toLowerCase(Locale.ROOT).contains(this.f)
|
||||||
|
|| module.getModuleCategory().d().toLowerCase(Locale.ROOT).contains(this.f);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void d() {
|
||||||
|
ModuleList moduleList1 = this;
|
||||||
|
moduleList1.uiComponents.clear();
|
||||||
|
moduleList1.D();
|
||||||
|
moduleList1.m = 0.0F;
|
||||||
|
moduleList1.animation.set(0.0F);
|
||||||
|
|
||||||
|
for (Module module : OnyxClient.moduleManager.getModules()) {
|
||||||
|
boolean bl = moduleList1.i() ? moduleList1.L(module) : module.getModuleCategory() == moduleList1.moduleCategory;
|
||||||
|
if (bl) {
|
||||||
|
moduleList1.uiComponents.add(new ModuleRow(module, moduleList1.moduleConsumer));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
package openonyx.ui.internal;
|
||||||
|
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
import openonyx.features.Module;
|
||||||
|
import openonyx.render.Render2D;
|
||||||
|
import openonyx.render.group_d.ColorAnimation;
|
||||||
|
import openonyx.render.group_d.Easings;
|
||||||
|
import openonyx.theme.Fonts;
|
||||||
|
import openonyx.theme.ThemeManager;
|
||||||
|
import openonyx.ui.RenderContext;
|
||||||
|
import openonyx.ui.UiComponent;
|
||||||
|
import openonyx.ui.UiSupport_545;
|
||||||
|
|
||||||
|
public class ModuleRow extends UiComponent {
|
||||||
|
private final ColorAnimation colorAnimation;
|
||||||
|
private final UiSupport_545 uiSupport_545 = new UiSupport_545();
|
||||||
|
private final Module module;
|
||||||
|
private boolean f;
|
||||||
|
private final Consumer<Module> moduleConsumer;
|
||||||
|
private final ToggleSwitch toggleSwitch;
|
||||||
|
|
||||||
|
public Module getModule() {
|
||||||
|
return this.module;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static float h() {
|
||||||
|
return 12.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(RenderContext renderContext) {
|
||||||
|
Render2D render2D;
|
||||||
|
Render2D render2D1 = render2D = renderContext.render2D;
|
||||||
|
int i = this.module.isEnabled();
|
||||||
|
render2D1.roundedRect(this.f, this.d, this.e, this.i, 12.0F, this.colorAnimation.L());
|
||||||
|
this.uiSupport_545.L(render2D, this.f, this.d, this.e, this.i, 12.0F, renderContext.palette().onSurface());
|
||||||
|
int j = i ? renderContext.palette().onSecondaryContainer() : renderContext.palette().onSurface();
|
||||||
|
i = i ? ThemeManager.withAlpha(renderContext.palette().onSecondaryContainer(), 0.72F) : renderContext.palette().onSurfaceVariant();
|
||||||
|
float g = this.f + h();
|
||||||
|
float fx = this.toggleSwitch.d() - 8.0F - g;
|
||||||
|
render2D.drawTextVCentered(Fonts.getFontstylE14(), render2D.trimToWidth(Fonts.getFontstylE14(), this.module.getName(), fx), g, this.d + this.i * 0.32F, j);
|
||||||
|
render2D.drawTextVCentered(
|
||||||
|
Fonts.getFontstylE2(), render2D.trimToWidth(Fonts.getFontstylE2(), this.module.getDescription(), fx), g, this.d + this.i * 0.7F, i
|
||||||
|
);
|
||||||
|
super.render(renderContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean mouseClicked(float f, float g, int i) {
|
||||||
|
if (this.toggleSwitch.mouseClicked(fx, g, i)) {
|
||||||
|
return true;
|
||||||
|
} else if (!this.contains(fx, g)) {
|
||||||
|
return false;
|
||||||
|
} else if (i == 0) {
|
||||||
|
boolean bl = this.H = true;
|
||||||
|
this.module.toggle();
|
||||||
|
return bl;
|
||||||
|
} else if (i == 1) {
|
||||||
|
this.moduleConsumer.accept(this.module);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(RenderContext renderContext) {
|
||||||
|
super.update(renderContext);
|
||||||
|
int i = this.module.isEnabled() ? renderContext.palette().secondaryContainer() : renderContext.palette().surfaceContainerHigh();
|
||||||
|
if (!this.f) {
|
||||||
|
this.f = true;
|
||||||
|
this.colorAnimation.L(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.colorAnimation.L(i, 250.0F, Easings.EASING6);
|
||||||
|
this.colorAnimation.L(renderContext.i);
|
||||||
|
boolean bl;
|
||||||
|
ModuleRow moduleRow1;
|
||||||
|
if (this.h && !this.toggleSwitch.D()) {
|
||||||
|
bl = true;
|
||||||
|
moduleRow1 = this;
|
||||||
|
} else {
|
||||||
|
bl = false;
|
||||||
|
moduleRow1 = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.uiSupport_545.L(renderContext.i, bl, moduleRow1.H);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ModuleRow(Module module, Consumer<Module> consumer) {
|
||||||
|
this.colorAnimation = new ColorAnimation(0);
|
||||||
|
this.module = modulex;
|
||||||
|
this.moduleConsumer = consumer;
|
||||||
|
this.i = I();
|
||||||
|
this.toggleSwitch = new ToggleSwitch(modulex::isEnabled, modulex::setEnabled);
|
||||||
|
this.uiComponents.add(this.toggleSwitch);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float I() {
|
||||||
|
return 46.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void L() {
|
||||||
|
this.toggleSwitch.L(true);
|
||||||
|
this.toggleSwitch.setBounds(this.f + this.e - 38.0F - h(), this.d + (this.i - 22.0F) / 2.0F, 38.0F, 22.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean mouseReleased(float f, float g, int i) {
|
||||||
|
this.H = false;
|
||||||
|
return super.mouseReleased(fx, g, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,129 @@
|
|||||||
|
package openonyx.ui.internal;
|
||||||
|
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
import openonyx.input.CharInput;
|
||||||
|
import openonyx.render.Render2D;
|
||||||
|
import openonyx.render.group_e.FontStyle;
|
||||||
|
import openonyx.theme.Fonts;
|
||||||
|
import openonyx.theme.ThemeManager;
|
||||||
|
import openonyx.ui.MaterialIcons;
|
||||||
|
import openonyx.ui.RenderContext;
|
||||||
|
import openonyx.ui.UiSupport_545;
|
||||||
|
|
||||||
|
public class ModuleSearch extends TextInput {
|
||||||
|
private final UiSupport_545 uiSupport_545 = new UiSupport_545();
|
||||||
|
public static final float M = 26.0F;
|
||||||
|
private static final float L = 9.0F;
|
||||||
|
private static final float j = 16.0F;
|
||||||
|
private static final float m = 12.0F;
|
||||||
|
private static final float h = 7.0F;
|
||||||
|
private final UiSupport_545 uiSupport_5452 = new UiSupport_545();
|
||||||
|
private static final float I = 2.0F;
|
||||||
|
private static final String f = "Search modules";
|
||||||
|
private static final float H = 22.0F;
|
||||||
|
|
||||||
|
public ModuleSearch(Consumer<String> consumer) {
|
||||||
|
this.i = 26.0F;
|
||||||
|
this.textEditor.L(consumer);
|
||||||
|
this.textEditor.d(() -> this.D(false));
|
||||||
|
this.textEditor.L(() -> {
|
||||||
|
if (!this.l()) {
|
||||||
|
this.D(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean d(float f, float g) {
|
||||||
|
return !this.textEditor.L() && Math.abs(fx - this.F()) <= 11.0F && this.contains(fx, g);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean l() {
|
||||||
|
return this.textEditor.d();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected float h() {
|
||||||
|
return this.textEditor.L() ? this.f + this.e - 9.0F : this.F() - 16.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(RenderContext renderContext) {
|
||||||
|
super.update(renderContext);
|
||||||
|
boolean bl = this.d(renderContext.H, renderContext.f);
|
||||||
|
this.uiSupport_545.L(renderContext.i, this.h && !bl, false);
|
||||||
|
this.uiSupport_5452.L(renderContext.i, bl, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected float l() {
|
||||||
|
return this.e() + 16.0F - 2.0F + 7.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
private float e() {
|
||||||
|
return this.f + 9.0F - 2.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean d(CharInput charInput) {
|
||||||
|
this.D(true);
|
||||||
|
return this.textEditor.L(charInput);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String d() {
|
||||||
|
return this.textEditor.L();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean mouseClicked(float f, float g, int i) {
|
||||||
|
if (i == 0 && this.d(fx, g)) {
|
||||||
|
this.l();
|
||||||
|
this.D(true);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return super.mouseClicked(fx, g, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float k() {
|
||||||
|
return 26.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected FontStyle L() {
|
||||||
|
return Fonts.getFontstylE15();
|
||||||
|
}
|
||||||
|
|
||||||
|
private float F() {
|
||||||
|
return this.f + this.e - 9.0F + 2.0F - 8.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(RenderContext renderContext) {
|
||||||
|
Render2D render2D = renderContext.render2D;
|
||||||
|
renderContext.render2D.roundedRect(this.f, this.d, this.e, this.i, Float.MAX_VALUE, renderContext.palette().surfaceContainerHigh());
|
||||||
|
this.uiSupport_545.L(render2D, this.f, this.d, this.e, this.i, Float.MAX_VALUE, renderContext.palette().onSurface());
|
||||||
|
float fx;
|
||||||
|
if ((fx = this.animation.getValue()) > 0.01F) {
|
||||||
|
render2D.roundedOutline(this.f, this.d, this.e, this.i, Float.MAX_VALUE, 1.5F, ThemeManager.withAlpha(renderContext.palette().primary(), fx));
|
||||||
|
}
|
||||||
|
|
||||||
|
fx = this.d + this.i / 2.0F;
|
||||||
|
MaterialIcons.L(render2D, this.e() + 8.0F, fx, 16.0F, renderContext.palette().onSurfaceVariant());
|
||||||
|
if (this.textEditor.L() && !this.i()) {
|
||||||
|
render2D.drawTextVCentered(this.L(), "Search modules", this.l(), fx, ThemeManager.withAlpha(renderContext.palette().onSurfaceVariant(), 0.7F));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.L(renderContext, fx, 12.0F, renderContext.palette().onSurface());
|
||||||
|
if (!this.textEditor.L()) {
|
||||||
|
this.uiSupport_5452.L(render2D, this.F() - 11.0F, fx - 11.0F, 22.0F, 22.0F, Float.MAX_VALUE, renderContext.palette().onSurface());
|
||||||
|
MaterialIcons.D(render2D, this.F(), fx, 16.0F, renderContext.palette().onSurfaceVariant());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.d(renderContext.H, renderContext.f)) {
|
||||||
|
render2D.usePointerCursor();
|
||||||
|
} else {
|
||||||
|
if (this.h) {
|
||||||
|
render2D.useTextCursor();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
package openonyx.ui.internal;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import openonyx.features.Module;
|
||||||
|
import openonyx.theme.Fonts;
|
||||||
|
import openonyx.ui.RenderContext;
|
||||||
|
import openonyx.ui.ScrollList;
|
||||||
|
|
||||||
|
public class ModuleSettingsPanel extends ScrollList {
|
||||||
|
private static final float l = 460.0F;
|
||||||
|
private final SettingList settingList = new SettingList();
|
||||||
|
private Module module;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(RenderContext renderContext) {
|
||||||
|
if (this.module != null) {
|
||||||
|
if (this.settingList.isEmpty()) {
|
||||||
|
renderContext.render2D
|
||||||
|
.drawTextCenteredVCentered(
|
||||||
|
Fonts.FONT_STYLE15, "This module has no settings", this.f + this.e / 2.0F, this.d + this.i / 2.0F, renderContext.palette().onSurfaceVariant()
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
super.render(renderContext);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Module getModule() {
|
||||||
|
return this.module;
|
||||||
|
}
|
||||||
|
|
||||||
|
private float l() {
|
||||||
|
return Math.min(this.e - 12.0F, 460.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void L(Module module) {
|
||||||
|
if (this.module != modulex) {
|
||||||
|
this.module = modulex;
|
||||||
|
this.uiComponents.clear();
|
||||||
|
this.settingList.clear();
|
||||||
|
this.m = 0.0F;
|
||||||
|
this.animation.set(0.0F);
|
||||||
|
if (modulex != null) {
|
||||||
|
ArrayList arrayList;
|
||||||
|
(arrayList = new ArrayList()).add(modulex.getBind());
|
||||||
|
arrayList.addAll(modulex.getSettings());
|
||||||
|
this.settingList.setSettings(arrayList);
|
||||||
|
this.uiComponents.addAll(this.settingList.getSettingControls());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void D(RenderContext renderContext) {
|
||||||
|
this.settingList.drawDividers(renderContext.render2D, this.h(), this.l(), renderContext.palette().outlineVariant(), 1.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
private float h() {
|
||||||
|
return this.f + (this.e - this.l()) / 2.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void i(RenderContext renderContext) {
|
||||||
|
this.I = this.settingList.layout(this.h(), this.d - this.animation.getValue(), this.l());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,156 @@
|
|||||||
|
package openonyx.ui.internal;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import openonyx.history.internal.EnumSetting;
|
||||||
|
import openonyx.history.internal.MultiEnumSetting;
|
||||||
|
import openonyx.render.Render2D;
|
||||||
|
import openonyx.render.group_d.Animation;
|
||||||
|
import openonyx.render.group_d.Easings;
|
||||||
|
import openonyx.render.group_e.FontStyle;
|
||||||
|
import openonyx.theme.Fonts;
|
||||||
|
import openonyx.theme.ThemeManager;
|
||||||
|
import openonyx.ui.MaterialIcons;
|
||||||
|
import openonyx.ui.RenderContext;
|
||||||
|
|
||||||
|
public class MultiEnumControl<E extends Enum<E>> extends SettingControl {
|
||||||
|
private static final float c = 9.0F;
|
||||||
|
private boolean a;
|
||||||
|
private static final float k = 5.0F;
|
||||||
|
private final List<float[]> list;
|
||||||
|
private static final float M = 12.0F;
|
||||||
|
private static final float L = 23.0F;
|
||||||
|
private final MultiEnumSetting<E> multiEnumSetting;
|
||||||
|
private float m;
|
||||||
|
private final List<Animation> animations;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected float L(RenderContext renderContext) {
|
||||||
|
return this.m;
|
||||||
|
}
|
||||||
|
|
||||||
|
private float L(RenderContext renderContext, int i, float f) {
|
||||||
|
String string = EnumSetting.displayName((Enum<?>)this.multiEnumSetting.getValues().get(i));
|
||||||
|
float g = renderContext.render2D.getTextWidth(Fonts.FONT_STYLE16, string);
|
||||||
|
return 18.0F + g + 16.0F * f;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean mouseClicked(float f, float g, int i) {
|
||||||
|
MultiEnumControl multiEnumControl1 = this;
|
||||||
|
if (multiEnumControl1.i() && i == 0) {
|
||||||
|
for (int j = i = 0; j < multiEnumControl1.list.size(); j = ++i) {
|
||||||
|
float[] h = multiEnumControl1.list.get(i);
|
||||||
|
if (f >= h[0] && f < h[0] + h[2] && g >= h[1] && g < h[1] + 23.0F) {
|
||||||
|
multiEnumControl1.multiEnumSetting.toggle(multiEnumControl1.multiEnumSetting.getValues().get(i));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public MultiEnumControl(MultiEnumSetting<E> multiEnumSetting) {
|
||||||
|
int j = 3 & 4;
|
||||||
|
super(multiEnumSettingx);
|
||||||
|
this.animations = new ArrayList<>();
|
||||||
|
this.list = new ArrayList<>();
|
||||||
|
this.m = 50.0F;
|
||||||
|
this.multiEnumSetting = multiEnumSettingx;
|
||||||
|
|
||||||
|
for (int i = j; j < multiEnumSettingx.getValues().size(); j = i) {
|
||||||
|
this.animations.add(new Animation(0.0F));
|
||||||
|
float[] f = new float[3];
|
||||||
|
boolean bl = true;
|
||||||
|
f[0] = 0.0F;
|
||||||
|
f[1] = 0.0F;
|
||||||
|
i++;
|
||||||
|
f[2] = 0.0F;
|
||||||
|
this.list.add(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(RenderContext renderContext) {
|
||||||
|
MultiEnumControl multiEnumControl1 = this;
|
||||||
|
multiEnumControl1.update(renderContext);
|
||||||
|
float h = multiEnumControl1.f;
|
||||||
|
float g = multiEnumControl1.l();
|
||||||
|
float f = 23.0F;
|
||||||
|
|
||||||
|
for (int kx = i = 0; kx < multiEnumControl1.multiEnumSetting.getValues().size(); kx = i) {
|
||||||
|
boolean bl = multiEnumControl1.multiEnumSetting.contains(multiEnumControl1.multiEnumSetting.getValues().get(i));
|
||||||
|
Animation animation = multiEnumControl1.animations.get(i);
|
||||||
|
Animation animation1;
|
||||||
|
if (!multiEnumControl1.a) {
|
||||||
|
animation.set(bl ? 1.0F : 0.0F);
|
||||||
|
animation1 = animation;
|
||||||
|
} else {
|
||||||
|
if (animation.getTarget() != (bl ? 1.0F : 0.0F)) {
|
||||||
|
animation.animateTo(bl ? 1.0F : 0.0F, 250.0F, Easings.EASING2);
|
||||||
|
}
|
||||||
|
|
||||||
|
animation1 = animation;
|
||||||
|
}
|
||||||
|
|
||||||
|
animation1.update(renderContext.i);
|
||||||
|
float j = multiEnumControl1.L(renderContext, i, animation.getValue());
|
||||||
|
if (h > multiEnumControl1.f && h + j > multiEnumControl1.f + multiEnumControl1.e) {
|
||||||
|
h = multiEnumControl1.f;
|
||||||
|
g += f + 5.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
multiEnumControl1.list.get(i)[0] = h;
|
||||||
|
multiEnumControl1.list.get(i)[1] = g;
|
||||||
|
multiEnumControl1.list.get(i)[2] = j;
|
||||||
|
i++;
|
||||||
|
h += j + 5.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
multiEnumControl1.a = true;
|
||||||
|
multiEnumControl1.m = g + f + 6.0F - multiEnumControl1.d;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void d(RenderContext renderContext, float o) {
|
||||||
|
MultiEnumControl multiEnumControl1 = this;
|
||||||
|
Render2D render2D = renderContext.render2D;
|
||||||
|
int mx = 0;
|
||||||
|
multiEnumControl1.L(renderContext, multiEnumControl1.e);
|
||||||
|
|
||||||
|
for (int i = 0; mx < multiEnumControl1.multiEnumSetting.getValues().size(); mx = i) {
|
||||||
|
float[] kx = multiEnumControl1.list.get(i);
|
||||||
|
float f = multiEnumControl1.animations.get(i).getValue();
|
||||||
|
float l = kx[0];
|
||||||
|
float g = kx[1];
|
||||||
|
float h = kx[2];
|
||||||
|
int j = renderContext.H >= l && renderContext.H < l + h && renderContext.f >= g && renderContext.f < g + 23.0F;
|
||||||
|
if (f > 0.01F) {
|
||||||
|
render2D.roundedRect(l, g, h, 23.0F, 8.0F, multiEnumControl1.L(ThemeManager.withAlpha(renderContext.palette().secondaryContainer(), f)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (f < 0.99F) {
|
||||||
|
render2D.roundedOutline(l, g, h, 23.0F, 8.0F, 1.0F, multiEnumControl1.L(ThemeManager.withAlpha(renderContext.palette().outline(), 1.0F - f)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (j) {
|
||||||
|
render2D.roundedRect(l, g, h, 23.0F, 8.0F, multiEnumControl1.L(ThemeManager.withAlpha(renderContext.palette().onSurface(), 0.08F)));
|
||||||
|
}
|
||||||
|
|
||||||
|
h = l + 9.0F + 16.0F * f;
|
||||||
|
j = f > 0.5F ? renderContext.palette().onSecondaryContainer() : renderContext.palette().onSurfaceVariant();
|
||||||
|
if (f > 0.05F) {
|
||||||
|
MaterialIcons.d(render2D, l + 9.0F + 6.0F, g + 11.5F, 12.0F * (0.7F + 0.3F * f), multiEnumControl1.L(ThemeManager.withAlpha(j, f)));
|
||||||
|
}
|
||||||
|
|
||||||
|
FontStyle fontStyle = Fonts.FONT_STYLE16;
|
||||||
|
String string = EnumSetting.displayName((Enum<?>)multiEnumControl1.multiEnumSetting.getValues().get(i));
|
||||||
|
float n = g + 11.5F;
|
||||||
|
i++;
|
||||||
|
render2D.drawTextVCentered(fontStyle, string, h, n, multiEnumControl1.L(j));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user