diff --git a/mods/UI/AdminListUI/src/AdminListUI.lua b/mods/UI/AdminListUI/src/AdminListUI.lua index 0bcf706..78e33ff 100644 --- a/mods/UI/AdminListUI/src/AdminListUI.lua +++ b/mods/UI/AdminListUI/src/AdminListUI.lua @@ -40,24 +40,24 @@ local function getFormSpecString(self, playerName, isSelect) size = {x=21, y=12}, }) - listForm: - list('current_player', 'main', 10.5, 6.5, 8, 4): - scrollContainer(listFormItems, 0.5, 0.5, 9, 11, 'admin_commands:list_items', 'vertical'): - scrollbar(10, 0.5, 0.25, 10, 'vertical', 'admin_commands:list_items', self:getContex(playerName, 'scroll')) + listForm + :list('current_player', 'main', 10.5, 6.5, 8, 4) + :scrollContainer(listFormItems, 0.5, 0.5, 9, 11, 'admin_commands:list_items', 'vertical') + :scrollbar(10, 0.5, 0.25, 10, 'vertical', 'admin_commands:list_items', self:getContex(playerName, 'scroll')) if isSelect then ---@type ItemStackString local item = self:getContex(playerName, 'select_item') local itemDef = core.registered_items[item] - listForm: - itemImage(11, 0.5, 2, 2, item): - areaLabel(11, 4.5, 4, 1, 'Add to inventory:'): - button(11, 5, 3, 1, 'admin_commands:list_add_item', '1'): - button(14, 5,3, 1, 'admin_commands:list_add_item', ''..tostring(itemDef.stack_max)): - areaLabel(14.5, 0.5, 6, 4, - item..'\n\n'.. - itemDef._title..'\n'.. - itemDef._description) + listForm + :itemImage(11, 0.5, 2, 2, item) + :areaLabel(11, 4.5, 4, 1, 'Add to inventory:') + :button(11, 5, 3, 1, 'admin_commands:list_add_item', '1') + :button(14, 5,3, 1, 'admin_commands:list_add_item', ''..tostring(itemDef.stack_max)) + :areaLabel(14.5, 0.5, 6, 4, + item..'\n\n'.. + itemDef._title..'\n'.. + itemDef._description) end return listForm:toString() diff --git a/mods/UI/PlayerInventoryUI/src/PlayerInventoryUI.lua b/mods/UI/PlayerInventoryUI/src/PlayerInventoryUI.lua index bb031c2..9a0db07 100644 --- a/mods/UI/PlayerInventoryUI/src/PlayerInventoryUI.lua +++ b/mods/UI/PlayerInventoryUI/src/PlayerInventoryUI.lua @@ -79,23 +79,23 @@ local function getCompactForm(self, playerName) -- We get a table for textures for tab selection buttons according to the active tab. local leftTabButtonTextures = tabButtonTextures[leftTabName] - InventoryForm: + InventoryForm -- Removing the inventory background color: - bgcolor('#00000000', 'neither'): + :bgcolor('#00000000', 'neither') -- A permanent part of the inventory: - background(0, 0.5, 14, 12.5, 'player_inventory_compact_middle_background.png', false): - listColors('#00000000', '#e1b69150'): - list('current_player', 'main', 1.5,9.75, 9,1): - list('current_player', 'main', 1.5,11.25, 9,1, 9): + :background(0, 0.5, 14, 12.5, 'player_inventory_compact_middle_background.png', false) + :listColors('#00000000', '#e1b69150') + :list('current_player', 'main', 1.5,9.75, 9,1) + :list('current_player', 'main', 1.5,11.25, 9,1, 9) -- Inventory mode switch button (compact/full): - imageButton(13, 9.75, 0.5, 1, 'player_inventory_compact_mode_button_on.png', 'change_compact_mode'): + :imageButton(13, 9.75, 0.5, 1, 'player_inventory_compact_mode_button_on.png', 'change_compact_mode') -- Tab: - container(tabs[leftTabName](self, playerName, 'left'), 1.5, 0.5): + :container(tabs[leftTabName](self, playerName, 'left'), 1.5, 0.5) -- Selection buttons for the (left) panel: - imageButton(1.5,0,2,0.5, leftTabButtonTextures[1],'select_left_craft_tab', core.colorize('#e1b691','craft')): - imageButton(3.5,0,2,0.5, leftTabButtonTextures[2], 'select_left_equip_tab', core.colorize('#e1b691','equip')): - imageButton(5.5,0,2,0.5, leftTabButtonTextures[3], 'select_left_bag_tab', core.colorize('#e1b691','bags')): - imageButton(7.5,0,2,0.5, leftTabButtonTextures[4], 'select_left_ref_tab', core.colorize('#e1b691','refs')) + :imageButton(1.5,0,2,0.5, leftTabButtonTextures[1],'select_left_craft_tab', core.colorize('#e1b691','craft')) + :imageButton(3.5,0,2,0.5, leftTabButtonTextures[2], 'select_left_equip_tab', core.colorize('#e1b691','equip')) + :imageButton(5.5,0,2,0.5, leftTabButtonTextures[3], 'select_left_bag_tab', core.colorize('#e1b691','bags')) + :imageButton(7.5,0,2,0.5, leftTabButtonTextures[4], 'select_left_ref_tab', core.colorize('#e1b691','refs')) return InventoryForm:toString() end @@ -133,29 +133,29 @@ local function getFullForm(self, playerName) local leftTabButtonTextures = tabButtonTextures[leftTabName] local rightTabButtonTextures = tabButtonTextures[rightTabName] - InventoryForm: + InventoryForm -- Removing the inventory background color: - bgcolor('#00000000', 'neither'): + :bgcolor('#00000000', 'neither') -- A permanent part of the inventory: - background(0, 9.5, 22, 3, 'player_inventory_middle_background.png', false): - listColors('#00000000', '#e1b69150'): - list('current_player', 'main', 5.5,9.75, 9,1): - list('current_player', 'main', 5.5,11.25, 9,1, 9): + :background(0, 9.5, 22, 3, 'player_inventory_middle_backgound.png', false) + :listColors('#00000000', '#e1b69150') + :list('current_player', 'main', 5.5,9.75, 9,1) + :list('current_player', 'main', 5.5,11.25, 9,1, 9) -- Inventory mode switch button (compact/full): - imageButton(17, 9.75, 0.5, 1, 'player_inventory_compact_mode_button_off.png', 'change_compact_mode'): + :imageButton(17, 9.75, 0.5, 1, 'player_inventory_compact_mode_button_off.png', 'change_compact_mode') -- Tabs: - container(tabs[leftTabName](self, playerName, 'left'), 0, 0.5): - container(tabs[rightTabName](self, playerName, 'right'), 11, 0.5): + :container(tabs[leftTabName](self, playerName, 'left'), 0, 0.5) + :container(tabs[rightTabName](self, playerName, 'right'), 11, 0.5) -- Selection buttons for the left panel: - imageButton(0,0,2,0.5, leftTabButtonTextures[1],'select_left_craft_tab', core.colorize('#e1b691','craft')): - imageButton(2,0,2,0.5, leftTabButtonTextures[2], 'select_left_equip_tab', core.colorize('#e1b691','equip')): - imageButton(4,0,2,0.5, leftTabButtonTextures[3], 'select_left_bag_tab', core.colorize('#e1b691','bags')): - imageButton(6,0,2,0.5, leftTabButtonTextures[4], 'select_left_ref_tab', core.colorize('#e1b691','refs')): + :imageButton(0,0,2,0.5, leftTabButtonTextures[1],'select_left_craft_tab', core.colorize('#e1b691','craft')) + :imageButton(2,0,2,0.5, leftTabButtonTextures[2], 'select_left_equip_tab', core.colorize('#e1b691','equip')) + :imageButton(4,0,2,0.5, leftTabButtonTextures[3], 'select_left_bag_tab', core.colorize('#e1b691','bags')) + :imageButton(6,0,2,0.5, leftTabButtonTextures[4], 'select_left_ref_tab', core.colorize('#e1b691','refs')) -- Selection buttons for the right panel: - imageButton(11,0,2,0.5, rightTabButtonTextures[1],'select_right_craft_tab', core.colorize('#e1b691','craft')): - imageButton(13,0,2,0.5, rightTabButtonTextures[2], 'select_right_equip_tab', core.colorize('#e1b691','equip')): - imageButton(15,0,2,0.5, rightTabButtonTextures[3], 'select_right_bag_tab', core.colorize('#e1b691','bags')): - imageButton(17,0,2,0.5, rightTabButtonTextures[4], 'select_right_ref_tab', core.colorize('#e1b691','refs')) + :imageButton(11,0,2,0.5, rightTabButtonTextures[1],'select_right_craft_tab', core.colorize('#e1b691','craft')) + :imageButton(13,0,2,0.5, rightTabButtonTextures[2], 'select_right_equip_tab', core.colorize('#e1b691','equip')) + :imageButton(15,0,2,0.5, rightTabButtonTextures[3], 'select_right_bag_tab', core.colorize('#e1b691','bags')) + :imageButton(17,0,2,0.5, rightTabButtonTextures[4], 'select_right_ref_tab', core.colorize('#e1b691','refs')) return InventoryForm:toString() end @@ -311,4 +311,6 @@ PlayerInventoryUI:registerOnFormFieldActionMatch('%S+::close_group', function(pl PlayerInventoryUI:showForm(playerName) end) +-- TODO: перенести сюда обработку вызовов из Player + return PlayerInventoryUI diff --git a/mods/UI/PlayerInventoryUI/src/PlayerInventoryUI/getBagTab.lua b/mods/UI/PlayerInventoryUI/src/PlayerInventoryUI/getBagTab.lua index 4591cfd..ea6039d 100644 --- a/mods/UI/PlayerInventoryUI/src/PlayerInventoryUI/getBagTab.lua +++ b/mods/UI/PlayerInventoryUI/src/PlayerInventoryUI/getBagTab.lua @@ -7,9 +7,9 @@ local Formspec = Smc.requireFormspec() local function getBagTab(self, playerName, tabType) local BagTab = Formspec:new() - BagTab: - image(0, 0, 11, 9, 'player_inventory_tab_background.png'): - label(2,2, 'BAG PANE') + BagTab + :image(0, 0, 11, 9, 'player_inventory_tab_background.png') + :label(2,2, 'BAG PANE') return BagTab end diff --git a/mods/UI/PlayerInventoryUI/src/PlayerInventoryUI/getCraftTab.lua b/mods/UI/PlayerInventoryUI/src/PlayerInventoryUI/getCraftTab.lua index a735cdb..6e93f9e 100644 --- a/mods/UI/PlayerInventoryUI/src/PlayerInventoryUI/getCraftTab.lua +++ b/mods/UI/PlayerInventoryUI/src/PlayerInventoryUI/getCraftTab.lua @@ -47,8 +47,8 @@ local function getCraftTab(self, playerName, tabType) local w, h = 0.0, 0.0 if selectedGroup ~= nil then - craftsListForm: - imageButton(0, 0, 1.125, 1.125, 'player_inventory_craft_tab_close_group_button_background.png', tabType..'::close_group') + craftsListForm + :imageButton(0, 0, 1.125, 1.125, 'player_inventory_craft_tab_close_group_button_background.png', tabType..'::close_group') w = 1.125 end @@ -65,23 +65,23 @@ local function getCraftTab(self, playerName, tabType) if output ~= nil then if craft.name == selectedCraft then - craftsListForm: - imageButton(w, h, 1.125, 1.125, 'player_inventory_craft_tab_button_pressed_background.png', craft.name..'::'..tabType..'::item_button') + craftsListForm + :imageButton(w, h, 1.125, 1.125, 'player_inventory_craft_tab_button_pressed_background.png', craft.name..'::'..tabType..'::item_button') else - craftsListForm: - imageButton(w, h, 1.125, 1.125, 'player_inventory_craft_tab_button_background.png', craft.name..'::'..tabType..'::item_button') + craftsListForm + :imageButton(w, h, 1.125, 1.125, 'player_inventory_craft_tab_button_background.png', craft.name..'::'..tabType..'::item_button') end - craftsListForm: - itemImage(w+0.0625, h+0.0625, 1, 1, output) + craftsListForm + :itemImage(w+0.0625, h+0.0625, 1, 1, output) else local craft = craft[1] assert(craft ~= nil) - craftsListForm: - imageButton(w, h, 1.125, 1.125, 'player_inventory_craft_tab_button_background.png', craft.group..'::'..tabType..'::group_button'): - itemImage(w+0.0625, h+0.0625, 1, 1, craft.output): - image(w, h, 1.125, 1.125, 'player_inventory_craft_tab_group_button_overlay.png') + craftsListForm + :imageButton(w, h, 1.125, 1.125, 'player_inventory_craft_tab_button_background.png', craft.group..'::'..tabType..'::group_button') + :itemImage(w+0.0625, h+0.0625, 1, 1, craft.output) + :image(w, h, 1.125, 1.125, 'player_inventory_craft_tab_group_button_overlay.png') end w = w + 1.125 @@ -91,12 +91,12 @@ local function getCraftTab(self, playerName, tabType) end end - CraftTab: - background(0, 0, 11, 9, 'player_inventory_craft_tab_background.png'): - container(craftsListForm, 0.5, 0.5): - button(1.75, 7.75, 1, 0.5, tabType..'::page_back', '<'): - button(2.75, 7.75, 1, 0.5, tabType..'::page_forward', '>'): - label(2.5,8.5, ('%s/%s'):format(pageNumber, pagesMax)) + CraftTab + :background(0, 0, 11, 9, 'player_inventory_craft_tab_background.png') + :container(craftsListForm, 0.5, 0.5) + :button(1.75, 7.75, 1, 0.5, tabType..'::page_back', '<') + :button(2.75, 7.75, 1, 0.5, tabType..'::page_forward', '>') + :label(2.5,8.5, ('%s/%s'):format(pageNumber, pagesMax)) if selectedCraft ~= '' then local craft = PrimitiveCraftHandler:getCraftByName(selectedCraft) @@ -115,15 +115,15 @@ local function getCraftTab(self, playerName, tabType) end end - CraftTab: - itemImage(5.5, 0.5, 2, 2, craft.output): - areaLabel(5.5, 3, 4, 4, - itemDef._title..'\n'.. - itemDef._description..'\n\n'.. - 'Needed:\n'..recipe): - areaLabel(5.5, 7, 4, 1, 'Craft:'): - button(5.5, 7.5, 2, 1, tabType..'::craft_item', '1'): - button(7.5, 7.5,2, 1, tabType..'::craft_item', ''..tostring(itemDef.stack_max)) + CraftTab + :itemImage(5.5, 0.5, 2, 2, craft.output) + :areaLabel(5.5, 3, 4, 4, + itemDef._title..'\n'.. + itemDef._description..'\n\n'.. + 'Needed:\n'..recipe) + :areaLabel(5.5, 7, 4, 1, 'Craft:') + :button(5.5, 7.5, 2, 1, tabType..'::craft_item', '1') + :button(7.5, 7.5,2, 1, tabType..'::craft_item', ''..tostring(itemDef.stack_max)) end return CraftTab diff --git a/mods/UI/PlayerInventoryUI/src/PlayerInventoryUI/getEquipTab.lua b/mods/UI/PlayerInventoryUI/src/PlayerInventoryUI/getEquipTab.lua index 8c73a4f..aa67309 100644 --- a/mods/UI/PlayerInventoryUI/src/PlayerInventoryUI/getEquipTab.lua +++ b/mods/UI/PlayerInventoryUI/src/PlayerInventoryUI/getEquipTab.lua @@ -7,9 +7,9 @@ local Formspec = Smc.requireFormspec() local function getEquipTab(self, playerName, tabType) local EquipTab = Formspec:new() - EquipTab: - image(0, 0, 11, 9, 'player_inventory_tab_background.png'): - label(2,2, 'EQUIPMENT PANE') + EquipTab + :image(0, 0, 11, 9, 'player_inventory_tab_background.png') + :label(2,2, 'EQUIPMENT PANE') return EquipTab end diff --git a/mods/UI/PlayerInventoryUI/src/PlayerInventoryUI/getRefTab.lua b/mods/UI/PlayerInventoryUI/src/PlayerInventoryUI/getRefTab.lua index 97d8be8..6dc6827 100644 --- a/mods/UI/PlayerInventoryUI/src/PlayerInventoryUI/getRefTab.lua +++ b/mods/UI/PlayerInventoryUI/src/PlayerInventoryUI/getRefTab.lua @@ -7,9 +7,9 @@ local Formspec = Smc.requireFormspec() local function getRefTab(self, playerName, tabType) local RefTab = Formspec:new() - RefTab: - image(0, 0, 11, 9, 'player_inventory_tab_background.png'): - label(2,2, 'REFERENCE PANE') + RefTab + :image(0, 0, 11, 9, 'player_inventory_tab_background.png') + :label(2,2, 'REFERENCE PANE') return RefTab end diff --git a/mods/UI/WorkStationUI/src/WorkStationUI.lua b/mods/UI/WorkStationUI/src/WorkStationUI.lua index d441e4d..f3663cc 100644 --- a/mods/UI/WorkStationUI/src/WorkStationUI.lua +++ b/mods/UI/WorkStationUI/src/WorkStationUI.lua @@ -28,22 +28,22 @@ local function getFormSpecString(self, playerName, isSelect) end end - listForm: - scrollContainer(listFormItems, 0.5, 0.5, 8, 6, 'work_station:list_items', 'vertical'): - scrollbar(8, 0.5, 0.25, 7, 'vertical', 'work_station:list_items') + listForm + :scrollContainer(listFormItems, 0.5, 0.5, 8, 6, 'work_station:list_items', 'vertical') + :scrollbar(8, 0.5, 0.25, 7, 'vertical', 'work_station:list_items') if isSelect then local stage = craft.stagesByName[craft.startStageName] local outputDef = core.registered_nodes[craft.output] - listForm: - itemImage(9, 0.5, 2, 2, craft.output): - areaLabel(9, 6, 2, 1, 'Start crafting:'): - button(9, 6.5, 3, 1, 'work_station:start_craft', 'x1'): - button(12, 6.5,3, 1, 'work_station:start_craft', 'x10'): - areaLabel(11.5, 0.5, 4, 4, - outputDef._title..'\n'.. - outputDef._description): - areaLabel(9, 2.5, 6, 4, 'Craft description:'..'\n'..craft:toString()) + listForm + :itemImage(9, 0.5, 2, 2, craft.output) + :areaLabel(9, 6, 2, 1, 'Start crafting:') + :button(9, 6.5, 3, 1, 'work_station:start_craft', 'x1') + :button(12, 6.5,3, 1, 'work_station:start_craft', 'x10') + :areaLabel(11.5, 0.5, 4, 4, + outputDef._title..'\n'.. + outputDef._description) + :areaLabel(9, 2.5, 6, 4, 'Craft description:'..'\n'..craft:toString()) end return listForm:toString()