mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-30 20:41:41 +09:00
Cleaned up file
This commit is contained in:
@@ -219,7 +219,7 @@ end)
|
|||||||
|
|
||||||
--[[-- Used to make a solid white bar in a gui
|
--[[-- Used to make a solid white bar in a gui
|
||||||
@element Gui.bar
|
@element Gui.bar
|
||||||
@tparam LuaGuiElement parent the parent element to which the container will be added
|
@tparam LuaGuiElement parent the parent element to which the bar will be added
|
||||||
@tparam number width the width of the bar that will be made, if not given bar will strech to fill the parent
|
@tparam number width the width of the bar that will be made, if not given bar will strech to fill the parent
|
||||||
|
|
||||||
@usage-- Adding a bar to a gui
|
@usage-- Adding a bar to a gui
|
||||||
@@ -239,4 +239,60 @@ end)
|
|||||||
style.color = {r=255,g=255,b=255}
|
style.color = {r=255,g=255,b=255}
|
||||||
if width then style.width = width
|
if width then style.width = width
|
||||||
else style.horizontally_stretchable = true end
|
else style.horizontally_stretchable = true end
|
||||||
|
end)
|
||||||
|
|
||||||
|
--[[-- Used to make a label which is centered and of a certian size
|
||||||
|
@element Gui.centered_label
|
||||||
|
@tparam LuaGuiElement parent the parent element to which the label will be added
|
||||||
|
@tparam number width the width of the label, must be given in order to center the caption
|
||||||
|
@tparam ?string|Concepts.LocalizedString caption the caption that will be shown on the label
|
||||||
|
@tparam[opt] ?string|Concepts.LocalizedString tooltip the tooltip that will be shown on the label
|
||||||
|
|
||||||
|
@usage-- Adding a centered label
|
||||||
|
local label = Gui.centered_label(parent, 100, 'This is centered')
|
||||||
|
|
||||||
|
]]
|
||||||
|
Gui.centered_label =
|
||||||
|
Gui.element(function(_,parent,width,caption,tooltip)
|
||||||
|
local label = parent.add{
|
||||||
|
type = 'label',
|
||||||
|
caption = caption,
|
||||||
|
tooltip = tooltip,
|
||||||
|
style = 'description_label'
|
||||||
|
}
|
||||||
|
|
||||||
|
local style = label.style
|
||||||
|
style.horizontal_align = 'center'
|
||||||
|
style.single_line = false
|
||||||
|
style.width = width
|
||||||
|
|
||||||
|
return label
|
||||||
|
end)
|
||||||
|
|
||||||
|
--[[-- Used to make a title which has two bars on either side
|
||||||
|
@element Gui.title_label
|
||||||
|
@tparam LuaGuiElement parent the parent element to which the label will be added
|
||||||
|
@tparam number width the width of the first bar, this can be used to position the label
|
||||||
|
@tparam ?string|Concepts.LocalizedString caption the caption that will be shown on the label
|
||||||
|
@tparam[opt] ?string|Concepts.LocalizedString tooltip the tooltip that will be shown on the label
|
||||||
|
|
||||||
|
@usage-- Adding a centered label
|
||||||
|
local label = Gui.centered_label(parent, 100, 'This is centered')
|
||||||
|
|
||||||
|
]]
|
||||||
|
Gui.title_label =
|
||||||
|
Gui.element(function(_,parent,width,caption,tooltip)
|
||||||
|
local title_flow = parent.add{ type='flow' }
|
||||||
|
title_flow.style.vertical_align = 'center'
|
||||||
|
|
||||||
|
Gui.bar(title_flow,width)
|
||||||
|
local title_label = title_flow.add{
|
||||||
|
type = 'label',
|
||||||
|
caption = caption,
|
||||||
|
tooltip = tooltip,
|
||||||
|
style = 'heading_1_label'
|
||||||
|
}
|
||||||
|
Gui.bar(title_flow)
|
||||||
|
|
||||||
|
return title_label
|
||||||
end)
|
end)
|
||||||
@@ -147,6 +147,7 @@ servers-d7=This is our event server, we try to run an event every weekend
|
|||||||
servers-8=S8 T̷-̶s̶-̴:̷
|
servers-8=S8 T̷-̶s̶-̴:̷
|
||||||
servers-d8=N̵o̴ ̶o̷-̶e̵ ̴k̸n̷-̶w̵s̸ ̴w̷h̷a̶-̶ ̷h̴a̴p̷p̴e̷n̷s̸ ̷o̶n̴ ̷t̶h̴-̶s̶ ̷s̷e̶r̸v̸e̴r̷,̶ ̸i̸t̴ ̷m̶-̸g̴h̶t̷ ̸n̸-̶t̵ ̷e̴v̸e̸n̶t̷ ̵-̷x̴i̵s̶t̸.̸
|
servers-d8=N̵o̴ ̶o̷-̶e̵ ̴k̸n̷-̶w̵s̸ ̴w̷h̷a̶-̶ ̷h̴a̴p̷p̴e̷n̷s̸ ̷o̶n̴ ̷t̶h̴-̶s̶ ̷s̷e̶r̸v̸e̴r̷,̶ ̸i̸t̴ ̷m̶-̸g̴h̶t̷ ̸n̸-̶t̵ ̷e̴v̸e̸n̶t̷ ̵-̷x̴i̵s̶t̸.̸
|
||||||
servers-external=External Links
|
servers-external=External Links
|
||||||
|
servers-open-in-browser=Open in your browser
|
||||||
backers-tab=Backers
|
backers-tab=Backers
|
||||||
backers-tooltip=People who have helped make our server
|
backers-tooltip=People who have helped make our server
|
||||||
backers-general=We would like to thank all our staff and backers who have helped our comunity grow. Our staff have helped to keep our servers safe from trolls and fun places to play. Our backers have helped us to cover our running costs and provide a great comunity for us all to enjoy together.
|
backers-general=We would like to thank all our staff and backers who have helped our comunity grow. Our staff have helped to keep our servers safe from trolls and fun places to play. Our backers have helped us to cover our running costs and provide a great comunity for us all to enjoy together.
|
||||||
|
|||||||
@@ -12,23 +12,12 @@ local Game = require 'utils.game' --- @dep utils.game
|
|||||||
|
|
||||||
local tabs = {}
|
local tabs = {}
|
||||||
local function Tab(caption,tooltip,element_define)
|
local function Tab(caption,tooltip,element_define)
|
||||||
tabs[#tabs+1] = {caption,tooltip,element_define}
|
tabs[#tabs+1] = {caption, tooltip, element_define}
|
||||||
end
|
end
|
||||||
|
|
||||||
local frame_width = 595
|
local frame_width = 595 -- controls width of top descritions
|
||||||
|
local title_width = 270 -- controls the centering of the titles
|
||||||
local function description_label(parent,width,caption)
|
local scroll_hieght = 275 -- controls the height of the scrolls
|
||||||
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
|
--- Sub content area used within the content areas
|
||||||
-- @element sub_content
|
-- @element sub_content
|
||||||
@@ -45,29 +34,11 @@ end)
|
|||||||
horizontal_align = 'center'
|
horizontal_align = 'center'
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Title element with bars on each side
|
--- Table which has a title above it above it
|
||||||
-- @element title
|
|
||||||
local title =
|
|
||||||
Gui.element(function(_,parent,bar_size,caption)
|
|
||||||
local title_flow = parent.add{ type='flow' }
|
|
||||||
title_flow.style.vertical_align = 'center'
|
|
||||||
|
|
||||||
Gui.bar(title_flow,bar_size)
|
|
||||||
local title_label = title_flow.add{
|
|
||||||
type = 'label',
|
|
||||||
caption = caption,
|
|
||||||
style = 'heading_1_label'
|
|
||||||
}
|
|
||||||
Gui.bar(title_flow)
|
|
||||||
|
|
||||||
return title_label
|
|
||||||
end)
|
|
||||||
|
|
||||||
--- Table which has a title above it
|
|
||||||
-- @element title_table
|
-- @element title_table
|
||||||
local title_table =
|
local title_table =
|
||||||
Gui.element(function(_,parent,bar_size,caption,column_count)
|
Gui.element(function(_,parent,bar_size,caption,column_count)
|
||||||
title(parent, bar_size, caption)
|
Gui.title_label(parent, bar_size, caption)
|
||||||
|
|
||||||
return parent.add{
|
return parent.add{
|
||||||
type = 'table',
|
type = 'table',
|
||||||
@@ -82,7 +53,7 @@ end)
|
|||||||
horizontally_stretchable = true
|
horizontally_stretchable = true
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Scroll to be used with title tables
|
--- Scroll to be used with Gui.title_label tables
|
||||||
-- @element title_table_scroll
|
-- @element title_table_scroll
|
||||||
local title_table_scroll =
|
local title_table_scroll =
|
||||||
Gui.element{
|
Gui.element{
|
||||||
@@ -94,7 +65,7 @@ Gui.element{
|
|||||||
}
|
}
|
||||||
:style{
|
:style{
|
||||||
padding = {1,3},
|
padding = {1,3},
|
||||||
maximal_height = 275,
|
maximal_height = scroll_hieght,
|
||||||
horizontally_stretchable = true,
|
horizontally_stretchable = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,18 +79,15 @@ Gui.element(function(_,parent)
|
|||||||
|
|
||||||
-- Set up the top flow with logos
|
-- Set up the top flow with logos
|
||||||
local top_flow = container.add{ type='flow' }
|
local top_flow = container.add{ type='flow' }
|
||||||
top_flow.add{ type='sprite', sprite='file/modules/gui/logo.png'}
|
top_flow.add{ type='sprite', sprite='file/modules/gui/logo.png' }
|
||||||
local top_vertical_flow = top_flow.add{ type='flow', direction='vertical' }
|
local top_vertical_flow = top_flow.add{ type='flow', direction='vertical' }
|
||||||
top_flow.add{ type='sprite', sprite='file/modules/gui/logo.png'}
|
top_flow.add{ type='sprite', sprite='file/modules/gui/logo.png' }
|
||||||
top_vertical_flow.style.horizontal_align = 'center'
|
top_vertical_flow.style.horizontal_align = 'center'
|
||||||
|
|
||||||
-- Add the title to the top flow
|
-- Add the title and description to the top flow
|
||||||
title(top_vertical_flow,62,'Welcome to '..server_details.name)
|
Gui.title_label(top_vertical_flow, 62, 'Welcome to '..server_details.name)
|
||||||
|
Gui.centered_label(top_vertical_flow, 380, server_details.description)
|
||||||
-- Add the description to the top flow
|
|
||||||
description_label(top_vertical_flow,380,server_details.description)
|
|
||||||
Gui.bar(container)
|
Gui.bar(container)
|
||||||
container.add{ type='flow' }.style.height = 4
|
|
||||||
|
|
||||||
-- Get the names of the roles the player has
|
-- Get the names of the roles the player has
|
||||||
local player_roles = Roles.get_player_roles(player)
|
local player_roles = Roles.get_player_roles(player)
|
||||||
@@ -129,9 +97,10 @@ Gui.element(function(_,parent)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Add the other information to the gui
|
-- Add the other information to the gui
|
||||||
description_label(sub_content(container),frame_width,{'readme.welcome-general',server_details.reset_time})
|
container.add{ type='flow' }.style.height = 4
|
||||||
description_label(sub_content(container),frame_width,{'readme.welcome-roles',table.concat(role_names,', ')})
|
Gui.centered_label(sub_content(container), frame_width, {'readme.welcome-general', server_details.reset_time})
|
||||||
description_label(sub_content(container),frame_width,{'readme.welcome-chat'})
|
Gui.centered_label(sub_content(container), frame_width, {'readme.welcome-roles', table.concat(role_names,', ')})
|
||||||
|
Gui.centered_label(sub_content(container), frame_width, {'readme.welcome-chat'})
|
||||||
|
|
||||||
return container
|
return container
|
||||||
end))
|
end))
|
||||||
@@ -142,21 +111,20 @@ Tab({'readme.rules-tab'},{'readme.rules-tooltip'},
|
|||||||
Gui.element(function(_,parent)
|
Gui.element(function(_,parent)
|
||||||
local container = parent.add{ type='flow', direction='vertical' }
|
local container = parent.add{ type='flow', direction='vertical' }
|
||||||
|
|
||||||
-- Add the title to the content
|
-- Add the title and description to the content
|
||||||
title(container,267,{'readme.rules-tab'})
|
Gui.title_label(container, title_width-3, {'readme.rules-tab'})
|
||||||
|
Gui.centered_label(container, frame_width, {'readme.rules-general'})
|
||||||
-- Add the tab description
|
|
||||||
description_label(container,frame_width,{'readme.rules-general'})
|
|
||||||
Gui.bar(container)
|
Gui.bar(container)
|
||||||
|
container.add{ type='flow' }
|
||||||
|
|
||||||
-- Add a table for the rules
|
-- Add a table for the rules
|
||||||
container.add{ type='flow' }
|
local rules = Gui.scroll_table(container, scroll_hieght, 1)
|
||||||
local rules = Gui.scroll_table(container,275,1)
|
|
||||||
rules.style = 'bordered_table'
|
rules.style = 'bordered_table'
|
||||||
|
rules.style.cell_padding = 4
|
||||||
|
|
||||||
-- Add the rules to the table
|
-- Add the rules to the table
|
||||||
for i = 1,15 do
|
for i = 1,15 do
|
||||||
description_label(rules,560,{'readme.rules-'..i})
|
Gui.centered_label(rules, 565, {'readme.rules-'..i})
|
||||||
end
|
end
|
||||||
|
|
||||||
return container
|
return container
|
||||||
@@ -169,22 +137,21 @@ Gui.element(function(_,parent)
|
|||||||
local container = parent.add{ type='flow', direction='vertical' }
|
local container = parent.add{ type='flow', direction='vertical' }
|
||||||
local player = Gui.get_player_from_element(parent)
|
local player = Gui.get_player_from_element(parent)
|
||||||
|
|
||||||
-- Add the title to the content
|
-- Add the title and description to the content
|
||||||
title(container,250,{'readme.commands-tab'})
|
Gui.title_label(container, title_width-20, {'readme.commands-tab'})
|
||||||
|
Gui.centered_label(container, frame_width, {'readme.commands-general'})
|
||||||
-- Add the tab description
|
|
||||||
description_label(container,frame_width,{'readme.commands-general'})
|
|
||||||
Gui.bar(container)
|
Gui.bar(container)
|
||||||
|
container.add{ type='flow' }
|
||||||
|
|
||||||
-- Add a table for the commands
|
-- Add a table for the commands
|
||||||
container.add{ type='flow' }
|
local commands = Gui.scroll_table(container, scroll_hieght, 2)
|
||||||
local commands = Gui.scroll_table(container,275,2)
|
|
||||||
commands.style = 'bordered_table'
|
commands.style = 'bordered_table'
|
||||||
|
commands.style.cell_padding = 0
|
||||||
|
|
||||||
-- Add the rules to the table
|
-- Add the rules to the table
|
||||||
for name,command in pairs(Commands.get(player)) do
|
for name,command in pairs(Commands.get(player)) do
|
||||||
description_label(commands,100,name)
|
Gui.centered_label(commands, 120, name)
|
||||||
description_label(commands,444,command.help)
|
Gui.centered_label(commands, 450, command.help)
|
||||||
end
|
end
|
||||||
|
|
||||||
return container
|
return container
|
||||||
@@ -196,30 +163,28 @@ Tab({'readme.servers-tab'},{'readme.servers-tooltip'},
|
|||||||
Gui.element(function(_,parent)
|
Gui.element(function(_,parent)
|
||||||
local container = parent.add{ type='flow', direction='vertical' }
|
local container = parent.add{ type='flow', direction='vertical' }
|
||||||
|
|
||||||
-- Add the title to the content
|
-- Add the title and description to the content
|
||||||
title(container,260,{'readme.servers-tab'})
|
Gui.title_label(container, title_width-10, {'readme.servers-tab'})
|
||||||
|
Gui.centered_label(container, frame_width, {'readme.servers-general'})
|
||||||
-- Add the tab description
|
|
||||||
description_label(container,frame_width,{'readme.servers-general'})
|
|
||||||
Gui.bar(container)
|
Gui.bar(container)
|
||||||
|
container.add{ type='flow' }
|
||||||
|
|
||||||
-- Draw the scroll
|
-- Draw the scroll
|
||||||
container.add{ type='flow' }
|
|
||||||
local scroll_pane = title_table_scroll(container)
|
local scroll_pane = title_table_scroll(container)
|
||||||
scroll_pane.style.maximal_height = 295
|
scroll_pane.style.maximal_height = scroll_hieght + 20 -- the text is a bit shorter
|
||||||
|
|
||||||
-- Add the dactorio servers
|
-- Add the factorio servers
|
||||||
local factoiro_servers = title_table(scroll_pane, 225, {'readme.servers-factorio'}, 2)
|
local factoiro_servers = title_table(scroll_pane, 225, {'readme.servers-factorio'}, 2)
|
||||||
for i = 1,8 do
|
for i = 1,8 do
|
||||||
description_label(factoiro_servers,106,{'readme.servers-'..i})
|
Gui.centered_label(factoiro_servers, 110, {'readme.servers-'..i})
|
||||||
description_label(factoiro_servers,462,{'readme.servers-d'..i})
|
Gui.centered_label(factoiro_servers, 460, {'readme.servers-d'..i})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Add the external links
|
-- Add the external links
|
||||||
local external_links = title_table(scroll_pane, 235, {'readme.servers-external'}, 2)
|
local external_links = title_table(scroll_pane, 235, {'readme.servers-external'}, 2)
|
||||||
for _,key in ipairs{'discord','website','patreon','status','github'} do
|
for _,key in ipairs{'discord','website','patreon','status','github'} do
|
||||||
description_label(external_links,106,key:gsub("^%l", string.upper))
|
Gui.centered_label(external_links, 110, key:gsub("^%l", string.upper))
|
||||||
description_label(external_links,462,{'links.'..key})
|
Gui.centered_label(external_links, 460, {'links.'..key}, {'readme.servers-open-in-browser'})
|
||||||
end
|
end
|
||||||
|
|
||||||
return container
|
return container
|
||||||
@@ -231,12 +196,11 @@ Tab({'readme.backers-tab'},{'readme.backers-tooltip'},
|
|||||||
Gui.element(function(_,parent)
|
Gui.element(function(_,parent)
|
||||||
local container = parent.add{ type='flow', direction='vertical' }
|
local container = parent.add{ type='flow', direction='vertical' }
|
||||||
|
|
||||||
-- Add the title to the content
|
-- Add the title and description to the content
|
||||||
title(container,260,{'readme.backers-tab'})
|
Gui.title_label(container, title_width-10, {'readme.backers-tab'})
|
||||||
|
Gui.centered_label(container, frame_width, {'readme.backers-general'})
|
||||||
-- Add the tab description
|
|
||||||
description_label(container,frame_width,{'readme.backers-general'})
|
|
||||||
Gui.bar(container)
|
Gui.bar(container)
|
||||||
|
container.add{ type='flow' }
|
||||||
|
|
||||||
-- Find which players will go where
|
-- Find which players will go where
|
||||||
local done = {}
|
local done = {}
|
||||||
@@ -269,20 +233,17 @@ Gui.element(function(_,parent)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Draw the scroll
|
|
||||||
container.add{ type='flow' }
|
|
||||||
local scroll_pane = title_table_scroll(container)
|
|
||||||
|
|
||||||
-- Add the different tables
|
-- Add the different tables
|
||||||
|
local scroll_pane = title_table_scroll(container)
|
||||||
for _, players in pairs(groups) do
|
for _, players in pairs(groups) do
|
||||||
local table = title_table(scroll_pane, players._width, players._title, 4)
|
local table = title_table(scroll_pane, players._width, players._title, 4)
|
||||||
for _,player_name in ipairs(players) do
|
for _,player_name in ipairs(players) do
|
||||||
description_label(table,140,player_name)
|
Gui.centered_label(table, 140, player_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
if #players < 4 then
|
if #players < 4 then
|
||||||
for i = 1,4-#players do
|
for i = 1,4-#players do
|
||||||
description_label(table,140)
|
Gui.centered_label(table, 140)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -302,11 +263,11 @@ Gui.element(function(event_trigger,parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
-- Add the left hand side of the frame back, removed because of frame_tabbed_pane style
|
-- Add the left hand side of the frame back, removed because of frame_tabbed_pane style
|
||||||
local left_lignment = Gui.alignment(container,nil,nil,'bottom')
|
local left_alignment = Gui.alignment(container, nil, nil, 'bottom')
|
||||||
left_lignment.style.padding = {32,0,0,0}
|
left_alignment.style.padding = {32,0,0,0}
|
||||||
|
|
||||||
local left_side =
|
local left_side =
|
||||||
left_lignment.add{
|
left_alignment.add{
|
||||||
type = 'frame',
|
type = 'frame',
|
||||||
style = 'frame_without_right_side'
|
style = 'frame_without_right_side'
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user