mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Merge pull request #2529 from kevlahnota/newmaster2
update SpellSmithScene selectbox
This commit is contained in:
@@ -117,6 +117,7 @@ public class SpellSmithScene extends UIScene {
|
|||||||
ui.onButtonPress("BResetEdition", () -> {
|
ui.onButtonPress("BResetEdition", () -> {
|
||||||
editionList.setColor(Color.WHITE);
|
editionList.setColor(Color.WHITE);
|
||||||
edition = "";
|
edition = "";
|
||||||
|
editionList.setUserObject(edition);
|
||||||
filterResults();
|
filterResults();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -267,7 +268,6 @@ public class SpellSmithScene extends UIScene {
|
|||||||
loadEditions(); //just to be safe since it's preloaded, if somehow edition is null, then reload it
|
loadEditions(); //just to be safe since it's preloaded, if somehow edition is null, then reload it
|
||||||
editionList.clearListeners();
|
editionList.clearListeners();
|
||||||
editionList.clearItems();
|
editionList.clearItems();
|
||||||
editionList.showScrollPane();
|
|
||||||
editionList.setItems(editions.toArray(new CardEdition[editions.size()]));
|
editionList.setItems(editions.toArray(new CardEdition[editions.size()]));
|
||||||
editionList.addListener(new ChangeListener() {
|
editionList.addListener(new ChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -278,6 +278,12 @@ public class SpellSmithScene extends UIScene {
|
|||||||
filterResults();
|
filterResults();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
editionList.addListener(new ClickListener() {
|
||||||
|
@Override
|
||||||
|
public void clicked(InputEvent event, float x, float y) {
|
||||||
|
editionList.showScrollPane();
|
||||||
|
}
|
||||||
|
});
|
||||||
editionList.setColor(Color.WHITE);
|
editionList.setColor(Color.WHITE);
|
||||||
filterResults();
|
filterResults();
|
||||||
super.enter();
|
super.enter();
|
||||||
@@ -357,6 +363,7 @@ public class SpellSmithScene extends UIScene {
|
|||||||
pullUsingShards.setText("Pull: " + currentShardPrice + "[+shards]");
|
pullUsingShards.setText("Pull: " + currentShardPrice + "[+shards]");
|
||||||
pullUsingGold.setDisabled(!(cardPool.size() > 0) || Current.player().getGold() < totalCost);
|
pullUsingGold.setDisabled(!(cardPool.size() > 0) || Current.player().getGold() < totalCost);
|
||||||
pullUsingShards.setDisabled(!(cardPool.size() > 0) || Current.player().getShards() < currentShardPrice);
|
pullUsingShards.setDisabled(!(cardPool.size() > 0) || Current.player().getShards() < currentShardPrice);
|
||||||
|
editionList.setUserObject(edition);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pullCard(boolean usingShards) {
|
public void pullCard(boolean usingShards) {
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ package forge.adventure.util;
|
|||||||
|
|
||||||
import com.badlogic.gdx.files.FileHandle;
|
import com.badlogic.gdx.files.FileHandle;
|
||||||
import com.badlogic.gdx.graphics.Color;
|
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.BitmapFont;
|
||||||
|
import com.badlogic.gdx.graphics.g2d.GlyphLayout;
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
||||||
import com.badlogic.gdx.math.Interpolation;
|
import com.badlogic.gdx.math.Interpolation;
|
||||||
import com.badlogic.gdx.math.Rectangle;
|
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;
|
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) {
|
static public SelectBox<Float> newComboBox(Float[] text, float item, Function<Object, Void> func) {
|
||||||
|
|||||||
Reference in New Issue
Block a user