本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.Image.setColor方法的典型用法代码示例。如果您正苦于以下问题:Java Image.setColor方法的具体用法?Java Image.setColor怎么用?Java Image.setColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.scenes.scene2d.ui.Image
的用法示例。
在下文中一共展示了Image.setColor方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deleteSessionConfirm
import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
protected ClickListener deleteSessionConfirm(final int session, final Image btnTrashcan,
final TextButton btnSession) {
return new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
Dialog confirmDelete = new Dialog("ᎯᎠᏍ ᏣᏚᎵᎭ?", skin) {
protected void result(Object object) {
if ("YES".equals(object)) {
SlotFolder.getSlotFolder(session).deleteDirectory();
btnSession.setText(EMPTY_SLOT+"\n"+nextSessionIndicationText(0l, 0));
btnTrashcan.setColor(Color.LIGHT_GRAY);
btnTrashcan.clearListeners();
}
};
};
confirmDelete.button("ᎥᎥ - YES", "YES");
confirmDelete.button("ᎥᏝ - NO", "NO");
confirmDelete.text("Are you sure you want\n" + "to delete this session?\n" + "This cannot be undone!");
confirmDelete.setModal(true);
confirmDelete.pack();
confirmDelete.show(stage);
}
};
}
示例2: createKnightPosition
import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
/**
* Create an image used to highlight valid positions for a knight.
*
* @param localPlayer the local player, always
*/
public Image createKnightPosition(Player localPlayer) {
Image knightPos = new Image(knightBg);
// The highlighted position should be a bit transparent
float alpha = 0.75f;
// It should also take the color of the local player
switch (localPlayer.getColor()) {
case WHITE:
knightPos.setColor(Color.WHITE.r, Color.WHITE.g, Color.WHITE.b, alpha);
break;
case BLUE:
knightPos.setColor(Color.BLUE.r, Color.BLUE.g, Color.BLUE.b, alpha);
break;
case RED:
knightPos.setColor(Color.RED.r, Color.RED.g, Color.RED.b, alpha);
break;
case ORANGE:
knightPos.setColor(Color.ORANGE.r, Color.ORANGE.g, Color.ORANGE.b, alpha);
break;
case YELLOW:
knightPos.setColor(Color.YELLOW.r, Color.YELLOW.g, Color.YELLOW.b, alpha);
break;
}
// Scale down the image
final float knightScale = 1 / 8f;
knightPos.setSize(knightScale * knightPos.getWidth(), knightScale * knightPos.getHeight());
// Place the origin in the center of the image to make it easier to draw
knightPos.setOrigin(knightPos.getWidth() / 2f, knightPos.getHeight() / 2f);
return knightPos;
}
示例3: createCityWall
import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
/** Create a city wall image with the provided color */
Image createCityWall(PlayerColor color) {
// Create the image from the texture region
Image cityWallImage = new Image(cityWall);
// Set the color
switch (color) {
case WHITE:
cityWallImage.setColor(Color.WHITE);
break;
case BLUE:
cityWallImage.setColor(Color.BLUE);
break;
case RED:
cityWallImage.setColor(Color.RED);
break;
case ORANGE:
cityWallImage.setColor(Color.ORANGE);
break;
case YELLOW:
cityWallImage.setColor(Color.YELLOW);
break;
}
// Scale down the image
final float imageScale = 1 / 4f;
cityWallImage.setSize(imageScale * cityWallImage.getWidth(), imageScale * cityWallImage.getHeight());
// Place the origin in the center of the image to make it easier to draw
cityWallImage.setOrigin(cityWallImage.getWidth() / 2f, cityWallImage.getHeight() / 2f);
return cityWallImage;
}
示例4: KnightActor
import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
public KnightActor(Knight knight) {
super(new ImageButtonStyle());
GamePieces gamePieces = GamePieces.getInstance();
this.knight = knight;
activeStates = gamePieces.knightActive;
inactiveStates = gamePieces.knightInactive;
// Set the background color
bgColor = new Image(gamePieces.knightBg);
switch (knight.getOwner().getColor()) {
case WHITE:
bgColor.setColor(Color.WHITE);
break;
case BLUE:
bgColor.setColor(Color.BLUE);
break;
case RED:
bgColor.setColor(Color.RED);
break;
case ORANGE:
bgColor.setColor(Color.ORANGE);
break;
case YELLOW:
bgColor.setColor(Color.YELLOW);
break;
}
refresh();
setSize(getPrefWidth(), getPrefHeight());
}
示例5: dropShadow
import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
private Image dropShadow(Image image) {
Image drop = new Image(Assets.LOGO);
drop.setPosition(image.getX() + 2.5f, image.getY() - 2.5f);
drop.setColor(0, 0, 0, 0.15f);
return drop;
}
示例6: createFlashImage
import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
private void createFlashImage() {
TextureRegion tr = AssetManager.getInstance().getTextureRegion("default");
flashImage = new Image(tr);
flashImage.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
flashImage.setPosition(0, 0);
flashImage.setVisible(false);
flashImage.setColor(new Color(0, 0, 0, 0));
stage.addActor(flashImage);
}
示例7: visualize
import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
@Override public IFuture<Void> visualize(ITargetOwner result) {
final Future<Void> future = new Future<Void>();
SoundManager.instance.playSoundIfExists(soundName);
Image image = new Image(Config.skin, "effect-luck-image");
image.setColor(color);
image.setScale(0, 0);
image.setOrigin(image.getWidth() / 2, image.getHeight() / 2);
image.setPosition(
result.getTarget().getX() * ViewController.CELL_SIZE + (ViewController.CELL_SIZE - image.getWidth()) * 0.5f,
result.getTarget().getY() * ViewController.CELL_SIZE + (ViewController.CELL_SIZE - image.getHeight()) * 0.5f + 6
);
visualizer.viewController.effectLayer.addActor(image);
image.addAction(
Actions.sequence(
Actions.parallel(
Actions.scaleTo(0.75f, 0.75f, 0.5f, Interpolation.sine),
Actions.rotateBy(135, 0.5f)
),
Actions.parallel(
Actions.scaleTo(0, 0, 0.5f, Interpolation.sine),
Actions.rotateBy(135, 0.5f)
),
Actions.run(future),
Actions.removeActor()
)
);
return future;
}
示例8: AbilityIconCounter
import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
public AbilityIconCounter(Ability ability, int value) {
if (ability == null) {
ability = Config.abilities.get("skip-turn");
}
image = new Image(Config.skin.getDrawable("ability/" + ability.name + "-icon"));
if (ability.cost <0) image.setColor(AbilityIcon.unique);
image.setScaling(Scaling.none);
image.setAlign(Align.left | Align.top);
image.moveBy(0, 1);
counter = new Label("", Config.skin, "default", "inventory-counter");
counter.setAlignment(Align.right | Align.bottom);
setCount(value);
addActor(image);
addActor(counter);
setSize(image.getPrefWidth(), image.getPrefHeight());
}
示例9: DrawOneAttachers
import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的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;
}
示例10: 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);
}
示例11: LearningSession
import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
public LearningSession(AbstractGame game, int session, Deck<CardData> masterDeck, Deck<CardData> activeDeck) {
super(game);
this.session = session;
this.masterDeck = masterDeck;
this.activeDeck = activeDeck;
setBackdrop(CLL1.BACKDROP);
setSkin(CLL1.SKIN);
log("Session: " + session);
log("Master Deck Size: " + masterDeck.size());
log("Active Deck Size: " + activeDeck.size());
log("First Time: " + (activeDeck.size() == 0));
stage.addAction(actionUpdateTimeLeft());
lblCountdown = new Label("0:00", skin);
lblCountdown.setFontScale(.75f);
challengeText = new Label("", skin);
choice1 = new Stack();
choice2 = new Stack();
choice1.setTouchable(Touchable.childrenOnly);
choice2.setTouchable(Touchable.childrenOnly);
Gdx.app.postRunnable(init1);
Gdx.app.postRunnable(init2);
Gdx.app.postRunnable(firstPlay);
assets.load(CHECKMARK, Texture.class);
assets.load(XMARK, Texture.class);
assets.finishLoadingAsset(CHECKMARK);
assets.finishLoadingAsset(XMARK);
checkmark = assets.get(CHECKMARK, Texture.class);
xmark = assets.get(XMARK, Texture.class);
imgCheckmark = new Image(checkmark);
imgCheckmark.setScaling(Scaling.fit);
imgCheckmark.setColor(new Color(Color.FOREST));
imgCheckmark.getColor().a = .75f;
imgXmark = new Image(xmark);
imgXmark.setScaling(Scaling.fit);
imgXmark.setColor(new Color(Color.FIREBRICK));
imgXmark.getColor().a = .75f;
assets.load(BUZZER, Sound.class);
assets.load(DING, Sound.class);
}