调用方式
addon:CreateConditionSlider()
可直接通过 addon 使用,无需依赖项。
作用
创建一个带有滑块和数字输入框的原生数值条件输入控件。配置 SetSliderValues、SetValue、SetIsPercent 和 SetCallback;OnValueChanged 报告已提交的值。使用 parent:AddChild(widget) 添加它。
参数
| 名称 | 类型 | 作用 |
|---|---|---|
self | RMAddon | Rotation Master 插件实例(使用冒号调用时隐含传入)。 |
返回值
| 1 | RMConditionInput | 支持滑块范围、百分比显示和待处理编辑验证的数值控件。 |
|---|
版本
内置辅助函数在每个版本上都会注册。不同的是它们读取的游戏 API;某个 API 缺失时,辅助函数会改用后备方案,或返回 nil 并附上原因。
它不直接读取任何游戏 API。
插件如何调用它
- 距离内计数 (widget)
local distance = addon:CreateConditionSlider() - 距离生命值百分比达到所需时间 (widget)
local health = addon:CreateConditionSlider()
依赖项
constructor→UI.condition_inputs.constructor
源码
UI/condition_inputs.lua,第 161 行。在游戏中为只读;“复制”会生成一份可编辑的副本。
UI.condition_inputs.CreateConditionSlider(self)
local w=addon:AcquireConditionWidget('RM-ConditionSlider',function() return constructor(true) end)
---@cast w RMConditionInput
return w