/* 로그인 시도 */ public void tryLogin() { ArrayList array = new ArrayList(); array.Add(new KeyValuePair <string, string>("id", loginWindow.GetComponent <loginWindowBehavior>().idField.text)); array.Add(new KeyValuePair <string, string>("password", loginWindow.GetComponent <loginWindowBehavior>().passwordField.text)); /* * array 에 id와 password를 받음. 통과하면 로그인 성공 */ SignJson resultJson = new SignJson(); transportManager.GetComponent <Transport>().SendPost("/login", array, resultJson, (jsonObject) => { SignJson result = (SignJson)jsonObject; if (result.success.Equals("true")) { transportManager.GetComponent <Transport>().SendGet("/api/user/" + ((KeyValuePair <string, string>)array[0]).Value , new UserResultJson(), (userJsonObject) => { UserResultJson user_result = (UserResultJson)userJsonObject; Debug.Log(user_result); dataManager.GetComponent <StaticDataManager>().dataMap.Add("map_name", user_result.data.cur_map_name); dataManager.GetComponent <StaticDataManager>().dataMap.Add("user", user_result.data); Debug.Log(user_result.data.cur_map_name); SceneManager.LoadScene("Scenes/" + user_result.data.cur_map_name + "Scene"); }); } else { Debug.Log("응 아니야~"); } }); }
/* 회원가입 시도 */ public void tryNewAccount() { ArrayList array = new ArrayList(); array.Add(new KeyValuePair <string, string>("id", loginWindow.GetComponent <loginWindowBehavior>().idField.text)); array.Add(new KeyValuePair <string, string>("password", loginWindow.GetComponent <loginWindowBehavior>().passwordField.text)); array.Add(new KeyValuePair <string, string>("name", "test")); SignJson signJson = new SignJson(); transportManager.GetComponent <Transport>().SendPost("/signup", array, signJson, (jsonObject) => { SignJson result = (SignJson)jsonObject; if (result.success.Equals("true")) { Debug.Log("로그인 하세요!"); } else { Debug.Log("오류 ...."); } }); }