123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- 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<ScreenBase>().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);
- }
- }
|