当前位置: 首页>>代码示例>>Java>>正文


Java ProgressBar类代码示例

本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.ProgressBar的典型用法代码示例。如果您正苦于以下问题:Java ProgressBar类的具体用法?Java ProgressBar怎么用?Java ProgressBar使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ProgressBar类属于com.badlogic.gdx.scenes.scene2d.ui包,在下文中一共展示了ProgressBar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateVisual

import com.badlogic.gdx.scenes.scene2d.ui.ProgressBar; //导入依赖的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);
}
 
开发者ID:TudorRosca,项目名称:enklave,代码行数:24,代码来源:ProgressBarEnergy.java

示例2: HitPointManaPointDialog

import com.badlogic.gdx.scenes.scene2d.ui.ProgressBar; //导入依赖的package包/类
public HitPointManaPointDialog(UserCharacterDataPacket character)
{

	super(character.getNickname(), Settings.DEFAULT_SKIN);
	this.linkedData = character;
	hitPoints = new ProgressBar(0, CharacterStatsCalculator.getMaxHP(character), 1.0f, false, Settings.DEFAULT_SKIN);
	hitPoints.setColor(new Color(1.0f, 0.2f, 0.2f, 0.9f));
	manaPoints = new ProgressBar(0, CharacterStatsCalculator.getMaxMP(character), 1.0f, false, Settings.DEFAULT_SKIN);
	manaPoints.setColor(new Color(0.2f, 0.2f, 1.0f, 0.9f));
	
	this.getContentTable().row();
	text("HP: ");
	this.getContentTable().add(hitPoints).top().right();
	this.getContentTable().row();
	text("MP: ");
	this.getContentTable().add(manaPoints).top().right();
	update();
}
 
开发者ID:MMORPG-Prototype,项目名称:MMORPG_Prototype,代码行数:19,代码来源:HitPointManaPointDialog.java

示例3: start

import com.badlogic.gdx.scenes.scene2d.ui.ProgressBar; //导入依赖的package包/类
@Override
public void start() {
    finishedLoading = false;
    
    stage = new Stage(new ScreenViewport());
    
    skin = createSkin();
    
    Image image= new Image(skin, "bg");
    image.setScaling(Scaling.stretch);
    image.setFillParent(true);
    stage.addActor(image);
    
    root = new Table();
    root.setFillParent(true);
    stage.addActor(root);
    
    progressBar = new ProgressBar(0, 1, .01f, false, skin);
    progressBar.setAnimateDuration(.1f);
    root.add(progressBar).growX().expandY().pad(20.0f);
}
 
开发者ID:raeleus,项目名称:bobbybird,代码行数:22,代码来源:LoadingState.java

示例4: show

import com.badlogic.gdx.scenes.scene2d.ui.ProgressBar; //导入依赖的package包/类
public void show() {
    if (!init) {
        loadingScreenAssets = new Assets.LoadingScreenAssets();
        AL.getAssetManager().loadAssetFields(loadingScreenAssets);
        AL.getAssetManager().finishLoading();
        font = new BitmapFont();
        batch = new SpriteBatch();

        cam = new OrthographicCamera();
        viewport = new FitViewport(1920, 1080);
        viewport.setCamera(cam);
        stage = new Stage(viewport);
        stage.setViewport(viewport);
        skin = loadingScreenAssets.styles_json;

        loadingScreenBar = new ProgressBar(0, 100, 1, false, skin);
        loadingScreenBar.setPosition(25, -10);
        loadingScreenBar.setSize(1890, 50);

        stage.addActor(loadingScreenBar);
    }
    init = true;
}
 
开发者ID:EtherWorks,项目名称:arcadelegends-gg,代码行数:24,代码来源:DefaultLoadingScreen.java

示例5: MenuScreen

import com.badlogic.gdx.scenes.scene2d.ui.ProgressBar; //导入依赖的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));
}
 
开发者ID:johannesmols,项目名称:GangsterSquirrel,代码行数:22,代码来源:MenuScreen.java

示例6: LoadingStage

import com.badlogic.gdx.scenes.scene2d.ui.ProgressBar; //导入依赖的package包/类
public LoadingStage() {
        GDefence.getInstance().assetLoader.load("MainMenuBg.png", Texture.class);//TODO
        GDefence.getInstance().assetLoader.load("mobHpBarBg.png", Texture.class);
        GDefence.getInstance().assetLoader.load("mobHpBarKnob.png", Texture.class);
//        I18NBundleLoader.I18NBundleParameter param = new I18NBundleLoader.I18NBundleParameter(/*new Locale("ru")*/Locale.US, "UTF-8");//TODO move to another place
//        GDefence.getInstance().assetLoader.load("Language/text", I18NBundle.class, param);
//        GDefence.getInstance().assetLoader.finishLoading();
        GDefence.getInstance().assetLoader.initLang("en");


        Image bg = new Image(GDefence.getInstance().assetLoader.get("MainMenuBg.png", Texture.class));
        addActor(bg);
        loadBar = new ProgressBar(0, 100, 1, false, GDefence.getInstance().assetLoader.getMobHpBarStyle());
        loadBar.setSize(300, 50);
        loadBar.getStyle().background.setMinHeight(loadBar.getHeight());
        loadBar.getStyle().knob.setMinHeight(loadBar.getHeight());
        loadBar.setPosition(Gdx.graphics.getWidth()/2 - loadBar.getWidth()/2, Gdx.graphics.getHeight()/2 - loadBar.getHeight()/2);
        addActor(loadBar);
        I18NBundle b = GDefence.getInstance().assetLoader.get("Language/text", I18NBundle.class);
        Label loading = new Label(b.get("loading"), FontLoader.generateStyle(34, Color.BLACK));//
        loading.setPosition(loadBar.getX() + loadBar.getWidth()/2 - loading.getWidth()/2,
                            loadBar.getY() - loadBar.getHeight());
        addActor(loading);
    }
 
开发者ID:mrDarkHouse,项目名称:GDefence,代码行数:25,代码来源:LoadingStage.java

示例7: setHealth

import com.badlogic.gdx.scenes.scene2d.ui.ProgressBar; //导入依赖的package包/类
protected void setHealth(int health) {
        this.maxHealth = health;
        this.health = health;
        hpBar = new ProgressBar(0, getHealth(), 1, false, GDefence.getInstance().assetLoader.getMobHpBarStyle()/*GDefence.getInstance().assetLoader.getSkin(), "health-bar2"*/);
//        hpBar.getStyle().knob = hpBar.getStyle().knobBefore;

        hpBar.getStyle().background.setMinWidth(getWidth());
        hpBar.getStyle().knobBefore.setMinWidth(getWidth() - 2);
//        hpBar.getStyle().background.setMinHeight(getHeight()/5);//.setSize(getWidth(), getHeight()/5);
//        hpBar.getStyle().knobBefore.setMinHeight(getHeight()/5);

//        hpBar.getStyle().background.setMinHeight(10);
//        hpBar.getStyle().knobBefore.setMinHeight(10 - 2);
////        hpBar.setPosition(getX(), getY());
//        //setPosition(Gdx.graphics.getWidth() - expBarSize[0], userlevelButton.getY() - expBarSize[1] - 4);
////        hpBar.setSize(width, height);
//        hpBar.setValue(getHealth());
//        hpBar.setAnimateDuration(0.5f);
//        hpBar.pack();
//        hpBar.
    }
 
开发者ID:mrDarkHouse,项目名称:GDefence,代码行数:22,代码来源:Mob.java

示例8: create

import com.badlogic.gdx.scenes.scene2d.ui.ProgressBar; //导入依赖的package包/类
private void create()
{
	skin = Global.loadSkin();

	stage = new Stage( new ScreenViewport() );
	batch = new SpriteBatch();

	Table table = new Table();

	label = new Label( "Loading", skin, "title" );
	progressBar = new ProgressBar( 0, 100, 1, false, skin );

	table.add( progressBar ).expand().fillX().bottom().pad( 20 );
	table.row();
	table.add( label ).expand().top().pad( 20 );

	table.setFillParent( true );
	stage.addActor( table );
}
 
开发者ID:infinity8,项目名称:Roguelike,代码行数:20,代码来源:LoadingScreen.java

示例9: RocketMainTable

import com.badlogic.gdx.scenes.scene2d.ui.ProgressBar; //导入依赖的package包/类
public RocketMainTable(Skin skin) {
	setSkin(skin);

	shieldLabel = new Label("", skin);
	add(shieldLabel);
	shieldBar = new ProgressBar(0, 100, 0.1f, false, getSkin());
	add(shieldBar);

	row();
	fuelLabel = new Label("", skin);
	add(fuelLabel);
	fuelBar = new ProgressBar(0, 100, 0.1f, false, getSkin());
	add(fuelBar);

	pack();
}
 
开发者ID:aphex-,项目名称:Alien-Ark,代码行数:17,代码来源:RocketMainTable.java

示例10: process

import com.badlogic.gdx.scenes.scene2d.ui.ProgressBar; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final ProgressBar actor,
        final String rawAttributeData) {
    final ActorConsumer<?, ProgressBar> action = parser.parseAction(rawAttributeData, actor);
    if (action == null) {
        parser.throwErrorIfStrict(
                "Unable to attach listener for " + actor + " with invalid action ID: " + rawAttributeData);
        return;
    }
    actor.addListener(new ChangeListener() {
        @Override
        public void changed(final ChangeEvent event, final Actor widget) {
            if (actor.getValue() >= actor.getMaxValue()) {
                final Object result = action.consume(actor);
                if (result instanceof Boolean && ((Boolean) result).booleanValue()) {
                    actor.removeListener(this);
                }
            }
        }
    });
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:22,代码来源:OnCompleteLmlAtrribute.java

示例11: LoadingScreen

import com.badlogic.gdx.scenes.scene2d.ui.ProgressBar; //导入依赖的package包/类
public LoadingScreen(PongForAndroid game) {
    this.game = game;
    setupAssetManager();
    Skin skin = new Skin(Gdx.files.internal("uiskin.json"));
    stage = new Stage();
    table = new Table();
    table.setFillParent(true);
    BitmapFont loadingFont = getLoadingFont();
    LabelStyle loadingStyle = new LabelStyle(loadingFont, Color.WHITE);
    Label loadLabel = new Label("Loading...", loadingStyle);

    progressBar = new ProgressBar(0, 100, 1, false, skin);
    progressBar.setAnimateDuration(1f);
    progressBar.setAnimateInterpolation(Interpolation.sine);
    table.add(loadLabel);
    table.row();
    table.add(progressBar).left();

    stage.addActor(table);

}
 
开发者ID:justinmeister,项目名称:PongWithLibgdx,代码行数:22,代码来源:LoadingScreen.java

示例12: addNormalWidgets

import com.badlogic.gdx.scenes.scene2d.ui.ProgressBar; //导入依赖的package包/类
private void addNormalWidgets () {
	ProgressBar progressbar = new ProgressBar(0, 100, 1, true, VisUI.getSkin());
	Slider slider = new Slider(0, 100, 1, true, VisUI.getSkin());
	Slider sliderDisabled = new Slider(0, 100, 1, true, VisUI.getSkin());

	progressbar.setValue(50);
	slider.setValue(50);
	sliderDisabled.setValue(50);
	sliderDisabled.setDisabled(true);

	VisTable progressbarTable = new VisTable(true);
	progressbarTable.add(progressbar);
	progressbarTable.add(slider);
	progressbarTable.add(sliderDisabled);

	add(progressbarTable);
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:18,代码来源:TestVertical.java

示例13: EnegryBar

import com.badlogic.gdx.scenes.scene2d.ui.ProgressBar; //导入依赖的package包/类
public EnegryBar(int width, int height, int x, int y) {
    energyBar = new ProgressBar(0, LevelMap.getLevel().getMaxEnergy(), 0.5f, true, /*GDefence.getInstance().assetLoader.getEnergyBarSkin()*/ GDefence.getInstance().assetLoader.getSkin(), "energy-bar");
    energyBar.getStyle().background.setMinWidth(width);
    energyBar.getStyle().knobBefore.setMinWidth(width - 2);
    energyBar.setPosition(x, y);
    //setPosition(Gdx.graphics.getWidth() - expBarSize[0], userlevelButton.getY() - expBarSize[1] - 4);
    energyBar.setSize(width, height);
    energyBar.setValue(LevelMap.getLevel().getEnergyNumber());
    energyBar.setAnimateDuration(0.5f);
    addActor(energyBar);
    initLabel();
}
 
开发者ID:mrDarkHouse,项目名称:GDefence,代码行数:13,代码来源:EnegryBar.java

示例14: init

import com.badlogic.gdx.scenes.scene2d.ui.ProgressBar; //导入依赖的package包/类
public void init(){
        getTitleLabel().setText(tower.getTowerPrototype().getName());

        info = new Label("", skin, "description");
        info.getStyle().font.getData().markupEnabled = true;
        level = new Label("", skin, "description");

        levelString = GDefence.getInstance().assetLoader.getWord("level") + " ";
        levelNum = tower.getTowerPrototype().getLevel();

        final float width = getWidth();
        expBar = new ProgressBar(0, tower.getTowerPrototype().exp2nextLevel()[tower.getTowerPrototype().getLevel() - 1], 0.2f, false,
                GDefence.getInstance().assetLoader.getExpBarSkin()) {
            @Override
            public float getPrefWidth() {
                return width - 10;
            }
        };//add text inside
        expBar.getStyle().background.setMinHeight(20);
        expBar.getStyle().knob.setMinHeight(20);
//        expBar.getStyle().background.setMinWidth(width - 10);
        expBar.getStyle().knob.setMinWidth(0.1f);
//                expBar.setSize(80, 20);//dont work first argument
        expBar.setValue(tower.getTowerPrototype().getCurrentExp());


        add(info).row();
        add(level).align(Align.center).row();
        add(expBar).align(Align.center);


        hasChanged();

        pack();

        tower.getStage().addActor(this);

        setVisible(false);
    }
 
开发者ID:mrDarkHouse,项目名称:GDefence,代码行数:40,代码来源:TowerTooltip.java

示例15: ProgressDialog

import com.badlogic.gdx.scenes.scene2d.ui.ProgressBar; //导入依赖的package包/类
public ProgressDialog(ProgressDialogStyle style) {
	super(style);
	current = new Label("", style.textStyle);
	progressBar = new ProgressBar(0, 1, 1, false, style.progressBarStyle);
	progressBar.setHeight(style.barHeight);
	progressBar.setAnimateDuration(0.1f);
	textLabel = new Label("", style.textStyle);
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:9,代码来源:ProgressDialog.java


注:本文中的com.badlogic.gdx.scenes.scene2d.ui.ProgressBar类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。