private void DrawError(XsollaError error) { if (mainScreenContainer != null) { currentActive = ActiveScreen.ERROR; GameObject errorScreen = Instantiate(Resources.Load(PREFAB_SCREEN_ERROR)) as GameObject; errorScreen.transform.SetParent(mainScreenContainer.transform); errorScreen.GetComponent <RectTransform> ().anchoredPosition = new Vector2(0, 0); mainScreenContainer.GetComponentInParent <ScrollRect> ().content = errorScreen.GetComponent <RectTransform> (); ScreenErrorController controller = errorScreen.GetComponent <ScreenErrorController> (); controller.ErrorHandler += OnErrorRecivied; controller.DrawScreen(error); } else { GameObject errorScreen = Instantiate(Resources.Load(PREFAB_SCREEN_ERROR_MAIN)) as GameObject; errorScreen.transform.SetParent(container.transform); Text[] texts = errorScreen.GetComponentsInChildren <Text>(); texts[1].text = "Somthing went wrong"; texts[2].text = error.errorMessage; texts[3].text = error.errorCode.ToString(); texts[3].gameObject.SetActive(false); Resizer.ResizeToParrent(errorScreen); } }
private void OpenError(XsollaError error) { currentActive = ActiveScreen.ERROR; GameObject errorScreen = Instantiate(Resources.Load("Prefabs/Screens/ScreenError")) as GameObject; errorScreen.transform.SetParent(mainScreenContainer.transform); errorScreen.GetComponent <RectTransform> ().anchoredPosition = new Vector2(0, 0); mainScreenContainer.GetComponentInParent <ScrollRect> ().content = errorScreen.GetComponent <RectTransform> (); ScreenErrorController controller = errorScreen.GetComponent <ScreenErrorController> (); controller.ErrorHandler += OnErrorRecivied; controller.DrawScreen(error); }