當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。