diff --git a/modules/ExpGamingCore/Gui/control.lua b/modules/ExpGamingCore/Gui/control.lua index c62f200c..28fff4b1 100644 --- a/modules/ExpGamingCore/Gui/control.lua +++ b/modules/ExpGamingCore/Gui/control.lua @@ -61,6 +61,24 @@ function Gui.bar(frame,width) return line end +--- Adds a lable that is centered +-- @usage Gui.centered_label(frane, 'Hello, world!') +-- @tparam LuaGuiElement frame the parent frame to add the label to +-- @tparam string string the string that the lable will have +function Gui.centered_label(frane, string) + local flow = frame.add {frame = 'flow'} + local flow_style = flow.style + flow_style.align = 'center' + flow_style.horizontally_stretchable = true + + local label = flow.add {type = 'label', caption = string} + local label_style = label.style + label_style.align = 'center' + label_style.single_line = false + + return label +end + --- Used to set the index of a drop down to a certian item -- @usage Gui.set_dropdown_index(dropdown,player.name) -- will select the index with the players name as the value -- @param dropdown the dropdown that is to be effected diff --git a/modules/ExpGamingCore/Gui/order_config.lua b/modules/ExpGamingCore/Gui/order_config.lua index 3514de34..7f19658f 100644 --- a/modules/ExpGamingCore/Gui/order_config.lua +++ b/modules/ExpGamingCore/Gui/order_config.lua @@ -1,4 +1,5 @@ return { + 'server-info', 'readme', 'science', 'rockets', diff --git a/modules/ExpGamingCore/Sync/control.lua b/modules/ExpGamingCore/Sync/control.lua index 92939063..482459fb 100644 --- a/modules/ExpGamingCore/Sync/control.lua +++ b/modules/ExpGamingCore/Sync/control.lua @@ -309,7 +309,7 @@ script.on_event('on_pre_player_left_game',Sync.emit_update) script.on_event('on_rocket_launched',Sync.emit_update) function Sync:on_init() - if loaded_modules['ExpGamingCore.Gui'] then verbose('ExpGamingCore.Gui is installed; Loading gui src') require(module_path..'/src/gui',{Sync=Sync}) end + if loaded_modules['ExpGamingCore.Gui'] then verbose('ExpGamingCore.Gui is installed; Loading gui src') require(module_path..'/src/gui',{Sync=Sync,module_path=module_path}) end if loaded_modules['ExpGamingCore.Role'] then verbose('ExpGamingCore.Role is installed; Loading role src') require(module_path..'/src/ranking',{Sync=Sync}) end if loaded_modules['ExpGamingCore.Server'] then require('ExpGamingCore.Server').add_module_to_interface('Sync','ExpGamingCore.Sync') end end diff --git a/modules/ExpGamingCore/Sync/src/gui.lua b/modules/ExpGamingCore/Sync/src/gui.lua index ff89e991..a7c8408d 100644 --- a/modules/ExpGamingCore/Sync/src/gui.lua +++ b/modules/ExpGamingCore/Sync/src/gui.lua @@ -12,6 +12,7 @@ local Gui = require('ExpGamingCore.Gui@^4.0.0') local Sync = Sync -- this is to force sync to remain in the ENV local Sync_gui_functions = {} +local logo_sprite_path = 'file'..string.sub(module_path,2)..'/src/logo.png' --- Adds a emeltent to the sever info gui -- @usage Sync.add_to_gui('string') -- return true @@ -43,24 +44,28 @@ end -- @gui server-info Sync.info_gui = Gui.center{ name='server-info', - caption='Server Info', + caption=logo_sprite_path, tooltip='Basic info about the current server', draw=function(self,frame) frame.caption = '' local info = Sync.info local frame = frame.add{type='flow',direction='vertical'} - local _flow = frame.add{type='flow'} - Gui.bar(_flow,200) + local h_flow = frame.add{type='flow'} + h_flow.add{type='sprite',sprite=logo_sprite_path} + local v_flow = h_flow.add{type='flow',direction='vertical'} + h_flow.add{type='sprite',sprite=logo_sprite_path} + local _flow = v_flow.add{type='flow'} + label_format(v_flow.add{ + type='label', + caption=info.server_description,style='description_label' + },412) + Gui.bar(_flow,110) label_format(_flow.add{ type='label', caption='Welcome To '..info.server_name, style='caption_label' },180) - Gui.bar(_flow,200) - label_format(frame.add{ - type='label', - caption=info.server_description,style='description_label' - },600) + Gui.bar(_flow,110) Gui.bar(frame,600) local _frame = frame local frame = frame.add{ diff --git a/modules/ExpGamingCore/Sync/src/logo.png b/modules/ExpGamingCore/Sync/src/logo.png new file mode 100644 index 00000000..cef59c4d Binary files /dev/null and b/modules/ExpGamingCore/Sync/src/logo.png differ