/// <summary> /// Handle receiveing / displaying a system error /// </summary> /// <param name="coreErrorVO"></param> protected override void OnCoreError(CoreErrorVO coreErrorVO) { base.OnCoreError(coreErrorVO); // Create an error dialog GameObject errorDialogGameObject = GameObject.Instantiate(Resources.Load(coreErrorVO.template) as GameObject); // Get the error dialog component CoreDialogComponent coreDialogComponent = errorDialogGameObject.GetComponent <CoreDialogComponent>(); if (coreDialogComponent == null) { DebugLogger.LogError("Error dialog component does not contain CoreErrorDialogComponent"); return; } coreDialogComponent.SetTitleText(coreErrorVO.title); coreDialogComponent.SetMessageText(coreErrorVO.message); coreDialogComponent.SetButtonText(coreErrorVO.buttonText); coreDialogComponent.SetButtonActive(coreErrorVO.buttonActive); // Destroy dialog on button click coreDialogComponent.OnDialogButtonClick += () => { GameObject.Destroy(errorDialogGameObject); if (coreErrorVO.callback != null) { coreErrorVO.callback.Invoke(); } ; }; // Add the dialog component to the VO coreErrorVO.coreDialogComponent = coreDialogComponent; // Send it back to the system SendNotification(CoreNote.ERROR_DIALOG_CREATED, coreErrorVO); }
/// <summary> /// Handle receieving errors /// </summary> /// <param name="coreErrorVO"></param> protected virtual void OnCoreError(CoreErrorVO coreErrorVO) { }