-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFonForgotScript.cs
More file actions
110 lines (102 loc) · 3 KB
/
Copy pathFonForgotScript.cs
File metadata and controls
110 lines (102 loc) · 3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class FonForgotScript : MonoBehaviour
{
public TMP_InputField login;
public Image mail;
public GameObject confirmed;
public GameObject invalid;
public string userLogin;
public bool sended = false;
public void OnEnable()
{
sended = false;
AppManager.Instance.BottomBar.SetActive(false);
userLogin = PlayerPrefs.GetString("userLogin");
Verify();
if (login.text == "")
{
Selected();
}
}
async public void Restore()
{
var AM = AppManager.Instance;
if (!sended && login.text != "")
{
sended = true;
AM.userInfo.user.phone = login.text;
PlayerPrefs.SetString("userLogin", AM.userInfo.user.phone.ToString());
string postData = JsonUtility.ToJson(AM.userInfo.user);
await WebRequests.Request.RequestPost("user/register", postData, (code, response) =>
{
if (code == 200)
{
AM.SwitchScreen(11);
}
}, false);
}
}
public void Verify()
{
if (login.text == userLogin)
{
confirmed.SetActive(true);
invalid.SetActive(false);
}
else
{
confirmed.SetActive(false);
invalid.SetActive(true);
}
if (login.text == "")
{
Selected();
}
}
public async void Deselect()
{
var AM = AppManager.Instance;
if (login.text == "")
{
mail.color = new Color32(61, 61, 61, 255);
login.GetComponent<Image>().color = new Color32(246, 249, 244, 255);
invalid.SetActive(false);
confirmed.SetActive(false);
}
else
{
await WebHandler.Instance.GetDataWrapper((repl) =>
{
JsonUtility.FromJsonOverwrite(repl, AM);
for (int i = 0; i < AM.res.emails.Count; i++)
if (AM.res.emails[i] == login.text)
{
confirmed.SetActive(true);
invalid.SetActive(false);
}
});
}
}
public void Selected()
{
mail.color = new Color32(61, 61, 61, 255);
login.GetComponent<Image>().color = new Color32(246, 249, 244, 255);
invalid.SetActive(false);
confirmed.SetActive(false);
}
public void Changed()
{
if (login.text.Length > 0)
{
mail.color = new Color32(101, 143, 32, 255);
login.GetComponent<Image>().color = new Color32(255, 255, 255, 255);
}
else
{
mail.color = new Color32(61, 61, 61, 255);
login.GetComponent<Image>().color = new Color32(246, 249, 244, 255);
}
}
}