请选择 进入手机版 | 继续访问电脑版

站内搜索

搜索
热搜: 活动 交友 discuz

iFAction 世界需要你的想象力!

[请帮忙] 自定义控件组怎么获取其中的数据

4

主题

7

帖子

115

积分

iF基础方块

Rank: 3Rank: 3

积分
115
发表于 2021-12-12 20:46:22 | 显示全部楼层 |阅读模式
我用自定义控件组做了一排按钮,怎么用代码判断当前点击的是哪个按钮?和怎么获取当前按下按钮的数据?


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
Jwx

4

主题

11

帖子

64

积分

iF基础方块

Rank: 3Rank: 3

积分
64
发表于 2021-12-16 15:08:08 | 显示全部楼层
You can see this treat for reference (control group part) http://bbs.cedong.com.cn/forum.p ... =764&extra=page%3D2

And you can get data of each button and store it in a variable with a scripts to use it later.

Ex. your traverse object in the UI control group could be an a data array like : items = ["coins","potions","gold","medals"]

In Controls, you can name your button with: obj, to display names in each button, then you can add an action when click it whit a script like: RV.GameData.value[ID] = obj;  to store the value in a string variable.

---------------------------------------
你可以看看这个供参考(对照组部分) http://bbs.cedong.com.cn/forum.p ... =764&extra=page%3D2

您可以获取每个按钮的数据并将其存储在带有脚本的变量中以供以后使用。

前任。 UI 控制组中的遍历对象可能是一个数据数组,例如:items = ["coins","potions","gold","medals"]

在控件中,您可以将您的按钮命名为:obj,以在每个按钮中显示名称,然后您可以在单击它时添加一个动作,例如:RV.GameData.value[ID] = obj; 将值存储在字符串变量中。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

联系我们
QQ群:977585123
iFAction下载
Windows客户端
反馈
意见建议
iFAction

iFAction

京ICP备15053274号-1

Powered by Discuz! X3.4 © 2001-2013 Comsenz Inc.