mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-30 04:21:41 +09:00
Core
This commit is contained in:
@@ -1,4 +1,12 @@
|
||||
--- Gui structure define for center gui frames
|
||||
--[[-- Core Module - Gui
|
||||
@module Gui
|
||||
@alias Prototype
|
||||
]]
|
||||
|
||||
--- Center Guis.
|
||||
-- Gui structure define for center gui frames
|
||||
-- @section center
|
||||
|
||||
--[[
|
||||
>>>> Functions
|
||||
CenterFrames.get_flow(player) --- Gets the center flow for a player
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
--- Gui structure define for left frames
|
||||
--[[-- Core Module - Gui
|
||||
@module Gui
|
||||
@alias Prototype
|
||||
]]
|
||||
|
||||
--- Left Guis.
|
||||
-- Gui structure define for left frames
|
||||
-- @section left
|
||||
|
||||
--[[
|
||||
>>>> Example formating
|
||||
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
--- Gui structure define for popup gui
|
||||
--[[-- Core Module - Gui
|
||||
@module Gui
|
||||
@alias Prototype
|
||||
]]
|
||||
|
||||
--- Popups.
|
||||
-- Gui structure define for popup gui
|
||||
-- @section popups
|
||||
|
||||
--[[
|
||||
>>>> Functions
|
||||
PopupFrames.get_flow(player) --- Gets the left flow that contains the popup frames
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
--- Gui structure for the toolbar (top left)
|
||||
--[[-- Core Module - Gui
|
||||
@module Gui
|
||||
@alias Prototype
|
||||
]]
|
||||
|
||||
--- Toolbar.
|
||||
-- Gui structure for the toolbar (top left)
|
||||
-- @section toolbar
|
||||
|
||||
--[[
|
||||
>>>> Example format
|
||||
-- this is the same as any other button define, this just automatically draws it
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
--- Core gui file for making element defines and element classes (use require 'expcore.gui')
|
||||
--[[-- Core Module - Gui
|
||||
@module Gui
|
||||
@alias Prototype
|
||||
]]
|
||||
|
||||
--- Core.
|
||||
-- Core gui file for making element defines and element classes (use require 'expcore.gui')
|
||||
-- see utils.gui for event handlering
|
||||
-- see expcore.gui.test for examples for element defines
|
||||
-- @section core
|
||||
|
||||
--[[
|
||||
>>>> Basic useage with no defines
|
||||
This module can be igroned if you are only wanting only event handlers as utils.gui adds the following:
|
||||
@@ -138,6 +146,7 @@ Gui.names = {} -- Stores debug names to link to gui uids
|
||||
|
||||
--- Used to create new element defines from a class prototype, please use the own given by the class
|
||||
-- @tparam table prototype the class prototype that will be used for the element define
|
||||
-- @tparam[opt] string debug_name the name that you want to see while debuging
|
||||
-- @treturn table the new element define with all functions accessed via __index metamethod
|
||||
function Gui.new_define(prototype,debug_name)
|
||||
local name = Gui.uid_name()
|
||||
@@ -159,7 +168,7 @@ function Gui.new_define(prototype,debug_name)
|
||||
end
|
||||
|
||||
--- Gets an element define give the uid, debug name or a copy of the element define
|
||||
-- @tparam name ?string|table the uid, debug name or define for the element define to get
|
||||
-- @tparam ?string|table name the uid, debug name or define for the element define to get
|
||||
-- @tparam[opt] boolean internal when true the error trace is one level higher (used internally)
|
||||
-- @treturn table the element define that was found or an error
|
||||
function Gui.get_define(name,internal)
|
||||
@@ -207,8 +216,8 @@ function Gui.categorize_by_surface(element)
|
||||
end
|
||||
|
||||
--- Draws a copy of the element define to the parent element, see draw_to
|
||||
-- @tparam name ?string|table the uid, debug name or define for the element define to draw
|
||||
-- @tparam element LuaGuiEelement the parent element that it the define will be drawn to
|
||||
-- @tparam ?string|table name the uid, debug name or define for the element define to draw
|
||||
-- @tparam LuaGuiEelement element the parent element that it the define will be drawn to
|
||||
-- @treturn LuaGuiElement the new element that was created
|
||||
function Gui.draw(name,element,...)
|
||||
local define = Gui.get_define(name,true)
|
||||
@@ -256,7 +265,7 @@ function Gui.set_padding(element,up,down,left,right)
|
||||
end
|
||||
|
||||
--- Sets the padding for a gui style
|
||||
-- @tparam element LuaStyle the element to set the padding for
|
||||
-- @tparam LuaStyle style the element to set the padding for
|
||||
-- @tparam[opt=0] number up the amount of padding on the top
|
||||
-- @tparam[opt=0] number down the amount of padding on the bottom
|
||||
-- @tparam[opt=0] number left the amount of padding on the left
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
--- Gui class define for buttons and sprite buttons
|
||||
--[[-- Core Module - Gui
|
||||
@module Gui
|
||||
@alias Prototype
|
||||
]]
|
||||
|
||||
--- Buttons.
|
||||
-- Gui class define for buttons and sprite buttons
|
||||
-- @section Buttons
|
||||
|
||||
--[[
|
||||
>>>> Functions
|
||||
Button.new_button(name) --- Creates a new button element define
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
--- Gui class define for checkbox and radiobuttons
|
||||
--[[-- Core Module - Gui
|
||||
@module Gui
|
||||
@alias Prototype
|
||||
]]
|
||||
|
||||
--- Checkboxs.
|
||||
-- Gui class define for checkbox and radiobuttons
|
||||
-- @section checkboxs
|
||||
|
||||
--[[
|
||||
>>>> Using an option set
|
||||
An option set is a set of radio buttons where only one of them can be active at a time, this means that when one
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
--- Gui class define for dropdowns and list box
|
||||
--[[-- Core Module - Gui
|
||||
@module Gui
|
||||
@alias Prototype
|
||||
]]
|
||||
|
||||
--- Dropdowns.
|
||||
-- Gui class define for dropdowns and list box
|
||||
-- @section dropdowns
|
||||
|
||||
--[[
|
||||
>>>> Functions
|
||||
Dropdown.new_dropdown(name) --- Creates a new dropdown element define
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
--- Gui class defines for elem buttons
|
||||
--[[-- Core Module - Gui
|
||||
@module Gui
|
||||
@alias Prototype
|
||||
]]
|
||||
|
||||
--- Elem Buttons.
|
||||
-- Gui class defines for elem buttons
|
||||
-- @section elem-buttons
|
||||
|
||||
--[[
|
||||
>>>> Functions
|
||||
ElemButton.new_elem_button(name) --- Creates a new elem button element define
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
--- Gui element define for progress bars
|
||||
--[[-- Core Module - Gui
|
||||
@module Gui
|
||||
@alias Prototype
|
||||
]]
|
||||
|
||||
--- Progress Bars.
|
||||
-- Gui element define for progress bars
|
||||
-- @section progress-bars
|
||||
|
||||
--[[
|
||||
>>>> Functions
|
||||
ProgressBar.set_maximum(element,amount,count_down) --- Sets the maximum value that represents the end value of the progress bar
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
--- Gui class define for sliders
|
||||
--[[-- Core Module - Gui
|
||||
@module Gui
|
||||
@alias Prototype
|
||||
]]
|
||||
|
||||
--- Sliders.
|
||||
-- Gui class define for sliders
|
||||
-- @section sliders
|
||||
|
||||
--[[
|
||||
>>>> Functions
|
||||
Slider.new_slider(name) --- Creates a new slider element define
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
--- Gui class define for text fields and text boxes
|
||||
--[[-- Core Module - Gui
|
||||
@module Gui
|
||||
@alias Prototype
|
||||
]]
|
||||
|
||||
--- Text.
|
||||
-- Gui class define for text fields and text boxes
|
||||
-- @section text
|
||||
|
||||
--[[
|
||||
>>>> Functions
|
||||
Text.new_text_field(name) --- Creates a new text field element define
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
--- This file is a breakout from core which forcues on instance management of defines
|
||||
--[[-- Core Module - Gui
|
||||
@module Gui
|
||||
@alias Prototype
|
||||
]]
|
||||
|
||||
--- Instances.
|
||||
-- This file is a breakout from core which forcues on instance management of defines
|
||||
-- @section instances
|
||||
|
||||
--[[
|
||||
>>>> Using registered instance groups
|
||||
The main use of this module is to register a group of elements referred here as "instances of an element define" in which
|
||||
@@ -158,7 +166,7 @@ end
|
||||
--- Gets all valid element instances and has the option of running a callback on those that are valid
|
||||
-- @tparam string name the name of the instance group to get the instances of
|
||||
-- @tparam[opt] string category the category to get the instances of, not needed when no categorise function
|
||||
-- @tparam[opt] callback function when given the callback will be ran on all valid elements
|
||||
-- @tparam[opt] function callback when given the callback will be ran on all valid elements
|
||||
-- callback param - element LuaGuiElement - the current valid element
|
||||
-- @treturn table the table of element instances with all invalid ones removed
|
||||
function Instances.get_valid_elements(name,category,callback)
|
||||
@@ -186,7 +194,7 @@ Instances.apply_to_elements = Instances.get_valid_elements
|
||||
|
||||
--- A version of add_element that does not require the group to be registered
|
||||
-- @tparam string name the name of the instance group to add the element to
|
||||
-- @tparam category ?string|nil the category to add the element to, can be nil but must still be given
|
||||
-- @tparam ?string|nil category the category to add the element to, can be nil but must still be given
|
||||
-- @tparam LuaGuiElement element the element to add to the instance group
|
||||
function Instances.unregistered_add_element(name,category,element)
|
||||
if not Instances.data[name] then Instances.data[name] = {} end
|
||||
@@ -200,7 +208,7 @@ end
|
||||
|
||||
--- A version of get_elements that does not require the group to be registered
|
||||
-- @tparam string name the name of the instance group to get the instances of
|
||||
-- @tparam category ?string|nil the category to get the instances of, can be nil but must still be given
|
||||
-- @tparam ?string|nil category the category to get the instances of, can be nil but must still be given
|
||||
-- @tparam[opt] function callback when given will be called on all valid instances
|
||||
-- callback param - element LuaGuiElement - the current valid element
|
||||
-- @treturn table the table of element instances with all invalid ones removed
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
--- Used to create new gui prototypes see elements and concepts
|
||||
--[[-- Core Module - Gui
|
||||
@module Gui
|
||||
@alias Prototype
|
||||
]]
|
||||
|
||||
--- Prototype.
|
||||
-- Used to create new gui prototypes see elements and concepts
|
||||
-- @section prototype
|
||||
|
||||
--[[
|
||||
>>>> Functions
|
||||
Constructor.event(event_name) --- Creates a new function to add functions to an event handler
|
||||
@@ -200,7 +208,7 @@ Prototype.on_style_update = Constructor.event('on_style_update')
|
||||
|
||||
--- Sets the style for the element define
|
||||
-- @tparam string style the style that will be used for this element when drawn
|
||||
-- @tparam[opt] callback function function is called when element is drawn to alter its style
|
||||
-- @tparam[opt] function callback function is called when element is drawn to alter its style
|
||||
-- @treturn self the element define to allow chaining
|
||||
function Prototype:set_style(style,callback)
|
||||
self.draw_data.style = style
|
||||
@@ -211,7 +219,7 @@ function Prototype:set_style(style,callback)
|
||||
end
|
||||
|
||||
--- Sets the element to be drawn inside a nameless flow, can be given a name using a function
|
||||
-- @tparam state ?boolean|function when true a padless flow is created to contain the element
|
||||
-- @tparam ?boolean|function state when true a padless flow is created to contain the element
|
||||
-- @treturn self the element define to allow chaining
|
||||
function Prototype:set_embedded_flow(state)
|
||||
if state == false or type(state) == 'function' then
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
--- This file creates a test gui that is used to test every input method
|
||||
--[[-- Core Module - Gui
|
||||
@module Gui
|
||||
@alias tests
|
||||
]]
|
||||
|
||||
--- Test.
|
||||
-- This file creates a test gui that is used to test every input method
|
||||
-- note that this does not cover every permutation only features in independence
|
||||
-- for example store in most cases is just by player name, but other store methods are tested with checkbox
|
||||
-- @section test
|
||||
|
||||
local Gui = require 'expcore.gui' --- @dep expcore.gui
|
||||
local format_chat_colour,table_keys = ext_require('expcore.common','format_chat_colour','table_keys') --- @dep expcore.common
|
||||
local Colors = require 'resources.color_presets' --- @dep resources.color_presets
|
||||
|
||||
Reference in New Issue
Block a user