mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-30 04:21:41 +09:00
Fixed Center
This commit is contained in:
@@ -35,10 +35,12 @@ end
|
|||||||
function center.open(player,center)
|
function center.open(player,center)
|
||||||
local player = Game.get_player(player)
|
local player = Game.get_player(player)
|
||||||
Gui.center.clear(player)
|
Gui.center.clear(player)
|
||||||
|
if not Gui._get_data('center')[center] then return false end
|
||||||
Gui._get_data('center')[center].open{
|
Gui._get_data('center')[center].open{
|
||||||
element={name=center},
|
element={name=center},
|
||||||
player_index=player.index
|
player_index=player.index
|
||||||
}
|
}
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- used to clear the center frame of the player, used mainly in script
|
-- used to clear the center frame of the player, used mainly in script
|
||||||
@@ -129,6 +131,17 @@ function center._center:draw(frame)
|
|||||||
frame.parent.add{type='frame',name='temp'}.destroy()--recenter the GUI
|
frame.parent.add{type='frame',name='temp'}.destroy()--recenter the GUI
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function center.open_tab(player,center,tab)
|
||||||
|
local player = Game.get_player(player)
|
||||||
|
if not Gui.center.open(player,center) then return false end
|
||||||
|
local name = center..'_'..tab
|
||||||
|
if not Gui._get_data('inputs_button')[name] then return false end
|
||||||
|
Gui._get_data('inputs_button')[name].events[defines.events.on_gui_click]{
|
||||||
|
element=Gui.center.get_flow(player)[center].tab_bar.tab_bar_scroll.tab_bar_scroll_flow[name],
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
--- If deafult draw is used then you can add tabs to the gui with this function
|
--- If deafult draw is used then you can add tabs to the gui with this function
|
||||||
-- @usage _center:add_tab('foo','Foo','Just a tab',function)
|
-- @usage _center:add_tab('foo','Foo','Just a tab',function)
|
||||||
-- @tparam string name this is the name of the tab
|
-- @tparam string name this is the name of the tab
|
||||||
|
|||||||
Reference in New Issue
Block a user