asdasd

def humUnits = ['footman','gryphonrider','knight','peasant','priest','rifleman','seigeengine','sorceress','spellbreaker','summonwaterelemental','dragonhawk','flyingmachine','mortarteam']
def orcUnits = ['wyvernrider','demolisher','grunt','headhunter','kotobeast','peon','raider','shaman','spiritwalker','spiritwolf','tauren','trollbatrider','witchdoctor']
def neUnits = ['mountaingiant','wisp','archer','chimaera','druidoftheclaw','druidofthetalon','dryad','faeriedragon','glaivethrower','hippogriff','huntress']
def udUnits = ['shade','abomination','acolyte','banshee','cryptfiend','frostwyrm','gargoyle','ghoul','meatwagon','necromancer','obsidianstatue','destroyer']

def units = [ne:neUnits,hum:humUnits,orc:orcUnits,ud:udUnits]
def content = ""

units.each{k,v->
def unitRows = ""
def race = k
v.each{
def unitName = it


def soundSrcStrings = [ready:'', what:'',yes:'',death:'',pissed:'']
// def soundSrcs = getSoundSrcForUnit(it)//filename list
def soundSrcs = ['footmanready','footmanready2']
def counter = [:]
soundSrcs.each{
['ready','what','yes','death','pissed'].each{
soundType->
if(it.toLowerCase().indexOf(soundType) != -1){
def readyCounter = counter[soundType]
if(!readyCounter){
soundSrcStrings[soundType] += """wsb:soundSrc="@raw/${it}" """
counter[soundType] = 2
}
else{
soundSrcStrings[soundType] += """wsb:soundSrc${counter[soundType]}="@raw/${it}" """
counter[soundType] = counter[soundType]+1
}
}
}

}


def unitRow = """<TableRow android:layout_marginBottom="5dip" ><ImageView android:src="@drawable/${unitName}" style="@style/iconStyle"/>
<com.jleo.war3.SoundingButton android:text="Ready"
${soundSrcStrings['ready']} style="@style/${race}ButtonStyle"/>
<com.jleo.war3.SoundingButton android:text="What"
${soundSrcStrings['what']} style="@style/${race}ButtonStyle"/>
<com.jleo.war3.SoundingButton android:text="Yes"
${soundSrcStrings['yes']} style="@style/${race}ButtonStyle"/>
<com.jleo.war3.SoundingButton android:text="Death"
${soundSrcStrings['death']} style="@style/${race}ButtonStyle"/>
<com.jleo.war3.SoundingButton android:text="Pissed"
${soundSrcStrings['pissed']} style="@style/${race}ButtonStyle"/></TableRow>"""



unitRows += unitRow
}
def id

if(k.equals('hum'))
id = "human"
if(k.equals('orc'))
id = "orc"
if(k.equals('ud'))
id = "undead"
if(k.equals('ne'))
id = "nightElf"
def template = """<ScrollView android:padding="10dip" android:id="@+id/${id}"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:scrollbars="none"><TableLayout
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:stretchColumns="0" android:background="@drawable/nebg">

${unitRows}

</TableLayout></ScrollView>
"""
content += template
}

new File("c:\\content.xml").write(content)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值