mirror of
https://github.com/Refactorio/RedMew.git
synced 2025-01-18 03:21:47 +02:00
on_open_debug callback
This commit is contained in:
parent
a1aa2add44
commit
ba87c468ce
@ -21,16 +21,16 @@ local name_lookup = {}
|
||||
-- GUI names
|
||||
local checkbox_name = Gui.uid_name()
|
||||
|
||||
-- Global tables
|
||||
-- global tables
|
||||
local enabled = {}
|
||||
local last_events = {}
|
||||
global.event_view = {
|
||||
global.debug_event_view = {
|
||||
enabled = enabled,
|
||||
last_events = last_events
|
||||
}
|
||||
|
||||
local function setup_globals()
|
||||
local tbl = global.event_view
|
||||
function Public.on_open_debug()
|
||||
local tbl = global.debug_event_view
|
||||
if tbl then
|
||||
enabled = tbl.enabled
|
||||
last_events = tbl.last_events
|
||||
@ -38,11 +38,13 @@ local function setup_globals()
|
||||
enabled = {}
|
||||
last_events = {}
|
||||
|
||||
global.event_view = {
|
||||
global.debug_event_view = {
|
||||
enabled = enabled,
|
||||
last_events = last_events
|
||||
}
|
||||
end
|
||||
|
||||
Public.on_open_debug = nil
|
||||
end
|
||||
|
||||
-- Local functions
|
||||
@ -91,8 +93,6 @@ grid_builder[0] = nil
|
||||
table.sort(grid_builder)
|
||||
|
||||
function Public.show(container)
|
||||
setup_globals()
|
||||
|
||||
local main_frame_flow = container.add({type = 'flow', direction = 'vertical'})
|
||||
local scroll_pane = main_frame_flow.add({type = 'scroll-pane'})
|
||||
local gui_table = scroll_pane.add({type = 'table', column_count = 3, draw_horizontal_lines = true})
|
||||
|
@ -16,6 +16,14 @@ local close_name = Gui.uid_name()
|
||||
local tab_name = Gui.uid_name()
|
||||
|
||||
function Public.open_dubug(player)
|
||||
for i = 1, #pages do
|
||||
local page = pages[i]
|
||||
local callback = page.on_open_debug
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
|
||||
local center = player.gui.center
|
||||
local frame = center[main_frame_name]
|
||||
if frame then
|
||||
|
Loading…
x
Reference in New Issue
Block a user