update SpellSmithScene selectbox

This commit is contained in:
Anthony Calosa
2023-02-22 06:38:01 +08:00
parent ba27d79ad9
commit f664b001a2
2 changed files with 19 additions and 1 deletions

View File

@@ -2,7 +2,9 @@ package forge.adventure.util;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.GlyphLayout;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.math.Interpolation;
import com.badlogic.gdx.math.Rectangle;
@@ -148,6 +150,15 @@ public class Controls {
return (this.isOver() || hasKeyboardFocus()) && this.getStyle().backgroundOver != null ? this.getStyle().backgroundOver : this.getStyle().background;
}
}
@Override
protected GlyphLayout drawItem(Batch batch, BitmapFont font, T item, float x, float y, float width) {
if (getUserObject() != null && getUserObject() instanceof String) { //currently this is used on spellsmith...
if (((String) getUserObject()).isEmpty())
return super.drawItem(batch, font, (T) Forge.getLocalizer().getMessage("lblSelectingFilter"), x, y, width);
}
return super.drawItem(batch, font, item, x, y, width);
}
};
}
static public SelectBox<Float> newComboBox(Float[] text, float item, Function<Object, Void> func) {