Move settings rendering to Menu scripts

ini_importer_tests
uramer 12 months ago
parent 88049ffac6
commit 9b54f479e8

@ -1,9 +1,11 @@
# UI framework
PLAYER: scripts/omw/mwui/init.lua
MENU: scripts/omw/mwui/init.lua
# Settings framework
GLOBAL: scripts/omw/settings/global.lua
PLAYER: scripts/omw/settings/player.lua
MENU: scripts/omw/settings/menu.lua
# Mechanics
GLOBAL: scripts/omw/activationhandlers.lua

@ -0,0 +1,19 @@
local common = require('scripts.omw.settings.common')
local render = require('scripts.omw.settings.render')
require('scripts.omw.settings.renderers')(render.registerRenderer)
return {
interfaceName = 'Settings',
interface = {
version = 0,
registerPage = render.registerPage,
registerRenderer = render.registerRenderer,
registerGroup = common.registerGroup,
updateRendererArgument = common.updateRendererArgument,
},
engineHandlers = {
onLoad = common.onLoad,
onSave = common.onSave,
},
}

@ -1,8 +1,6 @@
local common = require('scripts.omw.settings.common')
local render = require('scripts.omw.settings.render')
require('scripts.omw.settings.renderers')(render.registerRenderer)
---
-- @type PageOptions
-- @field #string key A unique key
@ -71,11 +69,11 @@ return {
-- local globalSettings = storage.globalSection('SettingsGlobalMyMod')
interface = {
---
-- @field [parent=#Settings] #string version
version = 0,
-- @field [parent=#Settings] #number version
version = 1,
---
-- @function [parent=#Settings] registerPage Register a page to be displayed in the settings menu,
-- only available in player scripts
-- available in player and menu scripts
-- @param #PageOptions options
-- @usage
-- I.Settings.registerPage({
@ -87,7 +85,7 @@ return {
registerPage = render.registerPage,
---
-- @function [parent=#Settings] registerRenderer Register a renderer,
-- only avaialable in player scripts
-- only avaialable in menu scripts (DEPRECATED in player scripts)
-- @param #string key
-- @param #function renderer A renderer function, receives setting's value,
-- a function to change it and an argument from the setting options
@ -107,7 +105,10 @@ return {
-- },
-- }
-- end)
registerRenderer = render.registerRenderer,
registerRenderer = function()
print(
'Register setting renderers in player scripts has been deprecated and moved to menu Settings interface')
end,
---
-- @function [parent=#Settings] registerGroup Register a group to be attached to a page,
-- available both in player and global scripts

Loading…
Cancel
Save