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)
asdasd
最新推荐文章于 2022-02-25 23:02:56 发布