Added checkboxs

This commit is contained in:
Cooldude2606
2019-08-29 18:20:44 +01:00
parent cb59cc0537
commit b631172487
99 changed files with 626 additions and 263 deletions

View File

@@ -7,7 +7,7 @@
-- Functions that act as a landing point for the other funtions
-- @section core
local Event = require 'utils.event' -- @dep utils.event
local Game = require 'utils.game' -- @dep utils.game
local Prototype = require 'expcore.gui.prototype'
local Gui = {
@@ -80,4 +80,40 @@ function Gui.clone_concept(name,new_name)
return concept:clone(new_name)
end
--[[-- A categorize function to be used with add_store, each player has their own category
@tparam LuaGuiElement element the element that will be converted to a string
@treturn string the player's name who owns this element
@usage-- Storing data on a per player basis, can be used with instances
Gui.get_concept('CustomButton')
:define_data_store(Gui.categorize_by_player)
]]
function Gui.categorize_by_player(element)
local player = Game.get_player_by_index(element.player_index)
return player.name
end
--[[-- A categorize function to be used with add_store, each force has its own category
@tparam LuaGuiElement element the element that will be converted to a string
@treturn string the player's force name who owns this element
@usage-- Storing data on a per force basis, can be used with instances
Gui.get_concept('CustomButton')
:define_data_store(Gui.categorize_by_force)
]]
function Gui.categorize_by_force(element)
local player = Game.get_player_by_index(element.player_index)
return player.force.name
end
--[[-- A categorize function to be used with add_store, each surface has its own category
@tparam LuaGuiElement element the element that will be converted to a string
@treturn string the player's surface name who owns this element
@usage-- Storing data on a per surface basis, can be used with instances
Gui.get_concept('CustomButton')
:define_data_store(Gui.categorize_by_surface)
]]
function Gui.categorize_by_surface(element)
local player = Game.get_player_by_index(element.player_index)
return player.surface.name
end
return Gui