mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-30 12:31:41 +09:00
Better Server INfo Gui
This commit is contained in:
@@ -61,6 +61,24 @@ function Gui.bar(frame,width)
|
|||||||
return line
|
return line
|
||||||
end
|
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
|
--- 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
|
-- @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
|
-- @param dropdown the dropdown that is to be effected
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
return {
|
return {
|
||||||
|
'server-info',
|
||||||
'readme',
|
'readme',
|
||||||
'science',
|
'science',
|
||||||
'rockets',
|
'rockets',
|
||||||
|
|||||||
@@ -309,7 +309,7 @@ script.on_event('on_pre_player_left_game',Sync.emit_update)
|
|||||||
script.on_event('on_rocket_launched',Sync.emit_update)
|
script.on_event('on_rocket_launched',Sync.emit_update)
|
||||||
|
|
||||||
function Sync:on_init()
|
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.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
|
if loaded_modules['ExpGamingCore.Server'] then require('ExpGamingCore.Server').add_module_to_interface('Sync','ExpGamingCore.Sync') end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -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 = Sync -- this is to force sync to remain in the ENV
|
||||||
|
|
||||||
local Sync_gui_functions = {}
|
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
|
--- Adds a emeltent to the sever info gui
|
||||||
-- @usage Sync.add_to_gui('string') -- return true
|
-- @usage Sync.add_to_gui('string') -- return true
|
||||||
@@ -43,24 +44,28 @@ end
|
|||||||
-- @gui server-info
|
-- @gui server-info
|
||||||
Sync.info_gui = Gui.center{
|
Sync.info_gui = Gui.center{
|
||||||
name='server-info',
|
name='server-info',
|
||||||
caption='Server Info',
|
caption=logo_sprite_path,
|
||||||
tooltip='Basic info about the current server',
|
tooltip='Basic info about the current server',
|
||||||
draw=function(self,frame)
|
draw=function(self,frame)
|
||||||
frame.caption = ''
|
frame.caption = ''
|
||||||
local info = Sync.info
|
local info = Sync.info
|
||||||
local frame = frame.add{type='flow',direction='vertical'}
|
local frame = frame.add{type='flow',direction='vertical'}
|
||||||
local _flow = frame.add{type='flow'}
|
local h_flow = frame.add{type='flow'}
|
||||||
Gui.bar(_flow,200)
|
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{
|
label_format(_flow.add{
|
||||||
type='label',
|
type='label',
|
||||||
caption='Welcome To '..info.server_name,
|
caption='Welcome To '..info.server_name,
|
||||||
style='caption_label'
|
style='caption_label'
|
||||||
},180)
|
},180)
|
||||||
Gui.bar(_flow,200)
|
Gui.bar(_flow,110)
|
||||||
label_format(frame.add{
|
|
||||||
type='label',
|
|
||||||
caption=info.server_description,style='description_label'
|
|
||||||
},600)
|
|
||||||
Gui.bar(frame,600)
|
Gui.bar(frame,600)
|
||||||
local _frame = frame
|
local _frame = frame
|
||||||
local frame = frame.add{
|
local frame = frame.add{
|
||||||
|
|||||||
BIN
modules/ExpGamingCore/Sync/src/logo.png
Normal file
BIN
modules/ExpGamingCore/Sync/src/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
Reference in New Issue
Block a user