using System;
using System.Text.RegularExpressions;
using Cute;
using UnityEngine;

public class NtDataTranslateInput : MonoBehaviour
{
	public UIInput InputEmail1;

	public UIInput InputEmail2;

	public string EmailAddress;

	private NtDataTranslateInfo info;

	private string checkInput()
	{
		string result = string.Empty;
		string value = InputEmail1.value;
		string value2 = InputEmail2.value;
		if (string.IsNullOrEmpty(value))
		{
			result = info.emailAddressTip2;
		}
		else if (!Regex.IsMatch(value, "(?i)^([a-z0-9\\+_\\-]+)(\\.[a-z0-9\\+_\\-]+)*@([a-z0-9\\-]+\\.)+[a-z]{2,6}$"))
		{
			result = info.emailAddressTip2;
		}
		else if (!value2.Equals(value))
		{
			result = info.emailAddressTip1;
		}
		return result;
	}

	public void UpLoadEmail(Action callback)
	{
		string text = checkInput();
		if (string.IsNullOrEmpty(text))
		{
			EmailAddress = InputEmail1.value;
			callback.Call();
			return;
		}
		DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
		dialogBase.SetTitleLabel(info.ERROR_TITLE);
		dialogBase.SetText(text);
		dialogBase.SetButtonLayout(DialogBase.ButtonLayout.DecisionBtn);
		dialogBase.SetPanelDepth(6000);
	}
}
