Added Redmew Debugger and Debugged Checkboxs

This commit is contained in:
Cooldude2606
2019-05-10 22:47:10 +01:00
parent 5c43c5f854
commit 0559bade9c
21 changed files with 1067 additions and 72 deletions

View File

@@ -1,26 +1,27 @@
local Gui = require 'utils.gui'
local Game = require 'utils.game'
Gui._prototype = {_draw={}}
Gui._prototype = {}
Gui.inputs = {}
Gui.structure = {}
Gui.outputs = {}
function Gui._extend_prototype(tbl)
for k,v in pairs(Gui._prototype) do
if not tbl[k] then tbl[k] = table.deep_copy(v) end
if not tbl[k] then tbl[k] = v end
end
return tbl
end
--- Sets the caption for the element config
function Gui._prototype:set_caption(caption)
self.caption = caption
self._draw.caption = caption
return self
end
--- Sets the tooltip for the element config
function Gui._prototype:set_tooltip(tooltip)
self.tooltip = tooltip
self._draw.tooltip = tooltip
return self
end
@@ -44,13 +45,14 @@ end
--- Draws the element using what is in the _draw table, allows use of authenticator if present
function Gui._prototype:draw_to(element)
if element.children[self.name] then return end
if element[self.name] then return end
local player = Game.get_player_by_index(element.player_index)
if self.pre_authenticator then
if not self.pre_authenticator(element.player,self.clean_name or self.name) then return end
if not self.pre_authenticator(player,self.clean_name or self.name) then return end
end
local _element = element.add(self._draw)
if self.authenticator then
_element.enabled = not not self.authenticator(element.player,self.clean_name or self.name)
_element.enabled = not not self.authenticator(player,self.clean_name or self.name)
end
if self._post_draw then self._post_draw(_element) end
return _element