本文整理汇总了Java中de.dakror.gamesetup.util.Helper类的典型用法代码示例。如果您正苦于以下问题:Java Helper类的具体用法?Java Helper怎么用?Java Helper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Helper类属于de.dakror.gamesetup.util包,在下文中一共展示了Helper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: drawTooltip
import de.dakror.gamesetup.util.Helper; //导入依赖的package包/类
@Override
public void drawTooltip(int x, int y, Graphics2D g) {
if (!(Game.currentGame.getActiveLayer() instanceof WorldHUDLayer)) return;
String tooltip = type.getDescription();
String timer = "Dauer: " + Assistant.formatSeconds(timeleft);
int width = g.getFontMetrics(g.getFont().deriveFont(30f)).stringWidth(tooltip) + 35;
int w2 = g.getFontMetrics(g.getFont().deriveFont(27f)).stringWidth(timer) + 35;
width = w2 > width ? w2 : width;
ArrayList<Resource> filled = value.getFilled();
int height = 90 + filled.size() * 30;
int x1 = x;
int y1 = y - 80;
if (x1 + width > Game.getWidth()) x1 -= (x1 + width) - GameFrame.getWidth();
if (y1 + height > Game.getHeight()) y1 -= (y1 + height) - GameFrame.getHeight();
Helper.drawShadow(x1, y1, width, height, g);
Helper.drawString(tooltip, x1 + 15, y1 + 40, g, 30);
Helper.drawString(timer, x1 + 20, y1 + 70, g, 27);
for (int i = 0; i < filled.size(); i++) {
Assistant.drawResource(value, filled.get(i), x1 + 20, y1 + 80 + i * 30, 25, 30, g);
}
}
开发者ID:Dakror,项目名称:Arise,代码行数:26,代码来源:Transfer.java
示例2: World
import de.dakror.gamesetup.util.Helper; //导入依赖的package包/类
public World(Packet03World packet) {
try {
id = packet.getId();
name = packet.getName();
speed = packet.getSpeed();
minX = minY = 0;
chunk = new BufferedImage(CHUNKSIZE, CHUNKSIZE, BufferedImage.TYPE_INT_ARGB);
for (int i = 0; i < chunk.getWidth(); i += 32)
for (int j = 0; j < chunk.getHeight(); j += 32)
Helper.drawImage2(Game.getImage("world/ground.png"), i, j, 32, 32, 32, 0, 32, 32, (Graphics2D) chunk.getGraphics());
updateSize();
} catch (Exception e) {
e.printStackTrace();
}
}
开发者ID:Dakror,项目名称:Arise,代码行数:19,代码来源:World.java
示例3: drawTooltip
import de.dakror.gamesetup.util.Helper; //导入依赖的package包/类
@Override
public void drawTooltip(int x, int y, Graphics2D g) {
if (Game.currentGame.getActiveLayer() instanceof CityHUDLayer) {
String string = getTooltipText();
int width = g.getFontMetrics(g.getFont().deriveFont(30f)).stringWidth(string) + 30;
int height = 64;
int x1 = x;
int y1 = y;
if (x1 + width > Game.getWidth()) x1 -= (x1 + width) - Game.getWidth();
if (y1 + height > Game.getHeight()) y1 -= (y1 + height) - Game.getHeight();
Helper.drawShadow(x1, y1, width, height, g);
Helper.drawString(string, x1 + 15, y1 + 40, g, 30);
}
}
开发者ID:Dakror,项目名称:Arise,代码行数:18,代码来源:Building.java
示例4: drawTooltip
import de.dakror.gamesetup.util.Helper; //导入依赖的package包/类
@Override
public void drawTooltip(int x, int y, Graphics2D g) {
int width = 150;
int height = TroopType.values().length * 30 + 70;
int x1 = x;
int y1 = y;
if (x1 + width > GameFrame.getWidth()) x1 -= (x1 + width) - GameFrame.getWidth();
if (y1 + height > GameFrame.getHeight()) y1 -= (y1 + height) - GameFrame.getHeight();
Helper.drawShadow(x1, y1, width, height, g);
Helper.drawString("Truppen", x1 + 20, y1 + 40, g, 35);
for (int i = 0; i < TroopType.values().length; i++) {
Resource r = TroopType.values()[i].getType();
Assistant.drawResource(CityLayer.resources, r, x1 + 20, y1 + i * 30 + 50, 30, 30, g);
}
}
开发者ID:Dakror,项目名称:Arise,代码行数:18,代码来源:ArmyLabel.java
示例5: draw
import de.dakror.gamesetup.util.Helper; //导入依赖的package包/类
@Override
public void draw(Graphics2D g) {
Helper.drawContainer((Game.getWidth() - width) / 2, (Game.getHeight() - height) / 2, width, height, false, false, g);
Helper.drawHorizontallyCenteredString(type.getType().getName(), Game.getWidth(), (Game.getHeight() - height) / 2 + 40, g, 35);
ArrayList<Resource> filled = type.getCosts().getFilled();
for (int i = 0; i < filled.size(); i++)
Assistant.drawLabelWithIcon(Game.getWidth() / 2 - width / 3, (Game.getHeight() - height) / 2 + 55 + i * 40, 30,
new Point(filled.get(i).getIconX(), filled.get(i).getIconY()), "" + type.getCosts().get(filled.get(i)) * (int) slider.getValue(), 30, g);
Helper.drawString("Dauer: " + Assistant.formatSeconds((int) ((type.getBuildTime() / (float) Game.world.getSpeed()) * slider.getValue())), Game.getWidth() / 2,
Game.getHeight() / 2 - 30, g, 30);
drawComponents(g);
}
开发者ID:Dakror,项目名称:Arise,代码行数:17,代码来源:BuildTroopsDialog.java
示例6: draw
import de.dakror.gamesetup.util.Helper; //导入依赖的package包/类
@Override
public void draw(Graphics2D g) {
g.drawImage(cache, 0, 0, null);
if (selectedBuilding != null) {
int width = 300, height = 200;
Helper.drawContainer(Game.getWidth() - width, Game.getHeight() - height, width, height, true, false, g);
}
Component hovered = null;
for (Component c : components) {
c.draw(g);
if (c.state == 2) hovered = c;
}
if (selectedBuilding != null) selectedBuilding.getGuiContainer().draw(g);
if (hovered != null && Game.currentGame.getActiveLayer() instanceof CityHUDLayer) hovered.drawTooltip(GameFrame.currentFrame.mouse.x, GameFrame.currentFrame.mouse.y, g);
}
开发者ID:Dakror,项目名称:Arise,代码行数:18,代码来源:CityHUDLayer.java
示例7: draw
import de.dakror.gamesetup.util.Helper; //导入依赖的package包/类
@Override
public void draw(Graphics2D g) {
if (cache == null) {
cache = new BufferedImage(Game.getWidth(), Game.getHeight(), BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = (Graphics2D) cache.getGraphics();
Helper.setRenderingHints(g2, true);
g2.setFont(g.getFont());
g2.drawImage(Game.getImage("system/menu.jpg"), 0, 0, Game.getWidth(), Game.getHeight(), null);
Shape oc = g2.getClip();
g2.setClip(new Rectangle(Game.getWidth() / 4, 190 + 19, Game.getWidth() / 2, 16));
Helper.drawOutline(Game.getWidth() / 4, 190, Game.getWidth() / 2, 32, true, g2);
g2.setClip(oc);
Helper.drawImageCenteredRelativeScaled(Game.getImage("system/title.png"), 50, 1920, 1080, Game.getWidth(), Game.getHeight(), g2);
Helper.drawContainer((Game.getWidth() - (TextButton.WIDTH + 40)) / 2, 300, TextButton.WIDTH + 40, TextButton.HEIGHT * 4 + 40, true, false, g2);
}
g.drawImage(cache, 0, 0, null);
drawComponents(g);
}
开发者ID:Dakror,项目名称:Arise,代码行数:24,代码来源:LoginLayer.java
示例8: loadLogo
import de.dakror.gamesetup.util.Helper; //导入依赖的package包/类
public void loadLogo() {
new Thread() {
@Override
public void run() {
try {
if (DakrorLauncher.internet)
userIcon.setIcon(new ImageIcon(
ImageIO.read(new URL(Helper.getURLContent(new URL("http://dakror.de/mp-api/logo?id=" + DakrorLauncher.userId)))).getScaledInstance( userIcon.getPreferredSize().width,
userIcon.getPreferredSize().height,
Image.SCALE_SMOOTH)));
} catch (Exception e) {
e.printStackTrace();
}
}
}.start();
}
开发者ID:Dakror,项目名称:DakrorLauncher,代码行数:17,代码来源:TitlePanel.java
示例9: getApps
import de.dakror.gamesetup.util.Helper; //导入依赖的package包/类
public static void getApps() {
try {
apps.clear();
if (DakrorLauncher.internet) {
JSONArray a = new JSONArray(Helper.getURLContent(new URL("http://dakror.de/app/get")));
for (int i = 0; i < a.length(); i++) {
JSONObject o = a.getJSONObject(i);
if (o.getInt("TYPE") == 0) {
apps.add(new App(o.getInt("ID"), o.getInt("STATE"), o.getInt("DATE"), o.getString("NAME"), o.getString("IMAGE"), o.getString("DESCRIPTION"), o.getLong("VERSION")));
}
}
} else {
for (File f : new File(CFG.DIR, DakrorLauncher.getLastLogin()[1] + "/apps/").listFiles()) {
apps.add(new App(0, 0, 0, f.getName(), f.getName().toLowerCase() + ".png", "", 1));
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
开发者ID:Dakror,项目名称:DakrorLauncher,代码行数:21,代码来源:AppLoader.java
示例10: main
import de.dakror.gamesetup.util.Helper; //导入依赖的package包/类
public static void main(String[] args) {
internet = Helper.isInternetReachable();
SLAnimator.start();
new Game();
Properties p = new Properties();
p.put("logoString", "");
AcrylLookAndFeel.setTheme(p);
try {
ToolTipManager.sharedInstance().setInitialDelay(0);
UIManager.setLookAndFeel(new AcrylLookAndFeel());
} catch (Exception e) {
e.printStackTrace();
}
new DakrorLauncher();
}
开发者ID:Dakror,项目名称:DakrorLauncher,代码行数:18,代码来源:DakrorLauncher.java
示例11: draw
import de.dakror.gamesetup.util.Helper; //导入依赖的package包/类
@Override
public void draw(Graphics2D g) {
if (mode1) {
Helper.drawShadow(x - (state > 0 && biggerOnHover ? 5 : 0) - 10, y - (state > 0 && biggerOnHover ? 5 : 0) - 10, width + (state > 0 && biggerOnHover ? 10 : 0) + 20, height
+ (state > 0 && biggerOnHover ? 10 : 0) + 20, g);
if (state != 1) Helper.drawOutline(x - (state > 0 && biggerOnHover ? 5 : 0) - 10, y - (state > 0 && biggerOnHover ? 5 : 0) - 10, width
+ (state > 0 && biggerOnHover ? 10 : 0) + 20, height + (state > 0 && biggerOnHover ? 10 : 0) + 20, state == 1, g);
else Helper.drawContainer(x - (state > 0 && biggerOnHover ? 5 : 0) - 10, y - (state > 0 && biggerOnHover ? 5 : 0) - 10, width + (state > 0 && biggerOnHover ? 10 : 0) + 20,
height + (state > 0 && biggerOnHover ? 10 : 0) + 20, false, false, shadow, g);
} else if (mode2) {
Helper.drawContainer(x - (state > 0 && biggerOnHover ? 5 : 0) - 10, y - (state > 0 && biggerOnHover ? 5 : 0) - 10, width + (state > 0 && biggerOnHover ? 10 : 0) + 20, height
+ (state > 0 && biggerOnHover ? 10 : 0) + 20, doubled, state == 1, shadow, g);
}
g.drawImage(img, x - (state > 0 && biggerOnHover ? 5 : 0), y - (state > 0 && biggerOnHover ? 5 : 0), width + (state > 0 && biggerOnHover ? 10 : 0), height
+ (state > 0 && biggerOnHover ? 10 : 0), null);
if (!enabled)
Helper.drawShadow(x - (state > 0 && biggerOnHover ? 5 : 0) - (mode1 ? 10 : 20), y - (state > 0 && biggerOnHover ? 5 : 0) - (mode1 ? 10 : 20), width
+ (state > 0 && biggerOnHover ? 10 : 0) + (mode1 ? 20 : 40), height + (state > 0 && biggerOnHover ? 10 : 0) + (mode1 ? 20 : 40), g);
}
开发者ID:Dakror,项目名称:GameSetup,代码行数:22,代码来源:IconButton.java
示例12: draw
import de.dakror.gamesetup.util.Helper; //导入依赖的package包/类
@Override
public void draw(Graphics2D g) {
int ty = state == 0 ? 124 : (state == 1 ? 202 : 280);
if (toggle) {
ty = selected ? 202 : 124;
}
if (!enabled) ty = 358;
Helper.drawImage(GameFrame.getImage("gui/gui.png"), x, y, width, height, 12, ty, WIDTH, HEIGHT, g);
Color c = g.getColor();
if (!enabled) g.setColor(Color.gray);
else g.setColor(Color.white);
if (toggle && selected) g.setColor(Color.decode("#7cde6a"));
Helper.drawHorizontallyCenteredString(text, x, width, y + height / 2 + shiftY, g, size);
g.setColor(c);
}
开发者ID:Dakror,项目名称:GameSetup,代码行数:22,代码来源:TextButton.java
示例13: draw
import de.dakror.gamesetup.util.Helper; //导入依赖的package包/类
@Override
public void draw(Graphics2D g) {
if (world != null) world.draw(g);
drawLayers(g);
if (!(getActiveLayer() instanceof HUDLayer) && !(getActiveLayer() instanceof GameStartLayer) && user != null) {
Helper.drawContainer(getWidth() - 200, getHeight() - 60, 200, 60, false, false, g);
g.setColor(Color.darkGray);
Helper.drawRightAlignedString(money + "$", getWidth() - 10, getHeight() - 20, g, 25);
}
if (debug && !screenshot) {
g.setColor(Color.green);
g.setFont(new Font("Arial", Font.PLAIN, 18));
Helper.drawString(getFPS() + " FPS", 0, 18, g, 18);
Helper.drawString(getUPS() + " UPS", 100, 18, g, 18);
}
}
开发者ID:Dakror,项目名称:SpamWars,代码行数:20,代码来源:Game.java
示例14: draw
import de.dakror.gamesetup.util.Helper; //导入依赖的package包/类
@Override
public void draw(Graphics2D g) {
if (dead) return;
Image i = Game.getImage("anim/" + name + ".png");
AffineTransform old = g.getTransform();
AffineTransform at = g.getTransform();
at.translate(-Game.w.getInsets().left, -Game.w.getInsets().top);
at.rotate(rotation, (int) (Game.world.x + pos.x) + size / 2, (int) (Game.world.y + pos.y) + size / 2);
g.setTransform(at);
Helper.drawImage(i, (int) (Game.world.x + pos.x), (int) (Game.world.y + pos.y), size, size, i.getHeight(null) * frame, 0, i.getHeight(null), i.getHeight(null), g);
g.setTransform(old);
}
开发者ID:Dakror,项目名称:SpamWars,代码行数:17,代码来源:Animation.java
示例15: draw
import de.dakror.gamesetup.util.Helper; //导入依赖的package包/类
@Override
public void draw(Graphics2D g) {
if (state == 0 && !selected) {
if (enabled) Helper.drawShadow(x, y, width, height, g);
Helper.drawOutline(x, y, width, height, false, g);
} else Helper.drawContainer(x, y, width, height, false, state == 1 || selected, g);
g.drawImage(icon, x + (width - icon.getWidth()) / 2, y + (height - icon.getHeight()) / 2, Game.w);
int m = 9;
if (part != null) {
Color c = g.getColor();
g.setColor(Color.decode("#c48813"));
Helper.drawRightAlignedString((part.price == 0) ? "Frei" : part.price + "$", x + width - 10, y + height - 10, g, 15);
g.setColor(c);
}
if (!enabled) Helper.drawShadow(x - m, y - m, width + m * 2, height + m * 2, g);
}
开发者ID:Dakror,项目名称:SpamWars,代码行数:23,代码来源:WeaponryButton.java
示例16: draw
import de.dakror.gamesetup.util.Helper; //导入依赖的package包/类
@Override
public void draw(Graphics2D g) {
g.translate(x, y);
WeaponryButton hov = null;
WeaponryButton sel = null;
for (WeaponryButton b : buttons) {
b.draw(g);
if (b.state != 0) hov = b;
if (b.selected) sel = b;
}
g.translate(-x, -y);
if (sel != null && extending) Helper.drawImage(Game.getImage("gui/gui.png"), x + sel.width, y + sel.y + (sel.height - 40) / 2, 38, 40, 539, 255, 38, 40, g);
if (hov != null) hov.drawTooltip(Game.currentGame.mouse.x, Game.currentGame.mouse.y, g);
}
开发者ID:Dakror,项目名称:SpamWars,代码行数:17,代码来源:WeaponryGroup.java
示例17: draw
import de.dakror.gamesetup.util.Helper; //导入依赖的package包/类
@Override
public void draw(Graphics2D g) {
if (end == 0) {
end = System.currentTimeMillis() + RESPAWN_TIME;
}
Composite oc = g.getComposite();
g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f));
Color o = g.getColor();
g.setColor(Color.gray);
g.fillRect(0, 0, Game.getWidth(), Game.getHeight());
g.setColor(o);
g.setComposite(oc);
if (end > 0) {
Helper.drawHorizontallyCenteredString("RESPAWN in ", Game.getWidth(), Game.getHeight() / 3, g, 70);
Helper.drawString((Math.round((end - System.currentTimeMillis()) / 100f) / 10f) + "", Game.getWidth() / 2 - 100, Game.getHeight() / 2, g, 90);
} else {
Helper.drawHorizontallyCenteredString("Du bist tot", Game.getWidth(), Game.getHeight() / 3, g, 90);
Helper.drawHorizontallyCenteredString("Respawn nächste Runde", Game.getWidth(), Game.getHeight() / 3 + 100, g, 40);
}
}
开发者ID:Dakror,项目名称:SpamWars,代码行数:23,代码来源:RespawnLayer.java
示例18: renderStats
import de.dakror.gamesetup.util.Helper; //导入依赖的package包/类
public void renderStats(Graphics2D g) {
Helper.drawContainer(Game.getWidth() / 2 - 500, Game.getHeight() / 2 - 300, 1000, 600, true, false, g);
Color o = g.getColor();
g.setColor(Color.gray);
Helper.drawHorizontallyCenteredString("Statistik", Game.getWidth(), Game.getHeight() / 2 - 220, g, 80);
Helper.drawOutline(Game.getWidth() / 2 - 495, Game.getHeight() / 2 - 295, 990, 100, false, g);
User[] users = Game.client.playerList.getUsers();
Arrays.sort(users, getSorter());
Helper.drawString("SPIELERNAME", Game.getWidth() / 2 - 450, Game.getHeight() / 2 - 160, g, 30);
Helper.drawString("K / D", Game.getWidth() / 2 + 300, Game.getHeight() / 2 - 160, g, 30);
for (int i = 0; i < users.length; i++) {
g.setColor(Color.white);
if (users[i].getUsername().equals(Game.user.getUsername())) g.setColor(Color.decode("#3333ff"));
Helper.drawString(users[i].getUsername(), Game.getWidth() / 2 - 450, Game.getHeight() / 2 - 110 + i * 30, g, 30);
Helper.drawString("/", Game.getWidth() / 2 + 350, Game.getHeight() / 2 - 110 + i * 30, g, 30);
Helper.drawRightAlignedString(users[i].K + "", Game.getWidth() / 2 + 331, Game.getHeight() / 2 - 110 + i * 30, g, 30);
Helper.drawString(users[i].D + "", Game.getWidth() / 2 + 391, Game.getHeight() / 2 - 110 + i * 30, g, 30);
}
g.setColor(o);
}
开发者ID:Dakror,项目名称:SpamWars,代码行数:22,代码来源:HUDLayer.java
示例19: draw
import de.dakror.gamesetup.util.Helper; //导入依赖的package包/类
@Override
public void draw(Graphics2D g) {
drawModality(g);
Helper.drawContainer(GameFrame.getWidth() / 2 - 310, Game.getHeight() / 2 - 125, 620, 250, true, false, g);
Helper.drawHorizontallyCenteredString("Bezahlung", Game.getWidth(), Game.getHeight() / 2 - 75, g, 40);
Helper.drawHorizontallyCenteredString("Das Bauen deiner Waffe kostet", Game.getWidth(), Game.getHeight() / 2 - 50, g, 20);
Color c = g.getColor();
if (Game.money >= costs) g.setColor(Color.darkGray);
else g.setColor(Color.decode("#660a0a"));
Helper.drawHorizontallyCenteredString(costs == 0 ? "Nichts" : costs + "$", Game.getWidth(), Game.getHeight() / 2 + 20, g, 80);
g.setColor(c);
drawComponents(g);
}
开发者ID:Dakror,项目名称:SpamWars,代码行数:18,代码来源:PurchaseWeaponLayer.java
示例20: drawTile
import de.dakror.gamesetup.util.Helper; //导入依赖的package包/类
public void drawTile(int cx, int cy, int i, int j, Graphics2D g) {
int x = i * SIZE;
int y = j * SIZE;
Point tp = getTexturePos(cx * Chunk.SIZE + i, cy * Chunk.SIZE + j);
if (tp.x < 3) // convex
{
Helper.drawImage(Game.getImage("tile/" + getTileset()), x, y, SIZE, SIZE, tp.x * SIZE, tp.y * SIZE, SIZE, SIZE, g);
} else {
// absolute sizes, not SIZE, easier to read.
Helper.drawImage(Game.getImage("tile/" + getTileset()), x, y, SIZE, SIZE, 32, 64, 32, 32, g);
if (tp.y == 0) Helper.drawImage(Game.getImage("tile/" + getTileset()), x, y, 16, 16, 64, 0, 16, 16, g);
if (tp.y == 1) Helper.drawImage(Game.getImage("tile/" + getTileset()), x + 16, y, 16, 16, 80, 0, 16, 16, g);
if (tp.y == 2) Helper.drawImage(Game.getImage("tile/" + getTileset()), x, y + 16, 16, 16, 64, 16, 16, 16, g);
if (tp.y == 3) Helper.drawImage(Game.getImage("tile/" + getTileset()), x + 16, y + 16, 16, 16, 80, 16, 16, 16, g);
}
}
开发者ID:Dakror,项目名称:VillageDefense,代码行数:18,代码来源:Tile.java
注:本文中的de.dakror.gamesetup.util.Helper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论