UI
UI namespace
danger
Please be careful when accessing and overriding settings of other scripts!
Properties
rootMenus
: Menu[] - std::vector<Menu>
List of all root menus.
Functions
GetLanguage
UI.GetLanguage()
→ number - integer
Returns currently selected language.
LoadTranslationFromFile
UI.LoadTranslationFromFile(
relativePath
: string - path, override
: boolean )
→ void
Argument | Type | Description |
---|---|---|
relativePath | string - path | Relative path to translation json file. |
override | boolean | If true, it will override all existing translation keys. |
Load custom translation json
file.
Example: Basic LoadTranslationFromFile example.
UI.LoadTranslationFromFile("assets/translation.json", true)
LoadTranslationFromBlob
UI.LoadTranslationFromBlob(
jsonBlob
: string, override
: boolean )
→ void
Argument | Type | Description |
---|---|---|
jsonBlob | string | Translation json. |
override | boolean | If true, it will override all existing translation keys. |
Load custom translation json
blob.
TranslateString
UI.TranslateString(
key
: string )
→ string
Argument | Type | Description |
---|---|---|
key | string | Translation key. Should be English string. |
Get translation for selected language and provided key.
Examples
Access Orbwalker Hold Radius settings and temporarily override it.
-- Warning: This is just a PoC to give you an idea how it can be done.
-- We highly advice not to mess around with settings, but if you have to - then please be responsible.
-- If you override some value - make sure to restore it immediately after you executed your logic.
local orbwalkerMenu
for _, v in UI.rootMenus:pairs() do
if v and v.name and v.name == "Orbwalker" then -- Locate Orbwalker Menu
orbwalkerMenu = v
break
end
end
local holdRadius = orbwalkerMenu["Configuration"]["HoldRadius"] -- Access HoldRadius setting
local originalHoldRadius
local function PushHoldRadius(value)
if originalHoldRadius then return end -- Make sure we don't override it twice
originalHoldRadius = holdRadius.value -- Store original value
holdRadius.value = value -- Override value
end
local function PopHoldRadius()
if not originalHoldRadius then return end
holdRadius.value = originalHoldRadius
originalHoldRadius = nil
end
local function MyLogic()
PushHoldRadius(50) -- Override
-- Perform logic
PopHoldRadius() -- Restore
end
Callback.Bind(CallbackType.OnUnload, function()
PopHoldRadius() -- Just in case do it OnUnload
return CallbackResult.Dispose
end)