Информация о файле
This "super" add-on is an assistant to add-on function. Similar to AddonManager. However, instead of being able to turn on/off or hide add-ons; it is capable of allowing add-on developers to quickly and simply create buttons or user input abilities for their add-ons. This allows the user and the developer to reduce the amount of memory their add-on uses if they want to allow people to customize certain aspects of the add-on.
Этот "супер" аддон - помощник для для других аддонов. Наподобие AddonManager. Однако, вместо того, чтобы включить/выключить или скрывать аддоны, этот аддон позволяет разработчикам, быстро и просто создавать окно с настройками, или пользовательский ввод для своего аддона. Это позволяет уменьшить объем памяти, используемый аддоном, когда хочется сделать, чтобы люди могли настраивать некоторые аспекты аддона.
--Developer Advice--
Response to "CONFIG_INIT_EVENT" -
Response to "CONFIG_EVENT_"..common.GetAddonName() -
- Required -
- NoB - This is the number of the button to be created.
name - This is for the name of the button.
btnType - This is the type of button;- "Simple" - For simple buttons.
"T/F" - For true and false buttons.
"EditLine" - For user input lines.
"Color" - For a customizable color button.
"Slider" - For a sliding button.
"Tabled" - For a forward/backward table button.
- "Simple" - For simple buttons.
- NoB - This is the number of the button to be created.
- Optional -
- state - This is for the "T/F" button, true or false.
value - This is mainly for the button types "Tabled" and "EditLine" to update the value.
steps - This is for the number of steps for the "Slider" button.
pos - This is for the position the "Slider" button should start at.
color - This is the RGBA current value of the color button.
texture - This is the textureId of a texture.
sizeX - Size for X value of "Tabled" texture.
sizeY - Size for Y value of "Tabled" texture.
text - Text for "Tabled" text.
scale - Scale for "Tabled" text.
- state - This is for the "T/F" button, true or false.
- Example -Code:userMods.SendEvent("CONFIG_EVENT_RESPONSE", {NoB = 0, name = "Dance", btnType = "T/F", state = true})
Response to "CONFIG_CHANGE_BUTTON_RESPONSE" -
- Required -
- NoB - Number of the button to change text.
Optional -- name - Name of the button. "EditLine" or "Tabled" buttons.
value - The new value for the button. "EditLine" or "Tabled" buttons.
texture - The new texture. "Tabled" buttons only.
sizeX - Size for X value of "Tabled" texture.
text - Text for "Tabled" text.
scale - Scale for "Tabled" text.
Example -Code:userMods.SendEvent("CONFIG_CHANGE_BUTTON_RESPONSE", {NoB = 0, name = "Dance2", value = "Tango"})
Response from "CONFIG_SIMPLE_"..common.GetAddonName() -
- Values Sent - {name}
Response from "CONFIG_BUTTON_"..common.GetAddonName() -
- Values Sent - {name, state}
Response from "CONFIG_EDIT_LINE_"..common.GetAddonName() -
- Values Sent - {name, text}
Response from "CONFIG_COLOR_"..common.GetAddonName() -
- Values Sent - {name, color}
Response from "CONFIG_SLIDER_"..common.GetAddonName() -
- Values Sent - {name, pos}
Response from "CONFIG_TABLED_"..common.GetAddonName() -
- Values Sent - {name, dir} (dir is "+" or "-")
Example code for True/False buttons:
function ConfigInitEvent()
userMods.SendEvent("CONFIG_INIT_EVENT_RESPONSE", { sender = common.GetAddonName() })
end
function ConfigEvent()
local num = 0
for i, v in NPB do
userMods.SendEvent("CONFIG_EVENT_RESPONSE", {NoB = num, name = L [GetGameLocalization()] , btnType = "T/F", state = v})
num = num + 1
end
end
function ConfigButtonResponse(p)
local s
for i, v in L [GetGameLocalization()] do
if v == p.name then
s = i
end
end
if NPB ~= nil then
NPB = not NPB
end
userMods.SetGlobalConfigSection("NPB", NPB)
common.StateUnloadManagedAddon( "UserAddon/"..common.GetAddonName() )
common.StateLoadManagedAddon( "UserAddon/"..common.GetAddonName() )
end
-- CONFIG WINDOW EVENTS (INIT, RESPONSE, BUTTON)
common.RegisterEventHandler( ConfigInitEvent, "CONFIG_INIT_EVENT" )
common.RegisterEventHandler( ConfigEvent, "CONFIG_EVENT_"..common.GetAddonName())
common.RegisterEventHandler( ConfigButtonResponse, "CONFIG_BUTTON_"..common.GetAddonName())
end
Что нового в версии 7 Просмотр изменений
Размещено
- фикс под обновление 7.0 (от LEM)