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


Java Image.addListener方法代码示例

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


在下文中一共展示了Image.addListener方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: drawtopcombat

import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
private void drawtopcombat(){
    groupTop = new Group();
    Texture lookup = managerAssets.getAssetsCombat().getTexture(NameFiles.progressbarcircular);
    lookup.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
    progressBarEnergy = ProgressBarEnergy.getInstance();
    Image imageLeftprofile = new Image(new TextureRegion(managerAssets.getAssetsButton().get(NameFiles.buttonBack1)));
    imageLeftprofile.setSize(Gdx.graphics.getWidth() * 0.15f, Gdx.graphics.getWidth() * 0.15f);
    imageLeftprofile.setPosition(imageLeftprofile.getWidth() * 0.1f, Gdx.graphics.getHeight() - imageLeftprofile.getHeight() * 1.1f);
    imageLeftprofile.addListener(new ClickListener(){
        @Override
        public void clicked(InputEvent event, float x, float y) {
            if(InformationProfile.getInstance().getDateUserGame().getEnklaveCombatId() == -1)
                gameManager.setScreen(gameManager.screenEnklave);
            else
                dialogExit("You can't out from combat!");
        }
    });
    groupTop.addActor(imageLeftprofile);
}
 
开发者ID:TudorRosca,项目名称:enklave,代码行数:20,代码来源:ScreenCombat.java

示例2: LeftSection

import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
public LeftSection(Skin skin) {
	this.setSkin(skin);
	
       Table moneyStatPanel = new StatPanel(skin);
       Image coin = new Image(skin , "coin");
       moneyLabel = new Label("",skin , "fontHemi20" , "white");
       moneyStatPanel.add(coin).pad(5).align(Align.left).expand().size(23 , 21);
       moneyStatPanel.add(moneyLabel).align(Align.right).pad(5 , 5 , 5 ,10).expand();
       this.add(moneyStatPanel).align(Align.right).size(120 , 30).spaceBottom(2).row();
       Table grayPanel = new GrayPanel(skin);
       _laserTowerIcon = new Image(skin , "laser-tower-icon");
       _plastmaTowerIcon = new Image(skin , "plastma-tower-icon");
       _missleTurretIcon = new Image(skin,"missile-tower-icon");
       
       _laserTowerTooltipTable = new LaserTowerTooltipTable(skin, TowerType.BASIC_LASER_TURRET);
       _plastmaTowerTooltipTable = new PlastmaTowerTooltipTable(skin, TowerType.PLASTMA_TOWER);
       _missileTowerTooltipTable = new MissileTowerTooltipTable(skin, TowerType.MISSILE_TURRET);
       
       _laserTowerIcon.addListener(_laserTowerTooltipTable.getTooltip());
       _plastmaTowerIcon.addListener(_plastmaTowerTooltipTable.getTooltip());
       _missleTurretIcon.addListener(_missileTowerTooltipTable.getTooltip());
       grayPanel.add(_laserTowerIcon).size(32,32).pad(10).align(Align.topLeft);
       grayPanel.add(_plastmaTowerIcon).size(32,32).pad(10).align(Align.topLeft);
       grayPanel.add(_missleTurretIcon).size(32, 32).pad(10).align(Align.topLeft).expand(32,32);
       this.add(grayPanel).expand();
}
 
开发者ID:JoakimRW,项目名称:ExamensArbeteTD,代码行数:27,代码来源:LeftSection.java

示例3: Map

import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
public Map(GameMap map, GameState gameState, int width, int height, ButtonStyle mapIndicatorStyle) {
	mapTexture = MinimapGenerator.generate(map, gameState, width, height);
	this.gameMap = map;
	this.gameState = gameState;
	calculateRatios(width, height);
	
	Image image = new Image(mapTexture);
	image.addListener(this);
	// only add the current camera position indicator in case 
	// the camera does not show the whole map already
	if (xRatio > 1 || yRatio > 1) {
		indicator = new MapScreenIndicator(mapIndicatorStyle);
	}
	
	WidgetGroup group = new WidgetGroup();
	group.addActor(image);
	if (indicator != null) {
		group.addActor(indicator);
		indicator.addListener(this);
	}
	group.setWidth(width);
	group.setHeight(height);
	group.invalidate();
	add(group).width(width).height(height);
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:26,代码来源:Map.java

示例4: run

import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
@Override
public void run() {
	assets.load(TRASH, Texture.class);
	assets.finishLoadingAsset(TRASH);
	Texture trash = assets.get(TRASH, Texture.class);

	Label titleLabel = new Label(TITLE, skin);
	 titleLabel.setFontScale(.85f);

	Table menu = new Table(skin);
	menu.setFillParent(true);
	menu.defaults().expand();
	menu.row();
	menu.add(titleLabel);
	for (int ix = 0; ix < 4; ix++) {
		FileHandle fh = SlotFolder.getSlotFolder(ix).child(CLL1.DECKSTATS);
		DeckStats di;
		try {
			String strJson;
			strJson = fh.readString(UTF_8.name());
			di = json.fromJson(DeckStats.class, strJson);
		} catch (Exception e) {
			di = new DeckStats();
			di.level = SkillLevel.Newbie;
			json.toJson(di, fh);
		}
		String c = di.level == null ? SkillLevel.Newbie.getEnglish() : di.level.getEnglish();
		int a = di.proficiency;
		int t = di.activeCards;
		String text = c + " - Active Cards: " + t + " - Proficiency: " + a + "%";
		if (t == 0) {
			text = EMPTY_SLOT;
		}
		int masterDeckSize = ((CLL1)game).cards.size();
		int percentInUse = 100*t/masterDeckSize;
		text += "\n" + nextSessionIndicationText(di.nextrun, percentInUse);
		
		Image btnDeleteSession = new Image(trash);
		btnDeleteSession.setScaling(Scaling.fit);
		btnDeleteSession.setColor(Color.DARK_GRAY);
		TextButton btnSession = new TextButton(text, skin);
		btnSession.getLabel().setFontScale(.7f);
		btnSession.getLabel().setAlignment(Align.center);
		menu.row();
		menu.add(btnSession).fillX().expand();
		menu.add(btnDeleteSession).expand(false, false);
		btnSession.addListener(chooseSession(ix));
		if (t!=0) {
			btnDeleteSession.addListener(deleteSessionConfirm(ix, btnDeleteSession, btnSession));
		} else {
			btnDeleteSession.setColor(Color.LIGHT_GRAY);
		}
	}
	TextButton btnBack = new TextButton(CLL1.BACKTEXT, skin);
	btnBack.getLabel().setFontScale(.7f);
	btnBack.pack();
	btnBack.addListener(onBack);
	menu.row();
	menu.add(btnBack).left().fill(false).expand(false, false);
	stage.addActor(menu);
}
 
开发者ID:CherokeeLanguage,项目名称:cll1-gdx,代码行数:62,代码来源:SelectSession.java

示例5: ColorOverlay

import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
public ColorOverlay(Sprite bg, Sprite redBG, Sprite orangeBG, Sprite blueBG, Sprite greenBg, final Application app, final TextureAtlas atlas)
{
    Sprite sprite = new Sprite(app.assets.get("images/colors/overlay.png", Texture.class));
    sprite.getTexture().setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
    image = new Image(sprite);

    colorButtons = new Array<ColorButton>();

    redButton = new ColorButton(atlas.createSprite("red-up"), atlas.createSprite("red-down"));
    orangeButton = new ColorButton(atlas.createSprite("orange-up"), atlas.createSprite("orange-down"));
    blueButton = new ColorButton(atlas.createSprite("blue-up"), atlas.createSprite("blue-down"));
    greenButton = new ColorButton(atlas.createSprite("green-up"), atlas.createSprite("green-down"));

    redButton.whenClicked(bg, redBG, "images/paddlandball/bg-red.png", app);
    orangeButton.whenClicked(bg, orangeBG, "images/paddlandball/bg-orange.png", app);
    blueButton.whenClicked(bg, blueBG, "images/paddlandball/bg-blue.png", app);
    greenButton.whenClicked(bg, greenBg, "images/paddlandball/bg-green.png", app);

    colorButtons.add(redButton);
    colorButtons.add(orangeButton);
    colorButtons.add(blueButton);
    colorButtons.add(greenButton);
    final Runnable notBusyAnmore = new Runnable()
    {
        @Override
        public void run()
        {
            busy = false;
        }
    };

    image.addListener(new ClickListener()
    {
        @Override
        public void clicked(InputEvent event, float x, float y)
        {
            if (enabled == false && busy == false)
            {
                busy = true;
                image.addAction(sequence(parallel(moveBy(0, 150, 0.4f)), run(notBusyAnmore)));
                enabled = true;
            }
            else if (enabled && busy == false)
            {
                busy = true;
                image.addAction(sequence(moveBy(0, -150, 0.4f), run(notBusyAnmore)));
                enabled = false;
            }
        }
    });
}
 
开发者ID:NahroTo,项目名称:Teleport-Ball,代码行数:52,代码来源:ColorOverlay.java


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