mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-30 20:41:41 +09:00
Added left Gui plus same changes else where
This commit is contained in:
@@ -9,7 +9,7 @@ Discord: https://discord.gg/XSsBV6b
|
|||||||
The credit below may be used by another script do not remove.
|
The credit below may be used by another script do not remove.
|
||||||
]]
|
]]
|
||||||
local credits = {{
|
local credits = {{
|
||||||
name='Center Gui',
|
name='ExpGaming - Center Gui',
|
||||||
owner='Explosive Gaming',
|
owner='Explosive Gaming',
|
||||||
dev='Cooldude2606',
|
dev='Cooldude2606',
|
||||||
description='The main gui in the center',
|
description='The main gui in the center',
|
||||||
@@ -42,7 +42,7 @@ function draw_frame.center(player,element)
|
|||||||
local frame_data = nil
|
local frame_data = nil
|
||||||
for _,frame in pairs(frames.center) do if element.name == frame[1] then frame_data = frame break end end
|
for _,frame in pairs(frames.center) do if element.name == frame[1] then frame_data = frame break end end
|
||||||
if player.gui.is_valid_sprite_path(frame_data[2]) then frame_data[2] = frame_data[1] end
|
if player.gui.is_valid_sprite_path(frame_data[2]) then frame_data[2] = frame_data[1] end
|
||||||
if player.gui.center[frame_data[1]] then player.gui.center.clear() return end
|
if player.gui.center[frame_data[1]] then player.gui.center.clear() return else player.gui.center.clear() end
|
||||||
if frame_data[4] and type(frame_data[4]) == 'function' then frame_data[4](player,element) return end
|
if frame_data[4] and type(frame_data[4]) == 'function' then frame_data[4](player,element) return end
|
||||||
local frame = player.gui.center.add{name=frame_data[1],type='frame',caption=frame_data[2],direction='vertical',style=mod_gui.frame_style}
|
local frame = player.gui.center.add{name=frame_data[1],type='frame',caption=frame_data[2],direction='vertical',style=mod_gui.frame_style}
|
||||||
local tab_bar_scroll = frame.add{type = "scroll-pane", name= "tab_bar_scroll", vertical_scroll_policy="never", horizontal_scroll_policy="always"}
|
local tab_bar_scroll = frame.add{type = "scroll-pane", name= "tab_bar_scroll", vertical_scroll_policy="never", horizontal_scroll_policy="always"}
|
||||||
|
|||||||
@@ -42,9 +42,10 @@ function add_input.draw_button(frame,name,display,tooltip)
|
|||||||
frame.add{name=name, type = "sprite-button", sprite=display, tooltip=tooltip, style = mod_gui.button_style}
|
frame.add{name=name, type = "sprite-button", sprite=display, tooltip=tooltip, style = mod_gui.button_style}
|
||||||
else
|
else
|
||||||
frame.add{name=name, type = "button", caption=display, tooltip=tooltip, style = mod_gui.button_style}
|
frame.add{name=name, type = "button", caption=display, tooltip=tooltip, style = mod_gui.button_style}
|
||||||
end break
|
end return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
error('No Button By The Name Of '..name)
|
||||||
end
|
end
|
||||||
--draws the text into a gui;;frame the frame to draw to;;name name of button to draw;;display(opptinal) overides the default;;tooltip(opptinal) overides the default
|
--draws the text into a gui;;frame the frame to draw to;;name name of button to draw;;display(opptinal) overides the default;;tooltip(opptinal) overides the default
|
||||||
function add_input.draw_text(frame,name,display)
|
function add_input.draw_text(frame,name,display)
|
||||||
|
|||||||
@@ -9,15 +9,34 @@ Discord: https://discord.gg/XSsBV6b
|
|||||||
The credit below may be used by another script do not remove.
|
The credit below may be used by another script do not remove.
|
||||||
]]
|
]]
|
||||||
local credits = {{
|
local credits = {{
|
||||||
name='File Header - ExpGaming-Core-GUI',
|
name='ExpGaming - Left Gui',
|
||||||
owner='Explosive Gaming',
|
owner='Explosive Gaming',
|
||||||
dev='Cooldude2606',
|
dev='Cooldude2606',
|
||||||
description='Just A File Header To Organise Code',
|
description='A simple way to add toggle menus to the left',
|
||||||
factorio_version='0.15.23',
|
factorio_version='0.15.23',
|
||||||
show=false
|
show=false
|
||||||
}}
|
}}
|
||||||
local function credit_loop(reg) for _,cred in pairs(reg) do table.insert(credits,cred) end end
|
local function credit_loop(reg) for _,cred in pairs(reg) do table.insert(credits,cred) end end
|
||||||
--Please Only Edit Below This Line-----------------------------------------------------------
|
--Please Only Edit Below This Line-----------------------------------------------------------
|
||||||
|
local add_frame = ExpGui.add_frame
|
||||||
|
local frames = ExpGui.frames
|
||||||
|
local draw_frame = ExpGui.draw_frame
|
||||||
|
--left guis are always present and only have their visabilty toggled
|
||||||
|
--adds a frame to the left bar; event(player,frame) must be present for left guis as there is no default
|
||||||
|
function add_frame.left(name,display,tooltip,restriction,event)
|
||||||
|
if not name then error('Frame requires a name') end
|
||||||
|
if not event or type(event) ~= 'function' then error('Frame requires a draw function') end
|
||||||
|
table.insert(frames.left,{name,display,event})
|
||||||
|
ExpGui.toolbar.add_button(name,display,tooltip,restriction,draw_frame.left)
|
||||||
|
end
|
||||||
|
--draw the left gui for the player; do not call manuley must use other functions to call
|
||||||
|
function draw_frame.left(player,element)
|
||||||
|
local frame_data = nil
|
||||||
|
for _,frame in pairs(frames.left) do if element.name == frame[1] then frame_data = frame break end end
|
||||||
|
local left = player.gui.left
|
||||||
|
if left[frame_data[1]] then ExpGui.toggleVisable(left[frame_data[1]]) return end
|
||||||
|
local frame = left.add{name=frame_data[1],type='frame',capption=frame_data[2]}
|
||||||
|
frame_data[3](player,frame)
|
||||||
|
end
|
||||||
--Please Only Edit Above This Line-----------------------------------------------------------
|
--Please Only Edit Above This Line-----------------------------------------------------------
|
||||||
return credits
|
return credits
|
||||||
@@ -29,7 +29,7 @@ end
|
|||||||
--draw the toolbar to the player only showing buttons within their restriction
|
--draw the toolbar to the player only showing buttons within their restriction
|
||||||
function toolbar.draw(player)
|
function toolbar.draw(player)
|
||||||
if not player then error('Need a player to draw to') end
|
if not player then error('Need a player to draw to') end
|
||||||
local toolbar_frame = player.gui.top.toolbar or player.gui.top.add{name='toolbar',type='flow'}
|
local toolbar_frame = player.gui.top
|
||||||
toolbar_frame.clear()
|
toolbar_frame.clear()
|
||||||
for _,btn in pairs(toolbar.buttons) do
|
for _,btn in pairs(toolbar.buttons) do
|
||||||
local rank = get_rank(player)
|
local rank = get_rank(player)
|
||||||
|
|||||||
Reference in New Issue
Block a user