Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void RegisterButton()
- {
- if (CreateStepOne() == "01")
- {
- NoticePanel.SetActive(true);
- NoticePanel.transform.GetChild(0).GetComponent<Text>().text = "Please enter username";
- return;
- }
- else if (CreateStepOne() == "02")
- {
- NoticePanel.SetActive(true);
- NoticePanel.transform.GetChild(0).GetComponent<Text>().text = "Please enter password";
- return;
- }
- else if (CreateStepOne() == "03")
- {
- NoticePanel.SetActive(true);
- NoticePanel.transform.GetChild(0).GetComponent<Text>().text = "Your username is dupilcated";
- return;
- }
- else
- {
- newRequest = URL + "user/add/user?" + CreateStepOne();
- }
- createPanel.SetActive(true);
- }
- public void CreateNameButton()
- {
- if (SetName() == "04")
- {
- NoticePanel.SetActive(true);
- createPanel.SetActive(false);
- NoticePanel.transform.GetChild(0).GetComponent<Text>().text = "Please Enter Your Name";
- return;
- }
- else if (SetName() == "05")
- {
- NoticePanel.SetActive(true);
- createPanel.SetActive(false);
- NoticePanel.transform.GetChild(0).GetComponent<Text>().text = "Your name is dupilcated to someone";
- return;
- }
- else
- {
- int newScore = Random.Range(0, 999999999);
- newRequest = URL + "user/add/user?" + CreateStepOne() + SetName() + "score=" + newScore;
- HttpWebRequest request = (HttpWebRequest)WebRequest.Create(newRequest);
- HttpWebResponse response = (HttpWebResponse)request.GetResponse();
- Stream stream = response.GetResponseStream();
- string responseBody = new StreamReader(stream).ReadToEnd();
- print(responseBody);
- }
- }
- public string CreateStepOne()
- {
- string newText = "";
- if (userText.text != null)
- {
- for (int i = 0; i < players.Length; i++)
- {
- if (userText.text == players[i].username)
- {
- return "03";
- }
- }
- newText += ("username=" + userText.text + "&");
- newUser = userText.text;
- }
- else
- {
- return "01";
- }
- if (passText.text != null)
- {
- newText += ("pass=" + passText.text + "&");
- newPassword = passText.text;
- createPanel.SetActive(true);
- return newText;
- }
- else
- {
- return "02";
- }
- }
- public string SetName() {
- string newText;
- if (nameText.text != null)
- {
- for (int i = 0; i < players.Length; i++)
- {
- if (nameText.text == players[i].name)
- {
- return "05";
- }
- }
- newName = nameText.text;
- newText = ("name=" + nameText.text + "&");
- return newText;
- }
- else
- {
- return "04";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement