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 BaseUI, Formspec = Smc.requireBaseUI(), Smc.requireFormspec()
|
||||||
|
|
||||||
local require = Mod.getInfo('smc__ui__player_inventory').require
|
local require = Mod.getInfo('smc__ui__player_inventory').require
|
||||||
@@ -60,14 +62,15 @@ local function getFormSpecString(self, playerName)
|
|||||||
|
|
||||||
|
|
||||||
InventoryForm:
|
InventoryForm:
|
||||||
--bgcolor('#00000000'):
|
bgcolor('#00000000'):
|
||||||
listColors('#00000000', '#C4C4C433'):
|
listColors('#00000000', '#e1b69150'):
|
||||||
list('current_player', 'main', 5.5,9.5, 9,2):
|
list('current_player', 'main', 5.5,9.25, 9,1):
|
||||||
background(0, 9, 22, 3.5, 'player_inventory_middle_background.png', false):
|
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[leftPaneName](self, playerName, 'left'), 0, 0):
|
||||||
container(panes[rightPaneName](self, playerName, 'right'), 11, 0):
|
container(panes[rightPaneName](self, playerName, 'right'), 11, 0):
|
||||||
button(10.5, 0, .5, .5, 'close_left_pane', 'x'):
|
button(10.25, 0.25, .5, .5, 'close_left_pane', 'x'):
|
||||||
button(21.5, 0, .5, .5, 'close_right_pane', 'x')
|
button(21.25, 0.25, .5, .5, 'close_right_pane', 'x')
|
||||||
|
|
||||||
return InventoryForm:toString()
|
return InventoryForm:toString()
|
||||||
end
|
end
|
||||||
@@ -80,23 +83,6 @@ end
|
|||||||
---@field getContex fun(self:PlayerInventoryUI,player:string|Player,key:PlayerInventoryUI.ContexKey):any
|
---@field getContex fun(self:PlayerInventoryUI,player:string|Player,key:PlayerInventoryUI.ContexKey):any
|
||||||
local PlayerInventoryUI = BaseUI:new('', getFormSpecString, false)
|
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)
|
PlayerInventoryUI:registerOnFormFieldAction('close_left_pane', function(player, fieldName, fieldValue)
|
||||||
local playerName = player:get_player_name()
|
local playerName = player:get_player_name()
|
||||||
|
|
||||||
@@ -105,7 +91,7 @@ PlayerInventoryUI:registerOnFormFieldAction('close_left_pane', function(player,
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
PlayerInventoryUI:registerOnFormFieldActionMatch('select_left_%S+', function(player, fieldName, fieldValue)
|
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)
|
assert(paneName ~= nil)
|
||||||
|
|
||||||
local playerName = player:get_player_name()
|
local playerName = player:get_player_name()
|
||||||
@@ -124,7 +110,7 @@ PlayerInventoryUI:registerOnFormFieldAction('close_right_pane', function(player,
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
PlayerInventoryUI:registerOnFormFieldActionMatch('select_right_%S+', function(player, fieldName, fieldValue)
|
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)
|
assert(paneName ~= nil)
|
||||||
|
|
||||||
local playerName = player:get_player_name()
|
local playerName = player:get_player_name()
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ local BagPane = Formspec:new()
|
|||||||
---@return Formspec
|
---@return Formspec
|
||||||
local function getBagPane(self, playerName, paneType)
|
local function getBagPane(self, playerName, paneType)
|
||||||
BagPane:
|
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')
|
label(2,2, 'BAG PANE')
|
||||||
|
|
||||||
return BagPane
|
return BagPane
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
local PrimitiveCraftHandler = Smc.requireCraftSystemPrimitiveCraftHandler()
|
||||||
|
|
||||||
local Formspec = Smc.requireFormspec()
|
local Formspec = Smc.requireFormspec()
|
||||||
|
|
||||||
local CraftPane = Formspec:new()
|
local CraftPane = Formspec:new()
|
||||||
@@ -8,7 +10,7 @@ local CraftPane = Formspec:new()
|
|||||||
---@return Formspec
|
---@return Formspec
|
||||||
local function getCraftPane(self, playerName, paneType)
|
local function getCraftPane(self, playerName, paneType)
|
||||||
CraftPane:
|
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')
|
label(2,2, 'CRAFTING PANE')
|
||||||
|
|
||||||
return CraftPane
|
return CraftPane
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ local EquipPane = Formspec:new()
|
|||||||
---@return Formspec
|
---@return Formspec
|
||||||
local function getEquipPane(self, playerName, paneType)
|
local function getEquipPane(self, playerName, paneType)
|
||||||
EquipPane:
|
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')
|
label(2,2, 'EQUIPMENT PANE')
|
||||||
|
|
||||||
return EquipPane
|
return EquipPane
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ local RefPane = Formspec:new()
|
|||||||
---@return Formspec
|
---@return Formspec
|
||||||
local function getRefPane(self, playerName, paneType)
|
local function getRefPane(self, playerName, paneType)
|
||||||
RefPane:
|
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')
|
label(2,2, 'REFERENCE PANE')
|
||||||
|
|
||||||
return RefPane
|
return RefPane
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ local selectPaneMenu = Formspec:new()
|
|||||||
local function getSelectPaneMenu(self, playerName, paneType)
|
local function getSelectPaneMenu(self, playerName, paneType)
|
||||||
|
|
||||||
selectPaneMenu:
|
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(3.5,2.5,2,2,'select_'..paneType..'_bag_pane', 'bag'):
|
||||||
button(5.5,2.5,2,2,'select_'..paneType..'_craft_pane', 'craft'):
|
button(5.5,2.5,2,2,'select_'..paneType..'_craft_pane', 'craft'):
|
||||||
button(3.5,4.5,2,2,'select_'..paneType..'_equip_pane', 'equip'):
|
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 |
Reference in New Issue
Block a user