From bb2009b7f71dc71d72d21f80188f164a99570e21 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Fri, 22 Sep 2017 16:37:36 +0100 Subject: [PATCH] Gui debug added --- locale/ExpGaming-Core/GUI/ExpGaming - Center Gui.lua | 4 +++- locale/ExpGaming-Core/GUI/ExpGaming - Inputs.lua | 2 ++ locale/ExpGaming-Core/GUI/ExpGaming - Left Gui.lua | 2 ++ locale/ExpGaming-Core/GUI/ExpGaming - Player Table.lua | 5 +++++ locale/ExpGaming-Core/GUI/ExpGaming - Popup.lua | 4 ++++ locale/ExpGaming-Core/GUI/ExpGaming - Toolbar.lua | 2 ++ 6 files changed, 18 insertions(+), 1 deletion(-) diff --git a/locale/ExpGaming-Core/GUI/ExpGaming - Center Gui.lua b/locale/ExpGaming-Core/GUI/ExpGaming - Center Gui.lua index a989fbae..fe1894b5 100644 --- a/locale/ExpGaming-Core/GUI/ExpGaming - Center Gui.lua +++ b/locale/ExpGaming-Core/GUI/ExpGaming - Center Gui.lua @@ -43,6 +43,7 @@ ExpGui.add_input.button('close_center','Close','Close this GUI',function(player, function draw_frame.center(player,element) local frame_data = nil for _,frame in pairs(frames.center) do if element.name == frame.name then frame_data = frame break end end + debug_write({'GUI','CENTER'},player.name..' '..frame_data.name) if player.gui.is_valid_sprite_path(frame_data.display) then frame_data.display = frame_data.name end if player.gui.center[frame_data.name] then player.gui.center.clear() return else player.gui.center.clear() end local frame = player.gui.center.add{name=frame_data.name,type='frame',caption=frame_data.display,direction='vertical',style=mod_gui.frame_style} @@ -50,7 +51,7 @@ function draw_frame.center(player,element) local tab_bar_scroll = frame.add{type = "scroll-pane", name= "tab_bar_scroll", vertical_scroll_policy="never", horizontal_scroll_policy="always"} local tab_bar = tab_bar_scroll.add{type='flow',direction='horizontal',name='tab_bar'} local tab = frame.add{type = "scroll-pane", name= "tab", vertical_scroll_policy="auto", horizontal_scroll_policy="never"} - for n,t in pairs(frame_data.tabs) do if rank_allowed(get_rank(player),t.name..'_tab') then ExpGui.add_input.draw_button(tab_bar,t.name) end end + for n,t in pairs(frame_data.tabs) do if rank_allowed(get_rank(player),t.name..'_tab') then debug_write({'GUI','CENTER','ADD'},t.name) ExpGui.add_input.draw_button(tab_bar,t.name) end end draw_frame.tab(player,tab_bar[frame_data.tabs[1].name]) ExpGui.add_input.draw_button(tab_bar,'close_center') tab.style.minimal_height = 300 @@ -65,6 +66,7 @@ function draw_frame.center(player,element) end --Draw the tab into the center GUI for the player; do not call manually, must use other functions to call function draw_frame.tab(player,element) + debug_write({'GUI','CENTER','OPEN-TAB'},element.name) for _,btn in pairs(element.parent.children) do if btn.name == 'close_center' or btn.name == element.name then btn.style.font_color = {r = 255, g = 255, b = 255,a=255} else diff --git a/locale/ExpGaming-Core/GUI/ExpGaming - Inputs.lua b/locale/ExpGaming-Core/GUI/ExpGaming - Inputs.lua index 968afb65..88ddc47d 100644 --- a/locale/ExpGaming-Core/GUI/ExpGaming - Inputs.lua +++ b/locale/ExpGaming-Core/GUI/ExpGaming - Inputs.lua @@ -34,6 +34,7 @@ end function add_input.draw_button(frame,name,display,tooltip) if not frame or not frame.valid then error('No frame to draw to') end if not name then error('No button to draw') end + debug_write({'GUI','INPUT'},name) for _,button in pairs(inputs.buttons) do if button.name == name then local display = display or button.display or button.name @@ -51,6 +52,7 @@ end function add_input.draw_text(frame,name,display) if not frame or not frame.valid then error('No frame to draw to') end if not name then error('No text filed to draw') end + debug_write({'GUI','INPUT'},name) for _,text in pairs(inputs.text) do if text.name == name then local display = display or text.display or text.name diff --git a/locale/ExpGaming-Core/GUI/ExpGaming - Left Gui.lua b/locale/ExpGaming-Core/GUI/ExpGaming - Left Gui.lua index ec2cb727..e64a7904 100644 --- a/locale/ExpGaming-Core/GUI/ExpGaming - Left Gui.lua +++ b/locale/ExpGaming-Core/GUI/ExpGaming - Left Gui.lua @@ -33,9 +33,11 @@ function add_frame.left(name,default_display,default_tooltip,vis,event) end --draw the left GUI for the player; called via script, only call manually when update is true and element is the name of the GUI function draw_frame.left(player,element,update) + debug_write({'GUI','LEFT'},player.name) local frame = nil local frame_data = nil local left = mod_gui.get_frame_flow(player) + debug_write({'GUI','LEFT','UPDATE'},update) if not update then for _,frame in pairs(frames.left) do if element.name == frame.name then frame_data = frame break end end if left[frame_data.name] then ExpGui.toggle_visible(left[frame_data.name]) return end diff --git a/locale/ExpGaming-Core/GUI/ExpGaming - Player Table.lua b/locale/ExpGaming-Core/GUI/ExpGaming - Player Table.lua index d838d5ca..3920ec00 100644 --- a/locale/ExpGaming-Core/GUI/ExpGaming - Player Table.lua +++ b/locale/ExpGaming-Core/GUI/ExpGaming - Player Table.lua @@ -39,6 +39,7 @@ for _,filter in pairs(player_table_functions.filters) do end --used to draw filters from the list above function player_table_functions.draw_filters(player,frame,filters) + debug_write({'GUI','PLAYER-TABLE','DRAW-FILTERS'},player.name) local input_bar = frame.add{type='flow',name='input_bar',direction='horizontal'} for _,name in pairs(filters) do local filter_data = nil @@ -76,6 +77,7 @@ end --used to draw the player table with filter that you want --filter = {{'is_admin',true},{'offline',true},{'player_name'}} ; if the length is 2 then it will not attempt to get a user input function player_table_functions.draw(player,frame,filters,input_location) + debug_write({'GUI','PLAYER-TABLE','START'},player.name) global.current_filters[player.index] = {filters,frame} --setup the table if frame.player_table then frame.player_table.destroy() end @@ -93,6 +95,7 @@ function player_table_functions.draw(player,frame,filters,input_location) local add=true for _,filter in pairs(filters) do if #filter == 2 and add then + debug_write({'GUI','PLAYER-TABLE','CHEAK'},p.name..' '..fliter.name) local result = player_table_functions.player_match(p,filter.name,filter.is_text) if not result and filter.is_text == true then result = filter.is_text end add = result or false @@ -100,11 +103,13 @@ function player_table_functions.draw(player,frame,filters,input_location) end for _,filter in pairs(player_table_functions.get_filters(input_location)) do if add then + debug_write({'GUI','PLAYER-TABLE','CHEAK'},p.name..' '..fliter.name) add = player_table_functions.player_match(p,filter.name,filter.is_text) or false end end --add the player if add then--and player.name ~= p.name then + debug_write({'GUI','PLAYER-TABLE','ADD'},p.name) player_table.add{name=p.name.."_id", type="label", caption=i} player_table.add{name=p.name..'_name', type="label", caption=p.name} if p.connected == true diff --git a/locale/ExpGaming-Core/GUI/ExpGaming - Popup.lua b/locale/ExpGaming-Core/GUI/ExpGaming - Popup.lua index 6dd67cd4..f1ae07f8 100644 --- a/locale/ExpGaming-Core/GUI/ExpGaming - Popup.lua +++ b/locale/ExpGaming-Core/GUI/ExpGaming - Popup.lua @@ -50,6 +50,7 @@ function add_frame.popup(style,default_display,default_tooltip,on_click,event) end --draw the popup on_click GUI for the player; do not call manually must use other functions to call function draw_frame.popup_button(player,element) + debug_write({'GUI','POPUP-BUTTON'},player.name) local frame_data = nil for _,frame in pairs(frames.popup) do if element.name == frame.style then frame_data = frame break end end local popups = mod_gui.get_frame_flow(player).popups @@ -62,8 +63,11 @@ function draw_frame.popup(style,args) local args = args or {} local frame_data = nil for _,frame in pairs(frames.popup) do if style == frame.style then frame_data = frame break end end + debug_write({'GUI','POPUP','STYLE'},style) + debug_write({'GUI','POPUP','ARGS'},args) game.write_file('popups.log','\n'..game.tick..' Popup Style: '..style..' Was made with args of: '..table.tostring(args), true, 0) for _,player in pairs(game.connected_players) do + debug_write({'GUI','POPUP','PLAYERS'},player.name) local popups = mod_gui.get_frame_flow(player).popups local frame = get_next_popup(popups) frame_data.event(player,frame,args) diff --git a/locale/ExpGaming-Core/GUI/ExpGaming - Toolbar.lua b/locale/ExpGaming-Core/GUI/ExpGaming - Toolbar.lua index fb05d501..be0553ad 100644 --- a/locale/ExpGaming-Core/GUI/ExpGaming - Toolbar.lua +++ b/locale/ExpGaming-Core/GUI/ExpGaming - Toolbar.lua @@ -27,12 +27,14 @@ function toolbar.add_button(name,default_display,default_tooltip,event) end --draw the toolbar to the player only showing buttons within their restriction function toolbar.draw(player) + debug_write({'GUI','TOOLBAR'},player.name) if not player then error('Need a player to draw to') end local toolbar_frame = mod_gui.get_button_flow(player) toolbar_frame.clear() for _,button in pairs(toolbar.buttons) do local rank = get_rank(player) if rank_allowed(get_rank(player),button.name) then + debug_write({'GUI','TOOLBAR','ADD'},button.name) ExpGui.add_input.draw_button(toolbar_frame,button.name) end end