mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
Updated docs
This commit is contained in:
@@ -139,6 +139,45 @@ function Gui.destroy(element)
|
||||
return false
|
||||
end
|
||||
|
||||
--[[-- Finds and returns a gui element if it is valid from a long chain of element names or concepts
|
||||
@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
|
||||
@usage-- Getting the center gui
|
||||
local exists, center = Gui.find(player,'gui','center')
|
||||
]]
|
||||
function Gui.find(element,...)
|
||||
local path = tostring(element.name)
|
||||
for _,next_element_name in pairs{...} do
|
||||
if type(next_element_name) == 'table' then
|
||||
next_element_name = next_element_name.name
|
||||
end
|
||||
|
||||
element = element[next_element_name]
|
||||
path = path..'.'..tostring(next_element_name)
|
||||
if not Gui.valid(element) then
|
||||
return false, path
|
||||
end
|
||||
end
|
||||
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
|
||||
@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
|
||||
@usage-- Getting the center gui
|
||||
local exists, center = Gui.exists(player,'gui','center')
|
||||
]]
|
||||
Gui.exists = Gui.find
|
||||
|
||||
--[[-- Toggles the enabled state of an element
|
||||
@tparam LuaGuiElement element the element that you want to toggle the enabled state of
|
||||
@treturn boolean the new enabled state of the element
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
--[[-- Core Module - ExpStyle
|
||||
@module ExpStyle
|
||||
@core ExpStyle
|
||||
@alias expstyle
|
||||
]]
|
||||
|
||||
local Gui = require 'expcore.gui' --- @dep expcore.gui
|
||||
local Gui = require 'expcore.gui' -- @dep expcore.gui
|
||||
|
||||
Gui.require_concept 'flow' --- @dep gui.concept.flow
|
||||
Gui.require_concept 'flow' -- @dep gui.concept.flow
|
||||
|
||||
--[[-- A flow which can be used to align text and other elements
|
||||
@see flow
|
||||
@see Gui.flow
|
||||
@element alignment
|
||||
@usage-- Concept Structure
|
||||
-- Root
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
@module ExpStyle
|
||||
]]
|
||||
|
||||
local Gui = require 'expcore.gui' --- @dep expcore.gui
|
||||
local Gui = require 'expcore.gui' -- @dep expcore.gui
|
||||
|
||||
Gui.require_concept 'frame' --- @dep gui.concept.frame
|
||||
Gui.require_concept 'frame' -- @dep gui.concept.frame
|
||||
|
||||
--[[-- A container frame that can be used to add a boader around your content
|
||||
@see frame
|
||||
@see Gui.frame
|
||||
@element container
|
||||
@usage-- Concept Structure
|
||||
-- Root
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
@module ExpStyle
|
||||
]]
|
||||
|
||||
local Gui = require 'expcore.gui' --- @dep expcore.gui
|
||||
local Gui = require 'expcore.gui' -- @dep expcore.gui
|
||||
|
||||
Gui.require_concept 'label' --- @dep gui.concept.frame
|
||||
Gui.require_concept 'label' -- @dep gui.concept.frame
|
||||
|
||||
local right_align =
|
||||
Gui.new_concept('alignment')
|
||||
|
||||
--[[-- A label pair which has a static label and a data label which can be changed
|
||||
@see label
|
||||
@see Gui.label
|
||||
@element data_label
|
||||
@usage-- Concept Structure
|
||||
-- Root
|
||||
@@ -64,6 +64,12 @@ end)
|
||||
return data_label_element
|
||||
end)
|
||||
|
||||
--[[-- Updates the caption and tooltip of the data label using the data format function
|
||||
@tparam LuaGuiElement element the data label element that you want to update
|
||||
@tparam any data the data that you want to pass to the format function
|
||||
@usage-- Updating the data to the current game tick
|
||||
data_label:update_data_element(element,game.tick)
|
||||
]]
|
||||
function data_label:update_data_element(element,data,...)
|
||||
local caption, tooltip = self.properties.data_format(self,element,data,...)
|
||||
if caption then
|
||||
@@ -74,6 +80,12 @@ function data_label:update_data_element(element,data,...)
|
||||
end
|
||||
end
|
||||
|
||||
--[[-- Updates the caption and tooltip of the data label using the data format function, given the parent of the data label
|
||||
@tparam LuaGuiElement parent the parent element to the data label element that you want to update
|
||||
@tparam any data the data that you want to pass to the format function
|
||||
@usage-- Updating the data to the current game tick
|
||||
data_label:update_from_parent(parent,game.tick)
|
||||
]]
|
||||
function data_label:update_from_parent(parent,data,...)
|
||||
local properties = self.properties
|
||||
local data_name = properties.data_label_name or properties.name..'_data'
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
@module ExpStyle
|
||||
]]
|
||||
|
||||
local Gui = require 'expcore.gui' --- @dep expcore.gui
|
||||
local Gui = require 'expcore.gui' -- @dep expcore.gui
|
||||
|
||||
Gui.require_concept 'frame' --- @dep gui.concept.table
|
||||
Gui.require_concept 'frame' -- @dep gui.concept.table
|
||||
|
||||
local right_align =
|
||||
Gui.new_concept('alignment')
|
||||
|
||||
--[[-- A frame that acts as a footer to a section of content
|
||||
@see frame
|
||||
@see Gui.frame
|
||||
@element footer
|
||||
@tparam string tooltip the tooltip to show on the title
|
||||
@usage-- Concept Structure
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
@module ExpStyle
|
||||
]]
|
||||
|
||||
local Gui = require 'expcore.gui' --- @dep expcore.gui
|
||||
local Gui = require 'expcore.gui' -- @dep expcore.gui
|
||||
|
||||
Gui.require_concept 'frame' --- @dep gui.concept.table
|
||||
Gui.require_concept 'frame' -- @dep gui.concept.table
|
||||
|
||||
local right_align =
|
||||
Gui.new_concept('alignment')
|
||||
|
||||
--[[-- A frame that acts as a header to a section of content
|
||||
@see frame
|
||||
@see Gui.frame
|
||||
@element header
|
||||
@tparam string tooltip the tooltip to show on the title
|
||||
@usage-- Concept Structure
|
||||
|
||||
@@ -1,7 +1,18 @@
|
||||
--[[-- Core Module - ExpStyle
|
||||
@core ExpStyle
|
||||
@module ExpStyle
|
||||
@alias expstyle
|
||||
]]
|
||||
|
||||
--- @dep expcore.gui
|
||||
|
||||
--- @dep gui.concept.frame
|
||||
|
||||
--- @dep gui.concept.flow
|
||||
|
||||
--- @dep gui.concept.table
|
||||
|
||||
--- @dep gui.concept.scroll
|
||||
|
||||
local function r(name)
|
||||
require('expcore.gui.styles.expstyle.'..name)
|
||||
end
|
||||
@@ -9,5 +20,9 @@ end
|
||||
r 'container'
|
||||
r 'alignment'
|
||||
r 'header'
|
||||
r 'footer'
|
||||
r 'scroll_table'
|
||||
r 'time_label'
|
||||
r 'time_label'
|
||||
r 'data_label'
|
||||
r 'unit_label'
|
||||
r 'toggle_button'
|
||||
@@ -2,10 +2,10 @@
|
||||
@module ExpStyle
|
||||
]]
|
||||
|
||||
local Gui = require 'expcore.gui' --- @dep expcore.gui
|
||||
local Gui = require 'expcore.gui' -- @dep expcore.gui
|
||||
|
||||
Gui.require_concept 'table' --- @dep gui.concept.table
|
||||
Gui.require_concept 'scroll' --- @dep gui.concept.scroll
|
||||
Gui.require_concept 'table' -- @dep gui.concept.table
|
||||
Gui.require_concept 'scroll' -- @dep gui.concept.scroll
|
||||
|
||||
local scroll_area =
|
||||
Gui.new_concept('scroll')
|
||||
@@ -13,7 +13,7 @@ Gui.new_concept('scroll')
|
||||
:set_horizontal_scroll('never')
|
||||
|
||||
--[[-- A table that is inside a vertical scroll area
|
||||
@see table
|
||||
@see Gui.table
|
||||
@element scroll_table
|
||||
@tparam number hight the max hight of the scroll area
|
||||
@usage-- Concept Structure
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
@module ExpStyle
|
||||
]]
|
||||
|
||||
local Gui = require 'expcore.gui' --- @dep expcore.gui
|
||||
local Gui = require 'expcore.gui' -- @dep expcore.gui
|
||||
local format_time = ext_require('expcore.common','format_time') --- @dep expcore.common
|
||||
|
||||
--- Converts a tick into string format with workds and symbols
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
@module ExpStyle
|
||||
]]
|
||||
|
||||
local Gui = require 'expcore.gui' --- @dep expcore.gui
|
||||
local Gui = require 'expcore.gui' -- @dep expcore.gui
|
||||
|
||||
Gui.require_concept 'button' --- @dep gui.concept.table
|
||||
Gui.require_concept 'button' -- @dep gui.concept.table
|
||||
|
||||
--[[-- A button that will toggle its caption each time it is pressed
|
||||
@see button
|
||||
@see Gui.button
|
||||
@element toggle_button
|
||||
@tparam string alt_caption the caption to show on the button in its true state
|
||||
@tparam string alt_tooltip the tooltip to show on the button in its true state
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
@module ExpStyle
|
||||
]]
|
||||
|
||||
local Gui = require 'expcore.gui' --- @dep expcore.gui
|
||||
local Gui = require 'expcore.gui' -- @dep expcore.gui
|
||||
|
||||
Gui.require_concept 'label' --- @dep gui.concept.frame
|
||||
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 label
|
||||
@see Gui.label
|
||||
@see data_label
|
||||
@element unit_label
|
||||
@usage-- Concept Structure
|
||||
@@ -60,6 +60,12 @@ end)
|
||||
return element
|
||||
end)
|
||||
|
||||
--[[-- Updates the caption and tooltip and unit of the data label using the data format function
|
||||
@tparam LuaGuiElement element the unit label element that you want to update
|
||||
@tparam any data the data that you want to pass to the format function
|
||||
@usage-- Updating the data to the current game tick
|
||||
unit_label:update_data_element(element,game.tick)
|
||||
]]
|
||||
function unit_label:update_data_element(element,data,...)
|
||||
local caption, unit, tooltip = self.properties.data_format(self,element,data,...)
|
||||
local unit_element = element.parent.parent[element.name..'_unit']
|
||||
@@ -75,6 +81,12 @@ function unit_label:update_data_element(element,data,...)
|
||||
end
|
||||
end
|
||||
|
||||
--[[-- Updates the caption and tooltip and unit of the unit label using the data format function, given the parent of the unit label
|
||||
@tparam LuaGuiElement parent the parent element to the unit label element that you want to update
|
||||
@tparam any data the data that you want to pass to the format function
|
||||
@usage-- Updating the data to the current game tick
|
||||
unit_label:update_from_parent(parent,game.tick)
|
||||
]]
|
||||
function unit_label:update_from_parent(parent,data,...)
|
||||
local properties = self.properties
|
||||
local data_name = properties.data_label_name or properties.name..'_data'
|
||||
|
||||
Reference in New Issue
Block a user