Better sliders
BIN
core/assets-raw/sprites/ui/slider-back.9.png
Normal file
|
After Width: | Height: | Size: 197 B |
|
Before Width: | Height: | Size: 118 B After Width: | Height: | Size: 117 B |
|
Before Width: | Height: | Size: 123 B After Width: | Height: | Size: 120 B |
|
Before Width: | Height: | Size: 122 B After Width: | Height: | Size: 120 B |
|
Before Width: | Height: | Size: 72 B |
@@ -2047,7 +2047,6 @@ public class UnitTypes implements ContentList{
|
|||||||
buildSpeed = 3f;
|
buildSpeed = 3f;
|
||||||
|
|
||||||
abilities.add(new EnergyFieldAbility(35f, 65f, 180f){{
|
abilities.add(new EnergyFieldAbility(35f, 65f, 180f){{
|
||||||
repair = 35f;
|
|
||||||
statusDuration = 60f * 6f;
|
statusDuration = 60f * 6f;
|
||||||
maxTargets = 25;
|
maxTargets = 25;
|
||||||
}});
|
}});
|
||||||
|
|||||||
@@ -16,14 +16,14 @@ import mindustry.type.*;
|
|||||||
public class EnergyFieldAbility extends Ability{
|
public class EnergyFieldAbility extends Ability{
|
||||||
private static final Seq<Healthc> all = new Seq<>();
|
private static final Seq<Healthc> all = new Seq<>();
|
||||||
|
|
||||||
public float damage = 1, repair = 20f, reload = 100, range = 60;
|
public float damage = 1, reload = 100, range = 60;
|
||||||
public Effect healEffect = Fx.heal, hitEffect = Fx.hitLaserBlast, damageEffect = Fx.chainLightning;
|
public Effect healEffect = Fx.heal, hitEffect = Fx.hitLaserBlast, damageEffect = Fx.chainLightning;
|
||||||
public StatusEffect status = StatusEffects.electrified;
|
public StatusEffect status = StatusEffects.electrified;
|
||||||
public float statusDuration = 60f * 6f;
|
public float statusDuration = 60f * 6f;
|
||||||
public float x, y;
|
public float x, y;
|
||||||
public boolean hitBuildings = true;
|
public boolean hitBuildings = true;
|
||||||
public int maxTargets = 25;
|
public int maxTargets = 25;
|
||||||
public float healPercent = 3f;
|
public float healPercent = 2.5f;
|
||||||
|
|
||||||
public float layer = Layer.bullet - 0.001f, blinkScl = 20f;
|
public float layer = Layer.bullet - 0.001f, blinkScl = 20f;
|
||||||
public float effectRadius = 5f, sectorRad = 0.14f, rotateSpeed = 0.5f;
|
public float effectRadius = 5f, sectorRad = 0.14f, rotateSpeed = 0.5f;
|
||||||
|
|||||||
@@ -3,12 +3,15 @@ package mindustry.maps.filters;
|
|||||||
|
|
||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.func.*;
|
import arc.func.*;
|
||||||
|
import arc.scene.event.*;
|
||||||
import arc.scene.style.*;
|
import arc.scene.style.*;
|
||||||
import arc.scene.ui.*;
|
import arc.scene.ui.*;
|
||||||
import arc.scene.ui.layout.*;
|
import arc.scene.ui.layout.*;
|
||||||
|
import arc.util.*;
|
||||||
import mindustry.*;
|
import mindustry.*;
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
|
import mindustry.ui.*;
|
||||||
import mindustry.ui.dialogs.*;
|
import mindustry.ui.dialogs.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
import mindustry.world.blocks.environment.*;
|
import mindustry.world.blocks.environment.*;
|
||||||
@@ -35,7 +38,7 @@ public abstract class FilterOption{
|
|||||||
final Floatc setter;
|
final Floatc setter;
|
||||||
final float min, max, step;
|
final float min, max, step;
|
||||||
|
|
||||||
boolean display;
|
boolean display = true;
|
||||||
|
|
||||||
SliderOption(String name, Floatp getter, Floatc setter, float min, float max){
|
SliderOption(String name, Floatp getter, Floatc setter, float min, float max){
|
||||||
this(name, getter, setter, min, max, (max - min) / 200);
|
this(name, getter, setter, min, max, (max - min) / 200);
|
||||||
@@ -57,19 +60,27 @@ public abstract class FilterOption{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void build(Table table){
|
public void build(Table table){
|
||||||
|
Label label;
|
||||||
if(!display){
|
if(!display){
|
||||||
table.add("@filter.option." + name);
|
label = new Label("@filter.option." + name);
|
||||||
}else{
|
}else{
|
||||||
table.label(() -> Core.bundle.get("filter.option." + name) + ": " + (int)getter.get());
|
label = new Label(() -> Core.bundle.get("filter.option." + name) + ": " + Strings.autoFixed(getter.get(), 2));
|
||||||
}
|
}
|
||||||
table.row();
|
label.setWrap(true);
|
||||||
Slider slider = table.slider(min, max, step, setter).growX().get();
|
label.setAlignment(Align.center);
|
||||||
|
label.touchable = Touchable.disabled;
|
||||||
|
label.setStyle(Styles.outlineLabel);
|
||||||
|
|
||||||
|
Slider slider = new Slider(min, max, step, false);
|
||||||
|
slider.moved(setter);
|
||||||
slider.setValue(getter.get());
|
slider.setValue(getter.get());
|
||||||
if(updateEditorOnChange){
|
if(updateEditorOnChange){
|
||||||
slider.changed(changed);
|
slider.changed(changed);
|
||||||
}else{
|
}else{
|
||||||
slider.released(changed);
|
slider.released(changed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table.stack(slider, label).colspan(2).pad(3).growX().row();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class Styles{
|
|||||||
public static ImageButtonStyle defaulti, nodei, righti, emptyi, emptytogglei, selecti, logici, geni, colori, accenti, cleari, clearFulli, clearPartiali, clearPartial2i, clearTogglei, clearTransi, clearToggleTransi, clearTogglePartiali;
|
public static ImageButtonStyle defaulti, nodei, righti, emptyi, emptytogglei, selecti, logici, geni, colori, accenti, cleari, clearFulli, clearPartiali, clearPartial2i, clearTogglei, clearTransi, clearToggleTransi, clearTogglePartiali;
|
||||||
public static ScrollPaneStyle defaultPane, horizontalPane, smallPane, nonePane;
|
public static ScrollPaneStyle defaultPane, horizontalPane, smallPane, nonePane;
|
||||||
public static KeybindDialog.KeybindDialogStyle defaultKeybindDialog;
|
public static KeybindDialog.KeybindDialogStyle defaultKeybindDialog;
|
||||||
public static SliderStyle defaultSlider, vSlider;
|
public static SliderStyle defaultSlider;
|
||||||
public static LabelStyle defaultLabel, outlineLabel, techLabel;
|
public static LabelStyle defaultLabel, outlineLabel, techLabel;
|
||||||
public static TextFieldStyle defaultField, nodeField, areaField, nodeArea;
|
public static TextFieldStyle defaultField, nodeField, areaField, nodeArea;
|
||||||
public static CheckBoxStyle defaultCheck;
|
public static CheckBoxStyle defaultCheck;
|
||||||
@@ -320,13 +320,7 @@ public class Styles{
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
defaultSlider = new SliderStyle(){{
|
defaultSlider = new SliderStyle(){{
|
||||||
background = slider;
|
background = sliderBack;
|
||||||
knob = sliderKnob;
|
|
||||||
knobOver = sliderKnobOver;
|
|
||||||
knobDown = sliderKnobDown;
|
|
||||||
}};
|
|
||||||
vSlider = new SliderStyle(){{
|
|
||||||
background = sliderVertical;
|
|
||||||
knob = sliderKnob;
|
knob = sliderKnob;
|
||||||
knobOver = sliderKnobOver;
|
knobOver = sliderKnobOver;
|
||||||
knobDown = sliderKnobDown;
|
knobDown = sliderKnobDown;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import arc.func.*;
|
|||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
import arc.graphics.Texture.*;
|
import arc.graphics.Texture.*;
|
||||||
import arc.input.*;
|
import arc.input.*;
|
||||||
|
import arc.scene.event.*;
|
||||||
import arc.scene.ui.*;
|
import arc.scene.ui.*;
|
||||||
import arc.scene.ui.TextButton.*;
|
import arc.scene.ui.TextButton.*;
|
||||||
import arc.scene.ui.layout.*;
|
import arc.scene.ui.layout.*;
|
||||||
@@ -686,23 +687,21 @@ public class SettingsMenuDialog extends Dialog{
|
|||||||
|
|
||||||
slider.setValue(settings.getInt(name));
|
slider.setValue(settings.getInt(name));
|
||||||
|
|
||||||
Label label = new Label(title);
|
Label value = new Label("");
|
||||||
|
value.setStyle(Styles.outlineLabel);
|
||||||
|
value.touchable = Touchable.disabled;
|
||||||
|
|
||||||
slider.changed(() -> {
|
slider.changed(() -> {
|
||||||
settings.put(name, (int)slider.getValue());
|
settings.put(name, (int)slider.getValue());
|
||||||
label.setText(title + ": " + sp.get((int)slider.getValue()));
|
value.setText(title + ": " + sp.get((int)slider.getValue()));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
value.setAlignment(Align.center);
|
||||||
|
value.setWrap(true);
|
||||||
|
|
||||||
slider.change();
|
slider.change();
|
||||||
|
|
||||||
table.table(t -> {
|
table.stack(slider, value).width(420f).left().padTop(4);
|
||||||
t.left().defaults().left();
|
|
||||||
t.add(label).minWidth(label.getPrefWidth() / Scl.scl(1f) + 50);
|
|
||||||
if(Core.graphics.isPortrait()){
|
|
||||||
t.row();
|
|
||||||
}
|
|
||||||
t.add(slider).width(180);
|
|
||||||
}).left().padTop(3);
|
|
||||||
|
|
||||||
table.row();
|
table.row();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,4 +10,4 @@ kapt.include.compile.classpath=false
|
|||||||
kotlin.stdlib.default.dependency=false
|
kotlin.stdlib.default.dependency=false
|
||||||
#needed for android compilation
|
#needed for android compilation
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
archash=52cd02b71205949b68e9b620b6a02fed3622bac0
|
archash=ca3a52e9571ff20f9dd6c43337740539f407d3dd
|
||||||
|
|||||||