PlayerInventoryUI: update backgrounds textures. #34

This commit is contained in:
Van
2026-03-26 21:37:13 +03:00
parent cb87d16560
commit 914ea881a4
8 changed files with 18 additions and 30 deletions

View File

@@ -1,3 +1,5 @@
local stringMatch = string.match
local BaseUI, Formspec = Smc.requireBaseUI(), Smc.requireFormspec()
local require = Mod.getInfo('smc__ui__player_inventory').require
@@ -60,14 +62,15 @@ local function getFormSpecString(self, playerName)
InventoryForm:
--bgcolor('#00000000'):
listColors('#00000000', '#C4C4C433'):
list('current_player', 'main', 5.5,9.5, 9,2):
background(0, 9, 22, 3.5, 'player_inventory_middle_background.png', false):
bgcolor('#00000000'):
listColors('#00000000', '#e1b69150'):
list('current_player', 'main', 5.5,9.25, 9,1):
list('current_player', 'main', 5.5,10.75, 9,1, 9):
background(0, 9, 22, 3, 'player_inventory_middle_background.png', false):
container(panes[leftPaneName](self, playerName, 'left'), 0, 0):
container(panes[rightPaneName](self, playerName, 'right'), 11, 0):
button(10.5, 0, .5, .5, 'close_left_pane', 'x'):
button(21.5, 0, .5, .5, 'close_right_pane', 'x')
button(10.25, 0.25, .5, .5, 'close_left_pane', 'x'):
button(21.25, 0.25, .5, .5, 'close_right_pane', 'x')
return InventoryForm:toString()
end
@@ -80,23 +83,6 @@ end
---@field getContex fun(self:PlayerInventoryUI,player:string|Player,key:PlayerInventoryUI.ContexKey):any
local PlayerInventoryUI = BaseUI:new('', getFormSpecString, false)
--[[
---Shows the player their inventory.
---@param playerName string
function PlayerInventoryUI:showForm(playerName)
local player = core.get_player_by_name(playerName)
assert(player ~= nil)
player:set_inventory_formspec(self:getFormSpecString(playerName))
core.show_formspec(playerName, '', '')
end
---Closes the player's inventory.
---@param playerName string
function PlayerInventoryUI:closeForm(playerName)
core.close_formspec(playerName, '')
end--]]
PlayerInventoryUI:registerOnFormFieldAction('close_left_pane', function(player, fieldName, fieldValue)
local playerName = player:get_player_name()
@@ -105,7 +91,7 @@ PlayerInventoryUI:registerOnFormFieldAction('close_left_pane', function(player,
end)
PlayerInventoryUI:registerOnFormFieldActionMatch('select_left_%S+', function(player, fieldName, fieldValue)
local paneName = string.match(fieldName, 'select_%S+_(%S+_%S+)')
local paneName = stringMatch(fieldName, 'select_%S+_(%S+_%S+)')
assert(paneName ~= nil)
local playerName = player:get_player_name()
@@ -124,7 +110,7 @@ PlayerInventoryUI:registerOnFormFieldAction('close_right_pane', function(player,
end)
PlayerInventoryUI:registerOnFormFieldActionMatch('select_right_%S+', function(player, fieldName, fieldValue)
local paneName = string.match(fieldName, 'select_%S+_(%S+_%S+)')
local paneName = stringMatch(fieldName, 'select_%S+_(%S+_%S+)')
assert(paneName ~= nil)
local playerName = player:get_player_name()

View File

@@ -8,7 +8,7 @@ local BagPane = Formspec:new()
---@return Formspec
local function getBagPane(self, playerName, paneType)
BagPane:
image(0, 0, 11, 9, 'player_inventory_background_block.png^[colorize:#BF59EE:120'):
image(0, 0, 11, 9, 'player_inventory_pane_background.png'):
label(2,2, 'BAG PANE')
return BagPane

View File

@@ -1,3 +1,5 @@
local PrimitiveCraftHandler = Smc.requireCraftSystemPrimitiveCraftHandler()
local Formspec = Smc.requireFormspec()
local CraftPane = Formspec:new()
@@ -8,7 +10,7 @@ local CraftPane = Formspec:new()
---@return Formspec
local function getCraftPane(self, playerName, paneType)
CraftPane:
image(0, 0, 11, 9, 'player_inventory_background_block.png^[colorize:#E7CC35:120'):
image(0, 0, 11, 9, 'player_inventory_pane_background.png'):
label(2,2, 'CRAFTING PANE')
return CraftPane

View File

@@ -8,7 +8,7 @@ local EquipPane = Formspec:new()
---@return Formspec
local function getEquipPane(self, playerName, paneType)
EquipPane:
image(0, 0, 11, 9, 'player_inventory_background_block.png^[colorize:#72FAC6:120'):
image(0, 0, 11, 9, 'player_inventory_pane_background.png'):
label(2,2, 'EQUIPMENT PANE')
return EquipPane

View File

@@ -8,7 +8,7 @@ local RefPane = Formspec:new()
---@return Formspec
local function getRefPane(self, playerName, paneType)
RefPane:
image(0, 0, 11, 9, 'player_inventory_background_block.png^[colorize:#8072FA:120'):
image(0, 0, 11, 9, 'player_inventory_pane_background.png'):
label(2,2, 'REFERENCE PANE')
return RefPane

View File

@@ -9,7 +9,7 @@ local selectPaneMenu = Formspec:new()
local function getSelectPaneMenu(self, playerName, paneType)
selectPaneMenu:
image(0, 0, 11, 9, 'player_inventory_background_block.png^[colorize:#FA8072:120'):
image(0, 0, 11, 9, 'player_inventory_pane_background.png'):
button(3.5,2.5,2,2,'select_'..paneType..'_bag_pane', 'bag'):
button(5.5,2.5,2,2,'select_'..paneType..'_craft_pane', 'craft'):
button(3.5,4.5,2,2,'select_'..paneType..'_equip_pane', 'equip'):

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB