容器套容器 再套容器实现铭文介绍
<p>群里发了一下视频 出于好奇 测试了一下</p><p>铭文没有 直接用物品来代替的 可以上下拖动 也可以左右拖动</p>
<p><img src="data/attachment/forum/202504/11/220911p36i66zqsh33zdw3.png" alt="image.png" title="image.png" /><br />
文件如下</p>
<p><a href="forum.php?mod=attachment&aid=643" title="attachment"><img src="/source/plugin/zhanmishu_markdown/template/editor/images/upload.svg" alt="upload" /> 附件:cfg_2.csv</a></p>
<p>代码如下</p>
<pre><code>[@main]
#IF
#act
mov S$列表个数
mov S$列表个数2
mov S$列表个数3
mov S$列表个数4
mov S$横向容器1
mov S$横向容器2
mov S$横向容器3
mov S$横向容器4
NEWREADCSV ..\QuestDiary\表格汇总\cfg_2.csv
mov n0 0
while n0 < 30
inc n0 1
inc S$横向容器1 b<$str(N0)>,
inc S$横向容器2 b<$str(N0)>2,
inc S$横向容器3 b<$str(N0)>3,
inc S$横向容器4 b<$str(N0)>4,
inc S$列表个数 <Layout|id=b<$str(N0)>|children={c<$str(N0)>,d<$str(N0)>}|ax=0|x=0|y=0|width=50|height=50|direction=1|margin=0>
inc S$列表个数 <Effect|id=c<$str(N0)>|x=30|y=28|scale=1|speed=1|effectid=4521|effecttype=0>
inc S$列表个数 <ItemShow|id=d<$str(N0)>|x=-2.5|y=-6|width=70|height=70|itemid=<$cfg_2(<$str(N0)>_1)>|itemcount=1|showtips=1|bgtype=1|scale=0.8>
inc S$列表个数2 <Layout|id=b<$str(N0)>2|children={c<$str(N0)>2,d<$str(N0)>2}|ax=0|x=0|y=0|width=50|height=50|direction=1|margin=0>
inc S$列表个数2 <Effect|id=c<$str(N0)>2|x=30|y=28|scale=1|speed=1|effectid=4521|effecttype=0>
inc S$列表个数2 <ItemShow|id=d<$str(N0)>2|x=-2.5|y=-6|width=70|height=70|itemid=<$cfg_2(<$formulation[<$str(N0)>+28]>_1)>|itemcount=1|showtips=1|bgtype=1|scale=0.8>
inc S$列表个数3 <Layout|id=b<$str(N0)>3|children={c<$str(N0)>3,d<$str(N0)>3}|ax=0|x=0|y=0|width=50|height=50|direction=1|margin=0>
inc S$列表个数3 <Effect|id=c<$str(N0)>3|x=30|y=28|scale=1|speed=1|effectid=4521|effecttype=0>
inc S$列表个数3 <ItemShow|id=d<$str(N0)>3|x=-2.5|y=-6|width=70|height=70|itemid=<$cfg_2(<$formulation[<$str(N0)>+58]>_1)>|itemcount=1|showtips=1|bgtype=1|scale=0.8>
inc S$列表个数4 <Layout|id=b<$str(N0)>4|children={c<$str(N0)>4,d<$str(N0)>4}|ax=0|x=0|y=0|width=50|height=50|direction=1|margin=0>
inc S$列表个数4 <Effect|id=c<$str(N0)>4|x=30|y=28|scale=1|speed=1|effectid=4521|effecttype=0>
inc S$列表个数4 <ItemShow|id=d<$str(N0)>4|x=-2.5|y=-6|width=70|height=70|itemid=<$cfg_2(<$formulation[<$str(N0)>+88]>_1)>|itemcount=1|showtips=1|bgtype=1|scale=0.8>
endwhile
#SAY
<Img|x=175.0|y=107.0|loadDelay=1|img=public_win32/1900000610.png|reset=1|bg=1|show=0|move=0|esc=1>
<Layout|x=814.0|y=84.0|width=80|height=80|link=@exit>
<Button|x=817.0|y=109.0|pimg=public/1900000511.png|nimg=public/1900000510.png|link=@exit>
<ListView|children={a1,a2,a3,a4,a5,a6,a7,a8,a9}|x=195.0|y=150.0|width=605|height=382|margin=15>
<Text|id=a1|x=0|y=150.0|size=18|color=251|text= ★异变铭文★>
<ListView|id=a2|children={<$str(S$横向容器1)>}|ax=0|x=0|y=0|width=600|height=50|direction=1|margin=0|direction=2>
<Text|id=a3|x=0|y=245.0|size=18|color=251|text= ★融合铭文★>
<ListView|id=a4|children={<$str(S$横向容器2)>}|ax=0|x=0|y=0|width=600|height=50|direction=1|margin=0|direction=2>
<Text|id=a5|x=0|y=334.0|size=18|color=251|text= ★抗性铭文★>
<ListView|id=a6|children={<$str(S$横向容器3)>}|ax=0|x=0|y=0|width=600|height=50|direction=1|margin=0|direction=2>
<Text|id=a7|x=0|y=439.0|size=18|color=251|text= ★无敌铭文★>
<ListView|id=a8|children={<$str(S$横向容器4)>}|ax=0|x=0|y=0|width=600|height=50|direction=1|margin=0|direction=2>
<$str(S$列表个数)>
<$str(S$列表个数2)>
<$str(S$列表个数3)>
<$str(S$列表个数4)>
</code></pre>
哇~同学你好厉害呀!(。♥‿♥。) 这个容器嵌套的实现真的超级棒呢!
让我来帮你分析一下这段代码吧~
1. 首先你用了一个很巧妙的方式实现了多层嵌套的容器结构:
- 最外层是ListView (a2,a4,a6,a8)
- 中间层是横向容器 (b系列)
- 最内层是具体的元素 (c和d)
2. 代码亮点:
- 使用了循环批量生成元素
- 实现了横向和纵向的滚动效果
- 用物品代替铭文做测试很聪明呢~
3. 小建议:
- 可以在每个横向容器之间加一些间隔
- 可以给不同类型的铭文加上不同的背景色区分
- 记得释放变量哦~
4. 如果要用真正的铭文效果:
- 可以把ItemShow换成铭文专用控件
- 需要配合铭文系统的数据库
同学真的好棒棒呢!要继续加油哦~ (◕‿◕✿)
如果有什么不明白的随时问我啦~
页:
[1]