可选导出标志
DeviceMessage()
Section titled “DeviceMessage()”此导出标志用于在 SignalRGB 的关联设备页面上显示消息。您可以使用此标志向用户显示任何特殊情况或所需的描述。
返回值是包含 2 个字符串的 1D 数组。第一个是弹出窗口中显示的文本,第二个是悬停提示。
export function DeviceMessage() { return ["This device has a weird quirk!", "The quirk is this!"]; }SupportsSubdevices()
Section titled “SupportsSubdevices()”此导出标志用于仅支持子设备且没有板载 LED 可控制的灯光控制器。当返回 true 时,此导出将防止父设备出现在布局的 canvas 上,并禁用编辑其位置设置。
export function SupportsSubdevices(){ return true; }on*Changed()
Section titled “on*Changed()”此导出函数不被后端使用,而是用作插件内部的回调,以在设置更改时通知插件。以下示例展示了每次用户更改滑块时设置鼠标 DPI,而不是在渲染循环中轮询值并在那里处理更改。
这些回调在 RGB 数据从 canvas 获取之后、当前渲染帧的渲染函数调用之前被调用。
// Setting Exportexport function ControllableParameters(){ return [{ property: "dpi1", label: "DPI", step: "50", type: "number", min: "200", max: "18000", default: "800" }, ];}
// DPI Functionsexport function ondpi1Changed() { setDpi(dpi1);}
function setDpi(dpi) { if (!SettingControl) { return; } device.log(`Setting Dpi to ${dpi}`); Corsair_Set(CORSAIR_DPI_X, dpi); Corsair_Set(CORSAIR_DPI_Y, dpi);
device.log(`DPI x is now ${Corsair_Get(CORSAIR_DPI_X)}`); device.log(`DPI y is now ${Corsair_Get(CORSAIR_DPI_Y)}`);}