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


Java Label类代码示例

本文整理汇总了Java中net.mostlyoriginal.game.component.ui.Label的典型用法代码示例。如果您正苦于以下问题:Java Label类的具体用法?Java Label怎么用?Java Label使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Label类属于net.mostlyoriginal.game.component.ui包,在下文中一共展示了Label类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: distanceChanged

import net.mostlyoriginal.game.component.ui.Label; //导入依赖的package包/类
@Subscribe
protected void distanceChanged( EditEvent event )
{
	if ( mDistanceIndicator.has(event.entity) && mLabel.has(event.entity))
	{
		Label label = mLabel.get(event.entity);
		DistanceIndicator distanceIndicator = mDistanceIndicator.get(event.entity);

		try {
			int distanceTraveled = Integer.valueOf(label.text);

			if ( distanceIndicator.travelTime > 0 && distanceTraveled > 0 ) {
				float scale = distanceTraveled / distanceIndicator.travelTime;
				if ( scale != 1) {
					MapMetadata metadata = mapMetadataManager.getMetadata();
					metadata.unitsPerPixel = MathUtils.clamp(metadata.unitsPerPixel*scale,0.01f,10f);
					refreshHandlerSystem.restart();
				}
			}
		} catch ( NumberFormatException e ) {
		}
	}
}
 
开发者ID:DaanVanYperen,项目名称:ns2-scc-profiler,代码行数:24,代码来源:MilestoneHandlerSystem.java

示例2: initialize

import net.mostlyoriginal.game.component.ui.Label; //导入依赖的package包/类
@Override
protected void initialize() {
    super.initialize();
    final Label label = new Label(G.version);
    label.align = Label.Align.RIGHT;
    Entity entity = new DynastyEntityBuilder(world)
            .with(Pos.class, Renderable.class)
            .with(label, new ColorAnimation(GdxUtil.convert(Color.WHITE), GdxUtil.convert(Color.valueOf("333333")), GdxUtil.convert(Interpolation.exp5), 1f / 2f, 2f)).build();
    mPos.get(entity).xy.set(G.CANVAS_WIDTH - 2, G.CANVAS_HEIGHT - 2);
}
 
开发者ID:DaanVanYperen,项目名称:odb-dynasty,代码行数:11,代码来源:AssetSystem.java

示例3: initialize

import net.mostlyoriginal.game.component.ui.Label; //导入依赖的package包/类
@Override
protected void initialize() {
    super.initialize();

    hintlabel = new Label("hintlabel");
    Entity hint = new DynastyEntityBuilder(world)
            .with(Pos.class, Renderable.class, Tint.class)
            .with(hintlabel).build();
    mColor.get(hint).setHex("004290");
    mPos.get(hint).set(10, 6);
}
 
开发者ID:DaanVanYperen,项目名称:odb-dynasty,代码行数:12,代码来源:ButtonSystem.java

示例4: process

import net.mostlyoriginal.game.component.ui.Label; //导入依赖的package包/类
protected void process(final Entity entity) {

        final Label label = mLabel.get(entity);
        final Pos pos = mPos.get(entity);

        if (label.text != null) {

            final BitmapFont font = label.scale == 3f ?  fontManager.extraBigFont : label.scale == 2f ? fontManager.bigFont : fontManager.font;

            if ( mColor.has(entity) )
            {
                final Color color = mColor.get(entity);
                font.setColor(color.r, color.g, color.b, color.a);
            } else {
                font.setColor(0f,0f,0f,1f);
            }

            switch ( label.align ) {
                case LEFT:
                    font.draw(batch, label.text, pos.x, pos.y);
                    break;
                case CENTER:
                    font.draw(batch, label.text, (int)(pos.x - font.getBounds(label.text).width / 2), (int)(pos.y + font.getBounds(label.text).height / 2));
                    break;
                case RIGHT:
                    font.draw(batch, label.text, pos.x - font.getBounds(label.text).width, pos.y);
                    break;
            }
        }
    }
 
开发者ID:DaanVanYperen,项目名称:ns2-scc-profiler,代码行数:31,代码来源:LabelRenderSystem.java

示例5: drawBubble

import net.mostlyoriginal.game.component.ui.Label; //导入依赖的package包/类
/**
 * /** Render lined bubble in pixmap space.
 *  @param color
 * @param text
 * @param x1         line origin
 * @param y1         line origin
 * @param x2         line end (where bubble will be)
 * @param y2         line end (where bubble will be)
 * @param pixmap     pixmap to render to.
 * @param renderMask render mask for label.
 * @param distanceIndicator
 */
public void drawBubble(Color color, String text, int x1, int y1, int x2, int y2, Pixmap pixmap, RenderMask renderMask, DistanceIndicator distanceIndicator) {

	pixmap.setColor(color);
	pixmap.drawLine(
			x1, pixmap.getHeight() - y1,
			x2, pixmap.getHeight() - y2);

	tmpCol.set(color).a = 1f;
	pixmap.setColor(tmpCol);
	pixmap.fillRectangle(x2 - 6, pixmap.getHeight() - y2 - 4, 11, 8);

	// label is in screen space.
	Label label = new Label(text);
	label.scale = 2;
	label.align = Label.Align.CENTER;
	Entity e = new EntityBuilder(world).with(
			new Renderable(1000),
			new Transient(),
			new net.mostlyoriginal.api.component.graphics.Color(1f, 1f, 1f, 1f),
			renderMask,
			new Input(1, 2),
			new Bounds(0, 0, 11, 8),
			new Clickable(),
			new Pos((int) (x2 * LayerManager.CELL_SIZE), (int) (y2 * LayerManager.CELL_SIZE)),
			label)
			.build();
	if ( distanceIndicator != null ) {
		e.edit().add(distanceIndicator);
	}
}
 
开发者ID:DaanVanYperen,项目名称:ns2-scc-profiler,代码行数:43,代码来源:RoutePlotSystem.java

示例6: process

import net.mostlyoriginal.game.component.ui.Label; //导入依赖的package包/类
@Override
protected void process(Entity e) {

	Clickable clickable = mClickable.get(e);
	if (clickable.state == Clickable.ClickState.CLICKED_LEFT) {
		selectInput(e);
	}

	if (selectedInput != null && selectedInput == e) {
		Label label = mLabel.get(e);

		// temporarily put text in field.
		if (typeBuffer.length() > 0) {
			label.text = typeBuffer.toString() + "<";
		} else label.text = "<";

		// escape changes.
		if (escaped) {
			selectInput(null);
		}

		// apply changes.
		if (entered) {
			entered = false;
			if (typeBuffer.length() >= input.minLength) {
				label.text = typeBuffer.toString();
				selectedInput = null;
				typeBuffer = new StringBuilder();
				eventManager.dispatch(new EditEvent(e));
			}
		}
	}
}
 
开发者ID:DaanVanYperen,项目名称:ns2-scc-profiler,代码行数:34,代码来源:InputSystem.java

示例7: initialize

import net.mostlyoriginal.game.component.ui.Label; //导入依赖的package包/类
@Override
protected void initialize() {
    super.initialize();

    hintlabel = new Label("hintlabel");
    new EntityBuilder(world).with(new Renderable(), new Pos(10, 6), hintlabel, new Color("004290")).build();
}
 
开发者ID:DaanVanYperen,项目名称:ns2-scc-profiler,代码行数:8,代码来源:ButtonSystem.java

示例8: initialize

import net.mostlyoriginal.game.component.ui.Label; //导入依赖的package包/类
@Override
protected void initialize() {
    super.initialize();
    final Label label = new Label(G.version);
    label.align = Label.Align.RIGHT;
    new EntityBuilder(world).with(new Pos(G.SCREEN_WIDTH - 2,G.SCREEN_HEIGHT - 2), label, new Renderable(), new ColorAnimation(GdxUtil.convert(Color.WHITE), GdxUtil.convert(Color.valueOf("333333")), GdxUtil.convert(Interpolation.exp5), 1f/ 2f, 2f)).build();
}
 
开发者ID:DaanVanYperen,项目名称:arktrail,代码行数:8,代码来源:AssetSystem.java

示例9: updateLabel

import net.mostlyoriginal.game.component.ui.Label; //导入依赖的package包/类
private void updateLabel(int offsetX, int offsetY, Entity e2, String label, Color color) {
    if ( mPos.has(e2)) {
        Pos pos = mPos.get(e2);
        pos.x = offsetX;
        pos.y = offsetY;
    }
    if ( mLabel.has(e2) )
    {
        Label l = mLabel.get(e2);
        l.text = label;
        mColor.get(e2).set(color);
    }
}
 
开发者ID:DaanVanYperen,项目名称:arktrail,代码行数:14,代码来源:CrewSystem.java

示例10: begin

import net.mostlyoriginal.game.component.ui.Label; //导入依赖的package包/类
@Override
protected void begin() {
    super.begin();

    hullBuilt = false;

    int builders = (int) (crewSystem.countOf(CrewMember.Ability.BUILD) * BUILDERS_BONUS_FACTOR);

    Label buildSpeedLabel = mLabel.get(labelEntity);

    if (builders > 10) {
        buildSpeed = 5;
        buildSpeedLabel.text = "buildspeed x5";
    } else if (builders >= 8) {
        buildSpeed = 4;
        buildSpeedLabel.text = "buildspeed x4";
    } else if (builders >= 5) {
        buildSpeed = 3;
        buildSpeedLabel.text = "buildspeed x3";
    } else if (builders >= 3) {
        buildSpeed = 2;
        buildSpeedLabel.text = "buildspeed x2";
    } else {
        buildSpeed = 1;
        buildSpeedLabel.text = "buildspeed x1";
    }
}
 
开发者ID:DaanVanYperen,项目名称:arktrail,代码行数:28,代码来源:ProductionSimulationSystem.java

示例11: process

import net.mostlyoriginal.game.component.ui.Label; //导入依赖的package包/类
protected void process(final Entity entity) {

        final Label label = mLabel.get(entity);
        final Pos pos = mPos.get(entity);

        if (label.text != null) {

            final BitmapFont font = label.scale == 2f ? fontManager.bigFont : fontManager.font;

            if ( mColor.has(entity) )
            {
                final Color color = mColor.get(entity);
                font.setColor(color.r, color.g, color.b, color.a);
            } else {
                font.setColor(1f,1f,1f,1f);
            }

            switch ( label.align ) {
                case LEFT:
                    font.draw(batch, label.text, pos.x, pos.y);
                    break;
                case RIGHT:
                    font.draw(batch, label.text, pos.x - font.getBounds(label.text).width, pos.y);
                    break;
            }
        }
    }
 
开发者ID:DaanVanYperen,项目名称:arktrail,代码行数:28,代码来源:LabelRenderSystem.java

示例12: initialize

import net.mostlyoriginal.game.component.ui.Label; //导入依赖的package包/类
@Override
protected void initialize() {
    super.initialize();

    hintlabel = new Label("hintlabel");
    new EntityBuilder(world).with(new Renderable(), new Pos(10, 6), hintlabel, GdxUtil.asColor("004290")).build();
}
 
开发者ID:DaanVanYperen,项目名称:arktrail,代码行数:8,代码来源:ButtonSystem.java

示例13: LabelRenderSystem

import net.mostlyoriginal.game.component.ui.Label; //导入依赖的package包/类
public LabelRenderSystem(EntityProcessPrincipal principal) {
    super(Aspect.all(Pos.class, Label.class, Renderable.class).exclude(Invisible.class), principal);
    batch = new SpriteBatch(1000);
}
 
开发者ID:DaanVanYperen,项目名称:odb-dynasty,代码行数:5,代码来源:LabelRenderSystem.java

示例14: estimateHeight

import net.mostlyoriginal.game.component.ui.Label; //导入依赖的package包/类
public float estimateHeight(Label label) {
    final BitmapFont font = label.scale == 3f ? fontManager.bigFont : fontManager.font;
    return new GlyphLayout(font, label.text,new Color(),label.maxWidth, Align.topLeft, true).height;
}
 
开发者ID:DaanVanYperen,项目名称:odb-dynasty,代码行数:5,代码来源:LabelRenderSystem.java

示例15: ButtonSystem

import net.mostlyoriginal.game.component.ui.Label; //导入依赖的package包/类
public ButtonSystem() {
    super(Aspect.all(Button.class, Clickable.class, Bounds.class).one(Anim.class, Label.class));
}
 
开发者ID:DaanVanYperen,项目名称:odb-dynasty,代码行数:4,代码来源:ButtonSystem.java


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