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


Java ProgressBar.ProgressBarStyle方法代码示例

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


在下文中一共展示了ProgressBar.ProgressBarStyle方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: onProcessingFinished

import com.badlogic.gdx.scenes.scene2d.ui.ProgressBar; //导入方法依赖的package包/类
@Override
public void onProcessingFinished() {
    btnClose.setDisabled(false);
    btnClose.setColor(Color.WHITE);

    FocusManager.switchFocus(stage, btnClose);

    window.closeOnEscape();

    if (!errors && cbAutoClose.isChecked()) {
        window.hide();
        showReopenLastDialogNotification();
    }

    // If there is only one pack, show log on error
    if (errors && adapter.size() == 1) {
        adapter.getView(adapter.get(0)).showLogWindow();
    }

    // Indicate total result by changing progress bar color
    {
        ProgressBar.ProgressBarStyle style = new ProgressBar.ProgressBarStyle(progressBar.getStyle());
        Drawable fill = errors ?
                VisUI.getSkin().getDrawable("progressBarErr") :
                VisUI.getSkin().getDrawable("progressBarSucc");
        style.knob = fill;
        style.knobBefore = fill;
        progressBar.setStyle(style);
    }
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:31,代码来源:PackDialogController.java

示例3: DrawOneAttachers

import com.badlogic.gdx.scenes.scene2d.ui.ProgressBar; //导入方法依赖的package包/类
private Group DrawOneAttachers(String typeFrame, String name, Color type, String photo, float energy,float energymax) {
    Group gr = new Group();
    Texture txt = managerAssets.getAssetsCombat().getTexture(typeFrame);
    Vector2 crop = Scaling.fit.apply(txt.getWidth(),txt.getHeight(),WIDTH,HEIGHT);
    final Image frame = new Image(new TextureRegion(txt));
    frame.setName("frame");
    frame.setSize(crop.x * 0.18f, crop.y * 0.2f);
    frame.setPosition(WIDTH - frame.getWidth() * 1.13f, HEIGHT / 2.3f);
    gr.addActor(frame);
    if(InformationProfile.getInstance().getDateUserGame().getFaction() != InformationEnklave.getInstance().getFaction())
        txt = managerAssets.getAssetsCombat().getTexture(NameFiles.targetRecharge);
    else
        txt = managerAssets.getAssetsCombat().getTexture(NameFiles.target);
    crop = Scaling.fit.apply(txt.getWidth(), txt.getHeight(), WIDTH, HEIGHT);
    Image frameselect = new Image(new TextureRegion(txt));
    frameselect.setSize(crop.x * 0.18f, crop.y * 0.2f);
    frameselect.setName("frameselect");
    frameselect.toFront();
    frameselect.setPosition(WIDTH - frame.getWidth() * 1.13f, HEIGHT / 2.3f);
    frameselect.setVisible(false);
    gr.addActor(frameselect);
    Label labelName = new Label(name.substring(0,name.length()>9 ? 9 : name.length()), new Label.LabelStyle(bt, type));
    labelName.setAlignment(Align.center);
    labelName.setWidth(crop.x*0.18f);
    labelName.setPosition(frame.getX(), frame.getY() + frame.getHeight() * 0.25f);
    gr.addActor(labelName);
    txt = managerAssets.getAssetsCombat().getTexture(photo);
    crop = Scaling.fit.apply(txt.getWidth(), txt.getHeight(), WIDTH, HEIGHT);
    Image profile = new Image(new TextureRegion(txt));
    profile.setColor(type);
    profile.setSize(crop.x * 0.07f, crop.y * 0.07f);
    profile.setPosition(frame.getRight() - frame.getWidth() / 2 - profile.getWidth() / 2, frame.getY() + frame.getHeight() * 0.42f);
    gr.addActor(profile);
    Skin skin = new Skin();
    skin.add("white", new TextureRegion(managerAssets.getAssetsCombat().getTexture(NameFiles.barLifeWhite), 0, 0, (int) (WIDTH * 0.014), (int) (WIDTH * 0.014)));
    ProgressBar.ProgressBarStyle barStyle = new ProgressBar.ProgressBarStyle(skin.newDrawable("white", Color.WHITE), skin.newDrawable("white", type));
    barStyle.knobBefore = barStyle.knob;
    ProgressBar bar = new ProgressBar(0,energymax, 1, false, barStyle);
    bar.setSize(WIDTH * 0.14f,HEIGHT * 0.012f);
    bar.setPosition(frame.getX() + frame.getWidth() * 0.07f, frame.getY() + frame.getHeight() * 0.07f);
    bar.setValue(energy);
    gr.addActor(bar);
    return gr;
}
 
开发者ID:TudorRosca,项目名称:enklave,代码行数:45,代码来源:DrawAttachers.java

示例4: drawoneDefenders

import com.badlogic.gdx.scenes.scene2d.ui.ProgressBar; //导入方法依赖的package包/类
private Group drawoneDefenders(String typeFrame,String name,Color type,String photo,float energy,float energymax){
        Group gr = new Group();
        Texture txt = managerAssets.getAssetsCombat().getTexture(typeFrame);
        Vector2 crop = Scaling.fit.apply(txt.getWidth(), txt.getHeight(), WIDTH, HEIGHT);
        Image frame = new Image(new TextureRegion(txt));
        frame.setName("frame");
        frame.setSize(crop.x * 0.18f, crop.y * 0.2f);
        frame.setPosition(WIDTH * 0.025f, HEIGHT / 2.3f);
        gr.addActor(frame);
        if(InformationProfile.getInstance().getDateUserGame().getFaction() == InformationEnklave.getInstance().getFaction())
            txt = managerAssets.getAssetsCombat().getTexture(NameFiles.targetRecharge);
        else
            txt = managerAssets.getAssetsCombat().getTexture(NameFiles.target);
        crop = Scaling.fit.apply(txt.getWidth(), txt.getHeight(), WIDTH, HEIGHT);
        Image frameselect = new Image(new TextureRegion(txt));
        frameselect.setName("frameselect");
        frameselect.toFront();
        frameselect.setSize(crop.x * 0.18f, crop.y * 0.2f);
        frameselect.setPosition(WIDTH * 0.025f, HEIGHT / 2.3f);
        frameselect.setVisible(false);
        gr.addActor(frameselect);
        Label labelName = new Label(name.substring(0,name.length()>9 ? 9 : name.length()),new Label.LabelStyle(bt,type));
        labelName.setAlignment(Align.center);
        labelName.setSize(WIDTH * 0.18f, HEIGHT * 0.02f);
        labelName.setPosition(frame.getX(), frame.getY() + frame.getHeight() * 0.25f);
        gr.addActor(labelName);
        txt = managerAssets.getAssetsCombat().getTexture(photo);
        crop = Scaling.fit.apply(txt.getWidth(), txt.getHeight(), WIDTH, HEIGHT);
        Image profile = new Image(new TextureRegion(txt));
//        profile.setColor(Color.BLUE);
        profile.setSize(crop.x*0.07f, crop.y*0.07f);
        profile.setPosition(frame.getRight() - frame.getWidth() / 2 - profile.getWidth() / 2, frame.getY() + frame.getHeight() * 0.42f);
        gr.addActor(profile);
        Skin skin = new Skin();
        skin.add("white", new TextureRegion(managerAssets.getAssetsCombat().getTexture(NameFiles.barLifeWhite),0,0,(int)(WIDTH*0.004),(int)(WIDTH*0.014)));
        ProgressBar.ProgressBarStyle barStyle = new ProgressBar.ProgressBarStyle(skin.newDrawable("white", Color.WHITE), skin.newDrawable("white",type));
        barStyle.knobBefore = barStyle.knob;
        ProgressBar bar = new ProgressBar(0, energymax, 1, false, barStyle);
        bar.setSize(WIDTH * 0.14f, HEIGHT * 0.012f);
        bar.setPosition(frame.getX()+frame.getWidth()*0.1f, frame.getY()+frame.getHeight()*0.07f);
        bar.setValue(energy);
        gr.addActor(bar);
        return gr;
    }
 
开发者ID:TudorRosca,项目名称:enklave,代码行数:45,代码来源:DrawDefenders.java

示例5: InitialView

import com.badlogic.gdx.scenes.scene2d.ui.ProgressBar; //导入方法依赖的package包/类
private void InitialView() {

        // create SVG image from Cachbox Logo
        try {
            InputStream stream = Gdx.files.internal("cb_logo.svg").read();
            float targetWidth = Gdx.graphics.getWidth() * 0.8f;
            Bitmap svgBitmap = PlatformConnector.getSvg("", stream, PlatformConnector.SvgScaleType.SCALED_TO_WIDTH, targetWidth);
            if (svgBitmap != null) {
                CB.CB_Logo = new Image(new Texture(Utils.getPixmapFromBitmap(svgBitmap)));
                CB.CB_Logo.setPosition((Gdx.graphics.getWidth() - svgBitmap.getWidth()) / 2, svgBitmap.getHeight() * 2);
                this.addActor(CB.CB_Logo);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }


        ProgressBar.ProgressBarStyle style = new ProgressBar.ProgressBarStyle();

        style.background = SvgSkinUtil.getSvgNinePatchDrawable(-1, -1, -1, -1
                , 0, 0, -1, -1
                , Utils.getTextureRegion(Gdx.files.internal("progress_back.svg").read()));

        style.knobBefore = SvgSkinUtil.getSvgNinePatchDrawable(-1, -1, -1, -1
                , -1, -1, -1, -1
                , Utils.getTextureRegion(Gdx.files.internal("progress_foreground.svg").read()));


        progress = new VisProgressBar(0f, 100f, 1f, false, style);
        float margin = 40 * (CanvasAdapter.dpi / 240);
        float progressWidth = Gdx.graphics.getWidth() - (margin * 2);

        progress.setBounds(margin, margin, progressWidth, ((SvgNinePatchDrawable) style.background).getPatch().getTotalHeight());
        this.addActor(progress);

        progress.setValue(0);

        Label.LabelStyle labelStyle = new Label.LabelStyle();
        String path = "skins/day/fonts/DroidSans.ttf";
        labelStyle.fontColor = Color.BLACK;
        labelStyle.font = new SkinFont(path, Gdx.files.internal(path), 20, null);
        workLabel = new Label(" \n ", labelStyle);
        workLabel.setBounds(margin, margin + progress.getHeight() + margin, progressWidth, workLabel.getPrefHeight());
        this.addActor(workLabel);

        // Init loader tasks
        initTaskList.add(new InitialWorkPathTask("InitialWorkPAth"));
        initTaskList.add(new SkinLoaderTask("Load UI"));
        initTaskList.add(new TranslationLoaderTask("Load Translations"));
        initTaskList.add(new GdxInitialTask("Initial GDX"));
        initTaskList.add(new InitialLocationListenerTask("Initial Loacation Reciver"));
        initTaskList.add(new LoadDbTask("Load Database"));

        // Use classpath for Desktop or assets for iOS and Android
        assets = (CanvasAdapter.platform.isDesktop()) ?
                new AssetManager(new ClasspathFileHandleResolver())
                : new AssetManager();

        Gdx.graphics.requestRendering();
    }
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:61,代码来源:Splash.java


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