本文整理汇总了Java中de.lessvoid.nifty.elements.Element.isVisible方法的典型用法代码示例。如果您正苦于以下问题:Java Element.isVisible方法的具体用法?Java Element.isVisible怎么用?Java Element.isVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类de.lessvoid.nifty.elements.Element
的用法示例。
在下文中一共展示了Element.isVisible方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
}
示例2: updateIcons
import de.lessvoid.nifty.elements.Element; //导入方法依赖的package包/类
void updateIcons() {
if (playerCharacter == null) {
return;
}
CSpellCast cCast = playerCharacter.getControl(CSpellCast.class);
CCharacterBuff cBuff = playerCharacter.getControl(CCharacterBuff.class);
boolean hasSilence = cBuff.hasBuff(BuffTypeIds.SILENCE);
for (Map.Entry<String, Element> entry : icons.entrySet()) {
float cooldown = cCast.getCooldown(Spell
.getSpell(entry.getKey()).getId());
Element overlay = entry.getValue()
.findElementById(entry.getKey() + "-overlay");
if (cooldown <= 0 && !hasSilence) {
if (overlay.isVisible()) {
overlay.hide();
}
} else {
if (!overlay.isVisible()) {
overlay.show();
}
Element cooldownText = overlay
.findElementById(entry.getKey() + "-spell-counter");
TextRenderer txt = cooldownText.getRenderer(TextRenderer.class);
if (cooldown > 3) {
txt.setText(String.format("%d", (int) cooldown));
} else if (cooldown > 0) {
txt.setText(String.format("%.1f", cooldown));
} else {
txt.setText("");
}
}
}
}
示例3: setLatestStatsList
import de.lessvoid.nifty.elements.Element; //导入方法依赖的package包/类
void setLatestStatsList(List<PlayerRoundStats> latestStatsList,
boolean teamStats) {
this.latestStatsList = latestStatsList;
Element statisticsLayer = screen.findElementById("layer_statistics");
if (statisticsLayer.isVisible()) {
update(teamStats);
}
}
示例4: showChat
import de.lessvoid.nifty.elements.Element; //导入方法依赖的package包/类
/**Displays the chat panel
*
*/
public void showChat(){
Element chatPanel = nifty.getScreen("hud").findElementByName("chatPanel");
Element chatText = nifty.getScreen("hud").findElementByName("chatText");
if(!chatPanel.isVisible()){
chatPanel.startEffect(EffectEventId.onCustom);
chatPanel.setVisible(true);
}
chatText.setFocus();
}
示例5: consumeItem
import de.lessvoid.nifty.elements.Element; //导入方法依赖的package包/类
/**Triggered when an Item is right clicked to activate
* Processes the item according to its type, and updates
* the model accordingly
*/
@NiftyEventSubscriber(pattern="ItemVal.*")
public void consumeItem(String id, NiftyMouseSecondaryReleaseEvent event){
Item item = findItemById(id.substring(7),screenManager.getInventoryManager().getPlayer().getContainerInventory());
//container items
if (item instanceof AbstractContainerItem) {
Element containerPanel = nifty.getScreen("hud").findElementByName("ContainerPanel");
if (!containerPanel.isVisible()){
containerPanel.setVisible(true);
openContainer = item;
screenManager.getInventoryManager().loadContainer(((AbstractContainerItem)item).getContainerInventory());
}else{
closeContainer();
}
hideInnerPopups(screenManager.getInventoryManager().getPlayer().getContainerInventory());
Element containerText = nifty.getScreen("hud").findElementByName("ContainerText");
String name = null;
for (ItemDisplayTuple p : item) {
if (p.stat == Stat.NAME){
name = p.string;
}
}
if (name == null){
containerText.getRenderer(TextRenderer.class).setText("Container");
}else{
containerText.getRenderer(TextRenderer.class).setText(name);
}
return;
}
//Rightclickable items
if (item instanceof RightClickable) {
RightClickable toClick = (RightClickable) item;
toClick.rightClick();
if (!(toClick instanceof AbstractGizmo)) screenManager.getInventoryManager().removeItem(item);
for(GUIObserver g : observers){
g.onRightClicked(item);
}
return;
}
//Consumable items
if (item instanceof AbstractConsumable){
AbstractConsumable toConsume = (AbstractConsumable)item;
toConsume.rightClick();
screenManager.getInventoryManager().removeItem(item);
}
}