12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- using UnityEngine;
- using System.Collections;
- public class StartRegistrationButtonHandler : MonoBehaviour {
- public UILabel Label;
- public GameObject UIWarning;
- public MessageCodeCap UIMessage;
- public ScreenBase RegScreen;
- void Start()
- {
- UIWarning.SetActive(false);
- }
- void OnClick()
- {
- if (Label.text == string.Empty || Label.text == "Namn...")
- {
- UIWarning.SetActive(true);
- }
- else
- {
- ServerGiftManager.Instance.RegisterSantaName(Label.text, state =>
- {
- switch (state)
- {
- case ServerGiftManager.RegistrationStates.UpdateDone:
- transform.parent.GetComponent<ScreenBase>().Hide();
- LoginManager.Instance.ThirdEnter.SetActive(true);
- //RegScreen.Show();
- Debug.Log("new");
- //todo: handle - user info was updated (everything goes good)
- break;
- case ServerGiftManager.RegistrationStates.Old:
- Debug.Log("Old");
- //todo: handle - old user returns (everything goes good)
- break;
- case ServerGiftManager.RegistrationStates.SantaNameNotUnique:
- UIMessage.LabelMessage.text = "Tyvärr är namnet redan upptaget";
- UIMessage.GetComponent<ScreenBase>().Show();
- UIMessage.GetComponent<UIPanel>().alpha = 1;
- Debug.Log("SantaNameNotUnique");
- //todo: handle - user should guess another name for santa (no data was updated!)
- break;
- case ServerGiftManager.RegistrationStates.IdentificatorNotIsset:
- Debug.Log("IdentificatorNotIsset");
- //todo: handle - you must run base registration first! (no data was updated!)
- break;
- case ServerGiftManager.RegistrationStates.ContactsIsNotEnough:
- Debug.Log("ContactsIsNotEnough");
- //todo: handle - santaName or phone or e-mail is empty (no data was updated!)
- break;
- case ServerGiftManager.RegistrationStates.Error:
- UIMessage.LabelMessage.text = "Okänt fel";
- UIMessage.GetComponent<ScreenBase>().Show();
- Debug.Log("Error");
- //todo: handle - unknown error happens - maybe internet connection errors (no data was updated!)
- break;
- }
-
- });
- }
- }
- }
|