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


Java XmlReader.Element方法代码示例

本文整理汇总了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);
    }

}
 
开发者ID:whitecostume,项目名称:libgdx_ui_editor,代码行数:26,代码来源:XmlUtils.java

示例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;
}
 
开发者ID:infinity8,项目名称:Roguelike,代码行数:20,代码来源:AbstractActivationAction.java

示例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;
}
 
开发者ID:infinity8,项目名称:Roguelike,代码行数:19,代码来源:AbstractTownEvent.java

示例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 ) );
	}
}
 
开发者ID:infinity8,项目名称:Roguelike,代码行数:22,代码来源:EventList.java

示例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"));
    }
}
 
开发者ID:whitecostume,项目名称:libgdx_ui_editor,代码行数:10,代码来源:XmlUtils.java

示例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);
    }
}
 
开发者ID:whitecostume,项目名称:libgdx_ui_editor,代码行数:13,代码来源:XmlUtils.java

示例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);
}
 
开发者ID:whitecostume,项目名称:libgdx_ui_editor,代码行数:11,代码来源:XmlUtils.java

示例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);
    }

}
 
开发者ID:whitecostume,项目名称:libgdx_ui_editor,代码行数:28,代码来源:FileUtils.java

示例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"));
    }
}
 
开发者ID:whitecostume,项目名称:libgdx_ui_editor,代码行数:10,代码来源:XmlUtils.java

示例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);
    }
}
 
开发者ID:whitecostume,项目名称:libgdx_ui_editor,代码行数:13,代码来源:XmlUtils.java

示例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});
}
 
开发者ID:whitecostume,项目名称:libgdx_ui_editor,代码行数:14,代码来源:XmlUtils.java

示例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);
}
 
开发者ID:whitecostume,项目名称:libgdx_ui_editor,代码行数:8,代码来源:XmlUtils.java

示例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));
	}
}
 
开发者ID:infinity8,项目名称:Roguelike,代码行数:40,代码来源:AbilityTree.java

示例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( "," ) ) );
	}
}
 
开发者ID:infinity8,项目名称:Roguelike,代码行数:31,代码来源:TreasureGenerator.java

示例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 );
}
 
开发者ID:infinity8,项目名称:Roguelike,代码行数:13,代码来源:AbilityOnDeathEvent.java


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