mirror of
https://github.com/Oarcinae/FactorioScenarioMultiplayerSpawn.git
synced 2025-02-15 13:33:33 +02:00
Fixing some bugs with enter/exit on top left gui.
This commit is contained in:
parent
eaf738f0ae
commit
fc5b6b2a50
@ -61,6 +61,7 @@ function InitOarcGuiTabs(player)
|
|||||||
AddOarcGuiTab(player, OARC_NOTEPAD_GUI_TAB_NAME)
|
AddOarcGuiTab(player, OARC_NOTEPAD_GUI_TAB_NAME)
|
||||||
SetOarcGuiTabEnabled(player, OARC_NOTEPAD_GUI_TAB_NAME, true)
|
SetOarcGuiTabEnabled(player, OARC_NOTEPAD_GUI_TAB_NAME, true)
|
||||||
|
|
||||||
|
HideOarcGui(player)
|
||||||
end
|
end
|
||||||
|
|
||||||
function CreateOarcGuiButton(player)
|
function CreateOarcGuiButton(player)
|
||||||
@ -84,14 +85,18 @@ function IsOarcGuiVisible(player)
|
|||||||
return (of.visible)
|
return (of.visible)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ToggleOarcGuiVisible(player)
|
function ShowOarcGui(player)
|
||||||
local of = mod_gui.get_frame_flow(player)[OARC_GUI]
|
local of = mod_gui.get_frame_flow(player)[OARC_GUI]
|
||||||
if (of ~= nil) then
|
if (of == nil) then return end
|
||||||
of.visible = not of.visible
|
of.visible = true
|
||||||
if (of.visible) then
|
player.opened = of
|
||||||
player.opened = of -- This allows us to indicate the player has this GUI open and when they press Esc we'll get an event!
|
end
|
||||||
end
|
|
||||||
end
|
function HideOarcGui(player)
|
||||||
|
local of = mod_gui.get_frame_flow(player)[OARC_GUI]
|
||||||
|
if (of == nil) then return end
|
||||||
|
of.visible = false
|
||||||
|
player.opened = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
function GetOarcGuiTabsPane(player)
|
function GetOarcGuiTabsPane(player)
|
||||||
@ -118,8 +123,10 @@ function ClickOarcGuiButton(event)
|
|||||||
if (not DoesOarcGuiExist(player)) then
|
if (not DoesOarcGuiExist(player)) then
|
||||||
CreateOarcGuiTabsPane(player)
|
CreateOarcGuiTabsPane(player)
|
||||||
else
|
else
|
||||||
ToggleOarcGuiVisible(player)
|
|
||||||
if (IsOarcGuiVisible(player)) then
|
if (IsOarcGuiVisible(player)) then
|
||||||
|
HideOarcGui(player)
|
||||||
|
else
|
||||||
|
ShowOarcGui(player)
|
||||||
FakeTabChangeEventOarcGui(player)
|
FakeTabChangeEventOarcGui(player)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -188,7 +195,6 @@ end
|
|||||||
function AddOarcGuiTab(player, tab_name, content_function)
|
function AddOarcGuiTab(player, tab_name, content_function)
|
||||||
if (not DoesOarcGuiExist(player)) then
|
if (not DoesOarcGuiExist(player)) then
|
||||||
CreateOarcGuiTabsPane(player)
|
CreateOarcGuiTabsPane(player)
|
||||||
ToggleOarcGuiVisible(player)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Get the tabbed pane
|
-- Get the tabbed pane
|
||||||
@ -226,12 +232,6 @@ function AddOarcGuiTab(player, tab_name, content_function)
|
|||||||
if (otabs.selected_tab_index == nil) then
|
if (otabs.selected_tab_index == nil) then
|
||||||
otabs.selected_tab_index = 1
|
otabs.selected_tab_index = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
-- if (global.oarc_gui_tab_funcs == nil) then
|
|
||||||
-- global.oarc_gui_tab_funcs = {}
|
|
||||||
-- end
|
|
||||||
|
|
||||||
-- global.oarc_gui_tab_funcs[tab_name] = content_function
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -278,6 +278,6 @@ end
|
|||||||
|
|
||||||
function OarcGuiOnGuiClosedEvent(event)
|
function OarcGuiOnGuiClosedEvent(event)
|
||||||
if (event.element and (event.element.name == "oarc_gui")) then
|
if (event.element and (event.element.name == "oarc_gui")) then
|
||||||
ToggleOarcGuiVisible(game.players[event.player_index])
|
HideOarcGui(game.players[event.player_index])
|
||||||
end
|
end
|
||||||
end
|
end
|
Loading…
x
Reference in New Issue
Block a user