What i wanted to do is Adding something to the HUD_SCENE and HUD_UI_SCENE.
But within this i wanted the option to set it Hidden, when the user decides to hide it.
this works at the first Moment with a simple control:SetHidden(true) but then after opening a map or another SCENE, the window will pop up if i go back to the HUD_SCENE or HUD_UI_SCENE no matter if it was hidden before or not. (that was ment with losing visible status)
i think i misunderstood the way the SCENE_MANAGER works.
Originally Posted by Garkin
If you add scene fragment to the scene, it means that fragment should be visible when scene is shown.
|
Thats the point. I thought you just attach them to the scene and can handle them like you want. But this only works within this "SCENE-Session".
I think ill use the way to attach them when they should be visible and remove them when they should be hidden.
Edit:
Okay, i did it now that way and i works really well
Lua Code:
--function to show / hide tlw
function AddOn.ShowHide()
if(tlw:IsHidden() == true)then
AddedFrag = AddOn.AddUiFragment(tlw)
else
AddOn.RemUiFragment(AddedFrag)
end
end
--function to Add Toplevelwindows to HUD Scene to Hide if another SCENE opens
function AddOn.AddUiFragment(NewFragment)
local Hud = SCENE_MANAGER:GetScene("hud")
local HudUI = SCENE_MANAGER:GetScene("hudui")
local fragment = ZO_SimpleSceneFragment:New(NewFragment)
Hud:AddFragment(fragment)
HudUI:AddFragment(fragment)
return fragment
end
--function to Remove Toplevelwindows from HUD Scene
function AddOn.RemUiFragment(OldFragment)
local Hud = SCENE_MANAGER:GetScene("hud")
local HudUI = SCENE_MANAGER:GetScene("hudui")
Hud:RemoveFragment(OldFragment)
HudUI:RemoveFragment(OldFragment)
end