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


Java Element类代码示例

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


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

示例1: onWindowButton

import de.lessvoid.nifty.elements.Element; //导入依赖的package包/类
@NiftyEventSubscriber(pattern="bt.*")
public void onWindowButton(String id, ButtonClickedEvent e) {
    String windowId = "wd" + id.substring(2);
    for (WindowController wc : windowControllers) {
        Window window = wc.getWindow();
        if (window.getId().equals(windowId)) {
            Element windowElement = window.getElement();
            if (windowElement.isVisible()) {
            	break;
            }
            // move the selected window to the top layer
            windowElement.markForMove(windowElement.getParent());
            windowElement.reactivate();
            windowElement.startEffect(EffectEventId.onCustom);

            windowElement.show();
            for (Element elm : windowElement.getElements()) {
            	// have to do this after markForMove(), otherwise radio button selections
            	// are not displayed properly
            	elm.show();
            }
            break;
        }
    }
}
 
开发者ID:dwhuang,项目名称:SMILE,代码行数:26,代码来源:GuiController.java

示例2: display

import de.lessvoid.nifty.elements.Element; //导入依赖的package包/类
@Override
public void display(@Nonnull final Element element, final ServerEntry serverEntry) {
    final Element text = element.findElementById("#server-name");
    final TextRenderer textRenderer = text.getRenderer(TextRenderer.class);
    final Element ip = element.findElementById("#server-ip");
    final TextRenderer ipRenderer = ip.getRenderer(TextRenderer.class);

    if (serverEntry != null) {
        textRenderer.setText(serverEntry.getName());
        ipRenderer.setColor(Color.WHITE);
        ipRenderer.setText(serverEntry.getIp());
    } else {
        textRenderer.setText("");
        ipRenderer.setText("");
    }
}
 
开发者ID:LeNiglo,项目名称:TinyTank,代码行数:17,代码来源:ServerEntryConverter.java

示例3: onStartScreen

import de.lessvoid.nifty.elements.Element; //导入依赖的package包/类
@Override
public void onStartScreen() {
	textfieldChat = screen.findNiftyControl("textfieldChat", TextField.class);
	panelToolTip = screen.findElementByName("panelToolTip");
	layerHUD = screen.findElementByName("layerHUD");
	panelPortal = screen.findElementByName("panelPortal");
	
	panelPortal.hide();
	
	for (Element e : notificationElements) {
		recursiveElementRemoval(nifty, screen, e);
	}
	
	notificationElements.clear();
	notificationControls.clear();
	
	Iterator<Message> itr = messages.iterator();
	while (itr.hasNext()) {
		Message m = itr.next();
		m.remove();
		itr.remove();
	}
	
	screen.getFocusHandler().setKeyFocus(null);
}
 
开发者ID:AMPBEdu,项目名称:gjOryx,代码行数:26,代码来源:WorldScreen.java

示例4: resetPlayers

import de.lessvoid.nifty.elements.Element; //导入依赖的package包/类
public void resetPlayers() {
	new Thread() {
		public void run() {
			int removableChildren = playerScrollPanelPanel.getChildrenCount();
			List<Element> children = playerScrollPanelPanel.getChildren();
			for (int i = 0; i < removableChildren; i++) {
				children.get(i).markForRemoval();
			}
			
			try {
				Thread.sleep(100);
			} catch (InterruptedException e) {ErrorLogger.logger.severe(e.getMessage());}
			
			id = 0;
			addPlayerComponents("Player:", "player0TextField", System.getenv("USERNAME"), "1");
		}
	}.start();
}
 
开发者ID:oberien,项目名称:Oberien,代码行数:19,代码来源:GameSetupScreenController.java

示例5: startGame

import de.lessvoid.nifty.elements.Element; //导入依赖的package包/类
public void startGame() {
	//TODO: without a player one cannot start
	String mapName = screen.findElementById("mapNameLabel").getRenderer(TextRenderer.class).getOriginalText();
	List<Element> children = playerScrollPanelPanel.getChildren();
	ArrayList<Player> players = new ArrayList<Player>();
	for (int i = 0; i < children.size(); i++) {
		Element child = children.get(i);
		String name = child.findNiftyControl("player" + i + "TextField", TextField.class).getDisplayedText();
		if (child.findElementById("player" + i + "Label").getRenderer(TextRenderer.class).getOriginalText().equals("AI:")) {
			System.err.println("AI not implemented yet. " + name + " excluded from Players.");
			continue;
		}
		Color colorNifty = screen.findElementById("color" + i).getRenderer(PanelRenderer.class).getBackgroundColor();
		org.newdawn.slick.Color colorSlick = new org.newdawn.slick.Color(colorNifty.getRed(), colorNifty.getGreen(), colorNifty.getBlue(), colorNifty.getAlpha());
		int team = Integer.parseInt(screen.findNiftyControl("team" + i, Button.class).getText().substring(5))-1;
		players.add(new Player(name, colorSlick, team));
	}

	Player[] player = new Player[players.size()];
	player = players.toArray(player);
	NiftyMenu.startGame(new Controller(MapList.getInstance().getMap(mapName), player, "Conquest"));
}
 
开发者ID:oberien,项目名称:Oberien,代码行数:23,代码来源:GameSetupScreenController.java

示例6: normalizeSize

import de.lessvoid.nifty.elements.Element; //导入依赖的package包/类
public void normalizeSize(){
    Element parent = selected.getParent().getNiftyElement();
    Element sel = selected.getNiftyElement();
    float hp = parent.getHeight();
    float wp = parent.getWidth();
    float totalPaddingHorz = parent.getPaddingLeft().getValue(wp) + parent.getPaddingRight().getValue(wp);
    float totalPaddingVert = parent.getPaddingTop().getValue(hp) + parent.getPaddingBottom().getValue(hp);
    float width = (float)sel.getWidth()/(parent.getWidth()- totalPaddingHorz);
    float height = (float)sel.getHeight()/(parent.getHeight()-totalPaddingVert);
    int percW = Math.round(width*100);
    int percH = Math.round(height*100);
   
    selected.addAttribute("width", ""+percW+"%");
    selected.addAttribute("height", ""+percH+"%");
    selected.lightRefresh();
    this.update();
}
 
开发者ID:relu91,项目名称:niftyeditor,代码行数:18,代码来源:ElementEditor.java

示例7: normalizePosition

import de.lessvoid.nifty.elements.Element; //导入依赖的package包/类
public void normalizePosition(){
    Element parent = selected.getParent().getNiftyElement();
    Element sel = selected.getNiftyElement();
    float hp = parent.getHeight();
    float wp = parent.getWidth();
    float totalPaddingHorz = parent.getPaddingLeft().getValue(wp) + parent.getPaddingRight().getValue(wp);
    float totalPaddingVert = parent.getPaddingTop().getValue(hp) + parent.getPaddingBottom().getValue(hp);
    float X = (float)(sel.getX()-parent.getX())/(parent.getWidth()- totalPaddingHorz);
    float Y = (float)(sel.getY()-parent.getY())/(parent.getHeight()-totalPaddingVert);
    int percX = Math.round(X*100);
    int percY = Math.round(Y*100);
   
    selected.addAttribute("x", ""+percX+"%");
    selected.addAttribute("y", ""+percY+"%");
    selected.lightRefresh();
    this.update();
}
 
开发者ID:relu91,项目名称:niftyeditor,代码行数:18,代码来源:ElementEditor.java

示例8: setHud

import de.lessvoid.nifty.elements.Element; //导入依赖的package包/类
@Override
public void setHud(ClientHud hud) {
    super.setHud(hud);

    Element parent = hud.getScreen().findElementByName("panel_right");

    new AmmoIndicatorBuilder("pellets",
            "Interface/Images/SpellIcons/shotgun.png", "#fff")
            .build(hud.getNifty(), hud.getScreen(), parent);
    new AmmoIndicatorBuilder("plasma",
            "Interface/Images/SpellIcons/plasma.png", "#fff")
            .build(hud.getNifty(), hud.getScreen(), parent);
    new AmmoIndicatorBuilder("rockets",
            "Interface/Images/SpellIcons/rocket_launcher.png", "#111")
            .build(hud.getNifty(), hud.getScreen(), parent);

    pelletsCounter = hud.getScreen().findElementByName("pellets-counter");
    plasmaCounter = hud.getScreen().findElementByName("plasma-counter");
    rocketsCounter = hud.getScreen().findElementByName("rockets-counter");
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:21,代码来源:CEliteSoldierHud.java

示例9: addIcon

import de.lessvoid.nifty.elements.Element; //导入依赖的package包/类
void addIcon(int key) {
    Element bottomPanel = screen.findElementById("panel_spells");
    CSpellCast cCast = playerCharacter.getControl(CSpellCast.class);
    Spell spell = cCast.getKeySpellNameMapping(key);

    if (spell == null) {
        return;
    }

    String iconPath;
    if (spell.getIconName() != null) {
        iconPath = "Interface/Images/SpellIcons/" + spell.getIconName();
    } else {
        iconPath = "Interface/Images/SpellIcons/placeholder.png";
    }
    icons.put(spell.getName(), new SpellIconBuilder(spell.getName(),
            iconPath).build(nifty, screen, bottomPanel));
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:19,代码来源:SpellBar.java

示例10: initializeStatisticsPanels

import de.lessvoid.nifty.elements.Element; //导入依赖的package包/类
private void initializeStatisticsPanels() {
    Element statisticsPanel = screen.findElementById("panel_statistics");
    
    int i;
    for (i = 0; i < latestStatsList.size(); ++i) {
        if (i < statisticsPanels.size()) {
            statisticsPanels.get(i).show();
        } else {
            statisticsPanels.add(new PlayerStatisticsPanelBuilder(i)
                    .build(nifty, screen, statisticsPanel));
        }
    }

    for (; i < statisticsPanels.size(); i++) {
        statisticsPanels.get(i).hideWithoutEffect();

    }
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:19,代码来源:VisualStatistics.java

示例11: onAction

import de.lessvoid.nifty.elements.Element; //导入依赖的package包/类
@Override
public void onAction(String name, boolean isPressed, float tpf) {
    if (isPressed || !isEnabled()) {
        return;
    }

    Globals.app.enqueue(() -> {
        Element layer = screen.findElementById("layer_statistics");
        if (!layer.isVisible() && teamGame) {
            show(State.TEAM);
        } else if ((!layer.isVisible() && !teamGame)
                || currentState == State.TEAM) {
            show(State.INDIVIDUAL);
        } else {
            currentState = State.NONE;
            hide();
        }
        return null;
    });
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:21,代码来源:VisualStatistics.java

示例12: setStatEffects

import de.lessvoid.nifty.elements.Element; //导入依赖的package包/类
/**Creates the StatEffect objects associated with a given custom orb effect
 * 
 * @param player - the player for which the orb effects need to be generated
 */
public void setStatEffects(Player player){
	//health
	Element healthOrb = nifty.getScreen("hud").findElementByName("HealthOrb");
	Element healthOrbfade = nifty.getScreen("hud").findElementByName("HealthOrbFade");
	EffectSource healthOrbef = new EffectSource(GuiEffectType.HEALTHORBCHANGE,healthOrb.getNifty(),healthOrb.getElementType(),"HealthOrbef",healthOrb,healthOrb.getFocusHandler(),false,null,null);
	healthOrbef.setActor(player);
	healthOrb.add(healthOrbef);
	healthOrbfade.add(healthOrbef);
	
	//Energy
	Element energyOrb = nifty.getScreen("hud").findElementByName("EnergyOrb");
	Element energyorbfade = nifty.getScreen("hud").findElementByName("EnergyOrbFade");
	EffectSource energyOrbef = new EffectSource(GuiEffectType.ENERGYORBCHANGE,energyOrb.getNifty(),energyOrb.getElementType(),"EnergyOrbef",energyOrb,energyOrb.getFocusHandler(),false,null,null);
	energyOrbef.setActor(player);
	energyOrb.add(energyOrbef);
	energyorbfade.add(energyOrbef);
}
 
开发者ID:GSam,项目名称:Game-Project,代码行数:22,代码来源:PlayerStatManager.java

示例13: removeBuff

import de.lessvoid.nifty.elements.Element; //导入依赖的package包/类
public void removeBuff(int buffId) {
    buffs.remove(buffId);
    BuffEffect buffEffect = effects.remove(buffId);
    // FIXME: Investigate why buffEffect is sometimes null
    // NOTE: This seems to happen at least with Slow and Ignite
    if (buffEffect != null) {
        buffEffect.destroy();
    } else {
        // FIXME: This seems to happen often!
        logger.log(Level.WARNING,
                "buffEffect with id {0} NOT IN buffs or IS null!", buffId);
    }

    if (hud == null) {
        return;
    }

    Element buffIcon = buffIcons.get(buffId);
    // FIXME: NullPointerException here. This is only workaround.
    if (buffIcon != null) {
        buffIcon.markForRemoval();
    }

    buffIcons.remove(buffId);
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:26,代码来源:CCharacterBuff.java

示例14: bind

import de.lessvoid.nifty.elements.Element; //导入依赖的package包/类
@Override
public void bind(Nifty nifty, Screen screen, Element element, Properties parameter,
                 Attributes controlDefinitionAttributes)
{
        assert this.element == null;
        this.element = element;
        this.nifty = nifty;
        
        ElementRenderer[] renders = element.getElementRenderer();
        for (int i = 0; i < renders.length; ++i)
        {
                if (renders[i] instanceof PanelRenderer)
                {
                        renders[i] = new CameraRenderer();
                }
        }
}
 
开发者ID:Periapsis,项目名称:aphelion,代码行数:18,代码来源:CameraNiftyController.java

示例15: execute

import de.lessvoid.nifty.elements.Element; //导入依赖的package包/类
@Override
public void execute(
        final Element element,
        final float normalizedTime,
        final Falloff falloff,
        final NiftyRenderEngine r)
{
        currentColor.linear(startColor, endColor, normalizedTime);
        if (falloff == null)
        {
                setColor(element, currentColor);
        }
        else
        {
                tempColor.mutiply(currentColor, falloff.getFalloffValue());
                setColor(element, tempColor);
        }
}
 
开发者ID:Periapsis,项目名称:aphelion,代码行数:19,代码来源:BackgroundColorAnimated.java


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