调用方式
addon:CreateConditionIcon()
可直接通过 addon 使用,无需依赖项。
作用
使用条件控件生命周期创建一个原生图像控件。SetImage 和 SetImageSize 用于选择材质;SetText 可选地添加说明文字。OnClick、OnEnter 和 OnLeave 使用共享的回调约定。将该控件使用 parent:AddChild(widget) 添加到回调的父级。
参数
| 名称 | 类型 | 作用 |
|---|---|---|
self | RMAddon | Rotation Master 插件实例(使用冒号调用时隐含传入)。 |
返回值
| 1 | RMConditionIcon | 带有标签、材质、禁用状态和回调的原生图像控件。 |
|---|
版本
内置辅助函数在每个版本上都会注册。不同的是它们读取的游戏 API;某个 API 缺失时,辅助函数会改用后备方案,或返回 nil 并附上原因。
它不直接读取任何游戏 API。
插件如何调用它
- 变形形态 (widget)
local formIcon = addon:CreateConditionIcon() - 已雕刻符文 (widget)
runeIcon = addon:CreateConditionIcon() Conditions.talent.iconlocal widget=addon:CreateConditionIcon();widget:SetWidth(64);widget:SetImageSize(60,60)
依赖项
constructor→UI.condition_icon.constructor
源码
UI/condition_icon.lua,第 73 行。在游戏中为只读;“复制”会生成一份可编辑的副本。
UI.condition_icon.CreateConditionIcon(self)
return self:AcquireConditionWidget('RM-ConditionIcon',constructor)