本帖最后由 smss 于 2019-6-26 11:23 编辑
具体报酬:100元人民币
支付方式:支付宝微信转账
联系方式:QQ296578353
有效期限:功能实现之前
批量替换文本中的指定内容 文本类似以下
<Variable name="city_id" type="string" column="city_id"/>
<Variable name="weather_location" type="string" column="city_name"/>
<Variable name="weather_id" type="int" column="weather_type"/>
<Variable name="city_id" type="string" column="city_id"/>
<Text name="Qm" x="100" y="300" w="458" alignV="center" color="#ababab" size="30" textExp="@city_id" marqueeSpeed="50" marqueeGap="2"/>
<Text name="QW" x="100" y="300" w="458" alignV="center" color="#ababab" size="30" textExp="#weather_location" marqueeSpeed="50" marqueeGap="2"/>
<Text name="QA" x="100" y="300" w="458" alignV="center" color="#ababab" size="30" textExp="#weather_id+#city_id" marqueeSpeed="50" marqueeGap="2"/>
需要把文本中
name="city_id"替换成name="A" name="weather_location"替换成name="B"以此类推顺序是从上到下 把每一个name=""中的名称替换为A B C D...如果超26字母那么就以AA AB AC...AAA AAB AAC...这种命名或类似你能想到不重名的方式来命名(但需要规避运算符号 如把一个名称替换成了*那么后边调用这个变量时就面临一个致命问题 #*+#- 使得代入不了运算 因此名称中不要出现运算符号 需要规避符号 +,-,*,/,%,**,|,||,=,==, !,not)
注意:如果名称出现2次以上 如name="city_id" 也需要把name="city_id"替换为name="A" 后续文本中如有关联那么也需要同步变更 特点是会在变量名前加#或@如下例子
希望得到如下文本
<Variable name="A" type="string" column="city_id"/>
<Variable name="B" type="string" column="city_name"/>
<Variable name="C" type="int" column="weather_type"/>
<Variable name="A" type="string" column="city_id"/>
<Text name="D" x="100" y="300" w="458" alignV="center" color="#ababab" size="30" textExp="@A" marqueeSpeed="50" marqueeGap="2"/>
<Text name="E" x="100" y="300" w="458" alignV="center" color="#ababab" size="30" textExp="#B" marqueeSpeed="50" marqueeGap="2"/>
<Text name="F" x="100" y="300" w="458" alignV="center" color="#ababab" size="30" textExp="#C+#A" marqueeSpeed="50" marqueeGap="2"/>
注意textExp不是固定调用以上变量名的 x="100" y="300" color="#ababab" size="30" 都可以调用 如x="#city_id" 需要变更为x="#A"
1实现替换name="" 中名称,使其变为无意义的字母或其它任何你知道的不重名的方式 让他人无法根据名称直接得知用途
2如果一个名称多次出现如下相同名称 那么需要替换成相同名称
<VariableCommand name="time_count" type="number[]" index="0" expression="0" />
<VariableCommand name="time_count" type="number[]" index="1" expression="0" />
<VariableCommand name="time_count" type="number[]" index="2" expression="0" />
<VariableCommand name="time_count" type="number[]" index="3" expression="0" />
变成
<VariableCommand name="B" type="number[]" index="0" expression="0" />
<VariableCommand name="B" type="number[]" index="1" expression="0" />
<VariableCommand name="B" type="number[]" index="2" expression="0" />
<VariableCommand name="B" type="number[]" index="3" expression="0" />
3如果name="tms0" 变成name="A"后续调用时 如#tms0或@tms0要同步这个名称变为#A @A
以下文本测试时使用- <Group x="540" y="483" w="#tms_w" align="center" pivotX="#tms_w/2" pivotY="0" scale="ifelse(#time_hour0}0,0.85,1)">
- <!-- 小时 -->
- <Time name="tms0" x="0" y="0" src="ToolsScreen_src/timing/number/number.png" space="2" formatExp="ifelse(#time_hour0}0,#time_hour0,'')+#time_hour1+#time_hour2+':'" visibility="(#time_hour0+#time_hour1+#time_hour2)}0"/>
- <!-- 分钟 : 秒 -->
- <Time name="tms1" x="#tms0.bmp_width" y="0" src="ToolsScreen_src/timing/number/number.png" space="2" formatExp="#time_minute1+#time_minute2+':'+#time_second1+#time_second2" />
- <!-- 毫秒 -->
- <Time name="milis1" x="#tms0.bmp_width+#tms1.bmp_width" y="0" src="ToolsScreen_src/timing/number/number.png" space="2" formatExp="'.'+#time_millisecond1+#time_millisecond2" />
- </Group>
- <Text x="540" y="425" align="center" size="30" color="#ffffff" text="最多计数4次哦" visibility="#timing_count==5" alpha="510*#start_ani"/>
- </Group>
- </Group>
- <Var name="time_count" type="number[]" size="4" const="true"/>
- <!-- #count_y_ani/2.06 -->
- <Array x="0" y="0+100*(1-#start_ani)+200-#count_y_ani/2.06" count="4" indexName="__count" alpha="510*#start_ani">
- <Group y="103*#__count" visibility="#__count{#timing_count*#start_ani">
- <!-- 序号 0-4 -->
- <Text x="245" y="984" size="27" color="#ffffff" textExp="'0'+int(#__count+1)"/>
- <!-- + 00:00.00 上次计时到本次间隔时间 -->
- <!-- <Text x="585" y="980" align="right" size="34" color="#ffffff" textExp="'+ '+'00:00.00'" alpha="180"/> -->
- <Text x="585" y="980" align="right" size="34" color="#ffffff" textExp="'+ '+int((#time_count[#__count]-#time_count[#__count-1])/1000%3600/60/10)+int((#time_count[#__count]-#time_count[#__count-1])/1000%3600/60%10)+':'+int((#time_count[#__count]-#time_count[#__count-1])/1000%60/10)+int((#time_count[#__count]-#time_count[#__count-1])/1000%60%10)+'.'+int((#time_count[#__count]-#time_count[#__count-1])/100%10)+int((#time_count[#__count]-#time_count[#__count-1])/10%10)" alpha="180"/>
- <!-- 本次计时时间:上次结束的时间+本次计次时间 -->
- <!-- <Text x="840" y="980" align="right" size="34" color="#ffffff" textExp="'02:30.25'" /> -->
- <Text x="840" y="980" align="right" size="34" color="#ffffff" textExp="int(#time_count[#__count]/1000%3600/60/10)+int(#time_count[#__count]/1000%3600/60%10)+':'+int(#time_count[#__count]/1000%60/10)+int(#time_count[#__count]/1000%60%10)+'.'+int(#time_count[#__count]/100%10)+int(#time_count[#__count]/10%10)"/>
- <Rectangle x="239" y="1047-1" w="646" h="2" fillColor="#ffffff" alpha="25" />
- </Group>
- </Array>
- <Var name="start_ani">
- <VariableAnimation name="startAni" initPause="true" loop="false">
- <AniFrame value="0" time="0" easeType="QuadEaseOut"/>
- <AniFrame value="1" time="300" easeType="QuadEaseOut"/>
- <AniFrame value="0" time="600" />
- <Triggers>
- <Trigger action="end" condition="#startAni.current_frame==600">
- <VariableCommand name="start_on" expression="0" persist="true"/>
- <VariableCommand name="start_pause" expression="0" persist="true"/>
- <VariableCommand name="time_count" type="number[]" index="0" expression="0" />
- <VariableCommand name="time_count" type="number[]" index="1" expression="0" />
- <VariableCommand name="time_count" type="number[]" index="2" expression="0" />
- <VariableCommand name="time_count" type="number[]" index="3" expression="0" />
- <VariableCommand name="timing_count" expression="0" persist="true" />
- </Trigger>
- </Triggers>
- </VariableAnimation>
- </Var>
- <Var name="count_y_ani">
- <VariableAnimation initPause="true" loop="false">
- <AniFrame value="#count_y_ani" time="0" easeType="QuadEaseOut"/>
- <AniFrame value="min(#timing_count,4)*103" time="300" easeType="QuadEaseOut"/>
- <AniFrame value="0" time="800"/>
- </VariableAnimation>
- </Var>
- <Group x="0" y="#count_y_ani/4.12" >
- <!-- 计次/停止(重置) -->
- <Image x="540-130*#start_ani" y="1420" pivotX="78" pivotY="78" align="center" alignV="center" srcExp="'ToolsScreen_src/timing/'+ifelse(#start_pause==1,'Stop','count')+'.png'" visibility="#start_on==1"/>
- <Button x="540-130*#start_ani" y="1420" w="156" h="156" visibility="#start_on==1" align="center" alignV="center">
- <Pressed>
- <Image x="540-130*#start_ani" y="1420" src="ToolsScreen_src/timing/pressed.png" alpha="30" align="center" alignV="center"/>
- </Pressed>
- <Triggers>
- <!-- 计次 -->
- <Trigger action="up" condition="#start_pause==0">
- <VariableCommand name="timing_count" expression="min(#timing_count+1,5)" persist="true" />
- <VariableCommand name="time_count" type="number[]" index="#timing_count-1" expression="#Time_total" persist="true"/>
- <AnimationCommand target="count_y_ani" command="play(0,300)" />
- <VariableCommand name="time_count0" expression="#time_count[0]" persist="true"/>
- <VariableCommand name="time_count1" expression="#time_count[1]" persist="true"/>
- <VariableCommand name="time_count2" expression="#time_count[2]" persist="true"/>
- <VariableCommand name="time_count3" expression="#time_count[3]" persist="true"/>
- </Trigger>
- <!-- 停止(重置) -->
- <Trigger action="up" condition="#start_pause==1">
- <AnimationCommand target="count_y_ani" command="play(300,800)" />
- <AnimationCommand target="clock_minute_ani" command="play(0,500)" condition="#clock_minute_ani==0"/>
- <AnimationCommand target="start_ani" command="play(300,600)" condition="#start_ani==1"/>
- </Trigger>
- </Triggers>
- </Button>
- <!-- 开始/继续/暂停 -->
- <Image x="540+130*#start_ani" y="1420" pivotX="78" pivotY="78" align="center" alignV="center" srcExp="'ToolsScreen_src/timing/'+ifelse(#start_on==0||#start_pause==1,'start','pause')+'.png'" />
- <Button x="540+130*#start_ani" y="1420" w="156" h="156" align="center" alignV="center" >
- <Pressed>
- <Image x="540+130*#start_ani" y="1420" src="ToolsScreen_src/timing/pressed.png" align="center" alignV="center" alpha="30"/>
- </Pressed>
- <Triggers>
- <!-- 开始 -->
- <Trigger action="up" condition="#start_on==0">
- <VariableCommand name="start_on" expression="1" persist="true" delay="10"/>
- <VariableCommand name="Start_timing" expression="#time_sys" persist="true"/>
- <VariableCommand name="Time_total" expression="0" persist="true" />
- <AnimationCommand target="start_ani" command="play(0,300)" condition="#start_ani==0"/>
- </Trigger>
- <Trigger action="up" condition="#start_on==1">
- <!-- 继续 -->
- <VariableCommand name="Start_timing" expression="#time_sys" persist="true" condition="#start_pause==1"/>
- <!-- 暂停 -->
- <VariableCommand name="Time_total_pause" expression="#Time_total" persist="true" condition="#start_pause==0"/>
- <VariableCommand name="start_pause" expression="int(#start_pause+1)%2" persist="true" />
- </Trigger>
- </Triggers>
- </Button>
- <!-- 返回按钮 -->
- <Image x="540" y="1700" src="ToolsScreen_src/back.png" align="center" alignV="center" touchable="true" alpha="170+50*#back_flag">
- <Triggers>
- <Trigger action="down">
- <VariableCommand name="back_flag" expression="1"/>
- </Trigger>
- <Trigger action="up">
- <VariableCommand name="back_flag" expression="0"/>
- <AnimationCommand target="init_tools_ani" command="play(800,0)" condition="#init_tools_ani==1"/>
- </Trigger>
- </Triggers>
- </Image>
- </Group>
- <Button w="1080" h="#screen_height" interceptTouch="true"/>
- </Group>
复制代码
|