本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.Skin类的典型用法代码示例。如果您正苦于以下问题:Java Skin类的具体用法?Java Skin怎么用?Java Skin使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Skin类属于com.badlogic.gdx.scenes.scene2d.ui包,在下文中一共展示了Skin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onFinishedLoading
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //导入依赖的package包/类
private void onFinishedLoading() {
BitmapFont main19Font = assetManager.get(MAIN_FONT_19_PATH());
BitmapFont main22Font = assetManager.get(MAIN_FONT_22_PATH());
BitmapFont letter20Font = assetManager.get(LETTER_FONT_20_PATH());
BitmapFont handwritten20Font = assetManager
.get(HANDWRITTEN_FONT_20_PATH());
ObjectMap<String, Object> fontMap = new ObjectMap<String, Object>();
fontMap.put("main-19", main19Font);
fontMap.put("main-22", main22Font);
fontMap.put("letter-20", letter20Font);
fontMap.put("handwritten-20", handwritten20Font);
assetManager.load(SKIN_PATH, Skin.class,
new SkinLoader.SkinParameter(SKIN_TEXTURE_ATLAS_PATH, fontMap));
assetManager.finishLoadingAsset(SKIN_PATH);
// game.setUISkin(assetManager.get(SKIN_PATH));
VisUI.load();
game.setUISkin(VisUI.getSkin());
// Notify loaded screens
game.getScreen("serverBrowser").finishLoading();
game.pushScreen("mainMenu");
}
示例2: BuildingScoreDialog
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //导入依赖的package包/类
public BuildingScoreDialog(Hexpert hexpert, Skin skin) {
super(hexpert, skin, false);
getContentTable().defaults().pad(15);
Label.LabelStyle lblStyle = skin.get("bigger", Label.LabelStyle.class);
Label lblExplaination = new Label(hexpert.i18NBundle.get("tut_score"), skin);
lblExplaination.setWrap(true);
lblExplaination.setAlignment(Align.center);
getContentTable().add(lblExplaination).colspan(8).width(8*160);
lblExplaination.setWrap(true);
getContentTable().row();
for (int i = 1; i < BuildingType.values().length; i++) {
BuildingType buildingType = BuildingType.values()[i];
Image image = new Image(new TextureRegion((Texture)
hexpert.assetManager.get(SPRITE_FOLDER + buildingType.name().toLowerCase() + "_min.png")));
getContentTable().add(image).width(160).height(160);
Label lblScore = new Label(Integer.toString(buildingType.getScore()), lblStyle);
lblScore.setAlignment(Align.center);
getContentTable().add(lblScore).expand();
if (i % 4 == 0)
getContentTable().row();
}
}
示例3: createResetButton
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //导入依赖的package包/类
private void createResetButton()
{
Skin skin = new Skin();
Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
pixmap.setColor(Color.WHITE);
pixmap.fill();
skin.add("white", new Texture(pixmap));
skin.add("default", new BitmapFont());
TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
textButtonStyle.up = skin.newDrawable("white", new Color(0, 0, 0, 1));
textButtonStyle.font = skin.getFont("default");
skin.add("default", textButtonStyle);
btnReset = new TextButton("RESET", skin);
btnReset.setX(5);
btnReset.setY(Gdx.graphics.getHeight() - 25);
btnReset.setWidth(60);
btnReset.setVisible(true);
group.addActor(btnReset);
}
示例4: createUndoButton
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //导入依赖的package包/类
private void createUndoButton()
{
Skin skin = new Skin();
Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
pixmap.setColor(Color.WHITE);
pixmap.fill();
skin.add("white", new Texture(pixmap));
skin.add("default", new BitmapFont());
TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
textButtonStyle.up = skin.newDrawable("white", new Color(0, 0, 0, 1));
textButtonStyle.font = skin.getFont("default");
skin.add("default", textButtonStyle);
btnUndo = new TextButton("UNDO", skin);
btnUndo.setX(70);
btnUndo.setY(Gdx.graphics.getHeight() - 25);
btnUndo.setWidth(60);
btnUndo.setVisible(true);
group.addActor(btnUndo);
}
示例5: create
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //导入依赖的package包/类
@Override
public void create() {
batch = new SpriteBatch();
// Load the UI skin
skin = new Skin(Gdx.files.internal("skin/uiskin.json"));
clickSound = Gdx.audio.newSound(Gdx.files.internal("sound/buttonClick.mp3"));
menuMusic = Gdx.audio.newMusic(Gdx.files.internal("sound/menuMusic.mp3"));
menuMusic.setLooping(true);
// Load the current account if cached
account = AccountManager.getLocalAccount();
// The first screen that shows up when the game starts
Screen mainScreen = account == null ? new LoginScreen(this) : new MenuScreen(this);
setScreen(mainScreen);
}
示例6: AddWindowButton
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //导入依赖的package包/类
private void AddWindowButton(final UIElement window, String buttonText, Skin skin, Table table)
{
final TextButton btn = new TextButton(buttonText, skin);
btn.addListener(new ChangeListener()
{
@Override
public void changed(ChangeEvent event, Actor actor)
{
if (window.isShowing())
window.hide();
else
window.show();
}
});
table.add(btn);
table.row();
}
示例7: onBuild
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //导入依赖的package包/类
@Override
protected void onBuild(Skin skin) {
btnAddGun = new TextButton("Add Gun Lv.1 ($" + GameSpecs.gun_cost_first
+ ")", skin);
row().fill().expandX();
add(btnAddGun).expandX();
btnAddCanon = new TextButton("Add Canon Lv.1 ($"
+ GameSpecs.canon_cost_first + ")", skin);
row().fill().expandX();
add(btnAddCanon).expandX();
btnAddSlower = new TextButton("Add Slower Lv.1 ($"
+ GameSpecs.slower_cost_first + ")", skin);
row().fill().expandX();
add(btnAddSlower).expandX();
super.onBuild(skin);
}
示例8: GameDialog
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //导入依赖的package包/类
public GameDialog(Skin skin) {
super("", skin);
waveLevel = new Label("", skin);
monsHP = new Label("", skin);
monsBonus = new Label("", skin);
monsSpeed = new Label("", skin);
monsNumber = new Label("", skin);
btnOK = new TextButton("Okay, Let them come!", skin);
btnOK.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
// TODO Auto-generated method stub
setVisible(false);
}
});
setTitle(" There are more monsters are coming to you... ");
}
示例9: ActionDialog
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //导入依赖的package包/类
public ActionDialog(Label text, Action action, I18NBundle bundle, Skin skin, Hexpert hexpert) {
super(hexpert, skin);
this.action = action;
getBackground().setMinWidth(1000);
getBackground().setMinHeight(400);
text.setWrap(true);
text.setAlignment(Align.center);
getContentTable().add(text).width(getBackground().getMinWidth()).expandX();
getButtonTable().defaults().width(200).height(120).pad(15);
TextButton textButtonYes = new TextButton(bundle.get("yes"), skin);
getButtonTable().add(textButtonYes);
setObject(textButtonYes, 1);
TextButton textButtonNo = new TextButton(bundle.get("no"), skin);
getButtonTable().add(textButtonNo);
setObject(textButtonNo, null);
}
示例10: updateVisual
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //导入依赖的package包/类
public void updateVisual(){
Skin skin = new Skin();
Pixmap pixmap = new Pixmap(1,(int)(Gdx.graphics.getHeight()*0.0175), Pixmap.Format.RGBA8888);
switch (infoProfile.getDateUserGame().getFaction()){
case 1:{
pixmap.setColor(1, 0f, 0f, 1);
break;
}
case 2:{
pixmap.setColor(0f, 0.831f, 0.969f,1f);
break;
}
case 3:{
pixmap.setColor(0.129f, 0.996f, 0.29f,1);
break;
}
}
pixmap.fill();
skin.add("blue", new Texture(pixmap));
ProgressBar.ProgressBarStyle style = new ProgressBar.ProgressBarStyle(bar.getStyle().background,skin.newDrawable("blue",Color.WHITE));
style.knobBefore = style.knob;
bar.setStyle(style);
}
示例11: MenuScreen
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //导入依赖的package包/类
public MenuScreen(MainGameClass game) {
this.game = game;
stage = new Stage(new ScreenViewport());
Gdx.input.setInputProcessor(stage);
skin = new Skin(Gdx.files.internal("skins/Flat_Earth_UI_Skin/flatearthui/flat-earth-ui.json"));
progressBarStyle = skin.get("fancy", ProgressBar.ProgressBarStyle.class);
TiledDrawable tiledDrawable = skin.getTiledDrawable("slider-fancy-knob").tint(skin.getColor("selection"));
tiledDrawable.setMinWidth(0);
progressBarStyle.knobBefore = tiledDrawable;
sliderStyle = skin.get("fancy", Slider.SliderStyle.class);
sliderStyle.knobBefore = tiledDrawable;
layoutTable = new Table();
layoutTable.top();
layoutTable.setFillParent(true);
layoutTable.pad(getPixelSizeFromDensityIndependentPixels(50));
}
示例12: TileEffectDialog
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //导入依赖的package包/类
public TileEffectDialog(Hexpert hexpert, Skin skin) {
super(hexpert, skin, false);
getContentTable().defaults().pad(15);
for(int i = 0; i < TileType.values().length; i++)
{
TileType tileType = TileType.values()[i];
Image tileImage = new Image(new TextureRegion((Texture) hexpert.assetManager.get(SPRITE_FOLDER + tileType.name().toLowerCase() + "_tile.png")));
getContentTable().add(tileImage).width(96).height(96);
Label lblDesc = new Label(hexpert.i18NBundle.get(tileType.name().toLowerCase() + "_effect"), skin);
lblDesc.setAlignment(Align.center);
getContentTable().add(lblDesc);
getContentTable().row();
}
}
示例13: initButtons
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //导入依赖的package包/类
public void initButtons(int score,TextureAtlas buttonAtlas) {
Skin buttonSkin = new Skin();
buttonSkin.addRegions(buttonAtlas);
//TODO FIX THIS SHIT INDENTATION
//TODO Long-term fix the magic numbers
ImageButton playButton = new ImageButton(buttonSkin.getDrawable("playbutton"),
buttonSkin.getDrawable("playbutton"));
playButton.setSize(256, 64);
playButton.setPosition(screenSize.width/2-playButton.getWidth()/2,
screenSize.height/2-playButton.getHeight()/2+50);
playButton.addListener(new InputListener() {
@Override
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
polymorph.setScreen(new GameScreen(polymorph));
DeathScreenMusic.stop();
return true;
}
});
stage.addActor(playButton);
}
示例14: StringValueLabel
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //导入依赖的package包/类
public StringValueLabel(CharSequence text, Skin skin, T value)
{
super(text, skin);
this.value = value;
originalText = text.toString();
update();
}
示例15: loadAssets
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //导入依赖的package包/类
public void loadAssets() {
assetManager.clear();
assetManager.load(DATA_PATH + "/skin/skin.json", Skin.class);
for (String directory : imagePacks.keys()) {
FileHandle folder = Gdx.files.local(directory);
for (FileHandle file : folder.list()) {
assetManager.load(file.path(), Pixmap.class);
imagePacks.get(directory).add(file.nameWithoutExtension());
}
}
assetManager.load(DATA_PATH + "/gfx/white.png", Pixmap.class);
assetManager.load(DATA_PATH + "/sfx/coin.wav", Sound.class);
assetManager.load(DATA_PATH + "/sfx/hit.wav", Sound.class);
assetManager.load(DATA_PATH + "/sfx/jump.wav", Sound.class);
}