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


Java PanelBuilder.image方法代码示例

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


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

示例1: addItemStats

import de.lessvoid.nifty.builder.PanelBuilder; //导入方法依赖的package包/类
/**
 * Adds particular stats to a hover panel given an item 
 * 
 * @param panel - the panel to add stats to
 * @param item - the item with stats to add
 * @param nifty - the main Nifty class
 */
public static void addItemStats(PanelBuilder panel, Item item, Nifty nifty){
	
	ImageBuilder im = new ImageBuilder();
	im.childLayoutVertical();
	
	//set image for text
	im.y("50");
	im.x("0");
	
	//build image stats on text
	im.backgroundColor("#0002");
	TextBuilder tb = new TextBuilder();
	String stats = " ";
	
	for (ItemDisplayTuple p : item) {
		stats += p.stat+": "+p.string+"\n ";	
	}
	
	//set text properties
	addText(im, stats);
	tb.font("Interface/Fonts/ItemText.fnt");
	tb.wrap(true);
	tb.textHAlignLeft();
	im.text(tb);
	panel.image(im);
	
}
 
开发者ID:GSam,项目名称:Game-Project,代码行数:35,代码来源:InventoryItemFactory.java

示例2: 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

示例3: 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

示例4: 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

示例5: 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.image方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。