mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-31 04:51:40 +09:00
More spelling fixes
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
CenterFrames.redraw_frame(player,name) --- Draws the center frame for a player, if already open then will destroy it and redraw
|
||||
CenterFrames.toggle_frame(player,name,state) --- Toggles if the frame is currently open or not, will open if closed and close if open
|
||||
|
||||
CenterFrames.new_frame(permision_name) --- Sets the frame to be the current active gui when opened and closes all other frames
|
||||
CenterFrames.new_frame(permission_name) --- Sets the frame to be the current active gui when opened and closes all other frames
|
||||
CenterFrames._prototype:on_draw(player,frame) --- Use to draw your elements onto the new frame
|
||||
CenterFrames._prototype:set_auto_focus(state) --- Sets the frame to be the current active gui when opened and closes all other frames
|
||||
CenterFrames._prototype:draw_frame(player) --- Draws this frame to the player, if already open does nothing (will call on_draw to draw to the frame)
|
||||
@@ -87,10 +87,10 @@ function CenterFrames.toggle_frame(player,name,state)
|
||||
end
|
||||
|
||||
--- Creates a new center frame define
|
||||
-- @tparam string permision_name the name that can be used with the permision system
|
||||
-- @tparam string permission_name the name that can be used with the permission system
|
||||
-- @treturn table the new center frame define
|
||||
function CenterFrames.new_frame(permision_name)
|
||||
local self = Toolbar.new_button(permision_name)
|
||||
function CenterFrames.new_frame(permission_name)
|
||||
local self = Toolbar.new_button(permission_name)
|
||||
|
||||
self:on_click(function(player,element)
|
||||
self:toggle_frame(player)
|
||||
|
||||
@@ -29,16 +29,16 @@
|
||||
LeftFrames.get_flow(player) --- Gets the left frame flow for a player
|
||||
LeftFrames.get_frame(name,player) --- Gets one frame from the left flow by its name
|
||||
LeftFrames.get_open(player) --- Gets all open frames for a player, if non are open it will remove the close all button
|
||||
LeftFrames.toggle_frame(name,player,state) --- Toggles the visiblty of a left frame, or sets its visiblty state
|
||||
LeftFrames.toggle_frame(name,player,state) --- Toggles the visibility of a left frame, or sets its visibility state
|
||||
|
||||
LeftFrames.new_frame(permision_name) --- Creates a new left frame define
|
||||
LeftFrames.new_frame(permission_name) --- Creates a new left frame define
|
||||
LeftFrames._prototype:set_open_by_default(state) --- Sets if the frame is visible when a player joins, can also be a function to return a boolean
|
||||
LeftFrames._prototype:set_direction(direction) --- Sets the direction of the frame, either vertical or horizontal
|
||||
LeftFrames._prototype:get_frame(player) --- Gets the frame for this define from the left frame flow
|
||||
LeftFrames._prototype:is_open(player) --- Returns if the player currently has this define visible
|
||||
LeftFrames._prototype:toggle(player) --- Toggles the visiblty of the left frame
|
||||
LeftFrames._prototype:toggle(player) --- Toggles the visibility of the left frame
|
||||
|
||||
LeftFrames._prototype:update(player) --- Updates the contents of the left frame, first tries update callback, oter wise will clear and redraw
|
||||
LeftFrames._prototype:update(player) --- Updates the contents of the left frame, first tries update callback, other wise will clear and redraw
|
||||
LeftFrames._prototype:update_all(update_offline) --- Updates the frame for all players, see update
|
||||
LeftFrames._prototype:redraw(player) --- Redraws the frame by calling on_draw, will always clear the frame
|
||||
LeftFrames._prototype:redraw_all(update_offline) --- Redraws the frame for all players, see redraw
|
||||
@@ -106,11 +106,11 @@ function LeftFrames.get_open(player)
|
||||
return open
|
||||
end
|
||||
|
||||
--- Toggles the visiblty of a left frame, or sets its visiblty state
|
||||
--- Toggles the visibility of a left frame, or sets its visibility state
|
||||
-- @tparam string name the name of the gui frame to toggle
|
||||
-- @tparam LuaPlayer player the player to get the frame of
|
||||
-- @tparam[opt] boolean state when given will be the state that the visiblty is set to
|
||||
-- @treturn boolean the new state of the visiblity
|
||||
-- @tparam[opt] boolean state when given will be the state that the visibility is set to
|
||||
-- @treturn boolean the new state of the visibility
|
||||
function LeftFrames.toggle_frame(name,player,state)
|
||||
local define = LeftFrames.frames[name]
|
||||
if not define then
|
||||
@@ -130,10 +130,10 @@ function LeftFrames.toggle_frame(name,player,state)
|
||||
end
|
||||
|
||||
--- Creates a new left frame define
|
||||
-- @tparam string permision_name the name that can be used with the permision system
|
||||
-- @tparam string permission_name the name that can be used with the permission system
|
||||
-- @treturn table the new left frame define
|
||||
function LeftFrames.new_frame(permision_name)
|
||||
local self = Toolbar.new_button(permision_name)
|
||||
function LeftFrames.new_frame(permission_name)
|
||||
local self = Toolbar.new_button(permission_name)
|
||||
|
||||
local mt = getmetatable(self)
|
||||
mt.__index = LeftFrames._prototype
|
||||
@@ -151,7 +151,7 @@ function LeftFrames.new_frame(permision_name)
|
||||
end
|
||||
|
||||
--- Sets if the frame is visible when a player joins, can also be a function to return a boolean
|
||||
-- @tparam[opt=true] ?boolean|function state the default state of the visiblty, can be a function
|
||||
-- @tparam[opt=true] ?boolean|function state the default state of the visibility, can be a function
|
||||
-- state param - player LuaPlayer - the player that has joined the game
|
||||
-- state param - define_name string - the define name for the frame
|
||||
-- state return - boolean - false will hide the frame
|
||||
@@ -167,7 +167,7 @@ function LeftFrames._prototype:set_open_by_default(state)
|
||||
end
|
||||
|
||||
--- Sets the direction of the frame, either vertical or horizontal
|
||||
-- @tparam string direction the direction to have the elements be added to thef frame
|
||||
-- @tparam string direction the direction to have the elements be added to the frame
|
||||
function LeftFrames._prototype:set_direction(direction)
|
||||
self.direction = direction
|
||||
return self
|
||||
@@ -221,9 +221,9 @@ function LeftFrames._prototype:is_open(player)
|
||||
return frame and frame.visible or false
|
||||
end
|
||||
|
||||
--- Toggles the visiblty of the left frame
|
||||
--- Toggles the visibility of the left frame
|
||||
-- @tparam LuaPlayer player the player to toggle the frame of
|
||||
-- @treturn boolean the new state of the visiblity
|
||||
-- @treturn boolean the new state of the visibility
|
||||
function LeftFrames._prototype:toggle(player)
|
||||
local frame = self:get_frame(player)
|
||||
Gui.toggle_visible(frame)
|
||||
@@ -231,7 +231,7 @@ function LeftFrames._prototype:toggle(player)
|
||||
return frame.visible
|
||||
end
|
||||
|
||||
--- Updates the contents of the left frame, first tries update callback, oter wise will clear and redraw
|
||||
--- Updates the contents of the left frame, first tries update callback, other wise will clear and redraw
|
||||
-- @tparam LuaPlayer player the player to update the frame of
|
||||
function LeftFrames._prototype:update(player)
|
||||
local frame = self:get_frame(player)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
PopupFrames.get_flow(player) --- Gets the left flow that contains the popup frames
|
||||
PopupFrames.open(define_name,player,open_time,...) --- Opens a popup for the player, can give the amount of time it is open as well as params for the draw function
|
||||
|
||||
PopupFrames.close_progress --- Progress bar which when depleaded will close the popup frame
|
||||
PopupFrames.close_progress --- Progress bar which when depleted will close the popup frame
|
||||
PopupFrames.close_button --- A button which can be used to close the gui before the timer runs out
|
||||
|
||||
PopupFrames.new_popup(name) --- Creates a new popup frame define
|
||||
@@ -34,17 +34,17 @@ Global.register(PopupFrames.paused_popups,function(tbl)
|
||||
PopupFrames.paused_popups = tbl
|
||||
end)
|
||||
|
||||
--- Sets the state of the element in the pasued list, nil or true
|
||||
--- Sets the state of the element in the paused list, nil or true
|
||||
-- @tparam LuaGuiElement element the element to set the state of
|
||||
-- @tparam[opt] boolean state the state to set it to, true will pause the the progress bar
|
||||
local function set_pasued_state(element,state)
|
||||
local function set_paused_state(element,state)
|
||||
local name = element.player_index..':'..element.index
|
||||
PopupFrames.paused_popups[name] = state
|
||||
end
|
||||
|
||||
--- Gets the state of the element in the pasued list, nil or true
|
||||
--- Gets the state of the element in the paused list, nil or true
|
||||
-- @tparam LuaGuiElement element the element to get the state of
|
||||
local function get_pasued_state(element)
|
||||
local function get_paused_state(element)
|
||||
local name = element.player_index..':'..element.index
|
||||
return PopupFrames.paused_popups[name]
|
||||
end
|
||||
@@ -75,11 +75,11 @@ end
|
||||
local function close_popup(element)
|
||||
local frame = element.parent.parent.parent
|
||||
if not frame or not frame.valid then return end
|
||||
set_pasued_state(element.parent[PopupFrames.close_progress:uid()])
|
||||
set_paused_state(element.parent[PopupFrames.close_progress:uid()])
|
||||
frame.destroy()
|
||||
end
|
||||
|
||||
--- Progress bar which when depleaded will close the popup frame
|
||||
--- Progress bar which when depleted will close the popup frame
|
||||
PopupFrames.close_progress =
|
||||
ProgressBar.new_progressbar()
|
||||
:use_count_down()
|
||||
@@ -100,20 +100,20 @@ end)
|
||||
--- When the progress bar is clicked it will pause its progress, or resume if previously paused
|
||||
Gui.on_click(PopupFrames.close_progress:uid(),function(event)
|
||||
local element = event.element
|
||||
if get_pasued_state(element) then
|
||||
set_pasued_state(element)
|
||||
if get_paused_state(element) then
|
||||
set_paused_state(element)
|
||||
else
|
||||
set_pasued_state(element,true)
|
||||
set_paused_state(element,true)
|
||||
end
|
||||
end)
|
||||
|
||||
--- When the parent flow of the progress bar is clicked it will pause its progress, or resume if previously paused
|
||||
Gui.on_click(PopupFrames.close_frame_name,function(event)
|
||||
local element = event.element[PopupFrames.close_progress:uid()]
|
||||
if get_pasued_state(element) then
|
||||
set_pasued_state(element)
|
||||
if get_paused_state(element) then
|
||||
set_paused_state(element)
|
||||
else
|
||||
set_pasued_state(element,true)
|
||||
set_paused_state(element,true)
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -214,9 +214,9 @@ Event.add(defines.events.on_player_created,function(event)
|
||||
}
|
||||
end)
|
||||
|
||||
--- Every tick any, not pasued, progress bars will go down by one tick
|
||||
--- Every tick any, not paused, progress bars will go down by one tick
|
||||
Event.add(defines.events.on_tick,PopupFrames.close_progress:event_countdown(function(element)
|
||||
return not get_pasued_state(element)
|
||||
return not get_paused_state(element)
|
||||
end))
|
||||
|
||||
return PopupFrames
|
||||
@@ -22,17 +22,17 @@ local Game = require 'utils.game'
|
||||
local mod_gui = require 'mod-gui'
|
||||
|
||||
local Toolbar = {
|
||||
permisison_names = {},
|
||||
permission_names = {},
|
||||
buttons = {}
|
||||
}
|
||||
|
||||
function Toolbar.allowed(player,define_name)
|
||||
local permisison_name = Toolbar.permisison_names[define_name] or define_name
|
||||
return Roles.player_allowed(player,permisison_name)
|
||||
local permission_name = Toolbar.permission_names[define_name] or define_name
|
||||
return Roles.player_allowed(player,permission_name)
|
||||
end
|
||||
|
||||
function Toolbar.permission_alias(define_name,permisison_name)
|
||||
Toolbar.permisison_names[define_name] = permisison_name
|
||||
function Toolbar.permission_alias(define_name,permission_name)
|
||||
Toolbar.permission_names[define_name] = permission_name
|
||||
end
|
||||
|
||||
--- Adds a new button to the toolbar
|
||||
|
||||
Reference in New Issue
Block a user