PlayerInventoryUI: update backgrounds textures. #34
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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'):
|
||||
|
||||
Reference in New Issue
Block a user