skip gui layout phase when window is not drawn

This commit is contained in:
in0finite 2019-08-30 17:14:44 +02:00
parent 617185f8ea
commit 2eabea6626

View file

@ -32,6 +32,21 @@ namespace SanAndreasUnity.UI {
} }
} }
private bool ShouldBeDrawn {
get {
if (Behaviours.Loader.IsLoading)
return false;
if (!this.IsOpened)
return false;
if (!PauseMenu.IsOpened && !Behaviours.GameManager.IsInStartupScene)
return false;
return true;
}
}
[SerializeField] private bool m_destroyOnClose = false; [SerializeField] private bool m_destroyOnClose = false;
public bool DestroyOnClose { get { return m_destroyOnClose; } set { m_destroyOnClose = value; } } public bool DestroyOnClose { get { return m_destroyOnClose; } set { m_destroyOnClose = value; } }
@ -139,14 +154,14 @@ namespace SanAndreasUnity.UI {
this.WindowStart (); this.WindowStart ();
} }
if (Behaviours.Loader.IsLoading)
return;
if (!this.IsOpened) if (!this.ShouldBeDrawn)
{
this.useGUILayout = false;
return; return;
}
if (!Behaviours.GameManager.IsInStartupScene && !PauseMenu.IsOpened) this.useGUILayout = true;
return;
Rect newRect; Rect newRect;