SendCodeButtonHandler.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using UnityEngine;
  2. using System.Collections;
  3. public class SendCodeButtonHandler : MonoBehaviour {
  4. UILabel _input;
  5. CodeColaHelper _cch;
  6. // Use this for initialization
  7. void Start () {
  8. _input = GameObject.Find("_input").GetComponent<UILabel>();
  9. _cch = GameObject.Find("Managers").GetComponent<CodeColaHelper>();
  10. }
  11. // Update is called once per frame
  12. void Update () {
  13. }
  14. public void OnClick()
  15. {
  16. //Debug.Log("CODE : " + _input.text + " CodeLength : " + _input.text.Length);
  17. RegisterCodeMIX.Instance.Activate(_input.text, (state, error) =>
  18. {
  19. switch (state)
  20. {
  21. case RegisterCodeMIX.ActivateStates.OtherError:
  22. //todo: handle error
  23. break;
  24. case RegisterCodeMIX.ActivateStates.RequestOrNetworkError:
  25. //todo: handle error
  26. break;
  27. case RegisterCodeMIX.ActivateStates.CouponAlreadyReedemed:
  28. //todo: handle error
  29. break;
  30. case RegisterCodeMIX.ActivateStates.BadInput:
  31. //todo: handle error
  32. break;
  33. case RegisterCodeMIX.ActivateStates.Done:
  34. //todo: EVERYTHING GOES WELL
  35. break;
  36. }
  37. });
  38. //_cch.StartCheckCode(_input.text);
  39. _input.text = "enter code here";
  40. }
  41. }