本文整理汇总了Java中com.badlogic.gdx.utils.XmlReader.Element方法的典型用法代码示例。如果您正苦于以下问题:Java XmlReader.Element方法的具体用法?Java XmlReader.Element怎么用?Java XmlReader.Element使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.utils.XmlReader
的用法示例。
在下文中一共展示了XmlReader.Element方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readAttr
import com.badlogic.gdx.utils.XmlReader; //导入方法依赖的package包/类
private static void readAttr(Group parentGroup, XmlReader.Element element){
if (element.getName().equals("Stage")){
XmlUtils.parseGenAttr(parentGroup,element);
if (element.getChildCount()>0){
for (int i = 0;i<element.getChildCount();i++){
readAttr(parentGroup,element.getChild(i));
}
}
}else if (element.getName().equals("Group")){
Group group = new Group();
XmlUtils.parseGenAttr(group,element);
parentGroup.addActor(group);
if (element.getChildCount()>0){
for (int i = 0;i<element.getChildCount();i++){
readAttr(group,element.getChild(i));
}
}
}else {
Actor actor = getActorByName(element.getName());
parentGroup.addActor(actor);
XmlUtils.parseGenAttr(actor,element);
XmlUtils.parseUqAttr(actor,element);
}
}
示例2: load
import com.badlogic.gdx.utils.XmlReader; //导入方法依赖的package包/类
public static AbstractActivationAction load( XmlReader.Element xml )
{
Class<AbstractActivationAction> c = ClassMap.get( xml.getName().toUpperCase() );
AbstractActivationAction type = null;
try
{
type = ClassReflection.newInstance( c );
}
catch ( Exception e )
{
System.err.println(xml.getName());
e.printStackTrace();
}
type.parse( xml );
return type;
}
示例3: load
import com.badlogic.gdx.utils.XmlReader; //导入方法依赖的package包/类
public static AbstractTownEvent load(XmlReader.Element xml )
{
Class<AbstractTownEvent> c = ClassMap.get(xml.getName().toUpperCase());
AbstractTownEvent type = null;
try
{
type = (AbstractTownEvent) ClassReflection.newInstance( c );
}
catch (ReflectionException e)
{
e.printStackTrace();
}
type.parse(xml);
return type;
}
示例4: EventList
import com.badlogic.gdx.utils.XmlReader; //导入方法依赖的package包/类
public EventList()
{
XmlReader reader = new XmlReader();
XmlReader.Element xml = null;
try
{
xml = reader.parse( Gdx.files.internal( "Levels/Town/EventList.xml" ) );
}
catch ( IOException e )
{
e.printStackTrace();
}
for (int i = 0; i < xml.getChildCount(); i++)
{
XmlReader.Element el = xml.getChild( i );
flagEvents.add( new FlagEvent( el ) );
}
}
示例5: parseGenAttr
import com.badlogic.gdx.utils.XmlReader; //导入方法依赖的package包/类
private static void parseGenAttr(Actor actor, XmlReader.Element element){
actor.setWidth(element.getFloat("width",100));
actor.setHeight(element.getFloat("height",100));
actor.setPosition(element.getFloat("x",0),element.getFloat("y",0));
actor.setOrigin(element.getFloat("originX",0),element.getFloat("originY",0));
if (element.getAttributes().containsKey("name")){
actor.setName(element.get("name"));
}
}
示例6: parseUqAttr
import com.badlogic.gdx.utils.XmlReader; //导入方法依赖的package包/类
private static void parseUqAttr(Actor actor, XmlReader.Element element){
Class cls = getActorType(actor);
if (cls.equals(Label.class)){
parseLabel((Label) actor,element);
}else if (cls.equals(Image.class)){
parseImage((Image) actor,element);
}else if (cls.equals(Button.class)){
parseButton((Button) actor,element);
}else if (cls.equals(TextField.class)){
parseTextField((TextField) actor,element);
}
}
示例7: parseButton
import com.badlogic.gdx.utils.XmlReader; //导入方法依赖的package包/类
private static void parseButton(Button button, XmlReader.Element element){
String upPath = element.get("up");
String downPath = element.get("down");
String checkPath = element.get("check");
Drawable up = new TextureRegionDrawable(new TextureRegion(new Texture(Gdx.files.internal(upPath))));
Drawable down = new TextureRegionDrawable(new TextureRegion(new Texture(Gdx.files.internal(downPath))));
Drawable checked = new TextureRegionDrawable(new TextureRegion(new Texture(Gdx.files.internal(checkPath))));
Button.ButtonStyle buttonStyle = new Button.ButtonStyle(up,down,checked);
button.setStyle(buttonStyle);
}
示例8: readAttr
import com.badlogic.gdx.utils.XmlReader; //导入方法依赖的package包/类
public static void readAttr(Group parentGroup, XmlReader.Element element, EventListener dragListener){
if (element.getName().equals("Stage")){
XmlUtils.parseGenAttr(parentGroup,element);
if (element.getChildCount()>0){
for (int i = 0;i<element.getChildCount();i++){
readAttr(parentGroup,element.getChild(i),dragListener);
}
}
}else if (element.getName().equals("Group")){
Group group = new Group();
XmlUtils.parseGenAttr(group,element);
group.addListener(dragListener);
parentGroup.addActor(group);
if (element.getChildCount()>0){
for (int i = 0;i<element.getChildCount();i++){
readAttr(group,element.getChild(i),dragListener);
}
}
}else {
Actor actor = EditorManager.getInstance().getActorByName(element.getName());
parentGroup.addActor(actor);
actor.addListener(dragListener);
XmlUtils.parseGenAttr(actor,element);
XmlUtils.parseUqAttr(actor,element);
}
}
示例9: parseGenAttr
import com.badlogic.gdx.utils.XmlReader; //导入方法依赖的package包/类
public static void parseGenAttr(Actor actor, XmlReader.Element element){
actor.setWidth(element.getFloat("width",100));
actor.setHeight(element.getFloat("height",100));
actor.setPosition(element.getFloat("x",0),element.getFloat("y",0));
actor.setOrigin(element.getFloat("originX",0),element.getFloat("originY",0));
if (element.getAttributes().containsKey("name")){
actor.setName(element.get("name"));
}
}
示例10: parseUqAttr
import com.badlogic.gdx.utils.XmlReader; //导入方法依赖的package包/类
public static void parseUqAttr(Actor actor, XmlReader.Element element){
Class cls = EditorManager.getInstance().getActorType(actor);
if (cls.equals(Label.class)){
parseLabel((Label) actor,element);
}else if (cls.equals(Image.class)){
parseImage((Image) actor,element);
}else if (cls.equals(Button.class)){
parseButton((VisImageButton) actor,element);
}else if (cls.equals(TextField.class)){
parseTextField((TextField) actor,element);
}
}
示例11: parseButton
import com.badlogic.gdx.utils.XmlReader; //导入方法依赖的package包/类
public static void parseButton(VisImageButton button, XmlReader.Element element){
String upPath = element.get("up");
String downPath = element.get("down");
String checkPath = element.get("check");
Drawable up = new TextureRegionDrawable(new TextureRegion(new Texture(Config.getImageFilePath(upPath))));
Drawable down = new TextureRegionDrawable(new TextureRegion(new Texture(Config.getImageFilePath(downPath))));
Drawable checked = new TextureRegionDrawable(new TextureRegion(new Texture(Config.getImageFilePath(checkPath))));
VisImageButton.VisImageButtonStyle buttonStyle = new VisImageButton.VisImageButtonStyle(
up,down,checked,up,down,checked
);
button.setStyle(buttonStyle);
attr2Button(button, new String[]{upPath, downPath, checkPath});
}
示例12: parseTextField
import com.badlogic.gdx.utils.XmlReader; //导入方法依赖的package包/类
public static void parseTextField(TextField textField, XmlReader.Element element){
String text = element.get("text","");
String messageText = element.get("messageText","");
textField.setText(text);
textField.setMessageText(messageText);
attr2TextField(textField);
}
示例13: parse
import com.badlogic.gdx.utils.XmlReader; //导入方法依赖的package包/类
public void parse( XmlReader.Element xml )
{
String abilityPath = tree.treePath + "/" + xml.getName();
XmlReader xmlReader = new XmlReader();
XmlReader.Element abilityElement = null;
try
{
abilityElement = xmlReader.parse( Gdx.files.internal( "Abilities/" + abilityPath + ".xml" ) );
}
catch ( IOException e )
{
e.printStackTrace();
}
if (abilityElement.getName().equalsIgnoreCase("Active"))
{
current = ActiveAbility.load( abilityElement );
}
else if (abilityElement.getName().equalsIgnoreCase("Passive"))
{
current = PassiveAbility.load( abilityElement );
}
else
{
throw new RuntimeException("Unknown ability type: "+abilityElement.getName());
}
current.setTree( this );
expToNextLevel = xml.getIntAttribute("BaseExp", expToNextLevel);
if (xml.getChildCount() > 0)
{
branch1 = new AbilityStage(tree, xml.getChild(0));
branch2 = new AbilityStage(tree, xml.getChild(1));
}
}
示例14: RecipeList
import com.badlogic.gdx.utils.XmlReader; //导入方法依赖的package包/类
public RecipeList( String path )
{
XmlReader reader = new XmlReader();
XmlReader.Element xml = null;
try
{
xml = reader.parse( Gdx.files.internal( path ) );
}
catch ( IOException e )
{
e.printStackTrace();
}
XmlReader.Element armoursElement = xml.getChildByName( "Armours" );
for (int i = 0; i < armoursElement.getChildCount(); i++)
{
XmlReader.Element armourElement = armoursElement.getChild( i );
armourRecipes.add( new RecipeData( armourElement.getName(), armourElement.getText().split( "," ) ) );
}
XmlReader.Element weaponsElement = xml.getChildByName( "Weapons" );
for (int i = 0; i < weaponsElement.getChildCount(); i++)
{
XmlReader.Element weaponElement = weaponsElement.getChild( i );
weaponRecipes.add( new RecipeData( weaponElement.getName(), weaponElement.getText().split( "," ) ) );
}
}
示例15: parse
import com.badlogic.gdx.utils.XmlReader; //导入方法依赖的package包/类
@Override
public void parse( XmlReader.Element xml )
{
condition = xml.getAttribute( "Condition", null );
if ( condition != null )
{
condition = condition.toLowerCase();
}
reliesOn = xml.getAttribute( "ReliesOn", "" ).split( "," );
ability = ActiveAbility.load( xml );
}