ChangePass.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using LitJson;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6. public class ChangePass : MonoBehaviour
  7. {
  8. public GameObject savesuccess;
  9. public GameObject terror;
  10. public GameObject terror2;
  11. public InputField inputold;
  12. public InputField inputnew1;
  13. public InputField inputnew2;
  14. public void changepass()
  15. {
  16. string oldpass = AesEncryption.Encrypt(inputold.text);
  17. string encrypted1 = AesEncryption.Encrypt(inputnew1.text);
  18. string encrypted2 = AesEncryption.Encrypt(inputnew1.text);
  19. if(encrypted1==encrypted2)
  20. {
  21. DataManager.Instance.setPass(oldpass,encrypted1,(msg) => {
  22. JsonData d = JsonMapper.ToObject(msg);
  23. if(d["data"]==null)
  24. {
  25. terror.SetActive(true);
  26. }
  27. else
  28. {
  29. terror2.SetActive(false);
  30. terror.SetActive(false);
  31. savesuccess.SetActive(true);
  32. Invoke("savecloes",2f);
  33. }
  34. });
  35. }
  36. else
  37. {
  38. terror2.SetActive(true);
  39. }
  40. }
  41. void savecloes()
  42. {
  43. savesuccess.SetActive(false);
  44. MainCenterManager.Instance.showMain();
  45. }
  46. }