mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-28 20:05:22 +09:00
Added welcome tab
This commit is contained in:
BIN
modules/gui/logo.png
Normal file
BIN
modules/gui/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
@@ -14,17 +14,82 @@ local function Tab(caption,tooltip,element_define)
|
||||
tabs[#tabs+1] = {caption,tooltip,element_define}
|
||||
end
|
||||
|
||||
local function description_label(parent,width,caption)
|
||||
local label = parent.add{
|
||||
type = 'label',
|
||||
caption = caption,
|
||||
style = 'description_label'
|
||||
}
|
||||
|
||||
local style = label.style
|
||||
style.horizontal_align = 'center'
|
||||
style.single_line = false
|
||||
style.width = width
|
||||
end
|
||||
|
||||
--- Sub content area used within the content areas
|
||||
-- @element sub_content
|
||||
local sub_content =
|
||||
Gui.element(function(_,parent)
|
||||
return parent.add{
|
||||
type = 'frame',
|
||||
direction = 'vertical',
|
||||
style = 'image_frame'
|
||||
}
|
||||
end)
|
||||
:style{
|
||||
horizontally_stretchable = true,
|
||||
horizontal_align = 'center'
|
||||
}
|
||||
|
||||
--- Content area for the welcome tab
|
||||
-- @element welcome_content
|
||||
Tab('Welcome',nil,
|
||||
Gui.element{
|
||||
type = 'label',
|
||||
caption = 'Welcome'
|
||||
})
|
||||
Tab({'readme.welcome-tab'},{'readme.welcome-tooltip'},
|
||||
Gui.element(function(_,parent)
|
||||
local server_details = global.server_details or { name='ExpGaming S0 - Local', description='Failed to load description: disconnected from sync api.', reset_time='Non Set', branch='Unknown'}
|
||||
local container = parent.add{ type='flow', direction='vertical' }
|
||||
local player = Gui.get_player_from_element(parent)
|
||||
|
||||
-- Set up the top flow with logos
|
||||
local top_flow = container.add{ type='flow' }
|
||||
top_flow.add{ type='sprite', sprite='file/modules/gui/logo.png'}
|
||||
local top_vertical_flow = top_flow.add{ type='flow', direction='vertical' }
|
||||
top_flow.add{ type='sprite', sprite='file/modules/gui/logo.png'}
|
||||
top_vertical_flow.style.horizontal_align = 'center'
|
||||
|
||||
-- Add the title to the top flow
|
||||
local title_flow = top_vertical_flow.add{ type='flow' }
|
||||
title_flow.style.vertical_align = 'center'
|
||||
Gui.bar(title_flow,85)
|
||||
title_flow.add{
|
||||
type = 'label',
|
||||
caption = 'Welcome to '..server_details.name,
|
||||
style = 'caption_label'
|
||||
}
|
||||
Gui.bar(title_flow,85)
|
||||
|
||||
-- Add the description to the top flow
|
||||
description_label(top_vertical_flow,380,server_details.description)
|
||||
Gui.bar(container)
|
||||
|
||||
-- Get the names of the roles the player has
|
||||
local player_roles = Roles.get_player_roles(player)
|
||||
local role_names = {}
|
||||
for i,role in ipairs(player_roles) do
|
||||
role_names[i] = role.name
|
||||
end
|
||||
|
||||
-- Add the other information to the gui
|
||||
description_label(sub_content(container),575,{'readme.welcome-general',server_details.reset_time})
|
||||
description_label(sub_content(container),575,{'readme.welcome-roles',table.concat(role_names,', ')})
|
||||
description_label(sub_content(container),575,{'readme.welcome-chat'})
|
||||
|
||||
return container
|
||||
end))
|
||||
|
||||
--- Content area for the rules tab
|
||||
-- @element rules_content
|
||||
Tab('Rules',nil,
|
||||
Tab({'readme.rules-tab'},{'readme.rules-tooltip'},
|
||||
Gui.element{
|
||||
type = 'label',
|
||||
caption = 'Rules'
|
||||
@@ -32,7 +97,7 @@ Gui.element{
|
||||
|
||||
--- Content area for the commands tab
|
||||
-- @element commands_content
|
||||
Tab('Commands',nil,
|
||||
Tab({'readme.commands-tab'},{'readme.commands-tooltip'},
|
||||
Gui.element{
|
||||
type = 'label',
|
||||
caption = 'Commands'
|
||||
@@ -40,15 +105,15 @@ Gui.element{
|
||||
|
||||
--- Content area for the servers tab
|
||||
-- @element servers_content
|
||||
Tab('Servers',nil,
|
||||
Tab({'readme.servers-tab'},{'readme.servers-tooltip'},
|
||||
Gui.element{
|
||||
type = 'label',
|
||||
caption = 'Servers'
|
||||
})
|
||||
|
||||
--- Content area for the servers tab
|
||||
-- @element servers_content
|
||||
Tab('Backers',nil,
|
||||
-- @element backers_content
|
||||
Tab({'readme.backers-tab'},{'readme.backers-tooltip'},
|
||||
Gui.element{
|
||||
type = 'label',
|
||||
caption = 'Backers'
|
||||
@@ -91,7 +156,6 @@ Gui.element(function(event_trigger,parent)
|
||||
tab_pane.add_tab(tab, tab_details[3](tab_pane))
|
||||
end
|
||||
|
||||
tab_pane.style.width = 500
|
||||
return container
|
||||
end)
|
||||
:on_open(function(player)
|
||||
@@ -107,7 +171,7 @@ end)
|
||||
--- Toggle button for the readme gui
|
||||
-- @element readme_toggle
|
||||
readme_toggle =
|
||||
Gui.toolbar_button('virtual-signal/signal-info','Information',function(player)
|
||||
Gui.toolbar_button('virtual-signal/signal-info',{'readme.main-tooltip'},function(player)
|
||||
return Roles.player_allowed(player,'gui/readme')
|
||||
end)
|
||||
:on_click(function(player,_)
|
||||
|
||||
Reference in New Issue
Block a user