diff --git a/res/layouts/pages/content_menu.xml b/res/layouts/pages/content_menu.xml new file mode 100644 index 00000000..da1b0bbc --- /dev/null +++ b/res/layouts/pages/content_menu.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/layouts/pages/content_menu.xml.lua b/res/layouts/pages/content_menu.xml.lua new file mode 100644 index 00000000..4effb782 --- /dev/null +++ b/res/layouts/pages/content_menu.xml.lua @@ -0,0 +1,51 @@ +function on_open(params) + if params then + mode = params.mode + end + refresh() +end + +function place_pack(panel, packinfo, callback) + if packinfo.error then + callback = nil + end + if packinfo.has_indices then + packinfo.id_verbose = packinfo.id.."*" + else + packinfo.id_verbose = packinfo.id + end + packinfo.callback = callback + panel:add(gui.template("pack", packinfo)) + if not callback then + document["pack_"..packinfo.id].enabled = false + end +end + +function open_pack(id) + local packinfo = pack.get_info(id) + + if packinfo['dependencies'] == nil then document.dependencies.text = 'None' else document.dependencies.text = table.tostring(packinfo['dependencies']) end + if packinfo['creator'] == '' then document.author.text = 'None' else document.author.text = packinfo['creator'] end + if packinfo['version'] == nil then document.version.text = 'None' else document.version.text = packinfo['version'] end + if packinfo['description'] == nil then document.description.text = 'None' else document.description.text = packinfo['description'] end +end + +function refresh() + local packs_installed = pack.get_installed() + local packs_available = pack.get_available() + + for i,k in ipairs(packs_available) do + table.insert(packs_installed, k) + end + + local contents = document.contents + contents:clear() + + for i,id in ipairs(packs_installed) do + local packinfo = pack.get_info(id) + + packinfo.index = i + local callback = string.format('open_pack("%s")', id) + place_pack(contents, packinfo, callback) + end +end diff --git a/res/layouts/pages/main.xml b/res/layouts/pages/main.xml index 3ff1c23f..11f53136 100644 --- a/res/layouts/pages/main.xml +++ b/res/layouts/pages/main.xml @@ -3,5 +3,6 @@ + diff --git a/res/texts/ru_RU.txt b/res/texts/ru_RU.txt index f4cdfbc0..d04997f9 100644 --- a/res/texts/ru_RU.txt +++ b/res/texts/ru_RU.txt @@ -6,6 +6,10 @@ Cancel=Отмена Back=Назад Continue=Продолжить Add=Добавить +Version=Версия +Creator=Автор +Dependencies=Зависимости +Description=Описание Converting world...=Выполняется конвертация мира... error.pack-not-found=Не удалось найти пакет @@ -31,6 +35,7 @@ menu.Page not found=Страница не найдена menu.Quit=Выход menu.Save and Quit to Menu=Сохранить и Выйти в Меню menu.Settings=Настройки +menu.Contents Menu=Меню контентпаков world.Seed=Зерно world.Name=Название