private static T DisplayDialog <T>(BaseDialog.Options _options, string _dialogName = null) where T : BaseDialog { T result = null; if (string.IsNullOrEmpty(_dialogName)) { _dialogName = typeof(T).Name; } result = ViewCanvas.Instance.DisplayDialog <T>(_dialogName); if (result != null) { result.Populate(_options); } else { LogHelper.LogWarning("Failed to display " + typeof(T).Name + " dialog named " + _dialogName ); } return(result); }
public override void Populate(BaseDialog.Options _options) { base.Populate(_options); Options twoButtonOptions = _options as TwoButtonsDialog.Options; if (twoButtonOptions != null) { if (rightButton != null) { SetActive(rightButton.gameObject, twoButtonOptions.showRightButton); m_onRightButtonClick = twoButtonOptions.onRightButtonClick; } SetText(rightButtonText, twoButtonOptions.rightButtonText); if (leftButton != null) { SetActive(leftButton.gameObject, twoButtonOptions.showLeftButton); m_onLeftButtonClick = twoButtonOptions.onLeftButtonClick; } SetText(leftButtonText, twoButtonOptions.leftButtonText); SetText(messageText, twoButtonOptions.messageText); } else { LogHelper.LogWarning("Failed to populate " + GetType().Name + "; " + nameof(_options) + " is not of type " + typeof(TwoButtonsDialog.Options).Name, this ); } }