mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
Added player List
This commit is contained in:
@@ -147,9 +147,9 @@ end
|
||||
@treturn[2] boolean if the element was found, found
|
||||
@treturn[2] LuaGuiElement the element that was found
|
||||
@usage-- Getting the center gui
|
||||
local exists, center = Gui.find(player,'gui','center')
|
||||
local exists, center = Gui.exists(player,'gui','center')
|
||||
]]
|
||||
function Gui.find(element,...)
|
||||
function Gui.exists(element,...)
|
||||
local path = tostring(element.name)
|
||||
for _,next_element_name in pairs{...} do
|
||||
if type(next_element_name) == 'table' then
|
||||
@@ -165,18 +165,22 @@ function Gui.find(element,...)
|
||||
return true, element
|
||||
end
|
||||
|
||||
--[[-- Checks if a gui element exists or not, returns it if found else the path where it failed
|
||||
@see Gui.find
|
||||
--[[-- Checks if a gui element exists or not, if not found will throw an error
|
||||
@see Gui.exists
|
||||
@tparam LuaGuiElement element the root element to start checking from
|
||||
@tparam ?string|table ... element names or element concepts that point to your element
|
||||
@treturn[1] boolean if the element was found, failed
|
||||
@treturn[1] string the path of the element that the search stoped at
|
||||
@treturn[2] boolean if the element was found, found
|
||||
@treturn[2] LuaGuiElement the element that was found
|
||||
@treturn LuaGuiElement the element that was found
|
||||
@usage-- Getting the center gui
|
||||
local exists, center = Gui.exists(player,'gui','center')
|
||||
local exists, center = Gui.find(player,'gui','center')
|
||||
]]
|
||||
Gui.exists = Gui.find
|
||||
function Gui.find(element,...)
|
||||
local exists, element = Gui.exists(element,...)
|
||||
if not exists then
|
||||
return error('Could not find element: '..element,2)
|
||||
else
|
||||
return element
|
||||
end
|
||||
end
|
||||
|
||||
--[[-- Toggles the enabled state of an element
|
||||
@tparam LuaGuiElement element the element that you want to toggle the enabled state of
|
||||
|
||||
@@ -40,7 +40,7 @@ end)
|
||||
-- Draw
|
||||
:define_draw(function(properties,parent,element)
|
||||
-- Make the label right aligned
|
||||
local data_name = properties.data_label_name or properties.name..'_data'
|
||||
local data_name = properties.data_label_name or properties.name..'_data'
|
||||
local right_align_element = right_align:draw(parent,data_name)
|
||||
|
||||
-- Add a new label
|
||||
|
||||
@@ -31,19 +31,21 @@ Gui.new_concept('frame')
|
||||
-- Update the table style
|
||||
Gui.set_padding(element,2,2,4,4)
|
||||
element.style = 'subfooter_frame'
|
||||
element.caption = nil
|
||||
element.caption = ''
|
||||
|
||||
local style = element.style
|
||||
style.horizontally_stretchable = true
|
||||
style.use_header_filler = false
|
||||
|
||||
-- Add the caption to the frame
|
||||
element.add{
|
||||
type = 'label',
|
||||
name = 'footer_caption',
|
||||
caption = properties.title,
|
||||
tooltip = properties.tooltip
|
||||
}
|
||||
if properties.title then
|
||||
element.add{
|
||||
type = 'label',
|
||||
name = 'footer_caption',
|
||||
caption = properties.title,
|
||||
tooltip = properties.tooltip
|
||||
}
|
||||
end
|
||||
|
||||
-- Add the right align area
|
||||
local align = right_align:draw(element,'footer_content')
|
||||
|
||||
@@ -27,7 +27,7 @@ Gui.new_concept('scroll_table')
|
||||
|
||||
Gui.new_concept('table')
|
||||
:save_as('scroll_table')
|
||||
:new_property('hight',nil,100)
|
||||
:new_property('height',nil,100)
|
||||
|
||||
-- Add a scroll before the table is drawn
|
||||
:define_pre_draw(function(properties,parent,element)
|
||||
@@ -36,7 +36,7 @@ Gui.new_concept('table')
|
||||
-- Set the scroll style
|
||||
Gui.set_padding(scroll,1,1,2,2)
|
||||
scroll.style.horizontally_stretchable = true
|
||||
scroll.style.maximal_height = properties.hight
|
||||
scroll.style.maximal_height = properties.height
|
||||
|
||||
-- Change the name of the element to table before it is drawn
|
||||
properties.name = 'table'
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
|
||||
local Gui = require 'expcore.gui' -- @dep expcore.gui
|
||||
|
||||
Gui.require_concept 'label' -- @dep gui.concept.frame
|
||||
|
||||
local right_align =
|
||||
Gui.new_concept('alignment')
|
||||
|
||||
--[[-- A label triplet which has a static label, a data label which can be changed, and a unit label
|
||||
@see Gui.label
|
||||
@see data_label
|
||||
@@ -34,11 +29,8 @@ end)
|
||||
local unit_label =
|
||||
Gui.new_concept('data_label')
|
||||
:save_as('unit_label')
|
||||
:new_property('data_label_name')
|
||||
:new_property('data_caption')
|
||||
:new_property('data_tooltip')
|
||||
:new_property('data_unit')
|
||||
:new_property('data_format',nil,function(concept,element,data,...)
|
||||
:set_data_format(function(concept,element,data,...)
|
||||
local base_unit = concept.properties.data_unit
|
||||
local caption = tostring(data)
|
||||
local unit = data == 1 and base_unit or base_unit..'s'
|
||||
@@ -53,6 +45,7 @@ end)
|
||||
-- Add the unit label
|
||||
parent.add{
|
||||
name = element.name..'_unit',
|
||||
type='label',
|
||||
caption = unit or '',
|
||||
tooltip = element.tooltip
|
||||
}
|
||||
|
||||
@@ -232,9 +232,9 @@ Gui.new_concept('toolbar-button')
|
||||
:save_as('toolbar-frame')
|
||||
|
||||
-- Properties
|
||||
:new_property('open_by_default',false)
|
||||
:new_property('use_container',true)
|
||||
:new_property('direction','horizontal')
|
||||
:new_property('open_by_default',nil,false)
|
||||
:new_property('use_container',nil,true)
|
||||
:new_property('direction',nil,'horizontal')
|
||||
:new_event('on_update')
|
||||
|
||||
-- Clone
|
||||
@@ -258,7 +258,6 @@ end)
|
||||
|
||||
frame.style.padding = 2
|
||||
|
||||
-- Add and return the container if a container is used
|
||||
if properties.use_container then
|
||||
local container =
|
||||
frame.add{
|
||||
@@ -270,7 +269,6 @@ end)
|
||||
Gui.set_padding(container)
|
||||
|
||||
return container
|
||||
|
||||
end
|
||||
|
||||
return frame
|
||||
|
||||
Reference in New Issue
Block a user