123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281 |
- using UnityEngine;
- using System.Collections;
- using System;
- using System.Collections.Generic;
- public class LoginManager : MonoBehaviour
- {
-
- public bool StartNoNumberCompetitions;
- public static LoginManager Instance;
- public ScreenBase CurScreenCodeEnter;
- public ScreenBase WrongLoginConnect;
- public ScreenBase WrongNumberPhone;
- public ScreenBase CouponBase;
- public ScreenBase CouponNumberWronge;
- public ScreenBase Login;
- public GameObject BackMessageCoupone;
- public ScreenBase ScreenCouponeGet;
- // public ScreenBase OverCompanyMessage;
- public ScreenBase ScreenSendSmsMessages;
- public List<UILabel> LabelsAfter28;
- public List<UILabel> Labels;
- public UIAnchor AnchorGameOverBack;
- public List<GameObject> CouponeObjects;
- public ScreenBase EnterCode;
- public ScreenBase EnterCodeWrong;
- public ScreenBase EnterCodeInternetError;
- public ScreenBase CouponGetEnterNumber;
- public ScreenBase CouponGetEnterNumberWrong;
- public ScreenBase CouponGetEnterNumberNoConnect;
- public List<ButtonWithTwoStates> ButtonsCoupon;
- public bool LoginOpen;
- public ScreenBase WrongConnectMessages;
- public ScreenBase WrongMessages;
- public ScreenBase GreatingMessages;
- public ScreenBase StartLevelMessages;
- public ScreenBase PopupLifeEndMessages;
- public enum StateCountryTelephoneCode
- {
- Danmark,
- Ukraine,
- Iceland
- }
-
- public StateCountryTelephoneCode CurStateCountryCodePhone;
- public bool GetCoupon;
- //public int MaxEnterCode;
- //public int CountEnterCode = 5;
- public DateTime TimeOverCompany;
- public bool OVERGAME;
- public ScreenBase GameOverVideoAdsLife;
- public PowerupsMainControllerCS hPowerupsMainControllerCS;
- private ControllerScriptCS hControllerScriptCS;
- public ScreenBase TutorDone;
- public bool Age;
- public ScreenBase OverGameMessage;
- public GameObject ThirdEnter;
- public GameObject FirstEnter;
- public void CouponeClosedWin()
- {
- //TooltipLastterController.Instance.NotificaionHide();
- NGUIMenuScript.Instance.CurStatePopup = NGUIMenuScript.StatesMenuForPopup.None;
- NGUIMenuScript.Instance.ShowMenu(NGUIMenuScript.NGUIMenus.ChangeLevel);
- NGUIMenuScript.Instance.CloseMenu(NGUIMenuScript.NGUIMenus.GameOver);
- NGUIMenuScript.Instance.toggleHUDGroupState(false, false);
- InGameScriptCS.Instance.bGamePaused = true;
- DefaultPositionPlayerAndWorld();
- PlayerControllerLevels.Instance.UpdatePlayerPosition();
- }
- public void OnClickOkLevelDone()
- {
- //if (PlayerPrefs.GetInt("GetCoupon") == 0)
- {
- TooltipLastterController.Instance.NotificaionHide();
- NGUIMenuScript.Instance.CurStatePopup = NGUIMenuScript.StatesMenuForPopup.None;
- NGUIMenuScript.Instance.ShowMenu(NGUIMenuScript.NGUIMenus.ChangeLevel);
- NGUIMenuScript.Instance.toggleHUDGroupState(false, false);
- InGameScriptCS.Instance.bGamePaused = true;
- DefaultPositionPlayerAndWorld();
- PlayerControllerLevels.Instance.UpdatePlayerPosition();
- }
- //else
- //{
- // TooltipLastterController.Instance.NotificaionHide();
- // CouponGetEnterNumber.Show();
- //}
- PlayerControllerLevels.Instance.AllDistance = PlayerControllerLevels.Instance.AllDistance + (int)hControllerScriptCS.getCurrentMileage();
- PlayerControllerLevels.Instance.AllGifts = PlayerControllerLevels.Instance.AllGifts + (int)hPowerupsMainControllerCS.getCurrencyUnits();
- PlayerControllerLevels.Instance.AllPoint = PlayerControllerLevels.Instance.AllPoint + (int)(hControllerScriptCS.getCurrentMileage() + hPowerupsMainControllerCS.getCurrencyUnits() * 3) + TooltipLastterController.Instance.PontWords;
- }
- public void DefaultPositionPlayerAndWorld()
- {
-
- }
- public bool OverLogin ()
- {
- //if ( DateTime.UtcNow.Year == 2016)
- //{
- // if (DateTime.UtcNow.Hour > 0 && DateTime.UtcNow.Minute > 0 && DateTime.UtcNow.Second > 0)
- // {
- // Debug.Log("OverLogin 1" );
- // return true;
- // }
- //}
- return false;
- }
- public bool OverCoupone()
- {
- //if (DateTime.UtcNow.Year == 2016)
- //{
-
- // Debug.Log("OverCoupone 1");
- // return true;
-
- //}
- return false;
- }
-
- void Start()
- {
- Instance = this;
- if (PlayerPrefs.GetInt("FirstEnterPage") == 1 && !string.IsNullOrEmpty(RegistrationManager.Instance.CurName) && PlayerPrefs.GetInt("FirstEnter") == 0)
- {
- ThirdEnter.SetActive(true);
- //FirsEnter.Show();
- }
- if (PlayerPrefs.GetInt("FirstEnterPage") == 0)
- {
- FirstEnter.SetActive(true);
- //FirsEnter.Show();
- }
- PlayerPrefs.SetInt("Level", 1);
-
- TouchScreenKeyboard.hideInput = true;
- StartCoroutine(Init());
- hControllerScriptCS = (ControllerScriptCS)GameObject.Find("Player").GetComponent(typeof(ControllerScriptCS));
- hPowerupsMainControllerCS = (PowerupsMainControllerCS)GameObject.Find("Player").GetComponent(typeof(PowerupsMainControllerCS));
- ServerGiftManager.Instance.GetAgeAction(state =>
- {
- string str = state.ToString();
- switch (str)
- {
- case "1":
- //StartCoroutine(EnterNameDialog());
- RegistrationManager.Instance.AgeActive = true;
- break;
- case "0":
-
- break;
- }
- });
- //if (DateTime.UtcNow.Year == 2017)
- //{
- // Debug.Log("DateTime");
- // OverGameMessage.gameObject.SetActive(true);
- // OverGameMessage.Show();
- // //OVERGAME = true;
-
- //}
- //else
- //{
- // Debug.Log("DateTime 0");
- //}
- if (OverLogin())
- {
- foreach (var l in Labels)
- {
- l.gameObject.SetActive(false);
- }
- //foreach (var l in LabelsAfter28)
- //{
- // l.gameObject.SetActive(true);
- //}
- //Destroy(Login.gameObject);
- }
- else
- {
- foreach (var l in Labels)
- {
- l.gameObject.SetActive(true);
- }
- //foreach (var l in LabelsAfter28)
- //{
- // l.gameObject.SetActive(false);
- //}
-
- }
- if (OverCoupone())
- {
- foreach (var l in CouponeObjects)
- {
- l.gameObject.SetActive(false);
- }
- AnchorGameOverBack.relativeOffset = new Vector2(0.0f,0.08f);
- Destroy(CouponGetEnterNumber.gameObject);
- }
-
-
- //Debug.Log(DateTime.UtcNow + " " + DateTime.UtcNow.Date.Month + " " + DateTime.UtcNow.Year +" " + DateTime.UtcNow.Hour);
- }
- private IEnumerator Init()
- {
- yield return new WaitForSeconds(1f);
- if (WrongLoginConnect != null)
- {
- yield return new WaitForSeconds(1f);
- }
- else
- {
- WrongLoginConnect = (ScreenBase)GameObject.Find("CouponPopupWrongNoConnect1").GetComponent(typeof(ScreenBase));
- WrongNumberPhone = (ScreenBase)GameObject.Find("CouponPopupWrongNumber").GetComponent(typeof(ScreenBase));
- CouponBase = (ScreenBase)GameObject.Find("CouponPopup").GetComponent(typeof(ScreenBase));
- Login = (ScreenBase)GameObject.Find("LoginPopup").GetComponent(typeof(ScreenBase));
- GreatingMessages = (ScreenBase)GameObject.Find("MessageGrearting").GetComponent(typeof(ScreenBase));
- StartLevelMessages= (ScreenBase)GameObject.Find("StartLevelMessages").GetComponent(typeof(ScreenBase));
- EnterCode = (ScreenBase)GameObject.Find("CodeEnter").GetComponent(typeof(ScreenBase));
- EnterCodeWrong = (ScreenBase)GameObject.Find("CodeEnterWrong").GetComponent(typeof(ScreenBase));
- EnterCodeInternetError = (ScreenBase)GameObject.Find("CodeEnterWrongNoConnect").GetComponent(typeof(ScreenBase));
- CouponGetEnterNumber = (ScreenBase)GameObject.Find("CodeEnter").GetComponent(typeof(ScreenBase));
- EnterCodeWrong = (ScreenBase)GameObject.Find("CodeEnterWrong").GetComponent(typeof(ScreenBase));
- EnterCodeInternetError = (ScreenBase)GameObject.Find("CodeEnterWrongNoConnect").GetComponent(typeof(ScreenBase));
- Instance = this;
- WrongLoginConnect.Hide();
- WrongNumberPhone.Hide();
- GreatingMessages.transform.GetComponent<UIPanel>().alpha = 1;
- GreatingMessages.Hide();
-
- //CouponGetEnterNumber.Hide();
- CouponGetEnterNumberWrong.Hide();
- CouponGetEnterNumberNoConnect.Hide();
- yield return new WaitForSeconds(1f);
- }
- }
- void OnEnable()
- {
- //WrongLoginConnect = (ScreenBase)GameObject.Find("CouponPopupWrongNoConnect1").GetComponent(typeof(ScreenBase));
- //WrongNumberPhone = (ScreenBase)GameObject.Find("CouponPopupWrongNumber").GetComponent(typeof(ScreenBase));
- //CouponBase = (ScreenBase)GameObject.Find("CouponPopup").GetComponent(typeof(ScreenBase));
- //Login = (ScreenBase)GameObject.Find("LoginPopup").GetComponent(typeof(ScreenBase));
- //EnterCode = (ScreenBase)GameObject.Find("CodeEnter").GetComponent(typeof(ScreenBase));
- //EnterCodeWrong = (ScreenBase)GameObject.Find("CodeEnterWrong").GetComponent(typeof(ScreenBase));
- //EnterCodeInternetError = (ScreenBase)GameObject.Find("CodeEnterWrongNoConnect").GetComponent(typeof(ScreenBase));
- //CouponGetEnterNumber = (ScreenBase)GameObject.Find("CodeEnter").GetComponent(typeof(ScreenBase));
- //EnterCodeWrong = (ScreenBase)GameObject.Find("CodeEnterWrong").GetComponent(typeof(ScreenBase));
- //EnterCodeInternetError = (ScreenBase)GameObject.Find("CodeEnterWrongNoConnect").GetComponent(typeof(ScreenBase));
- //WrongLoginConnect.Hide();
- //WrongNumberPhone.Hide();
- //CouponGetEnterNumber.Hide();
- //CouponGetEnterNumberWrong.Hide();
- //CouponGetEnterNumberNoConnect.Hide();
- }
- //void OnDestroy()
- //{
- // Destroy(this);
- //}
- }
|