public void Show() { _selfPage = Object.Instantiate( _loadObjectsManager.GetObjectByPath <GameObject>("Prefabs/UI/Pages/GameplayPage")); _selfPage.transform.SetParent(_uiManager.Canvas.transform, false); _buttonBack = _selfPage.transform.Find("Button_Back").GetComponent <Button>(); _buttonKeep = _selfPage.transform.Find("Button_Keep").GetComponent <ButtonShiftingContent>(); _buttonBack.onClick.AddListener(BackButtonOnClickHandler); _buttonKeep.onClick.AddListener(KeepButtonOnClickHandler); _reportGameActionsPanel = new ReportPanelItem(_selfPage.transform.Find("ActionReportPanel").gameObject); if (_zippingVfx == null) { _zippingVfx = GameObject.Find("Background/Zapping").gameObject; _zippingVfx.SetActive(false); } if (_gameplayManager.IsTutorial) { _buttonBack.gameObject.SetActive(false); } StartGame(); KeepButtonVisibility(false); }
public void Hide() { _isPlayerInited = false; if (_selfPage == null) { return; } _selfPage.SetActive(false); _reportGameActionsPanel.Dispose(); _reportGameActionsPanel = null; Object.Destroy(_selfPage); _selfPage = null; }