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


Java PanelBuilder.x方法代码示例

本文整理汇总了Java中de.lessvoid.nifty.builder.PanelBuilder.x方法的典型用法代码示例。如果您正苦于以下问题:Java PanelBuilder.x方法的具体用法?Java PanelBuilder.x怎么用?Java PanelBuilder.x使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在de.lessvoid.nifty.builder.PanelBuilder的用法示例。


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

示例1: addContainerSlots

import de.lessvoid.nifty.builder.PanelBuilder; //导入方法依赖的package包/类
/**
 * Adds slot elements to a given Draggable for a container
 * @param drag - the Draggable object to build slots upon
 * @param item - the item with the id associated to the container slot
 * @param nifty - the main nifty element
 */
public static void addContainerSlots(DraggableBuilder drag, Item item, Nifty nifty){
	
	int screenWidth = nifty.getRenderEngine().getWidth();
	int screenHeight = nifty.getRenderEngine().getHeight();
	
	PanelBuilder superPan = new PanelBuilder("container-"+item.getId());
	superPan.childLayoutAbsolute();
	
	//build the hover stats
	PanelBuilder pan = new PanelBuilder();
	pan.backgroundColor("#ffff");
	
	//set properties for popup panel
	pan.childLayoutAbsolute();
	
	pan.width(""+(int)(screenWidth*0.1));
	pan.height(""+(int)(screenHeight*0.25));
	pan.x(""+-(int)(screenWidth*0.2));
	pan.y(""+-(int)(screenWidth*0.2));
	
	superPan.panel(pan);
	superPan.renderOrder(1000);
	superPan.visible(true);	//don't show popup on creation
	drag.panel(superPan);
	
}
 
开发者ID:GSam,项目名称:Game-Project,代码行数:33,代码来源:InventoryItemFactory.java

示例2: addHoverPanel

import de.lessvoid.nifty.builder.PanelBuilder; //导入方法依赖的package包/类
/**
 * Adds the mouse-over hover panel to the given Draggable. Hover panel displays 
 * item stats.
 * 
 * @param drag - the Draggable object to build the hover stats upon
 * @param item - the Item with stats to display
 * @param nifty - the main Nifty class
 */
public static void addHoverPanel(DraggableBuilder drag, Item item, Nifty nifty){
	//set hover effects for the popup stats
	HoverEffectBuilder onHover = new HoverEffectBuilder("show");
	onHover.effectParameter("targetElement", "hoverstats-"+item.getId());
	HoverEffectBuilder offHover = new HoverEffectBuilder("hide");
	offHover.effectParameter("targetElement", "hoverstats-"+item.getId());
	drag.onHoverEffect(onHover);
	drag.onEndHoverEffect(offHover);
	
	//add elements to the base draggable
	drag.visible(true);
	drag.x(""+0);
	drag.y(""+0);
	
	PanelBuilder superPan = new PanelBuilder("hoverstats-"+item.getId());
	superPan.childLayoutAbsolute();
	
	//build the hover stats
	PanelBuilder pan = new PanelBuilder();
	pan.backgroundColor("#969a");

	addItemStats(pan,item,nifty);
	
	//set properties for popup panel
	pan.childLayoutAbsolute();
	pan.width("200");
	pan.height("100");
	pan.x("-150");
	pan.y("-100");

	superPan.panel(pan);
	superPan.renderOrder(1000);
	superPan.visible(false);	//don't show popup on creation
	drag.panel(superPan);
}
 
开发者ID:GSam,项目名称:Game-Project,代码行数:44,代码来源:InventoryItemFactory.java

示例3: makeWorldChest

import de.lessvoid.nifty.builder.PanelBuilder; //导入方法依赖的package包/类
/**Creates the PanelBuilder used to build the world chest panel element
 * on the HUD screen.
 */
public PanelBuilder makeWorldChest(){
	
	//create chest and set position and dimensions
	PanelBuilder chest = new PanelBuilder("WorldChest");
	chest.childLayoutVertical();
	chest.x(""+(int)(screenWidth*.40));
	chest.y(""+(int)(screenHeight*.1));
	chest.width(""+(int)(screenWidth*.30));
	chest.height("70%");
	
	//create image for hud screen and set dimensions
	ImageBuilder im = new ImageBuilder("WorldChestImagePanel");
	im.alignRight();
	im.width("100%");
	im.height("100%");
	im.filename("Interface/WorldChest.png");
	im.childLayoutAbsolute();
	
	//add the 4x45 drop slots for the worldchest
	addDropSlots(im);

	chest.image(im);

	//set initial state of world chest panel to closed.
	chest.visible(false);
	
	return chest;
}
 
开发者ID:GSam,项目名称:Game-Project,代码行数:32,代码来源:WorldChestPanel.java

示例4: makeContainer

import de.lessvoid.nifty.builder.PanelBuilder; //导入方法依赖的package包/类
/** Returns a PanelBuilder to build with the appropriate elements
 * and drag drop slots
 * 
 * @return	The PanelBuilder with the Container elements to build
 */
public PanelBuilder makeContainer(){
	//set up container panel and position
	PanelBuilder invent = new PanelBuilder("ContainerPanel");
	invent.childLayoutOverlay();
	invent.x(""+(int)(screenWidth*.57));
	invent.y(""+(int)(screenHeight*.3));
	invent.width(""+(int)(screenWidth*.13));
	invent.height("30%");
	
	//set up container image and size
	ImageBuilder im = new ImageBuilder();
	im.alignRight();
	im.width("100%");
	im.height("100%");
	im.filename("Interface/Container.png");
	im.childLayoutAbsolute();
	
	//add container item slots
	addDropSlots(im);
	
	//set container text
	TextBuilder tb = new TextBuilder("ContainerText");
	tb.text("");
	tb.font("Interface/Fonts/ItemText.fnt");
	tb.wrap(true);
	tb.width(""+(int)(screenWidth*.13));
	tb.x(""+0);
	tb.y(""+(int)(screenHeight*.02));
	
	//add text to image, set non-visible before displayed
	im.text(tb);
	invent.image(im);
	invent.visible(false);
	
	return invent;
}
 
开发者ID:GSam,项目名称:Game-Project,代码行数:42,代码来源:ContainerPanel.java

示例5: makeInventory

import de.lessvoid.nifty.builder.PanelBuilder; //导入方法依赖的package包/类
/** Returns a PanelBuilder to build the Inventory panel with the appropriate elements
 * and drop slots
 * 
 * @return	The PanelBuilder with the Inventory panel elements to build
 */
public PanelBuilder makeInventory(){
	
	//create panel and set location and size
	PanelBuilder invent = new PanelBuilder("InventoryPanel");
	invent.childLayoutVertical();
	invent.x(""+(int)(screenWidth*.70));
	invent.y(""+(int)(screenHeight*.1));
	invent.width(""+(int)(screenWidth*.25));
	invent.height("70%");
	
	//create the inventory panel image and set size
	ImageBuilder im = new ImageBuilder("InventoryPaneliamge");
	im.alignRight();
	im.width("100%");
	im.height("100%");
	im.filename("Interface/InventoryPanel2.png");
	im.childLayoutAbsolute();
	
	//add the drop slots to the inventory panel;s
	addDropSlots(im);
	invent.image(im);
	
	//set non-visible to begin with
	invent.visible(false);
	
	return invent;
}
 
开发者ID:GSam,项目名称:Game-Project,代码行数:33,代码来源:InventoryPanel.java

示例6: makePanel

import de.lessvoid.nifty.builder.PanelBuilder; //导入方法依赖的package包/类
/** Builds returns the PanelBuilder with the EquipmentPanel elements 
 * to be built by the HudScreen
 * @return
 */
public PanelBuilder makePanel(){
	
	//Create the panel and set location
	PanelBuilder equip = new PanelBuilder("CharEquip");
	equip.x(""+(int)(screenWidth*.05));
	equip.y(""+(int)(screenHeight*.1));
	equip.width(""+(int)(screenWidth*.35));
	equip.height(""+(int)(screenHeight*.72));
	equip.childLayoutVertical();
	equip.visible(false);
	
	//Create the equip panel image and set location
	ImageBuilder im = new ImageBuilder("CharEquipVisuals");
	im.alignRight();
	im.width("100%");
	im.height("100%");
	im.filename("Interface/CharEquipv3.png");
	im.childLayoutAbsolute();
	
	
	//set the text and positioning of text elements on the equip image
	im.text(makeText("CharDamage","DAMAGE", (int)(screenWidth*0.035),(int)(screenHeight*0.6), true));
	im.text(makeText("CharArmour","ARMOUR", (int)(screenWidth*0.035),(int)(screenHeight*0.625), true));
	im.text(makeText("CharEnergy","ENERGY", (int)(screenWidth*0.035),(int)(screenHeight*0.65), true));
	im.text(makeText("CharHealth","HEALTH", (int)(screenWidth*0.17),(int)(screenHeight*0.6), true));
	im.text(makeText("CharMaxHealth","MAX HEALTH", (int)(screenWidth*0.17),(int)(screenHeight*0.625), true));
	im.text(makeText("CharMaxEnergy","MAX ENERGY", (int)(screenWidth*0.17),(int)(screenHeight*0.65), true));
	
	//establish the equipment 'shake' effect
	im.onCustomEffect(new EffectBuilder("shake"){{
		customKey("shaker");
		effectParameter("distance","2");
		effectParameter("global","false");
		length(500);
	}});

	//generate the drag drop slots for the equip positions
	makeEquipSlots(im);
	equip.image(im);
	
	return equip;
}
 
开发者ID:GSam,项目名称:Game-Project,代码行数:47,代码来源:CharacterEquipPanel.java


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