only enable main menu canvas in startup scene

This commit is contained in:
in0finite 2020-04-19 00:03:48 +02:00
parent 8cf1c143df
commit 76aad79d40
2 changed files with 5 additions and 7 deletions

View file

@ -689,6 +689,7 @@ MonoBehaviour:
spaceAtBottom: 40
spaceBetweenButtons: 30
openedWindowTextColor: {r: 0, g: 1, b: 0, a: 1}
canvas: {fileID: 4580190521452898284}
buttonsContainer: {fileID: 8593699161208457630}
buttonPrefab: {fileID: 9144763033384219215, guid: c5e7e3e4ef714514090db34e6278e452,
type: 3}

View file

@ -21,6 +21,7 @@ namespace SanAndreasUnity.UI
static MenuEntry s_rootMenuEntry = new MenuEntry();
public Canvas canvas;
public RectTransform buttonsContainer;
public GameObject buttonPrefab;
@ -36,16 +37,12 @@ namespace SanAndreasUnity.UI
clickAction = () => GameManager.ExitApplication() });
}
void OnGUI ()
void OnSceneChanged(SceneChangedMessage sceneChangedMessage)
{
if (!GameManager.IsInStartupScene)
return;
// draw main menu gui
this.canvas.enabled = GameManager.IsInStartupScene;
}
public static bool DrawMenuEntry(string text)
{
return GUIUtils.ButtonWithCalculatedSize(text, Instance.minButtonWidth, Instance.minButtonHeight);