using UnityEngine; using System.Collections; public class EnterPhoneButton : MonoBehaviour { public UIInput Telephone; public CheckBoxConditionsHandler CheckBoxConditionsHandler; public UIButton Ok; // Use this for initialization void Start() { Ok.onClick.Add(new EventDelegate(ClickOk)); } void OnEnable() { Telephone.text = "Telefonnummer..."; } private bool DoneMail; private bool DonePhone; private void ClickOk() { if (ChekingTelephone(Telephone.text)) { Debug.Log("Telephone success"); } else { LoginManager.Instance.WrongNumberPhone.Show(); GetComponent().Hide(); } if (CheckBoxConditionsHandler.Check) { Debug.Log("Check success"); } if (ChekingTelephone(Telephone.text) && CheckBoxConditionsHandler.Check) { ServerGiftManager.Instance.RegisterPhone(Telephone.text, states => onDonePhone()); NGUIMenuScript.Instance.CurStatePopup = NGUIMenuScript.StatesMenuForPopup.Popup; NGUIMenuScript.Instance.ShowMenu(NGUIMenuScript.NGUIMenus.LeaderBoardNew); NGUIMenuScript.Instance.CloseMenu(NGUIMenuScript.NGUIMenus.GameOver); } } private void onDonePhone() { Debug.Log("onDonePhone"); PlayerPrefs.SetInt("Phone", 1); DonePhone = true; } private void onDoneMail() { Debug.Log("onDonePhone"); PlayerPrefs.SetInt("Mail", 1); DoneMail = true; } bool ChekingTelephone(string telephone) { RegexUtilities util = new RegexUtilities(); return util.IsValidPhone(telephone); } }